201027
authorhgs
Wed, 21 Jul 2010 18:26:52 +0300
changeset 33 8d5d7fcf9b59
parent 32 1f002146abb4
child 35 6aefa3341fcc
201027
cbs/cbsserver/Bmarm/CBSCLIENTU.DEF
cbs/cbsserver/Bmarm/CBSMCNCLIENTU.DEF
cbs/cbsserver/Bwins/CBSCLIENTU.DEF
cbs/cbsserver/Bwins/CBSMCNCLIENTU.DEF
cbs/cbsserver/Bwins/CBSSERVERU.DEF
cbs/cbsserver/CenRep/keys_cbsserver.xls
cbs/cbsserver/ClientInc/CbsCommon.h
cbs/cbsserver/ClientInc/RCbs.h
cbs/cbsserver/ClientInc/RCbsSettings.h
cbs/cbsserver/ClientInc/RCbsTopicCollection.h
cbs/cbsserver/ClientInc/RCbsTopicList.h
cbs/cbsserver/ClientInc/RCbsTopicMessages.h
cbs/cbsserver/ClientInc/ccbsmessageclientimpl.h
cbs/cbsserver/ClientSrc/RCbs.cpp
cbs/cbsserver/ClientSrc/RCbsSettings.cpp
cbs/cbsserver/ClientSrc/RCbsTopicCollection.cpp
cbs/cbsserver/ClientSrc/RCbsTopicList.cpp
cbs/cbsserver/ClientSrc/RCbsTopicMessages.cpp
cbs/cbsserver/ClientSrc/ccbsmessageclient.cpp
cbs/cbsserver/ClientSrc/ccbsmessageclientimpl.cpp
cbs/cbsserver/Data/CbsServer.rss
cbs/cbsserver/Data/cbsclient.pkg
cbs/cbsserver/Data/cbsclient_stub.pkg
cbs/cbsserver/Data/cbsclient_stub.sis
cbs/cbsserver/Data/cbsmcnclient.pkg
cbs/cbsserver/Data/cbsmcnclient_stub.pkg
cbs/cbsserver/Data/cbsmcnclient_stub.sis
cbs/cbsserver/Data/cbsserver.pkg
cbs/cbsserver/Data/cbsserver_stub.pkg
cbs/cbsserver/Data/cbsserver_stub.sis
cbs/cbsserver/EABI/CbsClientU.DEF
cbs/cbsserver/EABI/CbsMcnClientU.DEF
cbs/cbsserver/EABI/CbsServerU.def
cbs/cbsserver/Group/CbsClient.mmp
cbs/cbsserver/Group/CbsMcnClient.mmp
cbs/cbsserver/Group/CbsServer.mmp
cbs/cbsserver/Group/CbsServerUid.h
cbs/cbsserver/Group/backup_registration.xml
cbs/cbsserver/Group/bld.inf
cbs/cbsserver/McnClientSrc/CCbsMcnListener.cpp
cbs/cbsserver/McnClientSrc/CMcn.cpp
cbs/cbsserver/McnClientSrc/CMcnTopicArray.cpp
cbs/cbsserver/McnClientSrc/CbsMcnPanic.cpp
cbs/cbsserver/McnClientSrc/Rcbsmcnsession.cpp
cbs/cbsserver/McnClientSrc/Rmcnsubsession.cpp
cbs/cbsserver/Rom/CbsServerResources.iby
cbs/cbsserver/Rom/cbsserver.iby
cbs/cbsserver/ServerInc/CCbsBackupMonitor.h
cbs/cbsserver/ServerInc/CCbsDbImp.H
cbs/cbsserver/ServerInc/CCbsDbImpSettings.H
cbs/cbsserver/ServerInc/CCbsDbImpTopicCollection.h
cbs/cbsserver/ServerInc/CCbsDbImpTopicList.h
cbs/cbsserver/ServerInc/CCbsDbImpTopicMessages.h
cbs/cbsserver/ServerInc/CCbsDiskSpaceMonitor.h
cbs/cbsserver/ServerInc/CCbsEtelMessaging.h
cbs/cbsserver/ServerInc/CCbsLivecastHandler.h
cbs/cbsserver/ServerInc/CCbsMcnSession.h
cbs/cbsserver/ServerInc/CCbsMessage.h
cbs/cbsserver/ServerInc/CCbsMessageCleanUpTimer.h
cbs/cbsserver/ServerInc/CCbsMessageFactory.h
cbs/cbsserver/ServerInc/CCbsObject.h
cbs/cbsserver/ServerInc/CCbsRecCollector.h
cbs/cbsserver/ServerInc/CCbsRecDecoder.h
cbs/cbsserver/ServerInc/CCbsRecEtel.h
cbs/cbsserver/ServerInc/CCbsRecEtelMonitor.h
cbs/cbsserver/ServerInc/CCbsRecMessage.h
cbs/cbsserver/ServerInc/CCbsRecNetworkListener.h
cbs/cbsserver/ServerInc/CCbsRecWcdmaMessage.h
cbs/cbsserver/ServerInc/CCbsReceiverHelper.h
cbs/cbsserver/ServerInc/CCbsSatRefresh.h
cbs/cbsserver/ServerInc/CCbsScheduler.h
cbs/cbsserver/ServerInc/CCbsServer.h
cbs/cbsserver/ServerInc/CCbsSession.h
cbs/cbsserver/ServerInc/CCbsSetFilterSettingHandler.h
cbs/cbsserver/ServerInc/CCbsSettings.h
cbs/cbsserver/ServerInc/CCbsShutdownMonitor.h
cbs/cbsserver/ServerInc/CCbsTopicCollection.h
cbs/cbsserver/ServerInc/CCbsTopicList.h
cbs/cbsserver/ServerInc/CCbsTopicMessages.h
cbs/cbsserver/ServerInc/CbsDbConstants.h
cbs/cbsserver/ServerInc/CbsDebug.h
cbs/cbsserver/ServerInc/CbsLogger.h
cbs/cbsserver/ServerInc/CbsReceiverTypes.h
cbs/cbsserver/ServerInc/CbsServerConstants.h
cbs/cbsserver/ServerInc/CbsServerInternalPSKeys.h
cbs/cbsserver/ServerInc/CbsServerPanic.h
cbs/cbsserver/ServerInc/CbsServerPrivateCRKeys.h
cbs/cbsserver/ServerInc/CbsServerTypes.h
cbs/cbsserver/ServerInc/CbsStreamHelper.h
cbs/cbsserver/ServerInc/CbsUtils.h
cbs/cbsserver/ServerInc/MCbsDbObserver.H
cbs/cbsserver/ServerInc/MCbsDbSettingsObserver.H
cbs/cbsserver/ServerInc/MCbsDbTopicCollectionObserver.H
cbs/cbsserver/ServerInc/MCbsDbTopicListObserver.H
cbs/cbsserver/ServerInc/MCbsEtelMessaging.h
cbs/cbsserver/ServerInc/MCbsMcnSubscriptionsProvider.h
cbs/cbsserver/ServerInc/cbsinternalcrkeys.h
cbs/cbsserver/ServerInc/cbsvariant.hrh
cbs/cbsserver/ServerSrc/CCbsBackupMonitor.cpp
cbs/cbsserver/ServerSrc/CCbsDbImp.cpp
cbs/cbsserver/ServerSrc/CCbsDbImpSettings.cpp
cbs/cbsserver/ServerSrc/CCbsDbImpTopicCollection.cpp
cbs/cbsserver/ServerSrc/CCbsDbImpTopicList.cpp
cbs/cbsserver/ServerSrc/CCbsDbImpTopicMessages.cpp
cbs/cbsserver/ServerSrc/CCbsDiskSpaceMonitor.cpp
cbs/cbsserver/ServerSrc/CCbsEtelMessaging.cpp
cbs/cbsserver/ServerSrc/CCbsLivecastHandler.cpp
cbs/cbsserver/ServerSrc/CCbsMcnSession.cpp
cbs/cbsserver/ServerSrc/CCbsMessage.cpp
cbs/cbsserver/ServerSrc/CCbsMessageCleanUpTimer.cpp
cbs/cbsserver/ServerSrc/CCbsMessageFactory.cpp
cbs/cbsserver/ServerSrc/CCbsObject.cpp
cbs/cbsserver/ServerSrc/CCbsRecMessage.cpp
cbs/cbsserver/ServerSrc/CCbsRecWcdmaMessage.cpp
cbs/cbsserver/ServerSrc/CCbsReceiverHelper.cpp
cbs/cbsserver/ServerSrc/CCbsSatRefresh.cpp
cbs/cbsserver/ServerSrc/CCbsScheduler.cpp
cbs/cbsserver/ServerSrc/CCbsServer.cpp
cbs/cbsserver/ServerSrc/CCbsSession.cpp
cbs/cbsserver/ServerSrc/CCbsSetFilterSettingHandler.cpp
cbs/cbsserver/ServerSrc/CCbsSettings.cpp
cbs/cbsserver/ServerSrc/CCbsShutdownMonitor.cpp
cbs/cbsserver/ServerSrc/CCbsTopicCollection.cpp
cbs/cbsserver/ServerSrc/CCbsTopicList.cpp
cbs/cbsserver/ServerSrc/CCbsTopicMessages.cpp
cbs/cbsserver/ServerSrc/CbsServerPanic.cpp
cbs/cbsserver/ServerSrc/CbsStreamHelper.cpp
cbs/cbsserver/ServerSrc/CbsUtils.cpp
cbs/cbsserver/ServerSrc/Ccbsreccollector.cpp
cbs/cbsserver/ServerSrc/Ccbsrecdecoder.cpp
cbs/cbsserver/ServerSrc/Ccbsrecetel.cpp
cbs/cbsserver/ServerSrc/Ccbsrecetelmonitor.cpp
cbs/cbsserver/ServerSrc/Ccbsrecnetworklistener.cpp
cbs/cbsserver/conf/cbsserver.confml
cbs/cbsserver/conf/cbsserver_1020298F.crml
cbs/cbsserver/conf/cbsserver_102078EE.crml
cbs/cbsserver/loc/CbsServer.loc
cbs/cbsui/resources/Copy of cbs_app.docml
cbs/cbsui/rom/cbsuiresources.iby
cellular/psetnotesui/bmarm/psuiu.def
cellular/psetnotesui/bwins/psuiu.def
cellular/psetnotesui/data/psui.rss
cellular/psetnotesui/data/psui_stub.pkg
cellular/psetnotesui/data/psui_stub.sis
cellular/psetnotesui/eabi/psuiu.def
cellular/psetnotesui/group/bld.inf
cellular/psetnotesui/group/psui.mmp
cellular/psetnotesui/inc/psuiinternalconstants.h
cellular/psetnotesui/inc/psuinotecontroller.h
cellular/psetnotesui/inc/psuinotemaster.h
cellular/psetnotesui/inc/psuiquerydialog.h
cellular/psetnotesui/inc/psuireqobserver.h
cellular/psetnotesui/inc/psuiresourceloader.h
cellular/psetnotesui/inc/psuivariationproxy.h
cellular/psetnotesui/loc/psui.loc
cellular/psetnotesui/rom/psui.iby
cellular/psetnotesui/rom/psuiresources.iby
cellular/psetnotesui/src/psuibarringobs.cpp
cellular/psetnotesui/src/psuicliobserver.cpp
cellular/psetnotesui/src/psuicontainer.cpp
cellular/psetnotesui/src/psuidivertobs.cpp
cellular/psetnotesui/src/psuinotecontroller.cpp
cellular/psetnotesui/src/psuinotemaster.cpp
cellular/psetnotesui/src/psuiquerydialog.cpp
cellular/psetnotesui/src/psuireqobserver.cpp
cellular/psetnotesui/src/psuiresourceloader.cpp
cellular/psetnotesui/src/psuivariationproxy.cpp
cellular/psetnotesui/src/psuiwaitingobs.cpp
cellular/psetnotesui/tsrc/public/basic/BWINS/T_PSetNotesUiU.DEF
cellular/psetnotesui/tsrc/public/basic/EABI/T_PSetNotesUiU.DEF
cellular/psetnotesui/tsrc/public/basic/Src/T_PSetNotesUi.cpp
cellular/psetnotesui/tsrc/public/basic/Src/T_PSetNotesUi.h
cellular/psetnotesui/tsrc/public/basic/Src/T_PSetNotesUi_DllMain.cpp
cellular/psetnotesui/tsrc/public/basic/group/T_PSetNotesUi.mmp
cellular/psetnotesui/tsrc/public/basic/group/T_PSetNotesUi.pkg
cellular/psetnotesui/tsrc/public/basic/group/T_PSetNotesUi.sis
cellular/psetnotesui/tsrc/public/basic/group/bld.inf
cellular/psetnotesui/tsrc/public/basic/rom/T_PSetNotesUI.iby
cellular/servicerequest/bmarm/servicerequestu.def
cellular/servicerequest/bwins/servicerequestu.def
cellular/servicerequest/data/servicerequest.rss
cellular/servicerequest/data/servicerequest_stub.pkg
cellular/servicerequest/data/servicerequest_stub.sis
cellular/servicerequest/eabi/servicerequestu.def
cellular/servicerequest/group/bld.inf
cellular/servicerequest/group/servicerequest.mmp
cellular/servicerequest/inc/cservicerequest.h
cellular/servicerequest/inc/mservicerequestobserver.h
cellular/servicerequest/inc/servicerequest.hrh
cellular/servicerequest/rom/servicerequest.iby
cellular/servicerequest/rom/servicerequestresources.iby
cellular/servicerequest/src/cservicerequest.cpp
cellular/sssettings/bwins/sssettingsu.def
cellular/sssettings/eabi/sssettingsu.def
cellular/sssettings/group/bld.inf
cellular/sssettings/group/sssettings.mmp
cellular/sssettings/group/sssettings.pkg
cellular/sssettings/group/sssettings_stub.pkg
cellular/sssettings/group/sssettings_stub.sis
cellular/sssettings/inc/csssettingsactiveobject.h
cellular/sssettings/inc/csssettingsalsnotifier.h
cellular/sssettings/inc/csssettingsnotifier.h
cellular/sssettings/inc/csssettingsrefreshcontainer.h
cellular/sssettings/inc/csssettingsrefreshhandler.h
cellular/sssettings/inc/msssettingsrefreshhandler.h
cellular/sssettings/inc/sssettingsprivatecrkeys.h
cellular/sssettings/inc/sssettingsprivatepskeys.h
cellular/sssettings/logger/sssettingslogger.h
cellular/sssettings/logger/sssettingsloggingconf.h
cellular/sssettings/rom/sssettings.iby
cellular/sssettings/src/csssettingsactiveobject.cpp
cellular/sssettings/src/csssettingsalsnotifier.cpp
cellular/sssettings/src/csssettingsnotifier.cpp
cellular/sssettings/src/csssettingsrefreshcontainer.cpp
cellular/sssettings/src/csssettingsrefreshhandler.cpp
cellular/sssettings/src/rcustomerserviceprofilecache.cpp
cellular/sssettings/src/rsssettings.cpp
cellular/sssettings/tsrc/public/basic/EunitTest/BWINS/MT_SSSettingsu.def
cellular/sssettings/tsrc/public/basic/EunitTest/EABI/MT_SSSettingsu.def
cellular/sssettings/tsrc/public/basic/EunitTest/Group/MT_SSSettings.mmp
cellular/sssettings/tsrc/public/basic/EunitTest/Group/MT_SSSettings.pkg
cellular/sssettings/tsrc/public/basic/EunitTest/Group/MT_SSSettings.sis
cellular/sssettings/tsrc/public/basic/EunitTest/Group/bld.inf
cellular/sssettings/tsrc/public/basic/EunitTest/MT_SSSettings/MT_SSSettings.cpp
cellular/sssettings/tsrc/public/basic/EunitTest/MT_SSSettings/MT_SSSettings.h
cellular/sssettings/tsrc/public/basic/EunitTest/MT_SSSettings/MT_SSSettingsDllMain.cpp
cellular/sssettings/tsrc/public/basic/EunitTest/rom/mt_sssettings.iby
cellular/sssettings/tsrc/public/basic/group/bld.inf
cellular/sssettings/xqbindings/sssettingswrapper/rom/sssettingswrapper.iby
cellular/sssettings/xqbindings/sssettingswrapper/src/logging.h
cellular/sssettings/xqbindings/sssettingswrapper/src/sssettingswrapper.cpp
cellular/sssettings/xqbindings/sssettingswrapper/src/sssettingswrapper_p.cpp
cellular/sssettings/xqbindings/sssettingswrapper/src/sssettingswrapper_p.h
cellular/sssettings/xqbindings/sssettingswrapper/src/sssettingswrapper_s.cpp
cellular/sssettings/xqbindings/sssettingswrapper/sssettingswrapper.pri
cellular/sssettings/xqbindings/sssettingswrapper/sssettingswrapper.pro
cellular/sssettings/xqbindings/sssettingswrapper/tsrc/mocks/mock_rsssettings.cpp
cellular/sssettings/xqbindings/sssettingswrapper/tsrc/run_auto_tests_qt.bat
cellular/sssettings/xqbindings/sssettingswrapper/tsrc/ut_sssettingswrapper/qtestmains60.h
cellular/sssettings/xqbindings/sssettingswrapper/tsrc/ut_sssettingswrapper/ut_sssettingswrapper.cpp
cellular/sssettings/xqbindings/sssettingswrapper/tsrc/ut_sssettingswrapper/ut_sssettingswrapper.h
cellular/sssettings/xqbindings/sssettingswrapper/tsrc/ut_sssettingswrapper/ut_sssettingswrapper.pro
cellular/telephonysettings/bwins/phonesettingsu.def
cellular/telephonysettings/group/phonesettings_stub.sis
cellular/telephonysettings/inc/mcalldiverting.h
cellular/telephonysettings/inc/mnetworkinfoobs.h
cellular/telephonysettings/inc/psetcalldivertingbase.h
cellular/telephonysettings/inc/psetcalldivertingbasicimpl.h
cellular/telephonysettings/inc/psetcalldivertingcreator.h
cellular/telephonysettings/inc/psetcalldivertingdualaffectimpl.h
cellular/telephonysettings/inc/psetpanic.h
cellular/telephonysettings/inc/psetrefreshhandlerimpl.h
cellular/telephonysettings/inc/psetsubscriberidcheck.h
cellular/telephonysettings/inc/psettelephony.h
cellular/telephonysettings/inc/psetutility.h
cellular/telephonysettings/inc/psetvariationproxy.h
cellular/telephonysettings/logger/phonesettingslogger.h
cellular/telephonysettings/logger/phonesettingsloggingconf.h
cellular/telephonysettings/rom/phonesettings.iby
cellular/telephonysettings/src/psetcallbarring.cpp
cellular/telephonysettings/src/psetcalldiverting.cpp
cellular/telephonysettings/src/psetcalldivertingbase.cpp
cellular/telephonysettings/src/psetcalldivertingbasicimpl.cpp
cellular/telephonysettings/src/psetcalldivertingcreator.cpp
cellular/telephonysettings/src/psetcalldivertingdualaffectimpl.cpp
cellular/telephonysettings/src/psetcallwaiting.cpp
cellular/telephonysettings/src/psetcli.cpp
cellular/telephonysettings/src/psetcontainer.cpp
cellular/telephonysettings/src/psetcsp.cpp
cellular/telephonysettings/src/psetnetwork.cpp
cellular/telephonysettings/src/psetrefreshhandlerimpl.cpp
cellular/telephonysettings/src/psetsaobserver.cpp
cellular/telephonysettings/src/psetsubscriberidcheck.cpp
cellular/telephonysettings/src/psettelephony.cpp
cellular/telephonysettings/src/psetutility.cpp
cellular/telephonysettings/src/psetvariationproxy.cpp
cellular/telephonysettings/xqbindings/psetwrapper/tsrc/run_auto_tests_qt.bat
convergedcallengine/cce/bwins/cceu.def
convergedcallengine/cce/eabi/cceu.def
convergedcallengine/spsettings/conf/spsettings_10282E7F.crml
convergedcallengine/spsettings/conf/spsettings_10282e7f.crml
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/bwins/t_csppropertyu.def
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/bwins/t_cspsettingsengineu.def
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/bwins/t_cspsettingsu.def
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/bwins/t_cspsettingsvoiputilsu.def
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/bwins/ut_spsbackuphelpermonitoru.def
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/bwins/ut_spsbackuphelperperformeru.def
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/bwins/ut_spsbufferedpublisheru.def
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/group/T_CSPPropertyUT.mmp
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/group/T_CSPSettingsEngineUT.mmp
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/group/T_CSPSettingsUT.mmp
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/group/T_CSPSettingsVoIPUtilsUT.mmp
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/group/bld.inf
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/group/ut_spsbackuphelpermonitor.mmp
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/group/ut_spsbackuphelperperformer.mmp
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/group/ut_spsbufferredpublisher.mmp
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/T_CSPProperty.cpp
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/T_CSPProperty.h
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/T_CSPProperty_DllMain.cpp
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/T_CSPSettings.cpp
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/T_CSPSettings.h
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/T_CSPSettingsEngine.cpp
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/T_CSPSettingsEngine.h
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/T_CSPSettingsEngine_DllMain.cpp
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/T_CSPSettingsVoIPUtils.cpp
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/T_CSPSettingsVoIPUtils.h
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/T_CSPSettingsVoIPUtils_DllMain.cpp
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/T_CSPSettings_DllMain.cpp
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/ut_spsbackuphelpermonitor.cpp
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/ut_spsbackuphelpermonitor.h
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/ut_spsbackuphelpermonitor_dllmain.cpp
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/ut_spsbackuphelperperformer.cpp
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/ut_spsbackuphelperperformer.h
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/ut_spsbackuphelperperformer_dllmain.cpp
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/ut_spsbufferedpublisher.cpp
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/ut_spsbufferedpublisher.h
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/ut_spsbufferedpublisher_dllmain.cpp
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/stubs/FeatMgr.h
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/stubs/FeatMgrStub.cpp
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/stubs/T_cenrepdatabaseutilStub.cpp
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/stubs/T_spsettingsengineStub.cpp
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/stubs/TestData.cpp
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/stubs/TestData.h
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/stubs/abclient_stub.cpp
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/stubs/centralrepository_stub.cpp
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/stubs/serviceprovidersettings_stub.cpp
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/stubs/spsbackuphelperperformer_stub.cpp
convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/stubs/spsbufferedpublisher_stub.cpp
phoneclientserver/aiwdialdata/bwins/aiwdialdata_2_2u.def
phoneclientserver/aiwdialdata/bwins/aiwdialdatau.def
phoneclientserver/aiwdialdata/eabi/aiwdialdata_2_2u.def
phoneclientserver/aiwdialdata/eabi/aiwdialdatau.def
phoneclientserver/aiwdialdata/group/aiwdialdata_stub.sis
phoneclientserver/aiwdialdata/tsrc/public/adv/aiwdialtest/bmarm/aiwdialtestu.def
phoneclientserver/aiwdialdata/tsrc/public/adv/aiwdialtest/bwins/aiwdialtestu.def
phoneclientserver/aiwdialdata/tsrc/public/adv/aiwdialtest/eabi/aiwdialtestu.def
phoneclientserver/aiwdialdata/tsrc/public/adv/aiwdialtest/group/aiwdialtest_doxyfile.txt
phoneclientserver/aiwdialdata/tsrc/public/adv/aiwdialtest/src/aiwdialtestcases.cpp
phoneclientserver/aiwdialdata/tsrc/public/adv/group/readme.txt
phoneclientserver/aiwdialdata/tsrc/public/basic/aiwdialdatatests/bmarm/aiwdialdatatestsu.def
phoneclientserver/aiwdialdata/tsrc/public/basic/aiwdialdatatests/bwins/aiwdialdatatestsu.def
phoneclientserver/aiwdialdata/tsrc/public/basic/aiwdialdatatests/eabi/aiwdialdatatestsu.def
phoneclientserver/aiwdialdata/tsrc/public/basic/aiwdialdatatests/group/aiwdialdatatests.mmp
phoneclientserver/aiwdialdata/tsrc/public/basic/aiwdialdatatests/group/aiwdialdatatests.pkg
phoneclientserver/aiwdialdata/tsrc/public/basic/aiwdialdatatests/group/aiwdialdatatests_doxyfile.txt
phoneclientserver/aiwdialdata/tsrc/public/basic/aiwdialdatatests/group/bld.inf
phoneclientserver/aiwdialdata/tsrc/public/basic/aiwdialdatatests/inc/aiwdialdatatests.h
phoneclientserver/aiwdialdata/tsrc/public/basic/aiwdialdatatests/src/aiwdialdatatests.cpp
phoneclientserver/aiwdialdata/tsrc/public/basic/aiwdialdatatests/src/aiwdialdatatestscases.cpp
phoneclientserver/callui/bmarm/cauiengineu.def
phoneclientserver/callui/bwins/cauiengineu.def
phoneclientserver/callui/data/101f868e.rss
phoneclientserver/callui/data/callui.rss
phoneclientserver/callui/eabi/cauiengineu.def
phoneclientserver/callui/group/bld.inf
phoneclientserver/callui/group/callui_stub.pkg
phoneclientserver/callui/group/callui_stub.sis
phoneclientserver/callui/group/cauiengine.mmp
phoneclientserver/callui/group/cauiplugin.mmp
phoneclientserver/callui/inc/caui.hrh
phoneclientserver/callui/inc/cauiengine/cauiactiveobject.h
phoneclientserver/callui/inc/cauiengine/cauidialdatacontainer.h
phoneclientserver/callui/inc/cauiengine/cauidialogs.h
phoneclientserver/callui/inc/cauiengine/cauidialresultobserver.h
phoneclientserver/callui/inc/cauiengine/cauieng.h
phoneclientserver/callui/inc/cauiengine/cauiengfactimpl.h
phoneclientserver/callui/inc/cauiengine/cauiengine.h
phoneclientserver/callui/inc/cauiengine/cauilogger.h
phoneclientserver/callui/inc/cauiengine/cauimessagesender.h
phoneclientserver/callui/inc/cauiengine/cauimessagesenderstub.h
phoneclientserver/callui/inc/cauiengine/cauiquery.h
phoneclientserver/callui/inc/cauiengine/cauiqueryobserver.h
phoneclientserver/callui/inc/cauiengine/cauivoipextension.h
phoneclientserver/callui/inc/cauiengine/ccauireconnectqueryimpl.h
phoneclientserver/callui/inc/cauiplugin/cauiplugin.h
phoneclientserver/callui/loc/callui.loc
phoneclientserver/dialutils/bwins/dialutilsu.def
phoneclientserver/dialutils/eabi/dialutilsu.def
phoneclientserver/dialutils/inc/dialutilsfactimpl.h
phoneclientserver/dialutils/inc/dialutilsimpl.h
phoneclientserver/dialutils/src/dialutilsfactimpl.cpp
phoneclientserver/dialutils/src/dialutilsimpl.cpp
phoneclientserver/dialutils/src/dialutilsmain.cpp
phoneclientserver/enpolicy/bmarm/dosenpolicyu.def
phoneclientserver/enpolicy/bmarm/sosenpolicyu.def
phoneclientserver/enpolicy/bwins/dosenpolicyu.def
phoneclientserver/enpolicy/bwins/sosenpolicyu.def
phoneclientserver/enpolicy/eabi/dosenpolicyu.def
phoneclientserver/enpolicy/eabi/sosenpolicyu.def
phoneclientserver/enpolicy/group/bld.inf
phoneclientserver/enpolicy/group/dosenpolicy.mmp
phoneclientserver/enpolicy/group/dosenpolicy_stub.pkg
phoneclientserver/enpolicy/group/dosenpolicy_stub.sis
phoneclientserver/enpolicy/group/sosenpolicy.mmp
phoneclientserver/enpolicy/group/sosenpolicy_stub.pkg
phoneclientserver/enpolicy/group/sosenpolicy_stub.sis
phoneclientserver/enpolicy/inc/cemergencynumberpolicy.h
phoneclientserver/enpolicy/inc/dosenpolicy/cdosemergencynumberpolicy.h
phoneclientserver/enpolicy/inc/sosenpolicy/csosemergencynumberpolicyhandler.h
phoneclientserver/enpolicy/inc/sosenpolicy/csosemergencynumberpolicymanager.h
phoneclientserver/enpolicy/inc/sosenpolicy/csosenpolicyenlisthandler.h
phoneclientserver/enpolicy/inc/sosenpolicy/csosenpolicysatrefresh.h
phoneclientserver/enpolicy/inc/sosenpolicy/csosenpolicysimstatusmonitor.h
phoneclientserver/enpolicy/rom/enpolicy.iby
phoneclientserver/enpolicy/src/dosenpolicy/cdosemergencynumberpolicy.cpp
phoneclientserver/enpolicy/src/sosenpolicy/csosemergencynumberpolicyhandler.cpp
phoneclientserver/enpolicy/src/sosenpolicy/csosemergencynumberpolicymanager.cpp
phoneclientserver/enpolicy/src/sosenpolicy/csosenpolicyenlisthandler.cpp
phoneclientserver/enpolicy/src/sosenpolicy/csosenpolicysatrefresh.cpp
phoneclientserver/enpolicy/src/sosenpolicy/csosenpolicysimstatusmonitor.cpp
phoneclientserver/inc/cphcltdialer.h
phoneclientserver/inc/cphcltextphonebase.h
phoneclientserver/inc/cphcltextphonedialdata.h
phoneclientserver/inc/mphcltextphoneobserver.h
phoneclientserver/inc/rphcltemergencycall.h
phoneclientserver/phoneclient/bmarm/phoneclientu.def
phoneclientserver/phoneclient/bwins/phoneclient_aiwextu.def
phoneclientserver/phoneclient/bwins/phoneclient_aiwu.def
phoneclientserver/phoneclient/bwins/phoneclient_extu.def
phoneclientserver/phoneclient/bwins/phoneclientu.def
phoneclientserver/phoneclient/conf/ci_telephonyservices.confml
phoneclientserver/phoneclient/conf/telephonyservices_102029ac.crml
phoneclientserver/phoneclient/conf/telephonyservices_102078f1.crml
phoneclientserver/phoneclient/data/phoneclient.rss
phoneclientserver/phoneclient/data/phoneclient_stub.pkg
phoneclientserver/phoneclient/data/phoneclient_stub.sis
phoneclientserver/phoneclient/eabi/phoneclient_aiwextu.def
phoneclientserver/phoneclient/eabi/phoneclient_aiwu.def
phoneclientserver/phoneclient/eabi/phoneclient_extu.def
phoneclientserver/phoneclient/eabi/phoneclientu.def
phoneclientserver/phoneclient/group/bld.inf
phoneclientserver/phoneclient/group/phoneclient.mmp
phoneclientserver/phoneclient/inc/commandhandler/cphcltcomhandimplementation.h
phoneclientserver/phoneclient/inc/commandhandler/rphcltcommandhandler.h
phoneclientserver/phoneclient/inc/commandhandler/rphcltcommandhandlernotify.h
phoneclientserver/phoneclient/inc/emergencynumber/cphcltemergencytelnumber.h
phoneclientserver/phoneclient/inc/emergencynumber/emergencynumber_aiw/cphcltemergencycallimpl.h
phoneclientserver/phoneclient/inc/emergencynumber/emergencynumber_aiw/rphcltemergencycall.h
phoneclientserver/phoneclient/inc/emergencynumber/rphcltemergencynumber.h
phoneclientserver/phoneclient/inc/extcall/extcall_aiw/cphcltextphonedialdata.h
phoneclientserver/phoneclient/inc/extcall/extcall_aiw/rphcltcallnotify.h
phoneclientserver/phoneclient/inc/extcall/extcall_aiw/rphcltextcall.h
phoneclientserver/phoneclient/inc/extcall/rphcltextcall.h
phoneclientserver/phoneclient/inc/extcall/tphcltextphonedialdata.h
phoneclientserver/phoneclient/inc/extcallwrapper/extcallwrapper_aiw/cphcltdialer.h
phoneclientserver/phoneclient/inc/extcallwrapper/extcallwrapper_aiw/cphcltdialerdlg.h
phoneclientserver/phoneclient/inc/extcallwrapper/extcallwrapper_aiw/cphcltextphone.h
phoneclientserver/phoneclient/inc/extcallwrapper/extcallwrapper_aiw/cphcltextphonebase.h
phoneclientserver/phoneclient/inc/extcallwrapper/extcallwrapper_aiw/mphcltextphoneobserver.h
phoneclientserver/phoneclient/inc/ihf/rphcltihf.h
phoneclientserver/phoneclient/inc/imagehandler/cphcltimagehandlerimplementation.h
phoneclientserver/phoneclient/inc/imagehandler/cphcltoperatorlogocontainer.h
phoneclientserver/phoneclient/inc/imagehandler/rphcltimagehandler.h
phoneclientserver/phoneclient/inc/messenger/cphcltmessengerimplementation.h
phoneclientserver/phoneclient/inc/messenger/rphcltmessenger.h
phoneclientserver/phoneclient/inc/misc/telservicesinternalcrkeys.h
phoneclientserver/phoneclient/inc/misc/telservicesvariant.hrh
phoneclientserver/phoneclient/inc/notifier/notifier_aiw/cphcltcomhandrequestmonitor.h
phoneclientserver/phoneclient/inc/notifier/notifier_aiw/cphcltdialemergencyrequestmonitor.h
phoneclientserver/phoneclient/inc/notifier/notifier_aiw/cphcltdialrequestmonitor.h
phoneclientserver/phoneclient/inc/rphcltresourcefile.h
phoneclientserver/phoneclient/inc/session/phoneclient.hrh
phoneclientserver/phoneclient/inc/sharedclientserver/phcltclientserver.h
phoneclientserver/phoneclient/inc/ussd/ussd_ext/rphcltussd.h
phoneclientserver/phoneclient/inc/ussdwrapper/cphcltussdnotecontroller.h
phoneclientserver/phoneclient/inc/ussdwrapper/cphcltussdrequesthandler.h
phoneclientserver/phoneclient/inc/ussdwrapper/mphcltussdnotecontrollercallback.h
phoneclientserver/phoneclient/inc/ussdwrapper/mphcltussdrequesthandler.h
phoneclientserver/phoneclient/inc/ussdwrapper/ussd_ext/cphcltussdimp.h
phoneclientserver/phoneclient/rom/phoneclient.iby
phoneclientserver/phoneclient/src/commandhandler/cphcltcomhandimplementation.cpp
phoneclientserver/phoneclient/src/commandhandler/cphcltcommandhandler.cpp
phoneclientserver/phoneclient/src/commandhandler/rphcltcommandhandler.cpp
phoneclientserver/phoneclient/src/commandhandler/rphcltcommandhandlernotify.cpp
phoneclientserver/phoneclient/src/emergencynumber/emergencynumber_aiw/cphcltemergencycall.cpp
phoneclientserver/phoneclient/src/emergencynumber/emergencynumber_aiw/cphcltemergencycallimpl.cpp
phoneclientserver/phoneclient/src/emergencynumber/emergencynumber_aiw/rphcltemergencycall.cpp
phoneclientserver/phoneclient/src/extcall/extcall_aiw/cphcltdialdata.cpp
phoneclientserver/phoneclient/src/extcall/extcall_aiw/cphcltextphonedialdata.cpp
phoneclientserver/phoneclient/src/extcall/extcall_aiw/rphcltextcall.cpp
phoneclientserver/phoneclient/src/extcall/rphcltextcall.cpp
phoneclientserver/phoneclient/src/extcall/tphcltextphonedialdata.cpp
phoneclientserver/phoneclient/src/extcallwrapper/cphcltdialer.cpp
phoneclientserver/phoneclient/src/extcallwrapper/cphcltdialerdlg.cpp
phoneclientserver/phoneclient/src/extcallwrapper/cphcltextphone.cpp
phoneclientserver/phoneclient/src/extcallwrapper/cphcltextphonebase.cpp
phoneclientserver/phoneclient/src/extcallwrapper/extcallwrapper_aiw/cphcltdialer.cpp
phoneclientserver/phoneclient/src/extcallwrapper/extcallwrapper_aiw/cphcltdialerdlg.cpp
phoneclientserver/phoneclient/src/extcallwrapper/extcallwrapper_aiw/cphcltextphone.cpp
phoneclientserver/phoneclient/src/extcallwrapper/extcallwrapper_aiw/cphcltextphonebase.cpp
phoneclientserver/phoneclient/src/ihf/rphcltihf.cpp
phoneclientserver/phoneclient/src/ihf/rphcltihfstub.cpp
phoneclientserver/phoneclient/src/imagehandler/cphcltbaseimageparams.cpp
phoneclientserver/phoneclient/src/imagehandler/cphcltimagehandler.cpp
phoneclientserver/phoneclient/src/imagehandler/cphcltimagehandlerimplementation.cpp
phoneclientserver/phoneclient/src/imagehandler/cphcltoperatorlogocontainer.cpp
phoneclientserver/phoneclient/src/imagehandler/rphcltimagehandler.cpp
phoneclientserver/phoneclient/src/messenger/cphcltmessenger.cpp
phoneclientserver/phoneclient/src/messenger/cphcltmessengerimplementation.cpp
phoneclientserver/phoneclient/src/messenger/rphcltmessenger.cpp
phoneclientserver/phoneclient/src/notifier/notifier_aiw/cphcltcallnotify.cpp
phoneclientserver/phoneclient/src/notifier/notifier_aiw/cphcltcomhandrequestmonitor.cpp
phoneclientserver/phoneclient/src/notifier/notifier_aiw/cphcltdialemergencyrequestmonitor.cpp
phoneclientserver/phoneclient/src/notifier/notifier_aiw/cphcltdialrequestmonitor.cpp
phoneclientserver/phoneclient/src/notifier/notifier_aiw/rphcltcallnotify.cpp
phoneclientserver/phoneclient/src/notifier/rphcltcallnotify.cpp
phoneclientserver/phoneclient/src/notifier/rphcltextcallnotify.cpp
phoneclientserver/phoneclient/src/phcltutils.cpp
phoneclientserver/phoneclient/src/rphcltresourcefile.cpp
phoneclientserver/phoneclient/src/session/rphcltserver.cpp
phoneclientserver/phoneclient/src/ussd/ussd_ext/rphcltussd.cpp
phoneclientserver/phoneclient/src/ussdwrapper/cphcltussdext.cpp
phoneclientserver/phoneclient/src/ussdwrapper/cphcltussdimp.cpp
phoneclientserver/phoneclient/src/ussdwrapper/cphcltussdint.cpp
phoneclientserver/phoneclient/src/ussdwrapper/cphcltussdnotecontroller.cpp
phoneclientserver/phoneclient/src/ussdwrapper/cphcltussdrequesthandler.cpp
phoneclientserver/phoneclient/src/ussdwrapper/cphcltussdsatclient.cpp
phoneclientserver/phoneclient/tsrc/public/basic/ut_ussd/ut_testenv.cpp
phoneclientserver/phoneclient/tsrc/public/basic/ut_ussd/ut_ussd.cpp
phoneclientserver/phoneserver/bmarm/phoneserveru.def
phoneclientserver/phoneserver/bwins/phoneserver.def
phoneclientserver/phoneserver/bwins/phoneserveru.def
phoneclientserver/phoneserver/group/backup_registration.xml
phoneclientserver/phoneserver/group/bld.inf
phoneclientserver/phoneserver/group/phoneserver.mmp
phoneclientserver/phoneserver/group/phoneserver_stub.pkg
phoneclientserver/phoneserver/group/phoneserver_stub.sis
phoneclientserver/phoneserver/inc/commandhandler/cphsrvcomhandrequest.h
phoneclientserver/phoneserver/inc/commandhandler/cphsrvcomhandrequestmanager.h
phoneclientserver/phoneserver/inc/commandhandler/cphsrvsubsessioncommandhandler.h
phoneclientserver/phoneserver/inc/commandhandler/cphsrvsubsessioncommandhandlernotify.h
phoneclientserver/phoneserver/inc/commandhandler/mphsrvcomhandinitiators.h
phoneclientserver/phoneserver/inc/commandhandler/mphsrvcomhandnegotiators.h
phoneclientserver/phoneserver/inc/imagehandler/cphsrvimagesaver.h
phoneclientserver/phoneserver/inc/imagehandler/cphsrvsubsessionimagehandler.h
phoneclientserver/phoneserver/inc/imagehandler/mphsrvimagesaverobserver.h
phoneclientserver/phoneserver/inc/messenger/cphsrvmessengerobject.h
phoneclientserver/phoneserver/inc/messenger/cphsrvmessengerrequestmanager.h
phoneclientserver/phoneserver/inc/messenger/cphsrvsubsessionmessenger.h
phoneclientserver/phoneserver/inc/messenger/mphsrvmessengernegotiators.h
phoneclientserver/phoneserver/inc/messenger/phsrvmessengertypes.h
phoneclientserver/phoneserver/inc/standard/cphsrvemergencynumbermanager.h
phoneclientserver/phoneserver/inc/standard/cphsrvphonecontroller.h
phoneclientserver/phoneserver/inc/standard/cphsrvresourcemanager.h
phoneclientserver/phoneserver/inc/standard/cphsrvscheduler.h
phoneclientserver/phoneserver/inc/standard/cphsrvserver.h
phoneclientserver/phoneserver/inc/standard/cphsrvsession.h
phoneclientserver/phoneserver/inc/standard/cphsrvsubsessionbase.h
phoneclientserver/phoneserver/inc/standard/cphsrvsubsessionextcall.h
phoneclientserver/phoneserver/inc/standard/cphsrvsubsessionussd.h
phoneclientserver/phoneserver/inc/standard/kphsrvconfigure.h
phoneclientserver/phoneserver/inc/standard/mphsrvmessageprocessor.h
phoneclientserver/phoneserver/inc/standard/mphsrvphoneinterface.h
phoneclientserver/phoneserver/inc/standard/phsrvdebuginfo.h
phoneclientserver/phoneserver/inc/standard/phsrvstartup.h
phoneclientserver/phoneserver/inc/standard/phsrvsubsessionfactory.h
phoneclientserver/phoneserver/inc/standard/phsrvutils.h
phoneclientserver/phoneserver/inc/standard/standard_aiw/cphsrvcallrequest.h
phoneclientserver/phoneserver/inc/standard/standard_aiw/cphsrvcallrequestmanager.h
phoneclientserver/phoneserver/inc/standard/standard_aiw/cphsrvemergencyrequestmanager.h
phoneclientserver/phoneserver/inc/standard/standard_aiw/cphsrvsubsessionemergencynum.h
phoneclientserver/phoneserver/inc/standard/standard_aiw/cphsrvsubsessionnotifier.h
phoneclientserver/phoneserver/inc/standard/standard_aiw/mphsrvemergencyinitiators.h
phoneclientserver/phoneserver/inc/standard/standard_aiw/mphsrvemergencynegotiators.h
phoneclientserver/phoneserver/inc/standard/standard_aiw/mphsrvemergencynumbermanager.h
phoneclientserver/phoneserver/inc/standard/standard_aiw/mphsrvobjectinitiators.h
phoneclientserver/phoneserver/inc/standard/standard_aiw/mphsrvobjectnegotiators.h
phoneclientserver/phoneserver/inc/standard/standard_noaiw/cphsrvcallrequest.h
phoneclientserver/phoneserver/inc/standard/standard_noaiw/cphsrvcallrequestmanager.h
phoneclientserver/phoneserver/inc/standard/standard_noaiw/cphsrvsubsessionemergencynum.h
phoneclientserver/phoneserver/inc/standard/standard_noaiw/cphsrvsubsessionnotifier.h
phoneclientserver/phoneserver/inc/standard/standard_noaiw/mphsrvemergencynumbermanager.h
phoneclientserver/phoneserver/inc/standard/standard_noaiw/mphsrvobjectinitiators.h
phoneclientserver/phoneserver/inc/standard/standard_noaiw/mphsrvobjectnegotiators.h
phoneclientserver/phoneserver/inc/ussd/cphsrvussdmanager.h
phoneclientserver/phoneserver/inc/ussd/cphsrvussdnotifynwrelease.h
phoneclientserver/phoneserver/inc/ussd/cphsrvussdreceivehandler.h
phoneclientserver/phoneserver/inc/ussd/cphsrvussdreplytimer.h
phoneclientserver/phoneserver/inc/ussd/cphsrvussdsendhandler.h
phoneclientserver/phoneserver/inc/ussd/cphsrvussdsessioncancelwaiter.h
phoneclientserver/phoneserver/inc/ussd/mphsrvussdmessagesentobserver.h
phoneclientserver/phoneserver/inc/ussd/mphsrvussdnetworkobserver.h
phoneclientserver/phoneserver/inc/ussd/mphsrvussdreplytimerobserver.h
phoneclientserver/phoneserver/rom/phoneserver.iby
phoneclientserver/phoneserver/src/commandhandler/commandhandler_aiw/cphsrvcomhandrequestmanager.cpp
phoneclientserver/phoneserver/src/commandhandler/commandhandler_aiw/cphsrvcomhandrequestmanagerstub.cpp
phoneclientserver/phoneserver/src/commandhandler/commandhandler_noaiw/cphsrvcomhandrequestmanager.cpp
phoneclientserver/phoneserver/src/commandhandler/commandhandler_noaiw/cphsrvcomhandrequestmanagerstub.cpp
phoneclientserver/phoneserver/src/commandhandler/cphsrvcomhandrequest.cpp
phoneclientserver/phoneserver/src/commandhandler/cphsrvsubsessioncommandhandler.cpp
phoneclientserver/phoneserver/src/commandhandler/cphsrvsubsessioncommandhandlernotify.cpp
phoneclientserver/phoneserver/src/commandhandler/cphsrvsubsessioncommandhandlernotifystub.cpp
phoneclientserver/phoneserver/src/commandhandler/cphsrvsubsessioncommandhandlerstub.cpp
phoneclientserver/phoneserver/src/imagehandler/cphsrvimagesaver.cpp
phoneclientserver/phoneserver/src/imagehandler/cphsrvsubsessionimagehandler.cpp
phoneclientserver/phoneserver/src/messenger/cphsrvmessengerobject.cpp
phoneclientserver/phoneserver/src/messenger/cphsrvmessengerrequestmanager.cpp
phoneclientserver/phoneserver/src/messenger/cphsrvmessengerrequestmanagerstub.cpp
phoneclientserver/phoneserver/src/messenger/cphsrvsubsessionmessenger.cpp
phoneclientserver/phoneserver/src/messenger/cphsrvsubsessionmessengerstub.cpp
phoneclientserver/phoneserver/src/resources/phoneserver.hrh
phoneclientserver/phoneserver/src/resources/phoneserver.rss
phoneclientserver/phoneserver/src/standard/cphsrvemergencynumbermanager.cpp
phoneclientserver/phoneserver/src/standard/cphsrvphonecontroller.cpp
phoneclientserver/phoneserver/src/standard/cphsrvresourcemanager.cpp
phoneclientserver/phoneserver/src/standard/cphsrvscheduler.cpp
phoneclientserver/phoneserver/src/standard/cphsrvserver.cpp
phoneclientserver/phoneserver/src/standard/cphsrvsession.cpp
phoneclientserver/phoneserver/src/standard/cphsrvsubsessionbase.cpp
phoneclientserver/phoneserver/src/standard/cphsrvsubsessionussd.cpp
phoneclientserver/phoneserver/src/standard/phsrvdebuginfo.cpp
phoneclientserver/phoneserver/src/standard/phsrvstartup.cpp
phoneclientserver/phoneserver/src/standard/phsrvsubsessionfactory.cpp
phoneclientserver/phoneserver/src/standard/phsrvutils.cpp
phoneclientserver/phoneserver/src/standard/standard_aiw/cphcltdialdata.cpp
phoneclientserver/phoneserver/src/standard/standard_aiw/cphcltextphonedialdata.cpp
phoneclientserver/phoneserver/src/standard/standard_aiw/cphsrvcallrequest.cpp
phoneclientserver/phoneserver/src/standard/standard_aiw/cphsrvcallrequestmanager.cpp
phoneclientserver/phoneserver/src/standard/standard_aiw/cphsrvemergencyrequestmanager.cpp
phoneclientserver/phoneserver/src/standard/standard_aiw/cphsrvsubsessionemergencynum.cpp
phoneclientserver/phoneserver/src/standard/standard_aiw/cphsrvsubsessionextcall.cpp
phoneclientserver/phoneserver/src/standard/standard_aiw/cphsrvsubsessionnotifier.cpp
phoneclientserver/phoneserver/src/ussd/cphsrvussdmanager.cpp
phoneclientserver/phoneserver/src/ussd/cphsrvussdnotifynwrelease.cpp
phoneclientserver/phoneserver/src/ussd/cphsrvussdreceivehandler.cpp
phoneclientserver/phoneserver/src/ussd/cphsrvussdreplytimer.cpp
phoneclientserver/phoneserver/src/ussd/cphsrvussdsendhandler.cpp
phonecmdhandler/phonecmdhnlr/bwins/phonecmdhandleru.def
phonecmdhandler/phonecmdhnlr/group/phonecmdhandler.mmp
phonecmdhandler/phonecmdhnlr/inc/phonehandleractive.h
phonecmdhandler/phonecmdhnlr/inc/phonehandleranswercall.h
phonecmdhandler/phonecmdhnlr/inc/phonehandlercallbase.h
phonecmdhandler/phonecmdhnlr/inc/phonehandlercallstate.h
phonecmdhandler/phonecmdhnlr/inc/phonehandlercontrol.h
phonecmdhandler/phonecmdhnlr/inc/phonehandlerdebug.h
phonecmdhandler/phonecmdhnlr/inc/phonehandlerdialcall.h
phonecmdhandler/phonecmdhnlr/inc/phonehandlerdtmf.h
phonecmdhandler/phonecmdhnlr/inc/phonehandlerendcall.h
phonecmdhandler/phonecmdhnlr/inc/phonehandlermultipartycall.h
phonecmdhandler/phonecmdhnlr/inc/phonehandlerobserver.h
phonecmdhandler/phonecmdhnlr/inc/phonehandlerredial.h
phonecmdhandler/phonecmdhnlr/inc/phonehandlerresponse.h
phonecmdhandler/phonecmdhnlr/inc/phonehandlerservice.h
phonecmdhandler/phonecmdhnlr/inc/phonehandlervoicedial.h
phonecmdhandler/phonecmdhnlr/src/phonehandler.cpp
phonecmdhandler/phonecmdhnlr/src/phonehandleractive.cpp
phonecmdhandler/phonecmdhnlr/src/phonehandleranswercall.cpp
phonecmdhandler/phonecmdhnlr/src/phonehandlercallbase.cpp
phonecmdhandler/phonecmdhnlr/src/phonehandlercallstate.cpp
phonecmdhandler/phonecmdhnlr/src/phonehandlercontrol.cpp
phonecmdhandler/phonecmdhnlr/src/phonehandlerdialcall.cpp
phonecmdhandler/phonecmdhnlr/src/phonehandlerdtmf.cpp
phonecmdhandler/phonecmdhnlr/src/phonehandlerendcall.cpp
phonecmdhandler/phonecmdhnlr/src/phonehandlermultipartycall.cpp
phonecmdhandler/phonecmdhnlr/src/phonehandlerredial.cpp
phonecmdhandler/phonecmdhnlr/src/phonehandlerresponse.cpp
phonecmdhandler/phonecmdhnlr/src/phonehandlervoicedial.cpp
phonesrv.pro
phonesrv_plat/cbs_mcn_client_api/inc/cbsmcncommon.h
phonesrv_plat/cbs_mcn_client_api/inc/cbsmcnpanic.h
phonesrv_plat/cbs_mcn_client_api/inc/ccbsmcnlistener.h
phonesrv_plat/cbs_mcn_client_api/inc/cmcn.h
phonesrv_plat/cbs_mcn_client_api/inc/cmcntopicarray.h
phonesrv_plat/cbs_mcn_client_api/inc/mcbsmcnobserver.h
phonesrv_plat/cbs_mcn_client_api/inc/rcbsmcnsession.h
phonesrv_plat/cbs_mcn_client_api/inc/rmcnsubsession.h
phonesrv_plat/dial_utils_api/inc/dialutils.h
phonesrv_plat/dialpad_api/inc/dialpad.h
phonesrv_plat/network_handling_engine_api/inc/cnwsession.h
phonesrv_plat/network_handling_engine_api/inc/networkhandlingproxy.h
phonesrv_plat/network_handling_engine_api/inc/nwhandlingengine.h
phonesrv_plat/phone_client_api/inc/phclttypes.h
phonesrv_plat/phone_client_api/inc/rphcltserver.h
phonesrv_plat/phone_client_command_handler_api/inc/cphcltcommandhandler.h
phonesrv_plat/phone_client_emergency_call_api/inc/cphcltemergencycall.h
phonesrv_plat/phone_client_emergency_call_api/inc/mphcltemergencycallobserver.h
phonesrv_plat/phone_client_emergency_call_api/tsrc/BWINS/it_emergencycalltestsu.def
phonesrv_plat/phone_client_emergency_call_api/tsrc/EABI/it_emergencycalltestsu.def
phonesrv_plat/phone_client_image_handler_api/inc/cphcltbaseimageparams.h
phonesrv_plat/phone_client_image_handler_api/inc/cphcltimagehandler.h
phonesrv_plat/phone_client_image_handler_api/inc/cphcltimageparams.h
phonesrv_plat/phone_client_messenger_api/inc/cphcltmessenger.h
phonesrv_plat/phone_client_notify_api/inc/cphcltcallnotify.h
phonesrv_plat/phone_client_server_information_api/inc/phoneclientserverdomainpskeys.h
phonesrv_plat/phone_client_server_information_api/inc/phoneclientserverdomainpstypes.h
phonesrv_plat/phone_client_ussd_api/inc/cphcltussd.h
phonesrv_plat/phone_client_ussd_internal_api/inc/cphcltussdint.h
phonesrv_plat/phone_client_ussd_internal_api/inc/cphcltussdsatclient.h
phonesrv_plat/phone_client_utility_api/inc/phcltutils.h
phonesrv_plat/phone_settings_api/inc/mpsetcallbarring.h
phonesrv_plat/phone_settings_api/inc/mpsetcalldiverting.h
phonesrv_plat/phone_settings_api/inc/mpsetcallwaiting.h
phonesrv_plat/phone_settings_api/inc/mpsetcli.h
phonesrv_plat/phone_settings_api/inc/mpsetnetworkmode.h
phonesrv_plat/phone_settings_api/inc/mpsetnetworkselect.h
phonesrv_plat/phone_settings_api/inc/psetcallbarring.h
phonesrv_plat/phone_settings_api/inc/psetcalldiverting.h
phonesrv_plat/phone_settings_api/inc/psetcallwaiting.h
phonesrv_plat/phone_settings_api/inc/psetcli.h
phonesrv_plat/phone_settings_api/inc/psetconstants.h
phonesrv_plat/phone_settings_api/inc/psetcontainer.h
phonesrv_plat/phone_settings_api/inc/psetcsp.h
phonesrv_plat/phone_settings_api/inc/psetnetwork.h
phonesrv_plat/phone_settings_api/inc/psetrefreshhandler.h
phonesrv_plat/phone_settings_api/inc/psetsaobserver.h
phonesrv_plat/phone_settings_notes_ui_api/inc/psuibarringobs.h
phonesrv_plat/phone_settings_notes_ui_api/inc/psuicliobserver.h
phonesrv_plat/phone_settings_notes_ui_api/inc/psuiconstants.h
phonesrv_plat/phone_settings_notes_ui_api/inc/psuicontainer.h
phonesrv_plat/phone_settings_notes_ui_api/inc/psuidivertobs.h
phonesrv_plat/phone_settings_notes_ui_api/inc/psuiwaitingobs.h
phonesrv_plat/phone_settings_observer_api/inc/mpsetbarringobs.h
phonesrv_plat/phone_settings_observer_api/inc/mpsetcallwaitingobs.h
phonesrv_plat/phone_settings_observer_api/inc/mpsetcliobserver.h
phonesrv_plat/phone_settings_observer_api/inc/mpsetdivertobs.h
phonesrv_plat/phone_settings_observer_api/inc/mpsetnetworkinfoobs.h
phonesrv_plat/phone_settings_observer_api/inc/mpsetnetworkmodeobs.h
phonesrv_plat/phone_settings_observer_api/inc/mpsetrequestobs.h
phonesrv_plat/sat_client_api/inc/rsatsession.h
phonesrv_plat/sat_configuration_api/inc/satdomainpskeys.h
phonesrv_plat/sat_refresh_api/inc/msatrefreshobserver.h
phonesrv_plat/sat_refresh_api/inc/rsatrefresh.h
phonesrv_plat/ss_settings_api/inc/msssettingsobserver.h
phonesrv_plat/ss_settings_api/inc/msssettingsrefreshobserver.h
phonesrv_plat/ss_settings_api/inc/rcustomerserviceprofilecache.h
phonesrv_plat/ss_settings_api/inc/rsssettings.h
phonesrv_plat/string_parser_api/inc/cphonegsmemergencynumberhandler.h
phonesrv_plat/string_parser_api/inc/cphonegsmhandlerbase.h
phonesrv_plat/string_parser_api/inc/cphonegsmhandlercontainer.h
phonesrv_plat/string_parser_api/inc/cphonegsmmanufacturerhandler.h
phonesrv_plat/string_parser_api/inc/cphonegsmmischandler.h
phonesrv_plat/string_parser_api/inc/cphonegsmoptioncontainerbase.h
phonesrv_plat/string_parser_api/inc/cphonegsmparserbase.h
phonesrv_plat/string_parser_api/inc/cphonegsmparserresult.h
phonesrv_plat/string_parser_api/inc/cphonegsmparserresult.inl
phonesrv_plat/string_parser_api/inc/cphonegsmpcnprocedurehandler.h
phonesrv_plat/string_parser_api/inc/cphonegsmphonenumberhandler.h
phonesrv_plat/string_parser_api/inc/cphonegsmsimcontrolhandler.h
phonesrv_plat/string_parser_api/inc/cphonegsmsscallhandler.h
phonesrv_plat/string_parser_api/inc/cphonegsmsshandler.h
phonesrv_plat/string_parser_api/inc/cphonevoipnumberhandler.h
phonesrv_plat/string_parser_api/inc/phonegsmparser.h
phonesrv_plat/telephony_mediator_api/tsrc/ut_telephony_mediator_api/src/ut_telephonymediator_dllmain.cpp
phonesrv_plat/telephony_network_information_api/inc/networkhandlingdomainpskeys.h
satengine/satserver/CenRep/SATInternalPSKeys.h
satengine/satserver/CenRep/keys_sat.xls
satengine/satserver/Commands/CallControlCmd/group/CallControlCmd.mmp
satengine/satserver/Commands/CallControlCmd/group/bld.inf
satengine/satserver/Commands/CallControlCmd/inc/CCallControlHandler.h
satengine/satserver/Commands/CallControlCmd/inc/CallControlCmd.rls
satengine/satserver/Commands/CallControlCmd/inc/ccallcontrolrequesthandler.h
satengine/satserver/Commands/CallControlCmd/src/1020298B.rss
satengine/satserver/Commands/CallControlCmd/src/CCallControlHandler.cpp
satengine/satserver/Commands/CallControlCmd/src/ccallcontrolrequesthandler.cpp
satengine/satserver/Commands/CallControlCmd/src/std.cpp
satengine/satserver/Commands/CloseChannelCmd/group/CloseChannelCmd.mmp
satengine/satserver/Commands/CloseChannelCmd/group/bld.inf
satengine/satserver/Commands/CloseChannelCmd/inc/CCloseChannelHandler.h
satengine/satserver/Commands/CloseChannelCmd/inc/CloseChannelCmd.rls
satengine/satserver/Commands/CloseChannelCmd/src/102078DB.rss
satengine/satserver/Commands/CloseChannelCmd/src/CCloseChannelHandler.cpp
satengine/satserver/Commands/CloseChannelCmd/src/std.cpp
satengine/satserver/Commands/DisplayTextCmd/group/DisplayTextCmd.mmp
satengine/satserver/Commands/DisplayTextCmd/group/bld.inf
satengine/satserver/Commands/DisplayTextCmd/inc/CClearScreenHandler.h
satengine/satserver/Commands/DisplayTextCmd/inc/CDisplayTextHandler.h
satengine/satserver/Commands/DisplayTextCmd/inc/DisplayTextCmd.rls
satengine/satserver/Commands/DisplayTextCmd/src/10202989.rss
satengine/satserver/Commands/DisplayTextCmd/src/CClearScreenHandler.cpp
satengine/satserver/Commands/DisplayTextCmd/src/CDisplayTextHandler.cpp
satengine/satserver/Commands/DisplayTextCmd/src/std.cpp
satengine/satserver/Commands/GetChannelStatusCmd/group/GetChannelStatusCmd.mmp
satengine/satserver/Commands/GetChannelStatusCmd/group/bld.inf
satengine/satserver/Commands/GetChannelStatusCmd/inc/CGetChannelStatusHandler.h
satengine/satserver/Commands/GetChannelStatusCmd/inc/GetChannelStatusCmd.rls
satengine/satserver/Commands/GetChannelStatusCmd/src/102078DD.rss
satengine/satserver/Commands/GetChannelStatusCmd/src/CGetChannelStatusHandler.cpp
satengine/satserver/Commands/GetChannelStatusCmd/src/std.cpp
satengine/satserver/Commands/GetInkeyCmd/group/GetInkeyCmd.mmp
satengine/satserver/Commands/GetInkeyCmd/group/bld.inf
satengine/satserver/Commands/GetInkeyCmd/inc/CGetInkeyHandler.h
satengine/satserver/Commands/GetInkeyCmd/inc/GetInkeyCmd.rls
satengine/satserver/Commands/GetInkeyCmd/src/1000A889.rss
satengine/satserver/Commands/GetInkeyCmd/src/CGetInkeyHandler.cpp
satengine/satserver/Commands/GetInkeyCmd/src/std.cpp
satengine/satserver/Commands/GetInputCmd/group/GetInputCmd.mmp
satengine/satserver/Commands/GetInputCmd/group/bld.inf
satengine/satserver/Commands/GetInputCmd/inc/CGetInputHandler.h
satengine/satserver/Commands/GetInputCmd/inc/GetInputCmd.rls
satengine/satserver/Commands/GetInputCmd/src/10202985.rss
satengine/satserver/Commands/GetInputCmd/src/CGetInputHandler.cpp
satengine/satserver/Commands/GetInputCmd/src/std.cpp
satengine/satserver/Commands/LanguageNotificationCmd/group/LanguageNotificationCmd.mmp
satengine/satserver/Commands/LanguageNotificationCmd/group/bld.inf
satengine/satserver/Commands/LanguageNotificationCmd/inc/CLanguageNotificationHandler.h
satengine/satserver/Commands/LanguageNotificationCmd/inc/LanguageNotificationCmd.rls
satengine/satserver/Commands/LanguageNotificationCmd/src/101F79FE.rss
satengine/satserver/Commands/LanguageNotificationCmd/src/CLanguageNotificationHandler.cpp
satengine/satserver/Commands/LanguageNotificationCmd/src/std.cpp
satengine/satserver/Commands/LaunchBrowserCmd/group/LaunchBrowserCmd.mmp
satengine/satserver/Commands/LaunchBrowserCmd/group/bld.inf
satengine/satserver/Commands/LaunchBrowserCmd/inc/CLaunchBrowserHandler.h
satengine/satserver/Commands/LaunchBrowserCmd/inc/LaunchBrowserCmd.rls
satengine/satserver/Commands/LaunchBrowserCmd/src/1000A88D.rss
satengine/satserver/Commands/LaunchBrowserCmd/src/CLaunchBrowserHandler.cpp
satengine/satserver/Commands/LaunchBrowserCmd/src/std.cpp
satengine/satserver/Commands/MoSmControlCmd/group/MoSmControl.mmp
satengine/satserver/Commands/MoSmControlCmd/group/bld.inf
satengine/satserver/Commands/MoSmControlCmd/inc/CMoSmControlHandler.h
satengine/satserver/Commands/MoSmControlCmd/inc/MoSmControlCmd.rls
satengine/satserver/Commands/MoSmControlCmd/src/1020298D.rss
satengine/satserver/Commands/MoSmControlCmd/src/CMoSmControlHandler.cpp
satengine/satserver/Commands/MoSmControlCmd/src/std.cpp
satengine/satserver/Commands/OpenChannelCmd/group/OpenChannelCmd.mmp
satengine/satserver/Commands/OpenChannelCmd/group/bld.inf
satengine/satserver/Commands/OpenChannelCmd/inc/COpenChannelHandler.h
satengine/satserver/Commands/OpenChannelCmd/inc/OpenChannelCmd.rls
satengine/satserver/Commands/OpenChannelCmd/src/101F79FA.rss
satengine/satserver/Commands/OpenChannelCmd/src/COpenChannelHandler.cpp
satengine/satserver/Commands/OpenChannelCmd/src/std.cpp
satengine/satserver/Commands/PlayToneCmd/group/PlayToneCmd.mmp
satengine/satserver/Commands/PlayToneCmd/group/bld.inf
satengine/satserver/Commands/PlayToneCmd/inc/CPlayToneHandler.h
satengine/satserver/Commands/PlayToneCmd/inc/PlayToneCmd.rls
satengine/satserver/Commands/PlayToneCmd/src/1000A887.rss
satengine/satserver/Commands/PlayToneCmd/src/CPlayToneHandler.cpp
satengine/satserver/Commands/PlayToneCmd/src/std.cpp
satengine/satserver/Commands/ProvideLocalInfoCmd/group/ProvideLocalInfoCmd.mmp
satengine/satserver/Commands/ProvideLocalInfoCmd/group/bld.inf
satengine/satserver/Commands/ProvideLocalInfoCmd/inc/CProvideLocalInfoHandler.h
satengine/satserver/Commands/ProvideLocalInfoCmd/inc/ProvideLocalInfoCmd.rls
satengine/satserver/Commands/ProvideLocalInfoCmd/src/10205C45.rss
satengine/satserver/Commands/ProvideLocalInfoCmd/src/CProvideLocalInfoHandler.cpp
satengine/satserver/Commands/ProvideLocalInfoCmd/src/std.cpp
satengine/satserver/Commands/ReceiveDataCmd/group/ReceiveDataCmd.mmp
satengine/satserver/Commands/ReceiveDataCmd/group/bld.inf
satengine/satserver/Commands/ReceiveDataCmd/inc/CReceiveDataHandler.h
satengine/satserver/Commands/ReceiveDataCmd/inc/ReceiveDataCmd.rls
satengine/satserver/Commands/ReceiveDataCmd/src/10205C52.rss
satengine/satserver/Commands/ReceiveDataCmd/src/CReceiveDataHandler.cpp
satengine/satserver/Commands/ReceiveDataCmd/src/std.cpp
satengine/satserver/Commands/RefreshCmd/group/RefreshCmd.mmp
satengine/satserver/Commands/RefreshCmd/group/bld.inf
satengine/satserver/Commands/RefreshCmd/inc/CRefreshHandler.h
satengine/satserver/Commands/RefreshCmd/inc/RefreshCmd.rls
satengine/satserver/Commands/RefreshCmd/src/10202990.rss
satengine/satserver/Commands/RefreshCmd/src/CRefreshHandler.cpp
satengine/satserver/Commands/RefreshCmd/src/std.cpp
satengine/satserver/Commands/RefreshRequiredCmd/group/RefreshRequiredCmd.mmp
satengine/satserver/Commands/RefreshRequiredCmd/group/bld.inf
satengine/satserver/Commands/RefreshRequiredCmd/inc/CRefreshRequiredHandler.h
satengine/satserver/Commands/RefreshRequiredCmd/inc/RefreshRequiredCmd.rls
satengine/satserver/Commands/RefreshRequiredCmd/src/102078D9.rss
satengine/satserver/Commands/RefreshRequiredCmd/src/CRefreshRequiredHandler.cpp
satengine/satserver/Commands/RefreshRequiredCmd/src/std.cpp
satengine/satserver/Commands/SelectItemCmd/group/Create-UT_CSelectItemHandler-Sis.bat
satengine/satserver/Commands/SelectItemCmd/group/SelectItemCmd.mmp
satengine/satserver/Commands/SelectItemCmd/group/UT_CSelectItemHandler.pkg
satengine/satserver/Commands/SelectItemCmd/group/bld.inf
satengine/satserver/Commands/SelectItemCmd/inc/CSelectItemHandler.h
satengine/satserver/Commands/SelectItemCmd/inc/SelectItemCmd.rls
satengine/satserver/Commands/SelectItemCmd/src/1000f00A.rss
satengine/satserver/Commands/SelectItemCmd/src/CSelectItemHandler.cpp
satengine/satserver/Commands/SelectItemCmd/src/std.cpp
satengine/satserver/Commands/SendDataCmd/group/SendDataCmd.mmp
satengine/satserver/Commands/SendDataCmd/group/bld.inf
satengine/satserver/Commands/SendDataCmd/inc/CSendDataHandler.h
satengine/satserver/Commands/SendDataCmd/inc/SendDataCmd.rls
satengine/satserver/Commands/SendDataCmd/src/10205C50.rss
satengine/satserver/Commands/SendDataCmd/src/CSendDataHandler.cpp
satengine/satserver/Commands/SendDataCmd/src/std.cpp
satengine/satserver/Commands/SendDtmfCmd/group/SendDtmfCmd.mmp
satengine/satserver/Commands/SendDtmfCmd/group/bld.inf
satengine/satserver/Commands/SendDtmfCmd/inc/CSendDtmfHandler.h
satengine/satserver/Commands/SendDtmfCmd/inc/SendDtmfCmd.rls
satengine/satserver/Commands/SendDtmfCmd/inc/csatdtmfsender.h
satengine/satserver/Commands/SendDtmfCmd/src/1000A88B.rss
satengine/satserver/Commands/SendDtmfCmd/src/CSendDtmfHandler.cpp
satengine/satserver/Commands/SendDtmfCmd/src/csatdtmfsender.cpp
satengine/satserver/Commands/SendDtmfCmd/src/std.cpp
satengine/satserver/Commands/SendSSCmd/group/SendSsCmd.mmp
satengine/satserver/Commands/SendSSCmd/group/bld.inf
satengine/satserver/Commands/SendSSCmd/inc/CSendSsHandler.h
satengine/satserver/Commands/SendSSCmd/inc/SendSsCmd.rls
satengine/satserver/Commands/SendSSCmd/inc/csatsendssadditionalinfohandler.h
satengine/satserver/Commands/SendSSCmd/inc/csatsendssbarringnouiobs.h
satengine/satserver/Commands/SendSSCmd/inc/csatsendsscallwaitingnouiobs.h
satengine/satserver/Commands/SendSSCmd/inc/csatsendssclinouiobs.h
satengine/satserver/Commands/SendSSCmd/inc/csatsendssdivertnouiobs.h
satengine/satserver/Commands/SendSSCmd/inc/csatsendsshandler.h
satengine/satserver/Commands/SendSSCmd/inc/csatsendssrequestcompletehandler.h
satengine/satserver/Commands/SendSSCmd/src/1000A884.rss
satengine/satserver/Commands/SendSSCmd/src/CSendSsHandler.cpp
satengine/satserver/Commands/SendSSCmd/src/csatsendssadditionalinfohandler.cpp
satengine/satserver/Commands/SendSSCmd/src/csatsendssbarringnouiobs.cpp
satengine/satserver/Commands/SendSSCmd/src/csatsendsscallwaitingnouiobs.cpp
satengine/satserver/Commands/SendSSCmd/src/csatsendssclinouiobs.cpp
satengine/satserver/Commands/SendSSCmd/src/csatsendssdivertnouiobs.cpp
satengine/satserver/Commands/SendSSCmd/src/csatsendsshandler.cpp
satengine/satserver/Commands/SendSSCmd/src/csatsendssrequestcompletehandler.cpp
satengine/satserver/Commands/SendSSCmd/src/std.cpp
satengine/satserver/Commands/SendSmCmd/group/SendSmCmd.mmp
satengine/satserver/Commands/SendSmCmd/group/bld.inf
satengine/satserver/Commands/SendSmCmd/inc/CSatSSendMessageNoLoggingHandler.h
satengine/satserver/Commands/SendSmCmd/inc/CSendSmHandler.h
satengine/satserver/Commands/SendSmCmd/inc/MSatSmsObserver.h
satengine/satserver/Commands/SendSmCmd/inc/SendSmCmd.rls
satengine/satserver/Commands/SendSmCmd/src/1000f020.rss
satengine/satserver/Commands/SendSmCmd/src/CSatSSendMessageNoLoggingHandler.cpp
satengine/satserver/Commands/SendSmCmd/src/CSendSmHandler.cpp
satengine/satserver/Commands/SendSmCmd/src/std.cpp
satengine/satserver/Commands/SendUSSDCmd/group/SendUssdCmd.mmp
satengine/satserver/Commands/SendUSSDCmd/group/bld.inf
satengine/satserver/Commands/SendUSSDCmd/inc/CSendUssdHandler.h
satengine/satserver/Commands/SendUSSDCmd/inc/SendUssdCmd.rls
satengine/satserver/Commands/SendUSSDCmd/src/10202983.rss
satengine/satserver/Commands/SendUSSDCmd/src/CSendUssdHandler.cpp
satengine/satserver/Commands/SendUSSDCmd/src/std.cpp
satengine/satserver/Commands/SetUpCallCmd/group/Create-UT_CSetUpCallHandler-Sis.bat
satengine/satserver/Commands/SetUpCallCmd/group/SetUpCallCmd.mmp
satengine/satserver/Commands/SetUpCallCmd/group/UT_CSetUpCallHandler.pkg
satengine/satserver/Commands/SetUpCallCmd/group/bld.inf
satengine/satserver/Commands/SetUpCallCmd/inc/CSetUpCallHandler.h
satengine/satserver/Commands/SetUpCallCmd/inc/SetUpCallCmd.rls
satengine/satserver/Commands/SetUpCallCmd/inc/csetupcallrequesthandler.h
satengine/satserver/Commands/SetUpCallCmd/src/1000f005.rss
satengine/satserver/Commands/SetUpCallCmd/src/CSetUpCallHandler.cpp
satengine/satserver/Commands/SetUpCallCmd/src/csetupcallrequesthandler.cpp
satengine/satserver/Commands/SetUpCallCmd/src/std.cpp
satengine/satserver/Commands/SetUpEventListCmd/group/SetUpEventListCmd.mmp
satengine/satserver/Commands/SetUpEventListCmd/group/bld.inf
satengine/satserver/Commands/SetUpEventListCmd/inc/CSetUpEventListHandler.h
satengine/satserver/Commands/SetUpEventListCmd/inc/SetUpEventListCmd.rls
satengine/satserver/Commands/SetUpEventListCmd/src/10202992.rss
satengine/satserver/Commands/SetUpEventListCmd/src/CSetUpEventListHandler.cpp
satengine/satserver/Commands/SetUpEventListCmd/src/std.cpp
satengine/satserver/Commands/SetUpIdleModeTextCmd/group/SetUpIdleModeTextCmd.mmp
satengine/satserver/Commands/SetUpIdleModeTextCmd/group/bld.inf
satengine/satserver/Commands/SetUpIdleModeTextCmd/inc/CSetUpIdleModeTextHandler.h
satengine/satserver/Commands/SetUpIdleModeTextCmd/inc/SetUpIdleModeTextCmd.rls
satengine/satserver/Commands/SetUpIdleModeTextCmd/src/1000A88A.rss
satengine/satserver/Commands/SetUpIdleModeTextCmd/src/CSetUpIdleModeTextHandler.cpp
satengine/satserver/Commands/SetUpIdleModeTextCmd/src/std.cpp
satengine/satserver/Commands/SetUpMenuCmd/group/Create-UT_CSetUpMenuHandler-Sis.bat
satengine/satserver/Commands/SetUpMenuCmd/group/SetUpMenuCmd.mmp
satengine/satserver/Commands/SetUpMenuCmd/group/UT_CSetUpMenuHandler.pkg
satengine/satserver/Commands/SetUpMenuCmd/group/bld.inf
satengine/satserver/Commands/SetUpMenuCmd/inc/CSetUpMenuHandler.h
satengine/satserver/Commands/SetUpMenuCmd/inc/SetUpMenuCmd.rls
satengine/satserver/Commands/SetUpMenuCmd/src/1000f000.rss
satengine/satserver/Commands/SetUpMenuCmd/src/CSetUpMenuHandler.cpp
satengine/satserver/Commands/SetUpMenuCmd/src/std.cpp
satengine/satserver/Commands/SimSessionEndCmd/group/SimSessionEndCmd.mmp
satengine/satserver/Commands/SimSessionEndCmd/group/bld.inf
satengine/satserver/Commands/SimSessionEndCmd/inc/CSimSessionEndHandler.h
satengine/satserver/Commands/SimSessionEndCmd/inc/SimSessionEndCmd.rls
satengine/satserver/Commands/SimSessionEndCmd/src/1000f010.rss
satengine/satserver/Commands/SimSessionEndCmd/src/CSimSessionEndHandler.cpp
satengine/satserver/Commands/SimSessionEndCmd/src/std.cpp
satengine/satserver/Engine/BWINS/SATENGINEU.DEF
satengine/satserver/Engine/EABI/SatEngineU.DEF
satengine/satserver/Engine/group/Create-UT_CCommandHandler-Sis.bat
satengine/satserver/Engine/group/Create-UT_TSatEventMediator-Sis.bat
satengine/satserver/Engine/group/Create-UT_TSatEventsObserver-Sis.bat
satengine/satserver/Engine/group/SatEngine.mmp
satengine/satserver/Engine/group/SatEngineLib.mmp
satengine/satserver/Engine/group/UT_CCommandHandler.pkg
satengine/satserver/Engine/group/UT_TSatEventMediator.pkg
satengine/satserver/Engine/group/UT_TSatEventsObserver.pkg
satengine/satserver/Engine/group/bld.inf
satengine/satserver/Engine/inc/CSatApnHandler.h
satengine/satserver/Engine/inc/CSatBIPDataReceiver.h
satengine/satserver/Engine/inc/CSatBIPDataSender.h
satengine/satserver/Engine/inc/CSatBIPGPRSDataChannel.h
satengine/satserver/Engine/inc/CSatBIPUtils.h
satengine/satserver/Engine/inc/CSatClientServiceReq.h
satengine/satserver/Engine/inc/CSatCommandContainer.h
satengine/satserver/Engine/inc/CSatEventMonitorContainer.h
satengine/satserver/Engine/inc/CSatIconHandler.h
satengine/satserver/Engine/inc/CSatSAPChangeObserver.h
satengine/satserver/Engine/inc/CSatSBasicIconConverter.h
satengine/satserver/Engine/inc/CSatSColorIconConverter.h
satengine/satserver/Engine/inc/CSatSIconConverter.h
satengine/satserver/Engine/inc/CSatSIconSubSession.h
satengine/satserver/Engine/inc/CSatSRefreshSubSession.h
satengine/satserver/Engine/inc/CSatSServer.h
satengine/satserver/Engine/inc/CSatSSession.h
satengine/satserver/Engine/inc/CSatSSimSubscriberId.h
satengine/satserver/Engine/inc/CSatSSubSession.h
satengine/satserver/Engine/inc/CSatSUiClientHandler.h
satengine/satserver/Engine/inc/CSatSUiSubSession.h
satengine/satserver/Engine/inc/CSatThreadDeathMonitor.h
satengine/satserver/Engine/inc/EnginePanic.h
satengine/satserver/Engine/inc/MSatIconObserver.h
satengine/satserver/Engine/inc/MSatSIconAPI.h
satengine/satserver/Engine/inc/MSatSSessions.h
satengine/satserver/Engine/inc/MSatShellController.h
satengine/satserver/Engine/inc/MThreadDeathNotifier.h
satengine/satserver/Engine/inc/MThreadDeathObserver.h
satengine/satserver/Engine/inc/TSatBitOP.h
satengine/satserver/Engine/inc/TSatChannelIDInfo.h
satengine/satserver/Engine/inc/TSatEventMediator.h
satengine/satserver/Engine/inc/TSatEventsObserver.h
satengine/satserver/Engine/inc/TSatQoSParser.h
satengine/satserver/Engine/inc/TUSatAPI.h
satengine/satserver/Engine/inc/csatbipconnectionobserver.h
satengine/satserver/Engine/inc/csatbipsubconneventobserver.h
satengine/satserver/Engine/inc/csatmediatoreventprovider.h
satengine/satserver/Engine/inc/csatmultimodeapi.h
satengine/satserver/Engine/inc/csatprofilechangeobserver.h
satengine/satserver/Engine/src/CSatApnHandler.cpp
satengine/satserver/Engine/src/CSatBIPDataReceiver.cpp
satengine/satserver/Engine/src/CSatBIPDataSender.cpp
satengine/satserver/Engine/src/CSatBIPGPRSDataChannel.cpp
satengine/satserver/Engine/src/CSatBIPUtils.cpp
satengine/satserver/Engine/src/CSatClientServiceReq.cpp
satengine/satserver/Engine/src/CSatCommandContainer.cpp
satengine/satserver/Engine/src/CSatCommandHandler.cpp
satengine/satserver/Engine/src/CSatEventMonitorContainer.cpp
satengine/satserver/Engine/src/CSatIconHandler.cpp
satengine/satserver/Engine/src/CSatSAPChangeObserver.cpp
satengine/satserver/Engine/src/CSatSBasicIconConverter.cpp
satengine/satserver/Engine/src/CSatSColorIconConverter.cpp
satengine/satserver/Engine/src/CSatSIconConverter.cpp
satengine/satserver/Engine/src/CSatSIconSubSession.cpp
satengine/satserver/Engine/src/CSatSRefreshSubSession.cpp
satengine/satserver/Engine/src/CSatSScheduler.cpp
satengine/satserver/Engine/src/CSatSServer.cpp
satengine/satserver/Engine/src/CSatSSession.cpp
satengine/satserver/Engine/src/CSatSSimSubscriberId.cpp
satengine/satserver/Engine/src/CSatSSubSession.cpp
satengine/satserver/Engine/src/CSatSUiClientHandler.cpp
satengine/satserver/Engine/src/CSatSUiSubSession.cpp
satengine/satserver/Engine/src/CSatThreadDeathMonitor.cpp
satengine/satserver/Engine/src/Panic.cpp
satengine/satserver/Engine/src/SatServer.hrh
satengine/satserver/Engine/src/SatServer.rss
satengine/satserver/Engine/src/TSatBitOP.cpp
satengine/satserver/Engine/src/TSatChannelIDInfo.cpp
satengine/satserver/Engine/src/TSatEventMediator.cpp
satengine/satserver/Engine/src/TSatEventsObserver.cpp
satengine/satserver/Engine/src/TSatExtErrorUtils.cpp
satengine/satserver/Engine/src/TSatQoSParser.cpp
satengine/satserver/Engine/src/TUSatAPI.cpp
satengine/satserver/Engine/src/csatbipconnectionobserver.cpp
satengine/satserver/Engine/src/csatbipsubconneventobserver.cpp
satengine/satserver/Engine/src/csatmediatoreventprovider.cpp
satengine/satserver/Engine/src/csatmultimodeapi.cpp
satengine/satserver/Engine/src/csatprofilechangeobserver.cpp
satengine/satserver/Engine/src/csatsactivewrapper.cpp
satengine/satserver/Engine/src/std.cpp
satengine/satserver/EventMonitors/BWINS/SatEventMonitorsU.DEF
satengine/satserver/EventMonitors/EABI/SatEventMonitorsU.DEF
satengine/satserver/EventMonitors/group/EventMonitors.mmp
satengine/satserver/EventMonitors/group/bld.inf
satengine/satserver/EventMonitors/inc/CSatBIPChannelStatusMonitor.h
satengine/satserver/EventMonitors/inc/CSatBIPDataAvailableMonitor.h
satengine/satserver/EventMonitors/inc/CSatBrowserTerminationMonitor.h
satengine/satserver/EventMonitors/inc/CSatBrowserThreadMonitor.h
satengine/satserver/EventMonitors/inc/CSatEventMonitorHandler.h
satengine/satserver/EventMonitors/inc/CSatIdleScreenMonitor.h
satengine/satserver/EventMonitors/inc/CSatLanguageSelectionMonitor.h
satengine/satserver/EventMonitors/inc/CSatSimRemovalMonitor.h
satengine/satserver/EventMonitors/inc/CSatUserActivityMonitor.h
satengine/satserver/EventMonitors/inc/csatbrowserwsmonitor.h
satengine/satserver/EventMonitors/inc/msatbrowserthreadobserver.h
satengine/satserver/EventMonitors/inc/msatbrowserwsobserver.h
satengine/satserver/EventMonitors/src/CSatBIPChannelStatusMonitor.cpp
satengine/satserver/EventMonitors/src/CSatBIPDataAvailableMonitor.cpp
satengine/satserver/EventMonitors/src/CSatBrowserTerminationMonitor.cpp
satengine/satserver/EventMonitors/src/CSatBrowserThreadMonitor.cpp
satengine/satserver/EventMonitors/src/CSatEventMonitorHandler.cpp
satengine/satserver/EventMonitors/src/CSatIdleScreenMonitor.cpp
satengine/satserver/EventMonitors/src/CSatLanguageSelectionMonitor.cpp
satengine/satserver/EventMonitors/src/CSatSimRemovalMonitor.cpp
satengine/satserver/EventMonitors/src/CSatUserActivityMonitor.cpp
satengine/satserver/EventMonitors/src/TSatEventMonitorFactory.cpp
satengine/satserver/EventMonitors/src/csatbrowserwsmonitor.cpp
satengine/satserver/SatClient/BMARM/SATCLIENTU.DEF
satengine/satserver/SatClient/BMARM/SATSERVERU.DEF
satengine/satserver/SatClient/BMARM/SATSHELLCNTRLU.DEF
satengine/satserver/SatClient/BWINS/SATCLIENTU.DEF
satengine/satserver/SatClient/EABI/SatClientU.DEF
satengine/satserver/SatClient/group/SatClient.mmp
satengine/satserver/SatClient/group/bld.inf
satengine/satserver/SatClient/inc/CSatAllowRefreshMonitor.h
satengine/satserver/SatClient/inc/CSatRefreshMonitor.h
satengine/satserver/SatClient/inc/csatpluginmonitor.h
satengine/satserver/SatClient/src/CSatAllowRefreshMonitor.cpp
satengine/satserver/SatClient/src/CSatRefreshMonitor.cpp
satengine/satserver/SatClient/src/RSatRefresh.cpp
satengine/satserver/SatClient/src/RSatSession.cpp
satengine/satserver/SatClient/src/TSatIconInfo.cpp
satengine/satserver/SatClient/src/csatpluginmonitor.cpp
satengine/satserver/SatClient/src/rsatservice.cpp
satengine/satserver/SatInternalClient/bwins/SatInternalClientu.def
satengine/satserver/SatInternalClient/eabi/SatInternalClientu.def
satengine/satserver/SatInternalClient/group/bld.inf
satengine/satserver/SatInternalClient/group/satinternalclient.mmp
satengine/satserver/SatInternalClient/inc/CSatCActiveCommandHandler.h
satengine/satserver/SatInternalClient/inc/CSatCCommandProcessor.h
satengine/satserver/SatInternalClient/inc/CSatCDisplayTextHandler.h
satengine/satserver/SatInternalClient/inc/CSatCEventHandler.h
satengine/satserver/SatInternalClient/inc/CSatCGetInkeyHandler.h
satengine/satserver/SatInternalClient/inc/CSatCGetInputHandler.h
satengine/satserver/SatInternalClient/inc/CSatCNotifyHandler.h
satengine/satserver/SatInternalClient/inc/CSatCPlayToneHandler.h
satengine/satserver/SatInternalClient/inc/CSatCQueryHandler.h
satengine/satserver/SatInternalClient/inc/CSatCSelectItemHandler.h
satengine/satserver/SatInternalClient/inc/CSatCSetUpMenuHandler.h
satengine/satserver/SatInternalClient/inc/MSatUiAdapter.h
satengine/satserver/SatInternalClient/inc/MSatUiObserver.h
satengine/satserver/SatInternalClient/inc/RSatUiSession.h
satengine/satserver/SatInternalClient/src/CSatCActiveCommandHandler.cpp
satengine/satserver/SatInternalClient/src/CSatCCommandProcessor.cpp
satengine/satserver/SatInternalClient/src/CSatCDisplayTextHandler.cpp
satengine/satserver/SatInternalClient/src/CSatCEventHandler.cpp
satengine/satserver/SatInternalClient/src/CSatCGetInkeyHandler.cpp
satengine/satserver/SatInternalClient/src/CSatCGetInputHandler.cpp
satengine/satserver/SatInternalClient/src/CSatCNotifyHandler.cpp
satengine/satserver/SatInternalClient/src/CSatCPlayToneHandler.cpp
satengine/satserver/SatInternalClient/src/CSatCQueryHandler.cpp
satengine/satserver/SatInternalClient/src/CSatCSelectItemHandler.cpp
satengine/satserver/SatInternalClient/src/CSatCSetUpMenuHandler.cpp
satengine/satserver/SatInternalClient/src/RSatUiSession.cpp
satengine/satserver/SatServer/BWINS/SATSERVERU.DEF
satengine/satserver/SatServer/EABI/SatServerU.DEF
satengine/satserver/SatServer/group/SatServer.mmp
satengine/satserver/SatServer/group/bld.inf
satengine/satserver/SatServer/inc/SatSPanic.h
satengine/satserver/SatServer/src/std.cpp
satengine/satserver/SystemState/BMARM/SATSYSTEMSTATEU.DEF
satengine/satserver/SystemState/BWINS/SATSYSTEMSTATEU.DEF
satengine/satserver/SystemState/EABI/SatSystemStateU.DEF
satengine/satserver/SystemState/group/SatSystemState.mmp
satengine/satserver/SystemState/group/bld.inf
satengine/satserver/SystemState/inc/CSatCenRepChangeNotifier.h
satengine/satserver/SystemState/inc/CSatPSChangeNotifier.h
satengine/satserver/SystemState/inc/CSatSystemState.h
satengine/satserver/SystemState/inc/Panic.h
satengine/satserver/SystemState/inc/csatnetworkregstatusmonitor.h
satengine/satserver/SystemState/src/CSatCenRepChangeNotifier.cpp
satengine/satserver/SystemState/src/CSatPSChangeNotifier.cpp
satengine/satserver/SystemState/src/CSatSystemState.cpp
satengine/satserver/SystemState/src/TSatSystemStateFactory.cpp
satengine/satserver/SystemState/src/csatnetworkregstatusmonitor.cpp
satengine/satserver/SystemState/src/std.cpp
satengine/satserver/conf/sat.confml
satengine/satserver/conf/sat_102078E1.crml
satengine/satserver/group/bld.inf
satengine/satserver/group/satserver_stub.pkg
satengine/satserver/group/satserver_stub.sis
satengine/satserver/inc/CSatCommandHandler.h
satengine/satserver/inc/CSatSScheduler.h
satengine/satserver/inc/MSatApi.h
satengine/satserver/inc/MSatApnHandler.h
satengine/satserver/inc/MSatBIPChannelStatusObserver.h
satengine/satserver/inc/MSatBIPDataAvailableObserver.h
satengine/satserver/inc/MSatBIPDataChannel.h
satengine/satserver/inc/MSatBIPEventNotifier.h
satengine/satserver/inc/MSatBIPUtils.h
satengine/satserver/inc/MSatCommand.h
satengine/satserver/inc/MSatConnectionObserver.h
satengine/satserver/inc/MSatEventMonitor.h
satengine/satserver/inc/MSatEventMonitorContainer.h
satengine/satserver/inc/MSatEventMonitorUtils.h
satengine/satserver/inc/MSatEventObserver.h
satengine/satserver/inc/MSatRefreshSubSession.h
satengine/satserver/inc/MSatSSimSubscriberId.h
satengine/satserver/inc/MSatSUiClientHandler.h
satengine/satserver/inc/MSatSendDataObserver.h
satengine/satserver/inc/MSatSystemState.h
satengine/satserver/inc/MSatSystemStateChangeNotifier.h
satengine/satserver/inc/MSatSystemStateObserver.h
satengine/satserver/inc/MSatUiSession.h
satengine/satserver/inc/MSatUtils.h
satengine/satserver/inc/SATPrivateCRKeys.h
satengine/satserver/inc/SatLog.h
satengine/satserver/inc/SatMacroes.h
satengine/satserver/inc/SatSOpcodes.h
satengine/satserver/inc/SatSTypes.h
satengine/satserver/inc/SatServerFactory.h
satengine/satserver/inc/TSatEventMonitorFactory.h
satengine/satserver/inc/TSatExtErrorUtils.h
satengine/satserver/inc/TSatSystemStateFactory.h
satengine/satserver/inc/csatsactivewrapper.h
satengine/satserver/inc/msatasynctosync.h
satengine/satserver/inc/msatmediatoreventprovider.h
satengine/satserver/inc/msatmultimodeapi.h
satengine/satserver/inc/tsatinternaliconinfo.h
satengine/satserver/loc/SatServer.loc
satengine/satserver/rom/SatServerResources.iby
satengine/satserver/rom/satserver.iby
satui/satapp/inc/csatuiiconhandler.h
satui/satapp/inc/csatuiobserver.h
satui/satapp/inc/dialogwaiter.h
satui/satapp/inc/msatuiactionimplementer.h
satui/satapp/inc/satappaction.h
satui/satapp/inc/satappcommandhandler.h
satui/satapp/inc/satappcommonconstant.h
satui/satapp/inc/satappconfirmprovider.h
satui/satapp/inc/satappconstant.h
satui/satapp/inc/satappeventprovider.h
satui/satapp/inc/satappinputprovider.h
satui/satapp/inc/satappmainhandler.h
satui/satapp/inc/satappmenuprovider.h
satui/satapp/inc/satappplaytoneprovider.h
satui/satapp/inc/satapppopupprovider.h
satui/satapp/inc/satappserverdispatcher.h
satui/satapp/inc/satapptoneprovider.h
satui/satapp/inc/satappuiprovider.h
satui/satapp/inc/satappview.h
satui/satapp/inc/tflogger.h
satui/satapp/resource/sat_text_map.xls
satui/satapp/resource/satapp.docml
satui/satapp/resource/satapp.qm
satui/satapp/resource/satapp.qrc
satui/satapp/resource/satapp.ts
satui/satapp/resource/satapp_en.qm
satui/satapp/resource/satapp_en.ts
satui/satapp/satapp.pro
satui/satapp/src/csatuiiconhandler.cpp
satui/satapp/src/csatuiobserver.cpp
satui/satapp/src/dialogwaiter.cpp
satui/satapp/src/main.cpp
satui/satapp/src/satappaction.cpp
satui/satapp/src/satappcommandhandler.cpp
satui/satapp/src/satappconfirmprovider.cpp
satui/satapp/src/satappeventprovider.cpp
satui/satapp/src/satappinputprovider.cpp
satui/satapp/src/satappmainhandler.cpp
satui/satapp/src/satappmenuprovider.cpp
satui/satapp/src/satappplaytoneprovider.cpp
satui/satapp/src/satapppopupprovider.cpp
satui/satapp/src/satappserverdispatcher.cpp
satui/satapp/src/satapptoneprovider.cpp
satui/satapp/src/satappuiprovider.cpp
satui/satapp/src/satappview.cpp
satui/satapp/tsrc/ut_satapp/inc/dummyeventprovider.h
satui/satapp/tsrc/ut_satapp/inc/dummyplaytoneprovider.h
satui/satapp/tsrc/ut_satapp/inc/ut_csatuiobserver.h
satui/satapp/tsrc/ut_satapp/inc/ut_playtoneprovider.h
satui/satapp/tsrc/ut_satapp/inc/ut_satappaction.h
satui/satapp/tsrc/ut_satapp/inc/ut_satappconfirmprovider.h
satui/satapp/tsrc/ut_satapp/inc/ut_satappeventhandler.h
satui/satapp/tsrc/ut_satapp/inc/ut_satappinputprovider.h
satui/satapp/tsrc/ut_satapp/inc/ut_satappmainhandler.h
satui/satapp/tsrc/ut_satapp/inc/ut_satappmenuprovider.h
satui/satapp/tsrc/ut_satapp/inc/ut_satapppopupprovider.h
satui/satapp/tsrc/ut_satapp/inc/ut_satappserverdispatcher.h
satui/satapp/tsrc/ut_satapp/inc/ut_satapptoneprovider.h
satui/satapp/tsrc/ut_satapp/src/dummyeventprovider.cpp
satui/satapp/tsrc/ut_satapp/src/dummyplaytoneprovider.cpp
satui/satapp/tsrc/ut_satapp/src/main.cpp
satui/satapp/tsrc/ut_satapp/src/rsat_stub.cpp
satui/satapp/tsrc/ut_satapp/src/ut_csatuiobserver.cpp
satui/satapp/tsrc/ut_satapp/src/ut_playtoneprovider.cpp
satui/satapp/tsrc/ut_satapp/src/ut_satappaction.cpp
satui/satapp/tsrc/ut_satapp/src/ut_satappconfirmprovider.cpp
satui/satapp/tsrc/ut_satapp/src/ut_satappeventhandler.cpp
satui/satapp/tsrc/ut_satapp/src/ut_satappinputprovider.cpp
satui/satapp/tsrc/ut_satapp/src/ut_satappmainhandler.cpp
satui/satapp/tsrc/ut_satapp/src/ut_satappmenuprovider.cpp
satui/satapp/tsrc/ut_satapp/src/ut_satapppopupprovider.cpp
satui/satapp/tsrc/ut_satapp/src/ut_satappserverdispatcher.cpp
satui/satapp/tsrc/ut_satapp/src/ut_satapptoneprovider.cpp
satui/satapp/tsrc/ut_satapp/ut_satapp.pro
telutils/dialpad/bwins/dialpadu.def
telutils/dialpad/dialpad.pro
telutils/dialpad/eabi/dialpadu.def
telutils/dialpad/inc/dialpadkeypad.h
telutils/dialpad/inc/dialpadnumericbutton.h
telutils/dialpad/resources/dialpad.css
telutils/dialpad/src/dialpad.cpp
telutils/dialpad/src/dialpadbluetootheventfilter.cpp
telutils/dialpad/src/dialpademergencycalleventfilter.cpp
telutils/dialpad/src/dialpadhasheventfilter.cpp
telutils/dialpad/src/dialpadkeypad.cpp
telutils/dialpad/src/dialpadkeysequenceeventfilter.cpp
telutils/dialpad/src/dialpadnumericbutton.cpp
telutils/dialpad/src/dialpadvideomailboxeventfilter.cpp
telutils/dialpad/src/dialpadvoicemailboxeventfilter.cpp
telutils/dialpad/tsrc/unit/shared/mock_cphcltemergencycall.cpp
telutils/dialpad/tsrc/unit/shared/mock_cphcltemergencycall.h
telutils/dialpad/tsrc/unit/shared/mock_dialpadhasheventfilter.cpp
telutils/dialpad/tsrc/unit/shared/mock_hbnotificationdialog.cpp
telutils/dialpad/tsrc/unit/unit.pro
telutils/dialpad/tsrc/unit/ut_dialpademergencycalleventfilter/ut_dialpademergencycalleventfilter.cpp
telutils/dialpad/tsrc/unit/ut_dialpademergencycalleventfilter/ut_dialpademergencycalleventfilter.pro
telutils/dialpad/tsrc/unit/ut_dialpademergencycalleventfilter/xqservicerequest.h
telutils/dialpad/tsrc/unit/ut_dialpadkeyhandler/ut_dialpadkeyhandler.cpp
telutils/dialpad/tsrc/unit/ut_dialpadnumericbutton/ut_dialpadnumericbutton.cpp
telutils/dialpad/tsrc/unit/ut_dialpadnumericbutton/ut_dialpadnumericbutton.pro
telutils/phoneparser/bmarm/phoneparseru.def
telutils/phoneparser/bwins/phoneparseru.def
telutils/phoneparser/group/phoneparser_stub.sis
telutils/phoneparser/inc/cphonegsmdummyparser.h
telutils/phoneparser/inc/cphonegsmemergencynumberparser.h
telutils/phoneparser/inc/cphonegsmmanufacturerparser.h
telutils/phoneparser/inc/cphonegsmoptioncontainer.h
telutils/phoneparser/inc/cphonegsmparser.h
telutils/phoneparser/inc/cphonegsmparsercontainer.h
telutils/phoneparser/inc/cphonegsmpcnprocedureparser.h
telutils/phoneparser/inc/cphonegsmphonenumberparser.h
telutils/phoneparser/inc/cphonegsmsimcontrolparser.h
telutils/phoneparser/inc/cphonegsmsscallparser.h
telutils/phoneparser/inc/cphonegsmssparser.h
telutils/phoneparser/inc/cphoneparserfeatures.h
telutils/phoneparser/inc/cphonevoipnumberparser.h
telutils/phoneparser/inc/phoneparsercommon.h
telutils/phoneparser/rom/phoneparser.iby
telutils/phoneparser/src/cphonegsmdummyparser.cpp
telutils/phoneparser/src/cphonegsmemergencynumberhandler.cpp
telutils/phoneparser/src/cphonegsmemergencynumberparser.cpp
telutils/phoneparser/src/cphonegsmhandlercontainer.cpp
telutils/phoneparser/src/cphonegsmmanufacturerhandler.cpp
telutils/phoneparser/src/cphonegsmmanufacturerparser.cpp
telutils/phoneparser/src/cphonegsmmischandler.cpp
telutils/phoneparser/src/cphonegsmoptioncontainer.cpp
telutils/phoneparser/src/cphonegsmparser.cpp
telutils/phoneparser/src/cphonegsmparserbase.cpp
telutils/phoneparser/src/cphonegsmparsercontainer.cpp
telutils/phoneparser/src/cphonegsmparserresult.cpp
telutils/phoneparser/src/cphonegsmpcnprocedurehandler.cpp
telutils/phoneparser/src/cphonegsmpcnprocedureparser.cpp
telutils/phoneparser/src/cphonegsmphonenumberhandler.cpp
telutils/phoneparser/src/cphonegsmphonenumberparser.cpp
telutils/phoneparser/src/cphonegsmsimcontrolhandler.cpp
telutils/phoneparser/src/cphonegsmsimcontrolparser.cpp
telutils/phoneparser/src/cphonegsmsscallhandler.cpp
telutils/phoneparser/src/cphonegsmsscallparser.cpp
telutils/phoneparser/src/cphonegsmsshandler.cpp
telutils/phoneparser/src/cphonegsmssparser.cpp
telutils/phoneparser/src/cphoneparserfeatures.cpp
telutils/phoneparser/src/cphonevoipnumberhandler.cpp
telutils/phoneparser/src/cphonevoipnumberparser.cpp
telutils/phoneparser/src/phonegsmparser.cpp
vmbx/vmbxengine/conf/CI_voicemailbox.confml
vmbx/vmbxengine/conf/voicemailbox.confml
vmbx/vmbxengine/vmbxengine.pro
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/Bmarm/CBSCLIENTU.DEF	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,57 @@
+EXPORTS
+	__4RCbs @ 1 NONAME R3UNUSED ; RCbs::RCbs(void)
+	ChangeTopicHotmarkStatus__4RCbsUsi @ 2 NONAME R3UNUSED ; RCbs::ChangeTopicHotmarkStatus(unsigned short, int)
+	ChangeTopicNameAndNumber__4RCbsUsUsRCt4TBuf1i80 @ 3 NONAME ; RCbs::ChangeTopicNameAndNumber(unsigned short, unsigned short, TBuf<80> const &)
+	ChangeTopicSubscriptionStatus__4RCbsUsi @ 4 NONAME R3UNUSED ; RCbs::ChangeTopicSubscriptionStatus(unsigned short, int)
+	Close__4RCbs @ 5 NONAME R3UNUSED ; RCbs::Close(void)
+	Connect__4RCbs @ 6 NONAME R3UNUSED ; RCbs::Connect(void)
+	Connected__C4RCbs @ 7 NONAME R3UNUSED ; RCbs::Connected(void) const
+	CreateNewTopicList__4RCbsRC7TDesC16Ri @ 8 NONAME R3UNUSED ; RCbs::CreateNewTopicList(TDesC16 const &, int &)
+	DeleteAllTopics__4RCbs @ 9 NONAME R3UNUSED ; RCbs::DeleteAllTopics(void)
+	DeleteMessage__4RCbsRCUl @ 10 NONAME R3UNUSED ; RCbs::DeleteMessage(unsigned long const &)
+	DeleteTopicList__4RCbsRCi @ 11 NONAME R3UNUSED ; RCbs::DeleteTopicList(int const &)
+	DeleteTopic__4RCbsUs @ 12 NONAME R3UNUSED ; RCbs::DeleteTopic(unsigned short)
+	FindMessageByHandle__4RCbsRCUlR13TCbsDbMessage @ 13 NONAME R3UNUSED ; RCbs::FindMessageByHandle(unsigned long const &, TCbsDbMessage &)
+	FindTopicByNumber__4RCbsUsR11TCbsDbTopic @ 14 NONAME R3UNUSED ; RCbs::FindTopicByNumber(unsigned short, TCbsDbTopic &)
+	GetHotmarkedMessageHandle__4RCbsRUl @ 15 NONAME R3UNUSED ; RCbs::GetHotmarkedMessageHandle(unsigned long &)
+	GetLanguages__4RCbsR15TCbsDbLanguages @ 16 NONAME R3UNUSED ; RCbs::GetLanguages(TCbsDbLanguages &)
+	GetLatestTopicNumber__4RCbsRUs @ 17 NONAME R3UNUSED ; RCbs::GetLatestTopicNumber(unsigned short &)
+	GetMessageContents__4RCbsRCUlR6TDes16 @ 18 NONAME R3UNUSED ; RCbs::GetMessageContents(unsigned long const &, TDes16 &)
+	GetMessageCount__4RCbsUsRi @ 19 NONAME R3UNUSED ; RCbs::GetMessageCount(unsigned short, int &)
+	GetMessageIndexByHandle__4RCbsRCUlRi @ 20 NONAME R3UNUSED ; RCbs::GetMessageIndexByHandle(unsigned long const &, int &)
+	GetMessage__4RCbsUsiR13TCbsDbMessage @ 21 NONAME ; RCbs::GetMessage(unsigned short, int, TCbsDbMessage &)
+	GetNewTopicsCount__4RCbsRi @ 22 NONAME R3UNUSED ; RCbs::GetNewTopicsCount(int &)
+	GetNextAndPrevMessageHandle__4RCbsRCUlRUlT2Ri @ 23 NONAME ; RCbs::GetNextAndPrevMessageHandle(unsigned long const &, unsigned long &, unsigned long &, int &)
+	GetNextAndPrevTopicNumber__4RCbsRCUsRUsT2Ri @ 24 NONAME ; RCbs::GetNextAndPrevTopicNumber(unsigned short const &, unsigned short &, unsigned short &, int &)
+	GetReadFilesCleanupTime__4RCbsR18TTimeIntervalHours @ 25 NONAME R3UNUSED ; RCbs::GetReadFilesCleanupTime(TTimeIntervalHours &)
+	GetReceptionStatus__4RCbsRi @ 26 NONAME R3UNUSED ; RCbs::GetReceptionStatus(int &)
+	GetReceptionTime__4RCbsRiR5TTimeT2 @ 27 NONAME ; RCbs::GetReceptionTime(int &, TTime &, TTime &)
+	GetTopicCount__4RCbsRi @ 28 NONAME R3UNUSED ; RCbs::GetTopicCount(int &)
+	GetTopicDetectionStatus__4RCbsRi @ 29 NONAME R3UNUSED ; RCbs::GetTopicDetectionStatus(int &)
+	GetTopicListCount__4RCbsRi @ 30 NONAME R3UNUSED ; RCbs::GetTopicListCount(int &)
+	GetTopicList__4RCbsRiR15TCbsDbTopicList @ 31 NONAME R3UNUSED ; RCbs::GetTopicList(int &, TCbsDbTopicList &)
+	GetTopic__4RCbsiR11TCbsDbTopic @ 32 NONAME R3UNUSED ; RCbs::GetTopic(int, TCbsDbTopic &)
+	GetUnreadMessageCount__4RCbsRi @ 33 NONAME R3UNUSED ; RCbs::GetUnreadMessageCount(int &)
+	HasNextCollectionTopic__4RCbs @ 34 NONAME R3UNUSED ; RCbs::HasNextCollectionTopic(void)
+	LockMessage__4RCbsRCUl @ 35 NONAME R3UNUSED ; RCbs::LockMessage(unsigned long const &)
+	NextCollectionTopic__4RCbsR19TCbsDbTopicIdentity @ 36 NONAME R3UNUSED ; RCbs::NextCollectionTopic(TCbsDbTopicIdentity &)
+	NotifyOnTopicListEventCancel__4RCbs @ 37 NONAME R3UNUSED ; RCbs::NotifyOnTopicListEventCancel(void)
+	NotifyOnTopicListEvent__4RCbsR14TRequestStatusiR18TCbsTopicListEventRUs @ 38 NONAME ; RCbs::NotifyOnTopicListEvent(TRequestStatus &, int, TCbsTopicListEvent &, unsigned short &)
+	NotifySettingsChangedCancel__4RCbs @ 39 NONAME R3UNUSED ; RCbs::NotifySettingsChangedCancel(void)
+	NotifySettingsChanged__4RCbsR14TRequestStatusR17TCbsSettingsEvent @ 40 NONAME R3UNUSED ; RCbs::NotifySettingsChanged(TRequestStatus &, TCbsSettingsEvent &)
+	NumberOfUnreadHotmarkedMessages__4RCbs @ 41 NONAME R3UNUSED ; RCbs::NumberOfUnreadHotmarkedMessages(void)
+	ReadMessage__4RCbsRCUl @ 42 NONAME R3UNUSED ; RCbs::ReadMessage(unsigned long const &)
+	RenameTopicList__4RCbsiRC7TDesC16 @ 43 NONAME R3UNUSED ; RCbs::RenameTopicList(int, TDesC16 const &)
+	SaveMessage__4RCbsRCUl @ 44 NONAME R3UNUSED ; RCbs::SaveMessage(unsigned long const &)
+	SelectTopicList__4RCbsRCiR15TCbsDbTopicList @ 45 NONAME R3UNUSED ; RCbs::SelectTopicList(int const &, TCbsDbTopicList &)
+	SetLanguages__4RCbsRC15TCbsDbLanguages @ 46 NONAME R3UNUSED ; RCbs::SetLanguages(TCbsDbLanguages const &)
+	SetReadFilesCleanupTime__4RCbsG18TTimeIntervalHours @ 47 NONAME R3UNUSED ; RCbs::SetReadFilesCleanupTime(TTimeIntervalHours)
+	SetReceptionStatus__4RCbsi @ 48 NONAME R3UNUSED ; RCbs::SetReceptionStatus(int)
+	SetReceptionTime__4RCbsiG5TTimeT2 @ 49 NONAME ; RCbs::SetReceptionTime(int, TTime, TTime)
+	SetTopicDetectionStatus__4RCbsi @ 50 NONAME R3UNUSED ; RCbs::SetTopicDetectionStatus(int)
+	Shutdown__C4RCbs @ 51 NONAME R3UNUSED ; RCbs::Shutdown(void) const
+	StartCollectionBrowsing__4RCbs @ 52 NONAME R3UNUSED ; RCbs::StartCollectionBrowsing(void)
+	Version__C4RCbs @ 53 NONAME R3UNUSED ; RCbs::Version(void) const
+	"_._4RCbs" @ 54 NONAME R3UNUSED ; RCbs::~RCbs(void)
+	AddTopic__4RCbsR11TCbsDbTopic @ 55 NONAME R3UNUSED ; RCbs::AddTopic(TCbsDbTopic &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/Bmarm/CBSMCNCLIENTU.DEF	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,11 @@
+EXPORTS
+	NewL__4CMcn @ 1 NONAME R3UNUSED ; CMcn::NewL(void)
+	GetCellInfo__C4CMcnR6TDes16 @ 2 NONAME R3UNUSED ; CMcn::GetCellInfo(TDes16 &) const
+	NewL__14CMcnTopicArray @ 3 NONAME R3UNUSED ; CMcnTopicArray::NewL(void)
+	AddCbTopicL__14CMcnTopicArrayUs @ 4 NONAME R3UNUSED ; CMcnTopicArray::AddCbTopicL(unsigned short)
+	RegisterL__4CMcnP15MCbsMcnObserverRC14CMcnTopicArray @ 5 NONAME R3UNUSED ; CMcn::RegisterL(MCbsMcnObserver *, CMcnTopicArray const &)
+	Unregister__4CMcnP15MCbsMcnObserver @ 6 NONAME R3UNUSED ; CMcn::Unregister(MCbsMcnObserver *)
+	"_._4CMcn" @ 7 NONAME R3UNUSED ; CMcn::~CMcn(void)
+	GetInfoMessage__C4CMcnR6TDes16i @ 8 NONAME R3UNUSED ; CMcn::GetInfoMessage(TDes16 &, int) const
+	GetTopicNumber__C14CMcnTopicArrayRCUiRUi @ 9 NONAME R3UNUSED ; CMcnTopicArray::GetTopicNumber(unsigned int const &, unsigned int &) const
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/Bwins/CBSCLIENTU.DEF	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,49 @@
+EXPORTS
+	??0RCbs@@QAE@XZ @ 1 NONAME ; RCbs::RCbs(void)
+	??1RCbs@@QAE@XZ @ 2 NONAME ; RCbs::~RCbs(void)
+	?AddTopic@RCbs@@QAEHAAUTCbsDbTopic@@@Z @ 3 NONAME ; int RCbs::AddTopic(struct TCbsDbTopic &)
+	?ChangeTopicHotmarkStatus@RCbs@@QAEHGH@Z @ 4 NONAME ; int RCbs::ChangeTopicHotmarkStatus(unsigned short, int)
+	?ChangeTopicNameAndNumber@RCbs@@QAEHGGABV?$TBuf@$0FA@@@@Z @ 5 NONAME ; int RCbs::ChangeTopicNameAndNumber(unsigned short, unsigned short, class TBuf<80> const &)
+	?ChangeTopicSubscriptionStatus@RCbs@@QAEHGH@Z @ 6 NONAME ; int RCbs::ChangeTopicSubscriptionStatus(unsigned short, int)
+	?Close@RCbs@@QAEXXZ @ 7 NONAME ; void RCbs::Close(void)
+	?Connect@RCbs@@QAEHXZ @ 8 NONAME ; int RCbs::Connect(void)
+	?Connected@RCbs@@QBEHXZ @ 9 NONAME ; int RCbs::Connected(void) const
+	?DeleteAllTopics@RCbs@@QAEHXZ @ 10 NONAME ; int RCbs::DeleteAllTopics(void)
+	?DeleteMessage@RCbs@@QAEHABK@Z @ 11 NONAME ; int RCbs::DeleteMessage(unsigned long const &)
+	?DeleteTopic@RCbs@@QAEHG@Z @ 12 NONAME ; int RCbs::DeleteTopic(unsigned short)
+	?FindMessageByHandle@RCbs@@QAEHABKAAUTCbsDbMessage@@@Z @ 13 NONAME ; int RCbs::FindMessageByHandle(unsigned long const &, struct TCbsDbMessage &)
+	?FindTopicByNumber@RCbs@@QAEHGAAUTCbsDbTopic@@@Z @ 14 NONAME ; int RCbs::FindTopicByNumber(unsigned short, struct TCbsDbTopic &)
+	?GetHotmarkedMessageHandle@RCbs@@QAEXAAK@Z @ 15 NONAME ; void RCbs::GetHotmarkedMessageHandle(unsigned long &)
+	?GetLanguages@RCbs@@QAEXAAUTCbsDbLanguages@@@Z @ 16 NONAME ; void RCbs::GetLanguages(struct TCbsDbLanguages &)
+	?GetLatestTopicNumber@RCbs@@QAEHAAG@Z @ 17 NONAME ; int RCbs::GetLatestTopicNumber(unsigned short &)
+	?GetMessage@RCbs@@QAEHGHAAUTCbsDbMessage@@@Z @ 18 NONAME ; int RCbs::GetMessage(unsigned short, int, struct TCbsDbMessage &)
+	?GetMessageContents@RCbs@@QAEHABKAAVTDes16@@@Z @ 19 NONAME ; int RCbs::GetMessageContents(unsigned long const &, class TDes16 &)
+	?GetMessageCount@RCbs@@QAEHGAAH@Z @ 20 NONAME ; int RCbs::GetMessageCount(unsigned short, int &)
+	?GetMessageIndexByHandle@RCbs@@QAEHABKAAH@Z @ 21 NONAME ; int RCbs::GetMessageIndexByHandle(unsigned long const &, int &)
+	?GetNewTopicsCount@RCbs@@QAEHAAH@Z @ 22 NONAME ; int RCbs::GetNewTopicsCount(int &)
+	?GetNextAndPrevMessageHandle@RCbs@@QAEHABKAAK1AAH@Z @ 23 NONAME ; int RCbs::GetNextAndPrevMessageHandle(unsigned long const &, unsigned long &, unsigned long &, int &)
+	?GetNextAndPrevMessageHandle@RCbsTopicMessages@@QAEHABKAAK1AAH@Z @ 24 NONAME ; int RCbsTopicMessages::GetNextAndPrevMessageHandle(unsigned long const &, unsigned long &, unsigned long &, int &)
+	?GetNextAndPrevTopicNumber@RCbs@@QAEHABGAAG1AAH@Z @ 25 NONAME ; int RCbs::GetNextAndPrevTopicNumber(unsigned short const &, unsigned short &, unsigned short &, int &)
+	?GetReceptionStatus@RCbs@@QAEXAAH@Z @ 26 NONAME ; void RCbs::GetReceptionStatus(int &)
+	?GetTopic@RCbs@@QAEHHAAUTCbsDbTopic@@@Z @ 27 NONAME ; int RCbs::GetTopic(int, struct TCbsDbTopic &)
+	?GetTopicCount@RCbs@@QAEXAAH@Z @ 28 NONAME ; void RCbs::GetTopicCount(int &)
+	?GetTopicDetectionStatus@RCbs@@QAEXAAH@Z @ 29 NONAME ; void RCbs::GetTopicDetectionStatus(int &)
+	?GetUnreadMessageCount@RCbs@@QAEXAAH@Z @ 30 NONAME ; void RCbs::GetUnreadMessageCount(int &)
+	?HasNextCollectionTopic@RCbs@@QAEHXZ @ 31 NONAME ; int RCbs::HasNextCollectionTopic(void)
+	?LockMessage@RCbs@@QAEHABK@Z @ 32 NONAME ; int RCbs::LockMessage(unsigned long const &)
+	?NewL@CCbsMessageClient@@SAPAV1@XZ @ 33 NONAME ; class CCbsMessageClient * CCbsMessageClient::NewL(void)
+	?NextCollectionTopic@RCbs@@QAEHAAUTCbsDbTopicIdentity@@@Z @ 34 NONAME ; int RCbs::NextCollectionTopic(struct TCbsDbTopicIdentity &)
+	?NotifyOnTopicListEvent@RCbs@@QAEXAAVTRequestStatus@@HAAW4TCbsTopicListEvent@@AAG@Z @ 35 NONAME ; void RCbs::NotifyOnTopicListEvent(class TRequestStatus &, int, enum TCbsTopicListEvent &, unsigned short &)
+	?NotifyOnTopicListEventCancel@RCbs@@QAEXXZ @ 36 NONAME ; void RCbs::NotifyOnTopicListEventCancel(void)
+	?NotifySettingsChanged@RCbs@@QAEXAAVTRequestStatus@@AAW4TCbsSettingsEvent@@@Z @ 37 NONAME ; void RCbs::NotifySettingsChanged(class TRequestStatus &, enum TCbsSettingsEvent &)
+	?NotifySettingsChangedCancel@RCbs@@QAEXXZ @ 38 NONAME ; void RCbs::NotifySettingsChangedCancel(void)
+	?NumberOfUnreadHotmarkedMessages@RCbs@@QAEHXZ @ 39 NONAME ; int RCbs::NumberOfUnreadHotmarkedMessages(void)
+	?ReadMessage@RCbs@@QAEHABK@Z @ 40 NONAME ; int RCbs::ReadMessage(unsigned long const &)
+	?SaveMessage@RCbs@@QAEHABK@Z @ 41 NONAME ; int RCbs::SaveMessage(unsigned long const &)
+	?SetLanguages@RCbs@@QAEHABUTCbsDbLanguages@@@Z @ 42 NONAME ; int RCbs::SetLanguages(struct TCbsDbLanguages const &)
+	?SetReceptionStatus@RCbs@@QAEHH@Z @ 43 NONAME ; int RCbs::SetReceptionStatus(int)
+	?SetTopicDetectionStatus@RCbs@@QAEHH@Z @ 44 NONAME ; int RCbs::SetTopicDetectionStatus(int)
+	?Shutdown@RCbs@@QBEXXZ @ 45 NONAME ; void RCbs::Shutdown(void) const
+	?StartCollectionBrowsing@RCbs@@QAEXXZ @ 46 NONAME ; void RCbs::StartCollectionBrowsing(void)
+	?Version@RCbs@@QBE?AVTVersion@@XZ @ 47 NONAME ; class TVersion RCbs::Version(void) const
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/Bwins/CBSMCNCLIENTU.DEF	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,11 @@
+EXPORTS
+	??1CMcn@@UAE@XZ @ 1 NONAME ; public: virtual __thiscall CMcn::~CMcn(void)
+	?AddCbTopicL@CMcnTopicArray@@QAEXG@Z @ 2 NONAME ; public: void __thiscall CMcnTopicArray::AddCbTopicL(unsigned short)
+	?GetCellInfo@CMcn@@QBEHAAVTDes16@@@Z @ 3 NONAME ; public: int __thiscall CMcn::GetCellInfo(class TDes16 &)const 
+	?NewL@CMcn@@SAPAV1@XZ @ 4 NONAME ; public: static class CMcn * __cdecl CMcn::NewL(void)
+	?NewL@CMcnTopicArray@@SAPAV1@XZ @ 5 NONAME ; public: static class CMcnTopicArray * __cdecl CMcnTopicArray::NewL(void)
+	?RegisterL@CMcn@@QAEXPAVMCbsMcnObserver@@ABVCMcnTopicArray@@@Z @ 6 NONAME ; public: void __thiscall CMcn::RegisterL(class MCbsMcnObserver *,class CMcnTopicArray const &)
+	?Unregister@CMcn@@QAEXPAVMCbsMcnObserver@@@Z @ 7 NONAME ; public: void __thiscall CMcn::Unregister(class MCbsMcnObserver *)
+	?GetInfoMessage@CMcn@@QBEHAAVTDes16@@H@Z @ 8 NONAME ; public: int __thiscall CMcn::GetInfoMessage(class TDes16 &,int)const 
+	?GetTopicNumber@CMcnTopicArray@@QBEXABIAAI@Z @ 9 NONAME ; public: void __thiscall CMcnTopicArray::GetTopicNumber(unsigned int const &,unsigned int &)const 
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/Bwins/CBSSERVERU.DEF	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,6 @@
+EXPORTS
+	?WinsMain@@YAHPAX@Z @ 1 NONAME ; int __cdecl WinsMain(void *)
+	?__DbgTestInvariant@CCbsDbImpSettings@@QBEXXZ @ 2 NONAME ; public: void __thiscall CCbsDbImpSettings::__DbgTestInvariant(void)const 
+	?__DbgTestInvariant@CCbsDbImpTopicList@@QBEXXZ @ 3 NONAME ; public: void __thiscall CCbsDbImpTopicList::__DbgTestInvariant(void)const 
+	?__DbgTestInvariant@CCbsRecEtel@@QBEXXZ @ 4 NONAME ; public: void __thiscall CCbsRecEtel::__DbgTestInvariant(void)const 
+
Binary file cbs/cbsserver/CenRep/keys_cbsserver.xls has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ClientInc/CbsCommon.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,200 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 only common header file between CBS UI and 
+*                CbsClient packages.
+*
+*/
+
+
+
+#ifndef CBSCOMMON_H
+#define CBSCOMMON_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <s32std.h>
+#include <cbscommontypes.h>
+
+// CONSTANTS
+
+// Max count of topic lists in the root
+const TInt KCbsRootItemsSize = 1;
+
+// DATA TYPES  
+
+/**
+*   Type for representing handles to the topics.
+*
+*   For each topic there is an unique handle that does not change. 
+*   When the topic is deleted, the same handle can be used again.
+*/
+typedef TUint16 TCbsDbTopicHandle;
+
+// A handle to a topic.
+typedef TCbsDbTopicHandle TCbsTopicHandle;
+
+// A topic name.
+typedef TCbsDbTopicName TCbsTopicName;
+
+/**
+*   The structure that represents information about single topic. 
+*
+*   When an index message is received, then a new topic collection is created.
+*   In deed, records of this type are created.
+*/
+struct TCbsDbTopicIdentity
+    {
+    // Name of the topic
+    TCbsDbTopicName iName;
+
+    // The topic number (that is, the message identifier)
+    TCbsDbTopicNumber iNumber;
+    };
+
+// Type returned by RCbs::GetNextAndPrevTopicNumber and 
+// RCbs::GetNextAndPrevMessageHandle to specify whether the item in question 
+// is the first or the last (or both) in list.
+enum TCbsPositionInList 
+    {
+    ECbsHead = 0x01,
+    ECbsTail = 0x02
+    };
+
+// Enumerates the different language settings.
+enum TCbsDbLanguage
+    {
+    ECbsGerman,                 // German             
+    ECbsEnglish,                // English      
+    ECbsItalian,                // Italian      
+    ECbsFrench,                 // French       
+    ECbsSpanish,                // Spanish      
+    ECbsDutch,                  // Dutch        
+    ECbsSwedish,                // Swedish      
+    ECbsDanish,                 // Danish       
+    ECbsPortuguese,             // Portuguese   
+    ECbsFinnish,                // Finnish      
+    ECbsNorwegian,              // Norwegian    
+    ECbsGreek,                  // Greek        
+    ECbsTurkish,                // Turkish      
+    ECbsHungarian,              // Hungarian
+    ECbsPolish,                 // Polish
+    ECbsCzech,                  // Czech
+    ECbsHebrew,                 // Hebrew
+    ECbsArabic,                 // Arabic
+    ECbsRussian,                // Russian
+    ECbsIcelandic,              // Icelandic
+    ECbsOther,                  // Other 
+    ECbsAll,                    // All
+    ECbsCount                   // The amount of languages, 
+                                // this must be the last element
+    };
+
+
+// Structure to contain user-selected languages
+struct TCbsDbLanguages
+    {
+    TBool iLanguages[ ECbsCount ];
+    };
+
+// Structure containing cached information on topic
+struct TCbsDbImpTopic
+    {
+    // The stream identifier to the topic information.
+    TStreamId iTopicId;
+
+    // The stream identifier to the messages of the topic.
+    TStreamId iTopicMessagesId;
+
+    // The rest of the topic information
+    TCbsDbTopic iTopicData;
+    };
+
+// Structure that contains information about a topic list
+struct TCbsDbTopicList
+    {    
+    // Name of the topic list
+    TBuf< KCbsDbTopicNameLength > iTopicListName;
+
+    // Is this topic list the default topic list
+    TBool iIsDefaultTopicList;
+    
+    // The integer identifier of the list
+    TInt iNumber;
+
+    // NUmber of topic lists in this list
+    TInt iTopicCount;
+    };
+
+
+// The structure that contains (root) stream information.
+struct TCbsDbImpTopicList
+    {    
+    // Name of the topic list
+    TBuf< KCbsDbTopicNameLength > iTopicListName;    
+
+    // Is this topic list the default topic list
+    TBool iIsDefaultTopicList;
+
+    // The integer identifier of the list
+    TInt iNumber;
+
+    // NUmber of topic lists in this list
+    TInt iTopicCount;
+        
+	// The ID to topic list stream of this topic list
+	TStreamId iTopicListId;
+    };
+
+// Enumerates the reasons for the client panic.
+enum TCbsSessionPanic
+    {
+    ECbsBadRequest,
+    ECbsBadDescriptor
+    };
+
+// Enumerates the different types of settings-session related events.
+enum TCbsSettingsEvent
+    {
+    ECbsModifiedReceptionStatus,        // Reception status was modified
+    ECbsModifiedTopicDetectionStatus,   // Topic detection status was modified
+    ECbsModifiedLanguages,              // Preferred languages were modified
+    ECbsModifiedLimitedReceptionStatus, // Time-limited reception status modified
+    ECbsModifiedCleanupTime             // Clean up time of read messages modified
+    };
+
+// Enumerates the different types of topic list events that can occur.
+enum TCbsTopicListEvent
+    {
+    ECbsTopicListInitialized = 0x01,
+    ECbsTopicAdded = 0x02,
+    ECbsTopicModified = 0x04,
+    ECbsTopicDeleted = 0x08,
+    ECbsTopicReceivedNewMessage = 0x10,
+    ECbsTopicAllEvents = ( 0x01 | 0x02 | 0x04 | 0x08 | 0x10 )
+    };
+
+// Structure to contain user-selected languages
+typedef TCbsDbLanguages TCbsSettingsLanguages;
+
+// A structure that contains information about a topic list
+typedef TCbsDbTopicList TCbsTopicList;
+
+// A structure that contains information about one topic (information
+// that is retrieved from the index topic).
+typedef TCbsDbTopicIdentity TCbsTopicInfo;
+
+#endif      // CBSCOMMON_H   
+            
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ClientInc/RCbs.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,629 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 RCbs class.
+*    
+*                The client of the CBS Server is required to import this header file
+*                into project. The connection to the server is made with Connect()
+*                 and closed with Close().
+*
+*                RCbs provides the interface to CBS clients for accessing the    
+*                CBS server. It uses subsession classes RCbsSettings, RCbsTopicList,
+*                RCbsTopicMessages and RCbsTopicCollection to actually carry out
+*                the required ITC between client and server threads.
+*
+*
+*/
+
+
+
+#ifndef     RCBS_H
+#define     RCBS_H
+
+// INCLUDES
+#include <e32base.h>
+#include "CbsCommon.h"
+#include "RCbsSettings.h"
+#include "RCbsTopicCollection.h"
+#include "RCbsTopicList.h"
+#include "RCbsTopicMessages.h"
+
+//  CLASS DECLARATION 
+
+/**
+*   This represents the client-side session to the cbs server.
+*
+*   Every client must have an instance of the class to be able to communicate
+*   with the server.
+*
+*   Note that both client and server must use the same versions of the API.
+*   Otherwise the server will terminate the client process.
+*
+*   - The server does not buffer events. This must be taken into
+*     account when using notifications.
+*   - There can only be one pending notification request per subsession object.
+*     The behaviour is undefined, if you try to make several for only one 
+*      subsession.
+*/
+class RCbs 
+        : public RSessionBase
+    {
+    public:     // New functions
+        /**
+        *   Constructor.
+        */
+        IMPORT_C RCbs();
+
+        /**
+        *   Destructor.
+        */
+        IMPORT_C ~RCbs();
+
+        /**
+        *   Creates connection to the server.
+        *
+        *   Note that the method must be called before calling any other 
+        *   methods. The method returns an error code and, therefore, 
+        *   the caller is responsible of checking that everything went just 
+        *   fine.
+        *
+        *   @return                 Error code.
+        */
+        IMPORT_C TInt Connect();
+
+        /**
+        *   Closes the session to the server.
+        */
+        IMPORT_C void Close();
+
+        /**
+        *   Returns the version of CbsClient.
+        *
+        *   CbsServer and CbsClient must be of same version.
+        *
+        *   @return                 Returns the version of CbsClient.
+        */
+        IMPORT_C TVersion Version() const;
+
+        // === Settings-related methods
+
+        /**
+        *   Returns the reception status in aStatus, which is ETrue if the reception is
+        *   on. Otherwise it is EFalse.
+        *
+        *   @param  aStatus     The method returns the reception status in this parameter.
+        */
+        IMPORT_C void GetReceptionStatus( TBool& aStatus );
+
+        /**
+        *   Changes the reception status to aStatus.
+        *
+        *   @param  aStatus     It contains the new reception status.
+        *   @return             KErrNone if succeeded.
+        */
+        IMPORT_C TInt SetReceptionStatus( TBool aStatus );
+
+        /**
+        *   Returns the topic detection status in aStatus, which is ETrue if the detection
+        *   is on. Otherwise it is EFalse.
+        *
+        *   @param  aStatus     The method returns the topic detection status in this parameter.
+        */
+        IMPORT_C void GetTopicDetectionStatus( TBool& aStatus );
+        
+        /**
+        *   Changes the topic detection status to aStatus.
+        *
+        *   @param  aStatus     It contains the new topic detection status.
+        *   @return             KErrNone if succeeded.
+        */
+        IMPORT_C TInt SetTopicDetectionStatus( TBool aStatus );
+
+        /**
+        *   Returns the preferred languages in aLanguages.
+        *
+        *   @param aLanguages   The method returns the languages in this parameter.
+        */
+        IMPORT_C void GetLanguages( TCbsSettingsLanguages& aLanguages );
+
+        /**
+        *   Changes the preferred languages to aLanguages.
+        *
+        *   @param aLanguages   It contains the new preferred languages.
+        *   @return             KErrNone if succeeded.
+        */
+        IMPORT_C TInt SetLanguages( const TCbsSettingsLanguages& aLanguages );
+
+        /**
+        *   Requests the server to notify the client whenever any settings will be 
+        *   changed.
+        *
+        *   Note that for each subsession only one this kind of request can be pending. Each
+        *   client is responsible of assuring this.
+        *
+        *   @param  aStatus     It is the variable that the server will modify 
+        *                       whenever an event occurs.
+        *   @param  aEvent      The server will store the type of occurred event 
+        *                       to this variable.
+        */
+        IMPORT_C void NotifySettingsChanged( TRequestStatus& aStatus, 
+            TCbsSettingsEvent& aEvent );
+
+        /**
+        *   Cancels the request to notify the client.
+        */
+        IMPORT_C void NotifySettingsChangedCancel();
+
+        //  === Topic Collection-related methods
+        
+        /**
+        *   Resets the iterator. Must be called prior any call to HasNextTopic() 
+        *   or NextTopic()!
+        */
+        IMPORT_C void StartCollectionBrowsing();
+
+        /**
+        *   Returns ETrue, if there is a topic not accessed with NextTopic()
+        *    
+        *   @return     ETrue, if there is a topic. EFalse if the end of the collection
+        *               has been reached.
+        */
+        IMPORT_C TBool HasNextCollectionTopic();                            
+
+        /**
+        *   Returns the next topic in the topic collection skipping all topics with 
+        *   a topic number matching a topic already listed in the current topic list.
+        *   This function will return KErrNotFound if the collection is tried to 
+        *   access beyond the end of the list. Otherwise the error code will be 
+        *   the same returned by GetTopicInfo().
+        *
+        *   @param aInfo        The topic information will be stored here.
+        *   @return             The error code. KErrNotFound if there are no topics left.
+        */
+        IMPORT_C TInt NextCollectionTopic( TCbsTopicInfo& aInfo );
+
+        //  === Topic list-related methods
+
+        /**
+        *   Returns the total amount of topics the topic list contains.
+        *
+        *   @param aCount       It will contain the total amount of topics.
+        */
+        IMPORT_C void GetTopicCount( TInt& aCount );
+
+        /**
+        *   Returns information about a topic from the topic list.
+        *
+        *   Return values:
+        *   KErrArgument        Topic was not found.
+        *    
+        *   Rest of return values indicate a file error.
+        *
+        *   @param aIndex       It is the index to the topic.
+        *   @param aTopic       It will contain the topic information.
+        *   @return             Error code.
+        */
+        IMPORT_C TInt GetTopic( const TInt aIndex, TCbsTopic& aTopic );
+
+        /**
+        *   Finds the topic by the given number.
+        *
+        *   Return values:
+        *   KErrNone            Topic returned in parameter aTopic.
+        *   KErrNotFound        Topic was not found.
+        *
+        *   @param aNumber      Number of the topic
+        *   @param aTopic       Return: contains the topic information
+        *   @return             Error code
+        */
+        IMPORT_C TInt FindTopicByNumber( TCbsTopicNumber aNumber,
+            TCbsTopic& aTopic );
+
+        /** 
+        *   Deletes an existing topic.
+        *
+        *   @param  aNumber         Number of the topic to be deleted
+        *   @return                 Error code
+        */
+        IMPORT_C TInt DeleteTopic( TCbsTopicNumber aNumber );
+
+        /**
+        *   Delete all topics.
+        *
+        *   @return             Error code.
+        */
+        IMPORT_C TInt DeleteAllTopics();
+
+        /**
+        *   Adds a new topic. The handle assigned to the topic will be returned
+        *   in aTopic.
+        *
+        *   Return values:
+        *   KErrNone            Topic was successfully added.
+        *   KErrAlreadyExists   A topic of the same number already exists in DB
+        *   KErrArgument        Topic number given was not in a proper range.
+        *   KErrDiskFull        Topic not added - FFS out of space
+        *
+        *   Note that the number of the new topic must be unused.
+        *
+        *   @param aTopic       Contains the information of the new topic.
+        *                       On return, aTopic also contains the topic 
+        *                       handle.
+        *   @return             Error code.
+        */
+        IMPORT_C TInt AddTopic( TCbsTopic& aTopic );
+
+        /**
+        *   Changes the name and number of the existing topic.
+        *
+        *   Note that the changing fails in case there is another topic with
+        *   the new topic number. It also fails if the topic is protected.
+        *
+        *   Return values:
+        *   KErrNone            Topic name and number successfully changed.
+        *   KErrDiskFull        Topic information not changed - FFS out of space
+        *
+        *   @param  aOldNumber      Number of the topic to be changed
+        *   @param  aNewNumber      Number to be given for the topic
+        *   @param  aName           Name to be given for the topic
+        *   @return                 Error code
+        */  
+        IMPORT_C TInt ChangeTopicNameAndNumber( 
+            TCbsTopicNumber aOldNumber,
+            TCbsTopicNumber aNewNumber, 
+            const TCbsTopicName& aName );
+
+        /**
+        *   Changes topic subscription status.
+        *
+        *   @param  aNumber         Number of the topic
+        *   @param  aNewStatus      New subscription status
+        *   @return                 Error code
+        */
+        IMPORT_C TInt ChangeTopicSubscriptionStatus( 
+            TCbsTopicNumber aNumber, TBool aNewStatus );
+
+        /**
+        *   Changes topic hotmark status.
+        *
+        *   @param  aNumber         Number of the topic
+        *   @param  aNewStatus      New hotmark status
+        *   @return                 Error code
+        */
+        IMPORT_C TInt ChangeTopicHotmarkStatus( TCbsTopicNumber aNumber,
+            TBool aNewStatus );
+
+        /**
+        *   Requests the server to notify the client whenever an event occurs 
+        *   that changes the information of the topics. 
+        *   
+        *   Note that the client may select what kind of events it is 
+        *   interested in. Note also that there can be at most one pending
+        *   request per instance of the class.
+        *
+        *   @param aStatus      The variable that the server will modify
+        *                       whenever an event occurs.
+        *   @param aRequested   Events the client is interested in
+        *   @param aEvent       Indicates the variable that will contain the
+        *                       type of event that occured.
+        *   @param aNumber      Indicates the variable that will contain the
+        *                       topic number that was changed in event.
+        */
+        IMPORT_C void NotifyOnTopicListEvent( 
+            TRequestStatus& aStatus, 
+            const TInt aRequested, 
+            TCbsTopicListEvent& aEvent, 
+            TCbsTopicNumber& aNumber );
+
+        /**
+        *   Cancels the pending notify request.
+        */
+        IMPORT_C void NotifyOnTopicListEventCancel();
+
+        /**
+        *   Returns the number of topics added since last GetNewTopicsCount()
+        *   by the topic detection feature.
+        *
+        *   @param aCount       It will contain the amount of new topics.
+        *   @return TInt Result code.
+        */
+        IMPORT_C TInt GetNewTopicsCount( TInt& aCount );
+
+        /**
+        *   Returns the number of the topic which was last added 
+        *   to topic list.
+        *
+        *   Note: if a topic list cache is maintained by the client
+        *   (as CBS UI application does), this function has to 
+        *   be called BEFORE calling GetTopicCount() and GetTopic() 
+        *   to make sure that no topic is added in between 
+        *   GetTopic() and GetLatestTopicHandle() calls. If this
+        *   happens, GetLatestTopicHandle() will return a handle
+        *   to a topic that is not cached client-side.            
+        *        
+        *   Return codes:
+        *   KErrNone        aNumber is a valid topic number.
+        *   KErrNotFound    No topic added since server start, 
+        *                   aNumber is not valid.
+        *
+        *   @param  aNumber         Returns: number of the topic last added
+        *   @return                 Result code
+        */
+        IMPORT_C TInt GetLatestTopicNumber( TCbsTopicNumber& aNumber );
+
+        /**
+        *   Returns the total amount of unread messages.
+        *
+        *   @param  aCount          Return: number of unread messages
+        */
+        IMPORT_C void GetUnreadMessageCount( TInt& aCount );
+
+        /**
+        *   Returns the handle to the latest hotmarked message that has been
+        *   received after the system has started up.
+        *   
+        *   @param  aMessage        Handle to the message
+        */
+        IMPORT_C void GetHotmarkedMessageHandle( TCbsMessageHandle& aMessage );
+
+        /**
+        *   Returns the number of unread messages in hotmarked topics.
+        *
+        *   This function is to used by the client when deciding whether
+        *   the message or topic list view should be opened to display
+        *   a hotmarked message(s).
+        *
+        *   @return                 Number of unread hotmarked messages
+        */
+        IMPORT_C TInt NumberOfUnreadHotmarkedMessages();
+
+        /**
+        *   Returns the numbers of topics that precede and succeed the given 
+        *   topic in server-side topic list.
+        *
+        *   If the given topic is the first topic in list, aPosition has 
+        *   ECbsHead bit up. If the given topic is the last topic in list,
+        *   aPosition has ECbsTail bit up.
+        *    
+        *   Return code values:
+        *   KErrNone		aPrevTopicNumber, aNextTopicNumber and aPosition 
+        *		            contain valid values.
+        *   KErrNotFound	aCurrentTopicNumber specified a topic that was not
+        *                   on topic list.
+        *
+        *   @param  aCurrentTopicNumber	    Number that specifies the topic 
+        *                                   whose surroundings are returned
+        *   @param  aPrevTopicNumber		Returns: number of topic preceding 
+        *                                   the given topic
+        *   @param  aNextTopicNumber		Returns: number of topic succeeding
+        *                                   the given topic
+        *   @param  aPosition			    Returns: position of current 
+        *                                   topic in list.
+        *   @return 				        Result code
+        */
+        IMPORT_C TInt GetNextAndPrevTopicNumber( 
+	        const TCbsTopicNumber& aCurrentTopicNumber,
+	        TCbsTopicNumber& aPrevTopicNumber,
+	        TCbsTopicNumber& aNextTopicNumber,
+	        TInt& aPosition );
+
+        // === Topic Messages-related methods
+        
+        /**
+        *   Returns the total amount of messages the topic contains.    
+        *
+        *   Return codes:
+        *   KErrNotFound            Invalid handle.
+        *   KErrNone                aCount contains the number of messages 
+        *                           in topic
+        *
+        *   @param  aNumber         Number of the topic.
+        *   @param  aCount          Number of messages in given topic.
+        *   @return                 Result code
+        */
+        IMPORT_C TInt GetMessageCount( TCbsTopicNumber aNumber,
+            TInt& aCount );
+        
+        /**
+        *   Returns message information.
+        *
+        *   Return codes:
+        *   KErrNotFound        Topic or message not found.
+        *   KErrNone            aMessage contains the message information.
+        *
+        *   @param  aNumber     Number of the topic
+        *   @param  aIndex      Index to the message in topic.
+        *   @param  aMessage    Returns: the message information
+        *   @return             Error code
+        */
+        IMPORT_C TInt GetMessage( TCbsTopicNumber aNumber, TInt aIndex,
+            TCbsMessage& aMessage );
+
+        /**
+        *   Finds a message by given handle.
+        *
+        *   @param  aHandle     Handle to the message.
+        *   @param  aMessage    Return: contains the message information.
+        *   @return             Error code.
+        */
+        IMPORT_C TInt FindMessageByHandle( 
+            const TCbsMessageHandle& aHandle, 
+            TCbsMessage& aMessage );
+
+        /**
+        *   Returns the index of a message with given handle in topic.
+        *
+        *   Result code KErrNotFound indicates that no message was found with
+        *   the given handle.
+        *
+        *   @param  aHandle     Handle of the message
+        *   @param  aIndex      Return: index of the message in message topic
+        *   @return             Result code
+        */
+        IMPORT_C TInt GetMessageIndexByHandle( 
+            const TCbsMessageHandle& aHandle, TInt& aIndex );
+
+        /**
+        *   Deletes an existing message.
+        *
+        *   Note that it does not care a lot about the status of the message.
+        *   
+        *   Please check also the description of LockMessage().
+        *
+        *   @param  aHandle     It is handle to the message.
+        *   @return             Error code.
+        */
+        IMPORT_C TInt DeleteMessage( const TCbsMessageHandle& aHandle );
+        
+        /**
+        *   Saves a message (the saved message won't be deleted to make 
+        *   room for new messages).
+        *
+        *   Return codes:
+        *   KErrNone            Message is saved.
+        *   KErrGeneral         Message not saved -- total maximum of saved 
+        *                       messages reached.
+        *   KErrNotFound        Message not saved -- no message associated
+        *                       with the given handle.
+        *   KErrDiskFull        Message not saved -- FFS out of space.
+        *
+        *   @param  aHandle     Handle to the message to be saved.
+        *   @return             Return code.
+        */
+        IMPORT_C TInt SaveMessage( const TCbsMessageHandle& aHandle );
+
+        /**
+        *   Locks the message.
+        *
+        *   Note that a single topic messages subsession can have at most one locked
+        *   message. 
+        *
+        *   Message can be unlocked by trying to lock a null message. Locked message
+        *   will also be automatically unlocked when subsession is closed. If a message
+        *   is locked, then it will not be deleted from the database. Thus, deleting a 
+        *   message or trying to delete a topic that contains such a message will fail.
+        *
+        *   Locking a message does not prevent to save the message nor read the message.
+        *
+        *   @param  aHandle     It is handle to the message to be locked.
+        *   @return             Error code.
+        */
+        IMPORT_C TInt LockMessage( const TCbsMessageHandle& aHandle );
+        
+        /**
+        *   Sets the message as read.
+        *
+        *   @param  aHandle     It is handle to the message to be set read.
+        *   @return             Error code.
+        */
+        IMPORT_C TInt ReadMessage( const TCbsMessageHandle& aHandle );
+        
+        /**
+        *   Returns the message contents.
+        *
+        *   @param  aHandle     It is handle to the message.
+        *   @param  aBuffer     It will contain the contents (as much as it fits).
+        *   @return             Error code.
+        */
+        IMPORT_C TInt GetMessageContents( 
+            const TCbsMessageHandle& aHandle, 
+            TDes& aBuffer );
+
+        /**
+        *   Returns the handles of messages that precede and succeed the 
+        *   given message in server-side list of topic messages.
+        *
+        *   Topic is resolved from the given message handle
+        *
+        *   If the given handle specifies the first message in topic,
+        *   aPosition has ECbsHead bit up. If the given handle specifies 
+        *   the last message in topic, aPosition has ECbsTail bit up.
+        *    
+        *    Return code values:
+        *    KErrNone       aPrevMsgHandle, aNextMsgHandle and aPosition
+        *                   contain valid values.
+        *    KErrNotFound   aCurrentMsgHandle specified a message that was not
+        *                   found.
+        *
+        *    @param  aCurrentMsgHandle      Handle that specifies the message 
+        *                                   whose surroundings are returned
+        *    @param  aPrevMsgHandle         Returns: handle of message 
+        *                                   preceding the given message
+        *    @param  aNextMsgHandle         Returns: handle of message 
+        *                                   succeeding the given topic
+        *    @param  aPosition              Returns: position of current topic 
+        *                                   in list
+        *    @return 				        Result code
+        */
+        IMPORT_C TInt GetNextAndPrevMessageHandle(
+	        const TCbsMessageHandle& aCurrentMsgHandle,
+	        TCbsMessageHandle& aPrevMsgHandle,
+	        TCbsMessageHandle& aNextMsgHandle,
+	        TInt& aPosition );
+
+        // Other methods
+
+        /**
+        *   Returns ETrue if CbsServer session has been established.
+        *
+        *   @return                     ETrue, if session open.
+        */
+        IMPORT_C TBool Connected() const;
+
+        /**
+        *   Forces the server to shut down.
+        *        
+        */
+        IMPORT_C void Shutdown() const;
+
+    private:    // starting server
+        /**
+        *   Starts the server.
+        */
+        TInt StartServer();
+
+        /**
+        *   Checks if the server is already started.
+        */
+        TBool IsServerStarted();
+
+    private:
+
+        // Copy constructor
+        RCbs( const RCbs& );
+
+        // Assignment operator
+        RCbs& operator=( const RCbs& );
+    
+    private:
+        // Settings subsession
+        RCbsSettings iSettings;
+
+        // Topic list subsession
+        RCbsTopicList iTopicList;
+
+        // Topic messages subsession
+        RCbsTopicMessages iTopicMessages;
+
+        // Collection subsession
+        RCbsTopicCollection iTopicCollection;
+
+        // ETrue, if the session has been established
+        TBool iConnected;
+    };
+
+#endif      //  RCbs_H   
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ClientInc/RCbsSettings.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,157 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 RCbsSettings class
+*    
+*                Client-side subsession which handles requests regarding
+*                CbsServer settings, i.e. receive state, topic detection state and
+*                selected languages.
+*
+*
+*/
+
+
+
+#ifndef     RCBSSETTINGS_H
+#define     RCBSSETTINGS_H
+
+// INCLUDES
+#include <e32base.h>
+#include "CbsCommon.h"
+
+
+// FORWARD DECLARATIONS
+class RCbs;
+
+//  CLASS DECLARATION 
+
+/**
+*   This represents the client-side subsession to modify and retrieve settings.
+*/
+class RCbsSettings 
+        : public RSubSessionBase
+    {
+    public:     // New functions
+        
+        /**
+        *   Constructor.
+        */
+        RCbsSettings();
+
+        /**
+        *   Creates a subsession to the server. 
+        *
+        *   Note that this method must be called before using any other method.
+        *
+        *   @param  aServer     It is the session.
+        *   @return             Error code.
+        */
+        TInt Open( RCbs& aServer );
+        
+        /**
+        *   Closes the subsession.
+        *
+        *   @return             Error code.
+        */
+        TInt Close();
+
+        /**
+        *   Returns the reception status in aStatus, which is ETrue if the 
+        *   reception is on. Otherwise it is EFalse.
+        *
+        *   @param  aStatus     The method returns the reception status in 
+        *                       this parameter.
+        */
+        void GetReceptionStatus( TBool& aStatus );
+
+        /**
+        *   Changes the reception status to aStatus.
+        *
+        *   @param  aStatus     It contains the new reception status.
+        *   @return             Result code. KErrNone if no errors.
+        */
+        TInt SetReceptionStatus( TBool aStatus );
+
+        /**
+        *   Returns the topic detection status in aStatus, which is ETrue if 
+        *   the detection is on. Otherwise it is EFalse.
+        *
+        *   @param  aStatus     The method returns the topic detection status 
+        *                       in this parameter.
+        */
+        void GetTopicDetectionStatus( TBool& aStatus );
+        
+        /**
+        *   Changes the topic detection status to aStatus.
+        *
+        *   @param  aStatus     It contains the new topic detection status.
+        *   @return             Result code. KErrNone if no errors.
+        */
+        TInt SetTopicDetectionStatus( TBool aStatus );
+
+        /**
+        *   Returns the preferred languages in aLanguages.
+        *
+        *   @param aLanguages   The method returns the languages in this 
+        *                       parameter.
+        */
+        void GetLanguages( TCbsSettingsLanguages& aLanguages );
+
+        /**
+        *   Changes the preferred languages to aLanguages.
+        *
+        *   @param aLanguages   It contains the new preferred languages.
+        *   @return             Result code. KErrNone if no errors.
+        */
+        TInt SetLanguages( const TCbsSettingsLanguages& aLanguages );
+
+        /**
+        *   Requests the server to notify the client whenever any settings 
+        *   will be changed.
+        *
+        *   Note that for each subsession only one this kind of request can 
+        *   be pending. Each client is responsible of assuring this.
+        *
+        *   @param  aStatus     It is the variable that the server will 
+        *                       modify whenever an event occurs.
+        *   @param  aEvent      The server will store the type of occurred 
+        *                       event to this variable.
+        */
+        void NotifySettingsChanged( TRequestStatus& aStatus, 
+            TCbsSettingsEvent& aEvent );
+
+        /**
+        *   Cancels the request to notify the client.
+        */
+        void NotifySettingsChangedCancel();
+
+    private: // prohibited functions
+        // Prohibited copy constructor
+        RCbsSettings( const RCbsSettings& );
+
+        // Prohibited assignment operator
+        RCbsSettings& operator=( const RCbsSettings& );
+
+    private: // Data
+
+        // Pointer descriptor used to transfer information during a notify 
+        // request.
+        TPtr8 iNotifyEventPtr;
+    };
+
+
+#endif      //  RCBSSETTINGS_H   
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ClientInc/RCbsTopicCollection.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,154 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 RCbsTopicCollection class.
+*                This is the client-side subsession which handles requests regarding
+*                topic identities stored on CBS Server.
+*
+*
+*/
+
+
+
+#ifndef     RCBSTOPICCOLLECTION_H
+#define     RCBSTOPICCOLLECTION_H
+
+//  INCLUDES
+
+#include <e32base.h>
+#include "CbsCommon.h"
+
+//  FORWARD DECLARATIONS
+class RCbs;
+
+//  CLASS DECLARATION 
+
+/**
+*   This represents the client-side subsession to retrieve information 
+*   from topic collections.
+*/
+class RCbsTopicCollection 
+        : public RSubSessionBase
+    {
+    public:     // New functions
+        /**
+        *   Constructor.
+        */
+        RCbsTopicCollection();
+
+        /**
+        *   Creates a subsession to the server.
+        *
+        *   Note that the method must be called before any other method 
+        *   can be used.
+        *
+        *   @param  aServer             The base session.
+        *   @return                     Error code.
+        */
+        TInt Open( RCbs& aServer );
+
+        /**
+        *   Closes the subsession.
+        *
+        *   @return                     Error code.
+        */
+        TInt Close();
+
+        /**
+        *   Returns the total amount of topic information the topic collection
+        *   contains.
+        *
+        *   @param  aCount              It will contain the amount.
+        */
+        void GetTopicCount( TInt& aCount );
+
+        /**
+        *   Returns a topic information structure.
+        *
+        *   @param  aIndex              It is index to the topic info.
+        *   @param  aInfo               It will contain the information.
+        *   @return                     Error code.
+        */
+        TInt GetTopicInfo( TInt aIndex, TCbsTopicInfo& aInfo );
+
+        /**
+        *   Notifies the client next time when topic collection changes.
+        *   
+        *   @param  aStatus             It will be changed when topic collection
+        *                               changes.
+        */
+        void NotifyOnChange( TRequestStatus& aStatus );
+
+        /**
+        *   Cancels the pending request to notify.
+        */
+        void NotifyOnChangeCancel();
+
+        /**
+        *   Resets the iterator. Must be called prior any call to HasNextTopic() 
+        *   or NextTopic()!
+        */
+        void Start();
+
+        /**
+        *   Returns ETrue, if there is a topic not accessed with NextTopic()
+        *   
+        *   @return     ETrue, if there is a topic. EFalse if the end of the
+        *               collection has been reached.
+        */
+        TBool HasNextTopic();                          
+
+        /**
+        *   Returns the next topic in the topic collection skipping all topics with 
+        *   a topic number matching a topic already listed in the current topic list.
+        *   This function will return KErrNotFound if the collection is tried to 
+        *   access beyond the end of the list. Otherwise the error code will be 
+        *   the same returned by GetTopicInfo().
+        *
+        *   @param aInfo        The topic information will be stored here.
+        *   @return             The error code. KErrNotFound if there are no topics
+        *                       left.
+        */
+        TInt NextTopic( TCbsTopicInfo& aInfo );
+
+    private:
+        
+        /**
+        *   Returns information whether the topic was in topic list.
+        *   
+        *   @param 	aIndex      Topic index
+        *   @param  aInList     Was the topic in the list
+        *   @return             Error code. KErrNotFound, if topic
+        *                       didn't exist.
+        */
+        TInt TopicInList( TInt aIndex, TBool& aInList );
+
+    private:// prohibited functions
+        // Prohibited copy constructor
+        RCbsTopicCollection( const RCbsTopicCollection& );
+
+        // Prohibited assignment operator
+        RCbsTopicCollection& operator=( const RCbsTopicCollection& );
+
+    private:    // Data
+        //Iterator is used to point to the next unlisted topic in topic collection. 
+        //Unlisted topic is a topic which is not listed in the current topic list but 
+        //is awailable in the topic collection
+        TInt iIterator;     
+    };
+
+#endif      //  RCBSTOPICCOLLECTION_H
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ClientInc/RCbsTopicList.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,278 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 RCbsTopicList class
+*    
+*                RCbsTopicList provides an interface to CBS clients which
+*                allows accessing the Cell Broadcast topics stored
+*                in the CBS Server. Note: This class should not be directly 
+*                accessed by the client application.
+*
+*                Services include accessing and modifying topic information,
+*                deleting a single or all topics, and a notification service,
+*                that enables the client to receive notifications on 
+*                events modifying the server's topic list.
+*
+*
+*/
+
+
+
+#ifndef     RCBSTOPICLIST_H
+#define     RCBSTOPICLIST_H
+
+// INCLUDES
+#include <e32base.h>
+#include "CbsCommon.h"
+
+// FORWARD DECLARATIONS
+class RCbs;
+
+// CLASS DECLARATION 
+
+/**
+*   This class represents the client-side subsession to handle topic lists.
+*/
+
+class RCbsTopicList 
+        : public RSubSessionBase
+    {
+    public:     // New functions
+        /**
+        *   Constructor.
+        */
+        RCbsTopicList();
+
+        /**
+        *   Creates a subsession to the server. Before using any other method it
+        *   must be called.
+
+        *   @param aServer      It is the cbs server.
+        *   @return             Error code.
+        */
+        TInt Open( RCbs& aServer );
+
+        /**
+        *   Closes the subsession and connection to the server.
+        *
+        *   @return             Error code.
+        */
+        TInt Close();
+
+        /**
+        *   Returns the total amount of topics the topic list contains.
+        *
+        *   @param aCount       It will contain the total amount of topics.
+        */
+        void GetTopicCount( TInt& aCount );
+
+        /**
+        *   Returns information about a topic from the topic list.
+        *
+        *   @param aIndex       It is the index to the topic.
+        *   @param aTopic       It will contain the topic information.
+        *   @return             Error code.
+        */
+        TInt GetTopic( const TInt aIndex, TCbsTopic& aTopic );
+
+        /**
+        *   Finds the topic by given number.
+        *
+        *   @param aNumber      It is the number of the topic.
+        *   @param aTopic       It will contain the topic information.
+        *   @return             Error code.
+        */
+        TInt FindTopicByNumber( TCbsTopicNumber aNumber, TCbsTopic& aTopic );
+
+        /** 
+        *   Deletes an existing topic.
+        *
+        *   Note that the topic must exists.
+        *
+        *   @param aNumber      It is the handle to the topic to be deleted.
+        *   @return             Error code.
+        */
+        TInt DeleteTopic( TCbsTopicNumber aNumber );
+
+        /**
+        *   Delete all topics.
+        *
+        *   @return             Error code.
+        */
+        TInt DeleteAllTopics();
+
+        /**
+        *   Adds a new topic.
+        *
+        *   Note that the number of the new topic must be unused.
+        *
+        *   @param aTopic       It contains the information of the new topic.
+        *   @return             Error code.
+        */
+        TInt AddTopic( TCbsTopic& aTopic );
+
+        /**
+        *   Changes the name and number of the existing topic.
+        *
+        *   Note that the changing fails in case there is another topic with the new topic number.
+        *   It also fails if the topic is protected.
+        *
+        *   @param  aOldNumber     Old topic number
+        *   @param  aNewNumber     New topic number
+        *   @param  aName       It is the new name of the topic.
+        *   @return             Error code.
+        */  
+        TInt ChangeTopicNameAndNumber( 
+             TCbsTopicNumber aOldNumber,
+             TCbsTopicNumber aNewNumber, 
+             const TCbsTopicName& aName );
+
+        /**
+        *   Changes topic subscription status.
+        *
+        *   @param  aNumber     Number of the topic
+        *   @param  aNewStatus  It is the new subscription status.
+        *   @return             Error code.
+        */
+        TInt ChangeTopicSubscriptionStatus( TCbsTopicNumber aNumber, 
+             TBool aNewStatus );
+
+        /**
+        *   Changes topic hotmark status.
+        *
+        *   @param  aNumber     Number of the topic
+        *   @param  aNewStatus  It is the new hotmark status.
+        *   @return             Error code.
+        */
+        TInt ChangeTopicHotmarkStatus( TCbsTopicNumber aNumber, TBool aNewStatus );
+
+        /**
+        *   Requests the server to notify the client whenever an event occurs that changes
+        *   the information of the topics. 
+        *   
+        *   Note that the client may select what kind of events it is interested in. Note also that
+        *   there can be at most one pending request per instance of the class.
+        *
+        *   @param aStatus      It is the variable that the server will modify whenever an event occurs.
+        *   @param aRequested   It contains the events the client is listening to.
+        *   @param aEvent       It will contain the event that occurred.
+        *   @param aNumber      Number of topic
+        */
+        void NotifyOnEvent( 
+             TRequestStatus& aStatus, 
+             const TInt aRequested, 
+             TCbsTopicListEvent& aEvent, 
+             TCbsTopicNumber& aNumber );
+
+        /**
+        *   Cancels the pending notify request.
+        */
+         void NotifyOnEventCancel();
+
+        /**
+        *   Returns the number of session-specific new topics and resets the counter.
+        *   New topics are added by the topic detection feature in absence of
+        *   CBS UI Application.
+        *
+        *   @param aCount       On return contains the amount of new topics.
+        *   @return Result code.
+        */
+        TInt GetNewTopicsCount( TInt& aCount );
+
+        /**
+        *   Returns the latest topic's number.
+        *
+        *   @param aNumber       Number of the topic
+        *   @return              Result code.
+        */
+        TInt GetLatestTopicNumber( TCbsTopicNumber& aNumber );
+
+        /**
+        *   Returns the total amount of unread messages.
+        *
+        *   @param aCount       It will contain the amount of unread messages.
+        */
+        void GetUnreadMessageCount( TInt& aCount );
+
+        /**
+        *   Returns the handle to the latest hotmarked message that has been
+        *   received after the system has started up.
+        *   
+        *   @param aMessage     It is handle to the message.
+        */
+        void GetHotmarkedMessageHandle( TCbsMessageHandle& aMessage );
+        
+        /**
+        *   Returns the number of unread messages in hotmarked topics.
+        *
+        *   This function is to used by the client when deciding whether
+        *   the message or topic list view should be opened to display
+        *   a hotmarked message(s).
+        *
+        *   @return                 Number of unread hotmarked messages
+        */
+        TInt NumberOfUnreadHotmarkedMessages();
+
+        /**
+        *   Returns the numbers of topics that precede and succeed the given 
+        *   topic in server-side topic list.
+        *
+        *   If the given topic is the first topic in list, aPosition has 
+        *   ECbsHead bit up. If the given topic is the last topic in list,
+        *   aPosition has ECbsTail bit up.
+        *    
+        *   Return code values:
+        *   KErrNone		aPrevTopicNumber, aNextTopicNumber and aPosition 
+        *		            contain valid values.
+        *   KErrNotFound	aCurrentTopicNumber specified a topic that was not
+        *                   on topic list.
+        *
+        *   @param  aCurrentTopicNumber	    Number that specifies the topic 
+        *                                   whose surroundings are returned
+        *   @param  aPrevTopicNumber		Returns: number of topic preceding 
+        *                                   the given topic
+        *   @param  aNextTopicNumber		Returns: number of topic succeeding
+        *                                   the given topic
+        *   @param  aPosition			    Returns: position of current 
+        *                                   topic in list.
+        *   @return 				        Result code
+        */
+        TInt GetNextAndPrevTopicNumber( 
+	        const TCbsTopicNumber& aCurrentTopicNumber,
+	        TCbsTopicNumber& aPrevTopicNumber,
+	        TCbsTopicNumber& aNextTopicNumber,
+	        TInt& aPosition );
+
+    private: // prohibited functions
+        // Prohibited copy constructor
+        RCbsTopicList( const RCbsTopicList& );
+
+        // Prohibited assignment operator
+        RCbsTopicList& operator=( const RCbsTopicList& );
+
+    private:    // Data
+
+        // A pointer descriptor used to transfer information 
+        // during a notify request. 
+        TPtr8 iNotifyEventPtr;
+
+        // A pointer descriptor used to transfer information 
+        // during a notify request.
+        TPtr8 iNotifyHandlePtr;        
+    };
+
+#endif      //  RCBSTOPICLIST_H   
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ClientInc/RCbsTopicMessages.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,208 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 RCbsTopicMessages class
+*    
+*                Client-side subsession handling requests which regard 
+*                CB messages.
+*
+*
+*/
+
+
+
+#ifndef     RCBSTOPICMESSAGES_H
+#define     RCBSTOPICMESSAGES_H
+
+// INCLUDES
+#include <e32base.h>
+#include "CbsCommon.h"
+
+// FORWARD DECLARATIONS
+class RCbs;
+
+// CLASS DECLARATION 
+
+// Client-side subsession handling requests regarding 
+// CB messages.
+//
+class RCbsTopicMessages 
+        : public RSubSessionBase
+    {
+    public:     // New functions
+        /**
+        *   Constructor.
+        */
+        RCbsTopicMessages();
+
+        /**
+        *   Creates a subsession to the server. Before using any other method 
+        *   it must be called.
+        *
+        *   @param aServer      It is the cbs server.
+        *   @return             Return code.
+        */
+        TInt Open( RCbs& aServer );
+        
+        /**
+        *   Closes the subsession.
+        *
+        *   @return             Return code.
+        */
+        TInt Close();
+
+        /**
+        *   Returns the total amount of messages the topic contains.    
+        *
+        *   @param  aNumber     Topic number.
+        *   @param  aCount      It will contain the total amount of 
+        *                       messages.
+        */
+        TInt GetMessageCount( TCbsTopicNumber aNumber, TInt& aCount );
+        
+        /**
+        *   Returns message information.
+        *
+        *   @param  aNumber     Topic number
+        *   @param  aIndex      It is index to the message in topic. 
+        *   @param  aMessage    It will contain the message information.
+        *   @return             Return code.
+        */
+        TInt GetMessage( TCbsTopicNumber aNumber, TInt aIndex, 
+            TCbsMessage& aMessage );
+
+        /**
+        *   Finds a message by given handle.
+        *
+        *   @param  aHandle     It is handle to the message.
+        *   @param  aMessage    It will contain the message information.
+        *   @return             Return code.
+        */
+        TInt FindMessageByHandle( const TCbsMessageHandle& aHandle, 
+            TCbsMessage& aMessage );
+
+        /**
+        *   Returns the index of a message with given handle in topic.
+        *
+        *   Result code KErrNotFound indicates that no message was found with
+        *   the given handle.
+        *
+        *   @param  aHandle     Handle of the message
+        *   @param  aIndex      Return: index of the message in message topic
+        *   @return             Result code
+        */
+        TInt GetMessageIndexByHandle( 
+            const TCbsMessageHandle& aHandle, TInt& aIndex );
+
+        /**
+        *   Deletes an existing message.
+        *
+        *   Note that it does not care a lot about the status of the message.
+        *   
+        *   Check also the description of LockMessage method.
+        *
+        *   @param  aHandle     It is handle to the message.
+        *   @return             Return code.
+        */
+        TInt DeleteMessage( const TCbsMessageHandle& aHandle );
+        
+        /**
+        *   Saves a message (i.e., the saved message won't be deleted to make 
+        *   room for new messages).
+        *
+        *   Return codes:
+        *   KErrNone            Message is saved.
+        *   KErrGeneral         Message not saved -- total maximum of saved 
+        *                       messages reached.
+        *
+        *   @param  aHandle     Handle to the message to be saved.
+        *   @return             Return code.
+        */
+        TInt SaveMessage( const TCbsMessageHandle& aHandle );
+
+        /**
+        *   Locks the message.
+        *
+        *   Note that a single topic messages subsession can have at most one 
+        *   locked message. 
+        *
+        *   Message can be unlocked by trying to lock a null message. Locked 
+        *   message will also be automatically unlocked when subsession is 
+        *   closed. If a message is locked, then it will not be deleted from
+        *   the database. Thus, deleting a message or trying to delete a 
+        *   topic that contains such a message will fail.
+        *
+        *   Locking a message does not prevent to save the message nor read 
+        *   the message.
+        *
+        *   @param  aHandle     It is handle to the message to be locked.
+        *   @return             Return code.
+        */
+        TInt LockMessage( const TCbsMessageHandle& aHandle );
+        
+        /**
+        *   Sets the message as read.
+        *
+        *   @param  aHandle     It is handle to the message to be set read.
+        */
+        TInt ReadMessage( const TCbsMessageHandle& aHandle );
+        
+        /**
+        *   Returns the message contents.
+        *
+        *   @param  aHandle     It is handle to the message.
+        *   @param  aBuffer     It will contain the contents (as much as it fits).
+        *   @return             Return code.
+        */
+        TInt GetMessageContents( const TCbsMessageHandle& aHandle, 
+            TDes& aBuffer );
+
+        /**
+        *   Returns the handles of messages that precede and succeed the 
+        *   given message in server-side list of topic messages.
+        *
+        *   Topic is resolved from the given message handle
+        *
+        *   If the given handle specifies the first message in topic,
+        *   aPosition has ECbsHead bit up. If the given handle specifies 
+        *   the last message in topic, aPosition has ECbsTail bit up.
+        *    
+        *    Return code values:
+        *    KErrNone       aPrevMsgHandle, aNextMsgHandle and aPosition
+        *                   contain valid values.
+        *    KErrNotFound	aCurrentMsgHandle specified a message that was not
+        *			        found.
+        *
+        *    @param  aCurrentMsgHandle		Handle that specifies the message 
+        *                                   whose surroundings are returned
+        *    @param  aPrevMsgHandle		    Returns: handle of message 
+        *                                   preceding the given message
+        *    @param  aNextMsgHandle		    Returns: handle of message 
+        *                                   succeeding the given topic
+        *    @param  aPosition			    Returns: position of current topic 
+        *                                   in list
+        *    @return 				        Result code
+        */
+        IMPORT_C TInt GetNextAndPrevMessageHandle(
+	        const TCbsMessageHandle& aCurrentMsgHandle,
+	        TCbsMessageHandle& aPrevMsgHandle,
+	        TCbsMessageHandle& aNextMsgHandle,
+	        TInt& aPosition );
+
+    };
+
+#endif      //  RCBSTOPICMESSAGES_H   
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ClientInc/ccbsmessageclientimpl.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,152 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This file contains the header file of the CCbsMessageClientImpl class.
+*
+*
+*/
+
+
+
+#ifndef     CCBSMESSAGECLIENTIMPL_H
+#define     CCBSMESSAGECLIENTIMPL_H
+
+// INCLUDES
+#include <e32base.h>
+#include <ccbsmessageclient.h>
+#include "RCbs.h"
+
+//  CLASS DECLARATION 
+
+/**
+*   Implementation of CCbsMessageClient interface.
+*
+*   @lib CbsClient.lib
+*   @since 3.2
+*/
+NONSHARABLE_CLASS( CCbsMessageClientImpl ) : public CCbsMessageClient
+    {
+    public:     // Construction
+    
+        /**
+        *   Instantiates new CCbsMessageClientImpl object and establishes a session with
+        *   CBS server. 
+        *   
+        *   Active scheduler has to be installed prior to calling this function.
+        *
+        *   @return                     A new instance of CCbsMessageClientImpl
+        */
+        static CCbsMessageClientImpl* NewL();
+
+        /**
+        *   Destructor.
+        */
+        ~CCbsMessageClientImpl();
+
+    public:     // From base class
+    
+        /**
+        *   Finds a message by given handle.
+        *
+        *   @see CCbsMessageClient::FindMessageByHandle
+        */
+        TInt FindMessageByHandle( 
+            const TCbsMessageHandle& aHandle, 
+            TCbsMessage& aMessage );
+                
+        /**
+        *   Finds the topic by the given number.
+        *
+        *   @see CCbsMessageClient::FindTopicByNumber
+        */
+        TInt FindTopicByNumber( TCbsTopicNumber aNumber,
+            TCbsTopic& aTopic );
+
+        /**
+        *   Returns the total amount of topics the topic list contains.
+        *
+        *   @see CCbsMessageClient::TopicCount
+        */        
+        TInt TopicCount();
+
+        /**
+        *   Returns information about a topic from the topic list.
+        *
+        *   @see CCbsMessageClient::GetTopic
+        */
+        TInt GetTopic( const TInt aIndex, TCbsTopic& aTopic );
+        
+        /**
+        *   Returns the total amount of unread messages.
+        *
+        *   @see CCbsMessageClient::UnreadMessageCount
+        */
+        TInt UnreadMessageCount();
+        
+        /**
+        *   Returns the total amount of messages the topic contains.    
+        *
+        *   @see CCbsMessageClient::GetMessageCount
+        */
+        TInt GetMessageCount( TCbsTopicNumber aNumber,
+            TInt& aCount );
+                            
+        /**
+        *   Returns message information.
+        *
+        *   @see CCbsMessageClient::GetMessage
+        */
+        TInt GetMessage( TCbsTopicNumber aNumber, TInt aIndex,
+            TCbsMessage& aMessage );
+            
+        /**
+        *   Returns the message contents.
+        *
+        *   @see CCbsMessageClient::GetMessageContents
+        */
+        TInt GetMessageContents( 
+            const TCbsMessageHandle& aHandle, 
+            TDes& aBuffer );       
+            
+        /**
+        *   Sets the message as read.
+        *
+        *   @see CCbsMessageClient::SetMessageAsRead
+        */
+        TInt SetMessageAsRead( const TCbsMessageHandle& aHandle );
+                        
+    private:
+    
+        /**
+        *   Default constructor.
+        */
+        CCbsMessageClientImpl();
+        
+        /**
+        *   2nd-phase constructor
+        */
+        void ConstructL();  
+        
+    private:    // Data
+    
+        // CBS Client API
+        RCbs iCbsClient;        
+    };
+    
+    
+
+#endif      //  CCBSMESSAGECLIENTIMPL_H   
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ClientSrc/RCbs.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,757 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 RCbs class 
+                 member functions.
+*
+*/
+
+
+//  INCLUDES
+#include "RCbs.h"
+#include "CbsCommon.h"
+#include "CbsServerConstants.h"
+#include <data_caging_path_literals.hrh>
+
+// CONSTANTS 
+// Server name
+_LIT( KCbsServerExe, "CbsServer.exe");
+
+// How many microseconds to wait for server
+const TInt KWaitForServerRetries = 10;
+const TInt KWaitForServerTime = 500000;
+
+// ==================== LOCAL FUNCTIONS ====================
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// RCbs::RCbs
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RCbs::RCbs()   //lint -e1926
+                        //lint -e1928
+    : iConnected( EFalse )    
+    {
+    }                   //lint +e1926
+                        //lint +e1928
+    
+// Destructor
+EXPORT_C RCbs::~RCbs() 
+    {
+    // Close subsession and session.
+    Close();
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::Connect
+// Creates connection to the server.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RCbs::Connect()
+    {
+    TInt result( KErrNone );
+
+    if ( !iConnected )
+        {
+        // Start the server if it isn't already started
+        StartServer();
+
+        // Create a session to the server.
+        result = CreateSession( KCbsServerName,
+                                Version(), 
+                                KCbsServerDefaultSlots );
+    
+        if ( result == KErrNone )
+            {
+            // Create a settings subsession
+            result = iSettings.Open( *this );
+            }                        
+        if ( result == KErrNone )
+            {
+            // Create a topic list subsession
+            result = iTopicList.Open( *this );
+            }        
+        if ( result == KErrNone )
+            {
+            // Create a topic messages subsession
+            result = iTopicMessages.Open( *this );
+            }                        
+        if ( result == KErrNone )
+            {
+            // Create a topic collection subsession     
+            result = iTopicCollection.Open( *this );            
+            if ( result == KErrNone )
+                {
+                iConnected = ETrue;
+                }
+            else
+                {
+                iConnected = EFalse;
+                }
+            }        
+        }
+    // Return the result code           
+    return result; 
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::Close
+// Closes the session to the server.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RCbs::Close()
+    {
+    if ( iConnected )
+        {
+        // First close all subsessions.
+        iTopicCollection.Close();
+        iTopicMessages.Close();
+        iTopicList.Close();
+        iSettings.Close();
+
+        // Then close the server session.
+
+        // Try to tell the server we've closed the session.
+        // Just ignore if that fails.
+        const TIpcArgs args( TIpcArgs::ENothing );
+        SendReceive( ECbsCloseSession, args );
+
+        RHandleBase::Close();
+        iConnected = EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::Version
+// Returns the version of CbsClient.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+EXPORT_C TVersion RCbs::Version() const
+    {
+    // Create version and return it.
+    return TVersion( KCbsServerVersionMajor,
+                     KCbsServerVersionMinor,
+                     KCbsServerVersionBuild );
+    }
+
+// Settings-related methods
+
+// -----------------------------------------------------------------------------
+// RCbs::GetReceptionStatus
+// Requests the reception status from the server.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C void RCbs::GetReceptionStatus( 
+    TBool& aStatus )
+    {
+    iSettings.GetReceptionStatus( aStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::SetReceptionStatus
+// Changes the reception status to aStatus.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C TInt RCbs::SetReceptionStatus( 
+    TBool aStatus )
+    {    
+    // Change the reception status
+    return iSettings.SetReceptionStatus( aStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::GetTopicDetectionStatus
+// Requests the current topic detection status.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C void RCbs::GetTopicDetectionStatus( 
+    TBool& aStatus )
+    {
+    iSettings.GetTopicDetectionStatus( aStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::SetTopicDetectionStatus
+// Changes the topic detection status to aStatus.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+EXPORT_C TInt RCbs::SetTopicDetectionStatus( 
+    TBool aStatus )
+    {
+    return iSettings.SetTopicDetectionStatus( aStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::GetLanguages
+// Requests for the current language settings from the server.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C void RCbs::GetLanguages( 
+    TCbsSettingsLanguages& aLanguages )
+    {
+    iSettings.GetLanguages( aLanguages );
+    }
+// -----------------------------------------------------------------------------
+// RCbs::SetLanguages
+// Sets a new set of languages to the server.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C TInt RCbs::SetLanguages( 
+    const TCbsSettingsLanguages& aLanguages )
+    {
+    return iSettings.SetLanguages( aLanguages );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::NotifySettingsChanged
+// Requests the server to notify the client whenever any settings will be 
+// changed.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C void RCbs::NotifySettingsChanged( 
+    TRequestStatus& aStatus, 
+    TCbsSettingsEvent& aEvent )
+    {    
+    iSettings.NotifySettingsChanged( aStatus, aEvent );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::NotifySettingsChangedCancel
+// Cancels the request to notify the client.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C void RCbs::NotifySettingsChangedCancel()
+    {
+    iSettings.NotifySettingsChangedCancel();
+    }
+
+// Topic Collection -related methods
+
+// -----------------------------------------------------------------------------
+// RCbs::StartCollectionBrowsing
+// Resets the iterator.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C void RCbs::StartCollectionBrowsing()
+    {
+    iTopicCollection.Start();
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::HasNextCollectionTopic
+// Returns ETrue, if there is a topic not accessed with NextTopic()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool RCbs::HasNextCollectionTopic()
+    {
+    return iTopicCollection.HasNextTopic();
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::NextCollectionTopic
+// Returns the next topic identity if one exists.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RCbs::NextCollectionTopic( 
+    TCbsTopicInfo& aInfo )
+    {
+    return iTopicCollection.NextTopic( aInfo );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::GetTopicCount
+// Returns the total amount of topics the topic list contains. 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RCbs::GetTopicCount( 
+    TInt& aCount )
+    {
+    iTopicList.GetTopicCount( aCount );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::GetTopic
+// Returns information about a topic from the topic list.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RCbs::GetTopic( 
+    const TInt aIndex, 
+    TCbsTopic& aTopic )
+    {
+    return iTopicList.GetTopic( aIndex, aTopic ); 
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::FindTopicByNumber
+// Finds the topic by the given number.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RCbs::FindTopicByNumber( 
+    TCbsTopicNumber aNumber, 
+    TCbsTopic& aTopic )
+    {
+    return iTopicList.FindTopicByNumber( aNumber, aTopic );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::DeleteTopic
+// Deletes an existing topic.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RCbs::DeleteTopic( 
+    TCbsTopicNumber aNumber )
+    {
+    return iTopicList.DeleteTopic( aNumber );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::DeleteAllTopics
+// Delete all topics.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RCbs::DeleteAllTopics()
+    {
+    return iTopicList.DeleteAllTopics();
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::AddTopic
+// Adds a new topic.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RCbs::AddTopic( 
+    TCbsTopic& aTopic )
+    {
+    return iTopicList.AddTopic( aTopic );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::ChangeTopicNameAndNumber
+// Changes the name and number of the existing topic.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RCbs::ChangeTopicNameAndNumber( 
+    TCbsTopicNumber aOldNumber,
+    TCbsTopicNumber aNewNumber, 
+    const TCbsTopicName& aName )
+    {
+    return iTopicList.ChangeTopicNameAndNumber( 
+        aOldNumber, aNewNumber, aName );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::ChangeTopicSubscriptionStatus
+// Changes topic subscription status.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RCbs::ChangeTopicSubscriptionStatus( 
+    TCbsTopicNumber aNumber,
+    TBool aNewStatus )
+    {
+    return iTopicList.ChangeTopicSubscriptionStatus( aNumber, aNewStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::ChangeTopicHotmarkStatus
+// Changes topic hotmark status.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RCbs::ChangeTopicHotmarkStatus( 
+    TCbsTopicNumber aNumber,
+    TBool aNewStatus )
+    {
+    return iTopicList.ChangeTopicHotmarkStatus( aNumber, aNewStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::NotifyOnTopicListEvent
+// Requests the server to notify the client whenever an event occurs 
+// that changes the information of the topics.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RCbs::NotifyOnTopicListEvent( 
+    TRequestStatus& aStatus, 
+    const TInt aRequested, 
+    TCbsTopicListEvent& aEvent, 
+    TCbsTopicNumber& aNumber )
+    {
+    iTopicList.NotifyOnEvent( aStatus, aRequested, aEvent, aNumber );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::NotifyOnTopicListEventCancel
+// Cancels the pending notify request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RCbs::NotifyOnTopicListEventCancel()
+    {
+    iTopicList.NotifyOnEventCancel();
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::GetNewTopicsCount
+// Returns the number of topics added since last GetNewTopicsCount()
+// by the topic detection feature.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RCbs::GetNewTopicsCount( 
+    TInt& aCount )
+    {
+    return iTopicList.GetNewTopicsCount( aCount );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::GetLatestTopicNumber
+// Returns the number of the topic which was last added 
+// to topic list.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RCbs::GetLatestTopicNumber( 
+    TCbsTopicNumber& aNumber )
+    {
+    return iTopicList.GetLatestTopicNumber( aNumber );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::GetUnreadMessageCount
+// Returns the total amount of unread messages.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RCbs::GetUnreadMessageCount( 
+    TInt& aCount )
+    {
+    iTopicList.GetUnreadMessageCount( aCount );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::GetHotmarkedMessageHandle
+// Returns the handle to the latest hotmarked message that has been
+// received after the system has started up.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RCbs::GetHotmarkedMessageHandle( 
+    TCbsMessageHandle& aMessage )
+    {
+    iTopicList.GetHotmarkedMessageHandle( aMessage );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::GetHotmarkedMessageHandle
+// Returns the number of unread messages in hotmarked topics.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RCbs::NumberOfUnreadHotmarkedMessages() 
+    {
+    return iTopicList.NumberOfUnreadHotmarkedMessages();
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::GetNextAndPrevTopicNumber
+// Returns the numbers of topics that precede and succeed the given 
+// topic in server-side topic list.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RCbs::GetNextAndPrevTopicNumber( 
+        const TCbsTopicNumber& aCurrentTopicNumber,
+        TCbsTopicNumber& aPrevTopicNumber,
+        TCbsTopicNumber& aNextTopicNumber,
+        TInt& aPosition )
+    {
+    return iTopicList.GetNextAndPrevTopicNumber(
+        aCurrentTopicNumber,
+        aPrevTopicNumber,
+        aNextTopicNumber,
+        aPosition);
+    }
+
+
+// Topic Messages-related methods
+
+// -----------------------------------------------------------------------------
+// RCbs::GetMessageCount
+// Returns the total amount of messages the topic contains. 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RCbs::GetMessageCount( 
+    TCbsTopicNumber aNumber,
+    TInt& aCount )
+    {
+    return iTopicMessages.GetMessageCount( aNumber, aCount );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::GetMessage
+// Returns message information. 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C TInt RCbs::GetMessage( 
+    TCbsTopicNumber aNumber, 
+    TInt aIndex, 
+    TCbsMessage& aMessage )
+    {
+    return iTopicMessages.GetMessage( aNumber, aIndex, aMessage );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::FindMessageByHandle
+// Finds a message by given handle.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C TInt RCbs::FindMessageByHandle( 
+    const TCbsMessageHandle& aHandle, 
+    TCbsMessage& aMessage )
+    {
+    return iTopicMessages.FindMessageByHandle( aHandle, aMessage );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::GetMessageIndexByHandle
+// Returns the index of a message with given handle in topic.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//    
+EXPORT_C TInt RCbs::GetMessageIndexByHandle( 
+    const TCbsMessageHandle& aHandle, 
+    TInt& aIndex )
+    {
+    return iTopicMessages.GetMessageIndexByHandle( aHandle, aIndex );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::DeleteMessage
+// Deletes an existing message.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C TInt RCbs::DeleteMessage( 
+    const TCbsMessageHandle& aHandle )
+    {
+    return iTopicMessages.DeleteMessage( aHandle );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::SaveMessage
+// Saves a message (the saved message won't be deleted to make 
+// room for new messages).
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C TInt RCbs::SaveMessage( 
+    const TCbsMessageHandle& aHandle )
+    {
+    return iTopicMessages.SaveMessage( aHandle );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::LockMessage
+// Locks the message.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C TInt RCbs::LockMessage( 
+    const TCbsMessageHandle& aHandle )
+    {
+    return iTopicMessages.LockMessage( aHandle );   
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::ReadMessage
+// Sets the message as read.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C TInt RCbs::ReadMessage( 
+    const TCbsMessageHandle& aHandle )
+    {
+    return iTopicMessages.ReadMessage( aHandle );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::GetMessageContents
+// Returns the message contents.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C TInt RCbs::GetMessageContents( 
+    const TCbsMessageHandle& aHandle, 
+    TDes& aBuffer )
+    {
+    return iTopicMessages.GetMessageContents( aHandle, aBuffer );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::GetNextAndPrevMessageHandle
+// Returns the handles of messages that precede and succeed the 
+// given message in server-side list of topic messages.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C TInt RCbs::GetNextAndPrevMessageHandle(
+        const TCbsMessageHandle& aCurrentMsgHandle,
+        TCbsMessageHandle& aPrevMsgHandle,
+        TCbsMessageHandle& aNextMsgHandle,
+        TInt& aPosition )
+    {
+    return iTopicMessages.GetNextAndPrevMessageHandle(
+        aCurrentMsgHandle,
+        aPrevMsgHandle,
+        aNextMsgHandle,
+        aPosition );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::Connected
+// Returns ETrue if CbsServer session has been established.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C TBool RCbs::Connected() const 
+    {
+    return iConnected;
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::Shutdown
+// Forces the server to shut down.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C void RCbs::Shutdown() const
+    {
+    const TIpcArgs args( TIpcArgs::ENothing );
+    SendReceive( ECbsShutdown, args );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::StartServer
+// Starts the server.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+TInt RCbs::StartServer()
+    {	
+    TInt errorCode( KErrNone );
+    RMutex serverStartMutex;
+
+    if ( !IsServerStarted() )
+        {
+        TInt mutexExists( serverStartMutex.CreateGlobal( _L("CBSSERVERMTX") ) );
+        if ( mutexExists )
+            {
+            TInt openErr( serverStartMutex.OpenGlobal( _L("CBSSERVERMTX") ) );
+            if ( openErr )
+                {
+                return openErr;
+                }
+            }
+        // Mutex exists, wait until server is finished with it's tasks
+        if ( mutexExists == KErrAlreadyExists )
+            {
+            serverStartMutex.Wait();
+            }
+
+        // Create and start a new process.
+	    TBuf<1> arguments;
+	    RProcess p;
+
+	    #ifdef __WINS__
+        errorCode = p.Create( KCbsServerExe, arguments );        
+        #else
+        // Use the correct path depending on whether using data caging or not
+	    // Use path \sys\bin
+	    TBuf<64> fullPath;
+	    fullPath = KDC_PROGRAMS_DIR;
+        fullPath.Append( KCbsServerExe );	    	  
+	    errorCode = p.Create( fullPath, arguments );	    
+        #endif
+
+        if ( errorCode == KErrNone )
+            {
+	        p.Resume();
+	        p.Close();
+
+            TInt i( 0 );
+            for ( i = 0; i < KWaitForServerRetries; i++ )
+                {
+                if ( IsServerStarted() )
+                    {
+                    break; 
+                    }
+
+                User::After( KWaitForServerTime );
+                }            
+            }
+        // Finished with startup sequence, release the mutex
+        if ( mutexExists == KErrAlreadyExists )
+            {
+            serverStartMutex.Signal();
+            }
+        serverStartMutex.Close();
+        }    
+    return errorCode;
+    }
+
+// -----------------------------------------------------------------------------
+// RCbs::IsServerStarted
+// Checks if the server is already started.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+TBool RCbs::IsServerStarted()
+    {
+	TFindServer findServer( KCbsServerName );
+	TFullName name;
+	return ( findServer.Next( name ) == KErrNone );
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS ==============
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ClientSrc/RCbsSettings.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,196 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 RCbsSettings class 
+    		 member functions.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "CbsServerConstants.h"
+#include "RCbsTopicMessages.h"
+#include "RCbsSettings.h"
+#include "RCbs.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// C++ default constructor can NOT contain any code, that
+// might leave.
+//
+RCbsSettings::RCbsSettings()
+    : iNotifyEventPtr( NULL, 0, 0 )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsSettings::Open
+// Creates a subsession to the server.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+
+TInt RCbsSettings::Open( 
+    RCbs& aServer )
+    {
+    // Open the subsession.
+    const TIpcArgs args( TIpcArgs::ENothing );
+    return CreateSubSession( aServer, ECbsCreateSettingsSubsession, args );
+    }
+// -----------------------------------------------------------------------------
+// RCbsSettings::Close
+// Closes the subsession.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+
+TInt RCbsSettings::Close()
+    {
+    // Close the subsession.
+    RSubSessionBase::CloseSubSession( ECbsCloseSettingsSubsession );
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsSettings::GetReceptionStatus
+// Requests the reception status from the server.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void RCbsSettings::GetReceptionStatus( 
+    TBool& aStatus )
+    {
+    // Send request to the server. Get the current reception status.
+    aStatus = EFalse;
+    TPckgBuf< TBool > pckg( aStatus );
+    const TIpcArgs args( &pckg );
+
+    SendReceive( ECbsGetReceptionStatus, args );
+
+    aStatus = pckg();
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsSettings::SetReceptionStatus
+// Changes the reception status to aStatus.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+TInt RCbsSettings::SetReceptionStatus( 
+    TBool aStatus )
+    {  
+    // Change the reception status
+    TPckgBuf< TBool > pckg( aStatus );
+    const TIpcArgs args( &pckg );
+    return SendReceive( ECbsSetReceptionStatus, args );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsSettings::GetTopicDetectionStatus
+// Requests the current topic detection status.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+void RCbsSettings::GetTopicDetectionStatus( 
+    TBool& aStatus )
+    {
+    // Get the current topic detection status.
+    TPckgBuf< TBool > pckg;
+    const TIpcArgs args( &pckg );
+    SendReceive( ECbsGetTopicDetectionStatus, args );
+    aStatus = pckg();
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsSettings::SetTopicDetectionStatus
+// Sets a new topic detection status.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+TInt RCbsSettings::SetTopicDetectionStatus( 
+    TBool aStatus )
+    {
+    // Change the topic detection status.
+    TPckgBuf< TBool > pckg( aStatus );
+    const TIpcArgs args( &pckg );
+    return SendReceive( ECbsSetTopicDetectionStatus, args );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsSettings::GetLanguages
+// Returns the preferred languages in aLanguages.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+void RCbsSettings::GetLanguages( 
+    TCbsSettingsLanguages& aLanguages )
+    {
+    // Get the preferred languages
+    TPckgBuf< TCbsSettingsLanguages > pckg;
+    const TIpcArgs args( &pckg );
+    SendReceive( ECbsGetLanguages, args );
+    aLanguages = pckg();
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsSettings::SetLanguages
+// Sets a new set of languages to the server.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+TInt RCbsSettings::SetLanguages( 
+    const TCbsSettingsLanguages& aLanguages )
+    {
+    // Change the preferred languages
+    TPckgBuf< TCbsSettingsLanguages > pckg( aLanguages );
+    const TIpcArgs args( &pckg );
+    return SendReceive( ECbsSetLanguages, args );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsSettings::NotifySettingsChanged
+// Requests the server to notify the client whenever any settings 
+// will be changed.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+void RCbsSettings::NotifySettingsChanged( 
+    TRequestStatus& aStatus, 
+    TCbsSettingsEvent& aEvent )
+    {
+    // Set up the notify! 
+    iNotifyEventPtr.Set( reinterpret_cast<TText8*>( &aEvent ), 
+                         sizeof( TCbsSettingsEvent ),
+                         sizeof( TCbsSettingsEvent ) );
+
+    // Server writes through the pointer descriptor
+    const TIpcArgs args( &iNotifyEventPtr );
+    SendReceive( ECbsNotifySettingsChanged, args, aStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsSettings::NotifySettingsChangedCancel
+// Cancels the request to notify the client.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void RCbsSettings::NotifySettingsChangedCancel()
+    {
+    const TIpcArgs args( TIpcArgs::ENothing );
+    SendReceive( ECbsNotifySettingsChangedCancel, args );
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS ==============
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ClientSrc/RCbsTopicCollection.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,219 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 RCbsTopicCollection class 
+                 member functions.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "CbsServerConstants.h"
+#include "RCbs.h"
+#include "RCbsTopicCollection.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// RCbsTopicCollection::RCbsTopicCollection
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+RCbsTopicCollection::RCbsTopicCollection() 
+    : iIterator( 0 )
+    {   
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicCollection::Open
+// Creates a subsession to the server.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCbsTopicCollection::Open( 
+    RCbs& aServer  )
+    {
+    // Open the subsession.
+    const TIpcArgs args( TIpcArgs::ENothing );
+    return CreateSubSession( aServer, ECbsCreateTopicCollectionSubsession, args );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicCollection::Close
+// Closes a subsession to the server.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCbsTopicCollection::Close()
+    {
+    // Close the subsession
+    RSubSessionBase::CloseSubSession( ECbsCloseTopicCollectionSubsession );
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicCollection::GetTopicCount
+// Returns the total amount of topic information the topic collection
+// contains.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void RCbsTopicCollection::GetTopicCount( 
+    TInt& aCount )
+    {
+    // Get the topic count from the server
+    TPckgBuf< TInt > pckgCount;
+    const TIpcArgs args( &pckgCount );
+    SendReceive( ECbsGetTopicInfoCount, args );
+    aCount = pckgCount();
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicCollection::GetTopicInfo
+// Returns a topic information structure.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCbsTopicCollection::GetTopicInfo( 
+    TInt aIndex, 
+    TCbsTopicInfo& aInfo )
+    {
+    // Get topic information from the server
+    TPckgBuf< TCbsTopicInfo > pckgInfo( aInfo );
+    const TIpcArgs args( aIndex, &pckgInfo );
+    TInt result( SendReceive( ECbsGetTopicInfo, args ) );
+
+    if ( result == KErrNone )
+        {
+        aInfo = pckgInfo();
+        }
+    return result;    
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicCollection::NotifyOnChange
+// Notifies the client next time when topic collection changes.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void RCbsTopicCollection::NotifyOnChange( 
+    TRequestStatus& aStatus )
+    {
+    // Send notification on change
+    const TIpcArgs args( TIpcArgs::ENothing );
+    SendReceive( ECbsNotifyOnChange, args, aStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicCollection::NotifyOnChangeCancel
+// Cancels the pending request to notify.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void RCbsTopicCollection::NotifyOnChangeCancel()
+    {
+    // Cancel pending notification request.
+    const TIpcArgs args( TIpcArgs::ENothing );
+    SendReceive( ECbsNotifyOnChangeCancel, args );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicCollection::Start
+// Interface for topic collection browsing. Resets the iterator.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void RCbsTopicCollection::Start()
+    {
+    iIterator = 0;
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicCollection::HasNextTopic
+// Returns ETrue, if the topic collection has topic identities 
+// unaccessed with NextTopic().
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool RCbsTopicCollection::HasNextTopic()
+    {
+    TInt count( 0 );
+    TInt result( KErrNone );
+    TBool inList( EFalse );
+
+    GetTopicCount( count );
+    for ( ; iIterator < count; iIterator++ )
+        {
+        // Check if the current topic is in the topic list.
+        result = TopicInList( iIterator, inList );
+        if ( result != KErrNone )
+            {
+            return EFalse;
+            }
+        else if ( !inList )  
+            {
+            return ETrue;   // this topic is not in the list; 
+            }
+        }
+
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicCollection::NextTopic
+// Returns the next topic identity if one exists.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCbsTopicCollection::NextTopic( 
+    TCbsTopicInfo& aInfo )
+    {
+    // iIterator points to the next unlisted topic: return the topic 
+    // and error code.
+    TInt result( KErrNone );
+    result = GetTopicInfo( iIterator, aInfo );
+    if ( result == KErrNone )
+        {
+        iIterator++;    // advance to the next topic
+        }
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicCollection::TopicInList
+// Returns information whether the topic was in topic list.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCbsTopicCollection::TopicInList( 
+    TInt aIndex, 
+    TBool& aInList )
+    {
+    // value returned by the server gets stored here
+    TPckgBuf< TBool > pckgInList;
+    const TIpcArgs args( aIndex, &pckgInList );
+
+    TInt result = SendReceive( ECbsTopicInList, args );
+    if ( result == KErrNone )
+        {
+        aInList = pckgInList();
+        }
+    
+    return result;
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ClientSrc/RCbsTopicList.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,416 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 RCbsTopicList class 
+                 member functions.
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CbsServerConstants.h"
+#include "RCbs.h"
+#include "RCbsTopicList.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// RCbsTopicList::RCbsTopicList
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+RCbsTopicList::RCbsTopicList()
+    : iNotifyEventPtr( NULL, 0, 0 ), 
+    iNotifyHandlePtr( NULL, 0, 0 )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicList::Open
+// Creates a subsession to the server.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCbsTopicList::Open( 
+    RCbs& aServer )
+    {
+    const TIpcArgs args( TIpcArgs::ENothing );
+    return CreateSubSession( aServer, ECbsCreateTopicListSubsession, args );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicList::Close
+// Closes the subsession and connection to the server.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+TInt RCbsTopicList::Close()
+    {
+    // Close the subsession.
+    RSubSessionBase::CloseSubSession( ECbsCloseTopicListSubsession );
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicList::GetTopicCount
+// Returns the total amount of topics the topic list contains.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void RCbsTopicList::GetTopicCount( 
+    TInt& aCount )
+    {
+    // Send request to the server. Get the total amount of topics.
+    aCount = 0;
+    TPckgBuf< TInt > pckg( aCount );
+    const TIpcArgs args( &pckg );
+
+    TInt result = SendReceive( ECbsGetTopicCount, args );
+    // In case everything went just fine update the parameter!
+    if ( result == KErrNone )
+        {
+        aCount = pckg();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicList::GetTopic
+// Returns information about a topic from the topic list.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCbsTopicList::GetTopic( 
+    const TInt aIndex, 
+    TCbsTopic& aTopic )
+    {
+    TPckgBuf< TCbsTopic > pckgTopic;
+    const TIpcArgs args( aIndex, &pckgTopic );
+
+    TInt result = SendReceive( ECbsGetTopic, args );
+
+    // Update if everything went just fine
+    if ( result == KErrNone )
+        {
+        aTopic = pckgTopic();
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicList::FindTopicByNumber
+// Finds the topic by given number.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+TInt RCbsTopicList::FindTopicByNumber( 
+    TCbsTopicNumber aNumber, 
+    TCbsTopic& aTopic )
+    {
+    TPckgBuf< TCbsTopic > pckgTopic;
+    const TIpcArgs args( aNumber, &pckgTopic );
+
+    TInt result = SendReceive( ECbsFindTopicByNumber, args );
+
+    // Update aTopic if everything went just fine.
+    if ( result == KErrNone )
+        {
+        aTopic = pckgTopic();
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicList::DeleteTopic
+// Deletes an existing topic.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+TInt RCbsTopicList::DeleteTopic( 
+    TCbsTopicNumber aNumber )
+    {
+    // Send request to the server to delete a topic by handle    
+    const TIpcArgs args( aNumber );
+    return SendReceive( ECbsDeleteTopic, args );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicList::DeleteAllTopics
+// Delete all topics.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+TInt RCbsTopicList::DeleteAllTopics()
+    {
+    const TIpcArgs args( TIpcArgs::ENothing );
+    return SendReceive( ECbsDeleteAll, args );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicList::AddTopic
+// Adds a new topic.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCbsTopicList::AddTopic( 
+    TCbsTopic& aTopic )
+    {
+    // Send request to add a topic to the list.
+    TPckgBuf< TCbsTopic > pckgTopic( aTopic );
+    const TIpcArgs args( &pckgTopic );
+
+    TInt result = SendReceive( ECbsAddTopic, args );
+
+    if ( result == KErrNone )
+        {
+        // Update the topic information (only handle).
+        aTopic = pckgTopic();    
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicList::ChangeTopicNameAndNumber
+// Changes the name and number of the existing topic.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCbsTopicList::ChangeTopicNameAndNumber( 
+    TCbsTopicNumber aOldNumber, 
+    TCbsTopicNumber aNewNumber, 
+    const TCbsTopicName& aName )
+    {
+    // Send request to the server
+    const TIpcArgs args( aOldNumber, aNewNumber, &aName );
+    return SendReceive( ECbsChangeTopicNameAndNumber, args );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicList::ChangeTopicSubscriptionStatus
+// Changes topic subscription status.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCbsTopicList::ChangeTopicSubscriptionStatus( 
+     TCbsTopicNumber aNumber, 
+     TBool aNewStatus )
+    {
+    // Send request to the server
+    TPckgBuf< TBool > pckgStatus( aNewStatus );
+    const TIpcArgs args( aNumber, &pckgStatus );
+    return SendReceive( ECbsChangeTopicSubscriptionStatus, args );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicList::ChangeTopicHotmarkStatus
+// Changes topic hotmark status.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCbsTopicList::ChangeTopicHotmarkStatus( 
+     TCbsTopicNumber aNumber, 
+     TBool aNewStatus )
+    {
+    // Send request to the server
+    TPckgBuf< TBool > pckgStatus( aNewStatus );
+    const TIpcArgs args( aNumber, &pckgStatus );
+    return SendReceive( ECbsChangeTopicHotmarkStatus, args );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicList::NotifyOnEvent
+// Requests the server to notify the client whenever an event occurs that 
+// changes the information of the topics.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void RCbsTopicList::NotifyOnEvent( 
+    TRequestStatus& aStatus, 
+    const TInt aRequested, 
+    TCbsTopicListEvent& aEvent, 
+    TCbsTopicNumber& aHandle )
+    {
+    // Send request for the notify
+    iNotifyEventPtr.Set( reinterpret_cast< TText8* >( &aEvent ), 
+                         sizeof( TCbsTopicListEvent ),
+                         sizeof( TCbsTopicListEvent ) );
+    iNotifyHandlePtr.Set( reinterpret_cast< TText8* >( &aHandle ), 
+                         sizeof( TCbsTopicNumber ),
+                         sizeof( TCbsTopicNumber ) );
+
+    const TIpcArgs args( aRequested, &iNotifyEventPtr, &iNotifyHandlePtr );
+    SendReceive( ECbsNotifyOnEvent, args, aStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicList::NotifyOnEventCancel
+// Cancels the pending notify request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void RCbsTopicList::NotifyOnEventCancel()
+    {
+    const TIpcArgs args( TIpcArgs::ENothing );
+    SendReceive( ECbsNotifyOnEventCancel, args );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicList::GetNewTopicsCount
+// Returns the number of session-specific new topics and resets the counter.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCbsTopicList::GetNewTopicsCount( 
+    TInt& aCount )
+    {
+    // Send request to the server to get the total amount of new topics
+    aCount = 0;
+    TPckgBuf<TInt> pckg( aCount );
+    const TIpcArgs args( &pckg );
+
+    TInt result( SendReceive( ECbsGetNewTopicsCount, args ) );
+
+    if ( result == KErrNone )
+        {
+        aCount = pckg();
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicList::GetLatestTopicNumber
+// Returns the latest topic's number.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCbsTopicList::GetLatestTopicNumber( 
+    TCbsTopicNumber& aNumber )
+    {
+    aNumber = 0;
+    TPckgBuf<TCbsTopicNumber> pckg( aNumber );
+    const TIpcArgs args( &pckg );
+
+    TInt result( SendReceive( ECbsGetLatestTopicNumber, args ) );
+
+    if ( result == KErrNone )
+        {
+        aNumber = pckg();
+        }
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicList::GetUnreadMessageCount
+// Returns the total amount of unread messages.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void RCbsTopicList::GetUnreadMessageCount( 
+    TInt& aCount )
+    {
+    // Send request to the server to get the total amount of unread messages
+    TPckgBuf<TInt> pckg( aCount );
+    const TIpcArgs args( &pckg );
+
+    TInt result = SendReceive( ECbsGetUnreadMessageCount, args );
+
+    // In case everything went just fine update the parameter
+    if ( result == KErrNone )
+        {
+        aCount = pckg();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicList::GetHotmarkedMessageHandle
+// Returns the handle to the latest hotmarked message that has been
+// received after the system has started up.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+void RCbsTopicList::GetHotmarkedMessageHandle( 
+    TCbsMessageHandle& aMessage )
+    {
+    // Send request to the server to get the handle to the hotmarked message
+    TPckgBuf<TCbsMessageHandle> pckgMessageHandle( aMessage );
+    const TIpcArgs args( &pckgMessageHandle );
+
+    TInt result = SendReceive( ECbsGetHotmarkedMessageHandle, args );
+
+    if ( result == KErrNone )
+        {
+        aMessage = pckgMessageHandle();
+        }
+    else
+        {
+        aMessage = 0;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicList::NumberOfUnreadHotmarkedMessages
+// Returns the number of unread messages in hotmarked topics.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+TInt RCbsTopicList::NumberOfUnreadHotmarkedMessages() 
+    {
+    TInt hotMsgCount( 0 );
+    TPckgBuf<TInt> pckgHotMsgCount;    
+    const TIpcArgs args( &pckgHotMsgCount );
+
+    if ( SendReceive( ECbsGetUnreadHotmarkedMessageCount, args ) == KErrNone )
+        {
+        hotMsgCount = pckgHotMsgCount();
+        }
+
+    return hotMsgCount;
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicList::GetNextAndPrevTopicNumber
+// Returns the numbers of topics that precede and succeed the given 
+// topic in server-side topic list.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+TInt RCbsTopicList::GetNextAndPrevTopicNumber( 
+	const TCbsTopicNumber& aCurrentTopicNumber,
+	TCbsTopicNumber& aPrevTopicNumber,
+	TCbsTopicNumber& aNextTopicNumber,
+	TInt& aPosition )
+    {
+    TPckgBuf<TCbsTopicNumber> pckgCurrentTopic( aCurrentTopicNumber );
+    TPckgBuf<TCbsNextPrevTopicAndPosition> pckgResults;
+
+    const TIpcArgs args( &pckgCurrentTopic, &pckgResults );
+
+    TInt result( SendReceive( ECbsGetNextAndPrevTopicNumber, args ) );
+    if ( result == KErrNone )
+        {
+        aPrevTopicNumber = pckgResults().iPrevTopic;
+        aNextTopicNumber = pckgResults().iNextTopic;
+        aPosition = pckgResults().iPosition;
+        }
+    return result;
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS ==============
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ClientSrc/RCbsTopicMessages.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,291 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 RCbsTopicMessages class 
+                 member functions.
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CbsServerConstants.h"
+#include "RCbs.h"
+#include "RCbsTopicMessages.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// RCbsTopicMessages::RCbsTopicMessages
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+RCbsTopicMessages::RCbsTopicMessages()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicMessages::Open
+// Creates a subsession to the server.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+TInt RCbsTopicMessages::Open( 
+    RCbs& aServer )
+    {
+    const TIpcArgs args( TIpcArgs::ENothing );
+    return CreateSubSession( aServer, ECbsCreateTopicMessagesSubsession, args );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicMessages::Close
+// Closes the subsession.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+TInt RCbsTopicMessages::Close()
+    {
+    // Release locked message, if any
+    TCbsMessageHandle handle( 0 );
+    LockMessage( handle );
+
+    // Close the subsession.
+    RSubSessionBase::CloseSubSession( ECbsCloseTopicMessagesSubsession );
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicMessages::GetMessageCount
+// Returns the total amount of messages the topic contains.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+TInt RCbsTopicMessages::GetMessageCount( 
+    TCbsTopicNumber aNumber, 
+    TInt& aCount )
+    {
+    // Send request to get the total amount of messages
+    aCount = 0;
+    TPckgBuf< TInt > pckgCount( aCount );    
+    const TIpcArgs args( aNumber, &pckgCount );
+
+    TInt result = SendReceive( ECbsGetMessageCount, args );
+    
+    // If everything went fine, give the result to the client.
+    if ( result == KErrNone )
+        {
+        aCount = pckgCount();
+        }
+    return result;
+    }
+    
+// -----------------------------------------------------------------------------
+// RCbsTopicMessages::GetMessage
+// Returns message information.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+TInt RCbsTopicMessages::GetMessage( 
+    TCbsTopicNumber aNumber, 
+    TInt aIndex, 
+    TCbsMessage& aMessage )
+    {
+    // Send request to get the message from server
+    TPckgBuf< TCbsMessage > pckgMessage;
+    const TIpcArgs args( aNumber, aIndex, &pckgMessage );
+
+    TInt result = SendReceive( ECbsGetMessage, args );
+
+    if ( result == KErrNone )
+        {
+        aMessage = pckgMessage();
+        }
+    else
+        {
+        aMessage.iHandle = 0;
+        }
+
+    return result;
+
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicMessages::FindMessageByHandle
+// Finds a message by given handle.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+TInt RCbsTopicMessages::FindMessageByHandle( 
+    const TCbsMessageHandle& aHandle, 
+    TCbsMessage& aMessage )
+    {
+    // Send request to the server to find a message by handle
+    TPckgBuf< TCbsMessageHandle > pckgHandle( aHandle );
+    TPckgBuf< TCbsMessage > pckgMessage;
+    const TIpcArgs args( &pckgHandle, &pckgMessage );
+
+    TInt result = SendReceive( ECbsFindMessageByHandle, args );
+
+    // If everything went fine, update the message
+    if ( result == KErrNone )
+        {
+        aMessage = pckgMessage();
+        }
+    else
+        {
+        aMessage.iHandle = 0;
+        }
+
+    return result;
+
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicMessages::GetMessageIndexByHandle
+// Returns the index of a message with given handle in topic.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+TInt RCbsTopicMessages::GetMessageIndexByHandle( 
+    const TCbsMessageHandle& aHandle, 
+    TInt& aIndex )
+    {
+    TPckgBuf< TCbsMessageHandle > pckgHandle( aHandle );
+    TPckgBuf< TInt > pckgIndex( 0 );
+    const TIpcArgs args( &pckgHandle, &pckgIndex );
+
+    TInt result( SendReceive( ECbsGetMessageIndexByHandle, args ) );
+
+    if ( result == KErrNone )
+        {
+        aIndex = pckgIndex();
+        }
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicMessages::DeleteMessage
+// Deletes an existing message.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+TInt RCbsTopicMessages::DeleteMessage( 
+    const TCbsMessageHandle& aHandle )
+    {
+    // Send request to delete a message by handle
+    TPckgBuf< TCbsMessageHandle > pckgHandle( aHandle );
+    const TIpcArgs args( &pckgHandle );
+    return SendReceive( ECbsDeleteMessage, args );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicMessages::SaveMessage
+// Saves a message (i.e., the saved message won't be deleted to make 
+// room for new messages).
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+TInt RCbsTopicMessages::SaveMessage( 
+    const TCbsMessageHandle& aHandle )
+    {
+    // Send request to save a message by handle
+    TPckgBuf< TCbsMessageHandle > pckgHandle( aHandle );
+    const TIpcArgs args( &pckgHandle );
+    return SendReceive( ECbsSaveMessage, args );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicMessages::LockMessage
+// Locks the message.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+TInt RCbsTopicMessages::LockMessage( 
+    const TCbsMessageHandle& aHandle )
+    {
+    TPckgBuf< TCbsMessageHandle > pckgHandle( aHandle );
+    const TIpcArgs args( &pckgHandle );
+    return SendReceive( ECbsLockMessage, args );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicMessages::ReadMessage
+// Sets the message as read.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+TInt RCbsTopicMessages::ReadMessage( 
+    const TCbsMessageHandle& aHandle )
+    {
+    // Send request to set message read by handle
+    TPckgBuf< TCbsMessageHandle > pckgHandle( aHandle );
+    const TIpcArgs args( &pckgHandle );
+    return SendReceive( ECbsReadMessage, args );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicMessages::GetMessageContents
+// Returns the message contents.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+TInt RCbsTopicMessages::GetMessageContents( 
+    const TCbsMessageHandle& aHandle, 
+    TDes& aBuffer )
+    {
+    // Send request to get the message contents
+    TPckgBuf< TCbsMessageHandle > pckgHandle( aHandle );
+    TInt length = aBuffer.MaxLength();
+    const TIpcArgs args( &pckgHandle, length, &aBuffer );
+
+    TInt result( SendReceive( ECbsGetMessageContents, args ) );
+    if ( result != KErrNone )
+        {
+        aBuffer.Zero();
+        }
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsTopicMessages::GetNextAndPrevMessageHandle
+// Returns the handles of messages that precede and succeed the 
+// given message in server-side list of topic messages.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+TInt RCbsTopicMessages::GetNextAndPrevMessageHandle(
+	const TCbsMessageHandle& aCurrentMsgHandle,
+	TCbsMessageHandle& aPrevMsgHandle,
+	TCbsMessageHandle& aNextMsgHandle,
+	TInt& aPosition )
+    {
+    TPckgBuf< TCbsMessageHandle > pckgCurrentMsg( aCurrentMsgHandle );
+    TPckgBuf< TCbsNextPrevMsgAndPosition > pckgResults;
+    const TIpcArgs args( &pckgCurrentMsg, &pckgResults );
+
+    TInt result( SendReceive( ECbsGetNextAndPrevMsgHandle, args ) );
+    if ( result == KErrNone )
+        {
+        aPrevMsgHandle = pckgResults().iPrevMsg;
+        aNextMsgHandle = pckgResults().iNextMsg;
+        aPosition = pckgResults().iPosition;
+        }
+    return result;
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS ==============
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ClientSrc/ccbsmessageclient.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of the class CCbsMessageClient.
+*
+*/
+
+
+// INCLUDE FILES
+#include <ccbsmessageclient.h>
+#include "ccbsmessageclientimpl.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CCbsMessageClient::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CCbsMessageClient* CCbsMessageClient::NewL()
+    {
+    return CCbsMessageClientImpl::NewL();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessageClient::CCbsMessageClient
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCbsMessageClient::CCbsMessageClient()
+    {
+    }
+
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ClientSrc/ccbsmessageclientimpl.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,177 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of the class CCbsMessageClientImpl.
+*
+*/
+
+
+// INCLUDE FILES
+#include "ccbsmessageclientimpl.h"
+#include "RCbs.h"
+
+// ==================== LOCAL FUNCTIONS ====================
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCbsMessageClientImpl::CCbsMessageClientImpl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCbsMessageClientImpl::CCbsMessageClientImpl()
+    {    
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessageClientImpl::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCbsMessageClientImpl::ConstructL()
+    {    
+    User::LeaveIfError( iCbsClient.Connect() );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessageClientImpl::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCbsMessageClientImpl* CCbsMessageClientImpl::NewL() 
+    {
+    CCbsMessageClientImpl* self = new ( ELeave ) CCbsMessageClientImpl();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+    
+// Destructor
+CCbsMessageClientImpl::~CCbsMessageClientImpl() 
+    {
+    iCbsClient.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessageClientImpl::FindMessageByHandle
+//
+// (Other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CCbsMessageClientImpl::FindMessageByHandle( const TCbsMessageHandle& aHandle, 
+    TCbsMessage& aMessage )
+    {
+    return iCbsClient.FindMessageByHandle( aHandle, aMessage );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessageClientImpl::FindTopicByNumber
+// 
+// (Other items were commented in a header)
+// -----------------------------------------------------------------------------
+//    
+TInt CCbsMessageClientImpl::FindTopicByNumber( const TCbsTopicNumber aNumber,
+    TCbsTopic& aTopic )
+    {
+    return iCbsClient.FindTopicByNumber( aNumber, aTopic );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessageClientImpl::TopicCount
+// 
+// (Other items were commented in a header)
+// -----------------------------------------------------------------------------
+//                
+TInt CCbsMessageClientImpl::TopicCount()
+    {
+    TInt topicCount( 0 );
+    iCbsClient.GetTopicCount( topicCount );
+    return topicCount;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessageClientImpl::GetTopic
+// 
+// (Other items were commented in a header)
+// -----------------------------------------------------------------------------
+//    
+TInt CCbsMessageClientImpl::GetTopic( const TInt aIndex, TCbsTopic& aTopic )
+    {
+    return iCbsClient.GetTopic( aIndex, aTopic );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessageClientImpl::GetUnreadMessageCount
+// 
+// (Other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CCbsMessageClientImpl::UnreadMessageCount()
+    {
+    TInt msgCount( 0 );
+    iCbsClient.GetUnreadMessageCount( msgCount );
+    return msgCount;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessageClientImpl::GetMessageCount
+// 
+// (Other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CCbsMessageClientImpl::GetMessageCount( const TCbsTopicNumber aNumber,
+    TInt& aCount )
+    {
+    return iCbsClient.GetMessageCount( aNumber, aCount );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessageClientImpl::GetMessage
+// 
+// (Other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CCbsMessageClientImpl::GetMessage( const TCbsTopicNumber aNumber, 
+    const TInt aIndex,
+    TCbsMessage& aMessage )
+    {
+    return iCbsClient.GetMessage( aNumber, aIndex, aMessage );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessageClientImpl::GetMessageContents
+// 
+// (Other items were commented in a header)
+// -----------------------------------------------------------------------------
+//    
+TInt CCbsMessageClientImpl::GetMessageContents( const TCbsMessageHandle& aHandle, 
+    TDes& aBuffer )
+    {
+    return iCbsClient.GetMessageContents( aHandle, aBuffer );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessageClientImpl::SetMessageAsRead
+// 
+// (Other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+TInt CCbsMessageClientImpl::SetMessageAsRead( const TCbsMessageHandle& aHandle )
+    {
+    return iCbsClient.ReadMessage( aHandle );
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/Data/CbsServer.rss	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 of Cbs server
+*
+*/
+
+
+//  INCLUDES
+#include <badef.rh>
+#include <uikon.rh>
+#include <cbsserver.loc>
+
+RESOURCE RSS_SIGNATURE { }
+
+/******************* Localized texts **********************/
+
+// ---------------------------------------------------------
+// 
+//    r_text_index_topic
+//    Defines localized text, Index message text
+//
+// ---------------------------------------------------------
+//
+RESOURCE LBUF r_text_index_topic { txt = qtn_cb_litext_index; }
+
+// ---------------------------------------------------------
+// 
+//    r_text_sim_topic
+//    Defines localized text, SIM Topic text
+//
+// ---------------------------------------------------------
+//
+RESOURCE LBUF r_text_sim_topic { txt = qtn_cb_litext_sim_topic; }
+
+// ---------------------------------------------------------
+// 
+//    r_text_standard_topic_list
+//    Defines localized text, Standard Topic List name
+//
+// ---------------------------------------------------------
+//
+RESOURCE LBUF r_text_standard_topic_list { txt = qtn_cb_litext_standard_topic_list; }
+
+
+/******************* Default file paths **********************/
+
+// ---------------------------------------------------------
+// 
+//    r_file_settings
+//    CBS settings file path
+//
+// ---------------------------------------------------------
+//
+RESOURCE LBUF r_file_settings { txt = "C:\\system\\data\\cbs\\cbsettings.dat"; }
+
+// ---------------------------------------------------------
+// 
+//    r_file_topics
+//    CBS topics file path
+//
+// ---------------------------------------------------------
+//
+RESOURCE LBUF r_file_topics { txt = "C:\\system\\data\\cbs\\cbtopicsmsgs.dat"; }
+
+// ---------------------------------------------------------
+// 
+//    r_file_unsaved
+//    CBS unsaved messages file paths
+//
+// ---------------------------------------------------------
+//
+RESOURCE LBUF r_file_unsaved_wins { txt = "C:\\system\\data\\cbs\\cbunsaved.dat"; }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/Data/cbsclient.pkg	Wed Jul 21 18:26:52 2010 +0300
@@ -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:
+;
+; Languages
+&EN
+
+; Header
+#{"CbsClient"},(0x1000A85A),10,1,0,TYPE=PU
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Files
+"\epoc32\release\armv5\urel\cbsclient.dll"-"!:\sys\bin\cbsclient.dll"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/Data/cbsclient_stub.pkg	Wed Jul 21 18:26:52 2010 +0300
@@ -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:
+;
+; Languages
+&EN
+
+; Header
+#{"CbsClient"}, (0x1000A85A), 1, 0, 0, TYPE=SA
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Files
+""-"z:\sys\bin\cbsclient.dll"
Binary file cbs/cbsserver/Data/cbsclient_stub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/Data/cbsmcnclient.pkg	Wed Jul 21 18:26:52 2010 +0300
@@ -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:
+;
+; Languages
+&EN
+
+; Header
+#{"CbsMcnClient patch"},(0x1000A85B),10,1,0,TYPE=PU
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Files
+"\epoc32\release\armv5\urel\cbsmcnclient.dll"-"!:\sys\bin\cbsmcnclient.dll"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/Data/cbsmcnclient_stub.pkg	Wed Jul 21 18:26:52 2010 +0300
@@ -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:
+;
+; Languages
+&EN
+
+; Header
+#{"CbsMcnClient"}, (0x1000A85B), 1, 0, 0, TYPE=SA
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Files
+""-"z:\sys\bin\cbsmcnclient.dll"
Binary file cbs/cbsserver/Data/cbsmcnclient_stub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/Data/cbsserver.pkg	Wed Jul 21 18:26:52 2010 +0300
@@ -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:
+;
+; Languages
+&EN
+
+; Header
+#{"CbsServer patch"},(0x1000A859),10,1,0,TYPE=PU
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Files
+"\epoc32\release\armv5\urel\cbsserver.exe"-"!:\sys\bin\cbsserver.exe"
+"\epoc32\data\z\resource\cbsserver.rsc"-"!:\resource\cbsserver.rsc"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/Data/cbsserver_stub.pkg	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,31 @@
+;
+; 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:
+;
+; Languages
+&EN
+
+; Header
+#{"CbsServer"}, (0x1000A859), 1, 0, 0, TYPE=SA
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Files
+""-"z:\sys\bin\cbsserver.exe"
+""-"z:\resource\cbsserver.rsc"
+
Binary file cbs/cbsserver/Data/cbsserver_stub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/EABI/CbsClientU.DEF	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,50 @@
+EXPORTS
+	_ZN17CCbsMessageClient4NewLEv @ 1 NONAME
+	_ZN4RCbs10GetMessageEtiR13TCbsDbMessage @ 2 NONAME
+	_ZN4RCbs11DeleteTopicEt @ 3 NONAME
+	_ZN4RCbs11LockMessageERKm @ 4 NONAME
+	_ZN4RCbs11ReadMessageERKm @ 5 NONAME
+	_ZN4RCbs11SaveMessageERKm @ 6 NONAME
+	_ZN4RCbs12GetLanguagesER15TCbsDbLanguages @ 7 NONAME
+	_ZN4RCbs12SetLanguagesERK15TCbsDbLanguages @ 8 NONAME
+	_ZN4RCbs13DeleteMessageERKm @ 9 NONAME
+	_ZN4RCbs13GetTopicCountERi @ 10 NONAME
+	_ZN4RCbs15DeleteAllTopicsEv @ 11 NONAME
+	_ZN4RCbs15GetMessageCountEtRi @ 12 NONAME
+	_ZN4RCbs17FindTopicByNumberEtR11TCbsDbTopic @ 13 NONAME
+	_ZN4RCbs17GetNewTopicsCountERi @ 14 NONAME
+	_ZN4RCbs18GetMessageContentsERKmR6TDes16 @ 15 NONAME
+	_ZN4RCbs18GetReceptionStatusERi @ 16 NONAME
+	_ZN4RCbs18SetReceptionStatusEi @ 17 NONAME
+	_ZN4RCbs19FindMessageByHandleERKmR13TCbsDbMessage @ 18 NONAME
+	_ZN4RCbs19NextCollectionTopicER19TCbsDbTopicIdentity @ 19 NONAME
+	_ZN4RCbs20GetLatestTopicNumberERt @ 20 NONAME
+	_ZN4RCbs21GetUnreadMessageCountERi @ 21 NONAME
+	_ZN4RCbs21NotifySettingsChangedER14TRequestStatusR17TCbsSettingsEvent @ 22 NONAME
+	_ZN4RCbs22HasNextCollectionTopicEv @ 23 NONAME
+	_ZN4RCbs22NotifyOnTopicListEventER14TRequestStatusiR18TCbsTopicListEventRt @ 24 NONAME
+	_ZN4RCbs23GetMessageIndexByHandleERKmRi @ 25 NONAME
+	_ZN4RCbs23GetTopicDetectionStatusERi @ 26 NONAME
+	_ZN4RCbs23SetTopicDetectionStatusEi @ 27 NONAME
+	_ZN4RCbs23StartCollectionBrowsingEv @ 28 NONAME
+	_ZN4RCbs24ChangeTopicHotmarkStatusEti @ 29 NONAME
+	_ZN4RCbs24ChangeTopicNameAndNumberEttRK4TBufILi80EE @ 30 NONAME
+	_ZN4RCbs25GetHotmarkedMessageHandleERm @ 31 NONAME
+	_ZN4RCbs25GetNextAndPrevTopicNumberERKtRtS2_Ri @ 32 NONAME
+	_ZN4RCbs27GetNextAndPrevMessageHandleERKmRmS2_Ri @ 33 NONAME
+	_ZN4RCbs27NotifySettingsChangedCancelEv @ 34 NONAME
+	_ZN4RCbs28NotifyOnTopicListEventCancelEv @ 35 NONAME
+	_ZN4RCbs29ChangeTopicSubscriptionStatusEti @ 36 NONAME
+	_ZN4RCbs31NumberOfUnreadHotmarkedMessagesEv @ 37 NONAME
+	_ZN4RCbs5CloseEv @ 38 NONAME
+	_ZN4RCbs7ConnectEv @ 39 NONAME
+	_ZN4RCbs8AddTopicER11TCbsDbTopic @ 40 NONAME
+	_ZN4RCbs8GetTopicEiR11TCbsDbTopic @ 41 NONAME
+	_ZN4RCbsC1Ev @ 42 NONAME
+	_ZN4RCbsC2Ev @ 43 NONAME
+	_ZN4RCbsD1Ev @ 44 NONAME
+	_ZN4RCbsD2Ev @ 45 NONAME
+	_ZNK4RCbs7VersionEv @ 46 NONAME
+	_ZNK4RCbs8ShutdownEv @ 47 NONAME
+	_ZNK4RCbs9ConnectedEv @ 48 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/EABI/CbsMcnClientU.DEF	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,19 @@
+EXPORTS
+	_ZN14CMcnTopicArray11AddCbTopicLEt @ 1 NONAME
+	_ZN14CMcnTopicArray4NewLEv @ 2 NONAME
+	_ZN4CMcn10UnregisterEP15MCbsMcnObserver @ 3 NONAME
+	_ZN4CMcn4NewLEv @ 4 NONAME
+	_ZN4CMcn9RegisterLEP15MCbsMcnObserverRK14CMcnTopicArray @ 5 NONAME
+	_ZN4CMcnD0Ev @ 6 NONAME
+	_ZN4CMcnD1Ev @ 7 NONAME
+	_ZN4CMcnD2Ev @ 8 NONAME
+	_ZNK14CMcnTopicArray14GetTopicNumberERKjRj @ 9 NONAME
+	_ZNK4CMcn11GetCellInfoER6TDes16 @ 10 NONAME
+	_ZNK4CMcn14GetInfoMessageER6TDes16i @ 11 NONAME
+	_ZTI14CMcnTopicArray @ 12 NONAME ; #<TI>#
+	_ZTI15CCbsMcnListener @ 13 NONAME ; #<TI>#
+	_ZTI4CMcn @ 14 NONAME ; #<TI>#
+	_ZTV14CMcnTopicArray @ 15 NONAME ; #<VT>#
+	_ZTV15CCbsMcnListener @ 16 NONAME ; #<VT>#
+	_ZTV4CMcn @ 17 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/EABI/CbsServerU.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,66 @@
+EXPORTS
+	_ZTI10CCbsObject @ 1 NONAME ; #<TI>#
+	_ZTI10CCbsServer @ 2 NONAME ; #<TI>#
+	_ZTI11CCbsMessage @ 3 NONAME ; #<TI>#
+	_ZTI11CCbsRecEtel @ 4 NONAME ; #<TI>#
+	_ZTI11CCbsSession @ 5 NONAME ; #<TI>#
+	_ZTI12CCbsSettings @ 6 NONAME ; #<TI>#
+	_ZTI13CCbsScheduler @ 7 NONAME ; #<TI>#
+	_ZTI13CCbsTopicList @ 8 NONAME ; #<TI>#
+	_ZTI14CCbsMcnSession @ 9 NONAME ; #<TI>#
+	_ZTI14CCbsRecDecoder @ 10 NONAME ; #<TI>#
+	_ZTI14CCbsRecMessage @ 11 NONAME ; #<TI>#
+	_ZTI14CCbsSatRefresh @ 12 NONAME ; #<TI>#
+	_ZTI16CCbsRecCollector @ 13 NONAME ; #<TI>#
+	_ZTI17CCbsBackupMonitor @ 14 NONAME ; #<TI>#
+	_ZTI17CCbsDbImpSettings @ 15 NONAME ; #<TI>#
+	_ZTI17CCbsEtelMessaging @ 16 NONAME ; #<TI>#
+	_ZTI17CCbsTopicMessages @ 17 NONAME ; #<TI>#
+	_ZTI18CCbsDbImpTopicList @ 18 NONAME ; #<TI>#
+	_ZTI18CCbsMessageFactory @ 19 NONAME ; #<TI>#
+	_ZTI18CCbsRecEtelMonitor @ 20 NONAME ; #<TI>#
+	_ZTI18CCbsReceiverHelper @ 21 NONAME ; #<TI>#
+	_ZTI19CCbsLivecastHandler @ 22 NONAME ; #<TI>#
+	_ZTI19CCbsRecWcdmaMessage @ 23 NONAME ; #<TI>#
+	_ZTI19CCbsShutdownMonitor @ 24 NONAME ; #<TI>#
+	_ZTI19CCbsTopicCollection @ 25 NONAME ; #<TI>#
+	_ZTI20CCbsDiskSpaceMonitor @ 26 NONAME ; #<TI>#
+	_ZTI22CCbsDbImpTopicMessages @ 27 NONAME ; #<TI>#
+	_ZTI22CCbsRecNetworkListener @ 28 NONAME ; #<TI>#
+	_ZTI23CCbsMessageCleanupTimer @ 29 NONAME ; #<TI>#
+	_ZTI24CCbsDbImpTopicCollection @ 30 NONAME ; #<TI>#
+	_ZTI27CCbsSetFilterSettingHandler @ 31 NONAME ; #<TI>#
+	_ZTI9CCbsDbImp @ 32 NONAME ; #<TI>#
+	_ZTV10CCbsObject @ 33 NONAME ; #<VT>#
+	_ZTV10CCbsServer @ 34 NONAME ; #<VT>#
+	_ZTV11CCbsMessage @ 35 NONAME ; #<VT>#
+	_ZTV11CCbsRecEtel @ 36 NONAME ; #<VT>#
+	_ZTV11CCbsSession @ 37 NONAME ; #<VT>#
+	_ZTV12CCbsSettings @ 38 NONAME ; #<VT>#
+	_ZTV13CCbsScheduler @ 39 NONAME ; #<VT>#
+	_ZTV13CCbsTopicList @ 40 NONAME ; #<VT>#
+	_ZTV14CCbsMcnSession @ 41 NONAME ; #<VT>#
+	_ZTV14CCbsRecDecoder @ 42 NONAME ; #<VT>#
+	_ZTV14CCbsRecMessage @ 43 NONAME ; #<VT>#
+	_ZTV14CCbsSatRefresh @ 44 NONAME ; #<VT>#
+	_ZTV16CCbsRecCollector @ 45 NONAME ; #<VT>#
+	_ZTV17CCbsBackupMonitor @ 46 NONAME ; #<VT>#
+	_ZTV17CCbsDbImpSettings @ 47 NONAME ; #<VT>#
+	_ZTV17CCbsEtelMessaging @ 48 NONAME ; #<VT>#
+	_ZTV17CCbsTopicMessages @ 49 NONAME ; #<VT>#
+	_ZTV18CCbsDbImpTopicList @ 50 NONAME ; #<VT>#
+	_ZTV18CCbsMessageFactory @ 51 NONAME ; #<VT>#
+	_ZTV18CCbsRecEtelMonitor @ 52 NONAME ; #<VT>#
+	_ZTV18CCbsReceiverHelper @ 53 NONAME ; #<VT>#
+	_ZTV19CCbsLivecastHandler @ 54 NONAME ; #<VT>#
+	_ZTV19CCbsRecWcdmaMessage @ 55 NONAME ; #<VT>#
+	_ZTV19CCbsShutdownMonitor @ 56 NONAME ; #<VT>#
+	_ZTV19CCbsTopicCollection @ 57 NONAME ; #<VT>#
+	_ZTV20CCbsDiskSpaceMonitor @ 58 NONAME ; #<VT>#
+	_ZTV22CCbsDbImpTopicMessages @ 59 NONAME ; #<VT>#
+	_ZTV22CCbsRecNetworkListener @ 60 NONAME ; #<VT>#
+	_ZTV23CCbsMessageCleanupTimer @ 61 NONAME ; #<VT>#
+	_ZTV24CCbsDbImpTopicCollection @ 62 NONAME ; #<VT>#
+	_ZTV27CCbsSetFilterSettingHandler @ 63 NONAME ; #<VT>#
+	_ZTV9CCbsDbImp @ 64 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/Group/CbsClient.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2003-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CbsClient.
+*                This file is used to generate makefile with MAKMAKE utility.
+*
+*/
+
+#include <platform_paths.hrh>
+
+VENDORID        VID_DEFAULT
+
+TARGET          CbsClient.dll
+TARGETTYPE      dll
+UID             0x1000008d 0x1000A85A
+
+CAPABILITY      CAP_CLIENT_DLL
+
+lang SC
+
+SOURCEPATH      ../Group
+SOURCEPATH      ../ClientInc
+SOURCEPATH      ../ClientSrc
+
+// Client interface
+SOURCE          RCbs.cpp 
+SOURCE          RCbsSettings.cpp 
+SOURCE          RCbsTopicList.cpp 
+SOURCE          RCbsTopicMessages.cpp
+SOURCE          RCbsTopicCollection.cpp
+SOURCE          ccbsmessageclient.cpp
+SOURCE          ccbsmessageclientimpl.cpp
+
+USERINCLUDE     ../ClientInc 
+USERINCLUDE     ../ClientSrc 
+USERINCLUDE     ../ServerInc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/Group/CbsMcnClient.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2003-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CbsMcnClient.
+*                This file is used to generate makefile with MAKMAKE utility.
+*
+*/
+
+#include <platform_paths.hrh>
+
+VENDORID        VID_DEFAULT
+TARGET          CbsMcnClient.dll
+TARGETTYPE      dll
+UID             0x1000008d 0x1000A85B
+
+CAPABILITY      CAP_CLIENT_DLL
+
+LANGUAGE_IDS
+
+SOURCEPATH      ../Group
+SOURCEPATH      ../McnClientInc
+SOURCEPATH      ../McnClientSrc
+
+SOURCE          CMcn.cpp 
+SOURCE          Rcbsmcnsession.cpp 
+SOURCE          CCbsMcnListener.cpp 
+SOURCE          CMcnTopicArray.cpp 
+SOURCE          CbsMcnPanic.cpp 
+SOURCE          Rmcnsubsession.cpp
+
+USERINCLUDE     ../McnClientInc 
+USERINCLUDE     ../McnClientSrc 
+USERINCLUDE     ../ServerInc 
+USERINCLUDE     ../ClientInc
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib 
+LIBRARY        flogger.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/Group/CbsServer.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,138 @@
+/*
+* Copyright (c) 2003-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CbsServer.
+*                This file is used to generate makefile with MAKMAKE utility.
+*
+*/
+
+
+VENDORID        VID_DEFAULT
+
+#include <platform_paths.hrh>
+#include "CbsServerUid.h"
+#include <data_caging_paths.hrh>
+
+TARGET          CbsServer.exe
+
+#if defined( WINSCW )
+TARGETTYPE      exe
+#else
+TARGETTYPE      exexp
+#endif
+
+CAPABILITY      CAP_SERVER
+
+UID             KCbsServerUid2 KCbsServerUid3
+
+EPOCHEAPSIZE    0x1000 0x100000
+
+START RESOURCE  ../Data/CbsServer.rss
+HEADER
+TARGETPATH      RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END
+
+
+sourcepath      ../Group
+sourcepath      ../ServerInc
+sourcepath      ../ServerSrc
+
+#if defined( EABI )
+deffile ../EABI/ 
+#elif defined( WINS )
+// no .def file used
+#elif defined( WINSCW )
+//no .def file used
+#else
+deffile ../BMARM/ 
+#endif
+
+// Server base
+
+SOURCE          CCbsServer.cpp
+SOURCE          CbsServerPanic.cpp
+SOURCE          CCbsReceiverHelper.cpp
+SOURCE          CCbsScheduler.cpp
+SOURCE          CCbsMessageCleanUpTimer.cpp
+
+// Server side interface
+
+SOURCE          CCbsSession.cpp
+SOURCE          CCbsObject.cpp
+SOURCE          CCbsSettings.cpp
+SOURCE          CCbsTopicList.cpp
+SOURCE          CCbsTopicMessages.cpp
+SOURCE          CCbsTopicCollection.cpp
+SOURCE          CCbsMcnSession.cpp
+
+// Database implementation
+
+SOURCE          CbsStreamHelper.cpp
+SOURCE          CCbsDbImp.cpp
+SOURCE          CCbsDbImpSettings.cpp
+SOURCE          CCbsDbImpTopicList.cpp
+SOURCE          CCbsDbImpTopicMessages.cpp
+SOURCE          CCbsDbImpTopicCollection.cpp
+
+// ETel receiver
+SOURCE          Ccbsrecetel.cpp
+SOURCE          Ccbsrecetelmonitor.cpp
+SOURCE          CCbsRecMessage.cpp
+SOURCE          Ccbsreccollector.cpp
+SOURCE          Ccbsrecdecoder.cpp
+SOURCE          Ccbsrecnetworklistener.cpp
+SOURCE          CCbsSetFilterSettingHandler.cpp
+SOURCE          CCbsRecWcdmaMessage.cpp
+SOURCE          CCbsMessageFactory.cpp
+SOURCE          CCbsMessage.cpp
+
+// Wrapper classes for ETel
+SOURCE          CCbsEtelMessaging.cpp
+
+// Utilities
+SOURCE          CbsUtils.cpp
+SOURCE          CCbsLivecastHandler.cpp
+SOURCE          CCbsShutdownMonitor.cpp
+SOURCE          CCbsBackupMonitor.cpp
+SOURCE          CCbsSatRefresh.cpp
+SOURCE          CCbsDiskSpaceMonitor.cpp
+
+USERINCLUDE     . ../ServerInc 
+USERINCLUDE     ../ServerSrc
+USERINCLUDE     ../ClientInc 
+USERINCLUDE     ../McnClientInc 
+USERINCLUDE     ../loc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY     euser.lib 
+LIBRARY     estor.lib
+LIBRARY     efsrv.lib
+LIBRARY     etel.lib            // Core ETel functions
+LIBRARY     etelmm.lib          // Multimode ETel
+LIBRARY     charconv.lib        // Message decoding
+LIBRARY     bafl.lib            // Resource access
+LIBRARY     sysutil.lib         // SysUtil module, FFS critical level check
+LIBRARY     hal.lib
+LIBRARY	    satclient.lib       // for sat refresh
+LIBRARY     flogger.lib
+LIBRARY     centralrepository.lib
+LIBRARY     diskspacereserver.lib
+LIBRARY     FeatMgr.lib         // Feature Manager
+LIBRARY     CustomApi.lib       // SIM Topics usage
+LIBRARY     ViewCli.lib     // View server access
+LIBRARY     aknnotify.lib   // Soft notifications
+
+									
+EPOCSTACKSIZE 0x4000
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/Group/CbsServerUid.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 UIDs of the FR CBS Server.
+*
+*/
+
+
+#ifndef CBSSERVERUID_H
+#define CBSSERVERUID_H
+
+// INCLUDES
+// None
+
+// CONSTANTS  
+#define KCbsServerUid2 0x1000008d
+
+#define KCbsServerUid3 0x1000A859
+
+// MACROS  
+// None
+
+// DATA TYPES  
+// None
+
+// FUNCTION PROTOTYPES  
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION 
+// None
+
+#endif      //  CBSSERVERUID_H
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/Group/backup_registration.xml	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,8 @@
+<?xml version="1.0" standalone="yes"?>
+<backup_registration version="1.0">  
+    <passive_backup>      
+      <include_file name = "cbtopicsmsgs.dat"/>
+    </passive_backup>
+    <proxy_data_manager sid = "0x10202BE9" />
+    <restore requires_reboot = "no"/>
+</backup_registration>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/Group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2003-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 information required for building the CBS 
+*                module with BLDMAKE utility.
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+./CbsServer.mmp
+./CbsClient.mmp
+./CbsMcnClient.mmp
+
+PRJ_EXPORTS
+
+
+
+// Internal
+// UI CLIENT API
+../ClientInc/RCbs.h                     |../../../inc/RCbs.h
+../ClientInc/RCbsSettings.h             |../../../inc/RCbsSettings.h
+../ClientInc/RCbsTopicList.h            |../../../inc/RCbsTopicList.h
+../ClientInc/RCbsTopicMessages.h        |../../../inc/RCbsTopicMessages.h
+../ClientInc/RCbsTopicCollection.h      |../../../inc/RCbsTopicCollection.h
+../ClientInc/CbsCommon.h                |../../../inc/CbsCommon.h
+../ServerInc/CbsServerInternalPSKeys.h  |../../../inc/CbsServerInternalPSKeys.h
+
+// Backup registration file
+backup_registration.xml  /epoc32/data/z/private/1000A859/backup_registration.xml  
+backup_registration.xml  /epoc32/release/winscw/udeb/z/private/1000A859/backup_registration.xml 
+backup_registration.xml  /epoc32/release/winscw/urel/z/private/1000A859/backup_registration.xml 
+
+// SIS stubs
+../Data/cbsserver_stub.sis      /epoc32/data/z/system/install/cbsserver_stub.sis
+../Data/cbsclient_stub.sis      /epoc32/data/z/system/install/cbsclient_stub.sis
+../Data/cbsmcnclient_stub.sis   /epoc32/data/z/system/install/cbsmcnclient_stub.sis
+
+// IBY files
+../Rom/cbsserver.iby            CORE_MW_LAYER_IBY_EXPORT_PATH(cbsserver.iby)
+../Rom/CbsServerResources.iby   LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(CbsServerResources.iby)
+
+// LOC files
+../loc/CbsServer.loc            MW_LAYER_LOC_EXPORT_PATH(cbsserver.loc)
+
+// Generic configuration interface for component cenrep settings  
+../conf/cbsserver.confml                        MW_LAYER_CONFML(cbsserver.confml)
+../conf/cbsserver_102078EE.crml 	        MW_LAYER_CRML(cbsserver_102078EE.crml)
+../conf/cbsserver_1020298F.crml 	        MW_LAYER_CRML(cbsserver_1020298F.crml)
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/McnClientSrc/CCbsMcnListener.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 Implementation of the class CCbsMcnListener member 
+*                functions.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <ccbsmcnlistener.h>
+#include <rcbsmcnsession.h>
+#include <cmcn.h>
+#include "CbsLogger.h"
+
+// CONSTANTS
+
+const TInt KMcnListenerPriority = CActive::EPriorityStandard;
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCbsMcnListener::CCbsMcnListener
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCbsMcnListener::CCbsMcnListener( 
+    CMcn& aMcn, 
+    RCbsMcnSession& aSession )
+    : CActive( KMcnListenerPriority ), 
+      iMcn( aMcn ), 
+      iSession( aSession ),
+      iMcnPckg( iMcnMessage )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMcnListener::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCbsMcnListener::ConstructL()
+    {    
+    CBSLOGSTRING("CBSMCNCLIENT: >>> CCbsMcnListener::ConstructL()");
+
+    CActiveScheduler::Add( this );
+    Receive();
+
+    CBSLOGSTRING("CBSMCNCLIENT: <<< CCbsMcnListener::ConstructL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMcnListener::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCbsMcnListener* CCbsMcnListener::NewL( 
+    CMcn& aMcn, 
+    RCbsMcnSession& aSession )
+    {
+    CCbsMcnListener* self = new ( ELeave ) CCbsMcnListener( aMcn, aSession );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+    
+// Destructor
+CCbsMcnListener::~CCbsMcnListener() 
+    {
+    Cancel();
+    }
+// -----------------------------------------------------------------------------
+// CCbsMcnListener::RunL
+// This method is called when an Mcn message is received.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsMcnListener::RunL()
+    {   
+    CBSLOGSTRING2("CBSMCNCLIENT: >>> CCbsMcnListener::RunL(): iStatus: %d", iStatus.Int() );
+    CBSLOGSTRING2("CBSMCNCLIENT: CCbsMcnListener::RunL(): Msg topic number: %d", iMcnMessage.iTopicNumber );
+    CBSLOGSTRING2("CBSMCNCLIENT: CCbsMcnListener::RunL(): Msg network mode: %d", iMcnMessage.iNetworkMode );
+
+    // MCN message and parameters received from the network 
+    // and stored into iMcnMessage
+    iMcn.RelayMessage( iMcnMessage );
+    if ( iStatus.Int() != KErrServerTerminated && iStatus.Int() != KErrCancel )
+        {
+        Receive();
+        }    
+    
+    CBSLOGSTRING("CBSMCNCLIENT: <<< CCbsMcnListener::RunL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMcnListener::DoCancel
+// Cancels the outstanding Mcn request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsMcnListener::DoCancel()
+    {
+    iSession.ReadMcnMessageCancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMcnListener::Receive
+//  Receive an Mcn message from network.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsMcnListener::Receive()
+    {
+    CBSLOGSTRING("CBSMCNCLIENT: >>> CCbsMcnListener::Receive()");
+
+    iSession.ReadMcnMessage( iStatus, iMcnPckg );
+     
+    SetActive();
+    CBSLOGSTRING("CBSMCNCLIENT: <<< CCbsMcnListener::Receive()");
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/McnClientSrc/CMcn.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,203 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of the class CMcn.
+*
+*/
+
+
+// INCLUDE FILES
+#include <cmcn.h>
+#include <ccbsmcnlistener.h>
+#include <mcbsmcnobserver.h>
+#include <cbsmcnpanic.h>
+#include "CbsLogger.h"
+#include <cmcntopicarray.h>
+
+// CONSTANTS
+const TInt KReservedSpaceForMcnObservers = 3;
+
+// ==================== LOCAL FUNCTIONS ====================
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CMcn::CMcn
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CMcn::CMcn()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CMcn::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CMcn::ConstructL()
+    {    
+    CBSLOGSTRING("CBSMCNCLIENT: >>> CMcn::ConstructL()");    
+
+    User::LeaveIfError( iSession.Connect() );
+    iObservers = new ( ELeave ) CArrayPtrFlat< MCbsMcnObserver >
+        ( KReservedSpaceForMcnObservers );
+    iMcnListener = CCbsMcnListener::NewL( *this, iSession );
+
+    CBSLOGSTRING("CBSMCNCLIENT: <<< CMcn::ConstructL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CMcn::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CMcn* CMcn::NewL() 
+    {
+    CMcn* self = new ( ELeave ) CMcn;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+    
+// Destructor
+EXPORT_C CMcn::~CMcn() 
+    {
+    if ( iObservers != NULL ) 
+        {
+        iObservers->ResetAndDestroy();
+        }
+    delete iObservers;
+    delete iMcnListener;
+    iSession.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CMcn::RegisterL
+// Registers an observer to CBS server.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMcn::RegisterL( 
+    MCbsMcnObserver* aObserver, 
+    const CMcnTopicArray& aArray ) 
+    {
+    CBSLOGSTRING("CBSMCNCLIENT: >>> CMcn::RegisterL()");
+
+    __ASSERT_DEBUG( aObserver != 0, CbsMcnPanic( EMcnObserverNull ) );
+    iObservers->AppendL( aObserver );
+    iSession.RegisterL( aArray );
+
+    CBSLOGSTRING("CBSMCNCLIENT: <<< CMcn::RegisterL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CMcn::UnregisterL
+// Unregisters a previously registered MCN observer clearing
+// any topic subscriptions of this client in CBS server.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMcn::Unregister( 
+    MCbsMcnObserver* aObserver )
+    {
+    CBSLOGSTRING("CBSMCNCLIENT: >>> CMcn::Unregister()");
+
+    __ASSERT_DEBUG( aObserver !=0 , CbsMcnPanic( EMcnObserverNull ) );
+    TInt count( iObservers->Count() );
+    for( TInt i = 0; i < count; i++ )
+        {
+        MCbsMcnObserver* observer = iObservers->At( i );
+        if ( observer == aObserver )
+            {
+            iObservers->Delete( i );
+            break;
+            }
+        }
+    
+    // ignore result for now
+    TInt result( KErrNone );
+    TRAP( result, iSession.ClearSubscriptionsL() );
+
+    CBSLOGSTRING("CBSMCNCLIENT: <<< CMcn::Unregister()");
+    }
+
+// -----------------------------------------------------------------------------
+// CMcn::GetCellInfo
+// Retrieves the current MCN message (Cell Info, topic 050) from CBS 
+// server. 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CMcn::GetCellInfo( 
+    TDes& aMcnMessage ) const
+    {
+    return iSession.GetCellInfo( aMcnMessage );
+    }
+
+// -----------------------------------------------------------------------------
+// CMcn::RelayMessageL
+// Relays aMcnMessage and topic number to the registered observers.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMcn::RelayMessage( 
+    TCbsMcnMessage& aMcnMessage )
+    {
+    CBSLOGSTRING("CBSMCNCLIENT: >>> CMcn::RelayMessage()");
+
+    TInt count( iObservers->Count() );
+
+    CBSLOGSTRING2("CBSMCNCLIENT: CMcn::RelayMessage(): topicNumber: %d", aMcnMessage.iTopicNumber );
+    CBSLOGSTRING2("CBSMCNCLIENT: CMcn::RelayMessage(): Network mode: %d (0=GSM, 1=WCDMA, 2=Not defined)", aMcnMessage.iNetworkMode );
+    CBSLOGSTRING2("CBSMCNCLIENT: CMcn::RelayMessage(): Observer count: %d", count );
+
+    for ( TInt i = 0; i < count; )
+        {
+        TInt prevCount = count;
+
+        CBSLOGSTRING2("CBSMCNCLIENT: CMcn::RelayMessage(): Calling CellInfoChanged... Observer: %d", i);
+        
+        // Notify all registered observers        
+        iObservers->At( i )->CellInfoChanged( aMcnMessage );        
+        CBSLOGSTRING("CBSMCNCLIENT: CMcn::RelayMessage(): CellInfoChanged call finished.");
+
+        // Check if the client unregistered it's observer. If so, we don't
+        // increase the loop counter.
+        count = iObservers->Count();
+        if ( count == prevCount )
+            {
+            i++;
+            }        
+        }
+    CBSLOGSTRING("CBSMCNCLIENT: <<< CMcn::RelayMessage()");
+    }
+
+// -----------------------------------------------------------------------------
+// CMcn::GetInfoMessage
+// Retrieves the current info message from CBS server. 
+//
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CMcn::GetInfoMessage( 
+    TDes& aInfoMessage, 
+    TInt aTopicNumber ) const
+    {
+    return iSession.GetInfoMessage( aInfoMessage, aTopicNumber );   
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/McnClientSrc/CMcnTopicArray.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of the class CMcnTopicArray.
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include <cmcntopicarray.h>
+
+// CONSTANTS
+
+const TInt KInitialSpaceForTopicEntries = 3;
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CMcnTopicArray::CMcnTopicArray
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CMcnTopicArray::CMcnTopicArray()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CMcnTopicArray::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CMcnTopicArray::ConstructL()
+    {
+    iTopicList = new ( ELeave ) CArrayFixFlat< TUint >
+        ( KInitialSpaceForTopicEntries );
+    }
+    
+// -----------------------------------------------------------------------------
+// CMcnTopicArray::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CMcnTopicArray* CMcnTopicArray::NewL()
+    {
+    CMcnTopicArray* self = new ( ELeave ) CMcnTopicArray();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+    
+// Destructor
+CMcnTopicArray::~CMcnTopicArray()
+    {
+    delete iTopicList;
+    }
+
+// -----------------------------------------------------------------------------
+// CMcnTopicArray::AddCbTopicL
+// Adds a single CB topic to the topic list.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMcnTopicArray::AddCbTopicL( 
+    TUint16 aTopicNumber )
+    {
+    iTopicList->AppendL( aTopicNumber );
+    }
+
+// -----------------------------------------------------------------------------
+// CMcnTopicArray::EnumerateEntries
+// Returns the number of topic entries in parameter aEntries.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMcnTopicArray::EnumerateEntries( 
+    TUint& aEntries ) const
+    {
+    aEntries = iTopicList->Count();
+    }
+
+// -----------------------------------------------------------------------------
+// CMcnTopicArray::GetTopicNumber
+// Returns the topicnumber in aTopicNumber corresponding to the index
+// given in aIndex.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMcnTopicArray::GetTopicNumber( 
+    const TUint& aIndex, 
+    TUint& aTopicNumber ) const
+    {
+    aTopicNumber = iTopicList->At( aIndex );
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/McnClientSrc/CbsMcnPanic.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 called by this library's functions on critical error situations.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include <cbsmcnpanic.h>        // common header
+
+// CONSTANTS
+
+_LIT( KMcnPanic, "CbsMcn" );
+
+// ==================== LOCAL FUNCTIONS ====================
+
+// -----------------------------------------------------------------------------
+// CbsMcnPanic
+// Panics the McnClient
+// Returns: None
+// -----------------------------------------------------------------------------
+//
+GLDEF_C void CbsMcnPanic( 
+    TInt aPanic )
+    {
+    User::Panic( KMcnPanic, aPanic );   
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/McnClientSrc/Rcbsmcnsession.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,210 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of the class RCbsMcnSession.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "CbsServerConstants.h"
+#include <cbsmcnpanic.h>
+#include <cmcn.h>
+#include <rcbsmcnsession.h>
+#include <ccbsmcnlistener.h>
+#include <cmcntopicarray.h>
+#include "CbsLogger.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// RCbsMcnSession::RCbsMcnSession
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+RCbsMcnSession::RCbsMcnSession()
+    : iConnected( EFalse )
+    { //lint !e1928 !e1926
+    }                               
+    
+// Destructor
+RCbsMcnSession::~RCbsMcnSession()
+    {
+    Close();
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsMcnSession::GetCellInfo
+// Retrieves the current MCN message from CBS server.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCbsMcnSession::GetCellInfo( 
+    TDes& aMcnMessage ) const
+    {
+    return GetInfoMessage( aMcnMessage, KCellInfoTopic );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsMcnSession::GetInfoMessage
+// Retrieves the current HomeZone message from CBS server.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCbsMcnSession::GetInfoMessage( 
+    TDes& aMessage, 
+    const TInt aTopicNumber ) const
+    {
+    __ASSERT_DEBUG( iConnected, CbsMcnPanic( EMcnNotConnected ) );
+
+    const TIpcArgs args( &aMessage, aTopicNumber );
+    TInt result( SendReceive( EMcnGetInfoMessage, args ) );
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsMcnSession::ReadMcnMessage
+// Request next subscribed MCN message to be delivered to this session.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void RCbsMcnSession::ReadMcnMessage( 
+    TRequestStatus& aStatus, 
+    TPckg<TCbsMcnMessage>& aMcnPckg ) 
+    {
+    __ASSERT_DEBUG( iConnected, CbsMcnPanic( EMcnNotConnected ) );
+    iSubSession.ReadMcnMessage( aStatus, aMcnPckg );
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsMcnSession::ReadMcnMessageCancel
+// Cancels an outstanding request. Passed to the subsession object.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCbsMcnSession::ReadMcnMessageCancel() 
+    {
+    __ASSERT_DEBUG( iConnected, CbsMcnPanic( EMcnNotConnected ) );
+    return iSubSession.ReadMcnMessageCancel();
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsMcnSession::RegisterL
+// Subscribes topics given in aArray.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void RCbsMcnSession::RegisterL( 
+    const CMcnTopicArray& aArray )
+    {
+    CBSLOGSTRING("CBSMCNCLIENT: >>> RCbsMcnSession::RegisterL()");
+
+    __ASSERT_DEBUG( iConnected, CbsMcnPanic( EMcnNotConnected ) );
+    iSubSession.RegisterL( aArray );
+    
+    CBSLOGSTRING("CBSMCNCLIENT: <<< RCbsMcnSession::RegisterL()");
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsMcnSession::ClearSubscriptionsL
+// Clears all topic subscriptions of this session in CbsServer.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void RCbsMcnSession::ClearSubscriptionsL()
+    {
+    CBSLOGSTRING("CBSMCNCLIENT: >>> RCbsMcnSession::ClearSubscriptionsL()");
+
+    __ASSERT_DEBUG( iConnected, CbsMcnPanic( EMcnNotConnected ) );
+    iSubSession.ClearSubscriptionsL();
+
+    CBSLOGSTRING("CBSMCNCLIENT: <<< RCbsMcnSession::ClearSubscriptionsL()");
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsMcnSession::Connect
+// Establishes a connection with CbsServer.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RCbsMcnSession::Connect()
+    {
+    CBSLOGSTRING("CBSMCNCLIENT: >>> RCbsMcnSession::Connect()");
+
+    // Create a session to the server.
+    TInt result = CreateSession( KCbsServerName,
+       Version(), KCbsServerDefaultSlots );
+
+    CBSLOGSTRING2("CBSMCNCLIENT: RCbsMcnSession::Connect(): CreateSession() result: %d", result );    
+
+    if ( result == KErrNone )
+        {
+        TInt error = iSubSession.Open( *this );
+        if ( !error )
+            {
+            iConnected = ETrue;
+            CBSLOGSTRING("CBSMCNCLIENT: RCbsMcnSession::Connect(): Subsession opened.");            
+            }        
+        CBSLOGSTRING2("CBSMCNCLIENT: RCbsMcnSession::Connect(): Subsession opening failed, error: %d", error );        
+        } 
+    else
+        {
+        iConnected = EFalse;
+        CBSLOGSTRING2("CBSMCNCLIENT: RCbsMcnSession::Connect(): CreateSession failed, errorCode: %d", result );
+        }
+
+    CBSLOGSTRING2("CBSMCNCLIENT: <<< RCbsMcnSession::Connect(), iConnected: %d", iConnected );    
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsMcnSession::Close
+// Closes the connection with CbsServer.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void RCbsMcnSession::Close()
+    {
+    CBSLOGSTRING("CBSMCNCLIENT: >>> RCbsMcnSession::Close()");
+
+    if ( iConnected ) 
+        {
+        iSubSession.Close();
+
+        const TIpcArgs args( TIpcArgs::ENothing );
+        SendReceive( EMcnCloseSession, args );
+        RSessionBase::Close();
+        iConnected = EFalse;
+
+        CBSLOGSTRING("CBSMCNCLIENT: RCbsMcnSession::Close(): Connected -> subsession closed.");        
+        }
+    CBSLOGSTRING("CBSMCNCLIENT: <<< RCbsMcnSession::Close()");
+    }
+
+// -----------------------------------------------------------------------------
+// RCbsMcnSession::Version
+// Returns version information of this dll.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TVersion RCbsMcnSession::Version() const
+    {
+    // Create version and return it.
+    return TVersion( KCbsServerVersionMajor,
+                     KCbsServerVersionMinor,
+                     KCbsServerVersionBuild );
+    }
+    
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/McnClientSrc/Rmcnsubsession.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,180 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of the class RMcnSubSession.
+*
+*/
+
+
+// INCLUDE FILES
+#include "CbsServerConstants.h"
+#include <cbsmcnpanic.h>
+#include <rcbsmcnsession.h>
+#include <rmcnsubsession.h>
+#include <ccbsmcnlistener.h>
+#include <cmcntopicarray.h>
+#include "CbsLogger.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// RMcnSubSession::RMcnSubSession
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+RMcnSubSession::RMcnSubSession()
+    : iConnected( EFalse )
+    {    //lint !e1928    
+    }
+
+// Destructor
+RMcnSubSession::~RMcnSubSession()
+    {
+    Close();
+    }
+
+// -----------------------------------------------------------------------------
+// RMcnSubSession::Open
+// Creates a MCN subsession to CbsServer.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RMcnSubSession::Open( 
+    RCbsMcnSession& aMcnSession )
+    {
+    CBSLOGSTRING("CBSMCNCLIENT: >>> RMcnSubSession::Open()");
+
+    if ( !iConnected )
+        {
+        const TIpcArgs args( TIpcArgs::ENothing );
+        TInt result( CreateSubSession( aMcnSession, EMcnCreateSubsession, args ) );
+
+        if ( result == KErrNone )
+            {            
+            CBSLOGSTRING2("CBSMCNCLIENT: RMcnSubSession::Open(): Subsession created, result: %d", result );
+            iConnected = ETrue;
+            } 
+        else
+            {
+            iConnected = EFalse;
+            }
+        CBSLOGSTRING2("CBSMCNCLIENT: RMcnSubSession::Open(), returning %d.", result );        
+        return result;
+        }
+    CBSLOGSTRING("CBSMCNCLIENT: <<< RMcnSubSession::Open(), returning KErrGeneral.");    
+    return KErrGeneral;       
+    }
+
+// -----------------------------------------------------------------------------
+// RMcnSubSession::Close
+// Closes the subsession.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RMcnSubSession::Close()
+    {
+    CBSLOGSTRING("CBSMCNCLIENT: >>> RMcnSubSession::Close()");
+
+    if ( iConnected ) 
+        {
+        RSubSessionBase::CloseSubSession( EMcnCloseSubsession );
+        iConnected = EFalse;
+        }
+    CBSLOGSTRING("CBSMCNCLIENT: <<< RMcnSubSession::Close()");
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// RMcnSubSession::ReadMcnMessage
+// Request next subscribed MCN message to be delivered to this session.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void RMcnSubSession::ReadMcnMessage( 
+    TRequestStatus& aStatus, 
+    TPckg<TCbsMcnMessage>& aMcnPckg )
+    {
+    __ASSERT_DEBUG( iConnected, CbsMcnPanic( EMcnNotConnected ) );    
+    const TIpcArgs args( &aMcnPckg );
+
+    SendReceive( EMcnNotifyOnChange, args, aStatus );  // asynchronous
+    }
+
+// -----------------------------------------------------------------------------
+// RMcnSubSession::ReadMcnMessageCancel
+// Cancels an outstanding request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt RMcnSubSession::ReadMcnMessageCancel() 
+    {
+    __ASSERT_DEBUG( iConnected, CbsMcnPanic( EMcnNotConnected ) );
+    const TIpcArgs args( TIpcArgs::ENothing );
+    return SendReceive( EMcnNotifyOnChangeCancel, args );
+    }
+
+// -----------------------------------------------------------------------------
+// RMcnSubSession::RegisterL
+// Subscribes topics given in aArray.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void RMcnSubSession::RegisterL( 
+    const CMcnTopicArray& aArray )
+    {
+    CBSLOGSTRING("CBSMCNCLIENT: >>> RMcnSubSession::RegisterL()");
+
+    __ASSERT_DEBUG( iConnected, CbsMcnPanic( EMcnNotConnected ) );
+    // Store topic numbers into a descriptor.
+    TUint entries( 0 );
+    aArray.EnumerateEntries( entries );
+    TUint number( 0 );
+
+    // Request registration, pass topic numbers one at time to server-side.
+    
+    for( TUint i = 0; i < entries; i++ )
+        {
+        aArray.GetTopicNumber( i, number );
+        const TIpcArgs args( number );        
+
+        CBSLOGSTRING2("CBSMCNCLIENT: RMcnSubSession::RegisterL(): Passing topic number to server: %d", number );
+        User::LeaveIfError( SendReceive( EMcnSubscribeTopic, args ) );        
+        CBSLOGSTRING("CBSMCNCLIENT: RMcnSubSession::RegisterL(): Topic number passed to server OK." );
+        }
+
+    // Tell the server this was enough.
+    const TIpcArgs args2( TIpcArgs::ENothing );
+    User::LeaveIfError( SendReceive( EMcnNoMoreSubscriptions, args2 ) );
+
+    CBSLOGSTRING("CBSMCNCLIENT: <<< RMcnSubSession::RegisterL()");
+    }
+
+// -----------------------------------------------------------------------------
+// RMcnSubSession::ClearSubscriptionsL
+// Clears topic subscriptions of this session in CbsServer
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void RMcnSubSession::ClearSubscriptionsL()
+    {
+    CBSLOGSTRING("CBSMCNCLIENT: >>> RMcnSubSession::ClearSubscriptionsL()");
+
+    __ASSERT_DEBUG( iConnected, CbsMcnPanic( EMcnNotConnected ) );
+    const TIpcArgs args( TIpcArgs::ENothing );
+    User::LeaveIfError( SendReceive( EMcnClearSubscriptions, args ) );
+
+    CBSLOGSTRING("CBSMCNCLIENT: <<< RMcnSubSession::ClearSubscriptionsL(), cleared OK.");    
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/Rom/CbsServerResources.iby	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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:  IBY file of CbsServer resources
+*
+*/
+
+
+#ifndef CBSSERVERRESOURCES_IBY
+#define CBSSERVERRESOURCES_IBY
+
+data=ZRESOURCE\cbsserver.rsc        RESOURCE_FILES_DIR\cbsserver.rsc
+
+#endif // CBSSERVERRESOURCES_IBY
+
+//  End of File  
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/Rom/cbsserver.iby	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,34 @@
+/*
+* 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:  IBY file of CbsServer
+*
+*/
+
+
+#ifndef CBSSERVER_IBY
+#define CBSSERVER_IBY
+
+file=ABI_DIR\BUILD_DIR\CBSSERVER.EXE        PROGRAMS_DIR\CBSSERVER.EXE
+file=ABI_DIR\BUILD_DIR\CBSCLIENT.DLL        SHARED_LIB_DIR\CBSCLIENT.DLL
+file=ABI_DIR\BUILD_DIR\CBSMCNCLIENT.DLL     SHARED_LIB_DIR\CBSMCNCLIENT.DLL
+
+data=DATAZ_\private\1000A859\backup_registration.xml	private\1000A859\backup_registration.xml
+
+data=ZSYSTEM\install\cbsserver_stub.sis         System\Install\cbsserver_stub.sis
+data=ZSYSTEM\install\cbsclient_stub.sis         System\Install\cbsclient_stub.sis
+data=ZSYSTEM\install\cbsmcnclient_stub.sis      System\Install\cbsmcnclient_stub.sis
+
+#endif // CBSSERVER_IBY
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CCbsBackupMonitor.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,96 @@
+/*
+* 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:  This file contains the header file of the CCbsBackupMonitor class
+*    
+*
+*/
+
+
+#ifndef     CCBSBACKUPMONITOR_H
+#define     CCBSBACKUPMONITOR_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <e32property.h>
+#include "CCbsDbImp.H"
+
+//  CLASS DECLARATION 
+
+/**
+*  The CCbsBackupMonitor instance listens to 
+*  shutdown signal via Publish and Subscribe. On device shutdown,
+*  the listener stops server operation by stopping the active scheduler.
+*  CbsServer will then be terminated. 
+*/
+class CCbsBackupMonitor : public CActive
+    {
+    public:     // New functions
+
+        /**
+        *   Creates an instance of the class.
+        *
+        *   @param  aServer     Server reference
+        *   @return             A new instance of CCbsBackupMonitor
+        */
+        static CCbsBackupMonitor* NewL( CCbsDbImp& aDbImp );
+
+        /**
+        *   Destructor.
+        */
+        ~CCbsBackupMonitor();
+
+        /** 
+        *   Reissues the Subscribe request.
+        */
+        void IssueRequest();
+
+    private:    // From CActive
+
+        /**
+        *   Gets called when the system state changes.
+        */
+        void RunL();
+
+        /**
+        *   Cancels an outstanding Subscribe request.
+        */
+        void DoCancel();
+
+    private:
+
+        /**
+        *   The constructor.
+        *
+        */
+        CCbsBackupMonitor( CCbsDbImp& aDbImp );
+
+        /**
+        *   Finalizes the construction.
+        */
+        void ConstructL();
+      
+    private:    // Data
+        
+        // PubSub connection
+        RProperty iProperty;
+        
+        // DB reference
+        CCbsDbImp& iDbImp;
+    };
+
+#endif      //  CCBSBACKUPMONITOR_H   
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CCbsDbImp.H	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,224 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsDbImp class
+*
+*/
+
+
+
+
+#ifndef     CCBSDBIMP_H
+#define     CCBSDBIMP_H
+
+// INCLUDES
+#include <f32file.h>
+
+// CONSTANTS
+enum TCbsBackupRequest
+    {
+    ECbsNoBackup,
+    ECbsBackup,
+    ECbsRestore,
+    ECbsBackupNotDefined
+    };
+
+// FORWARD DECLARATIONS
+class CCbsDbImpSettings;
+class CCbsDbImpTopicList;
+class CCbsDbImpTopicCollection;
+class CCbsDbImpTopicMessages;
+class CBaBackupSessionWrapper;
+class CCbsBackupMonitor;
+class CCbsDiskSpaceMonitor;
+
+//  CLASS DECLARATION 
+
+/**
+*   Basis for the implementation of the database.
+*
+*   Constructs instances of database subclasses CCbsDbImpSettings,
+*   CCbsDbImpTopicCollection, CCbsDbTopicList and CCbsDbTopicMessages.
+*   On initialization determines whether datafiles already exist.
+*   If all of them are present and valid, no special action is taken.
+*
+*   If some or all datafiles are missing or corrupt, all datafiles
+*   are deleted and new files created.
+*   Factory default settings, if available, are then loaded from
+*   Shared Data and stored in server datafiles. This is done by
+*   database subinstances.
+*/
+class CCbsDbImp : public CBase
+    {
+    public:        // New functions
+
+        /**
+        *   Creates an instance of the class.
+        */
+        static CCbsDbImp* NewL();
+
+        /**
+         *   The destructor.
+         */
+        ~CCbsDbImp();
+    
+    public:
+
+        /**
+        *   Returns a reference to the current active topic list. 
+        *   
+        *   Using that instance the clients of the database can manage the 
+        *   topic list such as add and delete topics.
+        *
+        *   @return reference to the topic list.
+        */
+        CCbsDbImpTopicList& TopicListL();
+    
+        /**
+        *   Returns a reference to the current topic messages DB object.
+        *
+        *   @return reference to the topic messages.
+        */
+        CCbsDbImpTopicMessages& TopicMessagesL();
+
+        /**
+        *   Returns a reference to the settings DB object.
+        *    
+        *   @return reference to the settings.
+        */
+        CCbsDbImpSettings& SettingsL();
+
+        /**
+        *   Returns a reference to the topic collection. 
+        *   
+        *   @return reference to the topic collection.
+        */
+        CCbsDbImpTopicCollection& TopicCollectionL();
+
+        /**
+        *   Returns a reference to the backup wrapper. 
+        *   
+        *   @return reference to the backup wrapper.
+        */
+        CBaBackupSessionWrapper& BackupWrapperL();
+
+        /**
+        *   Checks if the database is initialized.
+        *
+        *   @return     ETrue if database has been initialized.
+        */
+        TBool IsInitialized() const;
+
+        /**
+        *   Registers for a notification for critical level.
+        */
+        void WaitForCriticalLevel();
+
+        /**
+        *   Deregisters from critical level notification.
+        */
+        void WaitForCriticalLevelCancel();
+        
+        /**
+        *   Changes file lock states as requested.
+        */
+        void ChangeFileLocksL( const TCbsBackupRequest& aRequest );
+        
+        /**
+        *   Constructs DB components.
+        *
+        */
+        void CreateComponentsL();
+
+    private:
+
+        /**
+        *   Constructor.
+        */
+        CCbsDbImp();
+
+        /**
+        *   The method creates the member variables and so finalizes 
+        *   the construction. It will leave if the construction fails.
+        */
+        void ConstructL();
+
+        /**
+        *   Constructs CCbsDbImpSettings.
+        *
+        *   @param  aFileName               Name of the settings file.
+        *   @return                         A ready-made CCbsDbImpSettings object.
+        */
+        CCbsDbImpSettings* CreateSettingsL();
+
+        /**
+        *   Constructs CCbsDbImpTopicList.
+        *
+        *   @param  aTopicsFile             Name of the topics file.
+        *   @param  aMessagesFile           Name of the messages file.
+        *   @return                         A ready-made CCbsDbImpTopicList object.
+        */
+        CCbsDbImpTopicList* CreateTopicListL( const TDesC& aTopicsFile,
+                                              const TDesC& aMessagesFile );
+
+        /**
+        *   Constructs CCbsDbImpTopicMessages.
+        *
+        *   @param  aTopicList              The CCbsDbImpTopicList to link to.
+        *   @return                         A ready-made CCbsDbImpTopicMessages object.
+        */
+        CCbsDbImpTopicMessages* CreateTopicMessagesL( CCbsDbImpTopicList& aTopicList );
+
+        /**
+        *   Constructs CCbsDbImpTopicCollection.
+        *
+        *   @param  aTopicList              The CCbsDbImpTopicList to link to.
+        *   @return                         A ready-made CCbsDbImpTopicCollection object.
+        */
+        CCbsDbImpTopicCollection* CreateTopicCollectionL();
+
+        /**
+        *   Free DB components.
+        */
+        void DeleteComponents();        
+        
+    private:
+        // Owns: DB settings object.
+        CCbsDbImpSettings* iSettings;
+
+        // Owns: DB topic list object.
+        CCbsDbImpTopicList* iTopicList;
+
+        // Owns: DB topic collection object. 
+        CCbsDbImpTopicCollection* iTopicCollection;
+
+        // Owns: DB topic messages object.
+        CCbsDbImpTopicMessages* iTopicMessages;
+
+        // File server session shared by all DB objects. 
+        RFs iFs;
+
+        // Owns: The backup wrapper
+        CBaBackupSessionWrapper* iBackupWrapper;
+        
+        // Owns: The backup monitor, uses PubSub
+        CCbsBackupMonitor* iBackupMonitor;
+        
+        // Owns: Disk space monitor, uses PubSub
+        CCbsDiskSpaceMonitor* iDiskSpaceMonitor;
+
+    };
+
+#endif      //  CCBSDBIMP_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CCbsDbImpSettings.H	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,238 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsDbImpSettings class
+*    
+*                This class represents the settings stored in the database.
+*
+*/
+
+
+
+#ifndef     CCBSDBIMPSETTINGS_H
+#define     CCBSDBIMPSETTINGS_H
+
+// INCLUDES
+#include "CbsCommon.h"
+#include "CCbsDbImp.H"
+
+//  FORWARD DECLARATIONS
+class MCbsDbSettingsObserver;
+
+//  CLASS DECLARATION 
+
+/**
+*   CCbsDbImpSettings represents server persistent settings.
+*   These settings include receive mode, topic detection mode
+*   and user selected languages.
+*
+*   Receive mode controls whether any CB messages are received
+*   or not. If topic detection is enabled and a message belonging
+*   to a previously unknown topic (i.e., a topic not on topic list)
+*   is received, the topic of this message is added onto the topic
+*   list.
+*
+*   User selected languages determine which message are received.
+*   The language of an incoming message has to be on the array
+*   of these preferred languages. Selection "All" allows reception
+*   of all messages, regardless of language. 
+*
+*   Settings are modifiable only through UI client requests.
+*   MCN client requests have no effect on these settings,
+*   that is, the settings in the file store. MCN client requests
+*   are taken into account when a call to CCbsRecEtel::ApplyStateChangesL()
+*   is made.
+*   
+*/
+class CCbsDbImpSettings : public CBase
+
+    {        
+    public:        // New functions
+        /**
+        *   Creates a new instance of the class. 
+        *
+        *   @param  aDatabase               Reference to the main DB instance.
+        *   @return                         Returns a pointer to the created 
+        *                                   instance of the class.
+        */
+        static CCbsDbImpSettings* NewL( CCbsDbImp& aDatabase );
+
+        /**
+        *   Destructor.
+        */
+        ~CCbsDbImpSettings();
+
+        /**
+        *   Changes the topic detection status.
+        *
+        *   @param aStatus                  New topic detection status.
+        */
+        void SetTopicDetectionStatusL( TBool aStatus );
+
+        /**
+        *   Returns the current value of the topic detection status.
+        *
+        *   @param aStatus                  The method will store to 
+        *                                   the variable the current topic 
+        *                                   detection status.
+        */
+        void GetTopicDetectionStatus( TBool& aStatus ) const;
+
+        /**
+        *   Changes the reception status.
+        *
+        *   @param aStatus                  New reception status.
+        */
+        void SetReceptionStatusL( TBool aStatus );
+
+        /**
+        *   Returns the current value of the topic reception status.
+        *
+        *   @param aStatus                  The method will store to 
+        *                                   the variable 
+        *                                   the current reception status.
+        */                  
+        void GetReceptionStatus( TBool& aStatus ) const;
+    
+        /**
+        *   Changes the preferred languages.
+        *
+        *   @param aLanguages               New preferred languages.
+        */
+        void SetLanguagesL( const TCbsDbLanguages& aLanguages );
+
+        /**
+        *   Returns the preferred languages.
+        *
+        *   @param aLanguages               The method will store to the variable
+        *                                   the current preferred languages.
+        */
+        void GetLanguages( TCbsDbLanguages& aLanguages ) const;
+
+        /**
+        *   Adds an observer to the settings. 
+        *
+        *   Observers are notified when an event occurs on the settings.
+        *
+        *   Panics if aObserver is null.
+        *
+        *   @param aObserver                Pointer to the observer that is 
+        *                                   requested to be added.
+        */
+        void AddObserverL( MCbsDbSettingsObserver* aObserver );
+    
+        /**
+        *   Removes database observer. 
+        *
+        *   The method will panic, if there is no such observer added
+        *   or the given observer is null.
+        *
+        *   @param aObserver                Pointer to the observer that is 
+        *                                   requested to be removed.
+        */
+        void RemoveObserver( const MCbsDbSettingsObserver* aObserver );
+
+    private:
+
+        // A structure that contains the settings.
+        struct TCbsDbImpSettings
+            {
+            // Reception status. ETrue, if the reception is enabled.
+            TBool iReceptionStatus;
+
+            // Topic detection status. ETrue, if the topic detection is enabled.
+            TBool iTopicDetectionStatus;
+
+            // Language settings.
+            TCbsDbLanguages iLanguageStatus;
+            };
+
+        /**
+        *   Constructor.
+        *
+        *   @param aDatabase                Reference to the main database object.
+        */
+        CCbsDbImpSettings( CCbsDbImp& aDatabase );
+
+        /**
+        *   Creates the instances.
+        *
+        */
+        void ConstructL();
+  
+        /**
+        *   Saves the settings to the shared data. 
+        *
+        *   @return Boolean value indicating whether the saving succeeded.
+        */
+        TBool SaveSettings();
+
+        /**
+        *   Saves the settings to the shared data.
+        *
+        *   The method leaves in case the writing to the stream does not 
+        *   succeed.
+        */
+        void DoSaveSettingsL();
+
+        /**
+        *   Loads the settings, i.e. values for reception status, 
+        *   topic detection and language subscriptions.
+        *
+        *   These values are retrieved from Central Repository, associated with
+        *   the UID of CbsServer.
+        *
+        */
+        void LoadSettingsL();
+
+        /**
+        *   Determines whether the language settings are equal.
+        *
+        *   @param  aLanguage1              First language set.
+        *   @param  aLanguage2              Second language set.
+        *   @return                         ETrue, if the languages are equal.
+        */
+        TBool IsLanguagesEqual( const TCbsDbLanguages& aLanguage1, 
+            const TCbsDbLanguages& aLanguage2 ) const;
+
+        /**
+        *   Sets default language settings.
+        *
+        *   @param  aLanguage               Place where to put the default 
+        *                                   settings.
+        */
+        void SetDefaultLanguageSettings( TCbsDbLanguages& aLanguage ) const;
+
+        /**
+        *   Reads settings from shared data.
+        *
+        */
+        //void ReadSettingsL( );
+
+    private:    
+
+        // The main database object.
+        CCbsDbImp& iDatabase;
+
+        // Cached CB settings.
+        TCbsDbImpSettings iSettings;
+
+        // Owns:   Array containing registered settings observers.
+        CArrayFixFlat<MCbsDbSettingsObserver*>* iObservers;
+
+        __DECLARE_TEST;
+    };
+
+#endif      //  CCBSDBIMPSETTINGS_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CCbsDbImpTopicCollection.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,205 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsDbImpTopicCollection class.
+*    
+*                This class represents the topic collection stored in the database.
+*                Topic collection keeps a record of topic identities received from
+*                the network. Topic identity includes a topic name and a topic number. 
+*                These can be accessed but not modified.
+*
+*/
+
+
+#ifndef     CCBSDBIMPTOPICCOLLECTION_H   
+#define     CCBSDBIMPTOPICCOLLECTION_H   
+
+//  INCLUDES
+
+#include <e32base.h>
+#include <e32std.h>
+#include <s32stor.h>
+#include <f32file.h>
+#include <s32file.h>
+
+#include "MCbsDbTopicCollectionObserver.H"
+
+//  CLASS DECLARATION 
+
+class CCbsDbImp;
+
+/**
+*   This class defines the interface for handling topic collections.
+*
+*   User's Guide for accessing stored topic identities:
+*   GetTopicIdentityCount(TInt&)
+*       Retrieves the number of topic identities currently stored in the 
+*       topic collection.
+*   GetTopicIdentityL(TInt&, TCbsDbTopicIdentity&)
+*       Retrieves a single topic identity identified with an index.
+*
+*   User's Guide for observing the topic collection.
+*   AddObserverL(MCbsDbTopicCollectionObserver*)
+*       Registers an observer which is notified of changes in the topic
+*       collection.
+*   RemoveObserverL(MCbsDbTopicCollectionObserver*)
+*       Unregisters an observer.
+*
+*   User's Guide for modifying the topic collection:
+*   Clear()
+*       Clears the current topic collection. This is called by the index
+*       message parsing routine when it's about to parse a root index
+*       message. Topic identities contained in subsequent child subindex 
+*       messages, if any, are then simply added with AddTopicIdentityL()
+*   AddTopicIdentityL(TCbsDbTopicIdentity&)
+*       Adds a topic identity into the topic collection's buffer.
+*   Apply()
+*       Writes the topic identity buffer into persistent storage.
+*       Clears the buffer.
+*   
+*/
+class CCbsDbImpTopicCollection : public CBase
+    {
+
+    public:     // New functions.
+        /**
+        *   Creates a new instance of the class.
+        *       
+        *   @return                     A pointer to the created 
+        *                               CCbsDbImpTopicCollection instance.
+        */
+        static CCbsDbImpTopicCollection* NewL();
+
+        /**
+        *   Destructor. 
+        */
+        ~CCbsDbImpTopicCollection();
+
+    public: 
+        /**
+        *   Returns the total amount of topic identities 
+        *   the collection contans.
+        *
+        *   @param aCount               The method stores the topic identity
+        *                               count to this variable.
+        */
+        void GetTopicIdentityCount( TInt& aCount ) const;
+
+        /**
+        *   Stores a topic identity (index is aIndex in the list) to aIdentity.
+        *   The method leaves if the parameter aIndex is invalid.
+        *
+        *   Exceptions:
+        *   KErrNotFound                The requested topic identity was not 
+        *                               found.
+        *
+        *   @param aIndex               Used to index identities.
+        *   @param aIdentity            The method stores a topic identity to 
+        *                               the parameter.
+        */
+        void GetTopicIdentityL( 
+            TInt& aIndex, 
+            TCbsDbTopicIdentity& aIdentity ) const;
+
+        /**
+        *   Adds a topic collection observer. 
+        *
+        *   Panics if aObserver is null.
+        *
+        *   Exceptions:
+        *   KErrNoMemory                OOM
+        *
+        *   @param aObserver            Pointer to the new observer to be added
+        */
+        void AddObserverL( MCbsDbTopicCollectionObserver* aObserver );
+
+        /**
+        *   Removes a topic collection observer. 
+        *
+        *   Panics if aObserver is null or aObserver is not registered
+        *   as an observer.
+        *
+        *   @param aObserver            Pointer to the observer to be removed
+        */
+        void RemoveObserver( const MCbsDbTopicCollectionObserver* aObserver );
+
+        /**
+        *   Clears the topic collection builder's buffered topic list.
+        *   This does not have any effect on identities stored in 
+        *   the database.
+        *
+        *   This method should be called prior to parsing a root index
+        *   message. Any topic identities extracted from subindex messages
+        *   should be appended into collection with AddTopicIdentityL()
+        *   without any call to Clear().
+        */
+        void Clear();
+
+        /**
+        *   Stores topic identities which were added to the topic 
+        *   collection with AddTopicIdentityL() after previous call to 
+        *   Apply().
+        *
+        */
+        void Apply();
+
+        /**
+        *   Adds a new topic identity to the buffered collection.
+        *   A topic identity contains topic name and number. If the
+        *   topic exists already, nothing is done.
+        *   
+        *   This method will return KErrAlreadyExists, if there is already 
+        *   another topic identity that has the same number.
+        *
+        *   Exceptions:
+        *   KErrNoMemory                OOM
+        *   KErrArgument                Topic number of the given identity is
+        *                               out of valid range.
+        *
+        *   @param  aIdentity           Topic identity to be added.
+        */
+        void AddTopicIdentityL( const TCbsDbTopicIdentity& aIdentity );
+
+    private:
+
+        /**
+        *   Constructor. 
+        *
+        */
+        CCbsDbImpTopicCollection();
+
+        /**
+        *   Finalizes the construction.
+        *
+        */
+        void ConstructL();
+
+        /**
+        *   Notifies topic collection observers about changed topic 
+        *   collection.
+        */       
+        void NotifyObservers();
+
+    private:
+
+        // Own: Contains the observers.
+        CArrayFixFlat< MCbsDbTopicCollectionObserver* >* iObservers;
+
+        // Own: Contains buffered topic identities.
+        CArrayFix< TCbsDbTopicIdentity >* iIdentities;
+
+    };
+
+#endif      //  CCBSDBIMPTOPICCOLLECTION_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CCbsDbImpTopicList.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,852 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsDmImpTopicList class
+*    
+*                This class represents the topic list stored in the database.
+*
+*/
+
+
+#ifndef     CCBSDBIMPTOPICLIST_H
+#define     CCBSDBIMPTOPICLIST_H
+
+// INCLUDES
+#include <f32file.h>
+
+#ifndef __SECURE_BACKUP__
+#include <babackup.h>
+#endif
+
+#include "CbsCommon.h"
+#include "CCbsDbImp.H"
+
+// FORWARD DECLARATIONS
+//class CCbsDbImp;
+class CCbsDbImpTopicMessages;
+class MCbsDbTopicListObserver;
+class CFileStore;
+//  CLASS DECLARATION 
+
+/**
+*   CCbsDbImpTopicList is the database topic list manager.
+*   
+*/
+class CCbsDbImpTopicList : public CBase
+#ifndef __SECURE_BACKUP__
+, public MBackupObserver
+#endif
+    {
+    #ifndef __SECURE_BACKUP__
+    public: // MBackupObserver
+        /**
+        *   Closes or reopens the settings file if requested by a backup.
+        *
+        *   @param aFileName                The name of the file to close.
+        *   @param aFlags                   The action to be performed.
+        *
+        */
+        void ChangeFileLockL( const TDesC& aFileName, TFileLockFlags aFlags );
+    #else
+    
+    public:
+        /**
+        *   Closes or reopens the settings file if requested by a backup.
+        *
+        *   @param aRequest                 Current request        
+        *
+        */
+        void ChangeFileLockL( const TCbsBackupRequest& aRequest );
+        
+    #endif
+
+    private: 
+        /**
+        *   Check if the server has a file lock. Leaves with
+        *   KErrLocked if not.
+        */
+        void CheckFileLockL() const;
+
+    public:     // New functions
+        
+        /**
+        *   Creates an instance of the class.
+        *
+        *   @param aFs                      Open file server session.
+        *   @param aTopicsFile              Name of the file containing topics.
+        *   @param aUnsavedMessagesFile     Name of the file containing unsaved
+        *                                   messages.
+        *   @param aDatabase                Reference to database object
+        *   @return                         Pointer to the created instance.
+        */
+        static CCbsDbImpTopicList* NewL( RFs& aFs, 
+            const TDesC& aTopicsFile, 
+            const TDesC& aUnsavedMessagesFile,
+            CCbsDbImp& aDatabase );
+
+        /**
+        *   Destructor.
+        */
+        ~CCbsDbImpTopicList();
+
+    public:
+
+        /**
+        *   Creates a new topic list
+		*
+        *	@param	aTopicListName		Name of the new topic list
+		*	@param	aTopicListIndex		Returns: Index number of the new list
+        */
+        void CreateNewTopicListL( const TDesC& aTopicListName );
+
+
+		/**
+        *	Deletes old read messages. The clean up interval is set
+		*	by the user.
+		*
+        */
+        void CleanupReadMessagesL();        
+
+        /**
+        *   Sets the topic messages manager.
+        *
+        *   Note that this function does not transfer ownership
+        *   of aMessages.
+        *
+        *   @param aMessages            Pointer to the topic messages 
+        *                               manager.
+        */
+        void SetTopicMessages( CCbsDbImpTopicMessages* aMessages );
+
+        /**
+        *   Returns pointer to the current store which contains topics
+        *   of the server (i.e., Topics-file) and saved messages. 
+        *   Leaves with KErrLocked if the store is locked by backup.
+        *
+        *   @return                     Pointer to topics store.
+        */
+        CFileStore* TopicStoreL() const;
+
+        /**
+        *   Returns a pointer to the name of the file, which contains unsaved
+        *   messages of the server.
+        *
+        *   @return                     Reference to the file name.
+        */
+        const TDesC& TopicFilename() const;
+
+        /**
+        *   Returns a pointer to the store, which contains unsaved
+        *   messages of the server.
+        *
+        *   @return                     Pointer to unsaved messages store.
+        */
+        CFileStore* UnsavedMessagesStore() const;
+
+        /**
+        *   Returns a pointer to the name of the file, which contains unsaved
+        *   messages of the server (Unsaved Messages-file, "cbs4.dat").
+        *
+        *   @return                     Reference to the file name.
+        */
+        const TDesC& UnsavedMessagesFilename() const;
+
+        /**
+        *   Returns the topic messages stream id by topic handle.
+        *
+        *   @param  aNumber             Topic number
+        *   @param  aId                 Returns: the stream id to the topic
+        *                               messages stream.
+        */
+        void GetTopicMessagesIdL( TCbsDbTopicNumber aNumber,
+            TStreamId& aId ) const;
+
+        /**
+        *   Updates the topic messages stream id by topic handle. The new 
+        *   identifier is expected not to be a null id.
+        *
+        *   Note that the method will not commit changes to the store. 
+        *   It also changes the internal state and thus if the method leaves, 
+        *   it is good to reload the whole root stream.
+        *
+        *   The method will delete the old topic messages stream.
+        *
+        *   @param aNumber              Topic number
+        *   @param aNewId               New stream id.
+        */
+        void UpdateTopicMessagesIdL( TCbsDbTopicNumber aNumber, 
+            const TStreamId& aNewId );
+
+        /**
+        *   Generates a message handle.
+        *
+        *   Note that it must be checked that the message handle is unique 
+        *   in that topic.
+        *
+        *   @param  aNumber             Topic number
+        *   @param  aRandom             Number generated in some way.
+        *   @return                     New message handle.
+        */
+        TCbsDbMessageHandle GenerateMessageHandle( 
+            const TCbsDbTopicNumber aNumber, TUint16 aRandom ) const;
+
+        /**
+        *   Informs that a new message has been received in a topic.
+        *
+        *   @param  aMessageHandle      Handle of the received message.
+        */
+        void InformNewMessageReceivedL(
+            const TCbsDbMessageHandle& aMessageHandle  );
+
+        /**
+        *   Informs that a message has been set as saved.
+        *
+        *   @param  aMessageHandle      Handle of the saved message.
+        */
+        void InformMessageSavedL( const TCbsDbMessageHandle& aMessageHandle );
+
+        /**
+        *   Informs that an unread message has been read.
+        *
+        *   @param  aMessageHandle      Handle of the read message.
+        */
+        void InformUnreadMessageReadL( 
+            const TCbsDbMessageHandle& aMessageHandle );
+
+        /**
+        *   Informs that a message has been deleted.
+        *
+        *   @param  aMessageHandle      Handle of the deleted message.
+        *   @param  aPermanent          ETrue, if the message was permanent.
+        *   @param  aRead               ETrue, if the message was read.
+        */
+        void InformMessageDeletedL( 
+            const TCbsDbMessageHandle& aMessageHandle, 
+            TBool aPermanent, TBool aRead );
+
+        /**
+        *   Extracts topic handle from message handle.
+        *
+        *   Note that the method does not check that the message exists.
+        *
+        *   @param  aHandle             Handle to a message.
+        *   @return                     Returns the number of the topic to 
+        *                               which the message belongs.
+        */
+        TCbsDbTopicNumber ExtractTopicNumber( 
+            const TCbsDbMessageHandle& aHandle ) const;
+        
+        /**
+        *   Initialises the whole topic list. 
+        */
+        void InitializeListL( const TBool aFileOpenFailed );
+
+        /**
+        *   Returns the total amount of saved messages.
+        *
+        *   @return                     Number of saved messages.
+        */
+        TInt TotalSavedMessages() const;
+
+        /**
+        *   Returns the amount of topics the list contains.
+        *
+        *   @param  aCount              Returns: number of topics in topic list
+        */
+        void GetTopicCount( TInt& aCount ) const;
+    
+        /**
+        *   Returns a topic by index.
+        *
+        *   Return values:
+        *   KErrNone                    Parameter aTopic contains the requested
+        *                               topic.
+        *   KErrArgument                Index out of bounds.
+        *
+        *   Leaves if file read fails.
+        *
+        *   @param  aIndex              Index to the topic.
+        *   @param  aTopic              Returns: topic information.
+        */
+        void GetTopicL( TInt aIndex, TCbsDbTopic& aTopic );
+
+        /**
+        *   Returns a topic by topic number.
+        *
+        *   Leaves with KErrNotFound, if a topic with the given number
+        *   is not found.
+        *
+        *   @param    aNumber           Number of the topic.
+        *   @param    aTopic            Returns: topic information.
+        */
+        void FindTopicByNumberL( TCbsDbTopicNumber aNumber, 
+            TCbsDbTopic& aTopic );
+
+        /**
+        *   Reads the name of the index topic from resource.
+        *
+        *   @return     Name of the index topic
+        */
+        HBufC* ReadIndexTopicNameLC();
+
+        /**
+        *   Adds a new topic to the list.
+        *
+        *   @param    aTopic            Topic information.
+        *   @param    aDetected         Was the topic detected automatically
+        */
+        void AddTopicL( TCbsDbTopic& aTopic, const TBool aDetected );
+
+        /**
+        *   Updates the topic name and number.
+        *
+        *   @param    aOldNumber        Old number of the topic.
+        *   @param    aNewNumber        New number of the topic.
+        *   @param    aName             New name of the topic.
+        */
+        void UpdateTopicNameAndNumberL( 
+            TCbsDbTopicNumber aOldNumber, 
+            TCbsDbTopicNumber aNewNumber, 
+            const TCbsDbTopicName& aName );
+
+        /**
+        *   Updates the topic subscription status.
+        *
+        *   @param    aNumber           Topic number
+        *   @param    aStatus           New subscription status.
+        */
+        void UpdateTopicSubscriptionStatusL( 
+            TCbsDbTopicNumber aNumber, 
+            TBool aStatus );
+
+        /**
+        *   Updates the topic hotmark status.
+        *
+        *   @param    aNumber           Topic number
+        *   @param    aStatus           New hotmark status.
+        */
+        void UpdateTopicHotmarkStatusL( 
+            TCbsDbTopicNumber aNumber, 
+            TBool aStatus );
+
+        /**
+        *   Deletes an existing topic and all its messages.
+        *
+        *   @param    aNumber           Number of the topic to be deleted.
+        */
+        void DeleteTopicL( TCbsDbTopicNumber aNumber );
+
+        /**
+        *   Gets the total amount of unread messages.
+        *
+        *   @param  aCount              Returns: number of unread topics. 
+        */
+        void GetUnreadMessageCount( TInt& aCount ) const;
+
+        /**
+        *   Returns the handle to the latest hotmarked message. 
+        *   
+        *   The method leaves if there is no such message.
+        *
+        *   @param  aMessage            Returns: Handle to a message that has         
+        *                               been  received under a hotmarked topic
+        */
+        void GetHotmarkedMessageHandleL( TCbsDbMessageHandle& aMessage );
+
+        /**
+        *   Adds a topic list observer. 
+        *   
+        *   After an observer is added to the topic list, it will be notified 
+        *   whenever an event occurs.
+        *
+        *   @param  aObserver           New observer for the list.
+        */
+        void AddObserverL( MCbsDbTopicListObserver* aObserver );
+
+        /**
+        *   Removes a topic list observer. 
+        *   
+        *   If aObserver is not in the list, the method will panic.
+        *
+        *   @param  aObserver           Pointer to the observer to be removed.
+        */
+        void RemoveObserver( const MCbsDbTopicListObserver* aObserver );
+
+        /**
+        *   Adds numbers of subscribed topics to the given array.
+        *
+        *   @param aSubscriptions       Dynamic array into which the topic
+        *                               numbers are inserted.
+        */
+        void AppendSubscribedTopicsL( CArrayFixFlat< TUint16 >& aSubscriptions )
+            const;
+
+        /**
+        *   Reverts all changes made to three datafiles handled by this
+        *   class.
+        */
+        void RevertFilesL();
+
+        /**
+        *   Commits all changes made to three datafiles handled by this
+        *   class.
+        */
+        void CommitFilesL();
+
+        /**
+        *   Returns the number of the topic that was added last
+        *   to the database by topic detection feature.
+        *
+        *   Result code KErrNotFound indicates that no topic has ever
+        *   been added to the database.
+        *
+        *   @param aNumber              Returns: topic number
+        *   @return                     Result code
+        */
+        TInt GetLatestTopicNumber( TCbsTopicNumber& aNumber ) const;
+
+        /**
+        *   Finds the index of the topic matching the given topic number
+        *   in the topic list.
+        *
+        *   @param aNumber              Topic number
+        *   @return                     Index to the position of topic in 
+        *                               the topic list.
+        */
+        TInt TopicIndexInList( TCbsDbTopicNumber aNumber ) const;
+
+        /**
+        *   Returns the number of unread messages in hotmarked topics.
+        */
+        TInt UnreadHotmarkedMessageCount() const;
+
+        /**
+        *   Retrieves numbers of topics that precede and succeed the topic
+        *   with number aCurrentTopic.
+        *
+        *   @param  aCurrentTopic   Topic number of current topic
+        *   @param  aNextTopic      Topic number of next topic
+        *   @param  aPrevTopic      Topic number of previous topic
+        *   @param  aPosition       Position of topic in the topic list
+        */
+        void GetNextAndPrevTopicNumberL( const TCbsTopicNumber& aCurrentTopic,
+            TCbsTopicNumber& aNextTopic, TCbsTopicNumber& aPrevTopic,
+            TInt& aPosition );
+
+        /**
+        *   Notifies each observer that a new message has arrived to a topic.
+        *
+        *   @param    aHandle                    Handle to the topic.
+        */
+        void NotifyNewMessageArrivedL( const TCbsDbMessageHandle& aHandle );
+
+        /**
+        *   Notifies each observer that a topic has been modified.
+        *
+        *   @param    aNumber                    Topic number
+        */
+        void NotifyTopicModifiedL( TCbsDbTopicNumber aNumber );
+
+        /**
+        *   Loads the topic stream to the memory.
+        *
+        */
+        void LoadDefaultTopicStreamL();
+
+    private:                
+
+        /**
+        *   Constructor.
+        *
+        *   @param aFs                  Open file server session.
+        *   @param aDatabase            Reference to database object
+        */
+        CCbsDbImpTopicList( RFs& aFs, CCbsDbImp& aDatabase );
+
+        /**
+        *   Returns the total amount of topics the list contains.
+        *
+        *   @return                     The total amount of topics in the list.
+        */
+        TInt TopicCount() const;
+
+		/**
+        *   Returns the total amount of topic lists.
+        *
+        *   @return                     The total amount of topic lists.
+        */
+        TInt TopicListCount() const;
+
+        /**    
+        *   Finalizes the construction.
+        *
+        *   @param aTopicFile           File name of the topic file
+        *   @param aUnsavedMessagesFile File name of the unsaved messages file.
+        */
+        void ConstructL( const TDesC& aTopicsFile, 
+            const TDesC& aUnsavedMessagesFile );
+
+        /**
+        *   Loads the root stream to the memory.
+        *
+        *   Root stream contains stream ids for each topic list and the total
+        *   count of topic lists.        
+        */
+        void LoadRootStreamL();
+
+        /**
+        *   Reloads the root stream to the memory.
+        */
+        void ReloadRootStreamL();
+       
+		/**
+        *   Reads all information on topic list found with stream ID.        
+        *
+        *   @param aId                  Stream id to the topic information
+        *   @param aTopicList           Returns: topic list information
+        */
+		void ReadTopicListInformationL(const TStreamId& aId, 
+			TCbsDbImpTopicList& aTopicList ) const;
+
+        /**
+        *   Reads all information on topic found in stream aId
+        *   into aTopic.
+        *
+        *   This function is called when details of a topic are needed.
+        *
+        *   @param aId                  Stream id to the topic information
+        *   @param aTopic               Returns: topic information.
+        */
+        void ReadTopicInformationL( const TStreamId& aId, TCbsDbImpTopic& aTopic ) const;
+
+        /**
+        *   Adds a topic to the database.
+        *
+        *   @param aTopic               Information on added topic.
+        */
+        void DoAddTopicL( const TCbsDbTopic& aTopic );
+
+        /**
+        *   Updates a topic information.
+        *
+        *   @param aTopic               Contains topic information.
+        *   @param aNeedToChange        Indicates whether or not it is required
+        *                               to change position in the array
+        *   @param aOldPosition         Old position.
+        *   @param aDeleting            Whether the call is due to a deletion.
+        */
+        void DoUpdateTopicL( const TCbsDbTopic& aTopic, 
+            TBool aNeedToChange, TInt aOldPosition, TBool aDeleting );
+
+        /**
+        *   Deletes an existing topic.
+        *
+        *   @param aPosition            Position of the topic to be deleted.
+        */
+        void DoDeleteTopicL( TInt aPosition );
+
+        /**
+        *   Updates a topic list information.
+        *
+        *   @param aTopicList       Contains topic list information.
+        *   @param aDeleting        Info if we are deleting an entry.
+        */
+        void UpdateTopicListStreamL( TCbsDbImpTopicList& aTopicList, 
+            TBool aDeleting );
+
+        /**
+        *   Updates the root stream.
+        *   If required, it will create a new stream.
+        *
+        *   @param aDeleting        Info if we are deleting an entry.
+        */
+        void UpdateRootStreamL( TBool aDeleting );
+
+        /**
+        *   Updates the topic information.
+        *
+        *   @param aTopic               Updated topic information.
+        */
+        void UpdateTopicL( TCbsDbTopicNumber aTopicNumber, 
+            TCbsDbTopic& aTopic );
+
+        /**
+        *   Checks that the topic number is valid. 
+        *
+        *   @param  aNumber             The topic number.
+        *   @return                     Boolean value indicating if number 
+        *                               is ok.
+        */
+        TBool CheckTopicNumber( TCbsDbTopicNumber aNumber ) const;
+
+        /**
+        *   Write the root stream.
+        *
+        *   @param    aOut              The stream to which the data is 
+        *                               written.
+        */
+        void WriteRootStreamL( RWriteStream& aOut ) const;
+
+        /**
+        *   Write the Topic list stream
+        *
+        *   @param    aOut              The stream to which the data is 
+        *                               written.
+        */
+        void WriteTopicListStreamL( RWriteStream& aOut, TCbsDbImpTopicList& aTopicList ) const;
+
+        /**
+        *   Notifies each observer that the topic list has been initialized.
+        */
+        void NotifyTopicListInitializedL();
+
+        /**
+        *   Notifies each observer that a topic has been added.
+        *
+        *   @param    aNumber                    Topic number
+        */
+        void NotifyTopicAddedL( TCbsDbTopicNumber aNumber );
+
+        /**
+        *   Notifies each observer that a topic has been deleted.
+        *
+        *   @param    aNumber                    Topic number
+        */
+        void NotifyTopicDeletedL( TCbsDbTopicNumber aNumber );
+
+        /**
+        *   Sets the hotmarked message handle.
+        *
+        *   @param    aMessageHandle             Handle to the message.
+        */
+        void SetHotmarkedMessage( const TCbsDbMessageHandle& aMessageHandle );
+
+        /**
+        *   Creates a default root stream.
+        *
+        *   The method may leave, if the creation or writing fails.
+        *
+        *   @param    aStore            The stream to to which the root
+        *                               stream is written.
+        *   @return                     Returns the stream identifier to 
+        *                               that created stream.
+        */
+        TStreamId CreateDefaultRootStreamL( CStreamStore& aStore ) const;
+
+        /**
+        *   Writes topic information to the stream.
+        *
+        *   @param    aOutstream        The stream to which the data is written.
+        *   @param    aTopic            Topic information.
+        *   @param    aTopicMessagesId  The stream identifier to the 
+        *                               topic messages.
+        */
+        void WriteTopicInformationL( RWriteStream& aOutstream, 
+            const TCbsDbTopic& aTopic, const TStreamId& aTopicMessagesId ) const;
+
+        /**
+        *   Extracts topic information (name, number, subscription and
+        *   hotmark status) from a factory defaults topics line
+        *   and adds that topic to the topic list.
+        *
+        *   @param aLine                Factory defaults line.
+        */
+        void AddDefaultTopicL( const TDesC& aLine );
+
+        /**
+        *   After a call to this function, the file stores can be assumed
+        *   to be open and initialized.
+        *
+        *   @param aDeleteExistingFiles     A flag whether to recreate and 
+        *                                   initialize the files or not
+        *   @param  aCreateNewTopicList     ETrue, if the first topic list
+        *                                   needs to be created
+        */
+        void OpenFilesL( TBool aDeleteExistingFiles, TBool aCreateNewTopicList );
+
+        /**
+        *   Creates CBS files, if appropriate.
+        *
+        *   @param  aUnsavedMsgFileExisted  Returns ETrue if unsaved messages
+        *                                   file already existed.
+        */
+        void CreateFilesIfNecessaryL( TBool& aUnsavedMsgFileExisted );
+
+        /**
+        *   Tries to open topic and unsaved messages files.
+        *
+        *   @param  aDeleteUnsavedMsgStreamIds  ETrue, if unsaved msg file 
+        *                                       has been deleted
+        *   @param  aCreateNewTopicList         ETrue, if the first topic list
+        *                                       needs to be created
+        */
+        void TryToOpenFilesL( TBool aDeleteUnsavedMsgStreamIds, TBool aCreateNewTopicList );
+
+        /**
+        *   Adds index topic to topic list.
+        */
+        void AddIndexTopicL();
+
+        /**
+        *   Creates an empty file store with the given filename.
+        *
+        *   @param aFilename            Filename to be created.
+        */
+        void DoCreateStoreL( const TDesC& aFilename );
+
+        /**
+        *   Deletes the unsaved messages' store and rebuilds it.
+        */
+        void RebuildUnsavedMessageStoreL();
+
+        /**
+        *   Deletes the topics' and unsaved messages' store and rebuilds them.
+        */
+        void RebuildTopicAndUnsavedStoresL();
+
+        /**
+        *  Called to repair the database when Unsaved messages -file
+        *  has been deleted, but Topics-file still contains information
+        *  on unsaved messages.
+        * 
+        *  Things that are done here: 
+        *       - Reset unread message counters, because a saved message
+        *         is always also read.
+        *       - Remove stream ids to unsaved messages from 
+        *         Topic messages -streams.
+        */
+        void HandleDeletionOfUnsavedMessagesFileL();
+
+        /**
+        *   Called by HandleDeletionOfUnsavedMessagesFileL().
+        *   Executes the necessary file operations.
+        */
+        void DoHandleDeletionOfUnsavedMessagesFileL();
+
+        /**
+        *   Replaces the given Topic message -stream with a stream which
+        *   contains all ids of saved messages but no ids of unsaved messages.
+        *
+        *   @param  aMsgStreamId        Topic messages -stream id
+        */
+        void DeleteUnsavedMessageStreamIdsL( const TStreamId& aMsgStreamId ) const;
+
+        /**
+        *   Resolves the topic position in topic list and uses this information
+        *   to call DoUpdateTopicL. Changes to stores are NOT commited.
+        *   Call to DoUpdateTopicL is not trapped.
+        *
+        *   @param  aTopic              Topic to be written into stream.
+        *   @param  aDeleting           Whether the call is due to a deletion.
+        */
+        void UpdateTopicCountersL( const TCbsDbTopic& aTopic,
+            const TBool aDeleting );
+
+        /**
+        *   Creates a standard topic list, which has it's topics and other settings
+        *   stored in Shared Data.
+        *
+        */
+        void CreateStandardTopicListL();
+
+        /**
+        *   Load the topic IDs belonging to a specified topic list
+        *
+        *   @param aTopicListStreamId   Stream ID of the topic list
+        */
+        void LoadTopicsIdsL( const TStreamId& aTopicListStreamId );
+
+        /**
+        *   Load the topics specified by the topic list stream ID
+        *
+        *   @param aTopicListStreamId   Stream ID of the topic list
+        */
+        void LoadTopicsL( const TStreamId& aTopicListStreamId );
+
+        /**
+        *   Updates the topic stream IDs in topic lists
+        *   
+        *   @param  aTopicNumber    The topic number
+        */
+        void UpdateTopicStreamIdsL( const TCbsDbTopicNumber aTopicNumber );
+
+    private:    // Data
+
+        // Ref: Database
+        CCbsDbImp& iDatabase;
+
+        // Ref: Topic messages manager.
+        CCbsDbImpTopicMessages* iMessages;
+        
+        // Session to the file server.
+        RFs& iFs;
+        
+        // Own: Store which contains topics.
+        CFileStore* iTopicStore;
+
+		// Own: Store which contains unsaved messages.
+        CFileStore* iUnsavedMessageStore;
+
+        // The last time iTopicStore and iUnsavedMessageStore were compacted
+        TTime iPreviousCompact;
+
+        // Current topic list in use
+        TCbsDbImpTopicList iCurrentTopicList;
+
+        // Own: Cached topic information.
+        CArrayFixFlat< TCbsDbImpTopic >* iTopics;
+
+        // Own: Registered topic list observers.
+        CArrayFixFlat< MCbsDbTopicListObserver* >* iObservers;
+
+        // Last topic added to topic list with topic detection.
+        TCbsTopicNumber iLastTopicNumber;
+
+        // Indicates whether there is a hotmarked message
+        TBool iIsHotmarkedMessage;
+
+        // Handle to the hotmarked message.
+        TCbsDbMessageHandle iMessageHandle;
+
+        // Own: Buffer containing the filename of topics file
+        HBufC* iTopicsFilename;
+
+        // Own: Buffer containing the filename of unsaved messages file
+        HBufC* iUnsavedMessagesFilename;
+
+        // Own: Cached topic list information.
+        CArrayFixFlat< TCbsDbImpTopicList >* iTopicLists;
+
+        // Own: Cached topic IDs
+        CArrayFixFlat< TStreamId >* iTopicIds;               
+
+        // Global topic count
+        TInt iTopicCount;
+
+        // Are we initializing Standard Topic list
+        TBool iInitializing; 
+
+        // Are we deleting all topics from current topic list
+        TBool iDeleteAllTopics;
+        
+        // Local variation bits
+        TInt iLVBits;
+
+        __DECLARE_TEST;
+    };
+
+#endif      // CCBSDBIMPTOPICLIST_H
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CCbsDbImpTopicMessages.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,576 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsDbImpTopicMessages class.
+*    
+*                This class represents the topic messages stored in the database.
+*
+*/
+
+
+
+#ifndef CCBSDBIMPTOPICMESSAGES_H
+#define CCBSDBIMPTOPICMESSAGES_H
+
+// INCLUDES
+#include <e32std.h>
+#include <s32file.h>
+#include "CbsCommon.h"
+
+// FORWARD DECLARATIONS
+class CCbsDbImp;
+class CCbsDbImpTopicList;
+class CCbsRecEtel;
+
+//  CLASS DECLARATION 
+
+/**
+*   CCbsDbImpTopicMessages represents CB messages stored in persistent memory.
+*   CBS server has two files to accommodate messages: one for unsaved 
+*   and one for saved messages. "Topic messages"-stream contains information
+*   on whether a message is saved or not, and what is message's stream id.
+*   CCbsDbImpTopicMessages determines the correct data file depending on
+*   message's save status.
+*
+*   Changes are written to stores immediately after operations. Message cache
+*   iMessageList contains header information of all messages in a single topic
+*   at once. A call to LoadCacheL() is thus made prior to any operation to
+*   make sure that the appropriate topic is being used.
+*/
+class CCbsDbImpTopicMessages : public CBase
+    {
+    public:        // New functions
+        /**
+        *   Creates an instance of the class.
+        *
+        *   @param  aTopicList          Topic list database manager
+        *   @param  aFs                 File server session
+        *   @return                     Pointer to the created instance
+        */
+        static CCbsDbImpTopicMessages* NewL( CCbsDbImpTopicList& aTopicList,
+            RFs& aFs );
+
+        /**
+        *   Destructor.
+        */
+        ~CCbsDbImpTopicMessages();
+
+    public:
+        /**
+        *   Invalidates the cache.
+        */
+        void InvalidateCache();
+
+        /**
+        *   Invalidates the cache if the cache contains messages of the topic.
+        *
+        *   @param aNumber              Number of the topic that is 
+        *                               invalidated.
+        */
+        void InvalidateCacheIfTopic( const TCbsDbTopicNumber& aNumber );
+
+        /**
+        *   Creates a default topic messages stream.
+        *
+        *   @param  aStore              Store to which the stream is created.
+        *   @return                     Stream identifier to the created stream
+        */
+        static TStreamId CreateDefaultTopicMessagesStreamL( 
+            CStreamStore& aStore );
+
+        /**
+        *   Delete all topics messages.
+        *
+        *   @param  aSavedStore         Store which contains saved messages.
+        *   @param  aUnsavedStore       Store which contains unsaved messages.
+        *   @param  aIn                 Stream for topic messages.
+        */
+        static void DeleteAllTopicMessagesL( CStreamStore& aSavedStore, 
+            CStreamStore& aUnsavedStore, RReadStream& aIn );
+
+        /**
+        *   Determines whether or not there are any locked messages in 
+        *   the topic.
+        *
+        *   @param  aNumber             Number of the topic.
+        *   @return                     Boolean value indicating if there are 
+        *                               locked messages in topic.
+        */
+        TBool IsLockedMessagesInTopic( const TCbsDbTopicNumber& aNumber ) 
+            const;
+
+        /**
+        *   Determines whether there is at least one locked message.
+        *
+        *   @return                     ETrue, if there's at least one locked
+        *                               message.
+        */
+        TBool IsLockedMessages() const;
+
+        /**
+        *   Returns the total amount of messages the topic contains.
+        *
+        *   @param aNumber              Number of the topic.
+        *   @param aCount               Returns: number of messages in given
+        *                               topic
+        */
+        void GetMessageCountL( const TCbsDbTopicNumber& aNumber, 
+            TInt& aCount );
+
+        /**
+        *   Returns message information.
+        *
+        *   @param aNumber              Number of the topic.
+        *   @param aIndex               Index to the message in topic.
+        *   @param aMessage             Returns: message information.
+        */
+        void GetMessageL( const TCbsDbTopicNumber& aNumber, 
+            TInt aIndex, TCbsDbMessage& aMessage );
+
+        /**
+        *   Finds the message for given handle and returns it.
+        *
+        *   @param aHandle              Handle to the message.
+        *   @param aMessage             Returns: message information.
+        */
+        void FindMessageByHandleL( const TCbsDbMessageHandle& aHandle, 
+            TCbsDbMessage& aMessage );
+
+        /**
+        *   Finds the message by message key.
+        *
+        *   @param  aNumber             Number of the topic.
+        *   @param  aKey                Message key to be looked for.
+        *   @return                     Handle to the message, or KErrNotFound if no 
+        *                               such message was found.
+        */
+        TInt FindMessageByKeyL( TCbsDbTopicNumber aNumber, 
+            TCbsDbMessageKey aKey,
+            TCbsDbMessage& aMessage );
+
+        /**
+        *   Stores the contents of the message to the buffer aContents. 
+        *   If aContents is too small to contain the whole message
+        *   body, the message body is truncated.
+        *
+        *   @param aHandle              Handle to the message.
+        *   @param aContents            Returns: message body
+        *   @param aSize                Number of bytes to read
+        */
+        void GetMessageContentsL( const TCbsDbMessageHandle& aHandle, 
+            TPtr& aContents, TUint aSize );
+
+        /**
+        *   Deletes a message from the topic.
+        *
+        *   @param aHandle      Handle to the message to be deleted.
+        *   @param  aReceiver   Receiver.
+        */
+        void DeleteMessageL( const TCbsDbMessageHandle& aHandle,
+            const CCbsRecEtel& aReceiver );
+        
+        /**
+        *   Creates a new message to the topic.
+        *
+        *   FFS critical level check is made prior to operation.
+        *
+        *   @param aNumber              Number of the topic to which 
+        *                               the message is to be added.
+        *   @param aMessage             Contains the message information 
+        *                               (i.e., header, not body).
+        *   @param aContents            The contents of the message.
+        */
+        void AddMessageL( const TCbsDbTopicNumber& aNumber, 
+            TCbsDbMessage& aMessage, const TPtrC& aContents );
+
+        /**
+        *   Saves the message.
+        *
+        *   FFS critical level check is made prior to the operation.
+        *
+        *   @param aHandle      Handle to the message to be saved.
+        *   @param  aReceiver   Receiver.
+        */
+        void SaveMessageL( const TCbsDbMessageHandle& aHandle,
+            const CCbsRecEtel& aReceiver );
+
+        /**
+        *   Sets the message as read.
+        *
+        *   @param aHandle      Handle to the message to be set read.
+        *   @param  aReceiver   Receiver.
+        */
+        void ReadMessageL( const TCbsDbMessageHandle& aHandle,
+            const CCbsRecEtel& aReceiver );
+
+        /**
+        *   Updates handles of messages in the topic with the number given in
+        *   aOldTopicNumber to match new topic number.
+        *
+        *   @param  aOldTopicNumber     Number of topic to be changed
+        *   @param  aNewTopicNumber     Change handles to match this number
+        */
+        void UpdateHandlesOfTopicMessagesL(
+            const TCbsDbTopicNumber& aOldTopicNumber, 
+            const TCbsDbTopicNumber& aNewTopicNumber );
+
+        /**
+        *   Unlocks one message and then locks another message.
+        *
+        *   Message that is locked can not be removed. Topic that 
+        *   contains a locked message can not be removed.
+        *
+        *   Note that locking status is not persistent in the sense that 
+        *   when the power is switched off and turned on, no messages 
+        *   are automatically locked.
+        *
+        *   @param aUnlock       Handle to the message to be unlocked.
+        *   @param aLock         Handle to the message to be locked.
+        */
+        void LockMessageL( const TCbsDbMessageHandle& aUnlock, 
+            const TCbsDbMessageHandle& aLock );
+
+        /**
+        *   Retrieves handles of messages that precede and succeed the message
+        *   with handle aCurrentMsg.
+        */
+        void GetNextAndPrevMsgHandleL(
+            const TCbsDbMessageHandle& aCurrentMsg,
+            TCbsDbMessageHandle& aNextMsg, 
+            TCbsDbMessageHandle& aPrevMsg, 
+            TInt& aPosition);
+    
+        /**
+        *   Finds message position by message handle.
+        *
+        *   The method leaves in case the message is not found.
+        *
+        *   @param  aHandle             Handle to the message to be looked for.
+        *   @return                     The position of the message.
+        */
+        TInt FindMessagePositionByHandleL( 
+            const TCbsDbMessageHandle& aMessage );        
+
+    private:
+
+        // The structure that represents the topic messages cache item.
+        struct TCbsDbImpTopicMessagesCacheItem
+            {   
+            // The stream identifier for the message information.
+            TStreamId iId;
+
+            // Whether this message is saved or not
+            TBool iIsSaved;
+
+            // Indicates whether iMessage and iContentsId are valid.
+            TBool iIsMessage;
+
+            // Message header - valid only if iIsMessage is true.
+            TCbsDbMessage iMessage;
+
+            // Stream identifier for message body-valid if iIsMessage is ETrue
+            TStreamId iContentsId;
+            };
+
+        typedef CArrayFixFlat< TCbsDbImpTopicMessagesCacheItem > 
+            TCbsDbImpTopicMessagesCache;
+
+        /**
+        *   Constructor.
+        *
+        *   @param aTopicList           Topic list database object
+        *   @param aFs                  File server session
+        */
+        CCbsDbImpTopicMessages( CCbsDbImpTopicList& aTopicList, RFs& aFs );
+
+        /**
+        *   Finalizes the construction.
+        */
+        void ConstructL();
+
+        /**
+        *   Adds a message.
+        *
+        *   @param aMessage             Contains the message information.
+        *   @param aContents            Contains the message contents.
+        */
+        void DoAddMessageL( TCbsDbMessage& aMessage, const TDesC& aContents );
+
+        /**
+        *   Deletes a message.
+        *
+        *   @param aPosition            Position in the internal array where 
+        *                               the message is.
+        */
+        void DoDeleteMessageL( TInt aPosition );
+
+        /**
+        *   Updates message information.
+        *
+        *   @param aId                  Stream id to which the information is
+        *                               written.
+        *   @param aMessage             Contains the message information.
+        *   @param aContentsId          Contains the contents id.
+        */
+        void DoUpdateMessageL( const TStreamId& aId, 
+            const TCbsDbMessage& aMessage, const TStreamId& aContentsId ) const;
+
+        /**
+        *   Sets the message read.
+        *
+        *   @param  aId                 Stream id to which the information is 
+        *                               written.
+        *   @param  aMessage            Contains the message information.
+        *   @param  aContentsId         Stream idenfitier to the contents.
+        */
+        void DoReadMessageL( const TStreamId& aId, const TCbsDbMessage& aMessage, 
+            const TStreamId& aContentsId );
+
+        /**
+        *   Deletes messages that are not supposed to be in the topic.
+        *
+        *   Because of message locking it is possible that there are more 
+        *   received messages than there should be. This method tries to 
+        *   delete this kind of message.
+        */
+        void DoDeleteL();
+
+        /**
+        *   Loads the cache, if it is not already loaded with this topic 
+        *   information.
+        *
+        *   The method does not load any message information to the cache 
+        *   - only what is really necessary.
+        *
+        *   @param aNumber              Number of the topic to be loaded 
+        *                               to the cache.
+        */
+        void LoadCacheL( const TCbsDbTopicNumber& aNumber );
+
+        /**
+        *   Loads the message header to the cache.
+        *
+        *   Note that it is assumed that the index is in proper range! 
+        *   And the cache is already loaded!
+        *
+        *   @param aIndex               The index to the message in cache.
+        *   @param aMessage             Returns: message information.
+        */
+        void LoadMessageL( TInt aIndex, TCbsDbMessage& aMessage );
+
+        /**
+        *   Loads message contents (as much as it fits).
+        *
+        *   Save status of message is required because saved and unsaved
+        *   messages are stored on separate files.
+        *
+        *   @param aContentsId          Stream identifier to the content.
+        *   @param aContents            Returns: message body.
+        *   @param aIsSaved             ETrue, if the message is saved.
+		*	@param aSize				Size of the message.
+        */
+        void LoadMessageContentsL( const TStreamId& aContentsId, TPtr& aContents, 
+            TBool aIsSaved, TUint aSize ) const;
+
+        /**
+        *   Generates a new message handle.
+        *
+        *   @param  aNumber             Number of the topic which will contain 
+        *                               the message.
+        *   @return                     Returns the new message handle.
+        */
+        TCbsDbMessageHandle GenerateNewMessageHandle( 
+            const TCbsDbTopicNumber& aNumber );
+
+        /**
+        *   Checks that if there are too many received messages in 
+        *   the internal cache, then they will be deleted if they
+        *   are not locked.
+        *
+        *   @return                     Boolean value indicating if some 
+        *                               changes was made.
+        */
+        TBool DeleteReceivedIfNecessaryL();
+
+        /**
+        *   Deletes message by its position in the internal cache.
+        *
+        *   Note that after the call the internal cache won't contain 
+        *   the item.
+        *
+        *   @param aPosition            The position to the message.
+        */
+        void DeleteMessageByPositionL( TInt index );
+
+        /**
+        *   Determines whether or not the message is locked.
+        *
+        *   @param  aHandle             The handle to the message.
+        *   @return                     Boolean value indicating if 
+        *                               the message is locked.
+        */
+        TBool IsMessageLocked( const TCbsDbMessageHandle& aHandle ) const;
+
+        /**
+        *   Deletes from the locked messages.
+        *
+        *   @param aHandle              Message to be unlocked.
+        */
+        void DeleteFromLocked( const TCbsDbMessageHandle& aHandle );
+
+        /**
+        *   Adds a handle to the locked messages.
+        *
+        *   @param aHandle              Message to be locked.
+        */
+        void InsertToLockedL( const TCbsDbMessageHandle& aHandle );
+
+        /**
+        *   Updates topic messages stream from the internal cache.
+        *
+        *   @param aDeleting            Whether the call is due to a deletion.
+        */
+        void UpdateTopicMessagesStreamL( TBool aDeleting );
+
+        /**
+        *   Writes topic messages stream from the internal cache.
+        *
+        *   @param aOut                 Stream to which data is written.
+        */
+        void WriteTopicMessagesStreamL( RWriteStream& aOut );
+
+        /**
+        *   Saves the message.
+        *
+        *   @param aMessage             The message to be saved.
+        *   @param aItem                The cache item to the previous instance of the
+        *                               message.
+        *   @param aContentPtr          The contents of the message.
+        *   @param aPosition            The position of the message in the cache.
+        */
+        void DoSaveMessageL( 
+            TCbsDbMessage& aMessage,
+            const TCbsDbImpTopicMessagesCacheItem& aItem,
+            const TDesC& aContentPtr,
+            TInt aPosition );
+
+        /**
+        *   Reverts any not commited file operation in data files,
+        *   reloads cache and then leaves with aReason.
+        *
+        *   @param  aReason             Leave code
+        */
+        void RevertFileOperationL( TInt aReason );
+
+        /**
+        *   Creates a new message content stream.
+        *
+        *   @param aStore               Store to which the stream is created.
+        *   @param aContents            Message content.
+        */
+        static TStreamId CreateMessageContentsStreamL( CStreamStore& aStore,
+            const TDesC& aContents );
+        
+        /**
+        *   Creates a new message stream.
+        *
+        *   @param aStore               Store to which the stream is created.
+        *   @param aMessage             Message information.
+        *   @param aContents            Stream identifier to the contents.
+        */
+        static TStreamId CreateMessageStreamL( CStreamStore& aStore, 
+            TCbsDbMessage& aMessage, const TStreamId& aContents );
+
+        /**
+        *   Reads all cache items for a topic.
+        *
+        *   @param aStore               Reference to the store.
+        *   @param aId                  Stream id to the topic messages stream.
+        *   @param aCache               Empty cache where it is supposed that 
+        *                               these messages are put.
+        *   @param aSpace               Contain the amount of space for 
+        *                               messages.
+        */
+        static void ReadTopicMessagesCacheItemsL( const CStreamStore& aStore, 
+            const TStreamId& aId, 
+            TCbsDbImpTopicMessagesCache& aCache, 
+            TInt& aSpace );
+
+        /**
+        *   Reads necessary message information from the store.
+        *
+        *   @param aStore               Store that contains the information.
+        *   @param aId                  Stream identifier to the message 
+        *                               stream.
+        *   @param aMessage             Contain message information.
+        *   @param aContentsId          Contain the stream identifier to 
+        *                               the contents.
+        */
+        static void ReadMessageInformationL( 
+            const CStreamStore& aStore, 
+            const TStreamId& aId, 
+            TCbsDbMessage& aMessage, 
+            TStreamId& aContentsId );
+
+        /**
+        *   Writes message information to the store.
+        *
+        *   @param aOut                 Stream to which data is written.
+        *   @param aMessage             Contains the message information to be
+        *                               written.
+        *   @param aContentsId          Stream identifier to the contents.
+        */
+        static void WriteMessageInformationL( RWriteStream& aOut, 
+            const TCbsDbMessage& aMessage, const TStreamId& aContentsId );
+
+        /**
+        *   Updates the soft notification (dialog) when unread message
+        *   count changes.
+        *
+        *   @param aHandle      Handle to the message to be set as read
+        *   @param  aReceiver   Receiver.
+        */            
+        void UpdateSoftNotificationL( const TCbsDbMessageHandle& aHandle,
+           const CCbsRecEtel& aReceiver );
+
+    private:
+
+        // Topic list manager.
+        CCbsDbImpTopicList& iTopicList;
+
+        // Indicates whether the cache is valid or not.
+        TBool iCacheValid;
+
+        // If cache is valid, then it contains the topic handle of the 
+        // cached topic.        
+        TCbsDbTopicNumber iCachedTopicNumber;
+
+        // If cache is valid, then it tells how many messages the stream 
+        // can hold.        
+        TInt iSpaceForMessages;
+       
+        // Own: If cache is valid, it contains some information of the 
+        // topic messages for fast access.        
+        TCbsDbImpTopicMessagesCache* iMessageList;
+
+        // Own: handles of the locked messages.
+        CArrayFixFlat< TCbsDbMessageHandle >* iLockedMessages;
+
+        // Reference to a file server session of CCbsDbImp
+        RFs& iFs;
+
+    };
+
+#endif      //  CCBSDBIMPTOPICMESSAGES_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CCbsDiskSpaceMonitor.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,97 @@
+/*
+* 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:  This file contains the header file of the CCbsDiskSpaceMonitor class
+*    
+*
+*/
+
+
+#ifndef     CCBSDISKSPACEMONITOR_H
+#define     CCBSDISKSPACEMONITOR_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CCbsDbImp;
+
+//  CLASS DECLARATION 
+
+/**
+*  The CCbsDiskSpaceMonitor instance listens to 
+*  shutdown signal via Publish and Subscribe. On device shutdown,
+*  the listener stops server operation by stopping the active scheduler.
+*  CbsServer will then be terminated. 
+*/
+class CCbsDiskSpaceMonitor : public CActive
+    {
+    public:     // New functions
+
+        /**
+        *   Creates an instance of the class.
+        *
+        *   @param  aDbImp      DB reference
+        *   @return             A new instance of CCbsDiskSpaceMonitor
+        */
+        static CCbsDiskSpaceMonitor* NewL( CCbsDbImp& aDbImp );
+
+        /**
+        *   Destructor.
+        */
+        ~CCbsDiskSpaceMonitor();
+
+        /** 
+        *   Reissues the Subscribe request.
+        */
+        void IssueRequest();
+
+    private:    // From CActive
+
+        /**
+        *   Gets called when the system state changes.
+        */
+        void RunL();
+
+        /**
+        *   Cancels an outstanding Subscribe request.
+        */
+        void DoCancel();
+
+    private:
+
+        /**
+        *   The constructor.
+        *
+        */
+        CCbsDiskSpaceMonitor( CCbsDbImp& aServer );
+
+        /**
+        *   Finalizes the construction.
+        */
+        void ConstructL();
+      
+    private:    // Data
+        
+        // PubSub connection
+        RProperty iProperty;
+        
+        // DB reference
+        CCbsDbImp& iDbImp;
+    };
+
+#endif      //  CCBSSHUTDOWNMONITOR_H   
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CCbsEtelMessaging.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,133 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsEtelMessaging class.
+*    
+*                CCbsEtelMessaging is a wrapper to RMobileBroadcastMessaging used 
+*                in network builds.
+*
+*/
+
+
+
+#ifndef CCBSETELMESSAGING_H
+#define CCBSETELMESSAGING_H
+
+// INCLUDES
+		/*****************************************************
+		*	Series 60 Customer / ETel
+		*	Series 60  ETel API
+		*****************************************************/
+#include <etelmm.h>            
+
+#include <e32base.h>
+#include "MCbsEtelMessaging.h"
+
+//  CLASS DECLARATION 
+
+/**
+*   CCbsEtelMessaging acts as a wrapper to RMobileBroadcastMessaging instance.
+*
+*/
+class CCbsEtelMessaging : public CBase, public MCbsEtelMessaging
+    {
+    public:
+
+        /**
+        *   Creates and returns a new instance of CCbsEtelMessaging.
+        *
+        *   @return Instance of CCbsEtelMessaging.
+        */
+        static CCbsEtelMessaging* NewL();
+
+        /**
+        *   Destructor.
+        */
+        virtual ~CCbsEtelMessaging();
+
+    public:     // MCbsEtelMessaging
+
+        /**
+        *   Opens an emulated ETel messaging session.
+        *
+        *   @param  aPhone RMobilePhone-session
+        */
+        TInt Open( RMobilePhone& aPhone );
+
+        /**
+        *   Closes ETel messaging session.
+        */
+        void Close();
+
+        /**
+        *   Requests forwarding of the next received CB message.
+        *
+        *   @param  aReqStatus          Client request status
+        *   @param  aMsgData            CBS message data descriptor
+		*	@param	aMsgAttributes		CBS message attributes
+        */
+        void ReceiveMessage( TRequestStatus& aReqStatus, TDes8& aMsgData, 
+            TDes8& aMsgAttributes );
+        
+        /**
+        *   Cancels an outstanding ReceiveMessage() request.
+        */
+        void ReceiveMessageCancel();
+
+        /**
+        *   Sets CBS receive mode (filter setting).
+        *
+        *   @param  aReqStatus          Returns: status of async operation
+        *	@param	aSetting			The new filter setting to be set to ETel
+        */
+        void SetFilterSetting( TRequestStatus& aReqStatus, 
+            RMobileBroadcastMessaging::TMobilePhoneBroadcastFilter aSetting ) const;
+
+        /**
+        *   Cancels an outstanding SetFilterSetting() request.
+        *
+        */
+        void SetFilterSettingCancel();
+
+        /**
+        *   Retrieves the current CBS receive mode (filter setting).
+        *
+        *   @param  aSetting			The setting to beffiled by ETel
+        *   @return                     Result code
+        */
+        TInt GetFilterSetting( 
+			RMobileBroadcastMessaging::TMobilePhoneBroadcastFilter& aSetting );        
+
+    private: // Private methods
+
+        /**
+        *   Constructor.
+        */
+        CCbsEtelMessaging();
+
+        /**
+        *   Finalizes the construction.
+        */
+        void ConstructL();
+
+    private: // Data
+
+        // ETel messaging session to which calls to this class are forwarded.
+        RMobileBroadcastMessaging iMessaging;
+    };
+
+#endif      //  CCBSETELMESSAGING_H
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CCbsLivecastHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,84 @@
+/*
+* 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:  Definition of CCbsLivecasetHandler class.
+*
+*/
+
+
+#ifndef     CCBSLIVECASTHANDLER_H
+#define     CCBSLIVECASTHANDLER_H
+
+//  INCLUDES
+
+#include <e32base.h>
+#include "CCbsMessage.h"
+
+//  FORWARD DECLARATIONS
+class CCbsRecEtel;
+
+//  CLASS DECLARATION 
+
+/**
+*   CCbsLivecastHandler constructs CB messages based on a page
+*   received through ETel.
+*
+*   The selection between GSM and WCDMA messages is made when
+*   constructing the message.
+*/
+class CCbsLivecastHandler : public CBase
+    {
+    public:     // New functions        
+
+        /**
+        *   Constructs a new CCbsLivecastHandler 
+        *   
+        *   @param      aRecEtel        CCbsRecEtel reference
+        *   @return                     A new instance of CCbsLivecastHandler
+        */
+        static CCbsLivecastHandler* NewL( CCbsRecEtel& aRecEtel );
+
+        /**
+        *   Destructor
+        */
+        ~CCbsLivecastHandler();
+
+        /**
+        *   Processes Livecast messages
+        */
+        void HandleLivecastMessageL( CCbsMessage* aLivecastMessage );
+        
+    private:
+
+        /**
+        *   Default constructor               
+        */  
+        CCbsLivecastHandler( CCbsRecEtel& aRecEtel );
+
+        /**
+        *   2nd-phase constructor               
+        */
+        void ConstructL();
+
+    private: // Data
+
+        // CCbsRecEtel instance to which CB messages are passed.
+        CCbsRecEtel& iRecEtel;
+
+    };
+
+#endif      //  CCBSLIVECASTHANDLER_H   
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CCbsMcnSession.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,191 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsMcnSession class which 
+*                responds to client MCN-related requests.
+*
+*/
+
+
+
+
+#ifndef     CCBSMCNSESSION_H
+#define     CCBSMCNSESSION_H
+
+//  INCLUDES
+
+#include <e32base.h>
+#include "CCbsObject.h"
+#include "MCbsMcnSubscriptionsProvider.h"
+#include <cbsmcncommon.h>
+
+//  FORWARD DECLARATIONS
+
+class CCbsDbImpSettings;
+class CCbsRecEtel;
+class CCbsReceiverHelper;
+class CCbsRecMessage;
+class CCbsSession;
+
+//  CLASS DECLARATION 
+
+/**
+*   CCbsMcnSession is the server-side subsession object, which takes care
+*   of client-side MCN requests.
+*/
+class CCbsMcnSession 
+        : public CCbsObject, public MCbsMcnSubscriptionsProvider
+    {
+    public:     // New functions
+        /**
+        *   Creates a new instance of the class.
+        *
+        *   @param  aSession            Main session instance.
+        *   @param  aReceiver           Receiver instance.
+        *   @return                     New instance of CCbsMcnSession.
+        */
+        static CCbsMcnSession* NewL( CCbsSession& aSession, 
+            CCbsRecEtel& aReceiver );
+
+        /**
+        *   Destructor.
+        */
+        ~CCbsMcnSession();
+
+    public:     // From CCbsObject
+        /**
+        *   Handle the requests for the object.
+        *
+        *   @param  aMessage            Message to be handled.
+        *   @return                     Indicates whether the message was 
+        *                               handled.
+        */
+        TBool HandleRequestsL( const RMessage2& aMessage );
+
+    public:     // From MCbsMcnSubscriptionsProvider
+        /**
+        *   Returns the number of topic subscriptions of this MCN client.
+        *
+        *   @return                     Number of subscribed CB topics
+        */
+        TUint NumberOfSubscriptions() const;
+
+        /**
+        *   If aMessage is of topic subscribed by the client,
+        *   aMessage is copied to client-side. 
+        *
+        *   @param  aMessage            CB message.
+        */
+        void RouteMessageL( const CCbsMessage& aMessage );
+
+    private:
+        /**
+        *   Constructor.
+        *
+        *   @param  aSession            Main session object.
+        *   @param  aReceiver           Receiver instance.
+        */
+        CCbsMcnSession( CCbsSession& aSession, CCbsRecEtel& aReceiver );
+
+        /**
+        *   Finalizes construction.
+        */
+        void ConstructL();
+
+        /**
+        *   Close the subsession.
+        */
+        void CloseMcnSession();
+
+        /**
+        *   Handles client request for message routing.
+        */
+        void NotifyOnChange();
+
+        /**
+        *   Handles client request to cancel an outstanding 
+        *   routing request.
+        */
+        void NotifyOnChangeCancel();
+
+        /**
+        *   Handles client request to subscribe a topic.
+        *
+        *   Note: ApplySubscriptionL has to be called in order to
+        *   apply receiver changes.
+        */
+        void SubscribeTopicL();
+
+        /**
+        *   Called by RouteMessageL() to actually copy the message content
+        *   to client side.
+        *
+        *   @param aMcnPckg         Package containing the MCN message
+        *                           and it's parameters.
+        */        
+        void NotifyClientL( const TPckg<TCbsMcnMessage>& aMcnPckg );                
+
+        /**
+        *   Clears all topic subscriptions of this MCN session.
+        *
+        *   Leaves only if CCbsRecEtel::ApplyStateChangesL() leaves.
+        */
+        void ClearSubscriptionsL();
+
+        /**
+        *   Forces receiver to reload CB topic subscriptions.
+        *
+        *   This function has to be called after MCN client has subscribed
+        *   topics with SubscribeTopicL().
+        */
+        void ApplySubscriptionsL();
+  
+    private:    // Prohibited operators and functions
+
+        // Copy constructor
+        CCbsMcnSession( const CCbsMcnSession& );
+
+        // Assignment operator
+        CCbsMcnSession& operator=( const CCbsMcnSession& );
+
+
+    private:    // Data
+        
+        /// Receiver object.
+        CCbsRecEtel& iReceiver;
+
+        /**
+        *   Indicates whether iMessage is a valid message; that is, there
+        *   is a pending notify request.
+        */
+        TBool iIsMessage;
+
+        /// Message for the pending notify request 
+        RMessage2 iMessage;
+
+        /// Array of topic numbers subscribed by the client.
+        CArrayFixFlat< TUint16 >* iSubscribedTopics;
+
+        // MCN message
+        TCbsMcnMessage iMcnMessage;
+
+        // MCN message package for IPC
+        TPckg<TCbsMcnMessage> iMcnPckg;
+
+    };
+
+#endif      //  CCBSMCNSESSION_H   
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CCbsMessage.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,603 @@
+/*
+* 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:  This file contains the header file of the CCbsMessage class.
+*
+*/
+
+
+
+#ifndef CCBSMESSAGE_H
+#define CCBSMESSAGE_H
+
+//  INCLUDES
+#include <etelmm.h>
+#include "CbsReceiverTypes.h"
+#include "CbsCommon.h"
+#include <cbsmcncommon.h>
+
+//  CONSTANTS  
+// If this constant is set to iPLMN.iMCC, iPLMN does not contain network info
+_LIT( KRecMessageNoNetworkInfo, "-1"  );
+
+/// Defines association element (ISO639-code, language)
+struct TCbsIso639ToLangMapElement
+    {
+    const TLitC< 3 > iCode;
+    const TCbsDbLanguage iLang;
+
+    TCbsIso639ToLangMapElement::TCbsIso639ToLangMapElement( 
+        const TLitC< 3 > aCode, 
+        TCbsDbLanguage aLang )
+        :iCode( aCode ), 
+        iLang( aLang ) { }
+    };
+
+// ISO639 codes defining recognized languages
+_LIT( KIso639Danish, "DA" );
+_LIT( KIso639German, "DE" );
+_LIT( KIso639Greek, "EL" );
+_LIT( KIso639English, "EN" );
+_LIT( KIso639Spanish, "ES" );
+_LIT( KIso639Finnish, "FI" );
+_LIT( KIso639French, "FR" );
+_LIT( KIso639Italian, "IT" );
+_LIT( KIso639Dutch, "NL" );
+_LIT( KIso639Norwegian, "NO" );
+_LIT( KIso639Portuguese, "PT" );
+_LIT( KIso639Swedish, "SV" );
+_LIT( KIso639Turkish, "TR" );
+_LIT( KIso639Hungarian, "HU" );
+_LIT( KIso639Polish, "PL" );
+_LIT( KIso639Czech, "CS" );
+_LIT( KIso639Hebrew, "HE" );
+_LIT( KIso639Arabic, "AR" );
+_LIT( KIso639Russian, "RU" );
+_LIT( KIso639Icelandic, "IS" );
+// Amount of languages that are mapped to ISO639 codes.
+const TInt KNumberOfLanguageMappings = 20;
+
+// CB message header size in bytes.
+const TInt KHeaderLength = 6;
+
+// Offset in CB message to index header in characters. 
+const TInt KIndexHeaderPosition = 0;
+
+// Index header length in characters (e.g., "EI1<cr><lf>")
+const TInt KIndexHeaderLength = 5;              // including trailing <cr><lf>
+
+// Offset to language indication, if applicable
+const TInt KLanguageIndicationPosition = 0;
+
+// Fixed length of language indication preceding message body
+const TInt KLanguageIndicationLength = 3;
+
+// Fixed length of language indication without trailing CR.
+const TInt KLanguageIndicationLengthWithoutCR = 2;
+
+// Geographical scope of CB message: cell wide / immediate display
+const TInt KGeographicalScopeCellImmediate = 0x00;
+
+// Geographical scope of CB message: operator wide / normal display
+const TInt KGeographicalScopePLMNNormal = 0x01;
+
+// Geographical scope of CB message: location area wide / normal display
+const TInt KGeographicalScopeLACNormal = 0x02;
+
+// Geographical scope of CB message: cell wide / normal display
+const TInt KGeographicalScopeCellNormal = 0x03;
+
+// Message code of an index message.
+const TUint16 KIndexMessageCode = 0x02AA; // 1010101010b
+
+const TUint8 KPageParameterSingle = 0x11;   // this page: 1, total pages: 1
+
+// ETSI DCS specification
+const TUint8 DCS_MASK_GENERAL_DATA_CODING_INDICATION = 0xcc;
+const TUint8 DCS_MASK_MESSAGE_HANDLING = 0xf4;
+const TUint8 DCS_MASK_LANGUAGE_INDICATION_PRECEDES = 0xff;
+const TUint8 DCS_GDCI_8BIT = 0x44;
+const TUint8 DCS_GDCI_UCS2 = 0x48;
+const TUint8 DCS_DCMH_8BIT = 0xf4;
+const TUint8 DCS_MPLI_UCS2 = 0x11;
+const TUint16 KMessageCodeMask = 0x3FF0;
+const TUint8 DCS_MASK_UDH = 0x9c;
+const TUint8 DCS_UDH_8BIT = 0x94;
+
+const TUint8 DCS_MASK_CLASS0 = 0xd3;
+const TUint8 DCS_CLASS0 = 0x50;
+
+// Message identifier value indicating that the message contains 
+// a base station identity.
+const TUint16 KCbsBaseStationId = 50;       
+
+// Information on Data Coding Scheme values.
+// Refer to ETSI GSM 03.38 for details.
+enum 
+    {
+    // Bits 4-7 0000: Language specified with bits 0-3, default alphabet.
+    ECbsRecLanguageGerman = 0,
+    ECbsRecLanguageEnglish = 1,
+    ECbsRecLanguageItalian = 2,
+    ECbsRecLanguageFrench = 3,
+    ECbsRecLanguageSpanish = 4,
+    ECbsRecLanguageDutch = 5,
+    ECbsRecLanguageSwedish = 6,
+    ECbsRecLanguageDanish = 7,
+    ECbsRecLanguagePortuguese = 8,
+    ECbsRecLanguageFinnish = 9,
+    ECbsRecLanguageNorwegian = 10,
+    ECbsRecLanguageGreek = 11,
+    ECbsRecLanguageTurkish = 12,
+    ECbsRecLanguageHungarian = 13,
+    ECbsRecLanguagePolish = 14,
+    ECbsRecLanguageUnspecified = 15,
+    // Bits 4-7 0001: Message preceded by language indication, 
+    // default or UCS2 alphabet.
+    ECbsRecDCSDefaultMsgPrecededByLanguage = 16,
+    ECbsRecDCSUCS2MsgPrecededByLanguage = 17,
+    // Bits 4-7 0010: Czech language, reservations for European languages
+    // using the default alphabet.
+    ECbsRecLanguageCzech = 32,
+    ECbsRecLanguageHebrew = 33,
+    ECbsRecLanguageArabic = 34,
+    ECbsRecLanguageRussian = 35,
+    ECbsRecLanguageIcelandic = 36,
+    // Bits 4-7 0011: Reserved for European languages using the default
+    // alphabet, with unspecified handling at the MS.
+    // Max value of language enum, this MUST remain as last
+    ECbsRecLanguageMax = 100
+    };
+
+// Message types, GSM, WCDMA, Livecast
+enum TCbsMessageType
+    {
+    ECbsMessageGsm,
+    ECbsMessageWcdma,
+    ECbsMessageLivecast,
+    ECbsMessageTypeUnspecified
+    };
+
+
+//  CLASS DECLARATION 
+
+/**
+*   CCbsMessage is the base class for GSM anf WCDMA message classes.
+*   
+*/
+class CCbsMessage : public CBase
+    {
+    public:
+
+        /**
+        *   Virtual destructor
+        */
+        virtual ~CCbsMessage();
+
+    public:
+        /**
+        *   Returns the type of the message (only in WCDMA)
+        *
+        *   @return                     Type of this message
+        */
+        virtual TInt MessageType() const = 0;        
+
+        /**
+        *   Returns ETrue, if this message is a child subindex message.
+        *
+        *   Child subindex messages have message code 1010101010b and
+        *   message identifier other than 0.
+        *
+        *   @return                     ETrue, if the message is child subindex
+        */
+        virtual TBool IsChildSubindex() const;    
+		
+        /**
+        *   Returns ETrue, if this message is a livecast message.
+        *
+        *
+        *   @return                     ETrue, if the message is livecast message
+        */
+
+		TBool IsLivecastMessage() const;
+
+        /**
+        *   Returns the message code of the message.
+        *
+        *   @return                     Message Code.
+        */
+        TCbsRecMessageCode MessageCode() const;
+
+        /**
+        *   Returns the update number of the message.
+        *
+        *   @return                     Update Number.
+        */
+        TCbsRecUpdateNumber UpdateNumber() const;
+
+        /**
+        *   Returns the alphabet set of this message.
+        *
+        *   Possible values are:
+        *
+        *   ECbsRecAlphabetDefault      7-bit GSM encoding
+        *   ECbsRecAlphabet8bit         8-bit data, unknown encoding
+        *   ECbsRecAlphabetUCS2         16-bit, UCS-2 encoding
+        *   ECbsRecAlphabetUnspecified  Unknown encoding
+        *
+        *   @return                     Alphabet
+        */
+        TCbsRecAlphabet Alphabet() const;
+
+        /**
+        *   Appends another message's content to this message's content.
+        *
+        *   @param aMsg                 Message that is appended 
+        *                               to this msg.
+        */
+        void AppendContent( const TDesC& aMsg );
+
+        /**
+        *   Appends another 8-bit message's content to this message's content.
+        *
+        *   @param aMsg                 Message that is appended 
+        *                               to this msg.
+        */
+        void AppendContent8( const TDesC8& aMsg );
+
+        /**
+        *   Returns identifier of the cell in which the phone was when this
+        *   message was received.
+        *
+        *   @return                     Cell identifier
+        */
+        TUint CellId() const;
+
+        /**
+        *   Returns a pointer descriptor to the Unicode contents of the 
+        *   message.
+        *
+        *   Panics if 16-bit presentation is not prepared.
+        *
+        *   @return                     Pointer descriptor to the contents of 
+        *                               the message.
+        */
+        const TDesC& Contents() const;
+
+        /**
+        *   Returns a pointer descriptor to 8-bit descriptor representation
+        *   of the message body. Panics if 8-bit representation
+        *   is not prepared.
+        *
+        *   @return                     Pointer descriptor to the 8-bit 
+        *                               representation of this message's body.
+        */
+        const TDesC8& Contents8() const;
+
+        /**
+        *   Returns the Data Coding Scheme of this message page.
+        *
+        *   Refer to GSM specification 03.38 for details on DCS.
+        *
+        *   @return                     Data Coding Scheme.
+        */
+        TCbsRecDCS DCS() const;
+
+        /**
+        *   Returns the geographical scope of the message.
+        *
+        *   @return                     Geographical scope.
+        */
+        TCbsRecGeographicalScope GeographicalScope() const;
+
+        /**
+        *   On return, aNetworkId contains identity of the network
+        *   in which the phone was when this message was received.
+        *
+        *   @param aNetworkInfo           Returns: Operator information
+        */
+        void GetPLMN( RMobilePhone::TMobilePhoneNetworkInfoV1& aNetworkInfo ) const;
+
+        /**
+        *   Returns ETrue, if this message is a Class 0 message according
+        *   to ETSI GSM specification 03.38.
+        */
+        TBool IsClass0() const;
+
+        /**
+        *   Returns ETrue, if the message is compressed.
+        *
+        *   @return                     ETrue, if the message is compressed.
+        */
+        TBool IsCompressed() const;
+
+        /**
+        *   Returns boolean value indicating if this is the index message.
+        *
+        *   Index messages have message code 1010101010b.
+        *
+        *   Refer to GSM specifications to for details.
+        *
+        *   @return                     Boolean value indicating if this is 
+        *                               an index message.
+        */
+        TBool IsIndexMessage() const;
+
+        /**
+        *   Returns the key of the message (serial number).
+        *    
+        *   Refer to GSM specifications for details.
+        *
+        *   @return                     Key of the message.
+        */
+        TCbsDbMessageKey Key() const;
+
+        /**
+        *   Returns the LAC (Location Area Code) of the area where the phone
+        *   was when this message was received.
+        *
+        *   @return                     Location area code
+        */
+        TUint LAC() const;
+
+        /**
+        *   Returns the language in which the message is written.
+        *
+        *   Function will panic, if the language has not been resolved
+        *   with ResolveLanguage().
+        *
+        *   @return                     The language of the message.
+        */
+        TCbsDbLanguage Language() const;
+
+        /**
+        *   Determines and returns the language of this message
+        *   based on first two characters of message content.
+        *   Assumes that the message content contains language
+        *   indication and that the content has been decoded
+        *   into UCS-2 representation.
+        *
+        *   @returns                    Language of the message
+        */
+        TCbsDbLanguage LanguagePrecedingMessage() const;
+
+        /**
+        *   Determines and returns the language of this message
+        *   based on DCS value. Assumes that the same DCS value
+        *   indicates, that the language can be determined in this
+        *   way (and not from message content).
+        *
+        *   @returns                    Language of the message
+        */
+        TCbsDbLanguage LanguageWithDefaultAlphabet() const;
+        
+        /**
+        *   Returns the 16-bit representation of the message
+        *   contents.
+        *
+        *   @returns                    Message contents
+        */
+        HBufC* Message() const;
+        
+        /**
+        *   Returns the 8-bit representation of the message
+        *   contents.
+        *
+        *   @returns                    Message contents
+        */
+        HBufC8* Message8() const;
+
+        /**
+        *   Returns the message class of the message.
+        *
+        *   @return                     Message Class.
+        */
+		TInt MessageClass() const;
+
+        /**
+        *   Returns ECbsRecLanguageIndicationBody, if message's content is 
+        *   preceded by language indication (see GSM 03.38).
+        *
+        *   Return values:
+        *   ECbsRecLanguageIndicationHeader Language indicated by the message
+        *                                   header DCS value
+        *   ECbsRecLanguageIndicationBody   Language indicated by 
+        *                                   a two-character prefix in message
+        *                                   body.
+        *
+        *   @return                         Indication location.
+        */
+        TCbsRecLanguageIndication MessagePrecededByLanguageIndication() const;
+
+        /**
+        *   Returns the network mode (GSM/WCDMA) of this message page.
+        *        
+        *   @return                         Network in which this message was 
+        *                                   received (GSM/WCDMA).
+        */
+        TCbsNetworkMode NetworkMode() const;
+
+        /**
+        *   Returns the page parameter of this message page.
+        *
+        *   Total and this page -fields can be accessed with 
+        *   methods TotalPages() and ThisPage().
+        *
+        *   @return                     Page Parameter.
+        */
+        TCbsRecPageParameter PageParameter() const;
+
+        /**
+        *   Frees the memory allocated for 8-bit representation of message
+        *   content.
+        */
+        void ReleaseEightBitRepresentation();
+
+        /**
+        *   Removes any index header prefix from the message body.
+        *
+        *   This method assumes that the index header is contained in the
+        *   first line of message body. This line, including trailing <cr><lf>
+        *   is removed.
+        *
+        *   Index header prefix is assumed to contain "EIn<cr><lf>", where n
+        *   specifies the version number this index message claims to 
+        *   follow and <cr><lf> is a carriage return + line feed.
+        *
+        *   It is also assumed that any language indication prefix has
+        *   already been removed prior to this operation.
+        *
+        *   Message must be in UCS-2 representation.
+        *
+        *   Leave reasons:
+        *   KErrUnderflow   Message is too short to contain index header.
+        */
+        void RemoveIndexHeaderL();
+
+        /**
+        *   Removes language indication field from the message body.
+        *
+        *   Presence of an indication is verified with the DCS value 
+        *   according to ETSI specifications. Message is assumed to
+        *   contain valid indication, i.e., three bytes preceding the message
+        *   body specifying the language code. 
+        *    
+        *   The correctness of this operation is not checked. If the
+        *   indication is invalid, the message body is likely to either have
+        *   a couple of characters too many or few.
+        *
+        *   Message is assumed to be decoded into UCS-2.
+        *
+        *   Leave reasons:
+        *   KErrUnderflow  Message is too short to contain language indication.
+        */
+        void RemoveLanguageIndicationFromBodyL();
+
+        /**
+        *   Returns ETrue, if this message requires to be displayed 
+        *   immediately.
+        *
+        *   The CB message has to be displayed immediately
+        *   if either it is flagged as a Class 0 message (see GSM 03.38)
+        *   or has a geographical scope of the type "Immediate" 
+        *   (see GSM 03.41).
+        *
+        *   This function always returns EFalse for Base station ID messages 
+        *   (message identifier = 50). 
+        *
+        *   @return                     Immediate display indication.
+        */
+        TBool RequiresImmediateDisplay() const;
+
+        /**
+        *   Increases the space allocated for message content.
+        *
+        *   @param aLength              New number of characters in msg 
+        *                               content.
+        */
+        void ReserveContentSizeL( TInt aLength );
+
+        /**
+        *   Increases the space allocated for 8-bit message content.
+        *
+        *   @param aLength              New number of characters in msg 
+        *                               content.
+        */
+        void ReserveContentSize8L( TInt aLength );
+
+        /**
+        *   Determines language of this message so that calls to Language()
+        *   will return the correct value.
+        *
+        *   Language information may be determined from Data Coding Scheme
+        *   of message header or from the first characters in message body.
+        *   For the latter to succeed, the message has to be decoded into 
+        *   UCS-2.
+        */
+        void ResolveLanguage();
+
+        /**
+        *   Sets the network information of this message.
+        *
+        *   @param aNetworkInfo         Network information
+        *   @param aArea                Area information
+        */
+        void SetNetworkInfo(
+            const RMobilePhone::TMobilePhoneNetworkInfoV1& aNetworkInfo,
+            const RMobilePhone::TMobilePhoneLocationAreaV1& aArea );
+
+        /**
+        *   Returns the page number of this page in the message page sequence,
+        *
+        *   @return                     Page number of this page.
+        */
+        virtual TUint ThisPage() const = 0;
+
+        /**
+        *   Returns the topic number to which the message belongs. 
+        *   (Message Identifier)
+        *
+        *   @return                     The number of the topic
+        */
+        TCbsDbTopicNumber TopicNumber() const;
+
+        /**
+        *   Returns the total number of pages in this page's message.
+        *
+        *   @return                     Total number of pages in this message
+        */
+        virtual TUint TotalPages() const = 0;
+        
+    protected:
+        CCbsMessage();      
+
+    protected:
+        // Data Coding Scheme (language, encoding, compression)
+        TCbsRecDCS iDCS;
+
+        // Own: contents of the message page in 16-bit representation
+        HBufC* iMessage;
+
+        // Own: contents of the message page in 8-bit representation
+        HBufC8* iMessage8;
+
+        // Serial Number (GS, Message Code, Update Number)
+        TUint16 iSerialNumber;
+
+        // Message Identifier (Topic number)
+        TUint16 iMessageIdentifier;
+
+        // Page Parameter (this page, total pages)
+        TCbsRecPageParameter iPageParameter;
+
+        // Total number of pages
+        TInt iTotalNumberOfPages;
+
+        // Location area information
+        RMobilePhone::TMobilePhoneLocationAreaV1 iLocationArea;
+
+        // Network information
+        RMobilePhone::TMobilePhoneNetworkInfoV1 iNetworkInfo;
+
+        // Language of this message
+        TCbsDbLanguage iLanguage;
+
+        // Network in which current message was received
+        TCbsNetworkMode iNetworkMode;
+        };
+
+#endif      //  CCBSMESSAGE_H
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CCbsMessageCleanUpTimer.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,99 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsMessageCleanupTimer class.
+*
+*/
+
+
+#ifndef CCBSMESSAGECLEANUPTIMER_H
+#define CCBSMESSAGECLEANUPTIMER_H
+
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CCbsDbImpTopicList;
+class CCbsDbImpSettings;
+class CCbsMessage;
+class CCbsRecCollector;
+
+typedef CArrayPtrFlat<CCbsMessage> CMessageBuffer;
+
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// Handles the cleaning up of read messages, according to time interval
+// set by the user.
+
+class CCbsMessageCleanupTimer : public CTimer
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        *   C++ default constructor.
+        *
+        *   @param  aTopicList  Reference to topic list database
+        *   @param  aSettings   Reference to settings database
+        */
+        CCbsMessageCleanupTimer( CCbsRecCollector& aCbsRecCollector, CMessageBuffer& aArray );
+
+        /**
+        *   Two-phased constructor.
+        *
+        *   @param  aTopicList  Reference to topic list database
+        *   @param  aSettings   Reference to settings database
+        */
+        static CCbsMessageCleanupTimer* NewL( CCbsRecCollector& aCbsRecCollector, CMessageBuffer& aArray );
+        
+        /**
+        *   Destructor.
+        */
+        ~CCbsMessageCleanupTimer();
+
+    public: // New functions
+        
+        /** 
+        *   Requests the timer to be started.
+        */
+        void StartTimer();
+
+        /** 
+        *   Requests the timer to be stopped.
+        */
+        void StopTimer();
+
+    public: // Functions from base classes
+
+        /**
+        *   Called when the timer expires. Renews the request.
+        */
+        void RunL();
+        
+    private:
+
+        /**
+        *   By default constructor is private.
+        */
+        void ConstructL();
+
+    private:    // Data
+
+		TTimeIntervalMinutes	iInterval;
+		CCbsRecCollector&		iCbsRecCollector;
+		CMessageBuffer&			iArray;
+    };
+
+#endif      // CCbsMessageCleanupTimer_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CCbsMessageFactory.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,105 @@
+/*
+* 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:  Header file for the CCbsMessageFactory class.
+*
+*/
+
+
+#ifndef     CCBSMESSAGEFACTORY_H
+#define     CCBSMESSAGEFACTORY_H
+
+//  INCLUDES
+
+#include <e32base.h>
+#include <etelmm.h>
+#include "CCbsMessage.h"
+
+//  FORWARD DECLARATIONS
+class CCbsRecEtel;
+
+//  CLASS DECLARATION 
+
+/**
+*   CCbsMessageFactory constructs CB messages based on a page
+*   received through ETel.
+*
+*   The selection between GSM and WCDMA messages is made when
+*   constructing the message.
+*/
+class CCbsMessageFactory : public CBase
+    {
+    public:     // New functions        
+
+        /**
+        *   Constructs a new CCbsMessage based on TDes8&
+        *   (which is a descriptor) received from EPOC Telephony Server.
+        *   
+        *   @param      aRecEtel        CCbsRecEtel reference
+        *   @return                     A new instance of CCbsMessageFactory
+        */
+        static CCbsMessageFactory* NewL( CCbsRecEtel& aRecEtel );
+
+        /**
+        *   Destructor
+        */
+        ~CCbsMessageFactory();
+
+        /**
+        *   Creates a new message.
+        *
+        *   @param  aMessagePage        Source message descriptor
+        *   @param  aAttributes         Message attributes
+        *   @return aMsgType            Message type (GSM/WCDMA/Livecast)
+        *   @return                     Current instance of CCbsMessage
+        */
+        CCbsMessage* CreateMessageL( const TDes8& aMessagePage,
+            const RMobileBroadcastMessaging::TMobileBroadcastAttributesV2& aAttributes,
+            TCbsMessageType& aMsgType );
+
+        /**
+        *   Creates a new message.
+        *        
+        *   @param  aMessage            Message from which to create the new msg
+        *   @return                     Current instance of CCbsMessage
+        */
+        CCbsMessage* CreateMessageL( const CCbsMessage& aMessage );
+        
+    private:
+
+        /**
+        *   Default constructor               
+        */  
+        CCbsMessageFactory( CCbsRecEtel& aRecEtel );
+
+        /**
+        *   2nd-phase constructor               
+        */
+        void ConstructL();
+
+
+    private: // Data
+
+        // Message attributes, mainly used with WCDMA
+        RMobileBroadcastMessaging::TMobileBroadcastAttributesV2 iAttributes;
+
+        // CCbsRecEtel instance to which CB messages are passed.
+        CCbsRecEtel& iRecEtel;
+
+    };
+
+#endif      //  CCBSMESSAGEFACTORY_H   
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CCbsObject.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,99 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 class represents the base class for all server-side subsession
+*                classes.
+*
+*/
+
+
+#ifndef     CCBSOBJECT_H
+#define     CCBSOBJECT_H
+
+//  INCLUDES
+
+#include <e32base.h>
+#include "CbsCommon.h"
+
+//  FORWARD DECLARATIONS
+class CCbsSession;
+
+//  CLASS DECLARATION 
+
+/**
+*   CCbsSession is the base class for the classes that represent
+*   server-side subsessions. 
+*
+*   It provides some convience functions is remove redundancy of
+*   subsession classes.
+*/
+class CCbsObject : public CObject
+    {
+    public:     // New functions
+        /**
+        *   Constructor.
+        *   
+        *   @param aSession                 Pointer to the session.
+        */  
+        CCbsObject( CCbsSession& aSession );
+
+        /**
+        *   Destructor.
+        */
+        ~CCbsObject();
+
+        /**
+        *   Handles the requests for the object.
+        *    
+        *   Implemented in subsession classes.
+        *
+        *   @param  aMessage            Request to be handled.
+        *   @return                     Boolean value indicating whether 
+        *                               the request was handled.
+        */
+        virtual TBool HandleRequestsL( const RMessage2& aMessage ) = 0;
+
+        /**
+        *   Returns the message of current client request.
+        *
+        *   @return                     The message object of the current
+        *                               client request.
+        */
+        const RMessage2& Message();
+
+        /** 
+        *   Returns a reference to the session.
+        *
+        *   @return                     Main session object.
+        */
+        CCbsSession& Session();
+
+        /**
+        *   Panics the client.
+        *
+        *   @param aPanic                Reason for panic.
+        */
+        void PanicClient( TCbsSessionPanic aPanic ) const;
+
+    private:    // Data
+
+        // The session to which this object belongs.
+        CCbsSession& iSession;
+
+    };
+
+#endif      //  CCBSOBJECT_H   
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CCbsRecCollector.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,207 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsRecCollector class.
+*
+*/
+
+
+#ifndef CCBSRECCOLLECTOR_H
+#define CCBSRECCOLLECTOR_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class TCbsMessageCompletion;
+class CCbsRecMessage;
+class CCbsMessage;
+class CCbsMessageFactory;
+class CCbsMessageCleanupTimer;
+
+// DATA TYPES
+// Dynamic array that contains collected message pages
+typedef CArrayPtrFlat<CCbsMessage> CMessageBuffer;
+
+
+// CLASS DECLARATION
+
+/**
+*   This class represents a collector, which stores pages of multipaged 
+*   messages. Complete messages are assembled and returned back to 
+*   the caller of CollectL() method.
+*  
+*   CCbsRecCollector stores message pages in a number of dynamic arrays.
+*   If all but one page of a message are present in collector, and
+*   the remaining page is received, the pages will be assembled and
+*   the corresponding message chain deleted.
+*
+*   The maximum number of incomplete messages stored in collector at once
+*   is fixed and determined by KMaxCollectorMessages in CCbsRecCollector.cpp.
+*
+*   CCbsRecCollector implements a circular list to contain message.
+*   Each incomplete message occupies a slot in this list. If the list already
+*   contains KMaxCollectorMessages messages, the next received multipaged
+*   message will delete all received pages of the oldest message in list.
+*
+*   On receival of a message page, the collector compares network information
+*   (PLMN, LAC, CellId) of both messages to decide whether pages are of
+*   the same message. In short, for pages to be of the same message
+*   their network information have to meet the requirements set by the 
+*   geographical scope of the already collected page.
+*   See ETSI GSM 03.41 for a detailed description. 
+*   
+*/
+class CCbsRecCollector : public CBase
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        *   Two-phased constructor.
+        *
+        *   @param  aFactory            Message factory instance
+        *   @return                     New CCbsRecCollector instance
+        */
+         static CCbsRecCollector* NewL( CCbsMessageFactory& aFactory );
+        
+        /**
+        *   Destructor.
+        */
+        virtual ~CCbsRecCollector();
+
+    public: // New functions
+
+        /**
+        *   Called by the Receiver when a multipaged message is received.
+        *   This method checks for other pages of this message to be
+        *   present in the collector. If all pages are present the
+        *   collector returns a pointer to completed message.
+        *
+        *   If some pages are still missing, function stores 
+        *   the message page and returns NULL.
+        *
+        *   @param aMessage             Multipaged message page
+        *   @return                     NULL or completed CB message
+        */
+        CCbsMessage* CollectL( CCbsMessage* aMessage, TInt aMessageType );
+ 
+        /**
+        *   Deletes all message pages contained in aArray.
+        *
+        *   @param aArray               Message chain.
+        */
+        void DeleteChainL( CMessageBuffer& aArray ) const; 
+
+    private:    // new functions
+
+        /**
+        *   C++ default constructor.
+        *
+        *   @param aListener            Message factory instance
+        */
+        CCbsRecCollector( CCbsMessageFactory& aFactory  );
+
+        /**
+        *   By default constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        *   Counts pages in message chain aArray and compares the result
+        *   against the total number of pages in the message.
+
+        *   @param  aArray              Message chain.
+        *   @return                     ETrue, if the chain contains all pages
+        *                               of the message and is ready to be 
+        *                               merged.
+        */
+        TBool AllPagesPresent( const CMessageBuffer& aArray ) const;
+
+        /**
+        *   Merges all pages in message chain aArray and returns
+        *   a pointer to the resulting assembled message. The pointer
+        *   is also left on the cleanup stack.
+        *
+        *   @param aArray               Message chain
+        *   @return                     Completed CB message
+        */
+        CCbsMessage* MergePagesLC( CMessageBuffer& aArray ) const;
+
+        /**
+        *   Finds and returns a message chain which already contains pages
+        *   of aMessage's message. If none is found, NULL is returned.
+        *
+        *   @param aMessage             Message page for which a correct chain
+        *                               is sought.
+        *   @return                     NULL or message chain that contains
+        *                               aMessage's pages.
+        */
+        CMessageBuffer* FindChainContainingPage( const CCbsMessage& aMessage ) const;
+        
+        /**
+        *   Adds message page aMessage to the correct position in message chain
+        *   aArray. Message chains are ordered in ascending page number order.
+        *   Duplicate pages are not accepted.
+        *
+        *   Ownership of aMessage is transferred to aArray, if the given page
+        *   hasn't been already collected. The given page will be deleted,
+        *   if it already exists in the chain.
+        *
+        *   @param aMessage             Message page, which is inserted into 
+        *                               the chain.
+        *   @param aArray               Message chain.
+        */
+        void AddMessageToChainL( CCbsMessage* aMessage, 
+            CMessageBuffer& aArray ) const;
+
+        /**
+        *   Checks if these pages can be merged. Returns ETrue, if merging is
+        *   acceptable.
+        *
+        *   Decision is based network information and geographical scope of 
+        *   pages. Network information consists of cell id, location area code
+        *   and operator id.
+        *
+        *   @param aPage1               Message page.
+        *   @param aPage2               Message page.
+        */
+        TBool CheckPageAreaInfoMatch( const CCbsMessage& aPage1, 
+            const CCbsMessage& aPage2 ) const;
+
+    private:    // prohibited functions
+        // Prohibited copy constructor
+        CCbsRecCollector( const CCbsRecCollector& );
+
+        // Prohibited assignment operator
+        CCbsRecCollector& operator=( const CCbsRecCollector& );
+
+    private:    // data
+        // Contains pointers to buffers, each containing a single partial
+        // message with 1 or more pages. 
+        CArrayPtrFlat< CMessageBuffer >* iRootNodeArray;
+
+        // An iterator which points to a location in iRootNodeArray next used
+        // to store a page of a message, which is "new" to the collector.
+        // Being "new" here means that the collector doesn't contain any
+        // pages of this message.
+        TInt iRootNodeIterator;
+
+        // Message factory
+        CCbsMessageFactory& iFactory;
+		CArrayPtrFlat< CCbsMessageCleanupTimer >*	iMessageCleanupTimerArray;
+
+    };
+
+#endif      // CCBSRECCOLLECTOR_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CCbsRecDecoder.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,150 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsRecDecoder class
+*
+*/
+
+
+#ifndef CCBSRECDECODER_H
+#define CCBSRECDECODER_H
+
+//  INCLUDES
+
+#include <e32base.h>
+#include <f32file.h>
+
+// FORWARD DECLARATIONS
+
+class CCnvCharacterSetConverter;
+class CCbsRecMessage;
+class CCbsRecWcdmaMessage;
+class CCbsMessage;
+
+// CLASS DECLARATION
+
+/**
+*   CCbsRecDecoder handles decoding of message contents.
+*
+*   CbsServer receives messages stored in 8-bit descriptors
+*   from ETel. This class converts them into 16-bit descriptors
+*   and decodes the message representation into UCS-2 (which
+*   is used by Symbian OS internally). 
+*  
+*/
+class CCbsRecDecoder : public CBase
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        *   Two-phased constructor.
+        *
+        *   @returns                    New instance of CCbsRecDecoder.
+        */
+         static CCbsRecDecoder* NewL();
+        
+        /**
+        *   Destructor.
+        */
+        virtual ~CCbsRecDecoder();
+
+    public:  // New functions
+
+        /**
+        *   Decodes message page into Unicode representation.
+        *
+        *   If the message has a language indication prefixed
+        *   in the message body, the indication is removed.
+        *
+        *   Compressed messages are not supported.
+        *   
+        *   Leave reasons:
+        *   KErrNotSupported    Message compressed or of unsupported character
+        *                       coding.
+        *   KErrNoMemory        OOM.
+        *   KErrGeneral         Failed due to other reasons.
+        *
+        *   @param aMessage Message page.
+        */
+        void DecodeL( CCbsMessage& aMessage );
+      
+    private:  // New functions
+
+        // Default constructor.
+        CCbsRecDecoder();
+
+        // Prohibited copy constructor.
+        CCbsRecDecoder( const CCbsRecDecoder& );
+
+        // Prohibited assignment operator.
+        CCbsRecDecoder& operator=( const CCbsRecDecoder& );
+
+        /**
+        *   2nd-phase constructor. 
+        */
+        void ConstructL();
+
+        /**
+        *   Decodes the given message's content.
+        *
+        *   @param aMessage             CB message
+        */
+        void DoDecodeL( CCbsMessage& aMessage );
+
+        /**
+        *   Decodes 8-bit and Unicode message representations.
+        *
+        *   @param aMsg                 CB message encoded in UCS2
+        */
+        void UnicodeDecodeL( CCbsMessage& aMsg );
+
+        /**
+        *   Decodes 7-bit message representation.
+        *
+        *   @param aMsg                 CB message encoded in 7-bit
+        */
+        void DefaultAlphabetDecodeL( CCbsMessage& aMsg );
+        
+        /**
+        *   Decodes 8-bit message representation.
+        *
+        *   @param aMsg                 CB message encoded in 8-bit
+        */
+        void EightbitAlphabetDecodeL( CCbsMessage& aMsg );
+
+        /**
+        *   Removes the trailing CRs from a message.
+        *
+        *   @param aText                Text from which the CR is to be removed
+        */
+        TPtrC RemoveTrailingCR( const TDesC& aText );
+        
+        /**
+        *   Removes trailing CRs and LFs from a 7-bit Cell info message.
+        *
+        *   @param aText                Text from which the CR is to be removed
+        *   @return                     Text with no CRs or LFs        
+        */
+        TPtrC8 RemoveTrailingControlChars( const TDesC8& aText );
+        
+   private:    // Data
+        // Own: character converter for 8-bit and UCS2 encodings
+        CCnvCharacterSetConverter* iConverter;
+
+        // File server session
+        RFs iFs;
+    };
+
+#endif      // CBSRECDECODER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CCbsRecEtel.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,457 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsRecEtel class
+*
+*/
+
+
+#ifndef     CCBSRECETEL_H
+#define     CCBSRECETEL_H
+
+
+//  INCLUDES
+#include <cmcn.h>
+#include "MCbsEtelMessaging.h"
+
+		/*****************************************************
+		*	Series 60 Customer / ETel
+		*	Series 60  ETel API
+		*****************************************************/
+#include <rmmcustomapi.h>       // SIM topics
+
+// CONSTANTS
+		/*****************************************************
+		*	Series 60 Customer / TSY
+		*	Needs customer TSY implementation
+		*****************************************************/
+
+// FORWARD DECLARATIONS
+class CCbsEtelFactory;
+class CCbsRecEtelMonitor;
+class CCbsRecCollector;
+class CCbsRecDecoder;
+class CCbsRecNetworkListener;
+class CCbsRecMessage;
+class CCbsReceiverHelper;
+class MCbsMcnSubscriptionsProvider;
+class CCbsSetFilterSettingHandler;
+class CCbsRecWcdmaMessage;
+class CCbsMessage;
+class CCbsMessageFactory;
+class CCbsLivecastHandler;
+
+
+//  CLASS DECLARATION 
+
+/**
+*   CCbsRecEtel sets up the receiver subsystem for receiving CBS messages 
+*   from the ETEL server.
+*
+*   This class creates instances of CCbsRecEtelMonitor to communicate with 
+*   ETel server, CCbsRecDecoder to decode message pages and 
+*   CCbsRecCollector to combine partial messages together. CCbsRecEtel 
+*   sends completed messages to the database via an interface 
+*   class CCbsReceiverHelper.
+*
+*   An instance of CCbsRecNetworkListener is created to monitor network
+*   state changes and report them to CCbsRecEtel instance.
+*
+*   CCbsRecEtel is also responsible for controlling the CBMI list entries 
+*   in ME defining Message Identifiers and DCSes that are to be received. 
+*
+*   CCbsRecEtel instance does not store information on what topics and
+*   languages to subscribe. Instead, on call to ApplyStateChangesL(), 
+*   subscriptions and other CB settings are retrieved from the database 
+*   and passed to EPOC Telephony server.
+*
+*   Thus, after topic subscriptions, languages or reception status have
+*   been modified, a call to ApplyStateChangesL() has to be made in order
+*   to actually bring the changes into effect.
+*
+*   ON SUBSCRIPTION OF TOPICS AND LANGUAGES
+*
+*   Although EPOC Telephony server can be requested to relay messages of certain topics and
+*   languages, there is a couple of things to note.
+*
+*   1. In order to detect topics broadcasted within the current region, all
+*   CB messages have to be received. This is done by subscribing all topics
+*   and languages.
+*
+*   2. Since MCN clients may subscribe any number of topics, topic filtering 
+*   has to be made to remove messages not requested by the UI client.
+*
+*   3. All languages have to be subscribed at all times. This is because
+*   TSY limits the number of languages and a single language (e.g., English),
+*   may be represented by multiple DCS values. In addition, CBS specification
+*   tells that any message in unspecified language has to be received.
+*   Thus the only possibility here is to ignore EPOC Telephony server provided facilities
+*   to filter languages, and implement filtering in CbsServer. 
+*   This is done in CCbsReceiverHelper.
+*/
+class CCbsRecEtel : public CBase
+    {
+    public:     // New functions
+        
+        /**
+        *   Creates an instance of the class.
+        *
+        *   @return A new instance of CCbsRecEtel.
+        */
+        static CCbsRecEtel* NewL();
+
+        /**
+        *   Destructor.
+        */
+        ~CCbsRecEtel();
+
+        /**
+        *   Called by the network listener (instance of CCbsRecEtelMonitor)
+        *   to indicate that a new message has been received and must be 
+        *   handled.
+        *
+        *   The message page is decoded, cell information (if present) is 
+        *   extracted and routed to MCN clients. Pages of multipaged messages 
+        *   are then given to the collector. If the message is completed
+        *   (all pages collected) or the message is singlepaged, it is
+        *   given onwards to CCbsReceiverHelper.
+        *
+        *   Note that a multipaged message page is routed to MCN clients 
+        *   before it is assembled. This is acceptable because maximum
+        *   length of a MCN message is specified to be 20 characters.
+        *
+        *   Ownership of aMessage transferred to CCbsRecEtel.
+        *
+        *   @param aMessage A pointer to the message page received.
+        */
+        void HandleMessageReceivedL( CCbsMessage* aMessage );
+
+        /**
+        *   Augments aMessage with current network information (i.e., PLMN, LAC
+        *   and Cell ID). Does nothing if the network listener iListener
+        *   is unavailable.        
+        *
+        *   @param aMessage Message page.
+        */
+        TInt AddNetworkInfo( CCbsMessage& aMessage ) const;
+            
+        /**
+        *   Sets the interface to which all accepted messages are given. 
+        *   
+        *   @param aInterface A pointer to the receiver interface.
+        */
+        void SetInterface( CCbsReceiverHelper* aInterface );
+
+        /**
+        *   Returns the current and maximum number of subscribed topics.
+        *
+        *   Topic restrictions are imposed by the TSY in use.
+        *
+        *   @param aTotal               Total amount of subscribed topics.
+        *   @param aMax                 Maximum amount of subscribed topics.
+        */
+        void GetSubscriptionsLimitsL( TInt& aTotal, TInt& aMax );
+        
+        /**
+        *   MCN client sessions register to CCbsRecEtel using this function.
+        *
+        *   When topic subscriptions are gathered during execution of
+        *   ApplyStateChangesL(), subscriptions of each registered subscription
+        *   provider are added to the CBMI list that determines which
+        *   topics are received.
+        *
+        *   @param aProvider            Topic subscription providing instance
+        */
+        void AddSubscriptionProviderL( 
+            MCbsMcnSubscriptionsProvider* aProvider );
+
+        /**
+        *   Removes a topic subscription provider.
+        *
+        *   @param aProvider            Topic subscription providing instance
+        */
+        void RemoveSubscriptionProviderL( 
+            const MCbsMcnSubscriptionsProvider* aProvider );
+
+        /**
+        *   Retrieves current subscriptions, languages and settings
+        *   from DB. This data is augmented by topic subscription
+        *   information retrieved from MCN client(s). Resulting
+        *   topic subscriptions, languages and settings will then
+        *   be requested from EPOC Telephony server.
+        *
+        */    
+        void ApplyStateChangesL();
+
+        /**
+        *   Returns the current cell information.
+        *
+        *   The information is retrieved from the last cell information
+        *   message received.
+        *
+        *   Result codes:
+        *   KErrNone                    Operation successful, aCellInfo 
+        *                               contains a valid cell info message
+        *   KErrNotFound                Cell information hasn't been received
+        *                               yet - aCellInfo is invalid.
+        *
+        *   @param  aInfoMessage        Current info message
+        *   @param  aTopicNumber        Number of the topic that 
+        *                               the msg belongs to
+        *   @return                     Result code
+        */
+        TInt GetCurrentMessage( TDes& aInfoMessage, TInt aTopicNumber );
+
+        /**
+        *   Loads CB topics from SIM and adds them on the topic list.
+        *   A topic is not added on the list if the same topic
+        *   already exists on the list. This identification is done
+        *   by the number of the topic only. 
+        *
+        *   The name of an added topic will be taken from SIM.
+        *   If no name has been associated with the topic, the string
+        *   <qtn_cb_litext_sim_topic> will be given to the topic.
+        *
+        *   Result codes:
+        *   KErrNotSupported            TSY does not support SIM topics.
+        *
+        *   @return                     Result code.
+        */
+        TInt LoadSimTopicsL();
+
+        /**
+        *   Deletes a CB topic matching the given topic number from SIM.
+        *
+        *   Leaves if the operation is unsuccessful.
+        *   
+        *   @param aNumber              Number of topic to be deleted from SIM.
+        *   @param aDeleteAll           Are we deleting all SIM topics, ETrue/EFalse
+        */
+        void DeleteSimTopicL( const TUint16 aNumber, const TBool aDeleteAll );
+        
+        /**
+        *   Deletes all topics from the SIM card.
+        *
+        *   Leaves if the operation is unsuccessful.
+        *           
+        */
+        void DeleteAllSimTopicsL();
+
+        /**
+        *   Passes the given CB message to each registered subscriptions
+        *   provider (a subscription provider is a MCN client wishing
+        *   CB message routing service).
+        *
+        *   @param  aMessage                CB message
+        */
+        void RouteMessageL( const CCbsMessage& aMessage );
+
+        /**
+        *   Returns the message collector reference.
+        *
+        *   @return                     Collector reference
+        */
+        CCbsRecCollector& Collector();
+        
+        /**
+        *   Returns the receiver helper reference.
+        *
+        *   @return                     Receiver helper reference
+        */
+        CCbsReceiverHelper& Interface() const;
+
+   private:
+        
+        /**
+        *   Constructor.
+        */
+        CCbsRecEtel();
+
+        /**
+        *   Finalizes the construction.
+        */
+        void ConstructL();
+
+        /**
+        *   Establishes a connection with the EPOC Telephony server.
+        *
+        *   Also opens the necessary EPOC Telephony server resources such as RMobilePhone and
+        *   RMobileBroadcastMessaging sessions.
+        */
+        void ConnectToEtelL();
+        
+        /**
+        *   Sets the given CB reception mode on ME.
+        *
+        *   @param aSetting         CB receive mode
+        */
+        void SetReceptionStatusL( 
+            RMobileBroadcastMessaging::TMobilePhoneBroadcastFilter aSetting );
+
+        /**
+        *   Returns the total number of topic subscriptions made by
+        *   MCN clients registered to the server.
+        *
+        *   @return                     Number of subscriptions by
+        *                               MCN clients.
+        */
+        TUint NumberOfMcnSubscriptions() const;
+
+        /**
+        *   Copies cell information message body into an internal
+        *   cache. This way MCN clients can be provided the current
+        *   cell information message even without message routing service.
+        *
+        *   The given message is assumed to be a valid cell information
+        *   message (CB message of topic 050).
+        *
+        *   @param  aMessage                Cell information message
+        */
+        void ExtractCellInformation( const CCbsMessage& aMessage );
+
+        /**
+        *   Copies cell information message body into an internal
+        *   cache. This way MCN clients can be provided the current
+        *   HomeZone message even without message routing service.
+        *
+        *   The given message is assumed to be a valid HomeZone
+        *   message (CB message of topic 221).
+        *
+        *   @param  aMessage                Cell information message
+        */
+        void ExtractHomeZoneInformation( const CCbsMessage& aMessage );
+
+        /**
+        *   Checks if the time of the day is such that the user does
+        *   not want to receive any messages.
+        *
+        *   @param  aMessage                CB message
+        *   @return                         ETrue if the message should
+        *                                   be recived, otherwise EFalse.
+        */
+        TBool CheckTimeL( const CCbsMessage* aMessage );
+                
+    private:    // Data
+
+        // Own: Collector, which is responsible for combining multipaged
+        // messages.        
+        CCbsRecCollector* iCollector;
+        
+        // Own: responsible for converting 7-bit and 8-bit representations 
+        // into UCS-2.
+        CCbsRecDecoder* iDecoder;
+
+        // Current reception status. This is a cached version of 
+        // a variable stored in ME/SIM.
+        RMobileBroadcastMessaging::TMobilePhoneBroadcastFilter iReception;
+
+        // Ref: interface to the server. 
+        CCbsReceiverHelper* iInterface;
+        
+        // Own: SMS messaging object for receiving CBS message pages 
+        // from the EPOC Telephony server.
+        MCbsEtelMessaging* iMessaging;
+
+        // Own: ETel monitor receives the message pages and forwards them to
+        // CCbsRecEtel.
+        CCbsRecEtelMonitor* iEtelMonitor;
+
+        // Own: Filter setting handler processes asynchronous 
+        // Set Filter Setting command.
+        CCbsSetFilterSettingHandler* iFilterSettingHandler;   
+
+        // EPOC Telephony server session.
+        RTelServer iEtelServer;
+
+        // Represents the GSM phone used for messaging and network information
+        // retrieving.
+
+		/*****************************************************
+		*	Series 60 Customer / ETel
+		*	Series 60  ETel API
+		*****************************************************/
+        RMobilePhone iGsmPhone;
+
+        // Custom API is used for SIM Topic handling.
+
+		/*****************************************************
+		*	Series 60 Customer / ETel
+		*	Series 60  ETel API
+		*****************************************************/
+        RMmCustomAPI iCustomPhone;
+
+        // Own: active object which listens to changes in network state
+        // and reports them to CCbsRecEtel instance.
+        CCbsRecNetworkListener* iNetworkListener;
+
+        // Own: set of MCN sessions that provide their topic subscriptions and
+        // get cell information routing services
+        CArrayFixFlat< MCbsMcnSubscriptionsProvider* >* iSubscriptionProviders;
+
+        // ETrue if a cell information message has been received.
+        TBool iCellInfoReceived;
+        
+        // Current reception status. This is a cached version of 
+        // a variable stored in ME.       
+        TBool iReceptionEnabled;
+
+        // Current cell information message.
+        TMcnMessage iCurrentCellInfoMessage;
+
+        // Has the user set a time to limit the reception
+        TBool iLimitedReception;
+
+        // The current time
+        TTime iNow;
+        TDateTime iDateTimeNow;
+
+        // Start and end times of limited reception
+        TTime iStartTime;
+        TTime iEndTime;
+
+        // Cell info cache variables
+        RMobilePhone::TMobilePhoneNetworkInfoV1 iCellInfoPLMN;
+        TUint iCellInfoLAC;
+        TUint iCellInfoCellId;
+
+        // ETrue if HomeZone message has been received
+        TBool iHomeZoneReceived;
+
+        // HomeZone cache variables
+        RMobilePhone::TMobilePhoneNetworkInfoV1 iHomeZonePLMN;
+        TUint iHomeZoneLAC;
+        TUint iHomeZoneCellId;
+
+        // Current HomeZone message
+        TMcnMessage iCurrentHomeZoneMessage;
+
+        // Message factory
+        CCbsMessageFactory* iFactory;
+
+        // LC message handler
+        CCbsLivecastHandler* iLivecastHandler;
+
+        // Local variation bits, fetched from CenRep
+        TInt iLVBits;
+                
+        // Indication of new SIM Topics
+        TBool iNewSimTopicsAdded;
+        
+        __DECLARE_TEST;
+    };
+
+#endif      //  CCBSRECETEL_H   
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CCbsRecEtelMonitor.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,150 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsRecEtelMonitor class
+*    
+*                This class receives CBS message pages from the EPOC Telephony server and
+*                sends them to a CCbsRecEtel instance.
+*
+*/
+
+
+
+#ifndef     CCBSRECETELMONITOR_H
+#define     CCBSRECETELMONITOR_H
+
+//  INCLUDES
+        /*****************************************************
+		*	Series 60 Customer / ETel
+		*	Series 60  ETel API
+		*****************************************************/
+#include <etelmm.h>
+
+//  FORWARD DECLARATIONS
+class TGsmBroadcastMessageData;
+class CCbsRecEtel;
+class MCbsEtelMessaging;
+class CCbsMessageFactory;
+class CCbsLivecastHandler;
+
+//  CLASS DECLARATION 
+
+/**
+*   CCbsRecEtelMonitor is an active object handling the reception of 
+*   CB message pages from the EPOC Telephony server.
+*    
+*   CCbsRecMessages are constructed from the received CBS message pages and
+*   forwarded to an instance of CCbsRecEtel for decoding.
+*   Constructing a whole message, in case of multipage messages, is also left 
+*   to CCbsRecEtel and CCbsRecCollector.
+*/
+class CCbsRecEtelMonitor : public CActive
+    {
+    public:     // New functions
+
+        /**
+        *   Creates an instance of the class.
+        *
+        *   @param      aEtel               A reference to the receiver
+        *   @param      aSmsMessaging       A reference to the messaging object
+        *   @param      aFactory            A reference to the message factory
+        *   @param      aLivecastHandler    A reference to the Livecast handler
+        *   @return                         A new instance of CCbsRecEtelMonitor
+        */
+        static CCbsRecEtelMonitor* NewL( CCbsRecEtel& aEtel, 
+            MCbsEtelMessaging& aSmsMessaging,  
+            CCbsMessageFactory& aFactory,
+            CCbsLivecastHandler& aLivecastHandler );
+
+        /**
+        *   Destructor.
+        */
+        ~CCbsRecEtelMonitor();
+
+        /** 
+        *   Requests EPOC Telephony server to forward next received CB message to 
+        *   this object.
+        */
+        void IssueRequest();
+
+    private:    // From CActive
+
+        /**
+        *   Becomes active when EPOC Telephony server has copied a CB message to 
+        *   iCbsMessagePage. The page is then given to CCbsRecEtel for
+        *   processing.
+        *
+        *   Finally this function reissues the ReceiveMessage request.
+        */
+        void RunL();
+
+        /**
+        *   Cancels an outstanding ReceiveMessage request.
+        */
+        void DoCancel();
+
+    private:
+
+        /**
+        *   The constructor.
+        *
+        *   @param  aEtel               CCbsRecEtel object.
+        *   @param  aMessaging          ETel messaging object
+        *   @param  aFactory            A reference to the message factory
+        *   @param  aLivecastHandler    A reference to the Livecast handler
+        */
+        CCbsRecEtelMonitor( CCbsRecEtel& aEtel, MCbsEtelMessaging& aMessaging,
+            CCbsMessageFactory& aFactory, CCbsLivecastHandler& aLivecastHandler );
+
+        /**
+        *   Finalizes the construction.
+        */
+        void ConstructL();
+      
+    private:    // Data
+
+        // CCbsRecEtel instance to which CB messages are passed.
+        CCbsRecEtel& iEtel;
+                
+        // Messaging subsession.
+        MCbsEtelMessaging& iSmsMessaging;       
+
+        /**
+        *   Message page is stored here when the monitor becomes active
+        *   due the arrival of a CBS message.
+        */        
+        // Message data
+        RMobileBroadcastMessaging::TBroadcastPageData iMsgData;
+        
+        // Attributedata of an incoming broadcast message
+        RMobileBroadcastMessaging::TMobileBroadcastAttributesV2 iAttributes;
+
+        // Attributepackage of an incoming broadcast message
+        RMobileBroadcastMessaging::TMobileBroadcastAttributesV2Pckg iMsgAttributesPckg;
+        
+        // Message factory
+        CCbsMessageFactory& iFactory;
+
+        // LC message handler
+        CCbsLivecastHandler& iLivecastHandler;
+
+        // Is Newsticker feature supported
+        TBool iNewstickerSupported;
+
+    };
+
+#endif      //  CCBSRECETELMONITOR_H   
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CCbsRecMessage.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,127 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsRecMessage class
+*
+*/
+
+
+#ifndef CCBSRECMESSAGE_H
+#define CCBSRECMESSAGE_H
+
+// INCLUDES
+		/*****************************************************
+		*	Series 60 Customer / ETel
+		*	Series 60  ETel API
+		*****************************************************/
+#include <etelmm.h>
+
+#include "CbsCommon.h"
+#include "CCbsMessage.h"
+
+// CLASS DECLARATION
+
+/**
+*   CCbsRecMessage represents a message page generated by CCbsRecEtelMonitor.
+*
+*   CCbsRecMessage is constructed from a CB message page received from 
+*   EPOC Telephony Server.
+*/
+class CCbsRecMessage : public CCbsMessage
+    {
+    public:        // Constructors and destructors
+
+        /**
+        *   Constructs a new CCbsRecMessage based on TDes8&
+        *   (which is a descriptor) received from EPOC Telephony Server.
+        *   
+        *   @param  aMessagePage        Source message descriptor
+        *   @return                     A new instance of CCbsRecMessage
+        */
+        static CCbsRecMessage* NewL( const TDes8& aMessagePage );
+
+        /**
+        *   Copy constructor
+        *
+        *   @param  aMessagePage        Source CCbsRecMessage instance
+        *   @return                     A new instance of CCbsRecMessage
+        */
+        static CCbsRecMessage* NewL( const CCbsMessage& aMessagePage );
+
+        /**
+        *   Destructor
+        */
+        ~CCbsRecMessage();     
+
+    public:
+
+        /**
+        *   Returns the page number of this page in the message page sequence,
+        *
+        *   @return                     Page number of this page.
+        */
+        TUint ThisPage() const;
+
+        /**
+        *   Returns the total number of pages in this page's message.
+        *
+        *   @return                     Total number of pages in this message
+        */
+        TUint TotalPages() const;        
+
+    public: // from CCbsMessage
+
+        /**
+        *   Returns the type of the message (only in WCDMA)
+        *
+        *   @return                     Type of this message
+        */
+        TInt MessageType() const;
+
+    protected:
+
+        /**
+        *   Default constructor
+        */
+        CCbsRecMessage();
+
+    private:
+
+        /**
+        *   2nd-phase constructor.
+        *
+        *   @param aMessagePage         Message page
+        */
+        void ConstructL( const TDes8& aMessagePage );
+
+        /**
+        *   2nd-phase copy constructor.
+        *
+        *   @param aMessagePage         Message page
+        */
+        void ConstructL( const CCbsMessage& aMessagePage ); 
+
+
+    private:    // prohibited functions and operators
+        
+        // Copy constructor: NewL() used instead
+        CCbsRecMessage( const CCbsRecMessage& );
+
+        // Assignment operator
+        CCbsRecMessage& operator=( const CCbsRecMessage& );
+
+    };
+
+#endif // CCBSRECMESSAGE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CCbsRecNetworkListener.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,168 @@
+/*
+* Copyright (c) 2003-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsRecNetworkListener class
+*
+*/
+
+
+#ifndef     CCBSRECNETWORKLISTENER_H
+#define     CCBSRECNETWORKLISTENER_H
+
+// FORWARD DECLARATIONS
+class RMobilePhone;
+
+//  CLASS DECLARATION
+
+/**
+*   CCbsRecNetworkListener is used to keep CbsServer up to date 
+*   with the current network information. This information
+*   is used to assemble multipaged CB messages.
+*
+*   This is an active object which receives notifications from EPOC Telephony Server
+*   when the current network information changes. A request for 
+*   new network information is constantly held active at EPOC Telephony Server,
+*   first requested at the time of construction of CCbsRecNetworkListener.
+*
+*   Network information can be retrieved from CCbsRecNetworkListener
+*   with GetCurrentNetworkInfo().
+*/
+class CCbsRecNetworkListener : public CActive
+    {
+    public:     // New functions
+
+        /**
+        *   Creates an instance of the class.
+        *
+        *   @param  aPhone              Open phone session.
+        *   @return                     A pointer to the created instance.
+        */        
+        static CCbsRecNetworkListener* NewL( RMobilePhone& aPhone );
+
+        /**
+        *   Destructor.
+        */
+        ~CCbsRecNetworkListener();
+
+        /**
+        *   Fetches the current networking info. 
+        *
+        *   Returns KErrNotFound, if the current network info hasn't been
+        *   received yet. Otherwise KErrNone is returned.
+        *
+        *   @param  aNetworkInfo        Return: current network information.
+        *   @param  aArea               Return: current area information
+        *   @return                     Result code
+        */        
+        TInt GetCurrentNetworkInfo( 
+            RMobilePhone::TMobilePhoneNetworkInfoV1& aNetworkInfo,
+            RMobilePhone::TMobilePhoneLocationAreaV1& aArea );
+
+    private:    // From CActive
+        /**
+        *   Called whenever EPOC Telephony Server notifies this object of the presence
+        *   of updated network information.
+        */
+        void RunL();
+
+        /**
+        *   Called whenever the listener has been requested to cancel.
+        */
+        void DoCancel();
+
+    private:    // new functions
+
+        /**
+        *   Default constructor.
+        *
+        *   @param  aPhone  Reference to phone object
+        */
+        CCbsRecNetworkListener( RMobilePhone& aPhone );
+
+        /**
+        *   Finalizes the construction.
+        */
+        void ConstructL();
+
+        /**
+        *   Requests getting current network from EPOC Telephony Server.
+        *
+        *   Called when CCbsRecNetworkListener is constructed.
+        */
+        void IssueGetCurrentNwRequest();
+
+        /**
+        *   Requests notification of network registration state change from 
+        *   EPOC Telephony Server.
+        */
+        void IssueNotifyNwRegChangeRequest();
+
+        /**
+        *   Requests notification of network state change from EPOC Telephony Server.
+        */
+        void IssueNotifyNwChangeRequest();
+
+        /**
+        *   When the current request is GetCurrentNetwork, handle the return result
+        */
+        void HandleGetCurrentNetworkResult();
+
+        /**
+        *   When the current request is NotifyNetworkRegistrationStatusChange, 
+        *   handle the return result
+        */
+        void HandleNotifyNetworkRegistrationStatusChangeResult();
+
+        /**
+        *   When the current request is NotifyCurrentNetworkChange, 
+        *   handle the return result
+        */
+        void HandleNotifyCurrentNetworkChangeResult();
+
+        // Prohibited copy constructor
+        CCbsRecNetworkListener( const RMobilePhone& );
+
+        // Prohibited assignment operator
+        CCbsRecNetworkListener& operator=( const RMobilePhone& );
+
+    private:    // Data
+        // ETrue, if iNetworkInfo contains current network information
+        TBool iNetworkInfoRetrieved;
+
+        // Phone instance
+        RMobilePhone& iPhone;
+
+        // Current network information data
+        RMobilePhone::TMobilePhoneNetworkInfoV1 iNetworkInfo;
+
+        // Current network information package        
+        RMobilePhone::TMobilePhoneNetworkInfoV1Pckg iNetworkInfoPckg;
+
+        // Current area information
+        RMobilePhone::TMobilePhoneLocationAreaV1 iArea;
+
+        // Status info
+        TBool iGetCurrentNetworkActive;
+
+        // Status of notification of network registration state change
+        TBool iNotifyNwRegChange;
+
+        // Network registration information
+        RMobilePhone::TMobilePhoneRegistrationStatus iRegistration;
+    };
+
+#endif      //  CCBSRECNETWORKLISTENER_H   
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CCbsRecWcdmaMessage.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,144 @@
+/*
+* 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:  This file contains the header file of the CCbsRecWcdmaMessage 
+*               class.
+*
+*/
+
+
+#ifndef CCBSRECWCDMAMESSAGE_H
+#define CCBSRECWCDMAMESSAGE_H
+
+// INCLUDES
+		/*****************************************************
+		*	Series 60 Customer / ETel
+		*	Series 60  ETel API
+		*****************************************************/
+#include <etelmm.h>
+
+#include "CbsCommon.h"
+#include "CbsReceiverTypes.h"
+#include "CCbsMessage.h"
+
+
+// CLASS DECLARATION
+
+/**
+*  CCbsRecWcdmaMessage represents a WCDMA message page generated by 
+*   CCbsRecEtelMonitor.
+*
+*  CCbsRecWcdmaMessage is constructed from a CB message page received from 
+*   EPOC Telephony Server.
+*/
+class CCbsRecWcdmaMessage : public CCbsMessage
+    {
+    public:        // Constructors and Destructors
+        /**
+        *   Constructs a new CCbsRecMessage based on TDes8&
+        *   (which is a descriptor) received from EPOC Telephony Server.
+        *   
+        *   @param  aMessagePage        Source message descriptor
+        *   @param  aAttributes         Message attributes
+        *   @return                     A new instance of CCbsRecWcdmaMessage
+        */
+        static CCbsRecWcdmaMessage* NewL( const TDes8& aMessagePage,
+            const RMobileBroadcastMessaging::TMobileBroadcastAttributesV2& aAttributes );
+
+        /**
+        *   Constructs a new CCbsRecMessage based on TDes8&
+        *   (which is a descriptor) received from EPOC Telephony Server.
+        *   
+        *   @param  aMessage        Source message
+        *   @return                 A new instance of CCbsRecWcdmaMessage
+        */
+        static CCbsRecWcdmaMessage* NewL( const CCbsMessage& aMessage );        
+
+        /**
+        *   Destructor
+        */
+        ~CCbsRecWcdmaMessage();
+
+    public:
+        /**
+        *   Returns the page number of this page in the message page sequence,
+        *
+        *   @return                     Page number of this page.
+        */
+        TUint ThisPage() const;
+
+        /**
+        *   Returns the total number of pages in this page's message.
+        *
+        *   @return                     Total number of pages in this message
+        */
+        TUint TotalPages() const;
+
+    public: // from CCbsMessage
+
+        /**
+        *   Appends another message's content to this message's content.
+        *
+        *   @return                     Type of this message
+        */
+        TInt MessageType() const;
+
+    private:
+
+        /**
+        *   2nd-phase constructor.
+        *
+        *   @param aMessagePage         Message page
+        *   @param aAttributes          Message attributes
+        */
+        void ConstructL( const TDes8& aMessagePage,
+            const RMobileBroadcastMessaging::TMobileBroadcastAttributesV2& aAttributes );
+
+        /**
+        *   2nd-phase constructor.
+        *
+        *   @param aMessage             Message page
+        */
+        void ConstructL( const CCbsMessage& aMessage );
+        
+        /**
+        *   Default constructor
+        */
+        CCbsRecWcdmaMessage( const RMobileBroadcastMessaging::TMobileBroadcastAttributesV2& aAttributes );
+
+        /**
+        *   Default constructor
+        */
+        CCbsRecWcdmaMessage();
+
+    private:    // prohibited functions and operators
+        
+        // Copy constructor: NewL() used instead
+       CCbsRecWcdmaMessage( const CCbsRecWcdmaMessage& );
+
+        // Assignment operator
+       CCbsRecWcdmaMessage& operator=( const CCbsRecWcdmaMessage& );
+
+    private:    // data
+
+        // Message type (CBS message, schedule message, CBS41 message)
+        TUint8 iMessageType;
+
+        // WCDMA message attributes
+        RMobileBroadcastMessaging::TMobileBroadcastAttributesV2 iWcdmaAttributes;
+        
+    };
+
+#endif // CCBSRECWCDMAMESSAGE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CCbsReceiverHelper.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,275 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsReceiverHelper class.
+*
+*/
+
+
+#ifndef     CCBSRECEIVERHELPER_H
+#define     CCBSRECEIVERHELPER_H
+
+// INCLUDES
+#include <e32base.h>
+#include "CbsCommon.h"
+
+// FORWARD DECLARATIONS
+class CCbsRecMessage;
+class CCbsServer;
+class CCbsDbImp;
+class CVwsSessionWrapper;
+class CCbsMessage;
+
+
+//  CLASS DECLARATION 
+
+/**
+*   CCbsReceiverHelper gets the messages from the receiver and 
+*   sends them to the database. All received messages are
+*   sent to CCbsReceiverHelper instance by CCbsRecEtel.
+*   This class makes subscription and existence checks
+*   to these messages and also implements topic detection
+*   feature.
+*/
+class CCbsReceiverHelper : public CBase
+    {
+    public:     // New functions
+        
+        /**
+        *   Creates an instance of the class.
+        *
+        *   @param  aDatabase           Database object.
+        *   @return                     New CCbsReceiverHelper instance.
+        */  
+         static CCbsReceiverHelper* NewL( CCbsDbImp& aDatabase );
+
+        /**
+        *   The destructor.
+        */            
+        ~CCbsReceiverHelper();
+
+        /**
+        *   Clears the topic detected counter.
+        */    
+        void ClearTopicsDetectedCounter();
+
+        /**
+        *   Returns the amount of detected topics.
+        *
+        *   @return                     The amount of detected topics.
+        */    
+        TUint TopicsDetected() const;
+
+        /**
+        *   This function is called when a message is received.
+        *
+        *   Assumptions;
+        *   1.  The message doesn't have it's permanent or read 
+        *       flags raised - method leaves with KErrNotSupported 
+        *       if this is the case. 
+        *   2.  If an index message (root or subindex) is passed as
+        *       a parameter, the language indication prefix, if any,
+        *       has been removed before HandleReceivedMessageL() is called.
+        *        
+        *   Assumption (2) holds because language indications are removed
+        *   by Receiver module in an instance of CCbsRecDecoder.
+        *
+        *   Exceptions:
+        *   KErrNoMemory                OOM occurred.
+        *   KErrNotSupported            aMessage's flags were invalid.
+        *   KErrAlreadyExists           aMessage is already stored in 
+        *                               the database.
+        *    
+        *   @param aMessage             Interface to get the information 
+        *                               about the message.
+        */
+        void HandleReceivedMessageL( CCbsMessage& aMessage );
+
+        /**
+        *   Checks if aMessage's topic is in the topic list.
+        *   If the topic detection is enabled and the aMessage's topic
+        *   is not in the list, the topic is added. The method
+        *   will then return ETrue. Otherwise EFalse is returned.
+        *
+        *   @param  aMessage            Message page.
+        *   @return                     ETrue, if topic added
+        */
+        TBool CheckForNewTopicL( const CCbsMessage& aMessage );
+
+        /**
+        *   Checks if aMessage's topic is subscribed and
+        *   if the message already exists in the database.
+        *   
+        *   Returns ETrue only if the message does not exist in the
+        *   database and the message's topic is subscribed.
+        *
+        *   @param  aMessage            Message page.
+        *   @return                     ETrue, if message can be received
+        */
+        TBool CheckForSubscriptionAndExistenceL( const CCbsMessage& aMessage );
+
+        /**
+        *   Checks if aMessage's language has been subscribed by the user.
+        *
+        *   ETrue is returned either if the language specified has been 
+        *   subscribed, message language is "Other" or the user has
+        *   preferred to receive messages of all languages.
+        *
+        *   @param  aMessage            Message page
+        *   @return                     ETrue, if message can be received
+        */
+        TBool LanguageOfMessageSubscribedL( const CCbsMessage& aMessage );
+
+        /**
+        *   Stores the CB topic (aNumber, aName) retrieved from 
+        *   SIM into the DB. If a topic of the same number already exists
+        *   in DB, does nothing.
+        *
+        *   @param aNumber              Number of the topic.
+        *   @param aName                Name of the topic.        
+        */
+        void AddSimTopicL( const TUint aNumber, const TDesC& aName );
+
+        /**
+        *   Returns a reference to the CCbsDbImp instance.
+        *
+        *   @return                     Main database object.
+        */
+        CCbsDbImp& Database() const;
+        
+        /**
+        *   Returns a reference to SIM Topic array
+        *
+        *   @return                     SIM Topic array.
+        */
+        CArrayFixFlat<TInt>& SimTopics() const;
+        
+        /**
+        *   Deletes a topic from the local SIM Topic array.
+        *
+        *   @param aNumber              Number of the topic.        
+        */
+        void DeleteFromSimTopicCache( const TUint16 aNumber );
+        
+        /**
+        *   Requests a notification to be launched when a message
+		*	arrives to a hotmarked topic.
+		*
+		*   @param aPlayTone            Should the message alert tone be
+		*                               played.
+        */
+        void LaunchMessageSoftNotificationL( const TBool aPlayTone );
+
+    private:
+
+        /**
+        *   The constructor.
+        *
+        *   @param aDatabase            Database object.
+        *   @param aServer              Server object.    
+        */
+        CCbsReceiverHelper( CCbsDbImp& aDatabase );
+
+        /**
+           Finalizes the construction.
+        */
+        void ConstructL();
+
+        /**
+        *   Handles detected topic.
+        *
+        *   @param  iTopicNumber        The number of the topic detected.
+        *   @return                     ETrue if the detected topic is added 
+        *                               to the topic list. EFalse otherwise.
+        */
+        TBool HandleTopicDetectedL( const TCbsDbTopicNumber& iTopicNumber );
+
+        /**
+        *   Handles index message. Parses topic identities and
+        *   stores them into the database.
+        *
+        *   Leave reasons:
+        *   KErrNoMemory                OOM occured.
+        *   KErrNotSupported            Index message was of unsupported 
+        *                               version.
+        *   KErrCorrupt                 Parsing of the index message failed.
+        *
+        *   @param  aContents           Index message body.
+        *   @param  aIsChildSubIndex    ETrue, if child subindex. 
+        *                               EFalse, if root index.
+        *   @return                     Result code.
+        */
+        void HandleIndexMessageL( const TDesC& aContents, 
+            const TBool aIsChildSubIndex );
+
+        /**
+        *   Parses all topic identities from aText which is assumed to be
+        *   an index message's content.
+        *        
+        *   Leave code values:
+        *   KErrNoMemory                Storing of topic identities failed 
+        *                               because of insufficient memory.
+        *   KErrNotSupported            Index message identifies itself as 
+        *                               an index of unknown type to the server.
+        *   KErrCorrupt                 A problem was encountered while parsing
+        *                               the index message content.
+        *   KErrAlreadyExists           Index message contained two or more 
+        *                               identities which shared the same topic 
+        *                               number.
+        *
+        *   @param aText                Index message body
+        */
+        void ParseTopicIdentitiesL( const TDesC& aText );
+
+        /**
+        *   Requests a notification to be launched about a message that 
+        *   requires immediate displaying.
+        *
+        *   @param  aMessage            Message to be displayed
+        */
+        void LaunchMessageImmediateDisplay( const TCbsDbMessage& aMessage );
+        
+        /**
+        * Turn lights on
+        */
+        void TurnLightsOn();
+        
+        /**
+        * Play Cbs tone.
+        */
+        void PlayCbsTone();
+
+    private:    // Member variables
+
+        // Reference to the database
+        CCbsDbImp& iDatabase;                
+
+        // Number of topics detected after startup.
+        TUint iTopicsDetected;
+
+        CArrayFixFlat<TInt>* iSimTopics;
+        
+        // View server session wrapper.
+        // Used to launch CBS UI application on arrival of
+        // CB messages designated "requiring immediate display".
+        CVwsSessionWrapper* iVwsSession;
+
+        // Local variation bits, fetched from CenRep
+        TInt iLVBits;
+    };
+
+#endif      //  CCBSRECEIVERHELPER_H   
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CCbsSatRefresh.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,115 @@
+/*
+* 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:  Monitors sat refresh for cbsserver
+*
+*/
+
+
+
+#ifndef CCBSSATREFRESH_H
+#define CCBSSATREFRESH_H
+
+//  INCLUDES
+#include <etelmm.h>
+#include <msatrefreshobserver.h>
+
+
+// FORWARD DECLARATIONS
+//class CNWGsmMessageHandler;
+class RSatSession;
+class RSatRefresh;
+class RSystemAgent;
+class CCbsServer;
+
+// CLASS DECLARATION
+
+/**
+*  Monitors sat refresh for cbsserver
+*
+*/
+class CCbsSatRefresh : public CBase, public MSatRefreshObserver
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CCbsSatRefresh* NewL( CCbsServer& aCbsServer );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CCbsSatRefresh();
+
+              
+    private:
+
+        /**
+        * Executes the NotifyNetworkConnectionFailure function.
+        * 
+        */
+        void IssueRequest();
+        
+          /**
+        * C++ default constructor.
+        */
+        CCbsSatRefresh( CCbsServer& aCbsServer );
+                                  
+                                  
+          /**
+        * Refresh query. Client should determine whether it allow the
+        * refresh to happen. In this method the client should not close or
+        * cancel the RSatRefresh subsession.
+        * @since 2.6
+        * @param aType Refresh type.
+        * @param aFiles Elementary files which are to be changed. 
+        * May be zero length. 
+        * @return ETrue to allow refresh, EFalse to decline refresh.
+        */
+        TBool AllowRefresh( TSatRefreshType aType, const TSatRefreshFiles& aFiles );
+
+         /**
+        * Notification of refresh. In this method the client should not close 
+        * or cancel the RSatRefresh subsession.
+        * @since 2.6
+        * @param aType Type of refresh which has happened.
+        * @param aFiles List of elementary files which has been changed. 
+        * May be zero length.
+        */
+        void Refresh( TSatRefreshType aType, const TSatRefreshFiles& aFiles );
+        
+        
+         /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+        
+    private:    // Data
+    // Reference to cbsserver
+	CCbsServer& iCbsServer;
+	// Sat session connection.
+	RSatSession* iSatSession;
+	// Sat refresh connection
+	RSatRefresh* iSatRefresh;
+	// System agent connection
+	RSystemAgent* iSystemAgent;
+   	// Is refresh allowed to do.
+    TBool iAllowRefresh;	
+    };
+
+#endif      // CCbsSatRefresh_H   
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CCbsScheduler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsScheduler class.
+*
+*/
+
+
+#ifndef CCBSSCHEDULER_H
+#define CCBSSCHEDULER_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CCbsServer;
+
+//  CLASS DECLARATION 
+
+/**
+*   CbsServer includes a scheduler of it's own to simplify
+*   client request handling code. All active object leaves are
+*   handled in function Error(). The behaviour of Error()
+*   depends on whether there is an outstanding client request
+*   or not: it will tell the client the reason for inability
+*   to handle the client request. It will also panic the
+*   client if the descriptor passed to the server was malformed.
+*   Finally, a panic is raised if the error does not originate
+*   from the server itself.
+*
+*   See Tasker: Professional Symbian Programming, Chapter 20
+*   for details.
+*/
+class CCbsScheduler : public CActiveScheduler
+    {
+public:     // new
+
+    /**
+    *   Default constructor  
+    */
+    CCbsScheduler();
+            
+    /**
+    *   Gives a pointer of the current CCbsServer instance
+    *   to the scheduler.
+    *
+    *   @param      aServer     The current server pointer
+    */
+    void SetServer( CCbsServer* aServer );
+
+public:     // from CActiveScheduler
+
+    /**
+    *   Overridden to handle leaves in request functions and
+    *   unexpected situations.
+    *
+    *   @param      aError      Error code, 
+    *                           see Symbian OS system documentation.
+    */
+    void Error( TInt aError ) const;
+
+private:    // prohibited operators and functions
+
+    // Copy constructor
+    CCbsScheduler( const CCbsScheduler& );
+
+    // Assignment operator
+    CCbsScheduler& operator=( const CCbsScheduler& );
+
+private:    // data
+
+    // Ref: server instance
+    CCbsServer* iServer;
+    };
+
+#endif // CCBSSCHEDULER_H   
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CCbsServer.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,256 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsServer class
+*    
+*                Represents CBS Server. Derives from EPOC client-server framework base
+*                class CServer.
+*
+*/
+
+
+
+
+#ifndef     CCBSSERVER_H
+#define     CCBSSERVER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "CbsCommon.h"
+#include "MCbsDbTopicListObserver.H"
+
+//  CONSTANTS  
+// This is the priority of the server active object.
+const TInt KCbsServerPriority = CActive::EPriorityStandard;
+  
+//  FORWARD DECLARATIONS
+#ifdef __WINS__
+// Required to satify EPOCEXE target type build criteria
+IMPORT_C TInt WinsMain( TAny * );
+#endif
+
+class CObjectConIx;
+class CCbsDbImp;
+class CCbsRecEtel;
+class CCbsReceiverHelper;
+class CCbsObject;
+class CCbsSatRefresh;
+class CCbsShutdownMonitor;
+
+//  CLASS DECLARATION 
+
+/**
+*   CCbsServer is the core part of CBS Server.
+*    
+*   CCbsServer allocates all server-side resources on startup and
+*   creates CCbsSession objects in response to client requests.
+*/
+class CCbsServer : public CServer2
+    {
+    public:     // New functions
+        /**
+        *   Creates an instance of the class.
+        *
+        *   The name of the server will be KCbsServerName as specified 
+        *   in CbsServerConstants.h.
+        *
+        *   After the call is made, the server is responsible of releasing 
+        *   both database and receiver during destruction. 
+        *
+        *   @return                     The method returns a pointer to the 
+        *                               new CCbsServer object.
+        */
+        static CCbsServer* NewL();
+        
+        /**
+        *   Destructor.
+        */
+        ~CCbsServer();
+
+        /**
+        *   Creates a new session object container.
+        *
+        *   It is the responsibility of the caller to delete the object 
+        *    container, when it is no longer used.
+        *
+        *   @return                     A pointer to the new object container.
+        */
+        CObjectCon* NewContainerL();
+
+        /**
+        *   Returns a reference to the database.
+        *            
+        *   @return                     Database object
+        */
+        CCbsDbImp& Database();
+
+        /**
+        *   Returns a reference to the receiver.
+        *        
+        *   @return                     Receiver object
+        */
+        CCbsRecEtel& Receiver();
+
+        /**
+        *   Returns the total number of detected (via topic detection feature)
+        *   topics and then clears the counter.
+        *
+        *   @return                     Number of detected topics.
+        */
+        TInt TotalTopicsDetected();
+
+        /**
+        *   Panics the client.
+        *
+        *   @param                      Reason of panic
+        */
+        void PanicClient( TInt aPanic ) const;
+
+        /**
+        *   Shuts the server down.
+        */  
+        void Shutdown();
+
+        /**
+        *   Returns the object container index reference
+        *
+        *   @return                     Container index reference
+        */  
+        CObjectConIx& ContainerIndex();
+
+        /**
+        *   Returns the current message
+        *
+        *   @return                     Current IPC message
+        */
+        const RMessage2 ServerMessage() const;
+
+        /**
+        *   Returns an object by handle.
+        *
+        *   @param  aHandle         Handle to the object.
+        *   @return                 Pointer to the object or, if there is no
+        *                           such object, NULL.
+        */
+        CCbsObject* ReturnObjectByHandle( TUint aHandle );
+
+        /**
+        *   Deletes a subsession
+        *
+        *   @param  aHandle         Handle to the object.
+        */
+        void DeleteObjectByHandle( TUint aHandle );
+
+        /**
+        *   Returns the object container
+        *
+        *   @@return                The object container
+        */
+        CObjectCon& Container();
+
+        /**
+        *   Returns the object index
+        *
+        *   @@return                The object index
+        */
+        CObjectIx& ObjectIx();
+        
+        /**
+        *   Reloads the SIM topics in case of SAT/SIM refresh
+        *        
+        */
+        void ReLoadSimTopicsL();
+
+    public:     // From CServer2      
+        
+        /**
+        *   Creates a new session (an instance of CCbsSession).
+        *
+        *   The method is meant to be called by the Symbian OS server framework and 
+        *   so it should not be used in any other case.
+        *
+        *   The method leaves if the version given as parameter and the server
+        *   version differ.
+        *
+        *   @param  aVersion            Expected version of CBS Server.
+        *   @return                     New session object.
+        */
+        CSession2* NewSessionL( const TVersion& aVersion, const RMessage2& aMessage ) const;
+        
+    private:
+
+        /**
+        *   Constructor.
+        *
+        *   @param  aPriority           Priority of the server. 
+        */
+        CCbsServer( TInt aPriority );
+
+        /**
+        *   Finalizes the construction by creating subcomponents
+        *   and synchronizing DB and receiver states.
+        */
+        void ConstructL();
+
+        /**
+        *   Initializes the receiver
+        */
+        void InitReceiverL();
+
+        /**
+        *   Initializes topic detection status.
+        */
+        void InitTopicDetectionStatusL();
+
+    private:    // Prohibited operators and functions
+
+        // Copy constructor
+        CCbsServer( const CCbsServer& );
+
+        // Assignment operator
+        CCbsServer& operator=( const CCbsServer& );
+
+    private:    // Data
+
+        // Own: The container index, that is required to create 
+        // object containers.
+        CObjectConIx* iContainerIx;
+        
+        // Own: database object.
+        CCbsDbImp* iDatabase;
+        
+        // Own: receiver object.
+        CCbsRecEtel* iReceiver;
+
+        // Own: gateway to the receiver.
+        CCbsReceiverHelper* iHelper;
+
+        // Own: PubSub shutdown monitor
+        CCbsShutdownMonitor* iShutdownMonitor;
+
+        // Own: the object container that contains the subsessions.
+        CObjectCon* iContainer;
+
+        // Own: object index that is used to find a subsession object 
+        // by it's handle.
+        CObjectIx* iIndex;
+        
+        // Sat refresh listener
+        CCbsSatRefresh* iSatRefresh;
+    };
+
+#endif      //  CCBSSERVER_H
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CCbsSession.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,184 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsRecCollector class.
+*    
+*                CCbsSession class represents a server-side CbsClient/CbsMcnClient session.
+*
+*/
+
+
+
+#ifndef     CCBSSESSION_H
+#define     CCBSSESSION_H
+
+// INCLUDES
+#include <e32base.h>
+#include "CbsCommon.h"
+
+// FORWARD DECLARATIONS
+class CCbsServer;
+class CCbsObject;
+class CObjectConIx;
+
+//  CLASS DECLARATION 
+
+/**
+*   This class represents a server-side session.
+*
+*   The instances of the class are responsible of handling 
+*   the requests of client-side RCbs and RCbsMcnSession objects.
+*
+*   This class contains handlers for opening subsessions and
+*   retrieving some general CBS information.
+*
+*   Client will be panicked, if a request is invalid.
+*/
+class   CCbsSession : public CSession2
+    {
+    public:     // New functions
+        /**
+        *   Creates a new instance of the class.
+        *
+        *   @param  aServer         Server
+        *   @return                 New CCbsSession instance
+        */
+        static CSession2* NewL( CCbsServer& aServer );
+
+        /**
+        *   Destructor.
+        */
+        ~CCbsSession();
+
+        /**
+        *   Finds the appropriate message service method and calls it to 
+        *   handle the request.
+        *
+        *   @param  aMessage        Handle to the message that 
+        *                           contains the request.
+        */
+        void DispatchMessageL( const RMessage2& aMessage );
+
+        /**
+        *   Panics the client.
+        *
+        *   @param  aPanic          Identifies the reason for panic.
+        */
+        void PanicClient( TCbsSessionPanic aPanic ) const;
+
+        /**
+        *   Returns the number of new topics detected. 
+        *
+        *   The counter will be reset after a call.
+        *
+        *   @return                 Number of topics detected.
+        */
+        TInt TotalTopicsDetected();
+
+        /**
+        *   Returns the last message arrived from the client
+        *
+        *   @return                 Current message
+        */
+        RMessage2& Message();
+
+        CCbsServer& Server();
+
+    public:     // From CSession2
+        
+        /**
+        *   Handles the received message.
+        *
+        *   The method simply calls DispatchMessageL (see above) under
+        *   trap harness. 
+        *
+        *   @param  aMessage        Handle to the message.
+        */
+        void ServiceL( const RMessage2& aMessage );
+    
+    private:
+
+        /**
+        *   Constructor.
+        *
+        *   @param  aServer         Reference to the server.
+        */
+        CCbsSession( CCbsServer& aServer );
+
+        /**
+        *   Finalizes the construction.
+        */
+        void ConstructL();
+
+        /**
+        *   Handles the session-based requests.
+        *
+        *   @param  aMessage        A handle to the message.
+        *   @return                 ETrue if the request was handled in 
+        *                           the main session.
+        */
+        TBool HandleSessionRequestsL( const RMessage2& aMessage );
+
+        /**
+        *   Create a new subsession, settings, for the session.
+        */
+        void NewSettingsL();
+
+        /**
+        *   Create a new subsession, topic list, for the session.
+        */
+        void NewTopicListL();
+
+        /**
+        *   Create a new subsession, topic collection, for the session.
+        */
+        void NewTopicCollectionL();
+
+        /**
+        *   Create a new subsession, topic messages, for the session.
+        */
+        void NewTopicMessagesL();
+
+        /**
+        *   Create a new MCN subsession.
+        */
+        void NewMcnSubsessionL();
+
+        /**
+        *   Return the current cell info message to the client.
+        */ 
+        void GetCurrentMcnInfoL();        
+
+    private:    // Data
+        
+        /**
+        *   Reference to CCbsServer object. 
+        *   iServer is a private member of CSharableSession so
+        *   we define a new name for CCbsServer pointer.
+        */
+        CCbsServer& iCbsServer;
+
+
+        /** 
+        *   The last message arrived from the client
+        *   
+        */
+        RMessage2 iCurrentMessage;
+
+    };
+
+#endif      //  CCBSSESSION_H   
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CCbsSetFilterSettingHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsSetFilterSettingHandler class
+*
+*/
+
+
+#ifndef     CCBSSETFILTERSETTINGHANDLER_H
+#define     CCBSSETFILTERSETTINGHANDLER_H
+
+//  INCLUDES
+		/*****************************************************
+		*	Series 60 Customer / ETel
+		*	Series 60  ETel API
+		*****************************************************/
+#include <etelmm.h>
+#include "CbsServerConstants.h"
+
+//  FORWARD DECLARATIONS
+class CCbsRecEtel;
+class CCbsRecEtelMonitor;
+class MCbsEtelMessaging;
+
+//  CLASS DECLARATION 
+
+/**
+*   Handles the SetFilterSetting command.
+*
+*/
+class CCbsSetFilterSettingHandler : public CActive
+    {
+    public:     // New functions
+
+        /**
+        *   Creates an instance of the class.
+        *
+        *   @param    aEtel             A reference to the receiver
+        *   @param    aMessaging        A reference to the messaging object
+        *   @return                     A new instance of 
+        *                               CCbsSetFilterSettingHandler
+        */
+        static CCbsSetFilterSettingHandler* NewL( CCbsRecEtel& aEtel, 
+            MCbsEtelMessaging& aMessaging );
+
+        /**
+        *   Destructor.
+        */
+        ~CCbsSetFilterSettingHandler();
+
+        /** 
+        *   Sets a new filter setting to EPOC Telephony server.
+        *
+        *   @param      aSetting        The new setting
+        */
+        void SetFilterSetting( 
+            RMobileBroadcastMessaging::TMobilePhoneBroadcastFilter aSetting );
+
+    private:    // From CActive
+
+        /**
+        *   Called when EPOC Telephony server has completed the SetFilterSetting operation.      
+        */
+        void RunL();
+
+        /**
+        *   Cancels an outstanding ReadCbsMessage request.
+        */
+        void DoCancel();
+        
+        /**
+        *   Is called if RunL() leaves.
+        *
+        *   @param    aError            Error code
+        *   @return                     Always KErrNone
+        */
+        TInt RunError( TInt aError );
+
+    private:
+
+        /**
+        *   The constructor.
+        *
+        *   @param  aEtel               CCbsRecEtel object.
+        *   @param  aMessaging          EPOC Telephony server messaging object.
+        */
+        CCbsSetFilterSettingHandler( CCbsRecEtel& aEtel, 
+            MCbsEtelMessaging& aMessaging );
+
+        /**
+        *   Finalizes the construction.
+        */
+        void ConstructL();
+
+    private:    // Data
+
+        // CCbsRecEtel instance to which CB messages are passed.
+        CCbsRecEtel& iEtel;
+                
+        // Messaging subsession.
+        MCbsEtelMessaging& iSmsMessaging;
+
+        // Type of broadcast id
+        RMobileBroadcastMessaging::TMobileBroadcastIdType iIdType;
+    };
+
+#endif      //  CCBSSETFILTERSETTINGHANDLER_H   
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CCbsSettings.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,196 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 server-side settings 
+*                subsession class.
+*
+*/
+
+
+
+#ifndef     CCBSSETTINGS_H
+#define     CCBSSETTINGS_H
+
+// INCLUDES
+#include "CCbsSession.h"
+#include "CCbsObject.h"
+#include "MCbsDbSettingsObserver.H"
+
+// FORWARD DECLARATIONS
+class CCbsDbImpSettings;
+class CCbsRecEtel;
+
+//  CLASS DECLARATION 
+
+/**
+*   The server-side CbsClient subsession for modifying settings.
+*/
+class   CCbsSettings
+        : public CCbsObject, public MCbsDbSettingsObserver
+    {
+    public:     // New functions
+        /**
+        *   Creates a new instance of the class.
+        *
+        *   @param  aSession        Session object
+        *   @param  aSettings       Database settings manager
+        *   @param  aReceiver       Receiver object
+        *   @return                 Pointer to a new instance of CCbsSettings
+        */
+        static CCbsSettings* NewL( CCbsSession& aSession, 
+                                   CCbsDbImpSettings& aSettings, 
+                                   CCbsRecEtel& aReceiver );
+
+        /**
+        *   Destructor.
+        */
+        ~CCbsSettings();
+
+    public:     // From CCbsObject
+        /**
+        *   Handle the requests for the object.
+        *
+        *   @param  aMessage        Message to be handled.
+        *   @return                 Indicates whether the message was handled.
+        */
+        TBool HandleRequestsL( const RMessage2& aMessage );
+
+    private:        // From MCbsDbSettingsObserver
+
+        /**
+        *   Called when the topic detection is changed.
+        */
+        void TopicDetectionStatusChangedIndL();
+
+        /**
+        *   Called when reception status is changed.
+        */
+        void ReceptionStatusChangedIndL();
+
+        /**
+        *   Called when preferred languages are changed.
+        */
+        void LanguagesChangedIndL();
+
+        /**
+        *   Called when time-limited reception status changed
+        */
+        void LimitedReceptionStatusChangedIndL();
+
+        /**
+        *   Called when clean up interval of read messages changed
+        */
+        void CleanupTimeChangedIndL();
+
+    private:
+        /**
+        *   Constructor.
+        *
+        *   @param  aSession        Session session object
+        *   @param  aSettings       Database settings manager
+        *   @param  aReceiver       Receiver
+        */
+        CCbsSettings( CCbsSession& aSession, 
+                      CCbsDbImpSettings& aSettings, 
+                      CCbsRecEtel& aReceiver );
+
+        /**
+        *   Finalizes construction.
+        */
+        void ConstructL();
+
+        /**
+        *   Close the subsession.
+        *
+        *   Note that the method will delete itself, so the object is no
+        *   longer valid after the call.
+        */
+        void CloseSettings();
+
+        /**
+        *   Return the current reception status to the client.
+        */
+        void GetReceptionStatusL();
+
+        /**
+        *   Change the reception status to the requested one.
+        */
+        void SetReceptionStatusL();
+
+        /**
+        *   Return the current topic detection status to the client.
+        */
+        void GetTopicDetectionStatusL();
+
+        /**
+        *   Change the topic detection status to the requested one.
+        */
+        void SetTopicDetectionStatusL();
+
+        /**
+        *   Return the preferred languages to the client.
+        */
+        void GetLanguagesL();
+
+        /**
+        *   Change the preferred languages to the requested.
+        */
+        void SetLanguagesL();
+
+        /**
+        *   Make request to notify when settings are changed.
+        */
+        void NotifySettingsChanged();
+
+        /**    
+        *   Cancel the request to notify when settings are changed.
+        */
+        void NotifySettingsChangedCancel();
+        
+        /**
+        *   Notifies the client (if there is a pending request).
+        *   
+        *   @param  aEvent          Identifies the type of request that 
+        *                           has happened.
+        */
+        void NotifyClientL( TCbsSettingsEvent aEvent );
+
+    private:    // Prohibited operators and functions
+
+        // Copy constructor
+        CCbsSettings( const CCbsSettings& );
+
+        // Assignment operator
+        CCbsSettings& operator=( const CCbsSettings& );
+
+    private:    // Data
+        
+        // Reference to the database settings manager
+        CCbsDbImpSettings& iSettings;
+
+        // Reference to the receiver
+        CCbsRecEtel& iReceiver;
+
+        // Indicates whether iMessage is a valid message; that is, there
+        // is a pending notify request.        
+        TBool iIsMessage;
+
+        // Message of the pending notify request, if available 
+        RMessage2 iMessage;
+    };
+
+#endif      //  CCBSSETTINGS_H   
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CCbsShutdownMonitor.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,97 @@
+/*
+* 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:  This file contains the header file of the CCbsShutdownMonitor class
+*    
+*
+*/
+
+
+#ifndef     CCBSSHUTDOWNMONITOR_H
+#define     CCBSSHUTDOWNMONITOR_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CCbsServer;
+
+//  CLASS DECLARATION 
+
+/**
+*  The CCbsShutdownMonitor instance listens to 
+*  shutdown signal via Publish and Subscribe. On device shutdown,
+*  the listener stops server operation by stopping the active scheduler.
+*  CbsServer will then be terminated. 
+*/
+class CCbsShutdownMonitor : public CActive
+    {
+    public:     // New functions
+
+        /**
+        *   Creates an instance of the class.
+        *
+        *   @param  aServer     Server reference
+        *   @return             A new instance of CCbsShutdownMonitor
+        */
+        static CCbsShutdownMonitor* NewL( CCbsServer& aServer );
+
+        /**
+        *   Destructor.
+        */
+        ~CCbsShutdownMonitor();
+
+        /** 
+        *   Reissues the Subscribe request.
+        */
+        void IssueRequest();
+
+    private:    // From CActive
+
+        /**
+        *   Gets called when the system state changes.
+        */
+        void RunL();
+
+        /**
+        *   Cancels an outstanding Subscribe request.
+        */
+        void DoCancel();
+
+    private:
+
+        /**
+        *   The constructor.
+        *
+        */
+        CCbsShutdownMonitor( CCbsServer& aServer );
+
+        /**
+        *   Finalizes the construction.
+        */
+        void ConstructL();
+      
+    private:    // Data
+        
+        // PubSub connection
+        RProperty iProperty;
+        
+        // Server reference
+        CCbsServer& iServer;
+    };
+
+#endif      //  CCBSSHUTDOWNMONITOR_H   
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CCbsTopicCollection.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,167 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsTopicCollection class.
+*    
+*                The server-side topic collection subsession class.
+*
+*/
+
+
+
+#ifndef     CCBSTOPICCOLLECTION_H
+#define     CCBSTOPICCOLLECTION_H
+
+//  INCLUDES
+
+#include "CCbsObject.h"
+#include "MCbsDbTopicCollectionObserver.H"
+
+//  FORWARD DECLARATIONS
+
+class CCbsSession;
+class CCbsDbImpTopicCollection;
+class CCbsDbImpTopicList;
+
+//  CLASS DECLARATION 
+
+/**
+*   CCbsTopicCollection is the server-side subsession object for handling
+*   CbsClient requests on topic identities of index messages.
+*/
+class CCbsTopicCollection : public CCbsObject, 
+    public MCbsDbTopicCollectionObserver
+    {
+    public:     // New functions
+
+        /**
+        *   Creates a new instance of the class.
+        *
+        *   @param  aSession        Session.
+        *   @param  aCollection     Topic collection manager.
+        *   @param  aList           Current topic list.
+        *   @return                 The new instance of the class.
+        */
+        static CCbsTopicCollection* NewL( CCbsSession& aSession, 
+            CCbsDbImpTopicCollection& aCollection, 
+            CCbsDbImpTopicList& aList );
+
+        /**
+        *   Destructor.
+        */
+        ~CCbsTopicCollection();
+
+    public:     // From CCbsObject
+        
+        /**
+        *   Handles the requests for the subsession.
+        *
+        *   @param  aMessage        Message of the client
+        *   @return                 ETrue, if the request was handled here
+        */
+        TBool HandleRequestsL( const RMessage2& aMessage );
+
+    private:        // From MCbsDbTopicCollectionObserver
+
+        /**
+        *   Called whenever topic collection contents are changed.
+        */
+        void TopicCollectionContentsChangedInd();
+
+    private:
+
+        /**
+        *   Constructor.
+        *
+        *   @param  aSession        Session
+        *   @param  aCollection     Topic collection
+        *   @param aList            Current topic list
+        */
+        CCbsTopicCollection( CCbsSession& aSession, 
+            CCbsDbImpTopicCollection& aCollection, 
+            CCbsDbImpTopicList& aList );
+
+        /**
+        *   Finalizes the construction.
+        */
+        void ConstructL();
+
+        /**
+        *   Closes the subsession.
+        */
+        void CloseCollection();
+
+        /**
+        *   Returns the total amount of topic info records.
+        */
+        void GetTopicCountL();
+
+        /**
+        *   Returns a topic info structure to the client.
+        */
+        void GetTopicInfoL();
+
+        /**
+        *   Returns a truth value determining if the given topic already 
+        *   exists in the current topic list.
+        */
+        void TopicInListL();
+
+        /**
+        *   Sets up a notification so that the client will be notified when 
+        *   the collecton is changed.
+        */
+        void NotifyOnChange();
+
+        /**
+        *   Cancels the pending request.
+        */
+        void NotifyOnChangeCancel();
+
+        /**
+        *   Notifies the client
+        */
+        void Notify();
+
+    private:    // Prohibited operators and functions
+
+        // Copy constructor
+        CCbsTopicCollection( const CCbsTopicCollection& );
+
+        // Assignment operator
+        CCbsTopicCollection& operator=( const CCbsTopicCollection& );
+
+    private:    // Data
+
+        // Topic collection manager.
+        CCbsDbImpTopicCollection& iCollection;
+
+        /**
+        *   The current topic list which is needed to tell client
+        *   only of topics not included in the topic list.
+        */
+        CCbsDbImpTopicList& iTopicList;
+        
+        // Indicates whether there is a pending notify request.
+        TBool iIsMessage;
+
+        // In case there is a pending notify request, this is the request.
+        RMessage2 iMessage;
+
+    };
+
+#endif      //  CCBSTOPICCOLLECTION_H
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CCbsTopicList.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,267 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsTopicList class.
+*    
+*                The server-side topic list subsession class.
+*
+*/
+
+
+
+#ifndef     CCBSTOPICLIST_H
+#define     CCBSTOPICLIST_H
+
+// INCLUDES
+#include "CCbsObject.h"
+#include "MCbsDbTopicListObserver.H"
+
+// FORWARD DECLARATIONS
+class CCbsSession;
+class CCbsRecEtel;
+class CCbsDbImpTopicList;
+
+//  CLASS DECLARATION 
+
+/**
+*   Subsession for managing the topic list.
+*/
+class   CCbsTopicList
+        : public CCbsObject, public MCbsDbTopicListObserver
+    {
+    public:     // New functions
+        /**
+        *   Creates a new instance of the class.
+        *
+        *   @param  aSession        Session
+        *   @param  aTopicList      Topic list
+        *   @param  aReceiver       Receiver.
+        *   @return                 The new instance of CCbsSettings.
+        */
+        static CCbsTopicList* NewL( CCbsSession& aSession, 
+                                    CCbsDbImpTopicList& aTopicList, 
+                                    CCbsRecEtel& aReceiver );
+
+        /**
+        *   Destructor.
+        */
+        ~CCbsTopicList();
+
+    public:     // From CCbsObject
+
+        /**
+        *   Handle the requests for the object. 
+        *
+        *   @param  aMessage        The message to be handled
+        *   @return                 ETrue, if the request was handled here
+        */
+        TBool HandleRequestsL( const RMessage2& aMessage );
+
+    private:    // From MCbsDbTopicListObserver
+
+        /**
+        *   Called when the topic list is initialized.
+        */
+        void TopicListInitializedIndL();
+
+        /**
+        *   Called whenever a topic is created. If necessary, 
+        *   the client will be notified.
+        *
+        *   @param  aHandle         A handle to the topic.    
+        */
+        void TopicAddedIndL( const TCbsDbTopicNumber& aNumber );
+
+        /**
+        *   Called whenever a topic is deleted. If necessary, 
+        *   the client will be notified.
+        *
+        *   @param  aHandle         A handle to the topic.
+        */
+        void TopicDeletedIndL( const TCbsDbTopicNumber& aNumber );
+
+        /**
+        *   Called whenever a topic is modified. If necessary, 
+        *   the client will be notified.
+        *
+        *   @param  aHandle         A handle to the topic.
+        */
+        void TopicModifiedIndL( const TCbsDbTopicNumber& aNumber );
+
+        /**
+        *   Called whenever a new message has been received. 
+        *   If necessary, the client will be notified.
+        *
+        *   @param  aHandle         A handle to the topic.
+        */
+        void TopicNewMessageReceivedIndL( const TCbsDbMessageHandle& aHandle );
+
+    private:
+        /**
+        *   Constructor.
+        *
+        *   @param  aSession        Session
+        *   @param  aTopicList      Topic list manager
+        *   @param  aReceiver       Receiver
+        */
+        CCbsTopicList( CCbsSession& aSession, 
+                       CCbsDbImpTopicList& aTopicList, 
+                       CCbsRecEtel& aReceiver );
+
+        /**
+        *   Finalizes construction.
+        */
+        void ConstructL();
+        
+        /**
+        *   Closes and destroys the subsession.
+        *
+        *   Note that after the call has completed, the object is no longer
+        *   valid. It is also left for the callee's task to complete 
+        *   the request.
+        */
+        void CloseTopicList();
+
+        /**
+        *   Returns the total number of topics to the client.
+        */
+        void GetTopicCountL();
+
+        /**
+        *   Returns the requested topic to the client.
+        */
+        void GetTopicL();
+
+        /**
+        *   Finds a topic by number and returns it to the client.
+        */
+        void FindTopicByNumberL();
+
+        /**
+        *   Deletes a topic by its number and returns it to the client.
+        */
+        void DeleteTopicL();
+
+        /**
+        *   Changes a topic name and number.
+        */
+        void ChangeTopicNameAndNumberL();
+        
+        /**
+        *   Changes topic subscription status.
+        */
+        void ChangeTopicSubscriptionStatusL();
+            
+        /**
+        *   Changes topic hotmark status.
+        */
+        void ChangeTopicHotmarkStatusL();
+
+        /**
+        *   Adds a topic to the list.
+        */
+        void AddTopicL();
+
+        /**
+        *   Sets up a pending notification request.
+        */
+        void NotifyOnEvent();
+
+        /**
+        *   Cancels a pending notification request.
+        */
+        void NotifyOnEventCancel();
+
+        /**
+        *   Returns the number of "new" topics to the client.
+        *
+        *   By new it is referred to topics that are created because of 
+        *   topic detection since last power on.
+        */
+        void GetNewTopicsCountL();
+
+        /**
+        *   Retrieves the number of the topic that was added
+        *   last to the topic list.
+        */
+        void GetLatestTopicNumberL();
+
+        /**
+        *   Returns the total amount of unread messages.
+        */
+        void GetUnreadMessageCountL();
+
+        /**
+        *   Returns a handle to the latest (that is not yet taken) 
+        *   hotmarked message handle.
+        */
+        void GetHotmarkedMessageHandleL();
+
+        /**
+        *   Returns the number of hotmarked, unread messages.
+        */
+        void GetUnreadHotmarkedMessageCountL();
+
+        /**
+        *   Deletes all topics.
+        */
+        void DeleteAllL();
+
+        /**
+        *   If there is a pending notify request, notifies 
+        *   the client.
+        *
+        *   @param  aEvent          The type of event
+        *   @param  aNumber         The topic which was affected
+        */
+        void NotifyClientL( TCbsTopicListEvent aEvent, 
+            TCbsTopicNumber aNumber );
+
+        /**
+        *   Retrieves and returns the numbers of topics that
+        *   precede and succeed the given topic in topic list.
+        *   
+        *   Also returns two flags indicating whether the
+        *   given topic is the first and/or the last topic in list.
+        */
+        void GetNextAndPrevTopicNumberL();
+
+    private:    // Prohibited operators and functions
+
+        // Copy constructor
+        CCbsTopicList( const CCbsTopicList& );
+
+        // Assignment operator
+        CCbsTopicList& operator=( const CCbsTopicList& );
+
+    private:    // Data
+
+        // Referebce to the topic list db.
+        CCbsDbImpTopicList& iTopicList;
+
+        // Reference to the receiver.
+        CCbsRecEtel& iReceiver;
+
+        // Indicates whether there is an active notify request.
+        TBool iIsMessage;
+
+        // The message for pending notify request.
+        RMessage2 iMessage;
+        
+    };
+
+#endif      //  CCBSTOPICLIST_H   
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CCbsTopicMessages.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,173 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsTopicMessages class
+*    
+*                This class represents the server-side topic messages subsession class.
+*
+*/
+
+
+
+#ifndef     CCBSTOPICMESSAGES_H
+#define     CCBSTOPICMESSAGES_H
+
+// INCLUDES
+#include "CCbsObject.h"
+
+// FORWARD DECLARATIONS
+class CCbsDbImpTopicMessages;
+class CCbsRecEtel;
+
+// CLASS DECLARATION 
+/**
+    It represents the server side topic messages subsession.
+*/
+class CCbsTopicMessages : public CCbsObject
+    {
+    public:     // New functions
+        /**
+        *   Creates a new instance of the class.
+        *
+        *   @param  aSession    Pointer to the session.
+        *   @param  aMessages   Pointer to the topic messages.
+        *   @param  aReceiver   Receiver.
+        *   @return             Pointer to a new instance of 
+        *                       CCbsTopicMessages.
+        */
+        static CCbsTopicMessages* NewL( CCbsSession& aSession, 
+                                        CCbsDbImpTopicMessages& aMessages,
+                                        CCbsRecEtel& aReceiver );
+
+        /**
+        *   Destructor.
+        */
+        ~CCbsTopicMessages();
+
+    public:     // From CCbsObject      
+        /**
+        *   Handle the requests for the object.
+        *
+        *   @param aMessage Message to be handled.
+        *   @return         It indicates whether the message was handled.
+        */
+        TBool HandleRequestsL( const RMessage2& aMessage );
+
+    private:
+        /**
+        *   Constructor.
+        *
+        *   @param  aSession    Pointer to the session.
+        *   @param  aMessages   Pointer to the topic messages.
+        *   @param  aReceiver   Receiver
+        */
+        CCbsTopicMessages( CCbsSession& aSession, 
+                           CCbsDbImpTopicMessages& aMessages,
+                           CCbsRecEtel& aReceiver );
+
+        /**
+        *   Finalizes construction.
+        */
+        void ConstructL();
+
+        /**
+        *   Closes the subsession.
+        */
+        void CloseTopicMessages();
+
+        /**
+        *   Returns the total amount of messages to the client.
+        */
+        void GetMessageCountL();
+
+        /**
+        *   Returns the requested message to the client.
+        */
+        void GetMessageL();
+
+        /**
+        *   Finds a message by its handle.
+        */
+        void FindMessageByHandleL();
+
+        /**
+        *   Returns message index in topic by message handle.
+        */
+        void GetMessageIndexByHandleL();
+
+        /**
+        *   Deletes a message.
+        *
+        *   @param  aReceiver   Receiver.
+        */    
+        void DeleteMessageL( const CCbsRecEtel& aReceiver );
+
+        /**
+        *   Saves a message.
+        *
+        *   @param  aReceiver   Receiver.
+        */
+        void SaveMessageL( const CCbsRecEtel& aReceiver );
+
+        /**
+        *   Locks a message.
+        */
+        void LockMessageL();
+
+        /**
+        *   Reads a message.
+        *
+        *   @param  aReceiver   Receiver.
+        */
+        void ReadMessageL( const CCbsRecEtel& aReceiver );
+
+        /**
+        *   Returns the content of the message to the client.
+        */
+        void GetMessageContentsL();
+
+        /**
+        *   Retrieves and returns the handles of messages that
+        *   precede and succeed the given message in topic.
+        *   
+        *   Also returns two flags indicating whether the
+        *   given message is the first and/or the last message in topic.
+        */
+        void GetNextAndPrevMsgHandleL();
+
+    private:    // Prohibited operators and functions
+
+        // Copy constructor
+        CCbsTopicMessages( const CCbsTopicMessages& );
+
+        // Assignment operator
+        CCbsTopicMessages& operator=( const CCbsTopicMessages& );
+
+    private:    // Data
+
+        // Pointer to the topic messages manager
+        CCbsDbImpTopicMessages& iMessages;
+        
+        // It is the locked message handle, or null message handle
+        // in case no message is locked.        
+        TCbsDbMessageHandle iLocked;
+        
+        // Receiver reference        
+        CCbsRecEtel& iReceiver;
+    };
+
+#endif      //  CCBSTOPICMESSAGES_H   
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CbsDbConstants.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Contains constants used by the database.
+*
+*/
+
+
+#ifndef     CBSDBCONSTANTS_H
+#define     CBSDBCONSTANTS_H
+
+// INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+
+// The default size of database observer array.
+const TInt KCbsDbObserverArraySize = 3;
+
+// The default size of the topic array.
+const TInt KCbsDbTopicArraySize = 50;
+
+// The maximum amount of received (not saved) messages in a topic.
+const TInt KCbsDbMaxReceivedMessages = 6;
+
+// The maximum amount of saved (not received) messages (all topics).
+const TInt KCbsDbMaxSavedMessages = 50;
+
+// Minimum valid topic number
+const TInt KCbsMinValidTopicNumber = 0;
+
+// Maximum valid topic number 
+const TInt KCbsMaxValidTopicNumber = 999;
+
+// Maximum number of characters in one message. 15 pages, 93 characters per page.
+const TUint KCbsMaxCharsInMessage = 15*93;
+  
+#endif      //  CBSDBCONSTANTS_H   
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CbsDebug.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2003-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 various macros to control debug printing with
+*                RDebug::Print() and insertion of file failure test code.
+*                NOTE-macro is provided to simplify printing warnings compile-time.
+*
+*/
+
+
+
+#ifndef CBS_DEBUG_H
+#define CBS_DEBUG_H
+
+/////////////////////////////////////////////////////////////////////////////
+// #Defines that control printing of additional information to debug stream.
+/////////////////////////////////////////////////////////////////////////////
+
+// Defining this enables debug printing with DEBUG(), DVAL() and DVAL2 macros.
+//#define CBS_PRINT_DEBUG_INFO
+
+// Defining this enables printing of headers of received messages
+//#define CBS_PRINT_MESSAGE_HEADER
+
+// Defining this makes message generators print the content of generated
+// messages in plaintext.
+//#define CBS_PRINT_MESSAGE_CONTENT
+
+// Defining this makes message generators print the content of generated 
+// messages in hexadecimal
+//#define CBS_PRINT_GENERATED_MESSAGES_IN_HEX
+
+// Prints topic file store structure to debug stream on startup.
+//#define CBS_PRINT_STORE_STRUCTURE 1
+
+// Prints additional info on generated messages
+//#define CBS_EMULATOR_PRINT_ADDITIONAL_INFO
+
+/////////////////////////////////////////////////////////////////////////////
+// #Defines that control compilation of file operation failure tests.
+/////////////////////////////////////////////////////////////////////////////
+
+// Defining this inserts User::Leave:s before file changes are commited.
+// Usage: FAIL_FILE_OP; forces a leave if DO_FILE_OP_FAILURE_TESTS is defined.
+
+// #define DO_FILE_OP_FAILURE_TESTS 1
+
+// Defining this inserts User::Leave:s to critical places trying to break 
+// the database integrity.
+// Usage: FAIL_FILE_OP_IN_A_NASTY_WAY; forces a leave if 
+// DO_NASTY_FILE_OP_FAILURE_TESTS is defined.
+
+// #define DO_NASTY_FILE_OP_FAILURE_TESTS 1
+
+// Defining this inserts User::Leave:s before file operations on startup.
+// Usage: FAIL_FILE_OP_STARTUP; forces a leave if 
+// DO_FILE_OP_FAILURE_STARTUP_TESTS is defined.
+
+//#define DO_FILE_OP_FAILURE_STARTUP_TESTS
+
+/////////////////////////////////////////////////////////////////////////////
+// Macros to simplify writing to the debug stream.
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef _DEBUG
+#ifdef CBS_PRINT_DEBUG_INFO
+#include <e32svr.h>
+#define DEBUG(s) RDebug::Print(_L(s))
+#define DVA(s, v) RDebug::Print(_L(s), v)
+#define DVA2(s, v1, v2) RDebug::Print(_L(s), v1, v2)
+#define DPRINT(s) RDebug::Print(s)
+
+#else // CBS_PRINT_DEBUG_INFO
+#define DEBUG(s) 
+#define DVA(s, v)
+#define DVA2(s, v1, v2)
+#define DPRINT(s)
+#endif // CBS_PRINT_DEBUG_INFO
+#else
+#define DEBUG(s)
+#define DVA(s, v)
+#define DVA2(s, v1, v2)
+#define DPRINT(s)
+#endif // _DEBUG
+
+/////////////////////////////////////////////////////////////////////////////
+// Macros to test file operation failures.
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef DO_FILE_OP_FAILURE_TESTS
+#define FAIL_FILE_OP User::Leave( KErrDiskFull )
+#else
+#define FAIL_FILE_OP
+#endif // DO_FILE_OP_FAILURE_TESTS
+
+#ifdef DO_NASTY_FILE_OP_FAILURE_TESTS
+#define FAIL_FILE_OP_IN_A_NASTY_WAY User::Leave( KErrDiskFull )
+#else
+#define FAIL_FILE_OP_IN_A_NASTY_WAY
+#endif // DO_FILE_OP_FAILURE_TESTS
+
+#ifdef DO_FILE_OP_FAILURE_STARTUP_TESTS
+#define FAIL_FILE_OP_STARTUP User::Leave( KErrDiskFull )
+#else
+#define FAIL_FILE_OP_STARTUP
+#endif // DO_FILE_OP_FAILURE_TESTS
+
+/////////////////////////////////////////////////////////////////////////////
+// NOTE is a convience macro to simplify printing warning texts compile-time.
+// The macro will print the filename and line number in question.
+// 
+// Usage: #pragma message(NOTE "Please remove this")
+/////////////////////////////////////////////////////////////////////////////
+#define STRINGIZE( L )             #L
+#define MAKESTRING( M, L )         M(L)
+#define LINENUMBER                 MAKESTRING( STRINGIZE, __LINE__ )
+#define NOTE                       __FILE__ "(" LINENUMBER ") : "
+
+#endif      // CBS_DEBUG_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CbsLogger.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,100 @@
+/*
+* 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:  Logger headerfile for CbsServer
+*
+*/
+
+
+
+#ifndef CBSLOGGER_H
+#define CBSLOGGER_H
+
+/* 
+-----------------------------------------------------------------------------
+    LOG SELECTION
+-----------------------------------------------------------------------------
+*/
+#ifndef _DEBUG
+    // UREL BUILD:
+    #define CBS_LOGGING_METHOD  0   // No logging in UREL builds
+#else
+    // UDEB BUILD:
+    #define CBS_LOGGING_METHOD  1   // 0 = No logging, 
+                                        // 1 = Flogger, 
+                                        // 2 = RDebug
+#endif //_DEBUG
+
+
+#if CBS_LOGGING_METHOD > 0
+    #define CBS_LOGGING_ENABLED     // This is for backward compatibility
+#endif //CBS_LOGGING_METHOD 
+
+/* 
+-----------------------------------------------------------------------------
+    FLOGGER SETTINGS
+-----------------------------------------------------------------------------
+*/
+#if CBS_LOGGING_METHOD == 1      // Flogger
+
+    #include <flogger.h>
+
+    _LIT(KCbsLogFolder, "TF");
+    _LIT(KCbsLogFile, "TFLOG.TXT");
+
+#elif CBS_LOGGING_METHOD == 2    // RDebug
+
+    #include <e32svr.h>
+
+#endif //CBS_LOGGING_METHOD
+
+
+/*
+-----------------------------------------------------------------------------
+    LOGGING MACROs
+
+    USE THESE MACROS IN YOUR CODE !
+-----------------------------------------------------------------------------
+*/
+
+
+#if CBS_LOGGING_METHOD == 1      // Flogger
+
+#define CBSLOGTEXT(AAA) /*lint -save -e960 */              { RFileLogger::Write(KCbsLogFolder(),KCbsLogFile(),EFileLoggingModeAppend,AAA); } /*lint -restore */
+#define CBSLOGSTRING(AAA) /*lint -save -e960 */           { _LIT(tempLogDes,AAA); RFileLogger::Write(KCbsLogFolder(),KCbsLogFile(),EFileLoggingModeAppend,tempLogDes()); } /*lint -restore */
+#define CBSLOGSTRING2(AAA,BBB) /*lint -save -e960 -e437 */       { _LIT(tempLogDes,AAA); RFileLogger::WriteFormat(KCbsLogFolder(),KCbsLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(tempLogDes()),BBB); } /*lint -restore */
+#define CBSLOGSTRING3(AAA,BBB,CCC) /*lint -save -e960 */   { _LIT(tempLogDes,AAA); RFileLogger::WriteFormat(KCbsLogFolder(),KCbsLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(tempLogDes()),BBB,CCC); } /*lint -restore */
+
+#elif CBS_LOGGING_METHOD == 2    // RDebug
+
+#define CBSLOGTEXT(AAA)              RDebug::Print(AAA);
+#define CBSLOGSTRING(AAA)            RDebug::Print(_L(AAA));
+#define CBSLOGSTRING2(AAA,BBB)       RDebug::Print(_L(AAA),BBB);
+#define CBSLOGSTRING3(AAA,BBB,CCC)   RDebug::Print(_L(AAA),BBB,CCC);
+
+#else    // CBS_LOGGING_METHOD == 0 or invalid
+
+// Example: CBSLOGTEXT(own_desc);
+#define CBSLOGTEXT(AAA)              
+// Example: CBSLOGSTRING("Test");
+#define CBSLOGSTRING(AAA)            
+// Example: CBSLOGSTRING("Test %i", aValue);
+#define CBSLOGSTRING2(AAA,BBB)       
+// Example: CBSLOGSTRING("Test %i %i", aValue1, aValue2);
+#define CBSLOGSTRING3(AAA,BBB,CCC)   
+
+#endif  // CBS_LOGGING_METHOD
+
+#endif    // CBSLOGGER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CbsReceiverTypes.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Contains enumerations and typedefs used by the receiver.
+*
+*/
+
+
+#ifndef CBSRECEIVERTYPES_H
+#define CBSRECEIVERTYPES_H
+
+// INCLUDES
+
+#include <s32std.h>
+
+// CONSTANTS
+
+// Alphabet/coding indication (GSM 03.38)
+enum TCbsRecAlphabet
+    {
+    // 7-bit alphabet coding
+    ECbsRecAlphabetDefault,
+    // 8-bit alphabet
+    ECbsRecAlphabet8bit,
+    // UCS2 (Unicode) alphabet coding
+    ECbsRecAlphabetUCS2,
+    // Unspecified coding; Use default coding instead.
+    ECbsRecAlphabetUnspecified
+    };
+
+// Language indication (GSM 03.38)
+enum TCbsRecLanguageIndication
+    {
+    // Language indicated in message page header.
+    ECbsRecLanguageIndicationHeader,
+    // Message content preceded by language indication.
+    ECbsRecLanguageIndicationBody
+    };
+
+enum TCbsRecGeographicalScope 
+    {
+    ECbsRecGeographicalScopeCell,
+    ECbsRecGeographicalScopeLAC,
+    ECbsRecGeographicalScopePLMN
+    };
+
+// DATA TYPES
+
+/**
+*   This represents the Data Coding Scheme of a CBS message.
+*
+*   DCS defines the language, encoding and compression of the message.
+*
+*   Refer to GSM specification 03.38 for details.
+*/
+typedef TUint8 TCbsRecDCS;
+
+/**
+*   This represents the Page Parameter of a CBS message.
+*
+*   Coding starts at bit value 0001 for a page value of 1. 0000 is reserved.
+*
+*   Bits 0-3 indicate total pages in this message (1..15).
+*   Bits 4-7 indicate the page number of this message in the current message 
+*            sequence (1..15).
+*/
+typedef TUint8 TCbsRecPageParameter;
+
+// These types comprise the Serial Number field of the CBS header (16 bits).
+typedef TUint16 TCbsRecMessageCode;            // actually 10 bits
+typedef TUint8 TCbsRecUpdateNumber;            // actually 4 bits
+
+#endif        // CBSRECEIVERTYPES_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CbsServerConstants.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,178 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Contains constants (version number, request codes) used by the server.*
+*/
+
+
+#ifndef CBSSERVERCONSTANTS_H
+#define CBSSERVERCONSTANTS_H
+
+//  INCLUDES
+
+#include <e32base.h>
+#include "CbsCommon.h"
+
+//  CONSTANTS
+
+// How long to wait if the server was locked by backup. Time in microseconds. 
+const TInt KTimeToWaitForBackup = 100000;
+
+// How many times to retry if the server is locked.
+const TInt KMaxRetryTimes = 50;
+
+// Name of CbsServer thread
+_LIT( KCbsServerName, "CbsServer" );
+
+// Server major version number
+const TInt KCbsServerVersionMajor  =   1;
+
+// Server minor version number
+const TInt KCbsServerVersionMinor  =   2;
+
+// Server build number
+const TInt KCbsServerVersionBuild  =   0;
+
+/**
+*   Enumeration of client requests.
+*/
+enum TCbsServerRequest
+    {
+    // RCbs requests
+    ECbsCloseSession,
+    ECbsCreateSettingsSubsession,
+    ECbsCreateTopicListSubsession,
+    ECbsCreateTopicMessagesSubsession,
+    ECbsCreateTopicCollectionSubsession,
+    ECbsShutdown,
+    
+    // RCbsSettings subsession requests
+    ECbsCloseSettingsSubsession,
+    ECbsSetReceptionStatus,
+    ECbsGetReceptionStatus,
+    ECbsSetTopicDetectionStatus,
+    ECbsGetTopicDetectionStatus,
+    ECbsGetLanguages,
+    ECbsSetLanguages,
+    ECbsNotifySettingsChanged,
+    ECbsNotifySettingsChangedCancel,
+
+    // RCbsTopicList subsession requests
+    ECbsCloseTopicListSubsession,
+    ECbsGetTopicCount,
+    ECbsGetTopic,
+    ECbsFindTopicByNumber,
+    ECbsDeleteTopic,
+    ECbsAddTopic,
+    ECbsChangeTopicNameAndNumber,
+    ECbsChangeTopicSubscriptionStatus,
+    ECbsChangeTopicHotmarkStatus,
+    ECbsNotifyOnEvent,
+    ECbsNotifyOnEventCancel,
+    ECbsGetNewTopicsCount,
+    ECbsGetLatestTopicNumber,
+    ECbsGetUnreadMessageCount,
+    ECbsGetHotmarkedMessageHandle,
+    ECbsGetUnreadHotmarkedMessageCount,
+    ECbsDeleteAll,
+    ECbsGetNextAndPrevTopicNumber,
+
+    // RCbsTopicMessages subsession requests
+    ECbsCloseTopicMessagesSubsession,
+    ECbsGetMessageCount,
+    ECbsGetMessage,
+    ECbsFindMessageByHandle,
+    ECbsGetMessageIndexByHandle,
+    ECbsDeleteMessage,
+    ECbsSaveMessage,
+    ECbsReadMessage,
+    ECbsLockMessage,
+    ECbsGetMessageContents,
+    ECbsGetNextAndPrevMsgHandle,
+        
+    // RCbsTopicCollection subsession requests
+    ECbsCloseTopicCollectionSubsession,
+    ECbsGetTopicInfoCount,
+    ECbsGetTopicInfo,
+    ECbsGetTopicInfoCountNotListed,
+    ECbsTopicInList,
+    ECbsNotifyOnChange,
+    ECbsNotifyOnChangeCancel,
+    ECbsGetUnlistedTopicIndexies,
+
+    // RCbsMcnSession requests
+    EMcnCreateSubsession,
+    EMcnCloseSession,
+    EMcnNotifyOnChange,
+    EMcnNotifyOnChangeCancel,
+    EMcnGetCellInfo,
+    EMcnSubscribeTopic,
+    EMcnClearSubscriptions,
+    EMcnNoMoreSubscriptions,
+    EMcnCloseSubsession,
+    EMcnGetInfoMessage
+    };
+
+// Number of message slots used in server-client ITC.
+const TInt KCbsServerDefaultSlots = 4;
+
+// Header size of a CB message page in bytes.
+const TInt KCbsCbMsgHeaderSize = 6;
+
+// Maximum characters in page
+const TInt KCbsMaxCharsInPage = 93;
+
+//  DATA TYPES  
+
+// Used by RCbs::GetNextAndPrevTopicNumber to transfer request results
+// from server to client.
+struct TCbsNextPrevTopicAndPosition
+    {
+    TCbsTopicNumber iPrevTopic;
+    TCbsTopicNumber iNextTopic;
+    TInt iPosition;
+    };
+
+// Used by RCbs::GetNextAndPrevMsgHandle to transfer request results
+// from server to client.
+struct TCbsNextPrevMsgAndPosition
+    {
+    TCbsMessageHandle iPrevMsg;
+    TCbsMessageHandle iNextMsg;
+    TInt iPosition;
+    };
+
+// Used by active objects to determine the command type.
+enum TCbsServerEtelCommand
+    {
+    ECbsReceiveMessage,
+    ECbsSetFilterSetting,
+    ECbsGetLanguageFilter,
+    ECbsSetLanguageFilter,
+    ECbsRetrieveBroadcastIdList,
+    ECbsStoreBroadcastIdList,
+    ECbsBroadcastListCancelAll,
+    ECbsCommandTypeNotSet
+    };
+
+// District info message topic.
+const TInt KCellInfoTopic = 50;
+
+// HomeZone message topic.
+const TInt KHomeZoneTopic = 221;
+
+#endif      //  CBSSERVERCONSTANTS_H   
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CbsServerInternalPSKeys.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,38 @@
+/*
+* 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:  Internal Publish & Subscribe keys for CBS Server.
+ *
+ *
+*/
+
+
+#ifndef CBSSERVER_INTERNAL_PS_KEYS_H
+#define CBSSERVER_INTERNAL_PS_KEYS_H
+
+const TUid KPSUidCellBroadcast = { 0x10202994 };
+
+/**
+ * This key is used to indicate the status of CBS Server to other 
+ * applications. The value is set to '1' when server is started,
+ * otherwise it is '0'.
+ *
+ * Possible values:
+ * 0: Default value, CBS Server is not running
+ * 1: Indicates that CBS Server is running
+ */
+const TUint32 KCbsServerStarted = 0x00000000;
+
+#endif
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CbsServerPanic.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,98 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 the CbsServerPanic() function which panics the server.
+*
+*/
+
+
+#ifndef CBSSERVERPANIC_H
+#define CBSSERVERPANIC_H
+
+// INCLUDES
+#include <e32base.h>
+
+//  DATA TYPES  
+
+/**
+*   Different reasons for panics in CbsServer.
+*
+*   Enumeration defined manually because of convience
+*   => Release build panic dialog shows only the panic
+*   number.
+*/
+enum TCbsServerPanic
+    {
+    ECbsSchedulerCreationFailed                 = 0,
+    ECbsServerCreationFailed                    = 1,
+    ECbsCollectorArrayEmpty                     = 2,
+    ECbsServerStartFailed                       = 3,
+    ECbsMsgRepUnprepared                        = 4,
+    ECbsInvalidMessage                          = 5,
+    ECbsDatabaseNull                            = 6,
+    ECbsReceiverNull                            = 7,
+    ECbsCbmiListNull                            = 8,
+    ECbsCbmiListNotEmpty                        = 9,
+    ECbsCbmiListMismatch                        = 10,
+    ECbsErrorFromNonClientObject                = 11,
+    ECbsSettingsInitFailed                      = 12,
+    ECbsObserverNull                            = 13,
+    ECbsUnrecognizedFactoryDefaultsTag          = 14,
+    ECbsFactoryDefaultsFileCorrupt              = 15,
+    ECbsFactoryDefaultsTopicsCorrupt            = 16,
+    ECbsTopicListProcessPanic                   = 17,
+    ECbsMessagesSubsessionInitFailed            = 18,
+    ECbsMessageAlreadyPermanent                 = 19,
+    ECbsMcnSessionInitFailed                    = 20,
+    ECbsObserverNotFound                        = 21,
+    ECbsTopicMessagesNull                       = 22,
+    EMcnProviderNull                            = 23,
+    EMcnSubscriptionsExceedTotalSubscriptions   = 24,
+    ESubscriptionTableCorrupt                   = 25,
+    EMcnProviderNotFound                        = 26,
+    ECbsRecShouldBeOn                           = 27,
+    ECbsMessageNullAtCopyConstructor            = 28,
+    ECbsRetrievedNullMessageContent             = 29,
+    ECbsFSSOpenFailed                           = 30,
+    ECbsInvalidSharedDataEvent                  = 31,
+    ECbsGeneratorInvalidMsgHeader               = 32,
+    ECbsStoreNull                               = 33,
+    ECbsNullTopic                               = 34,
+    ECbsCacheNotValid                           = 35,
+    EInvalidSessionObject                       = 36,
+    ECbsCollectorMergeFailed                    = 37,
+    ECbsInvalidLockHandle                       = 38,
+    ECbsNotIndexMessage                         = 39,
+    ECbsLanguageNotResolved                     = 40,
+    ECbsInvalidLanguage                         = 41,
+    ECbsTopicDuplicate                          = 42,
+    ECbsGetTopicFailed                          = 43,
+    ECbsFindTopicUnknownLeave                   = 44,
+    ECbsInvalidFilenameDescriptor               = 45,
+    ECbsTopicListArrayNull                      = 46
+    };
+
+//  FUNCTION PROTOTYPES  
+
+/**
+*   Panics the server.
+*
+*   @param aPanic Reason for the panic.
+*/
+GLDEF_C void CbsServerPanic( TCbsServerPanic aPanic );
+
+#endif      //  CBSSERVERPANIC_H   
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CbsServerPrivateCRKeys.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,83 @@
+/*
+* 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 contains the header file of private CR keys
+*
+*/
+
+
+
+#ifndef __CBSSERVER_PRIVATE_CR_KEYS_H__
+#define __CBSSERVER_PRIVATE_CR_KEYS_H__
+
+const TUid KCRUidCellBroadcast = {0x1020298F};
+
+/**
+* This key setting enables CBS messages reception if it is turned on.
+*
+* Possible integer values:
+* 0 Reception off
+* 1 Reception on
+*
+* Default value: 0
+*/
+const TUint32 KCbsReception = 0x00000001;
+
+/**
+* If this key value is set on and the topic of received message is 
+* not in the topic list, the topic is added to the topic list.
+*
+* Possible integer values:
+* 0 Topic detection off
+* 1 Topic detection on
+*
+* Default value: 0
+*/
+const TUint32 KCbsTopicDetection = 0x00000002;
+
+/**
+* This key holds information of message languages 
+* that are allowed to be received. Default value means that 
+* all messages with all languages are allowed to be received.
+*
+* Possible values:
+* Each character in the string can be either '0' or '1'
+*
+* Default value: 0000000000000000000001
+*/
+const TUint32 KCbsLanguages = 0x00000003;
+
+/**
+* With this key value user sets feature on, which limits message 
+* reception with a time frame. Time frame is defined separately by UI.
+*
+* Possible integer values:
+* 0 Time limits off
+* 1 Time limits on
+*
+* Default value: 0
+*/
+const TUint32 KCbsLimitedReception = 0x00000004;
+
+/**
+* Time when last automatic cleanup was excecuted.
+*
+* Possible integer values:
+* Interger representation of the time.
+*
+* Default value: 0
+*/
+const TUint32 KCbsCleanupTime = 0x00000005;
+	
+#endif // __CBSSERVER_PRIVATE_CR_KEYS_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CbsServerTypes.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Contains server typedefs and enumerations.
+*                Note that most of these types are aliases to database types.
+*
+*/
+
+
+
+#ifndef     CBSSERVERTYPES_H
+#define     CBSSERVERTYPES_H
+
+// INCLUDES
+
+#include <e32base.h>
+#include "CbsServerConstants.h"
+
+// DATA TYPES
+
+// Represents a handle to a message.
+typedef TCbsDbMessageHandle TCbsMessageHandle;
+
+// Represents the length of the message.
+typedef TCbsDbMessageLength TCbsMessageLength;
+
+// Represents a handle to a topic collection.
+typedef TUint TCbsTopicCollectionHandle;
+
+// Represents a handle to a topic.
+typedef TCbsDbTopicHandle TCbsTopicHandle;
+
+// Represents topic list handles.
+typedef TInt16 TCbsTopicListHandle;
+
+// Represents the topic numbers.
+typedef TCbsDbTopicNumber TCbsTopicNumber;
+
+// Enumerates the reasons for the client panic.
+typedef TCbsDbMessageKey TCbsMessageKey;
+
+#endif      //  CBSSERVERTYPES_H   
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CbsStreamHelper.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CbsStreamHelper class.
+*
+*/
+
+
+
+#ifndef CBSSTREAMHELPER_H
+#define CBSSTREAMHELPER_H
+
+// INCLUDES
+#include <s32file.h>
+
+// CLASS DECLARATION
+
+/**
+*   Contains common methods used by the database.
+*
+*
+*/
+class CbsStreamHelper
+    {
+    public:
+        /**
+        *   Reads boolean value from the stream.
+        *
+        *   @param aStream  The stream from which the value is read.
+        *   @return         Read value.
+        */
+        static TBool ReadBoolL( RReadStream& aStream );
+
+        /**
+        *   Writes boolean value to the stream.
+        *
+        *   @param aStream  The stream to which the value is written.
+        *   @param aBool    The value to be written.
+        */
+        static void WriteBoolL( RWriteStream& aStream, TBool aBool );
+    };
+
+#endif // CBSSTREAMHELPER
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/CbsUtils.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CbsUtils class
+*
+*/
+
+
+#ifndef CBSUTILS_H
+#define CBSUTILS_H
+
+// INCLUDES
+#include <e32std.h>
+  
+// FORWARD DECLARATIONS
+class RResourceFile;
+class RFs;
+
+// CLASS DECLARATION
+
+/**
+*   Namespace structure for CBS helper functions.
+*/
+class CbsUtils 
+    {
+    public:
+
+        /**
+        * Searches and opens the DLL default resource file. 
+        * Calls FindAndOpenResourceFileLC.
+        *
+        * @param   aFs         open file server handle.
+        * @param   aResFile    resource file to open. If open is succesful, resource file
+        *                      close operation is pushed on to the cleanup stack.
+        *
+        * @see CbsUtils::FindAndOpenResourceFileLC
+        */
+        static void FindAndOpenDefaultResourceFileLC
+            ( RFs& aFs, 
+            RResourceFile& aResFile );
+
+        /**
+        *   Leaves with KErrDiskFull if writing aBytesToWrite bytes 
+        *   to the Flash File System would reduce the free space on FFS 
+        *   under the critical level.
+        *
+        *   Used before every FFS write operation.
+        *
+        *   @param   aBytesToWrite      Number of bytes that are required 
+        *                               to write to FFS
+        *   @param   aFs                Open file server session
+        *
+        */
+        static void FFSCriticalLevelCheckL( const TInt aBytesToWrite, RFs& aFs );
+        
+        /**
+        *   Returns with KTrue if there is memory enough to allocate memory 
+        *   for aBytesToWrite bytes.
+        *
+        *   Used before every topic allocation operation.
+        *
+        *   @param   aBytesToWrite      Number of bytes that are required 
+        *                               to allocation
+        *
+        */
+        static TBool RamMemCriticalLevelCheckL( const TInt aBytesToWrite);
+
+        /**
+        *   Leaves with KErrDiskFull if writing aBytesToWrite bytes 
+        *   to the RAM File System would reduce the free space on RAM 
+        *   under the critical level.
+        *
+        *   Used before every RAM write operation.
+        *
+        *   @param aFileName            File whose volume should be checked.
+        *   @param aBytesToWrite        Number of bytes that are required
+        *                               to write to RAM
+        *   @param aFs                  Open file server session
+        */
+        static void VolumeCriticalLevelCheckL( 
+            const TDesC& aFileName,
+            TInt aBytesToWrite, const RFs& aFs );
+
+        /**
+        *   Returns ETrue, if the file aFile exists.
+        *   
+        *   The caller has to provide a file server session to this method.
+        *
+        *   @param aFs          Open file server session
+        *   @param aFile        File name and path
+        *   @return             ETrue, if the file exists.
+        */
+        static TBool ExistsL( const RFs& aFs, const TDesC& aFile );
+
+        /**
+        *   Deletes the given file.
+        *
+        *   @param  aFs         Open file server session
+        *   @param  aFile       Filename
+        */
+        static void DeleteFileL( RFs& aFs, const TDesC& aFile );
+
+private:
+    // Prohibited default constructor
+    CbsUtils();
+
+    // Prohibited copy constructor
+    CbsUtils( const CbsUtils& );
+    
+    // Prohibited assignment operator
+    CbsUtils& operator=( const CbsUtils& );
+
+    };
+
+#endif  // CBSUTILS_H
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/MCbsDbObserver.H	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 MCbsDbObserver class.
+*    
+*                Virtual class defining an interface for a database observer.
+*
+*/
+
+
+
+#ifndef MCBSDBOBSERVER_H
+#define MCBSDBOBSERVER_H
+
+//  INCLUDES
+
+#include <e32base.h>
+
+//  CLASS DEFINITIONS 
+
+/**
+*   This class defines the interface for database observers.
+*/
+class MCbsDbObserver
+    {
+    public:     // New functions
+        /**
+        *   Indicates that the database has been reinitialised.
+        */
+        virtual void DatabaseInitialisedInd() = 0;
+
+        /**
+        *   Indicates that the database has been closed, which should happen 
+        *   only when the database manager is to be destroyed.
+        */
+        virtual void DatabaseClosedInd() = 0;
+    };
+
+#endif      //  CBSDBOBSERVER_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/MCbsDbSettingsObserver.H	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 MCbsDbSettingsObserver class.
+*                Virtual class defining an interface for a settings observer.
+*
+*/
+
+
+
+#ifndef    MCBSDBSETTINGSOBSERVER_H
+#define    MCBSDBSETTINGSOBSERVER_H
+
+//  CLASS DECLARATION 
+
+/**
+*   This class defines the interface for settings observers.
+*/
+class    MCbsDbSettingsObserver
+    {
+    public:        // New functions
+        /**
+        *   The method is used to indicate that the topic detection 
+        *   status has been changed.
+        */
+        virtual void TopicDetectionStatusChangedIndL() = 0;
+
+        /**
+        *   The method is used to indicate that the reception status 
+        *   has been changed.
+        */
+        virtual void ReceptionStatusChangedIndL() = 0;
+
+        /**
+        *   The method is used to indicate that the preferred languages 
+        *   has been changed.
+        */
+        virtual void LanguagesChangedIndL() = 0;
+
+        /**
+        *   The method is used to indicate that the limited reception 
+        *   status has been changed.
+        */
+        virtual void LimitedReceptionStatusChangedIndL() = 0;
+
+        /**
+        *   The method is used to indicate that the clean up interval 
+        *   of read messages has been changed.
+        */
+        virtual void CleanupTimeChangedIndL() = 0;
+    };
+
+#endif      //  MCBSDBSETTINGSOBSERVER_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/MCbsDbTopicCollectionObserver.H	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Virtual class defining an interface for an observer which gets
+*                notified when the topic collection changes. 
+*
+*/
+
+
+
+
+#ifndef    MCBSDBTOPICCOLLECTIONOBSERVER_H
+#define    MCBSDBTOPICCOLLECTIONOBSERVER_H
+
+//  INCLUDES
+
+//  CLASS DECLARATION 
+
+/**
+*   This class defines the interface for a topic collection observer
+*/
+class    MCbsDbTopicCollectionObserver 
+    {
+    public:        // New functions
+        /**
+        *   Indicates that the contents of the collection have changed.
+        */
+        virtual void TopicCollectionContentsChangedInd() = 0;
+    };
+
+#endif      //  MCBSDBTOPICCOLLECTIONOBSERVER_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/MCbsDbTopicListObserver.H	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Virtual class defining an interface for an observer which gets
+*                notified when the topic list is changed. 
+*
+*/
+
+
+
+#ifndef     MCBSDBTOPICLISTOBSERVER_H
+#define     MCBSDBTOPICLISTOBSERVER_H
+
+//  INCLUDES
+
+#include <e32base.h>
+#include "CbsCommon.h"
+
+//  CLASS DECLARATION 
+
+/**
+*   This class defines the interface for topic list observers.
+*/
+class MCbsDbTopicListObserver
+    {
+    public:        // New functions
+        /**
+        *   Indicates that the topic list has been initialized.
+        */
+        virtual void TopicListInitializedIndL() = 0;
+
+        /**
+        *   Indicates that a new topic has been added.
+        *
+        *   @param  aNumber         Number of the topic that has been added
+        */
+        virtual void TopicAddedIndL( const TCbsDbTopicNumber& aNumber ) = 0;
+
+        /**
+        *   Indicates that a topic has been deleted.
+        *
+        *   @param  aNumber         Number of the topic that was deleted.
+        */
+        virtual void TopicDeletedIndL( const TCbsDbTopicNumber& aNumber ) = 0;
+
+        /**
+        *   Indicates that a topic has been modified.
+        *
+        *   @param  aNumber         Number of the topic that has been modified.
+        */
+        virtual void TopicModifiedIndL( const TCbsDbTopicNumber& aNumber ) = 0;
+
+        /**
+        *   Indicates that a topic has received a new message.
+        *
+        *   @param  aNumber         Number of the topic that has received 
+        *                           a new message.
+        */
+        virtual void TopicNewMessageReceivedIndL( 
+            const TCbsDbMessageHandle& aNumber ) = 0;
+    };
+
+#endif      //  MCBSDBTOPICLISTOBSERVER_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/MCbsEtelMessaging.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,105 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 MCbsEtelMessaging class.
+*
+*/
+
+
+
+#ifndef MCBSETELMESSAGING_H
+#define MCBSETELMESSAGING_H
+
+//  INCLUDES
+		/*****************************************************
+		*	Series 60 Customer / ETel
+		*	Series 60  ETel API
+		*****************************************************/
+#include <etelmm.h>        
+
+//  FORWARD DECLARATIONS
+class MCbsEtelPhone;
+
+//  CLASS DECLARATION 
+
+/**
+*   MCbsEtelMessaging is the interface for EPOC Telephony server connections.
+*   
+*/
+class MCbsEtelMessaging
+    {
+    public:
+
+        /**
+        *   Virtual destructor
+        */
+        virtual ~MCbsEtelMessaging() { }
+
+        /**
+        *   Opens the connection to EPOC Telephony server       
+        *
+        *   @param  aPhone      A reference to the phone
+        *   @return             Error code
+        */
+        virtual TInt Open( RMobilePhone& aPhone ) = 0;
+
+        /**
+        *   Closes the connection to EPOC Telephony server
+        */
+        virtual void Close() = 0;
+
+        /**
+        *   Requests to receive next incoming CB message
+        *
+        *   @param  aReqStatus      Return: Async request status
+        *   @param  aMsgData        Return: CB message data
+        *   @param  aMsgAttributes  Return: CB message attributes
+        */
+        virtual void ReceiveMessage( TRequestStatus& aReqStatus, 
+            TDes8& aMsgData, TDes8& aMsgAttributes ) = 0;
+
+        /**
+        *   Gets the filter setting from EPOC Telephony server
+        *
+        *   @param  aSetting        Return: Current filter setting
+        */
+        virtual TInt GetFilterSetting( 
+            RMobileBroadcastMessaging::TMobilePhoneBroadcastFilter& aSetting ) = 0;
+
+        /**
+        *   Sets the filter setting to EPOC Telephony server
+        *
+        *   @param  aReqStatus      Return: Async request status
+        *   @param  aSetting        New filter setting
+        */
+        virtual void SetFilterSetting( TRequestStatus& aReqStatus, 
+            RMobileBroadcastMessaging::TMobilePhoneBroadcastFilter aSetting ) const = 0;        
+
+        /**
+        *   Cancel ReceiveMessage
+        *
+        */
+        virtual void ReceiveMessageCancel() = 0;
+
+        /**
+        *   Cancel SetFilterSetting
+        *
+        */
+        virtual void SetFilterSettingCancel() = 0;
+        };
+
+#endif      //  MCBSETELMESSAGING_H
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/MCbsMcnSubscriptionsProvider.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Virtual class defining an interface for providing topic subscriptions
+*                information and routing CB messages.
+*
+*/
+
+
+
+
+#ifndef MCBSMCNSUBSCRIPTIONSPROVIDER_H
+#define MCBSMCNSUBSCRIPTIONSPROVIDER_H
+
+//  INCLUDES
+
+#include <e32base.h> 
+
+//  FORWARD DECLARATIONS
+
+class CCbsMessage;
+
+//  CLASS DECLARATION 
+
+/**
+*   This class defines the interface for providing CB topic subscriptions.
+*/
+class MCbsMcnSubscriptionsProvider
+    {
+    public:        // New functions
+        /*
+        *   Returns the number of topic subscriptions of this MCN client.
+        *
+        *   @return                     Number of subscribed CB topics
+        */
+        virtual TUint NumberOfSubscriptions() const = 0;
+
+        /**
+        *   Route CB message given in aMessage to a MCN client.
+		*	@param aMessage The CBS message to be routed
+        */
+        virtual void RouteMessageL( const CCbsMessage& aMessage ) = 0;
+    };
+
+#endif      //  MCBSMCNSUBSCRIPTIONSPROVIDER_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/cbsinternalcrkeys.h	Wed Jul 21 18:26:52 2010 +0300
@@ -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:  CBS internal Central Repository keys
+*
+*/
+
+
+#ifndef CBSINTERNALCRKEYS_H
+#define CBSINTERNALCRKEYS_H
+
+#include <e32std.h>
+
+/******************************************************************************
+* CBS Variation API
+* Keys under this category are used in defining CBS variation.
+******************************************************************************/
+const TUid KCRUidCbsVariation = {0x102078EE};
+
+/**
+* CBS Local Variation Flags. Values are defined in CbsVariant.hrh.
+*/
+const TUint32 KCbsVariationFlags                            = 0x00000001;
+
+#endif      // CBSINTERNALCRKEYS_H
+
+// End of file
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerInc/cbsvariant.hrh	Wed Jul 21 18:26:52 2010 +0300
@@ -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: 
+*
+*  The file contains values for Central Repository keys specifying
+*  CBS specific software settings. 
+*
+*
+*/
+
+
+#ifndef CBSVARIANT_HRH
+#define CBSVARIANT_HRH
+
+
+/** 
+* KCbsLVFlagTopicSubscription is on/off setting for CBS Topic 
+* automatic subscription feature.
+*/
+#define KCbsLVFlagTopicSubscription 0x00000001
+
+
+#endif // CBSVARIANT_HRH
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerSrc/CCbsBackupMonitor.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,181 @@
+/*
+* 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:  This module contains the implementation of CCbsBackupMonitor class 
+*                member functions.    
+*
+*/
+
+
+// INCLUDE FILES
+#include "CCbsBackupMonitor.h"
+#include <connect/sbdefs.h>
+#include "CbsLogger.h"
+
+// CONSTANTS
+const TInt KCbsBackupMask = 0xF;
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCbsBackupMonitor::CCbsBackupMonitor
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCbsBackupMonitor::CCbsBackupMonitor( CCbsDbImp& aDbImp )
+    : CActive( EPriorityStandard ),
+    iDbImp( aDbImp )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsBackupMonitor::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCbsBackupMonitor::ConstructL()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsBackupMonitor::ConstructL()");
+    
+    CActiveScheduler::Add( this );
+    
+    // Attach to backup property    
+    iProperty.Attach( KUidSystemCategory, conn::KUidBackupRestoreKey );    
+    IssueRequest();
+    
+    CBSLOGSTRING("CBSSERVER: <<< CCbsBackupMonitor::ConstructL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsBackupMonitor::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCbsBackupMonitor* CCbsBackupMonitor::NewL( CCbsDbImp& aDbImp )
+    {
+    CCbsBackupMonitor* self = 
+        new ( ELeave ) CCbsBackupMonitor( aDbImp );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+    
+// Destructor
+CCbsBackupMonitor::~CCbsBackupMonitor()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsBackupMonitor::~CCbsBackupMonitor()");
+    Cancel();
+	iProperty.Close();
+	CBSLOGSTRING("CBSSERVER: <<< CCbsBackupMonitor::~CCbsBackupMonitor()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsBackupMonitor::IssueRequest
+// Requests that we are notified when the system state changes.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsBackupMonitor::IssueRequest() 
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsBackupMonitor::IssueRequest()");
+    
+    if ( !IsActive() )
+        {
+        // Subscribe again
+    	iProperty.Subscribe( iStatus );
+	    SetActive();
+	    CBSLOGSTRING("CBSSERVER: CCbsBackupMonitor::IssueRequest(): New Subscribe() set active.");
+        }
+    CBSLOGSTRING("CBSSERVER: <<< CCbsBackupMonitor::IssueRequest()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsBackupMonitor::RunL
+// Becomes active when the system state changes.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsBackupMonitor::RunL()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsBackupMonitor::RunL()");
+    
+    if ( iStatus == KErrNone )
+        {        
+        // Resubscribe before processing new value to prevent missing updates        
+        IssueRequest();
+        
+        // Property updated, get new value
+    	TInt state( 0 );
+    	TInt backupState( 0 );
+    	TInt error( KErrNone );
+    	error = iProperty.Get( state );
+    	CBSLOGSTRING2("CBSSERVER: CCbsBackupMonitor::RunL(): error: %d", error );
+    	
+    	if ( !error )
+    	    {    	       	    
+    	    backupState = ( state &= KCbsBackupMask );
+    	    
+        	// States are from sbdefs.h
+        	switch ( backupState )
+        	    {
+        	    // No backup or restore ongoing
+        	    case conn::EBURUnset:
+        	    case conn::EBURNormal:
+        	        {
+        	        CBSLOGSTRING("CBSSERVER: CCbsBackupMonitor::RunL(): EBURUnset or EBURNormal" );
+        	        iDbImp.ChangeFileLocksL( ECbsNoBackup );
+        	        }    	        
+        	        break;
+        	    // Backup, release file locks
+        	    case conn::EBURBackupFull:
+        	    case conn::EBURBackupPartial:
+        	        {
+        	        CBSLOGSTRING("CBSSERVER: CCbsBackupMonitor::RunL(): EBURBackupFull or EBURBackupPartial" );
+        	        iDbImp.ChangeFileLocksL( ECbsBackup );
+        	        }    	        
+        	        break;
+        	    // Restore, release file locks
+        	    case conn::EBURRestoreFull:
+        	    case conn::EBURRestorePartial:
+        	        {
+        	        CBSLOGSTRING("CBSSERVER: CCbsBackupMonitor::RunL(): EBURRestoreFull or EBURRestorePartial" );
+        	        iDbImp.ChangeFileLocksL( ECbsRestore );
+        	        }
+        	        break;
+        	    default:
+        	        CBSLOGSTRING("CBSSERVER: CCbsBackupMonitor::RunL(): Default" );
+        	        break;
+        	    }
+    	    }
+        }
+    CBSLOGSTRING("CBSSERVER: <<< CCbsBackupMonitor::RunL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsBackupMonitor::DoCancel
+// Cancels an outstanding Subscribe request.  
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsBackupMonitor::DoCancel()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsBackupMonitor::DoCancel()");
+    iProperty.Cancel();   
+    CBSLOGSTRING("CBSSERVER: <<< CCbsBackupMonitor::DoCancel()");
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerSrc/CCbsDbImp.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,459 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 contains basis for the implementation of the database.
+*    
+*                Constructs instances of database subclasses CCbsDbImpSettings,
+*                CCbsDbImpTopicCollection, CCbsDbTopicList and CCbsDbTopicMessages.
+*                On initialization determines whether datafiles already exist.
+*                If all of them are present and valid, no special action is taken.
+*
+*                If some or all datafiles are missing or corrupt, all datafiles
+*                are deleted and new files created.
+*                Factory default settings, if available, are then loaded from
+*                Shared Data and stored in server datafiles. This is done by
+*                database subinstances.
+*
+*/
+
+
+//  INCLUDE FILES
+
+#include <barsc.h>
+#include <e32svr.h>
+#include <bautils.h>
+
+#include <CbsServer.rsg>
+
+#include "CbsUtils.h"
+#include "CbsServerPanic.h"
+#include "CCbsDbImp.H"
+#include "CbsDbConstants.h"
+#include "CCbsDbImpSettings.H"
+#include "CCbsDbImpTopicMessages.h"
+#include "CCbsDbImpTopicList.h"
+#include "CCbsDbImpTopicCollection.h"
+#include "CCbsBackupMonitor.h"
+#include "CCbsDiskSpaceMonitor.h"
+
+#include "CbsLogger.h"
+
+// Data file names
+_LIT( KCbsTopicsAndMsgsFileName, "cbtopicsmsgs.dat" );
+_LIT( KCbsUnsavedMsgsFileName, "cbunsaved.dat" );
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCbsDbImp::CCbsDbImp
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCbsDbImp::CCbsDbImp()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImp::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImp::ConstructL()
+    {
+    User::LeaveIfError( iFs.Connect() );
+
+    // Create the disk space monitor    
+    iDiskSpaceMonitor = CCbsDiskSpaceMonitor::NewL( *this );
+
+    TInt errorCode( KErrNone );
+    
+#ifdef __SECURE_BACKUP__
+    // Use PubSub for monitoring
+    iBackupMonitor = CCbsBackupMonitor::NewL( *this );
+#else
+    // Create a backup observer wrapper. If an error is returned,
+    // ignore it and leave iBackupWrapper to NULL.
+    TRAP( errorCode, ( iBackupWrapper = CBaBackupSessionWrapper::NewL() ) );
+#endif        
+
+    // Try to create the database components. If we couldn't because
+    // the disk is almost full, that's alright. We'll try again
+    // later.
+    TRAP( errorCode, CreateComponentsL() );
+    if ( errorCode == KErrDiskFull )
+        {
+        // Install an observer for the critical level
+        WaitForCriticalLevel();
+        }
+    else
+        {
+        User::LeaveIfError( errorCode );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImp::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCbsDbImp* CCbsDbImp::NewL()
+    {
+    CCbsDbImp* self = new ( ELeave ) CCbsDbImp;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// Destructor
+CCbsDbImp::~CCbsDbImp()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsDbImp::~CCbsDbImp()");
+    if ( iDiskSpaceMonitor )
+        {
+        delete iDiskSpaceMonitor;
+        }    
+    
+    DeleteComponents();
+
+    iFs.Close();
+    CBSLOGSTRING("CBSSERVER: <<< CCbsDbImp::~CCbsDbImp()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImp::TopicListL
+// Returns a reference to the current active topic list. 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CCbsDbImpTopicList& CCbsDbImp::TopicListL()
+    {
+    // Check if we have initialized the database succesfully
+    if ( !iTopicList )
+        {
+        User::Leave( KErrDiskFull );
+        }
+
+    return *iTopicList;    
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImp::TopicMessagesL
+// Returns a reference to the current topic messages DB object. 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CCbsDbImpTopicMessages& CCbsDbImp::TopicMessagesL()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsDbImp::TopicMessagesL()");
+    
+    // Check if we have initialized the database succesfully
+    if ( !iTopicMessages )
+        {
+        CBSLOGSTRING("CBSSERVER: CCbsDbImp::TopicMessagesL(): No iTopicMessages instance, leaving with KErrDiskFull...");
+        User::Leave( KErrDiskFull );
+        }
+
+    CBSLOGSTRING("CBSSERVER: <<< CCbsDbImp::TopicMessagesL(), returning *iTopicMessages.");
+    return *iTopicMessages;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImp::SettingsL
+// Returns a reference to the settings DB object.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CCbsDbImpSettings& CCbsDbImp::SettingsL()
+    {
+    // Check if we have initialized the database succesfully
+    if ( !iSettings )
+        {
+        User::Leave( KErrDiskFull );
+        }
+
+    return *iSettings;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImp::TopicCollectionL
+// Returns a reference to the topic collection.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CCbsDbImpTopicCollection& CCbsDbImp::TopicCollectionL()
+    {
+    // Check if we have initialized the database succesfully
+    if ( !iTopicCollection )
+        {
+        User::Leave( KErrDiskFull );
+        }
+
+    return *iTopicCollection;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImp::BackupWrapperL
+// Returns a reference to the backup wrapper. 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CBaBackupSessionWrapper& CCbsDbImp::BackupWrapperL()
+    {
+    if ( !iBackupWrapper )
+        {
+        User::Leave( KErrGeneral );
+        }
+
+    return *iBackupWrapper;
+    }
+
+// ---------------------------------------------------------
+// IsInitialized()    
+//
+// ---------------------------------------------------------
+TBool CCbsDbImp::IsInitialized() const
+    {
+    return iSettings != NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImp::CreateComponentsL
+// Creates topic list, settings topic messages and topic
+// collection instances and loads factory settings if necessary. 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImp::CreateComponentsL()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsDbImp::CreateComponentsL()");
+    
+    // Return if we have already been initialized
+    if ( IsInitialized() )
+        {
+        return;
+        }    
+    
+    TBuf<16> topicsFile( KCbsTopicsAndMsgsFileName );
+    TBuf<16> messagesFile( KCbsUnsavedMsgsFileName );  
+    
+    // Delete the old file for unsaved messages 
+    CbsUtils::DeleteFileL( iFs, messagesFile );
+    CBSLOGSTRING("CBSSERVER: CCbsDbImp::CreateComponentsL(): messagesFile deleted.");
+
+    // Make sure that data file paths exist.
+    iFs.MkDirAll( topicsFile ); 
+    iFs.MkDirAll( messagesFile ); 
+    
+    // Create the individual components. If creating any of the components
+    // fails, this method leaves and created components are deleted.
+    CCbsDbImpSettings* settings = CreateSettingsL();
+    CleanupStack::PushL( settings );
+
+    CCbsDbImpTopicList* topicList = CreateTopicListL( topicsFile, messagesFile );
+    CleanupStack::PushL( topicList );
+
+    CCbsDbImpTopicMessages* topicMessages = CreateTopicMessagesL( *topicList );
+    CleanupStack::PushL( topicMessages );
+
+    CCbsDbImpTopicCollection* topicCollection = CreateTopicCollectionL();
+    CleanupStack::PushL( topicCollection );
+    
+
+#ifndef __SECURE_BACKUP__
+
+    CBSLOGSTRING("CBSSERVER: CCbsDbImp::CreateComponentsL(): __SECURE_BACKUP__ not defined.");
+    
+    // Register the file to backup server
+    if ( iBackupWrapper )
+        {
+        iBackupWrapper->RegisterFileL( *topicsFile, *topicList );
+        }
+#endif
+
+    // We have succesfully created all components. Set them to member
+    // variables.
+    iTopicList = topicList;
+    iSettings = settings;
+    iTopicMessages = topicMessages;
+    iTopicCollection = topicCollection;
+
+    // Does not transfer ownership.
+    iTopicList->SetTopicMessages( iTopicMessages );    
+
+    // If we could create the database, cancel the disk space notify request
+    WaitForCriticalLevelCancel();
+
+    // The database components are preserved, but the resource reader and
+    // related buffers are deleted.
+    CleanupStack::Pop( 4 ); // topicMessages, settings, topicList, topicCollection
+    
+    CBSLOGSTRING("CBSSERVER: <<< CCbsDbImp::CreateComponentsL()");
+    }
+
+// ---------------------------------------------------------
+// DeleteComponents()     
+//
+// ---------------------------------------------------------
+void CCbsDbImp::DeleteComponents()
+    {
+    delete iTopicMessages;
+    iTopicMessages = NULL;
+
+    delete iTopicCollection;
+    iTopicCollection = NULL;
+
+#ifdef __SECURE_BACKUP__
+
+#else
+    // Delete owned objects and deregister files from
+    // backup server.
+    if ( iBackupWrapper && iSettings )
+        {
+        //iBackupWrapper->DeregisterFile( iSettings->FileName() );
+        }
+        
+    if ( iBackupWrapper && iTopicList )
+        {
+        //iBackupWrapper->DeregisterFile( iTopicList->TopicFilename() );
+        }
+#endif        
+        
+    delete iSettings;
+    iSettings = NULL;
+    
+    delete iTopicList;
+    iTopicList = NULL;
+
+#ifdef __SECURE_BACKUP__
+    delete iBackupMonitor;
+    iBackupMonitor = NULL;
+#else
+    delete iBackupWrapper;
+    iBackupWrapper = NULL;
+#endif    
+    }
+
+// ---------------------------------------------------------
+// CreateSettingsL()     
+//
+// ---------------------------------------------------------
+CCbsDbImpSettings* CCbsDbImp::CreateSettingsL()
+    {
+    CCbsDbImpSettings* settings = NULL;
+    TRAPD( err, ( settings = CCbsDbImpSettings::NewL( *this ) ) );
+    User::LeaveIfError( err );
+    return settings;
+    }
+
+// ---------------------------------------------------------
+// CreateTopicListL()     
+//
+// ---------------------------------------------------------
+CCbsDbImpTopicList* CCbsDbImp::CreateTopicListL( 
+    const TDesC& aTopicsFile,
+    const TDesC& aMessagesFile )
+    {
+    // Try to create the topic list.
+    CCbsDbImpTopicList* topicList = NULL;
+    TRAPD( err, ( topicList = CCbsDbImpTopicList::NewL(
+        iFs, aTopicsFile, aMessagesFile, *this ) ) );
+
+    // Handle data file corruption here.
+    switch ( err )
+        {
+        case KErrNone:
+            break;
+
+        case KErrCorrupt:
+        case KErrEof:
+            // The data file was corrupt. Delete it and try again.
+            CbsUtils::DeleteFileL( iFs, aTopicsFile );
+            CbsUtils::DeleteFileL( iFs, aMessagesFile );
+            topicList = CCbsDbImpTopicList::NewL(
+                iFs, aTopicsFile, aMessagesFile, *this );
+            break;
+
+        default:
+            User::Leave( err );
+            break;
+        }
+
+    return topicList;
+    }
+
+// ---------------------------------------------------------
+// CreateTopicMessagesL()     
+//
+// ---------------------------------------------------------
+CCbsDbImpTopicMessages* CCbsDbImp::CreateTopicMessagesL( 
+    CCbsDbImpTopicList& aTopicList )
+    {
+    // This cannot leave because of data file corruption.
+    return CCbsDbImpTopicMessages::NewL( aTopicList, iFs );
+    }
+
+
+// ---------------------------------------------------------
+// CreateTopicCollectionL()     
+//
+// ---------------------------------------------------------
+CCbsDbImpTopicCollection* CCbsDbImp::CreateTopicCollectionL()
+    {
+    // This does not create a data file.
+    return CCbsDbImpTopicCollection::NewL();
+    }
+
+// ---------------------------------------------------------
+// WaitForCriticalLevelL()     
+//
+// ---------------------------------------------------------
+void CCbsDbImp::WaitForCriticalLevel()
+    {
+    // We are running low on disk space. Ask for a notification
+    // when there is space again.
+    iDiskSpaceMonitor->IssueRequest();  
+    }
+
+
+// ---------------------------------------------------------
+// WaitForCriticalLevelCancel()     
+//
+// ---------------------------------------------------------
+void CCbsDbImp::WaitForCriticalLevelCancel()
+    {
+    // Cancel the notification for critical level    
+    iDiskSpaceMonitor->Cancel();    
+    }
+
+// ---------------------------------------------------------
+// ChangeFileLocksL()
+// 
+// Releases all files for backup/restore, or takes the
+// files into use again.
+// ---------------------------------------------------------
+    
+void CCbsDbImp::ChangeFileLocksL( const TCbsBackupRequest& aRequest )
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsDbImp::ChangeFileLocksL()");
+    
+    // Check/change the topiclist/topics/saved messages file
+    iTopicList->ChangeFileLockL( aRequest );
+    
+    CBSLOGSTRING("CBSSERVER: <<< CCbsDbImp::ChangeFileLocksL()");
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS ==============
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerSrc/CCbsDbImpSettings.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,476 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsDbImpSettings class 
+*                member functions.
+*    
+*                This class represents CBS settings stored in the database.
+*                A functionality is provided here to access, modify, store and restore
+*                settings.
+*
+*/
+
+
+//  INCLUDE FILES
+#include <centralrepository.h>
+#include "CbsServerPrivateCRKeys.h"
+#include "MCbsDbSettingsObserver.H"
+#include "CbsServerPanic.h"
+#include "CCbsDbImpSettings.H"
+#include "CbsDbConstants.h"
+#include "CbsStreamHelper.h"
+#include "CbsUtils.h"
+#include "CbsLogger.h"
+
+// CONSTANTS
+// Used if languages cannot be read from Shared Data.
+const TInt8 KDefaultsLanguageSubscribedValue = '1';
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpSettings::CCbsDbImpSettings
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCbsDbImpSettings::CCbsDbImpSettings(  
+    CCbsDbImp& aDatabase )
+    : iDatabase( aDatabase )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImp::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpSettings::ConstructL()
+    {
+    // Create an array for settings event observers.
+    iObservers = new ( ELeave ) CArrayFixFlat< MCbsDbSettingsObserver* >( 
+        KCbsDbObserverArraySize );
+
+    TRAPD( result, LoadSettingsL() );
+	if ( result != KErrNone )   
+		{
+		User::Leave( result );
+		}
+		
+    __TEST_INVARIANT;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpSettings::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCbsDbImpSettings* CCbsDbImpSettings::NewL( CCbsDbImp& aDatabase )
+    {
+    CCbsDbImpSettings* self = 
+        new ( ELeave ) CCbsDbImpSettings( aDatabase );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+    
+// Destructor
+CCbsDbImpSettings::~CCbsDbImpSettings()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsDbImpSettings::~CCbsDbImpSettings()");
+    delete iObservers;
+    CBSLOGSTRING("CBSSERVER: <<< CCbsDbImpSettings::~CCbsDbImpSettings()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpSettings::SetTopicDetectionStatusL
+// Changes the topic detection status.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpSettings::SetTopicDetectionStatusL( 
+    TBool aStatus )
+    {
+
+    // If the value does not change we do nothing but return
+    if ( aStatus != iSettings.iTopicDetectionStatus ) 
+        {
+        // First we change the status value in cache.
+        iSettings.iTopicDetectionStatus = aStatus;
+
+        // Now we try to save the modified settings to the store
+        if ( !SaveSettings() ) 
+            {        
+            // If an error occured, we leave the status unchanged.
+            if ( iSettings.iTopicDetectionStatus ) 
+                {
+                iSettings.iTopicDetectionStatus = EFalse;
+                }
+            else 
+                {
+                iSettings.iTopicDetectionStatus = ETrue;
+                }
+
+            // and then leave again
+            User::Leave( KErrWrite );
+            }
+
+        // Inform observers about the changed status
+        TInt amountOfObservers( iObservers->Count() );
+        for ( TInt i( 0 ); i < amountOfObservers; i++ )
+            {
+            iObservers->At( i )->TopicDetectionStatusChangedIndL();
+            }                
+        }    
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpSettings::SaveSettings
+// Saves the settings to CenRep
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCbsDbImpSettings::SaveSettings()
+    {
+    __TEST_INVARIANT;
+    TBool result( ETrue );
+
+    // Try to save the settings.
+    TRAPD( error, DoSaveSettingsL() );
+    if ( error != KErrNone )
+        {
+        // Some kind of failure occurred.
+        __TEST_INVARIANT;        
+        result = EFalse;
+        }
+
+    __TEST_INVARIANT;
+    return result;
+    }    
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpSettings::DoSaveSettingsL
+// Saves the settings to CenRep
+// The method leaves in case the writing to the does not succeed.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpSettings::DoSaveSettingsL()
+    {
+    
+    TInt reception( iSettings.iReceptionStatus );
+    TInt topicDetection( iSettings.iTopicDetectionStatus );
+    
+    TBuf< ECbsCount > languages; 
+   
+    for ( TInt i( 0 ); i < ECbsCount; i++ )
+        {
+        languages.AppendNum( iSettings.iLanguageStatus.iLanguages[i] );	
+        }
+   
+    // Connecting and initialization
+    CRepository* repository = CRepository::NewL( KCRUidCellBroadcast );
+ 
+    // Get the values from Central Repository
+    repository->Set( KCbsReception, reception );
+    repository->Set( KCbsTopicDetection, topicDetection );
+    repository->Set( KCbsLanguages, languages );
+    
+    // Closing the connection
+    delete repository;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpSettings::GetTopicDetectionStatus
+// Returns the current value of the topic detection status.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpSettings::GetTopicDetectionStatus( 
+    TBool& aStatus ) const
+    {
+    // We just give the asked status value from cache to aStatus
+    aStatus = iSettings.iTopicDetectionStatus;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpSettings::SetReceptionStatusL
+// Changes the reception status.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpSettings::SetReceptionStatusL( 
+    TBool aStatus )    
+    {
+
+    // If the value does not change we do nothing but return
+    if ( aStatus != iSettings.iReceptionStatus ) 
+        {
+        // First we change the status value in iSettings
+        iSettings.iReceptionStatus = aStatus;
+
+        // Now we try to save the modified settings to the store
+        if ( !SaveSettings() ) 
+            {
+            // If an error occured, we leave the status unchanged.
+            if ( iSettings.iReceptionStatus ) 
+                {
+                iSettings.iReceptionStatus = EFalse;
+                }
+            else 
+                {
+                iSettings.iReceptionStatus = ETrue;
+                }
+
+            // and then leave.
+            User::Leave( KErrWrite );
+            }
+
+        // Inform observers about the changed status
+        TInt amountOfObservers( iObservers->Count() );
+        for ( TInt i( 0 ); i < amountOfObservers; i++ )
+            {
+            iObservers->At( i )->ReceptionStatusChangedIndL();
+            }                
+        }    
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpSettings::GetReceptionStatus
+// Returns the current value of the topic reception status.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpSettings::GetReceptionStatus( 
+    TBool& aStatus ) const
+    {
+    // We just give the asked status value from cache to aStatus
+    aStatus = iSettings.iReceptionStatus;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpSettings::SetLanguagesL
+// Changes the preferred languages.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+void CCbsDbImpSettings::SetLanguagesL( 
+    const TCbsDbLanguages& aLanguages )
+    {
+    __TEST_INVARIANT;
+
+    // Compare language settings.
+    if ( !IsLanguagesEqual( aLanguages, iSettings.iLanguageStatus ) ) 
+        {
+        // We take a backup of the language status before changing the value.
+        TCbsDbLanguages oldLanguageStatus = iSettings.iLanguageStatus;
+        
+        // We change the language status value
+        iSettings.iLanguageStatus = aLanguages;
+
+        // Now we try to save the modified settings struct to the store
+        if ( !SaveSettings() ) 
+            {
+            // If an error occured, we leave the settings unchanged.
+            iSettings.iLanguageStatus = oldLanguageStatus;
+            User::Leave( KErrWrite );
+            }
+
+        // Inform observers about the changed status
+        TInt amountOfObservers( iObservers->Count() );
+        for ( TInt i( 0 ); i < amountOfObservers; i++ )
+            {
+            iObservers->At( i )->LanguagesChangedIndL();
+            }    
+        }
+    
+    __TEST_INVARIANT;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpSettings::GetLanguages
+// Returns the preferred languages.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+void CCbsDbImpSettings::GetLanguages( 
+    TCbsDbLanguages& aLanguages ) const
+    {
+    // We just give the asked status value from cache to aLanguages
+    aLanguages = iSettings.iLanguageStatus;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpSettings::AddObserverL
+// Adds an observer to the settings.
+// Observers are notified when an event occurs on the settings.    
+// Panics on debug mode if aObserver is null.  
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+void CCbsDbImpSettings::AddObserverL( 
+    MCbsDbSettingsObserver* aObserver )
+    {
+    __TEST_INVARIANT;
+    __ASSERT_DEBUG( aObserver!=0, CbsServerPanic( ECbsObserverNull ) );
+    iObservers->AppendL( aObserver );
+    __TEST_INVARIANT;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpSettings::RemoveObserver
+// Removes database observer.
+// The method will panic, if there is no such observer added
+// or the given observer is null.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+void CCbsDbImpSettings::RemoveObserver( 
+    const MCbsDbSettingsObserver* aObserver )
+    {
+    __ASSERT_DEBUG( aObserver != 0, CbsServerPanic( ECbsObserverNull ) );
+
+    // Find the observer to remove
+    TInt amountOfObservers( iObservers->Count() );
+    TBool found( EFalse );
+
+    for ( TInt index( 0 ); ( index < amountOfObservers ) && !found; index++ )
+        {
+        if ( aObserver == iObservers->At( index ) )
+            {
+            iObservers->Delete( index );
+            iObservers->Compress();  
+            found = ETrue;            
+            }
+        }
+
+    // Panic if the observer was not found
+    if ( !found )
+        {
+        CbsServerPanic( ECbsObserverNotFound );
+        }    
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpSettings::LoadSettingsL
+// Loads the settings, i.e. values for reception status, topic detection
+// and language subscriptions.
+// These values are retrieved from Central Repository, associated with
+// the UID of CbsServer.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+void CCbsDbImpSettings::LoadSettingsL()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsDbImpSettings::LoadSettingsL()");
+    
+    // Connecting and initialization
+    CRepository* repository = CRepository::NewL( KCRUidCellBroadcast );
+    
+    TBuf< ECbsCount > languages;
+    languages.Zero();
+
+    TInt reception( 0 );
+    TInt topicDetection( 0 );
+    
+    // Get the values from Central Repository
+    repository->Get( KCbsReception, reception );
+    repository->Get( KCbsTopicDetection, topicDetection );
+    repository->Get( KCbsLanguages, languages );
+    
+    // Closing the connection
+    delete repository;
+    
+    CBSLOGSTRING("CBSSERVER: CCbsDbImpSettings::LoadSettingsL(): Repository reading finished.");
+
+    iSettings.iReceptionStatus = reception == 0 ? EFalse : ETrue;
+    iSettings.iTopicDetectionStatus = topicDetection == 0 ? EFalse : ETrue;
+
+    if ( languages.Length() != ECbsCount )
+        {
+        User::Leave( KErrCorrupt );
+        }
+    
+    for ( TInt i( 0 ); i < ECbsCount; i++ )
+        {
+        iSettings.iLanguageStatus.iLanguages[ i ] = 
+            ( languages[ i ] == KDefaultsLanguageSubscribedValue );
+        }
+    CBSLOGSTRING("CBSSERVER: <<< CCbsDbImpSettings::LoadSettingsL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpSettings::IsLanguagesEqual
+// Determines whether the language settings are equal. 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+TBool CCbsDbImpSettings::IsLanguagesEqual( 
+    const TCbsDbLanguages& aLanguage1, 
+    const TCbsDbLanguages& aLanguage2 ) const
+    {
+    // Go through each language settings.
+    for ( TInt index( 0 ); index < ECbsCount; index++ )
+        {
+        if ( aLanguage1.iLanguages[ index ] != aLanguage2.iLanguages[ index ] )
+            {
+            return EFalse;
+            }
+        }
+
+    // Equal.
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpSettings::SetDefaultLanguageSettings
+// Sets default language settings.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+void CCbsDbImpSettings::SetDefaultLanguageSettings( 
+    TCbsDbLanguages& aLanguage ) const
+    {
+    // First, set all languages to false.
+    for ( TInt index( 0 ); index < ECbsAll; index++ )
+        {
+        aLanguage.iLanguages[ index ] = EFalse;
+        }
+
+    // And then set the "All"-choice to true.
+    aLanguage.iLanguages[ ECbsAll ] = ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpSettings::__DbgTestInvariant
+// Checks that the object is in a valid state, and panics if it is not.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+void CCbsDbImpSettings::__DbgTestInvariant() const
+    {
+#if defined(_DEBUG)
+    if ( iSettings.iReceptionStatus < 0 || iSettings.iReceptionStatus > 1 ||
+        iSettings.iTopicDetectionStatus < 0 || 
+        iSettings.iTopicDetectionStatus > 1 ||
+        iObservers == NULL )
+        {
+        User::Invariant();
+        }
+#endif
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerSrc/CCbsDbImpTopicCollection.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,295 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsDbImpTopicCollection class 
+*                member functions.
+*    
+*                Topic collection stored in the database is represented by this class.
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include "CbsCommon.h"
+#include "CbsServerPanic.h"
+#include "CCbsDbImpTopicCollection.h"
+#include "CCbsDbImp.H"
+#include "CbsDbConstants.h"
+#include "CbsLogger.h"
+
+// CONSTANTS
+
+// These values specify a range of accepted topic number values (inclusive).
+const TInt KMinTopicNumber = 1;     // 000 is not accepted.
+const TInt KMaxTopicNumber = 999;
+// Granularity for the iIdentities array
+const TInt KIdentitiesGranularity = 10;
+
+
+// ==================== LOCAL FUNCTIONS ====================
+
+// -----------------------------------------------------------------------------
+// Print
+// Prints out debug info about topics
+// Returns: None
+// -----------------------------------------------------------------------------
+//
+#ifdef _DEBUG
+void Print( const TDesC& aText, const TInt& aValue )
+    {
+    TBuf<100> stuff;
+    TBuf<10> value;
+    value.Num( aValue );
+    stuff = aText;
+    stuff.Append(value);
+    RDebug::Print(stuff);
+    }
+
+// -----------------------------------------------------------------------------
+// PrintTopicCollectionContentL
+// Prints the contentent of the Topic Collection
+// Returns: None
+// -----------------------------------------------------------------------------
+//
+void PrintTopicCollectionContentL( const CFileStore* aStore ) 
+    {
+    RDebug::Print(_L("Current topic collection content: "));
+    TStreamId rootStreamId = aStore->Root();
+    if ( rootStreamId == 0 ) 
+        {
+        RDebug::Print(_L("Store contains no root stream."));
+        return;
+        }
+    RStoreReadStream rootStream;
+    rootStream.OpenLC( *aStore, rootStreamId ); // on CS
+    TInt identityCount( rootStream.ReadUint16L() );
+
+    for ( TInt index( 0 ); index < identityCount; index++ )
+        {
+        TCbsDbTopicIdentity id;
+        id.iName.Zero();
+        TInt length( rootStream.ReadInt16L() );
+        for ( TInt index2( 0 ); index2 < length; index2++ )
+            {
+            TInt character( rootStream.ReadInt16L() );
+            id.iName.Append( TChar(character) );
+            }
+        id.iName.SetLength( length );
+    
+        id.iNumber = rootStream.ReadUint16L();
+
+        TBuf<255> buf = _L("Identity name: ");
+        buf.Append( id.iName );
+        buf.Append( _L(", number: ") );
+        buf.AppendNum( static_cast<TInt>(id.iNumber) );
+        RDebug::Print( buf );
+        }
+   
+    CleanupStack::PopAndDestroy();    // root stream
+    }
+#endif // _DEBUG
+    
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicCollection::CCbsDbImpTopicCollection
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCbsDbImpTopicCollection::CCbsDbImpTopicCollection()
+    { 
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicCollection::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicCollection::ConstructL( )
+    {
+    // Create an array for observers.
+    iObservers = new ( ELeave ) CArrayFixFlat<MCbsDbTopicCollectionObserver*>
+        ( KCbsDbObserverArraySize );
+
+    iIdentities = new ( ELeave ) CArrayFixFlat<TCbsDbTopicIdentity>
+        ( KIdentitiesGranularity );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicCollection::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCbsDbImpTopicCollection* CCbsDbImpTopicCollection::NewL()
+    {
+    // Normal two phase construction
+    CCbsDbImpTopicCollection* self = 
+            new ( ELeave ) CCbsDbImpTopicCollection();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// Destructor
+CCbsDbImpTopicCollection::~CCbsDbImpTopicCollection()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsDbImpTopicCollection::~CCbsDbImpTopicCollection()");
+    // Deallocate the observer array
+    delete iObservers;
+    delete iIdentities;
+    CBSLOGSTRING("CBSSERVER: <<< CCbsDbImpTopicCollection::~CCbsDbImpTopicCollection()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicCollection::GetTopicIdentityCount
+// Returns the number of topic identities stored in the database.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicCollection::GetTopicIdentityCount( 
+    TInt& aCount ) const
+    {
+    aCount = iIdentities->Count();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicCollection::GetTopicIdentityL
+// Returns a topic identity matching the given topic index parameter.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicCollection::GetTopicIdentityL( 
+    TInt& aIndex, 
+    TCbsDbTopicIdentity& aIdentity ) const
+    {
+    if ( aIndex >= iIdentities->Count() || aIndex < 0 )
+        {
+        User::Leave( KErrNotFound );
+        }
+    
+    aIdentity = iIdentities->At( aIndex );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicCollection::AddObserverL
+// Adds an observer. The observer will be informed of changes 
+// in the topic collection.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicCollection::AddObserverL( 
+    MCbsDbTopicCollectionObserver* aObserver )
+    {
+    __ASSERT_DEBUG( aObserver!=0, CbsServerPanic(ECbsObserverNull) );
+    iObservers->AppendL( aObserver );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicCollection::RemoveObserverL
+// Removes an observer.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicCollection::RemoveObserver( 
+    const MCbsDbTopicCollectionObserver* aObserver )
+    {
+    __ASSERT_DEBUG( aObserver != 0, CbsServerPanic( ECbsObserverNull ) );
+    TInt amountOfObservers( iObservers->Count() );
+    for ( TInt index( 0 ); index < amountOfObservers; index++ )
+        {
+        if ( aObserver == iObservers->At( index ) )
+            {
+            iObservers->Delete( index );
+            return;
+            }
+        }
+#ifdef _DEBUG
+    CbsServerPanic( ECbsObserverNotFound );
+#endif
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicCollection::ClearL
+// Clears the topic collection.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicCollection::Clear()
+    {
+    iIdentities->Reset();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicCollection::Apply
+// Writes topic identity cache (array iIdentities) into a store.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicCollection::Apply() 
+    {
+    NotifyObservers();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicCollection::AddTopicIdentityL
+// Adds a topic identity to the topic collection. This method 
+// is called by the index message handling routine after resolving a single 
+// topic number and name out of an index message.
+// Topic identities are maintained in ascending topic number order.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicCollection::AddTopicIdentityL( 
+    const TCbsDbTopicIdentity& aIdentity )
+    {
+    if ( aIdentity.iNumber < KMinTopicNumber || 
+         aIdentity.iNumber > KMaxTopicNumber )
+        {
+        User::Leave( KErrArgument );
+        }
+
+	// Insert using binary search. KErrAlreadyExists is returned, but
+	// all other error codes are passed to Leave.
+	TKeyArrayFix key( _FOFF( TCbsDbTopicIdentity, iNumber ), ECmpTUint16 );
+	TRAPD( errorCode, iIdentities->InsertIsqL( aIdentity, key ) );
+	if ( errorCode != KErrAlreadyExists )
+		{
+		User::LeaveIfError( errorCode );
+		}
+    }    
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicCollection::NotifyObservers
+// Notifies all registred observers about a topic collection contents change.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicCollection::NotifyObservers()
+    {
+    // Notify each observer.
+    TInt count( iObservers->Count() );
+    for ( TInt index( 0 ); index < count; index++ )
+        {
+        iObservers->At( index )->TopicCollectionContentsChangedInd();
+        }
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerSrc/CCbsDbImpTopicList.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,2757 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 implementation of the CCbsDbImpTopicList class
+*            member functions.
+*    
+*                This class represents the topic list contained in the database.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32svr.h>
+#include <f32file.h>
+
+#include <shareddataclient.h>   // RequestFreeDiskSpaceLC
+
+#include <barsc.h>              // Resource access
+#include <barsread.h>           // Resource access
+
+#include <CbsServer.rsg>
+
+#include "CbsServerPanic.h"
+#include "CbsStreamHelper.h"
+#include "CbsDbConstants.h"
+#include "CbsUtils.h"
+#include "CCbsDbImpTopicList.h"
+#include "MCbsDbTopicListObserver.H"
+#include "CCbsDbImpTopicMessages.h"
+
+#include "CbsLogger.h"
+
+#include <centralrepository.h>  // for local variation
+#include "cbsinternalcrkeys.h"  // for local variation
+#include "cbsvariant.hrh"       // for local variation
+ 
+// CONSTANTS
+
+// Initial size for topic cache array
+const TInt KDefaultTopicListSize = 10;
+
+// Size of the topic stream, used in checking against FFS free space limit
+const TInt KTopicStreamSize = 92;
+
+// Size of the topic messages stream, FFS critical level check
+const TInt KEmptyTopicMessagesStreamSize = 4;
+
+// Size of topic list stream, FFS critical level check
+const TInt KTopicListStreamSize = 85;
+
+// Size of topic list stream (root), FFS critical level check
+const TInt KTopicListRootStreamSize = 2;
+
+// Time in microseconds to wait after a critical store exception 
+// before a recovery attempt is made.
+const TInt KWaitAfterCriticalStoreException = 2000000;
+
+// Used when unsaved message stream ids are deleted from topic messages 
+// stream
+const TInt KTypicalNumberOfTopicMessages = 6;
+
+// Minimum interval between compacting the stores in minutes
+const TInt KMinimumCompactInterval = 30;
+
+// Number of the index topic
+const TInt KIndexTopicNumber = 0;
+
+// Space for reading messages
+const TInt KReadMessageSize = 92;
+
+const TInt KTopicsGranularity = 1;
+
+const TInt KTopicListsGranularity = 1;
+
+const TInt KTopicIdsGranularity = 5;
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::CCbsDbImpTopicList
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCbsDbImpTopicList::CCbsDbImpTopicList( 
+    RFs& aFs, 
+    CCbsDbImp& aDatabase )
+    : iDatabase( aDatabase ), 
+    iFs( aFs ),
+    iTopicCount( 0 ),
+    iInitializing( EFalse ),
+    iDeleteAllTopics( EFalse )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::ConstructL( 
+    const TDesC& aTopicsFile,
+    const TDesC& aUnsavedMessagesFile )
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsDbImpTopicList::ConstructL()");
+    
+    // Create observer array
+    iObservers = new ( ELeave ) CArrayFixFlat< MCbsDbTopicListObserver* >( 
+        KCbsDbObserverArraySize );
+
+    // Create topic array, additional memory size in new alloc, 1*192 B = 192 B
+    iTopics = new ( ELeave ) CArrayFixFlat< TCbsDbImpTopic >( KTopicsGranularity );
+
+    // Create the root item table, additional memory size in new alloc, 1*184 B = 184 B
+    iTopicLists = new ( ELeave ) CArrayFixFlat< TCbsDbImpTopicList >( KTopicListsGranularity ); 
+
+    // Create topic ID array, additional memory size in new alloc, 5*4 B = 20 B
+    iTopicIds = new ( ELeave ) CArrayFixFlat< TStreamId >( KTopicIdsGranularity ); 
+
+    // Initialize iPreviousCompact to now
+    iPreviousCompact.UniversalTime();
+
+    // Copy datafile names from parameters
+    iTopicsFilename = aTopicsFile.AllocL();
+    iUnsavedMessagesFilename = aUnsavedMessagesFile.AllocL();
+    
+    // Fetch local variation bits from CenRep    
+    CRepository* repository = CRepository::NewL( KCRUidCbsVariation );    
+    TInt err = repository->Get( KCbsVariationFlags, iLVBits );
+    CBSLOGSTRING2("CBSSERVER: CCbsRecEtel::ConstructL(): CenRep error: %d", err );    
+    if ( err )
+        {
+        iLVBits = 0;
+        }    
+    delete repository;
+
+    // If aLoadFactorySettings, then the files are recreated and initialized.
+    // If not, then the nonexisting files are created, files opened and
+    // data internalized.
+
+    TBool unsavedMsgFileExists( CbsUtils::ExistsL( iFs, *iUnsavedMessagesFilename ) );
+
+    TBool loadFactorySettings( !CbsUtils::ExistsL( iFs, aTopicsFile ) );
+    TRAPD( error, OpenFilesL( loadFactorySettings, EFalse ) );
+    
+    CBSLOGSTRING2("CBSSERVER: CCbsDbImpTopicList::ConstructL(): OpenFilesL() error: %d", error );
+    
+    if ( error == KErrDiskFull )
+        {
+        // Delete the store and open is again
+        CBSLOGSTRING("CBSSERVER: CCbsDbImpTopicList::ConstructL(): About to delete iTopicStore..." );
+        
+        delete iTopicStore;
+        iTopicStore = NULL;
+        
+        CBSLOGSTRING("CBSSERVER: CCbsDbImpTopicList::ConstructL(): iTopicStore deletion finished." );
+
+        // Try to open the store again   
+        TRAPD( error, iTopicStore = CFileStore::OpenL( iFs, *iTopicsFilename, EFileRead | EFileWrite ) );
+        CBSLOGSTRING2("CBSSERVER: CCbsDbImpTopicList::ConstructL(); iTopicStore OpenL() error: %d", error );
+        if ( error )
+            {
+            InitializeListL( ETrue );
+            }        
+        }
+    else
+        {
+        if ( loadFactorySettings )
+            {
+            // Create a topic list for standard topics
+            if ( iTopicLists->Count() == 0 )
+                {
+                CreateStandardTopicListL();
+                }                
+            }
+
+        // Only load the topics, if not already loaded when opening the files
+        if ( loadFactorySettings || unsavedMsgFileExists )
+            {
+            // Load the topics
+            LoadDefaultTopicStreamL();
+            }
+        
+        // Compact the topic store
+        TopicStoreL()->CompactL();
+        TopicStoreL()->CommitL();
+        }            
+    
+    // Reset the unread message count to be sure that UI client gets the correct information,
+    // at this point count is always zero.
+    for ( TInt i( 0 ); i < iTopics->Count(); ++i )
+        {
+        iTopics->At( i ).iTopicData.iUnreadMessages = 0;
+        }
+        
+    __TEST_INVARIANT;
+    
+    CBSLOGSTRING("CBSSERVER: <<< CCbsDbImpTopicList::ConstructL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCbsDbImpTopicList* CCbsDbImpTopicList::NewL( 
+    RFs& aFs, 
+    const TDesC& aTopicsFile, 
+    const TDesC& aUnsavedMessagesFile,
+    CCbsDbImp& aDatabase )
+    {
+    CCbsDbImpTopicList* self = 
+        new ( ELeave ) CCbsDbImpTopicList( aFs, aDatabase );
+    CleanupStack::PushL( self );
+    self->ConstructL( aTopicsFile, aUnsavedMessagesFile );
+    CleanupStack::Pop();
+    return self;
+    }
+
+// Destructor
+CCbsDbImpTopicList::~CCbsDbImpTopicList()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsDbImpTopicList::~CCbsDbImpTopicList()");
+    delete iTopics;
+    delete iTopicStore;
+    delete iTopicLists;
+    delete iTopicIds;
+    delete iUnsavedMessageStore;
+    delete iObservers;
+    delete iUnsavedMessagesFilename;
+    if ( iTopicsFilename )
+        {
+        delete iTopicsFilename;
+        }
+    CBSLOGSTRING("CBSSERVER: <<< CCbsDbImpTopicList::~CCbsDbImpTopicList()");
+    }
+
+#ifndef __SECURE_BACKUP__
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::ChangeFileLockL
+// Closes or reopens the settings file if requested by a backup.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::ChangeFileLockL( 
+    const TDesC& aFileName,
+    TFileLockFlags aFlags )
+    {
+    CBSLOGSTRING2("CBSSERVER: >>> CCbsDbImpTopicList::ChangeFileLockL() (1): flag: %d", aFlags );
+    
+    if ( aFlags == ETakeLock && iTopicStore == NULL )
+        {
+        CBSLOGSTRING("CBSSERVER: CCbsDbImpTopicList::ChangeFileLockL() (1): Try to open store...");
+        
+        // Try to open the store.
+        iTopicStore = CPermanentFileStore::OpenL( iFs, 
+            aFileName, EFileRead | EFileWrite );
+            
+        CBSLOGSTRING("CBSSERVER: CCbsDbImpTopicList::ChangeFileLockL() (1): Store opened.");
+        }
+    else if ( aFlags != ETakeLock )
+        {
+        CBSLOGSTRING("CBSSERVER: CCbsDbImpTopicList::ChangeFileLockL() (1): Deleting iTopicStore...");
+        
+        delete iTopicStore; 
+        iTopicStore = NULL;
+        
+        CBSLOGSTRING("CBSSERVER: CCbsDbImpTopicList::ChangeFileLockL() (1): iTopicStore deleted.");
+        }
+    CBSLOGSTRING("CBSSERVER: <<< CCbsDbImpTopicList::ChangeFileLockL() (1)");
+    }
+#else
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpSettings::ChangeFileLockL
+// Closes or reopens the settings file if requested by backup.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//    
+void CCbsDbImpTopicList::ChangeFileLockL( const TCbsBackupRequest& aRequest )
+    {
+    CBSLOGSTRING2("CBSSERVER: >>> CCbsDbImpTopicList::ChangeFileLockL() (2): aRequest: %d", aRequest );
+    
+    // If backing up or restoring, release locks
+    if ( ( aRequest == ECbsBackup || 
+        aRequest == ECbsRestore ) )
+        {
+        delete iTopicStore; 
+        iTopicStore = NULL;
+        
+        CBSLOGSTRING("CBSSERVER: CCbsDbImpTopicList::ChangeFileLockL() (2): iTopicStore deleted.");
+        }
+    // Else take files into use again
+    else if ( ( aRequest == ECbsNoBackup || 
+        aRequest == ECbsBackupNotDefined ) && 
+        iTopicStore == NULL)
+        {
+        CBSLOGSTRING("CBSSERVER: CCbsDbImpTopicList::ChangeFileLockL() (2): Calling CPermanentFileStore::OpenL()...");
+        // Try to open the store.
+        iTopicStore = CPermanentFileStore::OpenL( iFs, 
+            iTopicsFilename->Des(), EFileRead | EFileWrite );
+        CBSLOGSTRING("CBSSERVER: CCbsDbImpTopicList::ChangeFileLockL() (2): CPermanentFileStore::OpenL() finished.");
+        }
+    CBSLOGSTRING("CBSSERVER: <<< CCbsDbImpTopicList::ChangeFileLockL() (2)");
+    }
+
+#endif
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::CheckFileLockL
+// Check if the server has a file lock.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::CheckFileLockL() const
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsDbImpTopicList::CheckFileLockL()");
+    if ( iTopicStore == NULL )
+        {
+        CBSLOGSTRING("CBSSERVER: CCbsDbImpTopicList::CheckFileLockL(): iTopicStore == NULL, leaving with KErrLocked...");
+        User::Leave( KErrLocked );
+        }
+    CBSLOGSTRING("CBSSERVER: <<< CCbsDbImpTopicList::CheckFileLockL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::CreateNewTopicListL
+// Creates a new topic list.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::CreateNewTopicListL( const TDesC& aTopicListName )
+    {
+    // FFS critical level check
+    CbsUtils::FFSCriticalLevelCheckL( KTopicListStreamSize + 
+        KCbsDbTopicArraySize, iFs );
+
+    TInt topicListCount = iTopicLists->Count();
+
+    // Check if there already is 10 topic lists
+    if ( topicListCount < KCbsRootItemsSize )
+        {                  
+        // Create the stream for this topic list entry
+        RStoreWriteStream outstream;
+        TStreamId topicListStreamId( 
+            outstream.CreateLC( *TopicStoreL() ) ); // on CS        
+
+        // Set the values for this new topic list and set it as "current".
+        // Reset the topic count of this topic list.
+        iCurrentTopicList.iTopicCount = 0;
+
+        // Topic list stream id for this list
+        iCurrentTopicList.iTopicListId = topicListStreamId;
+    
+        // List name
+        iCurrentTopicList.iTopicListName = aTopicListName; 
+
+        // Is this the default list
+        iCurrentTopicList.iIsDefaultTopicList = ETrue;
+
+        // Number of this list, which is a int value between 0...9
+        iCurrentTopicList.iNumber = iTopicLists->Count();
+
+        // Add this list to the list array        
+        TKeyArrayFix key( _FOFF( TCbsDbImpTopicList, iNumber ), ECmpTUint16 );
+        iTopicLists->InsertIsqL( iCurrentTopicList, key );
+    
+        // Write the values to this topic list's stream
+        outstream << iCurrentTopicList.iTopicListName;
+        CbsStreamHelper::WriteBoolL( outstream, iCurrentTopicList.iIsDefaultTopicList );
+        outstream.WriteInt16L( iCurrentTopicList.iNumber );
+        outstream.WriteInt16L( iCurrentTopicList.iTopicCount );
+
+        // Write space for topic stream IDs        
+        for ( TInt i( 0 ); i < KCbsDbTopicArraySize; i++ )
+            {
+            outstream << TStreamId( 0 );
+            }        
+           
+        outstream.CommitL();
+        CleanupStack::PopAndDestroy(); // outstream    
+        
+        // Reset the topic array and add an index topic to this
+        // topic list
+        iTopics->Reset();
+        AddIndexTopicL();
+            
+        // Update the root stream
+        UpdateRootStreamL( EFalse );
+    
+        // Commit file changes
+        CommitFilesL();
+
+        // Load the topics (count = 1, Index topic only), 
+        // so that the array is up to date
+        LoadTopicsL( iCurrentTopicList.iTopicListId );            
+        } 
+    else
+        {
+        User::Leave( KErrGeneral );
+        }   
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::SetTopicMessages
+// Sets the topic messages db object for this topic list.
+// Note that this function does not transfer ownership
+// of aMessages.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::SetTopicMessages( 
+    CCbsDbImpTopicMessages* aMessages )
+    {
+    __ASSERT_ALWAYS( aMessages != NULL,
+        CbsServerPanic( ECbsTopicMessagesNull ) );
+    iMessages = aMessages;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::TopicCount
+// Returns the total amount of topics the list contains.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCbsDbImpTopicList::TopicCount() const
+    {
+    return iTopics->Count();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::TopicListCount
+// Get topic list count.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCbsDbImpTopicList::TopicListCount() const
+    {
+    return iTopicLists->Count();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::TopicStoreL
+// Returns pointer to the current store which contains topics
+// of the server (i.e., Topics-file) and saved messages. 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CFileStore* CCbsDbImpTopicList::TopicStoreL() const
+    {
+    CheckFileLockL();
+    return iTopicStore;
+    }
+
+// ---------------------------------------------------------
+// TopicFilename() 
+//
+// ---------------------------------------------------------
+const TDesC& CCbsDbImpTopicList::TopicFilename() const
+    {
+    return *iTopicsFilename;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::UnsavedMessagesStore
+// Returns a pointer to the store, which contains unsaved
+// messages of the server (Unsaved Messages-file, "cbs4.dat").
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CFileStore* CCbsDbImpTopicList::UnsavedMessagesStore() const
+    {
+    return iUnsavedMessageStore;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::UnsavedMessagesFilename
+// Returns a reference to the name of the file, which contains unsaved
+// messages of the server (Unsaved Messages-file, "cbs4.dat").
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+const TDesC& CCbsDbImpTopicList::UnsavedMessagesFilename() const
+    {
+    return *iUnsavedMessagesFilename;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::ExtractTopicNumber
+// Extracts topic handle from message handle.
+// Note that the method does not check that the message exists.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TCbsDbTopicNumber CCbsDbImpTopicList::ExtractTopicNumber( 
+    const TCbsDbMessageHandle& aHandle ) const
+    {    
+    return TCbsDbTopicNumber( aHandle >> 16 );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::GetTopicMessagesIdL
+// Returns the topic messages stream id by topic handle.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::GetTopicMessagesIdL( 
+    TCbsDbTopicNumber aNumber, TStreamId& aId ) const
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsDbImpTopicList::GetTopicMessagesIdL()");
+
+    // Find the topic.
+    TInt index( TopicIndexInList( aNumber ) );
+    CBSLOGSTRING2("CBSSERVER: CCbsDbImpTopicList::GetTopicMessagesIdL(): Leaving if index != 0. Index: %d.", index );
+    User::LeaveIfError( index );
+
+    // Return the topic message stream id.
+    aId = iTopics->At( index ).iTopicMessagesId;
+    
+    CBSLOGSTRING("CBSSERVER: <<< CCbsDbImpTopicList::GetTopicMessagesIdL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::UpdateTopicMessagesIdL
+// Updates the topic messages stream id by topic handle. 
+// The new identifier is expected not to be a null id.
+// Note that the method will not commit changes to the store. 
+// It also changes the internal state and thus if the method leaves, 
+// it is good to reload the whole root stream.
+// The method will delete the old topic messages stream.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::UpdateTopicMessagesIdL( 
+    TCbsDbTopicNumber aNumber, 
+    const TStreamId& aNewId )
+    {
+    __TEST_INVARIANT;
+    // Find position.
+    TInt index( TopicIndexInList( aNumber ) );
+    User::LeaveIfError( index );
+
+    // Get the old id.
+    TStreamId oldId( iTopics->At( index ).iTopicMessagesId );
+
+    // Get the topic information.
+    TCbsDbTopic topic;
+    GetTopicL( index, topic );
+
+    // Write information to the stream.
+    RStoreWriteStream outstream;
+    outstream.OpenLC( *TopicStoreL(), iTopics->At( index ).iTopicId ); // on CS
+    WriteTopicInformationL( outstream, topic, aNewId );
+    outstream.CommitL();
+    CleanupStack::PopAndDestroy();
+
+    // Delete the old stream.
+    TopicStoreL()->DeleteL( oldId );
+
+    // Update the topic messages id.
+    iTopics->At( index ).iTopicMessagesId = aNewId;
+    __TEST_INVARIANT;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::GenerateMessageHandle
+// Generates a new message handle using the topic 
+// handle of the message and a given random value.
+// Note that it must be checked that the message handle is unique 
+// in that topic.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TCbsDbMessageHandle CCbsDbImpTopicList::GenerateMessageHandle( 
+    const TCbsDbTopicNumber aNumber, 
+    TUint16 aRandom ) const
+    {
+    return ( aNumber << 16 ) + aRandom;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::ReloadRootStreamL
+// Reloads the root stream to the memory.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::ReloadRootStreamL()
+    {
+    LoadRootStreamL();
+    __TEST_INVARIANT;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::InformNewMessageReceivedL
+// Informs that a new message has been received in a topic.
+// This method is called by CCbsDbImpTopicMessages. After internal 
+// records are changed, the observers are informed of this event.
+// Note: leaves changes in stores uncommited.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::InformNewMessageReceivedL( 
+    const TCbsDbMessageHandle& aMessageHandle )
+    {
+    __TEST_INVARIANT;
+    // Find topic by handle.
+    TCbsDbTopicNumber number( ExtractTopicNumber( aMessageHandle ) );
+
+    TCbsDbTopic topic;
+    FindTopicByNumberL( number, topic );
+
+    topic.iUnreadMessages++;
+
+    // Increase the counter in cache
+    TInt position = TopicIndexInList( topic.iNumber );
+    iTopics->At( position ).iTopicData.iUnreadMessages++;
+
+    // Write topic information to topic stream but leave changes uncommited.
+    UpdateTopicCountersL( topic, EFalse );    
+
+    if ( topic.iHotmarked )
+        {
+        SetHotmarkedMessage( aMessageHandle );
+        }
+
+    __TEST_INVARIANT;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::InformMessageSavedL
+// Informs that a message has been set as saved.
+// Updates the saved messages counters
+// for the topic of the message and the whole system.
+// Called by CCbsDbTopicMessages.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::InformMessageSavedL( 
+    const TCbsDbMessageHandle& aMessageHandle )
+    {
+    __TEST_INVARIANT;
+    // Find topic by handle.
+    TCbsDbTopicNumber number( ExtractTopicNumber( aMessageHandle ) );
+
+    TCbsDbTopic topic;
+    FindTopicByNumberL( number, topic );
+
+    topic.iSavedMessages++;
+
+    // Increase the counter in cache
+    TInt position = TopicIndexInList( topic.iNumber );
+    iTopics->At( position ).iTopicData.iSavedMessages++;
+
+    // Write topic information to topic stream but leave changes uncommited.
+    UpdateTopicCountersL( topic, EFalse );
+
+    __TEST_INVARIANT;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::InformUnreadMessageReadL
+// Informs that an unread message has been read.
+// Updates the counters when a message is read by the client. 
+// Note: leaves changes in stores uncommited.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::InformUnreadMessageReadL( 
+    const TCbsDbMessageHandle& aMessageHandle )
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsDbImpTopicList::InformUnreadMessageReadL()");
+    
+    __TEST_INVARIANT;
+
+    // Check for file lock
+    CheckFileLockL();
+
+    // Check disk space
+    TRAPD( error, CbsUtils::FFSCriticalLevelCheckL( KReadMessageSize, iFs ) );
+    CBSLOGSTRING2("CBSSERVER: CCbsDbImpTopicList::InformUnreadMessageReadL(): FFSCriticalLevelCheckL returned: %d", error );
+    if ( error == KErrDiskFull )
+        {
+        return;
+        }
+
+    // Find topic by number.
+    TCbsDbTopicNumber number( ExtractTopicNumber( aMessageHandle ) );
+
+    TCbsDbTopic topic;
+    FindTopicByNumberL( number, topic );
+
+    // Decrease the counter
+    topic.iUnreadMessages--;
+
+    // Decrease the counter in cache
+    TInt position = TopicIndexInList( topic.iNumber );
+    iTopics->At( position ).iTopicData.iUnreadMessages--;
+
+    // Write topic information to topic stream but leave changes uncommited.
+    UpdateTopicCountersL( topic, EFalse );
+
+    __TEST_INVARIANT;
+    
+   CBSLOGSTRING("CBSSERVER: <<< CCbsDbImpTopicList::InformUnreadMessageReadL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::InformMessageDeletedL
+// Informs that an unread message has been deleted.
+// Updates the counters when a message is deleted. 
+// Note: leaves changes in stores uncommited.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::InformMessageDeletedL( 
+    const TCbsDbMessageHandle& aMessageHandle,
+    TBool aPermanent, 
+    TBool aRead )
+    {
+    // Find topic by handle.
+    TCbsDbTopicNumber number( ExtractTopicNumber( aMessageHandle ) );
+
+    TCbsDbTopic topic;
+    FindTopicByNumberL( number, topic );
+
+    TInt position = TopicIndexInList( topic.iNumber );    
+
+    if ( aPermanent )
+        {
+        topic.iSavedMessages--;
+        iTopics->At( position ).iTopicData.iSavedMessages--;
+        }
+    
+    if ( !aRead )
+        {        
+        topic.iUnreadMessages--;
+        iTopics->At( position ).iTopicData.iUnreadMessages--;
+        }
+
+    // Write topic information to topic stream but leave changes uncommited.
+    UpdateTopicCountersL( topic, ETrue );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::TotalSavedMessages
+// Returns the number of saved messages in the current topic list.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCbsDbImpTopicList::TotalSavedMessages() const
+    {
+    // Return the total amount of saved messages.
+    TInt count( 0 );
+    for ( TInt i( 0 ); i < iTopics->Count(); i++ )
+        {
+        count += iTopics->At( i ).iTopicData.iSavedMessages;
+        }
+
+    return count;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::GetTopicCount
+// Returns the number of topic stored in this topic list.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::GetTopicCount( 
+    TInt& aCount ) const
+    {
+    // Return the total amount of topics.
+    aCount = TopicCount();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::InitializeListL
+// Initializes the whole topic list. 
+// Creates and opens the topic list file, 
+// invalidates the cache and informs the observers.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::InitializeListL( const TBool aFileOpenFailed )
+    {
+    __TEST_INVARIANT;
+
+    if ( !aFileOpenFailed )
+        {
+        // Check for file lock
+        CheckFileLockL();
+        }    
+
+    // About to write to FFS: make critical level check
+    CbsUtils::FFSCriticalLevelCheckL( 0, iFs );
+
+    if ( iMessages != NULL && iMessages->IsLockedMessages() )
+        {
+        User::Leave( KErrAccessDenied );
+        }    
+
+    // If only one topic list exists, just delete and recreate the whole file
+    if ( iTopicLists->Count() == 1 || aFileOpenFailed == 1 )
+        {
+        delete iTopicStore; 
+        iTopicStore = NULL;
+        delete iUnsavedMessageStore; 
+        iUnsavedMessageStore = NULL;
+        CbsUtils::DeleteFileL( iFs, *iTopicsFilename  );
+        CbsUtils::DeleteFileL( iFs, *iUnsavedMessagesFilename );
+
+        iTopicLists->Reset();
+       
+        // Create new files.
+        OpenFilesL( EFalse, ETrue );
+        }
+    
+    iIsHotmarkedMessage = EFalse;
+    iLastTopicNumber = 0;
+    iMessageHandle = 0;
+
+    // Inform the message manager.
+    if ( iMessages )
+        {
+        iMessages->InvalidateCache();
+        }
+
+    // Notify everyone.
+    NotifyTopicListInitializedL();
+
+    __TEST_INVARIANT;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::GetTopicL
+// Returns a topic matching the given index.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::GetTopicL( 
+    TInt aIndex, 
+    TCbsDbTopic& aTopic )
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsDbImpTopicList::GetTopicL()");
+
+    __TEST_INVARIANT;
+    
+    // Check that aIndex is in proper range.
+    if ( ( aIndex < 0 ) || ( aIndex >= iTopics->Count() ) )
+        {
+        CBSLOGSTRING("CBSSERVER: CCbsDbImpTopicList::GetTopicL(): Leaving with KErrArgument...");
+        User::Leave( KErrArgument );
+        }
+
+    // And then get the information from the array.
+    aTopic = iTopics->At( aIndex ).iTopicData;
+
+    CBSLOGSTRING("CBSSERVER: <<< CCbsDbImpTopicList::GetTopicL()");
+    
+    __TEST_INVARIANT;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::FindTopicByNumberL
+// Returns a topic matching the given topic number 
+// (in GSM Specs this is called the Message Identifier)
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::FindTopicByNumberL( 
+    TCbsDbTopicNumber aNumber, 
+    TCbsDbTopic& aTopic )
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsDbImpTopicList::FindTopicByNumberL()");
+    
+    __TEST_INVARIANT;
+
+    TInt topicIndex( TopicIndexInList( aNumber ) );
+    CBSLOGSTRING2("CBSSERVER: CCbsDbImpTopicList::FindTopicByNumberL(): Leaving if topicIndex < 0: topicIndex: %d.", topicIndex );
+    User::LeaveIfError( topicIndex );
+
+    GetTopicL( topicIndex, aTopic );
+
+    CBSLOGSTRING("CBSSERVER: <<< CCbsDbImpTopicList::FindTopicByNumberL()");
+    
+    __TEST_INVARIANT;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::AddTopicL
+// Adds a new topic to the list.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::AddTopicL( 
+    TCbsDbTopic& aTopic, const TBool aDetected )
+    {
+    __TEST_INVARIANT;
+
+    // Check for file lock
+    CheckFileLockL();
+    
+    // Check that topic number is in proper range
+    if ( !CheckTopicNumber( aTopic.iNumber ) )
+        {
+        User::Leave( KErrArgument );
+        }    
+
+    // Check if there is a topic with the 
+    // same topic number in current topic list.
+    if ( TopicIndexInList( aTopic.iNumber ) != KErrNotFound )
+        {
+        User::Leave( KErrAlreadyExists );
+        } 
+
+    // There should not be any saved or unread messages
+    aTopic.iSavedMessages = 0;
+    aTopic.iUnreadMessages = 0;
+
+    // Variated feature. Also, only topics that were not detected automatically
+    // are subscribed by default.
+    if ( iLVBits & KCbsLVFlagTopicSubscription && !aDetected )
+        {
+        aTopic.iSubscribed = ETrue;
+        }
+    else
+        {
+        aTopic.iSubscribed = EFalse;        
+        }
+        
+    // Now we have the handle, so let's add the topic.
+    TRAPD( error, DoAddTopicL( aTopic ) );
+    if ( error != KErrNone )
+        {
+        RevertFilesL();
+        __TEST_INVARIANT;
+        User::Leave( error );
+        }
+    else
+        {        
+        iLastTopicNumber = aTopic.iNumber;
+        NotifyTopicAddedL( aTopic.iNumber );        
+        }        
+    
+    __TEST_INVARIANT;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::UpdateTopicNameAndNumberL
+// Updates the name and the topic number of a topic 
+// matching the given handle to the database.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::UpdateTopicNameAndNumberL( 
+    TCbsDbTopicNumber aOldNumber,
+    TCbsDbTopicNumber aNewNumber, 
+    const TCbsDbTopicName& aName )
+    {
+    // Check for file lock
+    CheckFileLockL();
+
+    // First, check that the new number is ok.
+    if ( !CheckTopicNumber( aNewNumber ) )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    // First find and then update.
+    TCbsDbTopic topic;
+    FindTopicByNumberL( aOldNumber, topic );
+
+    // If no changes to topic, no need to update
+    if ( !( aOldNumber == aNewNumber && topic.iName == aName ) )
+        {        
+        if ( topic.iProtected )
+            {
+            User::Leave( KErrAccessDenied );
+            }
+
+        topic.iName = aName;
+        topic.iNumber = aNewNumber;
+
+        UpdateTopicL( aOldNumber, topic );        
+        }    
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::UpdateTopicSubscriptionStatusL
+// Updates the new topic subscription status to the database.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::UpdateTopicSubscriptionStatusL( 
+    TCbsDbTopicNumber aNumber, 
+    TBool aStatus )
+    {
+    __TEST_INVARIANT;
+
+    // Update topic subsciption status.
+    TCbsDbTopic topic;
+    FindTopicByNumberL( aNumber, topic );
+
+    topic.iSubscribed = aStatus;
+    UpdateTopicL( aNumber, topic );
+    __TEST_INVARIANT;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::UpdateTopicHotmarkStatusL
+// Updates the new topic hotmarking status to the database.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::UpdateTopicHotmarkStatusL( 
+    TCbsDbTopicNumber aNumber, 
+    TBool aStatus )
+    {
+    __TEST_INVARIANT;
+
+    // Check for file lock
+    CheckFileLockL();
+
+    // Update topic hotmark status.
+    TCbsDbTopic topic;
+    FindTopicByNumberL( aNumber, topic );
+
+    topic.iHotmarked = aStatus;
+    UpdateTopicL( aNumber, topic );
+    __TEST_INVARIANT;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::DeleteTopicL
+// Deletes an existing topic and all its messages.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::DeleteTopicL( 
+    TCbsDbTopicNumber aNumber )
+    {
+    __TEST_INVARIANT;
+
+    // Try to find the position. If it is not found, leave.
+    TInt position( TopicIndexInList( aNumber ) );
+    User::LeaveIfError( position );
+
+    // Check that there are no locked messages in the topic.
+    if ( iMessages->IsLockedMessagesInTopic( aNumber ) )
+        {
+        User::Leave( KErrAccessDenied );
+        }
+
+    // Topic only in one topic list, not an index topic, so delete the topic.
+    if ( aNumber != 0 )
+        {
+        // Just try to delete
+        TRAPD( error, DoDeleteTopicL( position ) );
+        if ( error != KErrNone )
+            {
+            // It failed, so we must revert.
+            RevertFilesL();
+
+            // Inform the topic messages.
+            iMessages->InvalidateCacheIfTopic( aNumber );
+
+            __TEST_INVARIANT;
+            User::Leave( error );
+            }
+        else
+            {               
+            // Notify the observers
+            NotifyTopicDeletedL( aNumber );
+            }
+        }
+    __TEST_INVARIANT;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::GetUnreadMessageCount
+// Gets the total amount of unread messages.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::GetUnreadMessageCount( 
+    TInt& aCount ) const
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsDbImpTopicList::GetUnreadMessageCount()");
+    CBSLOGSTRING2("CBSSERVER: CCbsDbImpTopicList::GetUnreadMessageCount(): Topic count: %d", iTopics->Count() );
+    
+    // Return the total amount of unread messages.
+    TInt count( 0 );
+    for ( TInt i( 0 ); i < iTopics->Count(); i++ )
+        {
+        count += iTopics->At( i ).iTopicData.iUnreadMessages;
+        }
+
+    aCount = count;
+    
+    CBSLOGSTRING2("CBSSERVER: CCbsDbImpTopicList::GetUnreadMessageCount(): Unread msgs found: %d", count );
+    CBSLOGSTRING("CBSSERVER: <<< CCbsDbImpTopicList::GetUnreadMessageCount()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::GetHotmarkedMessageHandleL
+// Returns the handle to the latest hotmarked message.      
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::GetHotmarkedMessageHandleL( 
+    TCbsDbMessageHandle& aMessage )
+    {
+    __TEST_INVARIANT;
+    
+    // Check if there is a hotmarked message.
+    if ( iIsHotmarkedMessage )
+        {
+        // If there is, then return it.
+        aMessage = iMessageHandle;
+        iIsHotmarkedMessage = EFalse;
+        }
+    else
+        {
+        // Otherwise leave.
+        __TEST_INVARIANT;
+        User::Leave( KErrNotFound );
+        }
+    __TEST_INVARIANT;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::UnreadHotmarkedMessageCount
+// Returns the handle to the latest hotmarked message.      
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCbsDbImpTopicList::UnreadHotmarkedMessageCount() const
+    {
+    // Return the total amount of unread messages in hotmarked topics.
+    TInt count( 0 );
+    for ( TInt i( 0 ); i < iTopics->Count(); i++ )
+        {
+        TCbsDbTopic& topic = iTopics->At( i ).iTopicData;
+        if ( topic.iHotmarked )
+            {
+            count += topic.iUnreadMessages;
+            }
+        }
+    return count;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::AddObserverL
+// Adds a topic list observer. 
+// After an observer is added to the topic list, 
+// it will be notified whenever an event occurs.      
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::AddObserverL(
+    MCbsDbTopicListObserver* aObserver )
+    {
+    __ASSERT_DEBUG( aObserver != 0, CbsServerPanic( ECbsObserverNull ) );
+    iObservers->AppendL( aObserver );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::RemoveObserver
+// Removes a topic list observer. 
+// If aObserver is not in the list, the method will panic.  
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::RemoveObserver( 
+    const MCbsDbTopicListObserver* aObserver )
+    {
+    __TEST_INVARIANT;
+    __ASSERT_DEBUG( aObserver != 0, CbsServerPanic( ECbsObserverNull ) );
+    
+    TBool observerFound( EFalse );
+    TInt amountOfObservers( iObservers->Count() );
+
+    // Check if the observer exists and 
+    // find its possible location index in the array.
+    for ( TInt index( 0 ); ( index < amountOfObservers ) && !observerFound; index++ )
+        {
+        if ( aObserver == iObservers->At( index ) )
+            {
+            iObservers->Delete( index );
+            observerFound = ETrue;
+            }
+        }
+
+    __TEST_INVARIANT;
+
+#ifdef _DEBUG
+    if ( !observerFound )
+        {
+        CbsServerPanic( ECbsObserverNotFound );
+        }
+#endif
+
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::TopicIndexInList
+// Finds the index of the topic matching the given topic number
+// in the topic list.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCbsDbImpTopicList::TopicIndexInList( 
+    TCbsDbTopicNumber aNumber ) const
+    {
+    // Create a TCbsDbImpTopic to compare against and use a binary search.
+    TKeyArrayFix key( _FOFF( TCbsDbImpTopic, iTopicData.iNumber ), ECmpTUint16 );
+    TCbsDbImpTopic dummy;
+    TInt position;
+
+    dummy.iTopicData.iNumber = aNumber;
+    TInt result( iTopics->FindIsq( dummy, key, position ) );
+    
+    if ( result != KErrNone )
+        {
+        position = KErrNotFound;
+        }
+
+    return position;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::GetNextAndPrevTopicNumberL
+// Retrieves numbers of topics that precede and succeed the topic
+// with number aCurrentTopic.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::GetNextAndPrevTopicNumberL( 
+    const TCbsTopicNumber& aCurrentTopic,
+    TCbsTopicNumber& aNextTopic, 
+    TCbsTopicNumber& aPrevTopic,
+    TInt& aPosition )
+    {
+    // Determine position of requested topic in topic list.
+    TInt index( TopicIndexInList( aCurrentTopic ) );
+    User::LeaveIfError( index );    // if KErrNotFound
+    
+    // Determine position indications
+    aPosition = 0;
+    if ( index == 0 )
+        {
+        aPosition |= ECbsHead;
+        }
+    else
+        {
+        aPrevTopic = iTopics->At( index-1 ).iTopicData.iNumber;
+        }
+
+    if ( index == iTopics->Count()-1 )
+        {
+        aPosition |= ECbsTail;
+        }
+    else
+        {
+        aNextTopic = iTopics->At( index+1 ).iTopicData.iNumber;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::NotifyNewMessageArrivedL
+// Notifies each observer that a new message has arrived to a topic.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::NotifyNewMessageArrivedL(
+    const TCbsDbMessageHandle& aHandle )
+    {
+    // Notify each observer.
+    TInt count( iObservers->Count() );
+    for ( TInt index( 0 ); index < count; index++ )
+        {
+        iObservers->At( index )->TopicNewMessageReceivedIndL( aHandle );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::AppendSubscribedTopicsL
+// Adds numbers of subscribed topics to the given array.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::AppendSubscribedTopicsL( 
+    CArrayFixFlat<TUint16>& aSubscriptions ) const
+    {
+    TInt count( iTopics->Count() );
+    for ( TInt i( 0 ); i < count; i++ ) 
+        {
+        TCbsDbImpTopic& topic = iTopics->At( i );
+        if ( topic.iTopicData.iSubscribed )
+            {
+            aSubscriptions.AppendL( topic.iTopicData.iNumber );
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::LoadRootStreamL
+// Loads the root stream to the memory.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::LoadRootStreamL()
+    {
+    __ASSERT_DEBUG( iTopicLists != NULL, 
+        CbsServerPanic( ECbsTopicListArrayNull ) );
+
+    // Get the root stream and open it.
+    TStreamId id( TopicStoreL()->Root() );
+    RStoreReadStream instream;
+    instream.OpenLC( *TopicStoreL(), id ); // on CS
+
+    // Load the topic list count
+    TInt topicListCount( instream.ReadInt16L() );
+
+    // Sanity check
+    if ( topicListCount < 0 )
+        {
+        User::Leave( KErrCorrupt );
+        }
+
+    // Reset the topic list array
+    iTopicLists->Reset();    
+
+    // Load the topic list information
+    TCbsDbImpTopicList item; 
+    instream >> item.iTopicListId;
+    ReadTopicListInformationL( item.iTopicListId, item );
+    iTopicLists->AppendL( item );
+        
+    // Destroy the stream.
+    CleanupStack::PopAndDestroy(); // instream
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::LoadDefaultTopicStreamL
+// Loads the default topic list to the memory.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::LoadDefaultTopicStreamL()
+    {
+    __ASSERT_DEBUG( iTopics != NULL, 
+        CbsServerPanic( ECbsTopicListArrayNull ) );
+
+    // Read root item count
+    TInt topicListCount = iTopicLists->Count();
+
+    // If there isn't any, create a topic list for standard topics here
+    if ( topicListCount == 0 )
+        {
+        CreateStandardTopicListL();
+        topicListCount = iTopicLists->Count();
+        }
+
+    TStreamId defaultTopicListId( 0 );
+    TBool quitSearch( EFalse );
+
+    TInt i;
+    // Find the default topic list      
+    for ( i = 0; ( i < topicListCount ) && !quitSearch; ++i )
+        {
+        if ( iTopicLists->At( i ).iIsDefaultTopicList )
+            {            
+            defaultTopicListId = iTopicLists->At( i ).iTopicListId;
+            quitSearch = ETrue;
+            }        
+        }
+        
+    CArrayFixFlat< TStreamId >* topicIds = 
+        new ( ELeave ) CArrayFixFlat< TStreamId >( KTopicIdsGranularity );
+
+    // Open the default topic list stream
+    RStoreReadStream instream;
+    instream.OpenLC( *TopicStoreL(), defaultTopicListId ); // on CS
+
+    // Set the ID
+    iCurrentTopicList.iTopicListId = defaultTopicListId;
+    
+    // Set the name
+    HBufC* topicListName = HBufC::NewL( instream, KCbsDbTopicNameLength );
+    iCurrentTopicList.iTopicListName.Copy( topicListName->Des() );
+    delete topicListName;
+    topicListName = NULL;
+
+    // Skip default list status, since it is always true in default topic list
+    CbsStreamHelper::ReadBoolL( instream );
+    iCurrentTopicList.iIsDefaultTopicList = ETrue;
+
+    // Set the topic list number
+    iCurrentTopicList.iNumber = instream.ReadInt16L();
+    
+    // Read the amount of topics
+    TInt topicCount = instream.ReadInt16L();
+    iCurrentTopicList.iTopicCount = topicCount;
+
+    // Clear the topic array.
+    iTopics->ResizeL( 0 );
+
+    TStreamId id( 0 );
+
+    // Load the topic IDs       
+    for ( i = 0; i < topicCount; i++ )
+        {
+        instream >> id;
+        topicIds->AppendL( id );
+        }   
+    
+    // Destroy the stream.
+    CleanupStack::PopAndDestroy();
+       
+    // Load necessary information for each topic
+    TInt count = topicIds->Count();
+    TCbsDbImpTopic topic;
+    for ( i = 0; i < count; i++ )
+        {
+        ReadTopicInformationL( topicIds->At( i ), topic );
+
+        if ( topic.iTopicData.iNumber == KIndexTopicNumber )
+            {
+            HBufC* indexName = ReadIndexTopicNameLC(); // on CS
+            topic.iTopicData.iName.Copy( *indexName );
+            CleanupStack::PopAndDestroy(); // indexName
+            }
+
+        iTopics->AppendL( topic );
+        }
+    delete topicIds;
+    topicIds = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::ReadTopicListInformationL
+// Reads topic list information from stream.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::ReadTopicListInformationL( 
+    const TStreamId& aId, 
+    TCbsDbImpTopicList& aTopicList ) const
+    {
+    RStoreReadStream instream;
+    instream.OpenLC( *TopicStoreL(), aId ); // on CS
+
+    // Topic List name
+    HBufC* topicListName = HBufC::NewL( instream, KCbsDbTopicNameLength );
+    aTopicList.iTopicListName.Copy( topicListName->Des() );
+    delete topicListName;
+    topicListName = NULL;
+
+    // Default list status
+    aTopicList.iIsDefaultTopicList = CbsStreamHelper::ReadBoolL( instream );
+
+    // Topic List number
+    aTopicList.iNumber = instream.ReadInt16L();
+
+    // Topic count of this topic list
+    aTopicList.iTopicCount = instream.ReadInt16L();   
+
+    CleanupStack::PopAndDestroy(); // instream
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::ReadTopicInformationL
+// Reads all information on topic found in stream aId
+// into aTopic.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::ReadTopicInformationL( 
+    const TStreamId& aId, 
+    TCbsDbImpTopic& aTopic ) const
+    {
+    RStoreReadStream instream;
+    instream.OpenLC( *TopicStoreL(), aId ); // on CS
+
+    // Topic ID
+    aTopic.iTopicId = aId;
+
+    // Read saved messages.
+    aTopic.iTopicData.iSavedMessages = instream.ReadInt16L();
+
+    // Read name.
+    instream >> aTopic.iTopicData.iName;
+    
+    // Read topic number (message identifier)
+    aTopic.iTopicData.iNumber = instream.ReadInt16L();
+
+    // Read statuses
+    aTopic.iTopicData.iProtected = CbsStreamHelper::ReadBoolL( instream ); // Protected
+    aTopic.iTopicData.iSubscribed = CbsStreamHelper::ReadBoolL( instream );// Subscribed
+    aTopic.iTopicData.iHotmarked = CbsStreamHelper::ReadBoolL( instream ); // Hotmarked
+    
+    // Read unread messages count
+    aTopic.iTopicData.iUnreadMessages = instream.ReadInt16L();
+
+    // Topic messages' stream ID
+    instream >> aTopic.iTopicMessagesId;
+
+    // Sanity check
+    if ( aTopic.iTopicData.iSavedMessages > KCbsDbMaxSavedMessages
+        || aTopic.iTopicData.iNumber > KCbsMaxValidTopicNumber
+        || aTopic.iTopicData.iUnreadMessages > KCbsDbMaxReceivedMessages )
+        {
+        User::Leave( KErrCorrupt );
+        }
+
+    CleanupStack::PopAndDestroy(); // instream
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::DoAddTopicL
+// Adds a topic into the database.
+// Assumes aTopic is not a duplicate.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::DoAddTopicL( 
+    const TCbsDbTopic& aTopic )
+    {
+    // About to write to FFS: make critical level check
+    CbsUtils::FFSCriticalLevelCheckL( KTopicStreamSize + 
+        KEmptyTopicMessagesStreamSize, iFs );  
+
+    // Generate general information about topic.
+    TCbsDbImpTopic topic;
+    topic.iTopicData = aTopic;
+    
+    // Write stream for messages.
+    topic.iTopicMessagesId = 
+        CCbsDbImpTopicMessages::CreateDefaultTopicMessagesStreamL( 
+            *TopicStoreL() );
+
+    // Create stream for topic information.
+    RStoreWriteStream outstream;
+    topic.iTopicId = outstream.CreateLC( *TopicStoreL() ); // on CS
+    
+    WriteTopicInformationL( outstream, aTopic, topic.iTopicMessagesId );
+
+    outstream.CommitL();
+    CleanupStack::PopAndDestroy(); // outstream
+
+    // Now, insert the new topic information to the array
+    TKeyArrayFix key( _FOFF( TCbsDbImpTopic, iTopicData.iNumber ), ECmpTUint16 );
+    iTopics->InsertIsqL( topic, key );    
+
+    // Update the topic list stream
+    UpdateTopicListStreamL( iCurrentTopicList, EFalse );
+  
+    // We have modified only iTopicStore, so if CommitFilesL() leaves,
+    // we either get all committed or nothing committed.
+    CommitFilesL();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::DoUpdateTopicL
+// Updates the data for a topic into the database.
+// The position of the topic in the list is
+// changed if necessary. 
+// If the position has to be changed, the handles of messages
+// contained in the topic have to be changed as well because
+// the high word of the handle identifies the topic by it's
+// number.
+// Please note that standard EPOC DoSomethingL protocol
+// is not followed here as this function does NOT commit
+// changes made to the store. Instead, the caller must ensure
+// use of proper commit/revert operations.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::DoUpdateTopicL( 
+    const TCbsDbTopic& aTopic, 
+    TBool aNeedToChange, 
+    TInt aOldPosition,
+    TBool aDeleting )
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsDbImpTopicList::DoUpdateTopicL()");
+    
+    RSharedDataClient sharedData;
+    // About to write to FFS: make critical level check
+    if ( aDeleting )
+        {
+        User::LeaveIfError( sharedData.Connect() );
+        sharedData.RequestFreeDiskSpaceLC( KTopicStreamSize ); // on CS
+        }
+    else
+        {
+        CbsUtils::FFSCriticalLevelCheckL( KTopicStreamSize, iFs );
+        }
+
+    TInt newPosition( aOldPosition );
+
+    // If there is need to change position, change it.
+    if ( aNeedToChange )
+        {
+        TCbsDbImpTopic topic( iTopics->At( aOldPosition ) );
+
+        // Adjust handles of topic messages to match the changed topic number.
+        iMessages->UpdateHandlesOfTopicMessagesL( 
+            topic.iTopicData.iNumber, aTopic.iNumber );
+            
+        // Delete topic from the array.
+        iTopics->Delete( aOldPosition );        
+
+        // Set the number and reinsert into array
+        topic.iTopicData.iNumber = aTopic.iNumber;
+        TKeyArrayFix key( _FOFF( TCbsDbImpTopic, iTopicData.iNumber ), ECmpTUint16 );
+        newPosition = iTopics->InsertIsqL( topic, key );
+        }
+
+    iTopics->At( newPosition ).iTopicData.iSubscribed = aTopic.iSubscribed;
+    iTopics->At( newPosition ).iTopicData.iHotmarked = aTopic.iHotmarked;
+    iTopics->At( newPosition ).iTopicData.iName = aTopic.iName;
+    iTopics->At( newPosition ).iTopicData.iSavedMessages = aTopic.iSavedMessages;
+    iTopics->At( newPosition ).iTopicData.iUnreadMessages = aTopic.iUnreadMessages;
+    
+    // Replace existing stream.
+    RStoreWriteStream outstream;
+    outstream.ReplaceLC( *TopicStoreL(), 
+        iTopics->At( newPosition ).iTopicId ); // on CS
+    WriteTopicInformationL( outstream, aTopic, 
+        iTopics->At( newPosition ).iTopicMessagesId );
+
+    outstream.CommitL();
+    CleanupStack::PopAndDestroy(); // outstream
+
+    // Free the reserved space
+    if ( aDeleting )
+        {
+        CleanupStack::PopAndDestroy(); // disk space
+        sharedData.Close();
+        }
+    
+    // Update topic list stream, if necessary.
+    if ( aNeedToChange )
+        {
+        UpdateTopicListStreamL( iCurrentTopicList, EFalse );
+        }
+    
+    CBSLOGSTRING("CBSSERVER: <<< CCbsDbImpTopicList::DoUpdateTopicL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::DoDeleteTopicL
+// Deletes a topic from the given position in the database.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::DoDeleteTopicL( 
+    TInt aPosition )
+    {
+    // Check that the topic is not protected.
+    TCbsDbTopic topic;
+    GetTopicL( aPosition, topic );
+
+    // It is not allowed to delete a topic that is protected. It must
+    // first be updated to be not protected.
+    if ( topic.iProtected )
+        {
+        User::Leave( KErrAccessDenied );
+        }
+
+    // First delete all messages the topic contains.
+    RStoreReadStream instream;    
+    instream.OpenLC( *TopicStoreL(), 
+        iTopics->At( aPosition ).iTopicMessagesId ); // on CS
+    CCbsDbImpTopicMessages::DeleteAllTopicMessagesL( *TopicStoreL(), 
+        *iUnsavedMessageStore, instream );
+    iMessages->InvalidateCache();
+    CleanupStack::PopAndDestroy(); // instream
+
+    // Delete topic and topic messages streams.
+    TopicStoreL()->DeleteL( iTopics->At( aPosition ).iTopicMessagesId );
+    TopicStoreL()->DeleteL( iTopics->At( aPosition ).iTopicId );    
+
+    // Remove from the internal cache.
+    iTopics->Delete( aPosition );
+
+    iCurrentTopicList.iTopicCount--;                
+    UpdateTopicListStreamL( iCurrentTopicList, ETrue );
+    CommitFilesL();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::UpdateRootStreamL
+// Updates the root stream. 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::UpdateRootStreamL(
+    TBool aDeleting )
+    {      
+    // Check the free space
+    TInt neededSpace( KTopicListRootStreamSize + iTopicLists->Count() * 2 );        
+
+    RSharedDataClient sharedData;
+    // About to write to FFS: make critical level check
+    if ( aDeleting )
+        {
+        User::LeaveIfError( sharedData.Connect() );
+        sharedData.RequestFreeDiskSpaceLC( neededSpace ); // on CS
+        }
+    else
+        {
+        CbsUtils::FFSCriticalLevelCheckL( neededSpace, iFs );
+        }
+
+    // Now there is room for all topics. So we can just replace.
+    RStoreWriteStream outstream;
+    outstream.ReplaceLC( *TopicStoreL(), TopicStoreL()->Root() ); // on CS        
+
+    // Write root stream
+    WriteRootStreamL( outstream );
+    CleanupStack::PopAndDestroy(); // outstream
+
+    // Free the reserved space
+    if ( aDeleting )
+        {
+        CleanupStack::PopAndDestroy(); // disk space
+        sharedData.Close();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::UpdateTopicListStreamL
+// Updates topic list stream. 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::UpdateTopicListStreamL( 
+    TCbsDbImpTopicList& aTopicList,
+    TBool aDeleting )
+    {        
+    TInt neededSpace( KTopicListStreamSize + iTopics->Count() * 2 );
+    
+    RSharedDataClient sharedData;
+    // About to write to FFS: make critical level check
+    if ( aDeleting )
+        {
+        User::LeaveIfError( sharedData.Connect() );
+        sharedData.RequestFreeDiskSpaceLC( neededSpace ); // on CS
+        }
+    else
+        {
+        CbsUtils::FFSCriticalLevelCheckL( neededSpace, iFs );
+        }
+    
+    // Replace the stream
+    RStoreWriteStream outstream;
+    outstream.ReplaceLC( *TopicStoreL(), aTopicList.iTopicListId ); // on CS
+    
+    // Write root stream
+    WriteTopicListStreamL( outstream, aTopicList );
+    CleanupStack::PopAndDestroy(); // outstream
+    
+    // Free the reserved space
+    if ( aDeleting )
+        {
+        CleanupStack::PopAndDestroy(); // disk space
+        sharedData.Close();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::UpdateTopicL
+// Updates the information for a topic already existing 
+// in the database.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::UpdateTopicL( 
+    TCbsDbTopicNumber aTopicNumber, 
+    TCbsDbTopic& aTopic )
+    {
+    // Check that the new topic number is unique.
+    TBool needToChangePosition( ETrue );
+
+    // Try to find the topic and leave if it was not found.
+    TInt oldPosition( TopicIndexInList( aTopicNumber ) );
+    User::LeaveIfError( oldPosition );
+
+    // Check if we have to change the position of the topic in the 
+    // internal array
+    if ( aTopic.iNumber == aTopicNumber )
+        {
+        needToChangePosition = EFalse;
+        }
+    else
+        {
+        TInt topicWithTheNewNumber( TopicIndexInList( aTopic.iNumber ) );
+        if ( topicWithTheNewNumber != KErrNotFound && 
+             topicWithTheNewNumber != oldPosition )
+            {
+            User::Leave( KErrAlreadyExists );
+            }
+        }
+
+    // Write data to store.
+    // Deviation from EPOC standards: DoUpdateTopicL does NOT commit 
+    // the store.
+    TRAPD( result, DoUpdateTopicL( aTopic, needToChangePosition, 
+        oldPosition, EFalse ) );
+
+    // Commit both topic and unsaved msgs store
+    if ( result == KErrNone )
+        {
+        TRAP( result, CommitFilesL() );
+        }
+
+    // If either DoUpdateTopicL or CommitFilesL fails => revert.
+    if ( result != KErrNone )
+        {
+        TopicStoreL()->Revert();
+        ReloadRootStreamL();
+        User::Leave( result );
+        }    
+    else
+        {
+        // Notify the observers.
+        NotifyTopicModifiedL( aTopicNumber );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::CheckTopicNumber
+// Checks if a topic number is valid.
+// The valid topic number range in this implementation is 
+// 000..999, with 000 indicating an index message.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCbsDbImpTopicList::CheckTopicNumber( 
+    TCbsDbTopicNumber aNumber ) const
+    {
+    // Check that the number is in proper range
+    return aNumber <= KCbsMaxValidTopicNumber;        
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::WriteRootStreamL
+// Write the root stream.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::WriteRootStreamL( 
+    RWriteStream& aOut ) const
+    {
+    // Write the total amount of topic lists 
+    TInt topicListCount( iTopicLists->Count() );
+    aOut.WriteInt16L( topicListCount );
+    
+    // Write space for topic list stream ids
+    TInt index;
+    for ( index = 0; index < topicListCount; index++ )
+        {
+        aOut << iTopicLists->At( index ).iTopicListId;
+        }
+    
+    // Write null stream ids
+    for ( ; index < KCbsRootItemsSize; index++ )
+        {
+        aOut << TStreamId( 0 );
+        }
+    
+    aOut.CommitL();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::WriteTopicListStreamL
+// Writes topic list information to specified stream.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::WriteTopicListStreamL( 
+    RWriteStream& aOut, 
+    TCbsDbImpTopicList& aTopicList ) const
+    {
+    // Write the values to this topic list's stream
+
+    // Topic List name
+    aOut << aTopicList.iTopicListName;
+
+    // Is this the default list
+    CbsStreamHelper::WriteBoolL( aOut, aTopicList.iIsDefaultTopicList );
+
+    // Topic List number
+    aOut.WriteInt16L( aTopicList.iNumber );
+
+    // NUmber of topics in this list
+    aOut.WriteInt16L( iTopics->Count() );
+
+    // Write the stream IDs of the topics belonging to this list    
+    TInt i;
+    for ( i = 0; i < iTopics->Count(); i++ )
+        {
+        aOut << iTopics->At( i ).iTopicId;
+        }
+
+    // Write space for the rest topic stream IDs    
+    for ( ; i < KCbsDbTopicArraySize; i++ )
+        {
+        aOut << TStreamId( 0 );
+        }        
+           
+    aOut.CommitL();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::NotifyTopicListInitializedL
+// Notifies each observer that the topic list has been initialized.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::NotifyTopicListInitializedL()
+    {
+    // Notify each observer.
+    TInt count( iObservers->Count() );
+    for( TInt index( 0 ); index < count; index++ )
+        {
+        iObservers->At( index )->TopicListInitializedIndL();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::NotifyTopicAddedL
+// Notifies each observer that a topic has been added.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::NotifyTopicAddedL( 
+    TCbsDbTopicNumber aNumber )
+    {
+    // Notify each observer.
+    TInt count( iObservers->Count() );
+    for ( TInt index( 0 ); index < count; index++ )
+        {
+        iObservers->At( index )->TopicAddedIndL( aNumber );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::NotifyTopicModifiedL
+// Notifies each observer that a topic has been modified.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::NotifyTopicModifiedL( 
+    TCbsDbTopicNumber aNumber )
+    {
+    // Notify each observer.
+    TInt count( iObservers->Count() );
+    for( TInt index( 0 ); index < count; index++ )
+        {
+        iObservers->At( index )->TopicModifiedIndL( aNumber );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::NotifyTopicDeletedL
+// Notifies each observer that a topic has been deleted.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::NotifyTopicDeletedL( 
+    TCbsDbTopicNumber aNumber )
+    {
+    // Notify each observer.
+    TInt count( iObservers->Count() );
+    for( TInt index( 0 ); index < count; index++ )
+        {
+        iObservers->At( index )->TopicDeletedIndL( aNumber );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::SetHotmarkedMessage
+// Sets the hotmarked message handle.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::SetHotmarkedMessage( 
+    const TCbsDbMessageHandle& aMessageHandle )
+    {
+    // Set the hotmarked message.
+    iIsHotmarkedMessage = ETrue;
+    iMessageHandle = aMessageHandle;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::CreateDefaultRootStreamL
+// Creates a root stream and writes default values into it. 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TStreamId CCbsDbImpTopicList::CreateDefaultRootStreamL( 
+    CStreamStore& aStore ) const
+    {
+    // Create the stream
+    RStoreWriteStream outstream;
+    TStreamId id( outstream.CreateLC( aStore ) ); // on CS
+
+    // Write the amount of topic lists
+    outstream.WriteInt16L( 0 );
+
+    // Write space for topic list stream ids
+    for ( TInt index( 0 ); index < KCbsRootItemsSize; index++ )
+        {
+        outstream << TStreamId( 0 );
+        } 
+
+    outstream.CommitL();
+    CleanupStack::PopAndDestroy(); // aStore
+
+    // Return the stream id.
+    return id;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::WriteTopicInformationL
+// Writes topic data into a stream.
+// This includes number of saved messages, 
+// number of unread messages, topic handle, 
+// topic name, topic number, protection status, 
+// subscription status and hotmark status.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::WriteTopicInformationL( 
+    RWriteStream& aOut, 
+    const TCbsDbTopic& aTopic, 
+    const TStreamId& aTopicMessagesId ) const
+    {
+    // Write saved messages.
+    aOut.WriteInt16L( aTopic.iSavedMessages );
+
+    // Write name.
+    aOut << aTopic.iName;
+    
+    // Write topic number (message identifier)
+    aOut.WriteInt16L( aTopic.iNumber );
+
+    // Write statuses
+    CbsStreamHelper::WriteBoolL( aOut, aTopic.iProtected ); // Protected
+    CbsStreamHelper::WriteBoolL( aOut, aTopic.iSubscribed ); // Subscribed
+    CbsStreamHelper::WriteBoolL( aOut, aTopic.iHotmarked ); // Hotmarked
+    
+    // Write unread messages count
+    aOut.WriteInt16L( aTopic.iUnreadMessages );
+
+    // And then write the topic messages stream id.
+    aOut << aTopicMessagesId;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::RevertFilesL
+// Reverts all changes made to three datafiles handled by this class.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::RevertFilesL()
+    {
+
+    // Check for file lock
+    CheckFileLockL();
+
+    iTopicStore->Revert();   
+    iUnsavedMessageStore->Revert();
+    ReloadRootStreamL();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::CommitFilesL
+// Commits all changes made to two datafiles handled by this class.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::CommitFilesL()
+    {
+    TopicStoreL()->CommitL();
+    TInt errorCode( iUnsavedMessageStore->Commit() );
+
+    // If committing of the unsaved msg store fails, remove all
+    // messages in the store and rebuild the topic list
+    if ( errorCode != KErrNone )
+        {
+        TRAPD( errorCode2, RebuildUnsavedMessageStoreL() );
+        if ( errorCode2 != KErrNone )
+            {
+            CActiveScheduler::Stop();
+            User::Leave( KErrServerTerminated );
+            }
+
+        // Tell the caller that something went wrong
+        User::Leave( errorCode );
+        }
+
+    // Check if we should compact
+    TTime now;
+    TTimeIntervalMinutes interval;
+    now.UniversalTime();
+    now.MinutesFrom( iPreviousCompact, interval );
+    if ( interval.Int() >= KMinimumCompactInterval )
+        {
+        TopicStoreL()->CompactL();
+        iUnsavedMessageStore->CompactL();
+        iPreviousCompact = now;
+        }
+
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::RebuildUnsavedMessageStoreL
+// Deletes the unsaved messages' store and rebuilds it.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::RebuildUnsavedMessageStoreL() 
+    {
+    // Close the stores and delete the unsaved store
+    delete iUnsavedMessageStore; iUnsavedMessageStore = NULL;
+    delete iTopicStore; iTopicStore = NULL;
+    CbsUtils::DeleteFileL( iFs, *iUnsavedMessagesFilename );
+
+    // Re-create the store
+    DoCreateStoreL( *iUnsavedMessagesFilename );
+    TryToOpenFilesL( ETrue, EFalse );
+
+    // Remove the stream ids to unsaved messages, because
+    // they were all just deleted.
+    HandleDeletionOfUnsavedMessagesFileL();
+
+    // Compact the topic list
+    TopicStoreL()->CommitL();
+    TopicStoreL()->CompactL();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::RebuildTopicAndUnsavedStoresL
+// Deletes and rebuilds topic/topic list and unsaved message stores.
+// Loads Standard Topic List into memory.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::RebuildTopicAndUnsavedStoresL()
+    {
+    __TEST_INVARIANT;
+
+    // Check for file lock
+    CheckFileLockL();
+
+    // About to write to FFS: make critical level check
+    CbsUtils::FFSCriticalLevelCheckL( KTopicListRootStreamSize + 
+        KDefaultTopicListSize * 2, iFs );
+    
+    if ( iMessages != NULL && iMessages->IsLockedMessages() )
+        {
+        User::Leave( KErrAccessDenied );
+        }
+
+    delete iTopicStore; 
+    iTopicStore = NULL;
+    delete iUnsavedMessageStore; 
+    iUnsavedMessageStore = NULL;
+    CbsUtils::DeleteFileL( iFs, *iTopicsFilename  );
+    CbsUtils::DeleteFileL( iFs, *iUnsavedMessagesFilename );
+
+    // Create new files.
+    OpenFilesL( ETrue, EFalse );
+
+    // Add standard index topic.
+    AddIndexTopicL();
+    
+    // Load the Standard Topic list
+    LoadDefaultTopicStreamL();
+
+    iIsHotmarkedMessage = EFalse;
+    iLastTopicNumber = 0;
+    iMessageHandle = 0;
+
+    // Inform the message manager.
+    if ( iMessages )
+        {
+        iMessages->InvalidateCache();
+        }
+
+    // Notify everyone.
+    NotifyTopicListInitializedL();
+
+    __TEST_INVARIANT;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::GetLatestTopicNumber
+// Returns the number of the topic that was added last
+// to the database by topic detection feature.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCbsDbImpTopicList::GetLatestTopicNumber( 
+    TCbsTopicNumber& aNumber ) const
+    {
+    TInt result( KErrNone );
+    if ( iLastTopicNumber == 0 )
+        {
+        result = KErrNotFound;
+        }
+    aNumber = iLastTopicNumber;
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::OpenFilesL
+// After a call to this function, the file stores can be assumed
+// to be open and initialized.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::OpenFilesL( 
+    TBool aDeleteExistingFiles,
+    TBool aCreateNewTopicList )
+    {
+    __ASSERT_DEBUG( iTopicsFilename->Length() > 0, 
+        CbsServerPanic( ECbsInvalidFilenameDescriptor ) );
+    __ASSERT_DEBUG( iUnsavedMessagesFilename->Length() > 0, 
+        CbsServerPanic( ECbsInvalidFilenameDescriptor ) );
+
+    // if LFS, delete files, create files, open files, write root stream
+    // if not LFS, create file if it doesn't exist, open files
+
+    // Close file stores.
+    delete iTopicStore; 
+    iTopicStore = NULL;
+    delete iUnsavedMessageStore; 
+    iUnsavedMessageStore = NULL;
+
+    // If any of files doesn't exist, create the file. Also writes the root 
+    // stream of the topic file, if necessary.
+    // It is possible that this operation fails because FFS is full.
+    // In this case the server will take a break and retry. If the second
+    // attempt fails, the server is shut down.
+    TBool unsavedMsgFileExists( EFalse );
+    TRAPD( result, CreateFilesIfNecessaryL( unsavedMsgFileExists ) );
+    if ( result != KErrNone )
+        {
+        // Critical exception: wait for a while and retry.
+        User::After( KWaitAfterCriticalStoreException );
+        TBool ignoreThis( EFalse ); // value of unsavedMsgFileExists preserved
+        TRAP( result, CreateFilesIfNecessaryL( ignoreThis ) );
+        if ( result != KErrNone )
+            {
+            __DEBUGGER();
+            // Recovery is not possible: shut the server down.
+            CActiveScheduler::Stop();
+            User::Leave( KErrServerTerminated );
+            }
+        }
+
+    // Open the files for use. Also reads the topic file root stream.
+    TryToOpenFilesL( unsavedMsgFileExists == EFalse && 
+                     aDeleteExistingFiles == EFalse, 
+                     aCreateNewTopicList );
+
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::CreateFilesIfNecessaryL
+// Creates CBS files, if appropriate.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::CreateFilesIfNecessaryL( 
+    TBool& aUnsavedMsgFileExisted )
+    {    
+    if ( CbsUtils::ExistsL( iFs, *iTopicsFilename ) == EFalse )
+        {
+        CbsUtils::FFSCriticalLevelCheckL( KTopicListRootStreamSize + 
+            KDefaultTopicListSize * 2, iFs );
+   
+        CPermanentFileStore* store = CPermanentFileStore::CreateLC( iFs,
+            *iTopicsFilename, EFileWrite ); // on CS
+    
+        store->SetTypeL( store->Layout() );
+        TStreamId id( CreateDefaultRootStreamL( *store ) );
+        store->SetRootL( id );
+        store->CommitL();
+        CleanupStack::PopAndDestroy(); // store
+        }    
+
+    aUnsavedMsgFileExisted = CbsUtils::ExistsL( iFs, 
+        *iUnsavedMessagesFilename );
+    if ( aUnsavedMsgFileExisted == EFalse )
+        {
+        // No critical level check, because unsaved msgs reside on ramdisk
+        DoCreateStoreL( *iUnsavedMessagesFilename );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::DoCreateStoreL
+// Creates an empty file store with the given filename.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::DoCreateStoreL( 
+    const TDesC& aFilename )
+    {
+    CFileStore* store = CPermanentFileStore::CreateLC( iFs, 
+        aFilename, EFileWrite ); // on CS
+    store->SetTypeL( store->Layout() );
+    store->CommitL();
+    CleanupStack::PopAndDestroy();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::TryToOpenFilesL
+// Tries to open topic and unsaved messages files.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::TryToOpenFilesL( 
+    TBool aDeleteUnsavedMsgStreamIds,
+    TBool aCreateNewTopicList )
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsDbImpTopicList::TryToOpenFilesL()" );
+    
+    if ( !iTopicStore )
+        {
+        CBSLOGSTRING("CBSSERVER: CCbsDbImpTopicList::TryToOpenFilesL(): *** NO iTopicStore (1) ***" );    
+        }
+    
+    // Try to open the store    
+    TRAPD( error, iTopicStore = CFileStore::OpenL( iFs, *iTopicsFilename, EFileRead | EFileWrite ) );
+    CBSLOGSTRING2("CBSSERVER: CCbsDbImpTopicList::TryToOpenFilesL(); iTopicStore OpenL() error: %d", error );
+    
+    TRAPD( error2, iUnsavedMessageStore = CFileStore::OpenL( iFs, *iUnsavedMessagesFilename, EFileRead | EFileWrite ) );
+    CBSLOGSTRING2("CBSSERVER: CCbsDbImpTopicList::TryToOpenFilesL(); iUnsavedMessageStore OpenL() error: %d", error2 );
+       
+    if ( error || error2 )
+        {
+        CBSLOGSTRING("CBSSERVER: CCbsDbImpTopicList::TryToOpenFilesL(): Calling InitializeListL( ETrue )..." );
+        
+        InitializeListL( ETrue );
+        
+        CBSLOGSTRING("CBSSERVER: CCbsDbImpTopicList::TryToOpenFilesL(): Calling InitializeListL( ETrue ) finished." );
+        }
+    else
+        {
+        if ( iTopicLists->Count() == 0 && 
+            aDeleteUnsavedMsgStreamIds && 
+            aCreateNewTopicList )
+            {
+            // Create first topic list, since it was deleted with the file
+            CreateStandardTopicListL();
+            }
+                                               
+        // Load the root stream for topic store.
+        LoadRootStreamL();
+
+        if ( aDeleteUnsavedMsgStreamIds )
+            {
+            // Load the topics and repair the topic file 
+            // since unsaved msg file has been deleted
+            LoadDefaultTopicStreamL();
+            HandleDeletionOfUnsavedMessagesFileL();
+            }
+        }
+    CBSLOGSTRING("CBSSERVER: <<< CCbsDbImpTopicList::TryToOpenFilesL()" );
+    }
+
+// ---------------------------------------------------------
+// CCbsDbImpTopicList::ReadIndexTopicNameLC()
+// Reads the localized index topic name
+// (other items were commented in a header).
+// ---------------------------------------------------------
+HBufC* CCbsDbImpTopicList::ReadIndexTopicNameLC()
+    {
+    // Open localized resource file.
+    RResourceFile resourceFile;
+
+    CbsUtils::FindAndOpenDefaultResourceFileLC( iFs, resourceFile ); // on CS
+    // Read "Index"-string.
+    TResourceReader reader;
+    reader.SetBuffer( resourceFile.AllocReadLC( R_TEXT_INDEX_TOPIC ) );//on CS
+    HBufC* text = reader.ReadHBufCL();
+    CleanupStack::PopAndDestroy(2); // readerBuf, resourceFile
+    CleanupStack::PushL( text );
+
+    return text;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::AddIndexTopicL
+// Adds index topic to topic list.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::AddIndexTopicL()
+    {
+    // Open localized resource file.
+    HBufC* text = ReadIndexTopicNameLC();
+
+    TCbsDbTopic topic;
+    topic.iName.Copy( *text );
+    topic.iNumber = 0;
+    topic.iHotmarked = EFalse;
+    topic.iProtected = ETrue;
+    topic.iSubscribed = ETrue;
+    topic.iSavedMessages = 0;
+    topic.iUnreadMessages = 0;
+
+    // Add the topic without notifying anybody.
+    TRAPD( error, DoAddTopicL( topic ) );
+    if ( error != KErrNone )
+        {
+        RevertFilesL();
+        __TEST_INVARIANT;
+        User::Leave( error );
+        }
+
+    CleanupStack::PopAndDestroy();  // text
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::HandleDeletionOfUnsavedMessagesFileL
+// Called to repair the database when Unsaved messages -file
+// has been deleted, but Topics-file still contains information
+// on unsaved messages.
+//  
+// Things to do here: 
+//      - Reset unread message counters, because a saved message
+//        is always also read.
+//      - Remove stream ids to unsaved messages from 
+//        Topic messages -streams.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::HandleDeletionOfUnsavedMessagesFileL()
+    {
+    TRAPD( result, DoHandleDeletionOfUnsavedMessagesFileL() );
+    if ( result != KErrNone )
+        {
+        // Recovery impossible -> reset the database.
+        // Note that this function is not called when the database
+        // is initialized.
+        RebuildTopicAndUnsavedStoresL();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::DoHandleDeletionOfUnsavedMessagesFileL
+// Does the work for HandleDeletionOfUnsavedMessagesFileL().
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::DoHandleDeletionOfUnsavedMessagesFileL()
+    {
+    // Reset the unread counter of each topic and delete stream ids of 
+    // unsaved messages.
+    TInt numberOfTopics( iTopics->Count() );
+    for ( TInt i( 0 ); i < numberOfTopics; i++ )
+        {
+        TCbsDbTopic topic;
+        FindTopicByNumberL( iTopics->At( i ).iTopicData.iNumber, topic );
+        topic.iUnreadMessages = 0;
+        DoUpdateTopicL( topic, EFalse, i, EFalse );
+        DeleteUnsavedMessageStreamIdsL( iTopics->At( i ).iTopicMessagesId );
+        }
+
+    UpdateTopicListStreamL( iCurrentTopicList, ETrue );
+    TopicStoreL()->CommitL();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::DeleteUnsavedMessageStreamIdsL
+// This function is called when the unsaved messages file has
+// been deleted but the Topic messages -stream still contains
+// stream ids to deleted message streams.
+// All stream ids found in the given topic messages -stream 
+// pointing to the unsaved messages file are removed.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::DeleteUnsavedMessageStreamIdsL( 
+    const TStreamId& aMsgStreamId ) const
+    {
+    CArrayFixFlat< TStreamId >* streamIds = 
+        new ( ELeave ) CArrayFixFlat< TStreamId >( KTypicalNumberOfTopicMessages );
+    CleanupStack::PushL( streamIds );
+
+    RStoreReadStream instream;
+    instream.OpenLC( *TopicStoreL(), aMsgStreamId ); // on CS
+
+    // Read msg count
+    TInt numberOfMsgs( instream.ReadInt16L() );
+
+    // Read max msg count
+    TInt maxNumberOfMsgs( instream.ReadInt16L() );
+
+    TInt index( 0 );
+
+    for ( ; index < numberOfMsgs; index++ )
+        {
+        TBool saved( CbsStreamHelper::ReadBoolL( instream ) );
+        TStreamId id( 0 );
+        instream >> id;
+        if ( saved )
+            {
+            streamIds->AppendL( id );
+            }
+        }
+
+    CleanupStack::PopAndDestroy();  // instream
+
+    // Write stream ids of saved messages into the new topic message stream
+    // which replaces the stream identified with aMsgStreamId.
+    RStoreWriteStream outstream;    
+    outstream.ReplaceLC( *TopicStoreL(), aMsgStreamId ); // on CS
+
+    TInt numberOfSavedmessages( streamIds->Count() ); 
+
+    // Number of messages = number of saved messages
+    outstream.WriteInt16L( numberOfSavedmessages );
+
+    // Number of saved messages <= number of messages <= maxNumberOfMsgs
+    outstream.WriteInt16L( maxNumberOfMsgs );
+
+    for ( index = 0; index < numberOfSavedmessages; index++ )
+        {
+        // All messages are saved (i.e., permanent)
+        CbsStreamHelper::WriteBoolL( outstream, ETrue );
+        outstream << streamIds->At( index );
+        }
+
+    for ( ; index < maxNumberOfMsgs; index ++ )
+        {
+        CbsStreamHelper::WriteBoolL( outstream, EFalse );
+        outstream << TStreamId( 0 );
+        }
+
+    outstream.CommitL();
+    CleanupStack::PopAndDestroy(2);  // outstream, streamIds
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::UpdateTopicCountersL
+// Resolves the topic position in topic list and uses this information
+// to call DoUpdateTopicL.       
+// Changes to stores are NOT commited.
+// Call to DoUpdateTopicL is not trapped.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::UpdateTopicCountersL( 
+    const TCbsDbTopic& aTopic,
+    const TBool aDeleting )
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsDbImpTopicList::UpdateTopicCountersL()");
+    
+    // Find out the position of the topic in topic list.    
+    TInt index( TopicIndexInList( aTopic.iNumber ) );
+    if ( index == KErrNotFound )
+        {
+        User::Leave( KErrNotFound );
+        }   
+
+    // DoUpdateTopicL leaves changes uncommited. EFalse for not having to
+    // change topic position in topic list.
+    DoUpdateTopicL( aTopic, EFalse, index, aDeleting );
+    
+    CBSLOGSTRING("CBSSERVER: <<< CCbsDbImpTopicList::UpdateTopicCountersL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::CreateStandardTopicListL
+// Creates the Standard topic list (topic list no. 0)
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::CreateStandardTopicListL()
+    {
+    // Read standard topic list name from the resource file
+    RResourceFile resourceFile;
+    CbsUtils::FindAndOpenDefaultResourceFileLC( iFs, resourceFile ); // on CS
+
+    TResourceReader reader;
+    reader.SetBuffer( resourceFile.AllocReadLC( R_TEXT_STANDARD_TOPIC_LIST ) ); // on CS
+    HBufC* standardTopicListName = reader.ReadHBufCL();
+    CleanupStack::PushL( standardTopicListName );
+
+    // Create a new topic list
+    CreateNewTopicListL( standardTopicListName->Des() );
+
+    CleanupStack::PopAndDestroy( 3 ); // resourceFile, reader, standardTopicListName
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::LoadTopicsIdsL
+// Reads topic IDs of a topic list from the stream.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::LoadTopicsIdsL( 
+    const TStreamId& aTopicListStreamId )
+    {
+    // Open the topic list stream
+    RStoreReadStream instream;
+    instream.OpenLC( *TopicStoreL(), aTopicListStreamId ); // on CS
+
+    // Skip topic list name
+    delete HBufC::NewL( instream, KCbsDbTopicNameLength );
+
+    // Skip default list status
+    CbsStreamHelper::ReadBoolL( instream );
+
+    // Skip Topic List number
+    instream.ReadInt16L();
+    
+    // Skip the amount of topics
+    TInt topicCount = instream.ReadInt16L();
+
+    // Clear the array
+    iTopicIds->ResizeL( 0 );
+
+    TStreamId id( 0 );
+
+    // Load the topic IDs       
+    for ( TInt i = 0; i < topicCount; i++ )
+        {
+        instream >> id;
+        iTopicIds->AppendL( id );
+        }   
+    
+    CleanupStack::PopAndDestroy(); // instream
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::LoadTopicsL
+// Loads topics of a specified topic list.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::LoadTopicsL( 
+    const TStreamId& aTopicListStreamId )
+    {
+    // Open the topic list stream
+    RStoreReadStream instream;
+    instream.OpenLC( *TopicStoreL(), aTopicListStreamId ); // on CS
+
+    // Skip topic list name
+    delete HBufC::NewL( instream, KCbsDbTopicNameLength );
+
+    // Skip default list status
+    CbsStreamHelper::ReadBoolL( instream );
+
+    // Skip Topic List number
+    instream.ReadInt16L();
+    
+    // Skip the amount of topics
+    TInt topicCount = instream.ReadInt16L();
+
+    // Clear the arrays
+    iTopics->ResizeL( 0 );
+    iTopicIds->ResizeL( 0 );
+
+    TStreamId id( 0 );
+
+    // Load the topic IDs 
+    TInt i;
+    for ( i = 0; i < topicCount; i++ )
+        {
+        instream >> id;
+        iTopicIds->AppendL( id );
+        }   
+    
+    CleanupStack::PopAndDestroy(); // instream
+   
+    // Load necessary information for each topic
+    TInt count = iTopicIds->Count();
+    TCbsDbImpTopic topic;
+    for ( i = 0; i < count; i++ )
+        {
+        ReadTopicInformationL( iTopicIds->At( i ), topic );
+
+        if ( topic.iTopicData.iNumber == KIndexTopicNumber )
+            {
+            HBufC* indexName = ReadIndexTopicNameLC(); // on CS
+            topic.iTopicData.iName.Copy( *indexName );
+            CleanupStack::PopAndDestroy(); // indexName
+            }
+        iTopics->AppendL( topic );
+        }    
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::UpdateTopicStreamIdsL
+// Updates the topic stream IDs.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::UpdateTopicStreamIdsL( 
+    const TCbsDbTopicNumber aTopicNumber )
+    {
+    // Try to find the topic from current topic list
+    TInt position( TopicIndexInList( aTopicNumber ) );
+    if ( position >= 0 )
+        {
+        // Remove from the internal cache of this topic list
+        iTopics->Delete( position );
+
+        iCurrentTopicList.iTopicCount--;
+
+        // Update the stream
+        UpdateTopicListStreamL( iCurrentTopicList, EFalse );
+        CommitFilesL();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicList::__DbgTestInvariant
+// Checks that the object is in a valid state, and panics if it is not.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicList::__DbgTestInvariant() const
+    {
+    /*
+#if defined(_DEBUG)
+#endif
+    */
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerSrc/CCbsDbImpTopicMessages.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,1720 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsDbImpTopicMessages class 
+*                member functions. 
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+
+#include <shareddataclient.h>
+
+#include "CbsServerPanic.h"
+#include "CbsStreamHelper.h"
+#include "CbsUtils.h"
+#include "CbsDbConstants.h"
+#include "CCbsDbImpTopicList.h"
+#include "CCbsDbImpTopicMessages.h"
+#include "CCbsRecEtel.h"
+#include "CCbsReceiverHelper.h"
+
+#include "CbsLogger.h"
+
+// CONSTANTS
+
+// Expected maximum number of locked messages at once. 
+const TInt KDefaultSpaceForLockedMessages = 1;
+
+// CB message header size in bytes.
+const TInt KCbMessageHeaderSize = 16;
+
+// The space used for the header of messages stream
+const TInt KMessageRootStreamSize = 6;
+
+/// The space used by one message in the messages stream
+const TInt KMessageEntrySize = 3;
+
+// Default space reserved for topic messages in message stream
+const TInt KDefaultSpaceForMessages = 6;
+
+// Space for reading messages
+const TInt KReadMessageSize = 92;
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::CCbsDbImpTopicMessages
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCbsDbImpTopicMessages::CCbsDbImpTopicMessages( 
+    CCbsDbImpTopicList& aTopicList, 
+    RFs& aFs )
+    :iTopicList( aTopicList ), 
+    iCacheValid( EFalse ), 
+    iCachedTopicNumber( 0 ), 
+    iFs( aFs )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicMessages::ConstructL()
+    {
+    // Allocate the default size for the message list.
+    iMessageList = 
+        new ( ELeave ) CArrayFixFlat< TCbsDbImpTopicMessagesCacheItem > 
+            ( KCbsDbMaxReceivedMessages + KCbsDbMaxSavedMessages );
+
+    // Allocate the array for locked messages.
+    iLockedMessages = new ( ELeave ) CArrayFixFlat< TCbsDbMessageHandle >
+        ( KDefaultSpaceForLockedMessages );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCbsDbImpTopicMessages* CCbsDbImpTopicMessages::NewL( 
+    CCbsDbImpTopicList& aTopicList, RFs& aFs )
+    {
+    CCbsDbImpTopicMessages* self = 
+        new ( ELeave ) CCbsDbImpTopicMessages( aTopicList, aFs );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+    
+// Destructor
+CCbsDbImpTopicMessages::~CCbsDbImpTopicMessages()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsDbImpTopicMessages::~CCbsDbImpTopicMessages()");
+    // Invalidate cache.
+    InvalidateCache();
+
+    // And then delete the message list.
+    delete iMessageList;
+    
+    // Delete locked messages.
+    delete iLockedMessages; 
+    CBSLOGSTRING("CBSSERVER: <<< CCbsDbImpTopicMessages::~CCbsDbImpTopicMessages()");   
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::InvalidateCache
+// Resets the cache to default values.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicMessages::InvalidateCache()
+    {    
+    // Initialize members back to default.
+    iCacheValid = EFalse;
+    iCachedTopicNumber = 0;
+        
+    // Resize the message list. After the call is made, the
+    // array is empty.
+    if ( iMessageList )
+        {
+        iMessageList->Reset();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::InvalidateCacheIfTopic
+// Resets the cache to default values.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicMessages::InvalidateCacheIfTopic( 
+    const TCbsDbTopicNumber& aNumber )
+    {
+    // Check the handle and then invalidate
+    if ( iCachedTopicNumber == aNumber )
+        {
+        InvalidateCache();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::CreateDefaultTopicMessagesStreamL
+// Creates a default topic messages stream.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TStreamId CCbsDbImpTopicMessages::CreateDefaultTopicMessagesStreamL(
+    CStreamStore& aStore )
+    {
+    // Create the stream.
+    RStoreWriteStream outstream;
+    TStreamId id = outstream.CreateLC( aStore ); // on CS
+
+    // Write total amount of messages.
+    outstream.WriteInt16L( 0 );
+
+    // Write total amount of space for messages.
+    outstream.WriteInt16L( KDefaultSpaceForMessages );
+
+    for ( TInt index( 0 ); index < KDefaultSpaceForMessages; index++ )
+        {
+        // "Saved"-flag
+        CbsStreamHelper::WriteBoolL( outstream, EFalse );
+        // Write message stream id.
+        outstream << TStreamId( 0 );
+        }
+
+    outstream.CommitL();
+    CleanupStack::PopAndDestroy();  // outstream
+
+    return id;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::CreateDefaultTopicMessagesStreamL
+// Delete all topics messages.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicMessages::DeleteAllTopicMessagesL( 
+    CStreamStore& aSavedStore,
+    CStreamStore& aUnsavedStore,
+    RReadStream& aIn )
+    {
+    // Read total amount of messages.
+    TInt total( aIn.ReadInt16L() );
+    
+    // Skip space for messages.
+    aIn.ReadInt16L();
+
+    // Now, delete all streams..
+    for ( TInt index( 0 ); index < total; index++ )
+        {
+
+        TBool isSaved( CbsStreamHelper::ReadBoolL( aIn ) );
+        TStreamId id;
+
+        // Read stream id.
+        aIn >> id;
+        CStreamStore& store = isSaved ? aSavedStore : aUnsavedStore;
+        store.DeleteL( id );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::IsLockedMessagesInTopic
+// Determines whether or not there are any locked messages in 
+// the topic.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCbsDbImpTopicMessages::IsLockedMessagesInTopic( 
+    const TCbsDbTopicNumber& aNumber ) const
+    {
+    TBool result( EFalse );
+
+    // Checks whether or not there is a locked message in the topic.
+    TInt count( iLockedMessages->Count() );
+    for ( TInt index( 0 ); index < count; index++ )
+        {
+        if ( iTopicList.ExtractTopicNumber( 
+            iLockedMessages->At( index ) ) == aNumber )
+            {
+            result = ETrue;
+            }
+        }    
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::IsLockedMessages
+// Determines whether there is at least one locked message.
+// Returns ETrue, if there are any locked messages in the 
+// database.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCbsDbImpTopicMessages::IsLockedMessages() const
+    {
+    return ( iLockedMessages->Count() > 0 );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::GetMessageCountL
+// Returns the total amount of messages the topic contains.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicMessages::GetMessageCountL( 
+    const TCbsDbTopicNumber& aNumber, 
+    TInt& aCount )
+    {
+    // Load cache.
+    LoadCacheL( aNumber );
+
+    // and then get the message count.
+    aCount = iMessageList->Count();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::GetMessageL
+// Returns message information.
+// Returns the message matching the given
+// index value. Leaves if the index is not valid.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicMessages::GetMessageL( 
+    const TCbsDbTopicNumber& aNumber, 
+    TInt aIndex, 
+    TCbsDbMessage& aMessage )
+    {
+    // Load the cache.
+    LoadCacheL( aNumber );
+
+    // Check if the index is not valid.
+    if ( ( aIndex < 0 ) || ( aIndex >= iMessageList->Count() ) )
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    // Load the message.
+    LoadMessageL( aIndex, aMessage );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::FindMessageByHandleL
+// Finds the message for given handle and returns it.
+// Returns the message matching the given
+// index value.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicMessages::FindMessageByHandleL( 
+    const TCbsDbMessageHandle& aHandle, 
+    TCbsDbMessage& aMessage )
+    {
+    // Load cache
+    LoadCacheL( iTopicList.ExtractTopicNumber( aHandle ) );
+
+    // Load message
+    LoadMessageL( FindMessagePositionByHandleL( aHandle ), aMessage );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::GetMessageContentsL
+// Returns the contents of a message.
+// Stores the contents of the message to the buffer aContents. 
+// If aContents is too small to contain the whole message
+// body, the message body is truncated.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicMessages::GetMessageContentsL( 
+    const TCbsDbMessageHandle& aHandle, 
+    TPtr& aContents,
+    TUint aSize )
+    {
+    LoadCacheL( iTopicList.ExtractTopicNumber( aHandle ) );
+
+    TInt position( FindMessagePositionByHandleL( aHandle ) );
+
+    TCbsDbMessage message;
+    LoadMessageL( position, message );
+
+    LoadMessageContentsL( iMessageList->At( position ).iContentsId, 
+                          aContents, message.iPermanent, aSize );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::DeleteMessageL
+// Deletes a message. Leaves if the message is protected
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicMessages::DeleteMessageL( 
+    const TCbsDbMessageHandle& aHandle,
+    const CCbsRecEtel& aReceiver )
+    {
+    // Get the topic handle.
+    LoadCacheL( iTopicList.ExtractTopicNumber( aHandle ) );
+
+    // Check if the message is locked.
+    if ( IsMessageLocked( aHandle ) )
+        {
+        // Yes, leave.
+        User::Leave( KErrAccessDenied );
+        }
+    else
+        {
+        // Otherwise, delete.
+        TRAPD( error, DoDeleteMessageL( 
+            FindMessagePositionByHandleL( aHandle ) ) );
+
+        if ( error != KErrNone )
+            {
+            // Failed.
+            RevertFileOperationL( error );
+            }
+        else
+            {
+            // Update the soft notification dialog, if topic is hotmarked
+            UpdateSoftNotificationL( aHandle, aReceiver );
+            }
+        }
+
+    iTopicList.NotifyTopicModifiedL( 
+        iTopicList.ExtractTopicNumber( aHandle ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::AddMessageL
+// Creates a new message to the topic.
+// Stores a handle to the message in aHandle.
+// FFS critical level check is made prior to operation.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicMessages::AddMessageL( 
+    const TCbsDbTopicNumber& aNumber, 
+    TCbsDbMessage& aMessage, 
+    const TPtrC& aContents )
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsDbImpTopicMessages::AddMessageL()");
+    
+    LoadCacheL( aNumber );
+
+    aMessage.iLength = aContents.Length();
+    CBSLOGSTRING2("CBSSERVER: CCbsDbImpTopicMessages::AddMessageL(): Content length: %d.", aMessage.iLength );
+
+    // Generate a new message handle.
+    aMessage.iHandle = GenerateNewMessageHandle( aNumber );    
+    
+    // Make sure that the message is not inserted as permanent
+    aMessage.iPermanent = EFalse;
+
+    TRAPD( error, DoAddMessageL( aMessage, aContents ) );
+    if ( error != KErrNone )
+        {
+        CBSLOGSTRING2("CBSSERVER: CCbsDbImpTopicMessages::AddMessageL(): DoAddMessageL() failed, error: %d.", error );
+        
+        // Failed.
+        RevertFileOperationL( error );
+        
+        CBSLOGSTRING("CBSSERVER: CCbsDbImpTopicMessages::AddMessageL(): RevertFileOperationL() finished OK." );
+        }
+        
+    CBSLOGSTRING("CBSSERVER: <<< CCbsDbImpTopicMessages::AddMessageL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::SaveMessageL
+// Saves a message. 
+// This operation is called "keeping" in the UI. 
+// The CBS server has a global limit for saved 
+// messages. The function leaves, if this is exceeded. 
+// A saved message has it's permanent-flag raised.
+// FFS critical level check is made prior to the operation.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicMessages::SaveMessageL( 
+    const TCbsDbMessageHandle& aHandle,
+    const CCbsRecEtel& aReceiver )
+    {
+    // Load cache.
+    TCbsTopicNumber topicNumber( iTopicList.ExtractTopicNumber( aHandle ) );
+    LoadCacheL( topicNumber );
+
+    // Now find message by handle.
+    TInt position( FindMessagePositionByHandleL( aHandle ) );
+
+    TCbsDbMessage message;
+    LoadMessageL( position, message );
+    TStreamId contentsId( iMessageList->At( position ).iContentsId );
+
+    // This function should not be called if the message is already permanent.
+    if ( message.iPermanent )
+        {
+        User::Leave( KErrAlreadyExists );
+        }
+
+    // Check that the limit for maximum saved messages/topic is not exceeded.
+    TCbsDbTopic topic;
+    iTopicList.FindTopicByNumberL( topicNumber, topic );
+    if ( iTopicList.TotalSavedMessages() >= KCbsDbMaxSavedMessages )
+        {
+        User::Leave( KErrOverflow );
+        }
+
+    // FFS critical level check (header is 16 bytes, message coded in Unicode)
+    CbsUtils::FFSCriticalLevelCheckL( KCbMessageHeaderSize + 
+        2 * message.iLength, iFs );
+
+    // Create a temporary buffer for message body and load the contents into
+    // the buffer.
+    HBufC* buffer = HBufC::NewLC( message.iLength ); // on CS
+    TPtr contentPtr( buffer->Des() );
+    LoadMessageContentsL( contentsId, contentPtr, EFalse, message.iLength );
+
+    // Delete message's previous header and body streams.
+    TCbsDbImpTopicMessagesCacheItem item( iMessageList->At( position ) );    
+
+    TRAPD( result, DoSaveMessageL( message, item, contentPtr, position ) );
+    CleanupStack::PopAndDestroy( buffer );
+    if ( result != KErrNone )
+        {
+        RevertFileOperationL( result );
+        }
+    else
+        {
+        iTopicList.NotifyTopicModifiedL( 
+            iTopicList.ExtractTopicNumber( aHandle ) );
+            
+        // Update the soft notification dialog, if topic is hotmarked
+        UpdateSoftNotificationL( aHandle, aReceiver );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::DoSaveMessageL
+// Saves a message.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicMessages::DoSaveMessageL( 
+    TCbsDbMessage& aMessage,
+    const TCbsDbImpTopicMessagesCacheItem& aItem,
+    const TDesC& aContentPtr,
+    TInt aPosition )
+    {
+    CFileStore* store = iTopicList.UnsavedMessagesStore();
+    store->Delete( aItem.iId );
+    store->Delete( aItem.iContentsId );
+
+    TBool needToUpdateReadCounter( EFalse );
+    aMessage.iPermanent = ETrue;
+    if ( !aMessage.iRead ) 
+        {
+        needToUpdateReadCounter = ETrue;
+        aMessage.iRead = ETrue;
+        }
+
+    // Create new streams for message header and body.
+    TStreamId contentsStream( CreateMessageContentsStreamL( 
+        *iTopicList.TopicStoreL(), aContentPtr ) );
+    TStreamId messageStream( CreateMessageStreamL( 
+        *iTopicList.TopicStoreL(), aMessage, contentsStream ) );
+
+    // Update message's cache item information.
+	TCbsDbImpTopicMessagesCacheItem& item = iMessageList->At( aPosition );
+    item.iContentsId = contentsStream;
+    item.iId = messageStream;
+    item.iIsSaved = ETrue;
+    item.iMessage = aMessage;
+
+    // Update topic messages stream; the cache item is saved into the stream.
+    UpdateTopicMessagesStreamL( EFalse );
+
+    iTopicList.InformMessageSavedL( aMessage.iHandle );
+    if ( needToUpdateReadCounter )
+        {
+        iTopicList.InformUnreadMessageReadL( aMessage.iHandle );
+        }
+
+    // Commit changes to both files.
+    iTopicList.CommitFilesL();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::ReadMessageL
+// Marks the message read
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicMessages::ReadMessageL(
+    const TCbsDbMessageHandle& aHandle,
+    const CCbsRecEtel& aReceiver )
+    {
+    //Checked that there is space for writing data on FFS.
+    CbsUtils::FFSCriticalLevelCheckL( KReadMessageSize, iFs );
+
+    // Load cache.
+    TCbsDbTopicNumber topicNum( iTopicList.ExtractTopicNumber( aHandle ) );
+    LoadCacheL( topicNum );
+
+    // Now find message by handle.
+    TInt position( FindMessagePositionByHandleL( aHandle ) );
+
+    TCbsDbMessage message;
+    LoadMessageL( position, message );
+    TStreamId contentsId( iMessageList->At( position ).iContentsId );
+    TStreamId id( iMessageList->At( position ).iId );
+
+    // Check if the message is already read, then there is nothing more to do.
+    if ( !message.iRead )
+        {
+        message.iRead = ETrue;
+
+        TRAPD( error, DoReadMessageL( id, message, contentsId ) );
+        if ( error == KErrNone )
+            {
+            iMessageList->At( position ).iMessage = message;
+            
+            iTopicList.NotifyTopicModifiedL( 
+                iTopicList.ExtractTopicNumber( aHandle ) );
+        
+            // Update the soft notification dialog, if topic is hotmarked
+            UpdateSoftNotificationL( aHandle, aReceiver );
+            }
+        else
+            {
+            RevertFileOperationL( error );
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::UpdateHandlesOfTopicMessagesL
+// Updates handles of messages in the topic with the number given in
+// aOldTopicNumber to match new topic number. 
+// Traverses through the given topic processing
+// each message stream encountered. Since the topic number is
+// the primary key and previous message handles can be assumed
+// to be unique, updating the high word of the handle to
+// match the new topic number is adequate.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicMessages::UpdateHandlesOfTopicMessagesL(
+    const TCbsDbTopicNumber& aOldTopicNumber, 
+    const TCbsDbTopicNumber& aNewTopicNumber )
+    {
+    LoadCacheL( aOldTopicNumber );
+
+    TInt msgs( iMessageList->Count() );
+
+    for ( TInt i( 0 ); i < msgs; i++ )
+        {
+        // Fetch message at this position
+        TCbsDbMessage message;
+        LoadMessageL( i, message );
+        TStreamId contentsStreamId( iMessageList->At( i ).iContentsId );
+        TStreamId messageStreamId( iMessageList->At( i ).iId );
+
+        // Insert new topic number as the high word of the handle
+        message.iHandle = ( aNewTopicNumber << 16 ) |
+            ( message.iHandle & 0xFFFF );
+        DoUpdateMessageL( messageStreamId, message, contentsStreamId );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::LockMessageL
+// Unlocks one message and then locks another message.
+// Message that is locked can not be removed. Topic that 
+// contains a locked message can not be removed.
+// Note that locking status is not persistent in the sense that 
+// when the power is switched off and turned on, no messages 
+// are automatically locked.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicMessages::LockMessageL( 
+    const TCbsDbMessageHandle& aUnlock, 
+    const TCbsDbMessageHandle& aLock )
+    {
+    // Check if the message exists: leave if not found, ignore return value
+    if ( aLock != 0 )
+        {
+        TCbsDbMessage message;
+        TInt position( FindMessagePositionByHandleL( aLock ) );
+        LoadMessageL( position, message );
+        }
+
+    TBool unlockNull( ETrue );
+
+    if ( aUnlock != 0 )
+        {
+        DeleteFromLocked( aUnlock );
+        unlockNull = EFalse;
+        }
+
+    if ( aLock != 0 )
+        {
+        InsertToLockedL( aLock ) ;
+        }
+
+    if ( unlockNull == EFalse )
+        {
+        LoadCacheL( iTopicList.ExtractTopicNumber( aUnlock ) );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::GetNextAndPrevMsgHandleL
+// Returns the handles of the next and previous message
+// when given a current message. 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicMessages::GetNextAndPrevMsgHandleL(
+    const TCbsDbMessageHandle& aCurrentMsg,
+    TCbsDbMessageHandle& aNextMsg, 
+    TCbsDbMessageHandle& aPrevMsg, 
+    TInt& aPosition)
+    {
+    LoadCacheL( iTopicList.ExtractTopicNumber( aCurrentMsg ) );
+
+    // Load the current message
+    TInt index( FindMessagePositionByHandleL( aCurrentMsg ) );
+
+    // Reset position indications
+    aPosition = 0;
+
+    // Retrieve position indications and message handles
+    if ( index == 0 )
+        {
+        aPosition |= ECbsHead;
+        }
+    else
+        {
+        TCbsDbMessage prevMessage;
+        LoadMessageL( index - 1, prevMessage );
+        aPrevMsg = prevMessage.iHandle;
+        }
+
+    // If index points to the last element of iMessageList,
+    // raise flag ECbsTail.
+    if ( index == iMessageList->Count()-1 )
+        {
+        aPosition |= ECbsTail;
+        }
+    else
+        {
+        TCbsDbMessage nextMessage;
+        LoadMessageL( index+1, nextMessage );
+        aNextMsg = nextMessage.iHandle;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::DoAddMessageL
+// Inserts a message into the database.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicMessages::DoAddMessageL(
+    TCbsDbMessage& aMessage, 
+    const TDesC& aContents )
+    {
+    // Cache is assumed to be loaded. Message is assumed not to
+    // already exist in the DB.
+    CFileStore* store = aMessage.iPermanent ? 
+        iTopicList.TopicStoreL() : iTopicList.UnsavedMessagesStore();
+
+    if ( aMessage.iPermanent )
+        {
+        // About to write to FFS: make critical level check.
+        // Message is in Unicode characters, so its size
+        // is double the length.
+        CbsUtils::FFSCriticalLevelCheckL( KCbMessageHeaderSize + 
+            2 * aMessage.iLength, iFs );
+        }
+    else
+        {
+        CbsUtils::VolumeCriticalLevelCheckL(
+            iTopicList.UnsavedMessagesFilename(),
+            KCbMessageHeaderSize + 2 * aMessage.iLength, iFs );
+        }
+
+    // Create stream for contents.
+    TStreamId contentsStream( CreateMessageContentsStreamL( 
+        *store, aContents ) );
+
+    // Now we have to find the position to which the message should be
+    // inserted.         
+    TInt positionToBeInserted( -1 );
+
+    TTime messageTime( aMessage.iDateTime );
+    TInt index( 0 );
+
+    // Go through all messages in topic and find the position.
+    TInt count( iMessageList->Count() );
+    for ( ; index < count && positionToBeInserted == -1; index++ )
+        {
+        TCbsDbMessage message;
+        LoadMessageL( index, message );
+
+        TTime tmp( message.iDateTime );
+
+        if ( tmp <= messageTime )
+            {
+            positionToBeInserted = index;
+            }
+        }
+
+    // If we looped through, append
+    if ( positionToBeInserted == -1 )
+        {
+        positionToBeInserted = index;
+        }
+
+    // Create message stream.
+    TStreamId messageStream( CreateMessageStreamL( *store, 
+        aMessage, contentsStream ) );
+
+    // Add to internal cache.
+    TCbsDbImpTopicMessagesCacheItem item;
+    
+    item.iId = messageStream;
+    item.iIsMessage = EFalse;
+    item.iIsSaved = aMessage.iPermanent;
+
+    iMessageList->InsertL( positionToBeInserted, item );
+
+    // Check if message should be deleted.
+    DeleteReceivedIfNecessaryL();
+
+    // Update topic messages stream.
+    UpdateTopicMessagesStreamL( EFalse );
+
+    // Update counters.
+    iTopicList.InformNewMessageReceivedL( aMessage.iHandle );
+
+    // Commit changes to both stores.
+    iTopicList.CommitFilesL();
+
+    // Inform observers. Done after commit to make sure there's
+    // a message to inform of.
+    iTopicList.NotifyNewMessageArrivedL( aMessage.iHandle );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::DoDeleteMessageL
+// Deletes a message from the database.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicMessages::DoDeleteMessageL( 
+    TInt aPosition )
+    {    
+    TCbsDbMessage message;
+    LoadMessageL( aPosition, message );
+
+    // Delete the message, if it is possible.
+    DeleteMessageByPositionL( aPosition );
+    DeleteReceivedIfNecessaryL();
+    UpdateTopicMessagesStreamL( ETrue );
+
+    // Inform the topic list about deletion.
+    iTopicList.InformMessageDeletedL( message.iHandle, 
+        message.iPermanent, message.iRead );
+
+    iTopicList.CommitFilesL();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::DoUpdateMessageL
+// Updates the information for a message.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicMessages::DoUpdateMessageL( 
+    const TStreamId& aId, 
+    const TCbsDbMessage& aMessage, 
+    const TStreamId& aContentsId ) const
+    {
+    // Update the stream contents.
+    CFileStore* store = aMessage.iPermanent ? 
+        iTopicList.TopicStoreL() : iTopicList.UnsavedMessagesStore();
+
+    RStoreWriteStream outstream;
+    outstream.ReplaceLC( *store, aId ); // on CS
+
+    WriteMessageInformationL( outstream, aMessage, aContentsId );
+
+    outstream.CommitL();
+    CleanupStack::PopAndDestroy(); // outstream
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::DoReadMessageL
+// Marks a message read by updating it in the database.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicMessages::DoReadMessageL( 
+    const TStreamId& aId, 
+    const TCbsDbMessage& aMessage, 
+    const TStreamId& aContentsId )
+    {
+    DoUpdateMessageL( aId, aMessage, aContentsId );
+    iTopicList.InformUnreadMessageReadL( aMessage.iHandle );
+    iTopicList.CommitFilesL();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::DoDeleteL
+// Deletes messages that are not supposed to be in the topic.
+// Because of message locking it is possible that there are more 
+// received messages than there should be. This method tries to 
+// delete this kind of message.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicMessages::DoDeleteL()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsDbImpTopicMessages::DoDeleteL()");
+
+    // Delete temporary messages and update topic messages stream.
+    if ( DeleteReceivedIfNecessaryL() )
+        {
+        UpdateTopicMessagesStreamL( ETrue );    
+        }
+    iTopicList.CommitFilesL();
+    
+    CBSLOGSTRING("CBSSERVER: <<< CCbsDbImpTopicMessages::DoDeleteL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::FindMessageByKeyL
+// Returns a handle to a message with the given key.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCbsDbImpTopicMessages::FindMessageByKeyL( 
+    TCbsDbTopicNumber aNumber, 
+    TCbsDbMessageKey aKey,
+    TCbsDbMessage& aMessage )
+    {
+    TCbsDbMessage message;
+    TInt count;
+    TBool result( KErrNotFound );
+
+    // Find a message even if the update numbers don't match
+    aKey &= 0xfff0;
+
+    // Try to find a message with the same key in the topic.
+    LoadCacheL( aNumber );
+    GetMessageCountL( aNumber, count );
+
+    for ( TInt index( 0 ); ( index < count ) && ( result != KErrNone ); index++ )
+        {
+        LoadMessageL( index, message );
+
+        if ( (message.iKey & 0xfff0) == aKey )
+            {
+            aMessage = message;
+            result = KErrNone; // message was found
+            }
+        }
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::FindMessagePositionByHandleL
+// Returns the position of a message with the given handle.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCbsDbImpTopicMessages::FindMessagePositionByHandleL( 
+    const TCbsDbMessageHandle& aHandle )
+    {
+    // Load the cache.
+    LoadCacheL( iTopicList.ExtractTopicNumber( aHandle ) );
+
+    // Now, find the message
+    TInt count( iMessageList->Count() );
+
+    TCbsDbMessage message;
+    TBool found( EFalse );
+
+    // Go through messages.
+    TInt index( 0 );
+    for ( ; ( index < count ) && !found; )
+        {
+        // Load the message.
+        LoadMessageL( index, message );
+        
+        // Check if it is this one.
+        if ( message.iHandle == aHandle )
+            {
+            found = ETrue;
+            }
+        else
+            {
+            index++;
+            }        
+        }
+
+    if ( !found )
+        {
+        User::Leave( KErrNotFound );
+        }
+     
+    return index;        
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::LoadCacheL
+// Loads the cache, if it is not already loaded with this topic information.
+// The method does not load any message information to the cache 
+// - only what is really necessary.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicMessages::LoadCacheL( 
+    const TCbsDbTopicNumber& aNumber )
+    {
+    CBSLOGSTRING2("CBSSERVER: >>> CCbsDbImpTopicMessages::LoadCacheL(), topic number: %d.", aNumber );
+    
+    // Check if the cache is valid. If not, load it.
+    if ( !( iCacheValid && ( iCachedTopicNumber == aNumber ) ) ) 
+        {        
+        CBSLOGSTRING("CBSSERVER: CCbsDbImpTopicMessages::LoadCacheL(): Calling InvalidateCache()...");        
+        // Invalidate the old cache, if it is necessary.
+        InvalidateCache();        
+        CBSLOGSTRING("CBSSERVER: CCbsDbImpTopicMessages::LoadCacheL(): InvalidateCache() called OK.");
+
+        // Load message queue ids.
+        TStreamId id;
+        iTopicList.GetTopicMessagesIdL( aNumber, id );
+
+        ReadTopicMessagesCacheItemsL( *iTopicList.TopicStoreL(), 
+            id, *iMessageList, iSpaceForMessages );
+    
+        // Cache is valid.
+        iCachedTopicNumber = aNumber;
+        iCacheValid = ETrue;
+
+        // Check if it there are more topics than there should be.
+        TCbsDbTopic topic;
+        iTopicList.FindTopicByNumberL( aNumber, topic );
+        if ( ( iMessageList->Count() - topic.iSavedMessages ) > 
+             KCbsDbMaxReceivedMessages ) 
+            {
+            TRAPD( error, DoDeleteL() );
+            CBSLOGSTRING2("CBSSERVER: CCbsDbImpTopicMessages::LoadCacheL(): DoDeleteL() finished with %d.", error );        
+            
+            if ( error != KErrNone )
+                {
+                RevertFileOperationL( error );
+                }
+            }
+        }
+    CBSLOGSTRING("CBSSERVER: <<< CCbsDbImpTopicMessages::LoadCacheL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::LoadMessageL
+// Loads the message header to the cache.
+// Note that it is assumed that the index is in proper range and 
+// the cache is already loaded.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicMessages::LoadMessageL( 
+    TInt aIndex, 
+    TCbsDbMessage& aMessage )
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsDbImpTopicMessages::LoadMessageL()");
+
+    // Check that the aIndex is in proper range and.
+    // that the cache is valid (just for sure).
+    if ( aIndex < 0 || aIndex >= iMessageList->Count() ||
+         !iCacheValid )
+        {
+        CBSLOGSTRING("CBSSERVER: CCbsDbImpTopicMessages::LoadMessageL(): Leaving with KErrNotFound...");
+        User::Leave( KErrNotFound );
+        }
+
+    // Check if the message information is already loaded.
+    if ( iMessageList->At( aIndex ).iIsMessage )
+        {       
+        // Yes, just make a fast copy.
+        aMessage = iMessageList->At( aIndex ).iMessage;
+        CBSLOGSTRING("CBSSERVER: CCbsDbImpTopicMessages::LoadMessageL(): Msg already loaded, fast copy made.");
+        }
+    else
+        {
+        TStreamId id( TStreamId( 0 ) );
+        // Choose the file store: saved messages are stored elsewhere
+        // than other messages.
+        CFileStore* store = iMessageList->At( aIndex ).iIsSaved ?
+            iTopicList.TopicStoreL() : 
+            iTopicList.UnsavedMessagesStore();
+        CBSLOGSTRING("CBSSERVER: CCbsDbImpTopicMessages::LoadMessageL(): Store created.");
+
+        // Then read the message. If the message stream cannot be
+        // found, delete the reference to the message
+        TRAPD( error, ReadMessageInformationL( *store, 
+            iMessageList->At( aIndex ).iId, aMessage, id ) );
+            
+        CBSLOGSTRING2("CBSSERVER: CCbsDbImpTopicMessages::LoadMessageL(): ReadMessageInformationL() finished with %d.", error );
+        
+        if( error == KErrNotFound )
+            {
+            DeleteMessageByPositionL( aIndex );
+            UpdateTopicMessagesStreamL( ETrue );
+            iTopicList.CommitFilesL();    
+            }
+        
+        CBSLOGSTRING2("CBSSERVER: CCbsDbImpTopicMessages::LoadMessageL(): Leaving if error code < 0: error %d...", error );
+        User::LeaveIfError( error );
+
+        // And copy to the internal cache.
+        iMessageList->At( aIndex ).iIsMessage = ETrue;
+        iMessageList->At( aIndex ).iContentsId = id;
+        iMessageList->At( aIndex ).iMessage = aMessage;
+        }
+    CBSLOGSTRING("CBSSERVER: <<< CCbsDbImpTopicMessages::LoadMessageL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::LoadMessageContentsL
+// Loads message contents (as much as it fits).
+// Restores the contents of a message
+// by reading a stream specified in parameter aContentsId.
+// Save status of message is required because saved and unsaved
+// messages are stored on separate files.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicMessages::LoadMessageContentsL( 
+    const TStreamId& aContentsId, 
+    TPtr& aContents,
+    TBool aIsSaved,
+    TUint aSize ) const
+    {
+    CFileStore* store = aIsSaved ? 
+        iTopicList.TopicStoreL() :
+        iTopicList.UnsavedMessagesStore();
+
+    // Read data to the buffer.
+    RStoreReadStream instream;
+    instream.OpenLC( *store, aContentsId ); // on CS
+
+    // Read the data into a temporary buffer first.
+	// Then copy to the aContents descriptor only
+	// as much as it can take.
+    TUint length( instream.ReadInt16L() );
+    if ( length > KCbsMaxCharsInMessage )
+        {
+        User::Leave( KErrCorrupt );
+        }
+
+	HBufC* buf = HBufC::NewL( instream, length );    
+	if ( length > aSize )
+		{
+		length = aSize;
+		}
+
+	aContents.Copy( buf->Ptr(), length );
+	delete buf;
+
+    CleanupStack::PopAndDestroy(); // instream
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::GenerateNewMessageHandle
+// Generates a new, unique handle for a message.
+// The generation uses topic number as 
+// basis and then increments the handle value until an unique
+// handle is found.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TCbsDbMessageHandle CCbsDbImpTopicMessages::GenerateNewMessageHandle( 
+    const TCbsDbTopicNumber& aNumber )
+    {
+    // Start with a reasonable seed. We'll try the number
+    // of messages in topic, plus one.
+    TUint16 handleLow( TUint16( iMessageList->Count() + 1 ) );
+    TCbsDbMessageHandle handle( 1 );
+    TInt error( KErrNone );
+
+    while ( error == KErrNone )
+        {
+        handleLow++;
+        if ( handleLow == 0 ) 
+            {
+            handleLow++;
+            }
+
+        // Generate a new message handle.
+        handle = iTopicList.GenerateMessageHandle( aNumber, 
+            handleLow );
+
+        TRAP( error, ( FindMessagePositionByHandleL( handle ) ) );
+        }
+    return handle;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::DeleteReceivedIfNecessaryL
+// Checks that if there are too many received messages in the internal cache, 
+// then they will be deleted if they are not locked.  
+// Note: Count() is changed in for-loop.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCbsDbImpTopicMessages::DeleteReceivedIfNecessaryL()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsDbImpTopicMessages::DeleteReceivedIfNecessaryL()");
+    
+    // So check if there are too many received messages in the topic. 
+    // Thus delete if message is not locked.
+
+    __ASSERT_DEBUG( iCacheValid, CbsServerPanic( ECbsCacheNotValid ) );
+
+    TInt totalReceived( 0 );
+    TCbsDbMessage message;
+    TBool result( EFalse );
+    TInt index( 0 );
+
+    for ( index = 0; index < iMessageList->Count(); index++ ) 
+        {
+        LoadMessageL( index, message );
+
+        // Count the amount of received messages
+        if ( !message.iPermanent )
+            {
+            totalReceived++;
+            
+            // If there are too many, then check that it can be deleted.
+            if ( totalReceived > KCbsDbMaxReceivedMessages && 
+                !IsMessageLocked( message.iHandle ) )
+                {
+                // Delete the message.
+                DeleteMessageByPositionL( index );
+                iTopicList.InformMessageDeletedL
+                                    ( message.iHandle, 
+                                      message.iPermanent, 
+                                      message.iRead );
+                result = ETrue;
+                
+                // They are always deleted from internal cache
+                index--;
+                totalReceived--;
+                }
+            }
+        }
+
+    CBSLOGSTRING2("CBSSERVER: <<< CCbsDbImpTopicMessages::DeleteReceivedIfNecessaryL(), returning %d.", result );
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::DeleteMessageByPositionL
+// Deletes message by its position in the internal cache.
+// Note that after the call the internal cache won't contain 
+// the item.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicMessages::DeleteMessageByPositionL( 
+    TInt aIndex )
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsDbImpTopicMessages::DeleteMessageByPositionL()");
+    
+    // Delete from cache and from file.
+    __ASSERT_DEBUG( iCacheValid, CbsServerPanic( ECbsCacheNotValid ) );
+
+    TCbsDbImpTopicMessagesCacheItem item( iMessageList->At( aIndex ) );
+
+    // Determine the file where the message is stored.
+    CFileStore* store = item.iIsSaved ? iTopicList.TopicStoreL() :
+        iTopicList.UnsavedMessagesStore();
+
+    iMessageList->Delete( aIndex );
+
+    store->Delete( item.iId );
+    store->Delete( item.iContentsId );
+    
+    CBSLOGSTRING("CBSSERVER: <<< CCbsDbImpTopicMessages::DeleteMessageByPositionL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::IsMessageLocked
+// Determines whether or not the message is locked.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCbsDbImpTopicMessages::IsMessageLocked( 
+    const TCbsDbMessageHandle& aHandle ) const
+    {
+    // Find out if the message is locked.
+    TBool found( EFalse );
+    TInt count( iLockedMessages->Count() );
+    for ( TInt index( 0 ); ( index < count ) && !found; index++ )
+        {
+        if ( iLockedMessages->At( index ) == aHandle )
+            {
+            found = ETrue;            
+            }
+        }
+
+    return found;    
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::DeleteFromLocked
+// Deletes from the locked messages.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicMessages::DeleteFromLocked( 
+    const TCbsDbMessageHandle& aHandle )
+    {
+    TBool deleted( EFalse );
+    TInt count( iLockedMessages->Count() );
+
+    for ( TInt index( 0 ); ( index < count ) && !deleted; index++ )
+        {
+        if ( iLockedMessages->At( index ) == aHandle )
+            {
+            iLockedMessages->Delete( index );
+            deleted = ETrue;            
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::InsertToLockedL
+// Adds a handle to the locked messages.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicMessages::InsertToLockedL( 
+    const TCbsDbMessageHandle& aHandle )
+    {
+    // Just append to the end. 
+    iLockedMessages->AppendL( aHandle );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::UpdateTopicMessagesStreamL
+// Updates topic messages stream from the internal cache.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicMessages::UpdateTopicMessagesStreamL(
+    TBool aDeleting )
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsDbImpTopicMessages::UpdateTopicMessagesStreamL()");
+    
+    __ASSERT_DEBUG( iCacheValid, CbsServerPanic( ECbsCacheNotValid ) );
+
+    TInt neededSpace( KMessageRootStreamSize + 
+        iMessageList->Count() * KMessageEntrySize );
+
+    RSharedDataClient sharedData;
+    // About to write to FFS: make critical level check
+    if ( aDeleting )
+        {
+        User::LeaveIfError( sharedData.Connect() );
+        sharedData.RequestFreeDiskSpaceLC( neededSpace ); // on CS
+        }
+    else
+        {
+        CbsUtils::FFSCriticalLevelCheckL( neededSpace, iFs );
+        }
+
+    // Now, first check if the information fits well to the current stream.
+    if ( iSpaceForMessages >= iMessageList->Count() )
+        {
+        CBSLOGSTRING("CBSSERVER: CCbsDbImpTopicMessages::UpdateTopicMessagesStreamL(): (3)");
+        
+        // Write data to the old stream.
+        TStreamId id;
+        iTopicList.GetTopicMessagesIdL( iCachedTopicNumber, id );
+        CBSLOGSTRING("CBSSERVER: CCbsDbImpTopicMessages::UpdateTopicMessagesStreamL(): (4)");
+        
+        // Replace the existing stream.
+        RStoreWriteStream outstream;
+        outstream.ReplaceLC( *iTopicList.TopicStoreL(), id ); // on CS
+        CBSLOGSTRING("CBSSERVER: CCbsDbImpTopicMessages::UpdateTopicMessagesStreamL(): (5)");
+    
+        WriteTopicMessagesStreamL( outstream );
+        CBSLOGSTRING("CBSSERVER: CCbsDbImpTopicMessages::UpdateTopicMessagesStreamL(): (6)");
+
+        outstream.CommitL();
+        CleanupStack::PopAndDestroy(); // outstream
+        }
+    else
+        {
+        CBSLOGSTRING("CBSSERVER: CCbsDbImpTopicMessages::UpdateTopicMessagesStreamL(): (7)");
+        // Calculate the amount of space for messages.
+        if ( iSpaceForMessages == 0 )
+            {
+            // Zero is not very good, lets put it greater.
+            iSpaceForMessages = KDefaultSpaceForMessages;
+            }
+
+        // But no need for extra messages.
+        iSpaceForMessages = 2 * iSpaceForMessages;
+        if ( iSpaceForMessages > 
+             ( KCbsDbMaxReceivedMessages + KCbsDbMaxSavedMessages ) )
+            {
+            iSpaceForMessages = 
+                KCbsDbMaxReceivedMessages + KCbsDbMaxSavedMessages;
+            }
+        if ( iMessageList->Count() > iSpaceForMessages )
+            {
+            iSpaceForMessages = iMessageList->Count();
+            }
+
+        // And finally write the data to stream.
+        RStoreWriteStream outstream;
+        TStreamId id = outstream.CreateLC( *iTopicList.TopicStoreL() );// on CS
+        CBSLOGSTRING("CBSSERVER: CCbsDbImpTopicMessages::UpdateTopicMessagesStreamL(): (8)");
+
+        WriteTopicMessagesStreamL( outstream );
+        CBSLOGSTRING("CBSSERVER: CCbsDbImpTopicMessages::UpdateTopicMessagesStreamL(): (9)");
+
+        outstream.CommitL();
+        CleanupStack::PopAndDestroy(); // outstream
+
+        // And then update topic messages stream. It will also delete 
+        // the old stream.
+        iTopicList.UpdateTopicMessagesIdL( iCachedTopicNumber, id );
+        CBSLOGSTRING("CBSSERVER: CCbsDbImpTopicMessages::UpdateTopicMessagesStreamL(): (10)");
+        }
+
+    // Free the reserved space
+    if ( aDeleting )
+        {
+        CBSLOGSTRING("CBSSERVER: CCbsDbImpTopicMessages::UpdateTopicMessagesStreamL(): (11)");
+        CleanupStack::PopAndDestroy(); // disk space
+        sharedData.Close();
+        }
+
+    CBSLOGSTRING("CBSSERVER: <<< CCbsDbImpTopicMessages::UpdateTopicMessagesStreamL()"); 
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::WriteTopicMessagesStreamL
+// Writes topic messages stream from the internal cache.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicMessages::WriteTopicMessagesStreamL( 
+    RWriteStream& aOut )
+    {
+    // Write total amount of messages.
+    TInt count( iMessageList->Count() );
+    aOut.WriteInt16L( count );
+
+    // Write total amount of space for messages.
+    aOut.WriteInt16L( iSpaceForMessages );
+
+    TInt index( 0 );
+
+    for ( ; index < count; index++ )
+        {
+        CbsStreamHelper::WriteBoolL( aOut,
+            iMessageList->At( index ).iIsSaved );
+
+        // Write message stream id.
+        aOut << iMessageList->At( index ).iId;
+        }
+
+    for ( ; index < iSpaceForMessages; index++ )
+        {
+        CbsStreamHelper::WriteBoolL( aOut, EFalse );
+
+        // Write null message stream id.
+        aOut << TStreamId( 0 );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::CreateMessageContentsStreamL
+// Creates a new message content stream and writes 
+// the given contents into this stream.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TStreamId CCbsDbImpTopicMessages::CreateMessageContentsStreamL(
+    CStreamStore&  aStore, 
+    const TDesC& aContents )
+    {
+    // Create stream and write data to it.
+    RStoreWriteStream outstream;
+    TStreamId id( outstream.CreateLC( aStore ) ); // on CS
+
+    // Just write the contents..
+    TInt count( aContents.Length() );
+    outstream.WriteInt16L( count );
+	outstream << aContents;
+
+    outstream.CommitL();
+    CleanupStack::PopAndDestroy(); // outstream
+
+    return id;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::CreateMessageStreamL
+// Creates a message stream and
+// writes the message into that stream. 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TStreamId CCbsDbImpTopicMessages::CreateMessageStreamL( 
+    CStreamStore& aStore, 
+    TCbsDbMessage& aMessage, 
+    const TStreamId& aContents )
+    {
+    // Create stream and write data to it.
+    RStoreWriteStream outstream;
+    TStreamId id = outstream.CreateLC( aStore ); // on CS
+
+    // Write the handle.
+    outstream.WriteInt32L( aMessage.iHandle );
+
+    // Write the message key.
+    outstream.WriteInt16L( aMessage.iKey );
+    
+    // Write the language.
+    outstream.WriteInt16L( aMessage.iLanguage );
+
+    // Write the date and time.
+    outstream << aMessage.iDateTime;
+    
+    // Write the permanent status.
+    CbsStreamHelper::WriteBoolL( outstream, aMessage.iPermanent );
+    
+    // Write the read status.
+    CbsStreamHelper::WriteBoolL( outstream, aMessage.iRead );
+    
+    // Write the stream identifier to the contents.
+    outstream << aContents;
+
+    outstream.CommitL();
+    CleanupStack::PopAndDestroy(); // outstream
+
+    return id;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::ReadTopicMessagesCacheItemsL
+// Reads all cache items for a topic.
+// Restores topic message cache from a stream.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicMessages::ReadTopicMessagesCacheItemsL( 
+    const CStreamStore& aStore, 
+    const TStreamId& aId, 
+    TCbsDbImpTopicMessagesCache& aCache, 
+    TInt& aSpace )
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsDbImpTopicMessages::ReadTopicMessagesCacheItemsL()");
+    
+    RStoreReadStream instream;
+    instream.OpenLC( aStore, aId ); // on CS
+    CBSLOGSTRING("CBSSERVER: CCbsDbImpTopicMessages::ReadTopicMessagesCacheItemsL(): instream.OpenLC() OK.");
+
+    // Read total amount of messages.
+    TInt totalMessages( instream.ReadInt16L() );
+    CBSLOGSTRING2("CBSSERVER: CCbsDbImpTopicMessages::ReadTopicMessagesCacheItemsL(): totalMessages: %d.", totalMessages );
+
+    // Read total amount of space for messages.
+    aSpace = instream.ReadInt16L();
+    CBSLOGSTRING2("CBSSERVER: CCbsDbImpTopicMessages::ReadTopicMessagesCacheItemsL(): aSpace: %d.", aSpace );
+
+    // Sanity check: if the number of messages exceeds
+    // the worst case, leave. If the space for messages
+    // is smaller than number of messages, leave.
+    if ( totalMessages > KCbsDbMaxSavedMessages + KCbsDbMaxReceivedMessages 
+        || aSpace < totalMessages )
+        {
+        CBSLOGSTRING("CBSSERVER: CCbsDbImpTopicMessages::ReadTopicMessagesCacheItemsL(): Stream corrupt, leaving with KErrCorrupt...");
+        User::Leave( KErrCorrupt );
+        }
+
+    TCbsDbImpTopicMessagesCacheItem item;
+
+    aCache.Reset();
+
+    for ( TInt index( 0 ); index < totalMessages; index++ )
+        {
+        CBSLOGSTRING2("CBSSERVER: CCbsDbImpTopicMessages::ReadTopicMessagesCacheItemsL(): Looping msgs, i: %d.", index );
+        item.iIsSaved = CbsStreamHelper::ReadBoolL( instream );
+
+        // Read topic message stream id.
+        instream >> item.iId;
+
+        // Initialize other fields.
+        item.iIsMessage = EFalse;
+
+        // And finally, append the item to the array
+        aCache.AppendL( item );
+        
+        CBSLOGSTRING("CBSSERVER: CCbsDbImpTopicMessages::ReadTopicMessagesCacheItemsL(): Msg appended to array.");
+        }
+
+    CleanupStack::PopAndDestroy(); // instream
+    
+    CBSLOGSTRING("CBSSERVER: <<< CCbsDbImpTopicMessages::ReadTopicMessagesCacheItemsL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::ReadMessageInformationL
+// Restore a message from a stream.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicMessages::ReadMessageInformationL( 
+    const CStreamStore& aStore, 
+    const TStreamId& aId, 
+    TCbsDbMessage& aMessage, 
+    TStreamId& aContentsId )
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsDbImpTopicMessages::ReadMessageInformationL()");
+    
+    // Open the message information stream.
+    RStoreReadStream instream;
+    instream.OpenLC( aStore, aId ); // on CS
+
+    // Read the handle.
+    aMessage.iHandle = instream.ReadInt32L();
+
+    // Read the message key.
+    aMessage.iKey = instream.ReadInt16L();
+    
+    // Read the language.
+    aMessage.iLanguage = instream.ReadInt16L();    
+    
+    // Read the date and time.
+    TInt64 time;
+    instream >> time;
+    aMessage.iDateTime = time;
+    
+    // Read the permanent status.
+    aMessage.iPermanent = CbsStreamHelper::ReadBoolL( instream );
+
+    // Read the read status.
+    aMessage.iRead = CbsStreamHelper::ReadBoolL( instream );
+    
+    // Read the stream identifier to the contents.
+    instream >> aContentsId;
+
+    CleanupStack::PopAndDestroy(); // instream
+
+    if ( aContentsId == TStreamId( 0 ) )
+        {
+        aMessage.iLength = 0;
+        }
+    else
+        {
+        // Open message contents stream.
+        RStoreReadStream instreamContents;
+
+        instreamContents.OpenLC( aStore, aContentsId ); // on CS
+
+        // Read the length of the message.
+        aMessage.iLength = instreamContents.ReadInt16L();
+
+        CleanupStack::PopAndDestroy(); // instreamContents
+        }
+    CBSLOGSTRING("CBSSERVER: <<< CCbsDbImpTopicMessages::ReadMessageInformationL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::WriteMessageInformationL
+// Writes message information into a stream. 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicMessages::WriteMessageInformationL( 
+    RWriteStream& aOut, 
+    const TCbsDbMessage& aMessage, 
+    const TStreamId& aContentsId )
+    {    
+    // Write the handle.
+    aOut.WriteInt32L( aMessage.iHandle );
+    
+    // Write the message key.
+    aOut.WriteInt16L( aMessage.iKey );
+    
+    // Write the language.
+    aOut.WriteInt16L( aMessage.iLanguage );
+        
+    // Write the date and time.
+    aOut << aMessage.iDateTime;
+    
+    // Write the permanent status.
+    CbsStreamHelper::WriteBoolL( aOut, aMessage.iPermanent );
+    
+    // Write the read status.
+    CbsStreamHelper::WriteBoolL( aOut, aMessage.iRead );
+    
+    // Write the stream identifier to the contents.
+    aOut << aContentsId;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::UpdateSoftNotificationL
+// Updates the soft notification (dialog) when unread message count changes.           
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicMessages::UpdateSoftNotificationL( 
+    const TCbsDbMessageHandle& aHandle,
+    const CCbsRecEtel& aReceiver )
+    {
+    TCbsDbTopic topic;
+    TCbsDbTopicNumber topicNum( iTopicList.ExtractTopicNumber( aHandle ) );
+    iTopicList.FindTopicByNumberL( topicNum, topic ); 
+    
+    // If topic is hotmarked, update the soft notification (dialog) ,
+    // since number of read messages was changed
+    if ( topic.iHotmarked )
+        {            
+        aReceiver.Interface().LaunchMessageSoftNotificationL( EFalse );
+        } 
+    }
+    
+// -----------------------------------------------------------------------------
+// CCbsDbImpTopicMessages::RevertFileOperationL
+// Reverts any not commited file operation in data files,
+// reloads cache and then leaves with aReason.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDbImpTopicMessages::RevertFileOperationL( 
+    TInt aReason )
+    {
+    iTopicList.RevertFilesL();
+    InvalidateCache();
+    User::Leave( aReason );
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerSrc/CCbsDiskSpaceMonitor.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,164 @@
+/*
+* 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:  This module contains the implementation of CCbsDiskSpaceMonitor class 
+*                member functions.    
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32property.h>
+#include "CCbsDiskSpaceMonitor.h"
+#include <UikonInternalPSKeys.h>    // KPSUidUikon, KUikFFSFreeLevel
+#include "CCbsDbImp.H"
+#include "CbsLogger.h"
+
+// CONSTANTS
+
+// Value to receive from critical level notification for "OK"
+const TInt KCriticalLevelDiskOk = 0;
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCbsDiskSpaceMonitor::CCbsDiskSpaceMonitor
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCbsDiskSpaceMonitor::CCbsDiskSpaceMonitor( CCbsDbImp& aDbImp )
+    : CActive( EPriorityStandard ),
+    iDbImp( aDbImp )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDiskSpaceMonitor::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCbsDiskSpaceMonitor::ConstructL()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsDiskSpaceMonitor::ConstructL()");
+    
+    CActiveScheduler::Add( this );
+    
+    // Attach to disk space property
+    iProperty.Attach( KPSUidUikon, KUikFFSFreeLevel );
+    
+    CBSLOGSTRING("CBSSERVER: <<< CCbsDiskSpaceMonitor::ConstructL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDiskSpaceMonitor::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCbsDiskSpaceMonitor* CCbsDiskSpaceMonitor::NewL( CCbsDbImp& aDbImp )
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsDiskSpaceMonitor::NewL()");
+    
+    CCbsDiskSpaceMonitor* self = 
+        new ( ELeave ) CCbsDiskSpaceMonitor( aDbImp );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    
+    CBSLOGSTRING("CBSSERVER: <<< CCbsDiskSpaceMonitor::NewL(), returning self.");
+    return self;
+    }
+    
+// Destructor
+CCbsDiskSpaceMonitor::~CCbsDiskSpaceMonitor()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsDiskSpaceMonitor::~CCbsDiskSpaceMonitor()");
+    Cancel();
+	iProperty.Close();
+	CBSLOGSTRING("CBSSERVER: <<< CCbsDiskSpaceMonitor::~CCbsDiskSpaceMonitor()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDiskSpaceMonitor::IssueRequest
+// Requests that we are notified when the system state changes.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDiskSpaceMonitor::IssueRequest() 
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsDiskSpaceMonitor::IssueRequest()");
+    
+    if ( !IsActive() )
+        {        
+        // Subscribe again
+    	iProperty.Subscribe( iStatus );
+	    SetActive();
+	    CBSLOGSTRING("CBSSERVER: CCbsDiskSpaceMonitor::IssueRequest(): New Subscribe() set active.");
+        }
+        
+    CBSLOGSTRING("CBSSERVER: <<< CCbsDiskSpaceMonitor::IssueRequest()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDiskSpaceMonitor::RunL
+// Becomes active when the system state changes.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDiskSpaceMonitor::RunL()
+    {
+    CBSLOGSTRING2("CBSSERVER: >>> CCbsDiskSpaceMonitor::RunL(): iStatus: %d", iStatus.Int() );
+    
+    if ( iStatus == KErrNone )
+        {        
+        // Property updated, get new value
+    	TInt state( 0 );
+    	TInt error( KErrNone );
+    	error = iProperty.Get( state );
+    	CBSLOGSTRING2("CBSSERVER: CCbsDiskSpaceMonitor::RunL(): property.Get() error: %d", error );
+    	CBSLOGSTRING2("CBSSERVER: CCbsDiskSpaceMonitor::RunL(): property.Get() state: %d", state );
+    	
+    	// If we received DISK_SPACE_OK, try to create the database
+        // components.
+        if ( state == KCriticalLevelDiskOk )
+            {
+            CBSLOGSTRING("CBSSERVER: CCbsDiskSpaceMonitor::RunL(): Calling CreateComponentsL()..." );
+            iDbImp.CreateComponentsL();
+            CBSLOGSTRING("CBSSERVER: CCbsDiskSpaceMonitor::RunL(): CreateComponentsL() finished." );
+            }
+        // To prevent ARMV5 compiler error
+        if ( error )
+            {
+            error = KErrNone;
+            }            
+        }
+    CBSLOGSTRING("CBSSERVER: <<< CCbsDiskSpaceMonitor::RunL()");        
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsDiskSpaceMonitor::DoCancel
+// Cancels an outstanding Subscribe request.  
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsDiskSpaceMonitor::DoCancel()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsDiskSpaceMonitor::DoCancel()");
+    iProperty.Cancel();  
+    CBSLOGSTRING("CBSSERVER: <<< CCbsDiskSpaceMonitor::DoCancel()"); 
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerSrc/CCbsEtelMessaging.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,196 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsEtelMessaging
+*                class member functions.
+*   
+*                CCbsEtelMessaging acts as a wrapper to RMobileBroadcastMessaging instance. 
+*
+*/
+
+
+
+// INCLUDE FILES
+    /*******************************
+    *	Series 60 Customer / Etel
+    *	Series 60 Etel API
+    *******************************/
+#include <mmretrieve.h>
+#include "CCbsEtelMessaging.h"
+#include "CbsLogger.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCbsEtelMessaging::CCbsEtelMessaging
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCbsEtelMessaging::CCbsEtelMessaging()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsEtelMessaging::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCbsEtelMessaging::ConstructL()
+    {    
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsEtelMessaging::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCbsEtelMessaging* CCbsEtelMessaging::NewL()
+    {
+    CCbsEtelMessaging* self = new ( ELeave ) CCbsEtelMessaging;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();    
+    return self;
+    }
+
+    
+// Destructor
+        /*******************************
+        *	Series 60 Customer / Etel
+        *	Series 60 Etel API
+        *******************************/
+CCbsEtelMessaging::~CCbsEtelMessaging()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsEtelMessaging::~CCbsEtelMessaging()");
+    iMessaging.Close();
+    CBSLOGSTRING("CBSSERVER: <<< CCbsEtelMessaging::~CCbsEtelMessaging()");
+    }   
+
+// -----------------------------------------------------------------------------
+// CCbsEtelMessaging::Open
+// Opens an ETel messaging session.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+        /*******************************
+        *	Series 60 Customer / Etel
+        *	Series 60 Etel API
+        *******************************/
+TInt CCbsEtelMessaging::Open( 
+    RMobilePhone& aPhone )
+    {
+    return iMessaging.Open( aPhone );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsEtelMessaging::Close
+// Closes ETel messaging session.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+        /*******************************
+        *	Series 60 Customer / Etel
+        *	Series 60 Etel API
+        *******************************/
+void CCbsEtelMessaging::Close()
+    {
+    iMessaging.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsEtelMessaging::ReceiveMessage
+// Requests forwarding of the next received CB message.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+        /*******************************
+        *	Series 60 Customer / Etel
+        *	Series 60 Etel API
+        *******************************/
+void CCbsEtelMessaging::ReceiveMessage(
+    TRequestStatus& aReqStatus, 
+    TDes8& aMsgData, 
+    TDes8& aMsgAttributes )
+    {
+    iMessaging.ReceiveMessage( aReqStatus, aMsgData, aMsgAttributes );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsEtelMessaging::ReceiveMessageCancel
+// Cancels an outstanding ReceiveMessage() request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+        /*******************************
+        *	Series 60 Customer / Etel
+        *	Series 60 Etel API
+        *******************************/
+void CCbsEtelMessaging::ReceiveMessageCancel()
+    {
+    // Use the base class method to cancel    
+    iMessaging.CancelAsyncRequest( EMobileBroadcastMessagingReceiveMessage );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsEtelMessaging::SetFilterSetting
+// Sets CBS receive mode.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+        /*******************************
+        *	Series 60 Customer / Etel
+        *	Series 60 Etel API
+        *******************************/
+void CCbsEtelMessaging::SetFilterSetting(
+    TRequestStatus& aReqStatus, 
+    RMobileBroadcastMessaging::TMobilePhoneBroadcastFilter aSetting ) const
+    {
+    iMessaging.SetFilterSetting( aReqStatus, aSetting );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsEtelMessaging::SetFilterSettingCancel
+// Cancels active SetFilterSetting request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+        /*******************************
+        *	Series 60 Customer / Etel
+        *	Series 60 Etel API
+        *******************************/
+void CCbsEtelMessaging::SetFilterSettingCancel()
+    {
+    // Use the base class method to cancel
+    iMessaging.CancelAsyncRequest( EMobileBroadcastMessagingSetFilterSetting );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsEtelMessaging::GetFilterSetting
+// Retrieves the current CBS receive mode.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+        /*******************************
+        *	Series 60 Customer / Etel
+        *	Series 60 Etel API
+        *******************************/
+TInt CCbsEtelMessaging::GetFilterSetting(
+    RMobileBroadcastMessaging::TMobilePhoneBroadcastFilter& aSetting )
+    {
+    return iMessaging.GetFilterSetting( aSetting );
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//	End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerSrc/CCbsLivecastHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,166 @@
+/*
+* 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:  
+*
+*/
+
+
+// INCLUDE FILES
+#include "CCbsLivecastHandler.h"
+#include "CCbsRecMessage.h"
+#include "CCbsRecWcdmaMessage.h"
+#include "CCbsRecEtel.h"
+#include "CCbsRecCollector.h"
+#include "CCbsReceiverHelper.h"
+#include "CbsLogger.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCbsLivecastHandler::CCbsLivecastHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCbsLivecastHandler::CCbsLivecastHandler( CCbsRecEtel& aRecEtel )
+: iRecEtel( aRecEtel )
+    {    
+    }
+
+// Destructor    
+CCbsLivecastHandler::~CCbsLivecastHandler()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> ~CCbsLivecastHandler::~CCbsLivecastHandler()");
+    CBSLOGSTRING("CBSSERVER: <<< ~CCbsLivecastHandler::~CCbsLivecastHandler()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsLivecastHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCbsLivecastHandler* CCbsLivecastHandler::NewL( CCbsRecEtel& aRecEtel )
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsLivecastHandler::NewL()");
+
+    CCbsLivecastHandler* self = new ( ELeave ) CCbsLivecastHandler( aRecEtel );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    CBSLOGSTRING("CBSSERVER: <<< CCbsLivecastHandler::NewL()");
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsLivecastHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCbsLivecastHandler::ConstructL()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsLivecastHandler::HandleLivecastMessageL
+// Processes the message.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+void CCbsLivecastHandler::HandleLivecastMessageL( 
+    CCbsMessage* aLivecastMessage )
+    {
+	CBSLOGSTRING("CBSSERVER: >>> CCbsLivecastHandler::HandleLivecastMessageL()");
+
+    // Take ownership
+    CleanupStack::PushL( aLivecastMessage );
+
+    // Check if this message must be rejected:
+    // 1. Is message compressed
+    // 2. Is message defined as 'Class 2' or 'Class 3' message
+
+	TInt msgclass ( aLivecastMessage->MessageClass() );
+
+	if ( aLivecastMessage->IsCompressed() ||
+		msgclass == 3 || msgclass == 2 )
+        {		
+        CBSLOGSTRING("CBSSERVER: CCbsLivecastHandler::HandleLivecastMessageL(): Rejected, compressed/msg class.");
+
+        // Reject the message
+        CleanupStack::PopAndDestroy(); // aLivecastMessage
+        }
+    else
+        {
+        // Add network information to message
+        TInt error = iRecEtel.AddNetworkInfo( *aLivecastMessage );
+
+		CBSLOGSTRING2("CBSSERVER: CCbsLivecastHandler::HandleLivecastMessageL(): AddNetworkInfo() error: %d", error );
+
+        // Handle the message
+        // Is message multipaged
+        if ( aLivecastMessage->TotalPages() > 1 )
+            {			
+            CBSLOGSTRING("CBSSERVER: CCbsLivecastHandler::HandleLivecastMessageL(): Message multipaged.");
+
+            // Ensure that the network info is available. 
+            // If not, reject the message, because info is required to collect
+            // pages of a multipaged message.
+            if ( KErrNone != error )
+                {				
+                CBSLOGSTRING("CBSSERVER: CCbsLivecastHandler::HandleLivecastMessageL(): Message rejected, AddNetworkInfo() error.");
+                CleanupStack::PopAndDestroy( aLivecastMessage );
+                }
+            else
+                {				
+                CBSLOGSTRING("CBSSERVER: CCbsLivecastHandler::HandleLivecastMessageL(): Sending msg to Collector...");
+
+                // Ownership of aLivecastMessage transferred to collector with
+                // aLivecastMessage left on the cleanup stack.                
+                CCbsMessage* completedMsg = iRecEtel.Collector().CollectL( aLivecastMessage, ECbsMessageLivecast );
+                
+                CBSLOGSTRING("CBSSERVER: CCbsLivecastHandler::HandleLivecastMessageL(): Collector finished.");
+
+                if ( completedMsg )
+                    {					
+                    CBSLOGSTRING("CBSSERVER: CCbsLivecastHandler::HandleLivecastMessageL(): Msg collected.");
+
+                    // Message pages combined => Handle like a single-paged msg.
+                    // Result code ignored.
+                    CleanupStack::PushL( completedMsg );
+					
+                    CBSLOGSTRING("CBSSERVER: CCbsLivecastHandler::HandleLivecastMessageL(): Routing msg to RecEtel...");
+					iRecEtel.RouteMessageL( *completedMsg );					
+                    CBSLOGSTRING("CBSSERVER: CCbsLivecastHandler::HandleLivecastMessageL(): Routing finished.");
+
+                    CleanupStack::PopAndDestroy( completedMsg );
+                    }
+                }
+            }
+        // Message is single paged
+        else            
+            {			
+            CBSLOGSTRING("CBSSERVER: CCbsLivecastHandler::HandleLivecastMessageL(): Message single paged.");            
+
+            iRecEtel.RouteMessageL( *aLivecastMessage );			
+            CBSLOGSTRING("CBSSERVER: CCbsLivecastHandler::HandleLivecastMessageL(): Single paged RouteMessageL() OK.");
+
+            CleanupStack::PopAndDestroy( aLivecastMessage );
+            }        
+        }
+	CBSLOGSTRING("CBSSERVER: <<< CCbsLivecastHandler::HandleLivecastMessageL()");
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerSrc/CCbsMcnSession.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,377 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MCN server-side subsession implementation.
+*
+*                Implementation of MCN topic subscription commits changes (reception 
+*                state, subscribed topics, etc) immediately after every request.
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CbsCommon.h"
+#include "CbsServerPanic.h"
+#include "CbsServerConstants.h"
+#include "CCbsMcnSession.h"
+#include "CCbsRecMessage.h"
+#include "CCbsReceiverHelper.h"
+#include "CCbsDbImpSettings.H"
+#include "CCbsRecEtel.h"
+#include "CCbsSession.h"
+#include "CCbsServer.h"
+#include "CbsLogger.h"
+
+// CONSTANTS
+
+/// Initial size of the array holding numbers of subscribed topics.
+const TInt KInitialSpaceForSubscribedTopics = 1;
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCbsMcnSession::CCbsMcnSession
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCbsMcnSession::CCbsMcnSession( 
+    CCbsSession& aSession, 
+    CCbsRecEtel& aReceiver )
+    : CCbsObject( aSession ), 
+    iReceiver( aReceiver ),
+    iMcnPckg( iMcnMessage )
+    {
+    // Do nothing
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsEtelMessaging::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCbsMcnSession::ConstructL()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsMcnSession::ConstructL()");
+
+    iSubscribedTopics = new (ELeave) CArrayFixFlat<TUint16>
+        ( KInitialSpaceForSubscribedTopics );
+    iReceiver.AddSubscriptionProviderL( this );
+
+	CBSLOGSTRING("CBSSERVER: <<< CCbsMcnSession::ConstructL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsEtelMessaging::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCbsMcnSession* CCbsMcnSession::NewL( 
+    CCbsSession& aSession, 
+    CCbsRecEtel& aReceiver )
+    {
+	CBSLOGSTRING("CBSSERVER: >>> CCbsMcnSession::NewL()");
+
+    CCbsMcnSession* self = 
+        new (ELeave) CCbsMcnSession( aSession, aReceiver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    CBSLOGSTRING("CBSSERVER: <<< CCbsMcnSession::NewL()");
+    return self;
+    }
+
+// Destructor
+
+CCbsMcnSession::~CCbsMcnSession()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsMcnSession::~CCbsMcnSession()");
+    TRAP_IGNORE( iReceiver.RemoveSubscriptionProviderL( this ) );
+    delete iSubscribedTopics;
+    CBSLOGSTRING("CBSSERVER: <<< CCbsMcnSession::~CCbsMcnSession()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMcnSession::HandleRequestsL
+// Handles MCN client requests.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+TBool CCbsMcnSession::HandleRequestsL( 
+    const RMessage2& aMessage )
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsMcnSession::HandleRequestsL()");
+
+    TBool requestHandled( ETrue );
+
+    switch( aMessage.Function() )
+        {
+        case EMcnNotifyOnChange:
+            CBSLOGSTRING("CBSSERVER: CCbsMcnSession::HandleRequestsL(): EMcnNotifyOnChange");
+            NotifyOnChange();
+            break;
+
+        case EMcnCloseSubsession:
+            CBSLOGSTRING("CBSSERVER: CCbsMcnSession::HandleRequestsL(): EMcnCloseSubsession");
+            CloseMcnSession();
+            aMessage.Complete( KErrNone );
+            break;
+
+        case EMcnNotifyOnChangeCancel:
+            CBSLOGSTRING("CBSSERVER: CCbsMcnSession::HandleRequestsL(): EMcnNotifyOnChangeCancel");
+            NotifyOnChangeCancel();
+            break;
+
+        case EMcnSubscribeTopic:
+            CBSLOGSTRING("CBSSERVER: CCbsMcnSession::HandleRequestsL(): EMcnSubscribeTopic");
+            SubscribeTopicL();
+            break;
+
+        case EMcnClearSubscriptions:
+            CBSLOGSTRING("CBSSERVER: CCbsMcnSession::HandleRequestsL(): EMcnClearSubscriptions");
+            ClearSubscriptionsL();
+            break;
+
+        case EMcnNoMoreSubscriptions:
+            CBSLOGSTRING("CBSSERVER: CCbsMcnSession::HandleRequestsL(): EMcnNoMoreSubscriptions");
+            ApplySubscriptionsL();
+            break;
+
+        default:
+            CBSLOGSTRING("CBSSERVER: CCbsMcnSession::HandleRequestsL(): default");
+            requestHandled = EFalse;
+            break;
+        }
+    CBSLOGSTRING("CBSSERVER: <<< CCbsMcnSession::HandleRequestsL()");
+
+    return requestHandled;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMcnSession::NumberOfSubscriptions
+// Returns the number of topic subscriptions of this MCN client.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+TUint CCbsMcnSession::NumberOfSubscriptions() const
+    {
+    return iSubscribedTopics->Count();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMcnSession::RouteMessageL
+// Routes messages to the subscribed Mcnclients.
+// If the topic of the message is subscribed by the client,
+// aMessage is copied to client-side. 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsMcnSession::RouteMessageL( 
+    const CCbsMessage& aMessage )
+    {
+	CBSLOGSTRING("CBSSERVER: >>> CCbsMcnSession::RouteMessageL()");
+
+	TKeyArrayFix key(0, ECmpTUint16);
+	TInt index;
+    TUint16 topicNumber( aMessage.TopicNumber() );    
+	TInt result( iSubscribedTopics->FindIsq( topicNumber, key, index ) );
+
+
+    TBool isLC( aMessage.IsLivecastMessage() );
+
+    if ( isLC )
+        {
+        iMcnMessage.iBuffer8 = aMessage.Contents8();
+        iMcnMessage.iBuffer = KNullDesC;
+        }
+    else
+        {
+        iMcnMessage.iBuffer = aMessage.Contents();
+        iMcnMessage.iBuffer8 = KNullDesC8;
+        }
+    
+    iMcnMessage.iNetworkMode = aMessage.NetworkMode();
+    iMcnMessage.iTopicNumber = aMessage.TopicNumber();
+
+    CBSLOGSTRING2("CBSSERVER: CCbsMcnSession::RouteMessageL(): topicNumber: %d", iMcnMessage.iTopicNumber );
+    CBSLOGSTRING2("CBSSERVER: CCbsMcnSession::RouteMessageL(): networkMode: %d (0=GSM, 1=WCDMA, 2=Not defined).", iMcnMessage.iNetworkMode );    
+    
+	if ( result == KErrNone )
+		{        
+        CBSLOGSTRING("CBSSERVER: CCbsMcnSession::RouteMessageL(): Notifying client...");
+        NotifyClientL( iMcnPckg );
+        CBSLOGSTRING("CBSSERVER: CCbsMcnSession::RouteMessageL(): Client notified.");
+	    }
+	CBSLOGSTRING("CBSSERVER: <<< CCbsMcnSession::RouteMessageL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMcnSession::CloseMcnSession
+// Close the subsession.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsMcnSession::CloseMcnSession()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsMcnSession::CloseMcnSession()");
+
+    // Removes the object.
+    Session().Server().DeleteObjectByHandle( Message().Int3() );
+
+    CBSLOGSTRING("CBSSERVER: <<< CCbsMcnSession::CloseMcnSession()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMcnSession::NotifyOnChange
+// Handles client request for message routing.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//   
+void CCbsMcnSession::NotifyOnChange()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsMcnSession::NotifyOnChange()");
+
+    if ( iIsMessage )
+        {
+        NotifyOnChangeCancel();
+        }
+
+    iMessage = Message();
+    iIsMessage = ETrue;
+
+    CBSLOGSTRING("CBSSERVER: <<< CCbsMcnSession::NotifyOnChange()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMcnSession::NotifyOnChangeCancel
+// Handles client request to cancel an outstanding routing request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsMcnSession::NotifyOnChangeCancel()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsMcnSession::NotifyOnChangeCancel()");
+
+    if ( iIsMessage )
+        {
+        iMessage.Complete( KErrCancel );
+        }
+
+    iIsMessage = EFalse;
+    Message().Complete( KErrNone );
+
+    CBSLOGSTRING("CBSSERVER: <<< CCbsMcnSession::NotifyOnChangeCancel()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMcnSession::SubscribeTopicL
+// Handles client-side request to subscribe a single topic.
+// An attempt to subscribe the same topic twice does not
+// cause any error - the topic remains subscribed. 
+// Note: ApplySubscriptionL has to be called in order to
+// apply receiver changes.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsMcnSession::SubscribeTopicL()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsMcnSession::SubscribeTopicL()");
+
+    // Read topic number from client.
+    TUint16 topicNumber( 0 );
+    topicNumber = static_cast<TUint16> ( Message().Int0() );
+   
+    // Store the topic number and notify receiver.
+	TKeyArrayFix key(0, ECmpTUint16);
+	TRAPD( err, iSubscribedTopics->InsertIsqL( topicNumber, key ) );
+	if( err != KErrAlreadyExists )
+		{        
+        CBSLOGSTRING2("CBSSERVER: CCbsMcnSession::SubscribeTopicL(), leaving if error != 0: %d", err);
+		User::LeaveIfError( err );
+		}
+
+    // Complete the request.
+    Message().Complete( KErrNone );
+
+    CBSLOGSTRING("CBSSERVER: <<< CCbsMcnSession::SubscribeTopicL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMcnSession::NotifyClientL
+// Called by RouteMessageL() to actually copy the message content
+// to client side.
+// If the client has a CB message routing request pending,
+// the message and topicnumber of the message are given to client side.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsMcnSession::NotifyClientL( 
+    const TPckg<TCbsMcnMessage>& aMcnPckg )
+    {
+	CBSLOGSTRING("CBSSERVER: >>> CCbsMcnSession::NotifyClientL()");
+
+    if ( iIsMessage )
+        {        
+        CBSLOGSTRING("CBSSERVER: CCbsMcnSession::NotifyClientL(): Writing msg pckg to client...");
+        // Write the message package to client
+		iMessage.WriteL( 0, aMcnPckg );        
+        CBSLOGSTRING("CBSSERVER: CCbsMcnSession::NotifyClientL(): Writing msg pckg to client OK.");
+
+        // Complete the request
+        iMessage.Complete( KErrNone );
+        iIsMessage = EFalse;
+        }
+	CBSLOGSTRING("CBSSERVER: <<< CCbsMcnSession::NotifyClientL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMcnSession::ClearSubscriptionsL
+// Clears all topic subscriptions of this MCN session.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsMcnSession::ClearSubscriptionsL() 
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsMcnSession::ClearSubscriptionsL()");
+
+    iSubscribedTopics->Reset();
+    iReceiver.ApplyStateChangesL();
+    Message().Complete( KErrNone );
+    
+    CBSLOGSTRING("CBSSERVER: <<< CCbsMcnSession::ClearSubscriptionsL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMcnSession::ApplySubscriptionsL
+// Forces receiver to reload CB topic subscriptions.
+// This function has to be called after MCN client has subscribed
+// topics with SubscribeTopicL().
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsMcnSession::ApplySubscriptionsL() 
+    {
+	CBSLOGSTRING("CBSSERVER: >>> CCbsMcnSession::ApplySubscriptionsL()");
+
+    iReceiver.ApplyStateChangesL();
+    Message().Complete( KErrNone );
+
+	CBSLOGSTRING("CBSSERVER: <<< CCbsMcnSession::ApplySubscriptionsL()");
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerSrc/CCbsMessage.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,788 @@
+/*
+* 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:  Implementation of CCbsMessage class.
+*
+*/
+
+
+// INCLUDE FILES
+#include "CbsServerPanic.h"
+#include "CCbsMessage.h"
+#include "CbsLogger.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::CCbsMessage
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCbsMessage::CCbsMessage()
+    {
+    }
+
+// Destructor    
+CCbsMessage::~CCbsMessage()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsMessage::~CCbsMessage()");
+    CBSLOGSTRING("CBSSERVER: <<< CCbsMessage::~CCbsMessage()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::Alphabet
+// Returns the alphabet set of this message.
+// Decides the alphabet set of this message by examining DCS field. 
+// Note that DCS value "unspecified" isn't used anymore.
+// All messages are considered to have "default" representation.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TCbsRecAlphabet CCbsMessage::Alphabet() const
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsMessage::Alphabet()");
+    CBSLOGSTRING2("CBSSERVER: CCbsMessage::Alphabet(): iDCS: %d", iDCS );
+    
+    TCbsRecAlphabet alphabet( ECbsRecAlphabetUnspecified );   
+
+    // Check for Message preceded by language indication/UCS2 and
+    // General Data Coding Indication/UCS2
+    if ( 
+        ( iDCS & DCS_MASK_LANGUAGE_INDICATION_PRECEDES ) == DCS_MPLI_UCS2 || 
+        ( iDCS & DCS_MASK_GENERAL_DATA_CODING_INDICATION ) == DCS_GDCI_UCS2 )
+        {
+        alphabet = ECbsRecAlphabetUCS2;
+        }
+    // Check for 8-bit DCSs
+    else if ( 
+        ( iDCS & DCS_MASK_GENERAL_DATA_CODING_INDICATION ) == DCS_GDCI_8BIT ||
+        ( iDCS & DCS_MASK_MESSAGE_HANDLING )== DCS_DCMH_8BIT ||
+        ( iDCS & DCS_MASK_UDH ) == DCS_UDH_8BIT )
+        {
+        alphabet = ECbsRecAlphabet8bit;
+        }
+     // Else assume that alphabet is default
+    else
+        {
+        alphabet = ECbsRecAlphabetDefault;
+        }
+
+    CBSLOGSTRING("CBSSERVER: <<< CCbsMessage::Alphabet(), returning alphabet.");
+    return alphabet;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::AppendContent
+// Appends another message's content to this message's content.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsMessage::AppendContent( 
+    const TDesC& aMsg )
+    {
+    iMessage->Des().Append( aMsg );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::AppendContent8
+// Appends another message's content to this message's content.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsMessage::AppendContent8( 
+    const TDesC8& aMsg )
+    {
+    iMessage8->Des().Append( aMsg );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::CellId
+// Returns identifier of the cell in which the phone was when this  message was received.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+TUint CCbsMessage::CellId() const
+    {
+    return iLocationArea.iCellId;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::Contents
+// Returns a pointer descriptor to the Unicode contents of the message.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+const TDesC& CCbsMessage::Contents() const
+    {
+    __ASSERT_DEBUG( iMessage != 0, CbsServerPanic( ECbsMsgRepUnprepared ) );
+    return *iMessage;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::Contents8
+// Returns a pointer descriptor to 8-bit descriptor representation
+// of the message body. 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+const TDesC8& CCbsMessage::Contents8() const
+    {
+    __ASSERT_DEBUG( iMessage8 != 0, CbsServerPanic( ECbsMsgRepUnprepared ) );
+    return *iMessage8;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::DCS
+// Returns the Data Coding Scheme of this message page.
+// Refer to GSM specification 03.38 for details on DCS.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+TCbsRecDCS CCbsMessage::DCS() const
+    {
+    return iDCS;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::GeographicalScope
+// Returns the geographical scope of the message.
+// This is a 16-bit value containing Geographical 
+// Scope (2 bits), Message Code (10 bits) and Update Number (4 bits).
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TCbsRecGeographicalScope CCbsMessage::GeographicalScope() const
+    {
+    TInt gs( Key() >> 14 );
+    if ( gs == KGeographicalScopeCellImmediate || 
+         gs == KGeographicalScopeCellNormal )
+        {
+        return ECbsRecGeographicalScopeCell;
+        }
+    else if ( gs == KGeographicalScopePLMNNormal ) 
+        {
+        return ECbsRecGeographicalScopePLMN;
+        }
+    else
+        {
+        return ECbsRecGeographicalScopeLAC;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::GetPLMN
+// Returns operator information.
+// On return, aNetworkInfo contains identity of the network
+// in which the phone was when this message was received.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+void CCbsMessage::GetPLMN( 
+    RMobilePhone::TMobilePhoneNetworkInfoV1& aNetworkInfo ) const
+    {
+    aNetworkInfo.iCountryCode = iNetworkInfo.iCountryCode;
+    aNetworkInfo.iNetworkId = iNetworkInfo.iNetworkId;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::IsChildSubindex
+// Returns boolean value indicating if this message is a child subindex message.
+// Child subindex messages have message code 1010101010b and
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+TBool CCbsMessage::IsChildSubindex() const
+    {
+    return IsIndexMessage() && ( TopicNumber() != 0 );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::IsClass0
+// Returns ETrue, if this message is a Class 0 message according to 
+// ETSI GSM specification 03.38.
+// Message is of class 0 if the 6th and 7th bit of Geographical Scope
+// are both zero.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCbsMessage::IsClass0() const
+    {
+    // Examine bits 0, 1, 4, 6 and 7 of DCS.
+    TUint8 class0( DCS() );
+    class0 &= DCS_MASK_CLASS0;
+    // Check Class 0 indication.
+    return class0 == DCS_CLASS0; 
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::IsCompressed
+// Returns ETrue, if the message is compressed.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCbsMessage::IsCompressed() const
+    {
+    // The CB message is compressed only if the value of DCS is 011xxxxx.
+    return ( TUint8( iDCS >> 5 ) == 3 );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::IsIndexMessage
+// Returns boolean value indicating if this is the index message.  
+// Index messages have message code 1010101010b.
+// Refer to GSM specifications to for details.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+TBool CCbsMessage::IsIndexMessage() const
+    {
+    return MessageCode() == KIndexMessageCode;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::Key
+// Returns the key of the message (serial number).
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TCbsDbMessageKey CCbsMessage::Key() const
+    {
+    return TCbsDbMessageKey( iSerialNumber );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::LAC
+// Returns location area information.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+TUint CCbsMessage::LAC() const
+    {
+    return iLocationArea.iLocationAreaCode;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::Language
+// Returns the language specified in this message.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TCbsDbLanguage CCbsMessage::Language() const
+    {
+    __ASSERT_DEBUG( iLanguage != -1, 
+        CbsServerPanic( ECbsLanguageNotResolved ) );
+
+    return iLanguage;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::LanguagePrecedingMessage
+// Determines and returns the language of this message
+// based on first two characters of message content.
+// Assumes that the message content contains language
+// indication and that the content has been decoded
+// into UCS-2 representation.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TCbsDbLanguage CCbsMessage::LanguagePrecedingMessage() const
+    {
+    /// Mapping of ISO639 codes to server internal language representation
+    const TCbsIso639ToLangMapElement KLanguageMap[ KNumberOfLanguageMappings ] = 
+        {
+        TCbsIso639ToLangMapElement( KIso639Danish, ECbsDanish ),
+        TCbsIso639ToLangMapElement( KIso639German, ECbsGerman ),
+        TCbsIso639ToLangMapElement( KIso639Greek, ECbsGreek ),
+        TCbsIso639ToLangMapElement( KIso639English, ECbsEnglish ),
+        TCbsIso639ToLangMapElement( KIso639Spanish, ECbsSpanish ),
+        TCbsIso639ToLangMapElement( KIso639Finnish, ECbsFinnish ),
+        TCbsIso639ToLangMapElement( KIso639French, ECbsFrench ),
+        TCbsIso639ToLangMapElement( KIso639Italian, ECbsItalian ),
+        TCbsIso639ToLangMapElement( KIso639Dutch, ECbsDutch ),
+        TCbsIso639ToLangMapElement( KIso639Norwegian, ECbsNorwegian ),
+        TCbsIso639ToLangMapElement( KIso639Portuguese, ECbsPortuguese ),
+        TCbsIso639ToLangMapElement( KIso639Swedish, ECbsSwedish ),
+        TCbsIso639ToLangMapElement( KIso639Turkish, ECbsTurkish ),
+        TCbsIso639ToLangMapElement( KIso639Hungarian, ECbsHungarian ),
+        TCbsIso639ToLangMapElement( KIso639Polish, ECbsPolish ),
+        TCbsIso639ToLangMapElement( KIso639Czech, ECbsCzech ),
+        TCbsIso639ToLangMapElement( KIso639Hebrew, ECbsHebrew ),
+        TCbsIso639ToLangMapElement( KIso639Arabic, ECbsArabic ),
+        TCbsIso639ToLangMapElement( KIso639Russian, ECbsRussian ),
+        TCbsIso639ToLangMapElement( KIso639Icelandic, ECbsIcelandic )
+        };
+
+    __ASSERT_DEBUG( iMessage != NULL , CbsServerPanic( ECbsMsgRepUnprepared ) );
+
+    TPtrC isoCode( 
+        Contents().Left( KLanguageIndicationLengthWithoutCR ) );
+
+    for ( TInt i( 0 ); i<KNumberOfLanguageMappings; i++ )
+        {
+        TCbsIso639ToLangMapElement element( KLanguageMap[i] );
+        TPtrC code( element.iCode );
+        if ( code == isoCode )
+            {
+            TCbsDbLanguage language( element.iLang );
+            return language;
+            }
+        }
+    return ECbsOther;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::LanguageWithDefaultAlphabet
+// Determines and returns the language of this message
+// based on DCS value. Assumes that the same DCS value
+// indicates, that the language can be determined in this
+// way (and not from message content).
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TCbsDbLanguage CCbsMessage::LanguageWithDefaultAlphabet() const
+    {
+    TCbsDbLanguage language;
+    switch ( iDCS )
+        {
+        // These cases handle DCS values with bits 0000xxxx.
+        // All languages use the default alphabet.
+        case ECbsRecLanguageGerman: 
+            language = ECbsGerman; 
+            break;
+        case ECbsRecLanguageEnglish: 
+            language = ECbsEnglish; 
+            break;
+        case ECbsRecLanguageItalian: 
+            language = ECbsItalian; 
+            break;
+        case ECbsRecLanguageFrench: 
+            language = ECbsFrench; 
+            break;
+        case ECbsRecLanguageSpanish: 
+            language = ECbsSpanish; 
+            break;
+        case ECbsRecLanguageDutch: 
+            language = ECbsDutch; 
+            break;
+        case ECbsRecLanguageSwedish: 
+            language = ECbsSwedish; 
+            break;
+        case ECbsRecLanguageDanish: 
+            language = ECbsDanish; 
+            break;
+        case ECbsRecLanguagePortuguese: 
+            language = ECbsPortuguese; 
+            break;
+        case ECbsRecLanguageFinnish: 
+            language = ECbsFinnish; 
+            break;
+        case ECbsRecLanguageNorwegian: 
+            language = ECbsNorwegian; 
+            break;
+        case ECbsRecLanguageGreek: 
+            language = ECbsGreek; 
+            break;
+        case ECbsRecLanguageTurkish: 
+            language = ECbsTurkish; 
+            break;
+        case ECbsRecLanguageHungarian: 
+            language = ECbsHungarian; 
+            break;
+        case ECbsRecLanguagePolish: 
+            language = ECbsPolish; 
+            break;
+        case ECbsRecLanguageUnspecified: 
+            language = ECbsOther; 
+            break;
+        case ECbsRecLanguageCzech:
+            language = ECbsCzech;
+            break;
+        case ECbsRecLanguageHebrew:
+            language = ECbsHebrew;
+            break;
+        case ECbsRecLanguageArabic:
+            language = ECbsArabic;
+            break;
+        case ECbsRecLanguageRussian:
+            language = ECbsRussian;
+            break;
+        case ECbsRecLanguageIcelandic:
+            language = ECbsIcelandic;
+            break;
+        default:
+            language = ECbsOther;
+            break;
+        }
+    return language;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::Message
+// Returns the 16-bit message content
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+HBufC* CCbsMessage::Message() const
+    {
+    return iMessage;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::Message8
+// Returns the 8-bit representation of the message
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+HBufC8* CCbsMessage::Message8() const
+    {
+    return iMessage8;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::MessageCode
+// Returns the message code of the message.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TCbsRecMessageCode CCbsMessage::MessageCode() const
+    {
+    return TCbsRecMessageCode( ( TUint16( Key() & KMessageCodeMask ) ) >> 4 );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::MessageClass
+// Returns the class of the message.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCbsMessage::MessageClass() const
+    {
+	TUint8 msgclass;
+	msgclass = TUint8( iDCS >> 4 );
+	TInt messageClass( 0 );
+
+    if ( msgclass == 0x05 || msgclass == 0x07 || msgclass == 0x0f ) // 0000 0101 or 0000 0111 or 0000 1111
+		{
+			msgclass = 0x03; // 0000 0011
+
+			// Lets find out last two bits
+			msgclass = TUint8( msgclass & iDCS );
+			switch ( msgclass )
+			{
+				case 1:
+					messageClass = 1;
+					break;
+				case 2:
+					messageClass = 2;
+					break;
+				case 3:
+					messageClass = 3;
+					break;
+				case 0:
+				default:
+					messageClass = 0;
+					break;
+			}
+		}
+	return messageClass;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::MessagePrecededByLanguageIndication
+// Returns ECbsRecLanguageIndicationBody if message's content is preceded 
+// by language indication (see GSM 03.38).
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TCbsRecLanguageIndication CCbsMessage::MessagePrecededByLanguageIndication() const
+    {
+    TCbsRecLanguageIndication indication( ECbsRecLanguageIndicationHeader );
+    if ( iDCS == 0x10 || iDCS == 0x11 )
+        {
+        indication = ECbsRecLanguageIndicationBody;
+        }
+    return indication;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::NetworkMode
+// Returns current network mode (GSM/WCDMA)
+// 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TCbsNetworkMode CCbsMessage::NetworkMode() const
+    {
+    return iNetworkMode;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::PageParameter
+// Returns the Page Parameter of the message page
+//
+// Page Parameter is a 8-bit field describing the number
+// of pages in a message and the index of this page in a
+// sequence of pages comprising a message.
+// For single-page messages this value is 00010001b. 
+// Value 0 (zero) is reserved with coding beginning at 0001b.
+// Thus there can be 1..15 pages in one message.
+// Total and this page -fields can be accessed with 
+// methods TotalPages() and ThisPage().
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TCbsRecPageParameter CCbsMessage::PageParameter() const
+    {
+    return iPageParameter;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::ReleaseEightBitRepresentation
+// Frees the memory allocated for 8-bit representation of message content.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+void CCbsMessage::ReleaseEightBitRepresentation()
+    {
+    delete iMessage8;
+    iMessage8 = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::RemoveIndexHeaderL
+// Removes any index header prefix from the message body.
+//    
+// This method assumes that the index header is contained in the
+// first line of message body. This line, including trailing <cr><lf>
+// is removed.
+//
+// Index header prefix is assumed to contain "EIn<cr><lf>", where n
+// specifies the version number this index message claims to 
+// follow and <cr><lf> is a carriage return + line feed.
+//  
+// It is also assumed that any language indication prefix has
+// already been removed prior to this operation.
+//
+// Message must be in UCS-2 representation.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsMessage::RemoveIndexHeaderL() 
+    {
+    __ASSERT_DEBUG( IsIndexMessage(), CbsServerPanic( ECbsNotIndexMessage ) );
+
+    if ( iMessage->Length() < KIndexHeaderLength )
+        {
+        User::Leave( KErrUnderflow );   // Msg too short to contain ix header.
+        }
+
+    iMessage->Des().Delete( KIndexHeaderPosition, KIndexHeaderLength );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::RemoveLanguageIndicationFromBodyL
+// Removes language indication field from the message body.
+//   
+// Presence of an indication is verified with the DCS value 
+// according to ETSI specifications. Message is assumed to
+// contain valid indication, i.e., three bytes preceding the message
+// body specifying the language code. 
+//  
+// The correctness of this operation is not checked. If the
+// indication is invalid, the message body is likely to either have
+// a couple of characters too many or few.
+// 
+// Message is assumed to be decoded into UCS-2.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsMessage::RemoveLanguageIndicationFromBodyL()
+    {
+    if ( MessagePrecededByLanguageIndication() == 
+        ECbsRecLanguageIndicationBody )
+        {
+        if ( iMessage->Length() < KLanguageIndicationPosition + 
+            KLanguageIndicationLength )
+            {
+            User::Leave( KErrUnderflow );
+            }
+
+        iMessage->Des().Delete( KLanguageIndicationPosition, 
+            KLanguageIndicationLength );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::RequiresImmediateDisplay
+// Returns ETrue, if this message requires to be displayed immediately.
+//       	   
+// The CB message has to be displayed immediately
+// if either it is flagged as a Class 0 message (see GSM 03.38)
+// or has a geographical scope of the type "Immediate" 
+// (see GSM 03.41).
+//  
+// This function always returns EFalse for Base station ID messages 
+// (message identifier = 50).
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCbsMessage::RequiresImmediateDisplay() const
+    {
+    return IsClass0();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::ReserveContentSizeL
+// Increases the space allocated for message content.
+// Reallocates message content to match parameter aLength.
+// Should be used before AppendContent()-call.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsMessage::ReserveContentSizeL( 
+    TInt aLength )
+    {
+    if ( iMessage == NULL )
+        {
+        iMessage = HBufC::NewL( aLength );
+        }
+    else if ( ( iMessage ) && ( aLength < iMessage->Length() ) )                
+        {
+        User::Leave( KErrArgument );
+        }
+    else
+        {
+        iMessage = iMessage->ReAllocL( aLength );
+        }    
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::ReserveContentSize8L
+// Increases the space allocated for message content.
+// Reallocates message content to match parameter aLength.
+// Should be used before AppendContent()-call.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsMessage::ReserveContentSize8L( 
+    TInt aLength )
+    {
+    if ( iMessage8 == NULL )
+        {
+        iMessage8 = HBufC8::NewL( aLength );
+        }
+    else if ( ( iMessage8 ) && ( aLength < iMessage8->Length() ) )                
+        {
+        User::Leave( KErrArgument );
+        }
+    else
+        {
+        iMessage8 = iMessage8->ReAllocL( aLength );
+        }    
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::ResolveLanguage
+// Determines language of this message so that calls to Language() 
+// will return the correct value.
+//
+// Language information may be determined from Data Coding Scheme
+// of message header or from the first characters in message body.
+// For the latter to succeed, the message has to be decoded into UCS-2.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsMessage::ResolveLanguage()
+    {
+    if ( iDCS <= ECbsRecLanguageUnspecified ||      // 0000xxxx
+        ( iDCS >= ECbsRecLanguageCzech && iDCS < ECbsRecLanguageMax ) )
+        {
+        // Default alphabet, bits 0-3 specify language.
+        iLanguage = LanguageWithDefaultAlphabet();
+        }
+    else if ( MessagePrecededByLanguageIndication() == 
+        ECbsRecLanguageIndicationBody )
+        {
+        iLanguage = LanguagePrecedingMessage();
+        }
+    else
+        {
+        iLanguage = ECbsOther;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::SetNetworkInfo
+// Sets the network information of this message.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+void CCbsMessage::SetNetworkInfo(
+    const RMobilePhone::TMobilePhoneNetworkInfoV1& aNetworkInfo,
+    const RMobilePhone::TMobilePhoneLocationAreaV1& aArea )
+    {
+    iNetworkInfo = aNetworkInfo;
+    iLocationArea = aArea;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::TopicNumber
+// Returns the 16-bit Message Identifier containing the topic number.	
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TCbsDbTopicNumber CCbsMessage::TopicNumber() const
+    {
+    return TCbsDbTopicNumber( iMessageIdentifier );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::UpdateNumber
+// Returns the update number of the message
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TCbsRecUpdateNumber CCbsMessage::UpdateNumber() const
+    {
+    return TCbsRecUpdateNumber( Key() & 0xF );            // 00001111b
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCbsMessage::IsLivecastMessage
+// Checks if this message is a Livecast message.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+TBool CCbsMessage::IsLivecastMessage() const
+    {
+    TBool isLivecastMsg( EFalse );
+
+    // Check if this message is a Livecast message (just check the topic number)
+    if ( TopicNumber() >= KCbsLivecastTopicMin && 
+        TopicNumber() <= KCbsLivecastTopicMax )
+        {
+        // This is a Livecast msg
+        isLivecastMsg = ETrue;
+        }
+
+    return isLivecastMsg;
+    }
+
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerSrc/CCbsMessageCleanUpTimer.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,146 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsMessageCleanupTimer class 
+*                member functions.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CCbsMessageCleanUpTimer.h"
+#include "CCbsRecCollector.h"
+#include "CbsLogger.h"
+
+// CONSTANTS
+
+// Message cleanup timer in minutes. This is only for livecast messages.
+const TInt KMessageCleanUpTime = 10;
+
+// ==================== LOCAL FUNCTIONS =====================================
+
+// ================= MEMBER FUNCTIONS =======================================
+
+// -----------------------------------------------------------------------------
+// CCbsMessageCleanupTimer::CCbsMessageCleanupTimer
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCbsMessageCleanupTimer::CCbsMessageCleanupTimer( CCbsRecCollector& aCbsRecCollector, CMessageBuffer& aArray )
+		: CTimer( EPriorityStandard ),
+		iCbsRecCollector ( aCbsRecCollector ),
+		iArray ( aArray )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessageCleanupTimer::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCbsMessageCleanupTimer::ConstructL()
+    {
+    // Construct the timer
+    CTimer::ConstructL();       
+
+	iInterval = KMessageCleanUpTime;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessageCleanupTimer::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCbsMessageCleanupTimer* CCbsMessageCleanupTimer::NewL( CCbsRecCollector& aCbsRecCollector, CMessageBuffer& aArray )
+    {
+    CCbsMessageCleanupTimer* self = 
+        new ( ELeave ) CCbsMessageCleanupTimer( aCbsRecCollector, aArray );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+    }
+    
+// Destructor
+CCbsMessageCleanupTimer::~CCbsMessageCleanupTimer()
+    {   
+    CBSLOGSTRING("CBSSERVER: >>> CCbsMessageCleanupTimer::~CCbsMessageCleanupTimer()"); 
+    Cancel();
+    CBSLOGSTRING("CBSSERVER: <<< CCbsMessageCleanupTimer::~CCbsMessageCleanupTimer()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessageCleanupTimer::StartTimer
+// Starts the clean up timer.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsMessageCleanupTimer::StartTimer()
+    {    
+    // Cancel a pending request
+    if ( IsActive() )
+        {
+        Cancel();
+        }
+
+    // Get the current time
+    TTime now;
+    now.HomeTime();
+
+    if ( iInterval.Int() > 0 )
+        {
+        TTime nextCleanup( 0 );
+        nextCleanup = now + iInterval;
+        
+        // Start the timer
+        At( nextCleanup );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessageCleanupTimer::StopTimer
+// Stops (cancels) the clean up timer.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsMessageCleanupTimer::StopTimer()
+    {
+    Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessageCleanupTimer::RunL
+// Called after the timer expires. Makes the request to delete the read
+// messages and to set the last clean up time.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsMessageCleanupTimer::RunL()	
+    {
+    if ( iStatus == KErrNone )
+        {
+		iCbsRecCollector.DeleteChainL ( iArray );
+		StopTimer();
+        }
+	}
+
+// ================= OTHER EXPORTED FUNCTIONS ===============================
+
+
+
+//  End of File 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerSrc/CCbsMessageFactory.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,171 @@
+/*
+* 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:  Implementation of CCbsMessageFactory class.
+*
+*/
+
+
+// INCLUDE FILES
+#include <featmgr.h>
+
+#include "CCbsMessageFactory.h"
+#include "CCbsRecMessage.h"
+#include "CCbsRecWcdmaMessage.h"
+#include "CCbsRecEtel.h"
+#include "CbsLogger.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCbsMessageFactory::CCbsMessageFactory
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCbsMessageFactory::CCbsMessageFactory( CCbsRecEtel& aRecEtel )
+: iRecEtel( aRecEtel )
+    {    
+    }
+
+// Destructor    
+CCbsMessageFactory::~CCbsMessageFactory()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsMessageFactory::~CCbsMessageFactory()");
+    CBSLOGSTRING("CBSSERVER: <<< CCbsMessageFactory::~CCbsMessageFactory()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessageFactory::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCbsMessageFactory* CCbsMessageFactory::NewL( CCbsRecEtel& aRecEtel )
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsMessageFactory::NewL()");
+
+    CCbsMessageFactory* self = new ( ELeave ) CCbsMessageFactory( aRecEtel );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    CBSLOGSTRING("CBSSERVER: <<< CCbsMessageFactory::NewL()");
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessageFactory::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCbsMessageFactory::ConstructL()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessageFactory::CreateMessageL
+// Creates a CB message.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+CCbsMessage* CCbsMessageFactory::CreateMessageL( const TDes8& aMessagePage,
+    const RMobileBroadcastMessaging::TMobileBroadcastAttributesV2& aAttributes,
+    TCbsMessageType& aMsgType )
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsMessageFactory::CreateMessageL()");
+
+    CCbsMessage* currentMessage;
+    currentMessage = NULL;
+    
+    if ( aAttributes.iFormat == RMobileBroadcastMessaging::EFormatWcdmaTpdu )
+        {
+        // Accept WCDMA messages only if the feature is supported.
+        FeatureManager::InitializeLibL();
+        
+        if ( FeatureManager::FeatureSupported( KFeatureIdFf3gCellbroadcast ) )
+            {
+            CBSLOGSTRING("CBSSERVER: CCbsMessageFactory::CreateMessageL(): WCDMA msg...");
+            currentMessage = CCbsRecWcdmaMessage::NewL( 
+                aMessagePage, aAttributes );        
+            CBSLOGSTRING("CBSSERVER: CCbsMessageFactory::CreateMessageL(): WCDMA msg created OK.");
+
+            iAttributes = aAttributes;
+
+            // Set the message type
+            aMsgType = ECbsMessageWcdma;
+            }
+        else
+            {
+            CBSLOGSTRING("CBSSERVER: CCbsMessageFactory::CreateMessageL(): WCDMA messages not supported, currentMessage set to NULL.");
+            currentMessage = NULL;
+            }
+        FeatureManager::UnInitializeLib();
+        }
+    else if ( aAttributes.iFormat == RMobileBroadcastMessaging::EFormatGsmTpdu ||
+        aAttributes.iFormat == RMobileBroadcastMessaging::EFormatUnspecified )
+        {        
+        CBSLOGSTRING("CBSSERVER: CCbsMessageFactory::CreateMessageL(): GSM msg...");
+        currentMessage = CCbsRecMessage::NewL( aMessagePage );        
+        CBSLOGSTRING("CBSSERVER: CCbsMessageFactory::CreateMessageL(): GSM msg created OK.");
+
+        // Set the message type
+        aMsgType = ECbsMessageGsm;
+        }
+    else
+        {        
+        CBSLOGSTRING("CBSSERVER: CCbsMessageFactory::CreateMessageL(): Unknown msg type, currentMessage set to NULL.");
+        currentMessage = NULL;
+        }
+
+    if ( currentMessage )
+        {
+        // Livecast messages are handled separately
+        if ( currentMessage->IsLivecastMessage() )
+            {        
+            CBSLOGSTRING("CBSSERVER: CCbsMessageFactory::CreateMessageL(): This is a LC msg, setting type to ECbsMessageLivecast.");
+            // Set the message type
+            aMsgType = ECbsMessageLivecast;    
+            }
+        }
+    
+    CBSLOGSTRING("CBSSERVER: <<< CCbsMessageFactory::CreateMessageL(), returning currentMessage");
+    return currentMessage;    
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsMessageFactory::CreateMessageL
+// Creates a CB message.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+CCbsMessage* CCbsMessageFactory::CreateMessageL( const CCbsMessage& aMessage )
+    {
+    CCbsMessage* message;
+    message = NULL;
+    
+    if ( iAttributes.iFormat == RMobileBroadcastMessaging::EFormatWcdmaTpdu )
+        {
+        message = CCbsRecWcdmaMessage::NewL( aMessage );
+        }
+    else if ( iAttributes.iFormat == RMobileBroadcastMessaging::EFormatGsmTpdu ||
+        iAttributes.iFormat == RMobileBroadcastMessaging::EFormatUnspecified )
+        {
+        message = CCbsRecMessage::NewL( aMessage );
+        }
+
+    return message;
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerSrc/CCbsObject.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 class represents the base class for all server-side subsession
+*                classes.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "CbsCommon.h"
+#include "CCbsSession.h"
+#include "CCbsObject.h"
+#include "CbsLogger.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCbsObject::CCbsObject
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCbsObject::CCbsObject( CCbsSession& aSession )
+    : iSession( aSession )
+    {
+    }
+
+// Destructor    
+CCbsObject::~CCbsObject()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsObject::~CCbsObject()");
+    CBSLOGSTRING("CBSSERVER: <<< CCbsObject::~CCbsObject()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsObject::Message
+// Returns the current message.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+const RMessage2& CCbsObject::Message()
+    {
+    return iSession.Message();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsObject::Session
+// Returns the current session.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+CCbsSession& CCbsObject::Session()
+    {
+    return iSession;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsObject::PanicClient
+// Panics the client.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+void CCbsObject::PanicClient( 
+    TCbsSessionPanic aPanic ) const
+    {
+    iSession.PanicClient( aPanic );
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerSrc/CCbsRecMessage.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,215 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsRecMessage class 
+*                member functions.
+*    
+*                CCbsRecMessage represents a message page generated by CCbsRecEtelMonitor.
+*                CCbsRecMessage is constructed from a CB message page received from 
+*                ETel server.   
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CCbsRecMessage.h"
+#include "CbsServerPanic.h"
+#include "CbsLogger.h"
+
+// CONSTANTS
+
+// ================= MEMBER FUNCTIONS =======================================
+
+// -----------------------------------------------------------------------------
+// CCbsRecMessage::CCbsRecMessage
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCbsRecMessage::CCbsRecMessage()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecMessage::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCbsRecMessage::ConstructL( 
+    const TDes8& aMessagePage )    // ETel received msg page
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsRecMessage::ConstructL() (TDes8 from ETel)");
+
+    // Retrieve values for message header information.
+    iSerialNumber = TUint16( ( aMessagePage[ 0 ] << 8 ) | aMessagePage [ 1 ] );
+    iMessageIdentifier = TUint16( ( aMessagePage[ 2 ] << 8 ) | aMessagePage[ 3 ] );
+    iDCS = aMessagePage[ 4 ];    
+    iPageParameter = aMessagePage[ 5 ];
+
+    if ( ThisPage() == 0 || TotalPages() == 0 )
+        {
+        iPageParameter = KPageParameterSingle;
+        }
+
+    CBSLOGSTRING2("CBSSERVER: CCbsRecMessage::ConstructL(): iSerialNumber: %d", iSerialNumber );
+    CBSLOGSTRING2("CBSSERVER: CCbsRecMessage::ConstructL(): iMessageIdentifier: %d", iMessageIdentifier );
+    CBSLOGSTRING2("CBSSERVER: CCbsRecMessage::ConstructL(): iDCS: %d", iDCS );
+    CBSLOGSTRING2("CBSSERVER: CCbsRecMessage::ConstructL(): iPageParameter: %d", iPageParameter );
+
+    // 16-bit representation not prepared.
+    iMessage = NULL;
+
+    // A buffer for the message contents.
+    iMessage8 = HBufC8::NewL( RMobileBroadcastMessaging::KGsmBroadcastDataSize );
+    TPtr8 messagePtr = iMessage8->Des();
+	TPtrC8 sourceMessagePtr;
+
+	if ( ThisPage() == 1 && IsLivecastMessage () ) 
+		{
+		sourceMessagePtr.Set( aMessagePage.Right( aMessagePage.Length() ) );
+		}
+	else
+		{
+		sourceMessagePtr.Set( aMessagePage.Right( aMessagePage.Length() - KHeaderLength ) );
+		}
+
+    // Copy the TCbs page contents into this buffer.
+    messagePtr.Copy( sourceMessagePtr );
+
+    // Indicate that we have no network info available
+    iNetworkInfo.iCountryCode = KRecMessageNoNetworkInfo;
+
+    // Set network mode
+    iNetworkMode = ECbsNetworkGsm;
+
+    CBSLOGSTRING("CBSSERVER: <<< CCbsRecMessage::ConstructL() (TDes8 from ETel)");
+    }
+    
+// -----------------------------------------------------------------------------
+// CCbsRecMessage::ConstructL
+// Symbian 2nd phase copyconstructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCbsRecMessage::ConstructL( 
+    const CCbsMessage& aMessagePage )
+    {
+    iSerialNumber = aMessagePage.Key();
+    iMessageIdentifier = aMessagePage.TopicNumber();
+    iDCS = aMessagePage.DCS();
+    iPageParameter = aMessagePage.PageParameter();
+
+    iLanguage = aMessagePage.Language();
+
+    // A buffer for the message contents.
+    if ( aMessagePage.Message() != NULL )
+        {
+        iMessage = HBufC::NewL( aMessagePage.Contents().Length() );
+        iMessage->Des().Copy( aMessagePage.Contents() );
+        }
+
+    if ( aMessagePage.Message8() != NULL )
+        {
+        iMessage8 = HBufC8::NewL( aMessagePage.Contents8().Length() );
+        TPtr8 messagePtr = iMessage8->Des();
+        messagePtr.Copy( aMessagePage.Contents8() );
+        }
+    }
+    
+// -----------------------------------------------------------------------------
+// CCbsRecMessage::NewL
+// Two-phased constructor.
+// Constructs a new CCbsRecMessage based on TDes8&
+// (which is a descriptor) received from EPOC Telephony Server.
+// -----------------------------------------------------------------------------
+//
+CCbsRecMessage* CCbsRecMessage::NewL( 
+    const TDes8& aMessagePage ) // page received from EPOC Telephony Server 
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsRecMessage::NewL() (TDes8 from ETel)");
+
+    CCbsRecMessage* self = new ( ELeave ) CCbsRecMessage();
+    CleanupStack::PushL( self );
+    self->ConstructL( aMessagePage );
+    CleanupStack::Pop();
+
+    CBSLOGSTRING("CBSSERVER: <<< CCbsRecMessage::NewL() (TDes8 from ETel)");
+    return self;
+    } 
+
+// -----------------------------------------------------------------------------
+// CCbsRecMessage::NewL
+// Constructs a copy of the message given as parameter.
+// -----------------------------------------------------------------------------
+//
+CCbsRecMessage* CCbsRecMessage::NewL( 
+    const CCbsMessage& aMessagePage )
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsRecMessage::NewL() (copy CCbsMessage)");
+
+    CCbsRecMessage* self = new ( ELeave ) CCbsRecMessage;
+    CleanupStack::PushL( self );
+    self->ConstructL( aMessagePage );
+    CleanupStack::Pop();
+    
+    CBSLOGSTRING("CBSSERVER: <<< CCbsRecMessage::NewL() (copy CCbsMessage)");
+    return self;
+    }
+    
+// Destructor
+CCbsRecMessage::~CCbsRecMessage()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsRecMessage::~CCbsRecMessage()");
+    delete iMessage;
+    delete iMessage8;
+    CBSLOGSTRING("CBSSERVER: <<< CCbsRecMessage::~CCbsRecMessage()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecMessage::ThisPage
+// Returns the page number of this page in the message page sequence
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+TUint CCbsRecMessage::ThisPage() const
+    {
+    return PageParameter() >> 4;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecMessage::TotalPages
+// Returns the total number of pages in this page's message.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+TUint CCbsRecMessage::TotalPages() const
+    {
+    return PageParameter() & 0xF;    // 1111b
+    }
+
+
+// ============ PRIVATE FUNCTIONS ==========================
+
+// -----------------------------------------------------------------------------
+// CCbsRecMessage::MessageType
+// Returns the message type of this message.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCbsRecMessage::MessageType() const
+    {
+    return KErrNotSupported;
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS ==============
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerSrc/CCbsRecWcdmaMessage.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,250 @@
+/*
+* 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:  This module contains the implementation of CCbsRecWcdmaMessage 
+*                class member functions.
+*    
+*                CCbsRecWcdmaMessage represents a WCDMA message page generated 
+*                by CCbsRecEtelMonitor. CCbsRecWcdmaMessage is constructed from a
+*                CB message page received from ETel server.   
+*
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include "CCbsRecWcdmaMessage.h"
+#include "CbsServerPanic.h"
+#include "CbsLogger.h"
+
+// The empty message length. 1 octet is for page parameter 
+const TInt KCbsRecWcdmaMessageMinLength = 1;
+// The maximum message length
+const TInt KCbsRecWcdmaMessageMaxLength = 82;
+// The value that use for parse the page parameter octet.
+const TInt KCbsRecWcdmaPageOfNumberMaskForLow4 = 0x000f;
+
+
+// ================= MEMBER FUNCTIONS =======================================
+
+// -----------------------------------------------------------------------------
+// CCbsRecWcdmaMessage::CCbsRecWcdmaMessage
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCbsRecWcdmaMessage::CCbsRecWcdmaMessage( 
+    const RMobileBroadcastMessaging::TMobileBroadcastAttributesV2& aAttributes )    
+    : iWcdmaAttributes( aAttributes )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecWcdmaMessage::CCbsRecWcdmaMessage
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCbsRecWcdmaMessage::CCbsRecWcdmaMessage()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecWcdmaMessage::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCbsRecWcdmaMessage::ConstructL( 
+    const TDes8& aMessagePage,    // ETel received msg page
+    const RMobileBroadcastMessaging::TMobileBroadcastAttributesV2& aAttributes )
+    {
+    // Message attributes
+    iTotalNumberOfPages = 
+     ( aAttributes.iNumberOfPages & KCbsRecWcdmaPageOfNumberMaskForLow4 ) ?
+     ( aAttributes.iNumberOfPages & KCbsRecWcdmaPageOfNumberMaskForLow4 ) : 1;
+
+    iMessageType = aAttributes.iMessageType;
+    iMessageIdentifier = aAttributes.iMessageId;
+    iSerialNumber = aAttributes.iSerialNum;
+    iDCS = aAttributes.iDCS;
+
+    // 16-bit representation not prepared.
+    iMessage = NULL;
+    // A buffer for the message contents.
+    iMessage8 = HBufC8::NewL( RMobileBroadcastMessaging::KWCdmaBroadcastPageSize );    
+    TPtr8 messagePtr = iMessage8->Des();
+    messagePtr.Trim();
+
+    TPtrC8 sourceMessagePtr;
+    TInt msgLength = aMessagePage.Length();
+    CBSLOGSTRING2("CBSSERVER: CCbsRecWcdmaMessage::\
+                   ConstructL(): msgLength: %d", msgLength );
+
+    // Message from ETel for 3G has no header and CTSY will append the page 
+    // parameter to the last of message. So the non-empty message's length
+    // must more than 1 octet. The max length for one message page must
+    // less than 82 octets. Additional octets will be omitted.
+    if ( msgLength > KCbsRecWcdmaMessageMinLength )
+        {
+        // Number of this page. Taken form the last byte of the message. 
+        // Max 15, therefore masked with 0xF
+        iPageParameter = 
+            ( aMessagePage[ msgLength - KCbsRecWcdmaMessageMinLength ] 
+            & KCbsRecWcdmaPageOfNumberMaskForLow4 ) ?
+            ( aMessagePage[ msgLength - KCbsRecWcdmaMessageMinLength ] 
+              & KCbsRecWcdmaPageOfNumberMaskForLow4 ) : 1;
+        
+        sourceMessagePtr.Set( aMessagePage.Left( msgLength - 
+                    KCbsRecWcdmaMessageMinLength) );
+
+        if ( KCbsRecWcdmaMessageMaxLength < sourceMessagePtr.Length() )
+            {
+            sourceMessagePtr.Set( aMessagePage.Left( 
+                        KCbsRecWcdmaMessageMaxLength ) );
+            }
+        }
+
+    // Copy the TCbs page contents into this buffer.
+    messagePtr.Copy( sourceMessagePtr );
+
+    // Indicate that we have no network info available
+    iNetworkInfo.iCountryCode = KRecMessageNoNetworkInfo;
+
+    // Set network mode
+    iNetworkMode = ECbsNetworkWcdma;
+
+    CBSLOGSTRING2("CBSSERVER: CCbsRecWcdmaMessage::ConstructL(): \
+                   iTotalNumberOfPages: %d", iTotalNumberOfPages );
+    CBSLOGSTRING2("CBSSERVER: CCbsRecWcdmaMessage::ConstructL(): \
+                   iSerialNumber: %d", iSerialNumber );
+    CBSLOGSTRING2("CBSSERVER: CCbsRecWcdmaMessage::ConstructL(): \
+                   iMessageIdentifier: %d", iMessageIdentifier );
+    CBSLOGSTRING2("CBSSERVER: CCbsRecWcdmaMessage::ConstructL(): \
+                   iDCS: %d", iDCS );
+    CBSLOGSTRING2("CBSSERVER: CCbsRecWcdmaMessage::ConstructL(): \
+                   iPageParameter: %d", iPageParameter );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecWcdmaMessage::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCbsRecWcdmaMessage::ConstructL( const CCbsMessage& aMessage )
+    {
+    // Message attributes
+    iTotalNumberOfPages = aMessage.TotalPages();
+    iMessageType = (TUint8) aMessage.MessageType();
+    iMessageIdentifier = aMessage.TopicNumber();
+    iSerialNumber = aMessage.Key();
+    iDCS = aMessage.DCS();
+    // Number of this page, extracted from last octet of the message data
+    iPageParameter = aMessage.PageParameter();
+
+    iLanguage = aMessage.Language();
+
+    // A buffer for the message contents.
+    if ( aMessage.Message() )
+        {
+        iMessage = HBufC::NewL( aMessage.Contents().Length() );
+        iMessage->Des().Copy( aMessage.Contents() );
+        }
+
+    if ( aMessage.Message8() )
+        {
+        iMessage8 = HBufC8::NewL( aMessage.Contents8().Length() );
+        TPtr8 messagePtr = iMessage8->Des();
+        messagePtr.Copy( aMessage.Contents8() );
+        }
+    }
+   
+// -----------------------------------------------------------------------------
+// CCbsRecWcdmaMessage::NewL
+// Two-phased constructor.
+// Constructs a new CCbsRecWcdmaMessage based on TDes8& and message attributes
+// (which is a descriptor) received from EPOC Telephony Server.
+// -----------------------------------------------------------------------------
+//
+CCbsRecWcdmaMessage* CCbsRecWcdmaMessage::NewL( 
+    const TDes8& aMessagePage,  // page received from EPOC Telephony Server 
+    const RMobileBroadcastMessaging::TMobileBroadcastAttributesV2& aAttributes ) 
+    {
+    CCbsRecWcdmaMessage* self = new ( ELeave ) CCbsRecWcdmaMessage( aAttributes );
+    CleanupStack::PushL( self );
+    self->ConstructL( aMessagePage, aAttributes );
+    CleanupStack::Pop( self );
+    return self;
+    } 
+
+// -----------------------------------------------------------------------------
+// CCbsRecWcdmaMessage::NewL
+// Two-phased constructor.
+// Constructs a new CCbsRecWcdmaMessage based on an existing message.
+// -----------------------------------------------------------------------------
+//
+CCbsRecWcdmaMessage* CCbsRecWcdmaMessage::NewL( const CCbsMessage& aMessage )
+    {
+    CCbsRecWcdmaMessage* self = new ( ELeave ) CCbsRecWcdmaMessage();
+    CleanupStack::PushL( self );
+    self->ConstructL( aMessage );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+   
+// Destructor
+CCbsRecWcdmaMessage::~CCbsRecWcdmaMessage()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsRecWcdmaMessage::~CCbsRecWcdmaMessage()");
+    delete iMessage;
+    delete iMessage8;
+    CBSLOGSTRING("CBSSERVER: <<< CCbsRecWcdmaMessage::~CCbsRecWcdmaMessage()");
+    }
+    
+// -----------------------------------------------------------------------------
+// CCbsRecWcdmaMessage::ThisPage
+// Returns the page number of this page in the message page sequence
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+TUint CCbsRecWcdmaMessage::ThisPage() const
+    {
+    return PageParameter();    
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecWcdmaMessage::TotalPages
+// Returns the total number of pages in this page's message.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+TUint CCbsRecWcdmaMessage::TotalPages() const
+    {
+    return iTotalNumberOfPages;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecWcdmaMessage::MessageType
+// Returns the message type of this message.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCbsRecWcdmaMessage::MessageType() const
+    {
+    return iMessageType;
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerSrc/CCbsReceiverHelper.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,905 @@
+/*
+* Copyright (c) 2003-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 module contains the implementation of CCbsReceiverHelper class
+*                member functions.
+*
+*                CCbsReceiverHelper gets the messages from the receiver and
+*                sends them to the database. All received messages are
+*                sent to CCbsReceiverHelper instance by CCbsRecEtel.
+*                This class makes subscription and existence checks
+*                to these messages and also implements topic detection feature.
+*
+*/
+
+
+// INCLUDE FILES
+#include <barsc.h>              // Resource access
+#include <barsread.h>           // Resource access
+
+#include <CbsServer.rsg>
+
+#include "CbsCommon.h"
+#include "CbsUtils.h"
+#include "CbsServerPanic.h"
+#include "CCbsServer.h"
+#include "CCbsReceiverHelper.h"
+#include "CCbsDbImp.H"
+#include "CCbsDbImpSettings.H"
+#include "CCbsDbImpTopicList.h"
+#include "CCbsDbImpTopicMessages.h"
+#include "CCbsDbImpTopicCollection.h"
+#include "CCbsRecMessage.h"
+#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <viewcli.h>            // View server access
+#else
+#include <viewclipartner.h>
+#endif
+#include <AknNotifyStd.h>       // ECellBroadcastNotification
+#include <AknSoftNotifier.h>    // Soft Notification API
+#include <e32property.h>
+#include <coreapplicationuisdomainpskeys.h>
+// <-- QT PHONE START -->
+//#include <NcnListDomainPSKeys.h> 
+// <-- QT PHONE END -->
+
+#include <data_caging_path_literals.hrh>
+#include "CbsLogger.h"
+
+#include <centralrepository.h>  // for local variation
+#include "cbsinternalcrkeys.h"  // for local variation
+#include "cbsvariant.hrh"       // for local variation
+
+// CONSTANTS
+
+// UID of CBS UI application
+#define KUidCbsUiappDef 0x101F4CD3
+const TUid KUidCbsUiappApp = { KUidCbsUiappDef };
+
+const TInt KCbsImmediateMessageIdInt = 313;
+const TUid KCbsImmediateMessageId = { KCbsImmediateMessageIdInt };
+// <-- QT PHONE START -->
+//const TInt KCbsMessageTone  = 2; // See SharedDataKeysVariant.h or NcnListInternalPSKeys.h
+// <-- QT PHONE END -->
+// DATA TYPES
+// CbsUi application view ID's
+enum TCbsUiViewIds
+    {
+    ECbsUiTopicViewId = 1,
+    ECbsUiTopicListViewId,
+    ECbsUiListAppColumnViewId,
+    ECbsUiMsgViewId,            //message view id
+    ECbsUiAddFromIndexViewId,
+    ECbsUiSettingsViewId
+    };
+
+// These values specify a range of accepted topic number values (inclusive).
+const TUint KMinTopicNumber = 1;     // 000 is not accepted.
+const TUint KMaxTopicNumber = 999;
+
+// LOCAL FUNCTION PROTOTYPES
+LOCAL_C void ParseMessageFormatL(
+    TLex& aLex, CCbsDbImpTopicCollection& aCollection );
+LOCAL_C void ParseIndexElementIntroL(
+    TLex& aLex, CCbsDbImpTopicCollection& aCollection );
+LOCAL_C void ParseServiceIntroL(
+    TLex& aLex, CCbsDbImpTopicCollection& aCollection );
+LOCAL_C void ParseMessageIdL(
+    TLex& aLex, TUint& aMessageId );
+LOCAL_C void ParseSubIndexIntroL(
+    TLex& aLex );
+LOCAL_C void ParseSubIndexIdL(
+    TLex& aLex );
+LOCAL_C void ParseNameCharactersCrLfL(
+    TLex& aLex, TPtrC& aName );
+
+// ==================== LOCAL FUNCTIONS ====================
+
+// -----------------------------------------------------------------------------
+// ParseMessageFormatL
+// Parses an index message.
+// Returns: None
+// -----------------------------------------------------------------------------
+//
+LOCAL_C void ParseMessageFormatL(
+    TLex& aLex,
+    CCbsDbImpTopicCollection& aCollection )
+    {
+    TInt identitiesCount( 0 );
+    while ( !aLex.Eos() )
+        {
+        ParseIndexElementIntroL( aLex, aCollection );
+        identitiesCount++;
+        }
+
+    if ( identitiesCount == 0 )
+        {
+        User::Leave( KErrCorrupt );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// ParseIndexElementIntroL
+// Parses part of an index message.
+// Returns: None
+// -----------------------------------------------------------------------------
+//
+LOCAL_C void ParseIndexElementIntroL(
+    TLex& aLex,
+    CCbsDbImpTopicCollection& aCollection )
+    {
+    TBool hasSubIndexId( EFalse );
+
+    // subindex-id (optional for service-intro)
+    if ( aLex.Peek().IsAlpha() )
+        {
+        hasSubIndexId = ETrue;
+        ParseSubIndexIdL( aLex );
+        }
+
+    // subindex-intro | service-intro
+    // We'll take a peek to discover, which one
+    if ( hasSubIndexId && aLex.Peek() == EKeySpace )
+        {
+        ParseSubIndexIntroL( aLex );
+        }
+    else
+        {
+        ParseServiceIntroL( aLex, aCollection );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// ParseServiceIntroL
+// Parses part of an index message.
+// Returns: None
+// -----------------------------------------------------------------------------
+//
+LOCAL_C void ParseServiceIntroL(
+    TLex& aLex,
+    CCbsDbImpTopicCollection& aCollection )
+    {
+    // We'll store the results here
+    TCbsDbTopicIdentity identity;
+
+    // message-id
+    TUint messageId;
+    ParseMessageIdL( aLex, messageId );
+    identity.iNumber = TUint16( messageId );
+
+    // delimeter
+    TChar delimeter( aLex.Get() );
+    if ( delimeter != ' ' && delimeter != '.' )
+        {
+        User::Leave( KErrCorrupt );
+        }
+
+    // service-name
+    TPtrC serviceName;
+    ParseNameCharactersCrLfL( aLex, serviceName );
+    // drop crlf
+    serviceName.Set( serviceName.Left( serviceName.Length()-2 ) );
+
+    // If the delimeter is ' ', store the identity. Otherwise
+    // it only refers to a subindex page, so we skip it
+    if ( delimeter == ' ' )
+        {
+        // Copy max. KCbsDbTopicNameLength characters
+        identity.iName = serviceName.Left( KCbsDbTopicNameLength );
+        // Store the topic identity into the database
+        aCollection.AddTopicIdentityL( identity );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// ParseMessageIdL
+// Parses part of an index message.
+// Returns: None
+// -----------------------------------------------------------------------------
+//
+LOCAL_C void ParseMessageIdL(
+    TLex& aLex,
+    TUint& aMessageId )
+    {
+    if ( aLex.Val( aMessageId ) != KErrNone
+        || aMessageId < KMinTopicNumber
+        || aMessageId > KMaxTopicNumber )
+        {
+        User::Leave( KErrCorrupt );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// ParseSubIndexIntroL
+// Parses part of an index message.
+// subindex-intro = " " subindex-name crlf
+// subindex-name  = name-character+
+// Returns: None
+// -----------------------------------------------------------------------------
+//
+LOCAL_C void ParseSubIndexIntroL(
+    TLex& aLex )
+    {
+    if ( aLex.Get() != EKeySpace )
+        {
+        User::Leave( KErrCorrupt );
+        }
+
+    // subindex-name crlf
+    TPtrC subIndexName;
+    ParseNameCharactersCrLfL( aLex, subIndexName );
+    }
+
+// -----------------------------------------------------------------------------
+// ParseSubIndexIdL
+// Parses part of an index message.
+// subindex-id = subindex-character+
+// Returns: None
+// -----------------------------------------------------------------------------
+//
+LOCAL_C void ParseSubIndexIdL(
+    TLex& aLex )
+    {
+    // check that there is at least one subindex-character
+    if ( !aLex.Peek().IsAlpha() )
+        {
+        User::Leave( KErrCorrupt );
+        }
+
+    // subindex-id
+    while ( aLex.Peek().IsAlpha() )
+        {
+        aLex.Inc();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// ParseNameCharactersCrLfL
+// Parses part of an index message.
+// name-character+ crlf
+// Returns: None
+// -----------------------------------------------------------------------------
+//
+LOCAL_C void ParseNameCharactersCrLfL(
+    TLex& aLex,
+    TPtrC& aName )
+    {
+    aLex.Mark();
+
+    // check that we have at least one name-character
+    TChar currCharacter( aLex.Get() );
+    if( currCharacter == EKeyLineFeed
+        || currCharacter == EKeyEnter
+        || currCharacter == 0 )
+        {
+        User::Leave( KErrCorrupt );
+        }
+
+    // scan until LF or EOS
+    while( currCharacter != EKeyLineFeed && currCharacter != 0 )
+        {
+        currCharacter = aLex.Get();
+        }
+
+    // CR-LF is ok, EOS is not
+    if( currCharacter == EKeyLineFeed )
+        {
+        aName.Set( aLex.MarkedToken() );
+        }
+    else
+        {
+        User::Leave( KErrCorrupt );
+        }
+    }
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCbsReceiverHelper::CCbsReceiverHelper
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCbsReceiverHelper::CCbsReceiverHelper(
+    CCbsDbImp& aDatabase )
+    : iDatabase( aDatabase )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsReceiverHelper::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCbsReceiverHelper::ConstructL()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsReceiverHelper::ConstructL()");
+
+    iVwsSession = CVwsSessionWrapper::NewL();
+
+    // Array for SIM Topic numbers. This way we know which topics
+    // to delete also from the SIM card (when deleting all topics).
+    iSimTopics = new ( ELeave ) CArrayFixFlat<TInt>( 1 );
+    
+    // Fetch local variation bits from CenRep    
+    CRepository* repository = CRepository::NewL( KCRUidCbsVariation );    
+    TInt err = repository->Get( KCbsVariationFlags, iLVBits );
+    if ( err )
+        {
+        iLVBits = 0;
+        }  
+    CBSLOGSTRING2("CBSSERVER: CCbsRecEtel::ConstructL(): CenRep error: %d", err );
+    delete repository;
+
+    CBSLOGSTRING("CBSSERVER: <<< CCbsReceiverHelper::ConstructL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsReceiverHelper::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCbsReceiverHelper* CCbsReceiverHelper::NewL(
+    CCbsDbImp& aDatabase )
+    {
+    // Normal two phase construction.
+    CCbsReceiverHelper* self = new ( ELeave ) CCbsReceiverHelper( aDatabase );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// Destructor
+CCbsReceiverHelper::~CCbsReceiverHelper()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsReceiverHelper::~CCbsReceiverHelper()");
+
+    delete iSimTopics;
+    delete iVwsSession;
+
+    CBSLOGSTRING("CBSSERVER: <<< CCbsReceiverHelper::~CCbsReceiverHelper()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsReceiverHelper::CCbsReceiverHelper
+// Processes a message received by the receiver.
+//
+// This function is called when a message is received.
+//
+// Assumptions;
+// 1.  The message doesn't have it's permanent or read
+//     flags raised - method leaves with KErrNotSupported
+//     if this is the case.
+// 2.  If an index message (root or subindex) is passed as
+//     a parameter, the language indication prefix, if any,
+//     has been removed before HandleReceivedMessageL() is called.
+//
+// Assumption (2) holds because language indications are removed
+// by Receiver module in an instance of CCbsRecDecoder.
+// Message may not be accepted if it is somehow invalid
+// or the reception has been disabled.
+// This function also handles the detection of new topics
+// and the processing of an index message.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsReceiverHelper::HandleReceivedMessageL(
+    CCbsMessage& aMessage )
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsReceiverHelper::HandleReceivedMessageL()");
+
+    if ( aMessage.IsIndexMessage() )
+        {
+        CBSLOGSTRING("CBSSERVER: CCbsReceiverHelper::HandleReceivedMessageL(): Index msg.");
+
+        // It is assumed that a language indication prefix,
+        // if any, has already been removed from the message.
+        aMessage.RemoveIndexHeaderL();
+
+        TBool isChildSubindex( aMessage.IsChildSubindex() );
+
+        // Parse the index message
+        HandleIndexMessageL( aMessage.Contents(), isChildSubindex );
+
+        // Child subindex messages won't be displayed to the user.
+        if ( isChildSubindex )
+            {
+            return;
+            }
+        }
+
+    TUint16 topicNumber( aMessage.TopicNumber() );
+    CBSLOGSTRING2("CBSSERVER: CCbsReceiverHelper::HandleReceivedMessageL(): topic number: %d.", topicNumber );
+
+    TCbsDbTopic topic;
+    iDatabase.TopicListL().FindTopicByNumberL( topicNumber, topic );
+    CBSLOGSTRING("CBSSERVER: CCbsReceiverHelper::HandleReceivedMessageL(): iDatabase.TopicListL().FindTopicByNumberL(..) called OK." );
+
+    // If subscribed, handle the message
+    if ( topic.iSubscribed )
+        {
+        CBSLOGSTRING("CBSSERVER: CCbsReceiverHelper::HandleReceivedMessageL(): Topic subscribed, processing." );
+
+        // Create and initialize message
+        TCbsDbMessage message;
+
+        TTime now;
+        now.UniversalTime();
+        message.iDateTime = now.Int64();
+        message.iKey = aMessage.Key();
+        message.iLanguage = aMessage.Language();
+        message.iLength = aMessage.Contents().Length();
+        message.iPermanent = EFalse;
+        message.iRead = EFalse;
+        TPtrC ptr( aMessage.Contents() );
+
+        iDatabase.TopicMessagesL().AddMessageL( topicNumber, message, ptr );
+        CBSLOGSTRING("CBSSERVER: CCbsReceiverHelper::HandleReceivedMessageL(): Msg added OK." );
+
+        if ( aMessage.RequiresImmediateDisplay() )
+            {
+            CBSLOGSTRING("CBSSERVER: CCbsReceiverHelper::HandleReceivedMessageL(): Calling LaunchMessageImmediateDisplay()... " );
+
+            // If the operator indicates that this message must be displayed
+            // immediately, request a view switch of CBS UI application.
+            LaunchMessageImmediateDisplay( message );
+
+            CBSLOGSTRING("CBSSERVER: CCbsReceiverHelper::HandleReceivedMessageL(): LaunchMessageImmediateDisplay() called OK." );
+            }
+        else if ( topic.iHotmarked )
+            {
+            // The message is of a hotmarked topic => Show a soft notification.
+            CBSLOGSTRING("CBSSERVER: CCbsReceiverHelper::HandleReceivedMessageL(): Calling LaunchMessageSoftNotification()... " );
+            LaunchMessageSoftNotificationL( ETrue );
+            CBSLOGSTRING("CBSSERVER: CCbsReceiverHelper::HandleReceivedMessageL(): LaunchMessageSoftNotification() called OK." );
+            }
+        } // if ( topic.iSubscribed )
+    else
+        {
+        CBSLOGSTRING("CBSSERVER: CCbsReceiverHelper::HandleReceivedMessageL(): Topic NOT subscribed, msg not processed." );
+        }
+
+    CBSLOGSTRING("CBSSERVER: <<< CCbsReceiverHelper::HandleReceivedMessageL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsReceiverHelper::CheckForNewTopicL
+// Checks if aMessage's topic is in the topic list.
+//
+// If the topic detection is enabled and the topic of this
+// message is not in the topic list, the topic is added
+// to the list. The method will then return ETrue.
+// Otherwise EFalse is returned.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCbsReceiverHelper::CheckForNewTopicL(
+    const CCbsMessage& aMessage )
+    {
+    // Check if the topic detection is on and if so, add topic if the topic
+    // is a new topic.
+    TBool detection;
+    TBool result( EFalse );
+
+    iDatabase.SettingsL().GetTopicDetectionStatus( detection );
+
+    if ( detection && HandleTopicDetectedL( aMessage.TopicNumber() ) )
+        {
+        // If a new topic added, we do not send the message to
+        // the database so return ETrue.
+        result = ETrue;
+        }
+    else
+        {
+        // Topic detection disabled or topic already in the database
+        result = EFalse;
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsReceiverHelper::CheckForSubscriptionAndExistenceL
+// Checks if the topic of this message is listed and subscribed.
+// Returns ETrue only if the message does not exist in the
+// database and the message's topic is subscribed.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCbsReceiverHelper::CheckForSubscriptionAndExistenceL(
+    const CCbsMessage& aMessage )
+    {
+    // Check if the message belongs to some subscribed topic.
+    TCbsDbTopic topic;
+    TUint16 topicNumber( 0 );
+
+    // Index messages are stored in topic 0.
+    if ( !aMessage.IsIndexMessage() )
+        {
+        topicNumber = aMessage.TopicNumber();
+        }
+
+    TRAPD( errorCode, iDatabase.TopicListL().FindTopicByNumberL( topicNumber, topic ) );
+
+    if ( errorCode == KErrNotFound )
+        {
+        return EFalse;
+        }
+    User::LeaveIfError( errorCode );
+
+    return topic.iSubscribed;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsReceiverHelper::LanguageOfMessageSubscribedL
+// Checks if aMessage's language has been subscribed by the user.
+// ETrue is returned either if the language specified has been
+// subscribed, message language is "Other" or the user has
+// prefers to receive messages of all languages.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCbsReceiverHelper::LanguageOfMessageSubscribedL(
+    const CCbsMessage& aMessage )
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsReceiverHelper::LanguageOfMessageSubscribedL" );
+
+    TCbsDbLanguages languages;
+    iDatabase.SettingsL().GetLanguages( languages );
+
+    if ( aMessage.Language() < 0 || aMessage.Language() >= ECbsCount )
+        {
+        return EFalse;
+        }
+
+    TCbsDbLanguage language( aMessage.Language() );
+    CBSLOGSTRING2("CBSSERVER: CCbsReceiverHelper::LanguageOfMessageSubscribedL: language: %d.", language );
+
+    TBool subscribed( languages.iLanguages[ECbsAll] ||
+        languages.iLanguages[ECbsOther] && language == ECbsOther ||
+        !languages.iLanguages[ECbsOther] && languages.iLanguages[language] );
+
+    CBSLOGSTRING2("CBSSERVER: <<< CCbsReceiverHelper::LanguageOfMessageSubscribedL, returning %d.", subscribed );
+    return subscribed;
+    }
+
+// ---------------------------------------------------------
+// AddSimTopicL()
+//
+// Adds the given topic (aNumber, aName) into the DB.
+// ---------------------------------------------------------
+void CCbsReceiverHelper::AddSimTopicL( 
+    const TUint aNumber,
+    const TDesC& aName )
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsReceiverHelper::AddSimTopicL()");
+
+    TCbsDbTopic topic;
+    if ( aName == KNullDesC )       // Topic name not given, use "SIM topics".
+        {
+        // Establish file server session.
+        RFs fs;
+        User::LeaveIfError( fs.Connect() );
+        CleanupClosePushL( fs );
+
+        // Open localized resource file.
+        RResourceFile resourceFile;
+        CbsUtils::FindAndOpenDefaultResourceFileLC(
+            fs, resourceFile ); // on CS
+
+        // Read "SIM topic"-string.
+        TResourceReader reader;
+        reader.SetBuffer( resourceFile.AllocReadLC(
+            R_TEXT_SIM_TOPIC ) ); // on CS
+
+        HBufC* text = reader.ReadHBufCL();
+        topic.iName = *text;
+        CleanupStack::PopAndDestroy(3);  // fs, resourceFile, readerBuf
+
+        CBSLOGSTRING("CBSSERVER: CCbsReceiverHelper::AddSimTopicL(): Topic name read from resources.");
+        }
+    else // Use the given topic name.
+        {
+        topic.iName = aName;
+        }
+
+    topic.iNumber = TUint16( aNumber );
+    topic.iHotmarked = EFalse;
+    topic.iProtected = EFalse;
+    
+    // Variated feature    
+    if ( iLVBits & KCbsLVFlagTopicSubscription )
+        {
+        topic.iSubscribed = ETrue;
+        }
+    else
+        {
+        topic.iSubscribed = EFalse;
+        }
+
+    // Leaves, if the topic already exists, so we trap that
+    // error. All other errors are passed as a normal leave.
+    CBSLOGSTRING2("CBSSERVER: CCbsReceiverHelper::AddSimTopicL(): Topic %d from SIM to topic list...", topic.iNumber );
+    // Try to add topic to topic list, topic not detected automatically
+    TRAPD( err, iDatabase.TopicListL().AddTopicL( topic, EFalse ) );
+    CBSLOGSTRING2("CBSSERVER: CCbsReceiverHelper::AddSimTopicL(): AddTopicL() TRAPped error: %d.", err );
+
+    if( err != KErrAlreadyExists && err != KErrArgument )
+        {
+        CBSLOGSTRING("CBSSERVER: CCbsReceiverHelper::AddSimTopicL(): Leave if error != -11 || -6");
+        User::LeaveIfError( err );
+        }
+
+    // Append to SIM Topic array
+    iSimTopics->AppendL( topic.iNumber );
+    CBSLOGSTRING2("CBSSERVER: CCbsReceiverHelper::AddSimTopicL(): Topic %d appended to array.", topic.iNumber ); 
+    
+    // Leave so that caller is informed e.g. if topic already exists
+    User::LeaveIfError( err );
+    CBSLOGSTRING("CBSSERVER: <<< CCbsReceiverHelper::AddSimTopicL()" );
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsReceiverHelper::SimTopics
+// Returns topics currently added from the SIM card.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CArrayFixFlat<TInt>& CCbsReceiverHelper::SimTopics() const
+    {
+    return *iSimTopics;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsReceiverHelper::DeleteFromSimTopicCache
+// Deletes the topic number from local SIM Topic array.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsReceiverHelper::DeleteFromSimTopicCache( const TUint16 aNumber )
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsReceiverHelper::DeleteFromSimTopicCache()");
+    CBSLOGSTRING2("CBSSERVER: CCbsReceiverHelper::DeleteFromSimTopicCache(): Topic number: %d", aNumber );
+    CBSLOGSTRING2("CBSSERVER: CCbsReceiverHelper::DeleteFromSimTopicCache(): Topic count in cache (1): %d", iSimTopics->Count() );
+
+    // Check if this topic is a SIM Topic (can be found in the array)
+    TKeyArrayFix key( 0, ECmpTUint16 );
+    TInt index;
+    TUint16 topicNumber( aNumber );
+    TInt result( iSimTopics->FindIsq( topicNumber, key, index ) );
+
+    CBSLOGSTRING2("CBSSERVER: CCbsReceiverHelper::DeleteFromSimTopicCache(): FindIsq() result: %d", result );
+    CBSLOGSTRING2("CBSSERVER: CCbsReceiverHelper::DeleteFromSimTopicCache(): FindIsq() result, position: %d", index );
+
+    // Delete the topic from the array
+    if ( result == KErrNone )
+        {
+        CBSLOGSTRING2("CBSSERVER: CCbsReceiverHelper::DeleteFromSimTopicCache(): Topic no. %d found from cache.", aNumber );
+        iSimTopics->Delete( index );
+        CBSLOGSTRING2("CBSSERVER: CCbsReceiverHelper::DeleteFromSimTopicCache(): Topic deleted from cache, index: %d", index );
+        iSimTopics->Compress();
+        CBSLOGSTRING("CBSSERVER: CCbsReceiverHelper::DeleteFromSimTopicCache(): SIM Topic array compressed.");
+        }
+
+    CBSLOGSTRING2("CBSSERVER: CCbsReceiverHelper::DeleteFromSimTopicCache(): Topic count in cache (2): %d", iSimTopics->Count() );
+    CBSLOGSTRING("CBSSERVER: <<< CCbsReceiverHelper::DeleteFromSimTopicCache()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsReceiverHelper::Database
+// Returns a reference to the CCbsDbImp instance.
+// If a topic of the same number already exists
+// in DB, does nothing.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CCbsDbImp& CCbsReceiverHelper::Database() const
+    {
+    return iDatabase;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsReceiverHelper::TopicsDetected
+// Returns the number of detected topics.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUint CCbsReceiverHelper::TopicsDetected() const
+    {
+    return iTopicsDetected;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsReceiverHelper::ClearTopicsDetectedCounter
+// Sets the counter for detected topics to zero.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsReceiverHelper::ClearTopicsDetectedCounter()
+    {
+    // Clear the variable indicating the amount of detected topics.
+    iTopicsDetected = 0;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsReceiverHelper::HandleTopicDetectedL
+// Handles detected topic.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCbsReceiverHelper::HandleTopicDetectedL(
+    const TCbsDbTopicNumber& iTopicNumber )
+    {
+    // Create new topic and initialise it.
+    TCbsDbTopic topic;
+    topic.iNumber = iTopicNumber;
+    topic.iName = KNullDesC;
+    topic.iProtected = EFalse;
+    topic.iSubscribed = EFalse;
+    topic.iHotmarked = EFalse;
+
+    TBool result( ETrue );
+
+    // Try to add the topic. If succeeded,
+    // increase counter iTopicsDetected.
+    TRAPD( error, iDatabase.TopicListL().AddTopicL( topic, ETrue ) );
+
+    if ( error == KErrAlreadyExists )
+        {
+        result = EFalse;
+        }
+    else if ( error != KErrNone && error != KErrAlreadyExists )
+        {
+        User::Leave( error );
+        }
+    else
+        {
+        // Update the detected topics counter
+        iTopicsDetected++;
+        }
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsReceiverHelper::HandleIndexMessageL
+// Processes an index message and builds a new topic collection
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsReceiverHelper::HandleIndexMessageL(
+    const TDesC& aContents,
+    const TBool aIsChildSubIndex )
+    {
+    // Previous topic identities are cleared if a root index message
+    // is received.
+    if ( !aIsChildSubIndex )
+        {
+        iDatabase.TopicCollectionL().Clear();
+        }
+    // Parses topic identities from the index message.
+    // The identities are stored in the current topic collection.
+    // If the index message is corrupt, it should still be stored,
+    // so trap the error.
+    TLex lex( aContents );
+    TRAPD( error, ParseMessageFormatL( lex, iDatabase.TopicCollectionL() ) );
+    switch ( error )
+        {
+        case KErrNone:
+            // If the message all went fine, apply.
+            // The topic identities are written into persistent memory.
+            iDatabase.TopicCollectionL().Apply();
+            break;
+
+        case KErrCorrupt:
+            // Do not react on corrupt messages.
+            break;
+
+        default:
+            // All other errors will prevent saving the message.
+            User::Leave( error );
+            break;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsReceiverHelper::ParseTopicIdentitiesL
+// Parses all topic identities from aText which is assumed to be
+// an index message's content.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsReceiverHelper::ParseTopicIdentitiesL(
+        const TDesC& aText )
+    {
+    // Create a lexer and pass it to the parser
+    TLex lex( aText );
+
+    ParseMessageFormatL( lex, iDatabase.TopicCollectionL() );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsReceiverHelper::LaunchMessageSoftNotificationL
+// Requests to launch a soft notification.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsReceiverHelper::LaunchMessageSoftNotificationL( const TBool aPlayTone )
+    {
+    TInt numberOfHotMsgs( 0 );
+    numberOfHotMsgs = iDatabase.TopicListL().UnreadHotmarkedMessageCount();
+
+    CAknSoftNotifier* notifier = CAknSoftNotifier::NewLC(); // on CS
+
+    TurnLightsOn();
+
+    if ( aPlayTone )
+        {
+        PlayCbsTone();
+        }
+
+    notifier->SetNotificationCountL( ECellBroadcastNotification, numberOfHotMsgs );
+    CleanupStack::PopAndDestroy( notifier );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsReceiverHelper::LaunchMessageImmediateDisplay
+// Requests to show the message immediately.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsReceiverHelper::LaunchMessageImmediateDisplay(
+    const TCbsDbMessage& aMessage )
+    {
+    TUid uiViewUid( TUid::Uid( ECbsUiMsgViewId ) );
+    TVwsViewId id( KUidCbsUiappApp, uiViewUid );
+    TPckgBuf<TCbsMessageHandle> pckg( aMessage.iHandle );
+
+    // Ignore result value.
+    iVwsSession->CreateActivateViewEvent( id, KCbsImmediateMessageId, pckg );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsReceiverHelper::TurnLightsOn
+// Turns lights on
+// -----------------------------------------------------------------------------
+//
+void CCbsReceiverHelper::TurnLightsOn()
+    {
+     // Change the bit on and off. SysAp will detect that
+     // the lights should be switched on for the specified time.
+     RProperty::Set(KPSUidCoreApplicationUIs, KLightsControl, ELightsOn);
+     RProperty::Set(KPSUidCoreApplicationUIs, KLightsControl, ELightsOff);
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsReceiverHelper::PlayCbsTone
+// Plays a tone
+// -----------------------------------------------------------------------------
+//
+void CCbsReceiverHelper::PlayCbsTone()
+    {
+    // <-- QT PHONE START -->
+    /*
+    RProperty::Define( KPSUidNcnList, KNcnPlayAlertTone, RProperty::EInt,
+        ECapability_None , ECapabilityWriteDeviceData );
+    RProperty::Set( KPSUidNcnList, KNcnPlayAlertTone, KCbsMessageTone );
+    */
+    // <-- QT PHONE END-->
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS ==============
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerSrc/CCbsSatRefresh.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,151 @@
+/*
+* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This module contains the implementation of CCbsSatRefresh
+*                class member functions.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CCbsSatRefresh.h"
+#include "CCbsServer.h"
+#include <rsatrefresh.h>
+#include <rsatsession.h>
+
+#include "CbsLogger.h"
+
+// Constants
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CCbsSatRefresh::CCbsSatRefresh
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCbsSatRefresh::CCbsSatRefresh( CCbsServer& aCbsServer ): 
+	iCbsServer ( aCbsServer )
+    {
+    CBSLOGSTRING( ">>> CBSSERVER: CCbsSatRefresh::CCbsSatRefresh" );
+    CBSLOGSTRING( "<<< CBSSERVER: CCbsSatRefresh::CCbsSatRefresh" );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSatRefresh::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCbsSatRefresh::ConstructL()
+    {
+    CBSLOGSTRING( ">>> CBSSERVER: CCbsSatRefresh::ConstructL" );
+    
+    iSatSession = new ( ELeave ) RSatSession;
+    iSatSession->ConnectL();
+    iSatRefresh = new ( ELeave ) RSatRefresh( *this );
+   	iSatRefresh->OpenL( *iSatSession );   	
+   	
+   	TSatRefreshFiles file;
+   	file.Append( KCbmiEf );
+   	iSatRefresh->NotifyFileChangeL( file );
+   	
+    CBSLOGSTRING( "<<< CBSSERVER: CCbsSatRefresh::ConstructL" );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSatRefresh::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCbsSatRefresh* CCbsSatRefresh::NewL( CCbsServer& aCbsServer )
+    {    
+    CCbsSatRefresh* self = new (ELeave) CCbsSatRefresh( aCbsServer );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+    
+// Destructor
+CCbsSatRefresh::~CCbsSatRefresh()
+    {
+    CBSLOGSTRING( ">>> CBSSERVER: CCbsSatRefresh::~CCbsSatRefresh" );
+    
+    if ( iSatRefresh )
+        {
+        // Cancel notifications.
+        iSatRefresh->Cancel();	
+        // Close SubSession.
+        iSatRefresh->Close();
+        }
+	delete iSatRefresh;
+	
+	if ( iSatSession )
+		{
+		iSatSession->Close();
+		}
+	delete iSatSession;
+	
+    CBSLOGSTRING( "<<< CBSSERVER: CCbsSatRefresh::~CCbsSatRefresh" );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSatRefresh::AllowRefresh
+// Refresh query. Determines whether it allow the refresh to happen. 
+// -----------------------------------------------------------------------------
+//
+TBool CCbsSatRefresh::AllowRefresh( TSatRefreshType aType, const TSatRefreshFiles& /*aFiles*/ )
+ 	{
+ 	// Refresh is always allowed
+    CBSLOGSTRING( ">>> CBSSERVER: CCbsSatRefresh::AllowRefresh()" );
+    CBSLOGSTRING2( "CBSSERVER: CCbsSatRefresh::AllowRefresh() Refresh type: %d", aType );
+    CBSLOGSTRING( "<<< CBSSERVER: CCbsSatRefresh::AllowRefresh complete, returning ETrue." );
+    
+    // To prevent ARMV5 compiler warnings
+    if ( aType )
+        {
+        aType = ERefreshTypeNotSet;
+        }
+	return ETrue;
+    }
+ 
+// -----------------------------------------------------------------------------
+// CCbsSatRefresh::Refresh
+// Notification of refresh. In this method the client should not close 
+// or cancel the RSatRefresh subsession. 
+// -----------------------------------------------------------------------------
+//     
+void CCbsSatRefresh::Refresh( TSatRefreshType aType, const TSatRefreshFiles& /*aFiles*/ )
+	{
+	// Reload SIM Topics in case of refresh     		
+    CBSLOGSTRING( ">>> CBSSERVER: CCbsSatRefresh::Refresh" );
+    CBSLOGSTRING2( "CBSSERVER: CCbsSatRefresh::Refresh Type: %d", aType );
+    
+    TRAP_IGNORE( iCbsServer.ReLoadSimTopicsL() );
+    
+    // Notify SAT Server that refresh initiated file read is done
+    iSatRefresh->RefreshEFRead( EFalse );
+    
+    // To prevent ARMV5 compiler warnings
+    if ( aType )
+        {
+        aType = ERefreshTypeNotSet;
+        }
+    
+    CBSLOGSTRING( "<<< CBSSERVER: CCbsSatRefresh::Refresh complete " );
+	}
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerSrc/CCbsScheduler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsScheduler class 
+*                member functions.   
+*
+*/
+
+
+//  INCLUDES
+#include "CbsServerPanic.h"
+#include "CCbsScheduler.h"
+#include "CCbsServer.h"
+ 
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCbsScheduler::CCbsScheduler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCbsScheduler::CCbsScheduler()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsScheduler::SetServer
+// Gives a pointer of the current CCbsServer instance to the scheduler.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsScheduler::SetServer( 
+    CCbsServer* aServer )
+    {
+    iServer = aServer;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsScheduler::Error
+// Overridden to handle leaves in request functions and unexpected situations.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsScheduler::Error( 
+    TInt aError ) const
+    {
+    // Server caused the error
+    if ( iServer->IsActive() )
+        {
+        __DEBUGGER();
+        }
+    else
+        {
+        // Panic the client.
+        if ( aError == KErrBadDescriptor )
+            {
+            iServer->PanicClient( KErrBadDescriptor );
+            }
+        // Otherwise relay the error code to the client and restart the server
+        iServer->ServerMessage().Complete( aError );
+        iServer->ReStart();
+        }    
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerSrc/CCbsServer.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,519 @@
+/*
+* Copyright (c) 2003-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsServer class 
+*                member functions.
+*   
+*                This file contains the entry point for CbsServer.exe/dll.  
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include <barsc.h>
+
+#include "CbsCommon.h"
+#include "CCbsScheduler.h"
+#include "CbsServerConstants.h"
+#include "CbsServerPanic.h"
+#include "CCbsServer.h"
+#include "CCbsSession.h"
+#include "CbsUtils.h"
+
+#include "CCbsRecEtel.h"
+#include "CCbsDbImp.H"
+
+#include "CCbsDbImp.H"
+#include "CCbsRecEtel.h"
+
+#include "CCbsDbImpSettings.H"
+#include "CCbsDbImpTopicList.h"
+#include "CCbsReceiverHelper.h"
+#include "CCbsSatRefresh.h"
+
+#include <e32property.h>
+#include "CbsServerInternalPSKeys.h"
+#include "CCbsShutdownMonitor.h"
+#include "CbsLogger.h"
+#include "CbsServerUid.h"
+
+
+// LOCAL FUNCTION PROTOTYPES
+LOCAL_C void InitServerL();
+
+// ==================== LOCAL FUNCTIONS ====================
+
+// -----------------------------------------------------------------------------
+// InitServerL
+// Initializes and starts CBS Server.
+// Creates the active scheduler and an instance of the server.
+// Returns: None
+// -----------------------------------------------------------------------------
+//
+LOCAL_C void InitServerL()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> InitServerL()");
+    // perform init code under the cleanup stack
+	User::RenameThread( KCbsServerName );
+    
+    // create server - if one of this name does not already exist
+    TFindServer findCbsServer( KCbsServerName );
+    TFullName pathName;
+
+    RMutex serverStartMutex;
+    TInt createErr( serverStartMutex.CreateGlobal( _L("CBSSERVERMTX") ) );
+    if ( createErr )
+        {
+        TInt openErr( serverStartMutex.OpenGlobal( _L("CBSSERVERMTX") ) );
+        User::LeaveIfError( openErr );
+        }
+    serverStartMutex.Wait();
+
+    if ( findCbsServer.Next( pathName ) != KErrNone ) 
+        {
+        // start scheduler and server
+        CCbsScheduler* scheduler = new (ELeave) CCbsScheduler;
+        CleanupStack::PushL( scheduler );
+        CActiveScheduler::Install( scheduler );
+
+        CCbsServer* server = CCbsServer::NewL();
+        CleanupStack::PushL( server );
+        
+        // The scheduler needs access to the server instance.
+        scheduler->SetServer( server );
+        
+        // Set the key using Publish & Subscribe
+        RProperty property;                       
+        _LIT_SECURITY_POLICY_PASS( KCbsServerReadPolicy );
+        _LIT_SECURITY_POLICY_S0( KCbsServerWritePolicy, KCbsServerUid3 );
+                
+        property.Define( KPSUidCellBroadcast, KCbsServerStarted, RProperty::EInt, KCbsServerReadPolicy, KCbsServerWritePolicy );
+        CBSLOGSTRING("CBSSERVER: InitServerL(): Property defined.");
+                
+        property.Set( KPSUidCellBroadcast, KCbsServerStarted, 1 );
+        CBSLOGSTRING("CBSSERVER: InitServerL(): Property set.");
+                
+        property.Close();
+
+        serverStartMutex.Signal();
+        serverStartMutex.Close();
+
+        CBSLOGSTRING("CBSSERVER: InitServerL(): CbsServer created ok, starting active schduler.");
+
+        RProcess::Rendezvous( KErrNone );
+        
+        // start fielding requests from clients
+        CActiveScheduler::Start();
+        CBSLOGSTRING("CBSSERVER: InitServerL(): CbsServer shutting down, destroying scheduler & server instances.");
+
+        // finished when the scheduler stops
+        CleanupStack::PopAndDestroy(2); // server, scheduler    
+        }
+    else
+        {
+        serverStartMutex.Signal();
+        serverStartMutex.Close();
+        }
+    CBSLOGSTRING("CBSSERVER: <<< InitServerL()");
+    }
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCbsServer::CCbsServer
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCbsServer::CCbsServer( 
+    TInt aPriority )
+    : CServer2( aPriority )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsServer::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCbsServer::ConstructL()
+    {
+    CBSLOGSTRING( "CBSSERVER: >>> CCbsServer::ConstructL()" );
+    // Use PubSub to monitor shutdown event
+    iShutdownMonitor = CCbsShutdownMonitor::NewL( *this );
+
+    iReceiver = CCbsRecEtel::NewL();
+
+    iDatabase = CCbsDbImp::NewL();
+
+    iHelper = CCbsReceiverHelper::NewL( *iDatabase );
+
+    iReceiver->SetInterface( iHelper );
+    InitReceiverL();
+    
+    // Create the container index.
+    iContainerIx = CObjectConIx::NewL();
+    iContainer = NewContainerL();
+    iIndex = CObjectIx::NewL();
+
+	// Create SAT refresh listener
+	TInt error( KErrNone );
+	TRAP( error, iSatRefresh = CCbsSatRefresh::NewL( *this ));
+    CBSLOGSTRING2( "CBSSERVER: CCbsServer::ConstructL(): CCbsSatRefresh::NewL error: %d", error );
+
+    // Start the server
+    if ( Start( KCbsServerName ) != KErrNone ) 
+        {
+        CbsServerPanic( ECbsServerStartFailed );
+        }
+
+    CBSLOGSTRING( "CBSSERVER: <<< CCbsServer::ConstructL()" );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsServer::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCbsServer* CCbsServer::NewL()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsServer::NewL()");
+    CCbsServer* self = new ( ELeave ) CCbsServer( KCbsServerPriority );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    CBSLOGSTRING("CBSSERVER: <<< CCbsServer::NewL()");
+    return self;
+    }
+
+    
+// Destructor
+CCbsServer::~CCbsServer()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsServer::~CCbsServer()");
+    // Note: it is important to delete in correct order
+    
+    // The correct order is: 
+    //        1st:    sessions, subsessions and other server related objects
+    //        2nd:    receiver 
+    //        3rd:    database
+
+    if ( iIndex )
+        {
+        delete iIndex; 
+        iIndex = NULL;        
+        }
+    
+    if ( iContainer )
+        {
+        if ( iContainerIx )
+            {
+            iContainerIx->Remove( iContainer );
+            iContainer = NULL;
+            }        
+        }
+
+    // Delete subsessions
+    if ( iContainerIx )
+        {
+        delete iContainerIx;
+        iContainerIx = NULL;
+        }    
+
+    if ( iSatRefresh )
+        {
+        delete iSatRefresh;
+        iSatRefresh = NULL;
+        }
+        
+    if ( iReceiver )
+        {
+        delete iReceiver;
+        iReceiver = NULL;
+        }	
+    
+    if ( iDatabase )
+        {
+        delete iDatabase;
+        iDatabase = NULL;
+        }
+        
+    if ( iHelper )
+        {
+        delete iHelper;
+        iHelper = NULL;
+        }
+           
+    if ( iShutdownMonitor )
+        {
+        delete iShutdownMonitor;
+        iShutdownMonitor = NULL;
+        }
+            
+    CBSLOGSTRING("CBSSERVER: <<< CCbsServer::~CCbsServer()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsServer::NewSessionL
+// Creates a new session (an instance of CCbsSession).
+//   
+// The method is meant to be called by the Symbian OS server framework and 
+// so it should not be used in any other case.
+//  
+// The method leaves if the version given as parameter and the server
+// version differ.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CSession2* CCbsServer::NewSessionL( 
+    const TVersion& aVersion,
+    const RMessage2& /*aMessage*/ ) const
+    {
+    TVersion currentVersion( KCbsServerVersionMajor,
+                             KCbsServerVersionMinor,
+                             KCbsServerVersionBuild );
+
+    // Check the client version
+    if ( !User::QueryVersionSupported( currentVersion, aVersion ) )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    // Create and return a new session
+    return CCbsSession::NewL( *( CCbsServer* ) this );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsServer::NewContainerL
+// Creates a new session object container.
+//  
+// It is the responsibility of the caller to delete the object 
+// container, when it is no longer used.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CObjectCon* CCbsServer::NewContainerL()
+    {
+    // Create the new container.
+    return iContainerIx->CreateL();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsServer::Database
+// Returns a reference to the database.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+CCbsDbImp& CCbsServer::Database()
+    {
+    return *iDatabase;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsServer::Receiver
+// Returns a reference to the receiver.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CCbsRecEtel& CCbsServer::Receiver()
+    {
+    return *iReceiver;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsServer::TotalTopicsDetected
+// Returns the total number of detected (via topic detection feature)
+// topics and then clears the counter.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//   
+TInt CCbsServer::TotalTopicsDetected()
+    {
+    TInt count( iHelper->TopicsDetected() );
+    iHelper->ClearTopicsDetectedCounter();
+    return count;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsServer::PanicClient
+// Panics the client.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+void CCbsServer::PanicClient( 
+    TInt aPanic ) const
+    {
+    __DEBUGGER();   // Debugger breakpoint in server's context.
+    Message().Panic( KCbsServerName, aPanic );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsServer::Shutdown
+// Shuts down the server.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+void CCbsServer::Shutdown()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsServer::Shutdown()");
+    Cancel();
+    CActiveScheduler::Stop();
+    CBSLOGSTRING("CBSSERVER: <<< CCbsServer::Shutdown()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsServer::ContainerIndex
+// Returns the container index.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+CObjectConIx& CCbsServer::ContainerIndex()
+    {
+    return *iContainerIx;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsServer::ServerMessage
+// Returns the current IPC message.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+const RMessage2 CCbsServer::ServerMessage() const
+    {
+    return Message();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsServer::ReturnObjectByHandle
+// Returns a subsession object matching the given handle.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CCbsObject* CCbsServer::ReturnObjectByHandle( 
+    TUint aHandle )
+    {
+    return ( CCbsObject* )iIndex->At( aHandle );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsServer::DeleteObjectByHandle
+// Deletes a subsession 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsServer::DeleteObjectByHandle( 
+    TUint aHandle )
+    {    
+    // Find object and then delete it
+    CCbsObject* object = ReturnObjectByHandle( aHandle );
+
+    if ( object )
+        {
+        // Remove from index (and it will delete the object)
+        iIndex->Remove( aHandle );
+        }
+    else
+        {
+        CbsServerPanic( EInvalidSessionObject );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsServer::Container
+// Returns the object container
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CObjectCon& CCbsServer::Container()
+    {
+    return *iContainer;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsServer::ObjectIx
+// Returns the object index
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CObjectIx& CCbsServer::ObjectIx()
+    {
+    return *iIndex;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsServer::InitReceiverL
+// Initializes the receiver with values retrieved from the database.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+void CCbsServer::InitReceiverL()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsServer::InitReceiverL()");
+    
+    // DB leave trapped.
+    TInt ignore( KErrNone );
+    TRAP( ignore, iReceiver->LoadSimTopicsL() );
+    CBSLOGSTRING2("CBSSERVER: CCbsServer::InitReceiverL(): LoadSimTopicsL() TRAPped error: %d", ignore);
+
+    iReceiver->ApplyStateChangesL();
+    
+    CBSLOGSTRING("CBSSERVER: <<< CCbsServer::InitReceiverL()");    
+    }
+    
+// -----------------------------------------------------------------------------
+// CCbsServer::ReLoadSimTopicsL
+// Initializes the receiver with values retrieved from the database.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+void CCbsServer::ReLoadSimTopicsL()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsServer::ReLoadSimTopicsL()");
+
+    TInt ignore( KErrNone );
+    
+    TRAP( ignore, iReceiver->LoadSimTopicsL() );
+    CBSLOGSTRING2("CBSSERVER: CCbsServer::ReLoadSimTopicsL(): LoadSimTopicsL() TRAPped error: %d", ignore);
+
+    iReceiver->ApplyStateChangesL();
+    
+    CBSLOGSTRING("CBSSERVER: <<< CCbsServer::ReLoadSimTopicsL()");    
+    }    
+
+// ================= OTHER EXPORTED FUNCTIONS ==============
+
+// -----------------------------------------------------------------------------
+// E32Main
+// E32Main implements the executable entry function.
+// Creates a cleanup stack and runs the server. 
+// Returns: Zero
+// -----------------------------------------------------------------------------
+//
+GLDEF_C TInt E32Main()
+    {
+    __UHEAP_MARK;
+    CTrapCleanup* cleanup = CTrapCleanup::New(); 
+
+    TRAPD( error, InitServerL() ); 
+
+    __ASSERT_ALWAYS( !error, User::Panic( KCbsServerName, error) );
+    delete cleanup; 
+    __UHEAP_MARKEND;
+    return 0; 
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerSrc/CCbsSession.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,506 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsSession class 
+*                member functions.
+*    
+*                This class represents a server-side session.
+*
+*                The instances of the class are responsible of handling 
+*                the requests of client-side RCbs and RCbsMcnSession objects.
+*
+*                This class contains handlers for opening subsessions and
+*                retrieving some general CBS information.
+*
+*                Client will be panicked, if a request is invalid. 
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CbsCommon.h"
+#include "CbsServerConstants.h"
+#include "CbsServerPanic.h"
+#include "CCbsServer.h"
+#include "CCbsSession.h"
+#include "CCbsObject.h"
+#include "CCbsRecEtel.h"
+#include "CCbsSettings.h"
+#include "CCbsTopicList.h"
+#include "CCbsTopicCollection.h"
+#include "CCbsTopicMessages.h"
+#include "CCbsMcnSession.h"
+
+#include "CCbsDbImp.H"
+#include "CbsLogger.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCbsSession::CCbsSession
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCbsSession::CCbsSession( 
+    CCbsServer& aServer )
+    : CSession2(), 
+    iCbsServer( aServer )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSession::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCbsSession::ConstructL()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsSession::ConstructL()");
+    CBSLOGSTRING("CBSSERVER: <<< CCbsSession::ConstructL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSession::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSession2* CCbsSession::NewL(     
+    CCbsServer& aServer )
+    {
+    CCbsSession* self = new ( ELeave ) CCbsSession( aServer );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+    
+// Destructor
+// Session destructor is called when the client-side session
+// object makes a Close()-call. There's no need to send
+// a "close session" request to the server.
+CCbsSession::~CCbsSession()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsSession::~CCbsSession()");    
+    CBSLOGSTRING("CBSSERVER: <<< CCbsSession::~CCbsSession()"); 
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSession::DispatchMessageL
+// Finds the appropriate message service method and calls it to 
+// handle the request. 
+// 
+// Relays a message to a proper message handling method. 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsSession::DispatchMessageL( 
+    const RMessage2& aMessage )
+    {
+    if ( !HandleSessionRequestsL( aMessage ) ) 
+        {
+        // The request was not for the session. Submit requests to 
+        // the correct subsessions.
+        CCbsObject* object = iCbsServer.ReturnObjectByHandle( aMessage.Int3() );
+
+        if ( object )
+            {
+            // Let the subsession to handle the request
+            if ( !object->HandleRequestsL( aMessage ) )
+                {
+                aMessage.Complete( KErrNotSupported );
+                }
+            }
+        else
+            {
+            PanicClient( ECbsBadRequest );
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSession::HandleSessionRequestsL
+// Handles the session-based requests.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCbsSession::HandleSessionRequestsL( 
+    const RMessage2& aMessage )
+    {
+    TBool result( ETrue );
+    TCbsServerRequest request( ( TCbsServerRequest ) aMessage.Function() );    
+
+    // Handle requests for the session.
+    switch ( request ) 
+        {
+        case EMcnCloseSession:
+            {
+            // Close the session
+            aMessage.Complete( KErrNone );
+            }            
+            break;
+
+        case ECbsCloseSession:
+            {
+            // Close the session
+            aMessage.Complete( KErrNone );                
+            }
+            break;
+                
+        case EMcnGetCellInfo:
+        case EMcnGetInfoMessage:
+            {
+            GetCurrentMcnInfoL();
+            }            
+            break;
+
+        case ECbsCreateSettingsSubsession:
+            {
+            NewSettingsL();                
+            }            
+            break;
+
+        case ECbsCreateTopicListSubsession:            
+            {
+            NewTopicListL();
+            }
+            
+            break;
+
+        case ECbsCreateTopicMessagesSubsession:            
+            {
+            NewTopicMessagesL();
+            }
+            break;
+
+        case ECbsCreateTopicCollectionSubsession:            
+            {
+            NewTopicCollectionL();
+            }                    
+            break;
+
+        case EMcnCreateSubsession:
+            {
+            NewMcnSubsessionL();
+            }            
+            break;
+           
+        case ECbsShutdown:        
+            {
+            iCbsServer.Shutdown();
+            aMessage.Complete( KErrNone );
+            }                                
+            break;        
+
+        default:
+            // The request was not for the session.
+            result = EFalse;
+        }
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSession::PanicClient
+// Panics the client.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsSession::PanicClient( 
+    TCbsSessionPanic aPanic ) const
+    {    
+    // Panic
+    iCurrentMessage.Panic( KCbsServerName, aPanic );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSession::TotalTopicsDetected
+// Returns the number of new topics detected. 
+// The counter will be reset after a call.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCbsSession::TotalTopicsDetected()
+    {
+    return iCbsServer.TotalTopicsDetected();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSession::Message
+// Returns the current message in process 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+RMessage2& CCbsSession::Message()
+    {
+    return iCurrentMessage;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSession::ServiceL
+// Handles the received message.
+// The method simply calls DispatchMessageL to process a
+// message and informs the client if the handling failed.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsSession::ServiceL( 
+    const RMessage2& aMessage )
+    {
+    iCurrentMessage = aMessage;
+
+    TRAPD( result, DispatchMessageL( aMessage ) );
+
+    if ( result != KErrNone )
+        {
+        // Inform the client
+        aMessage.Complete( result );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSession::NewSettingsL
+// Create a new subsession, settings, for the session.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+void CCbsSession::NewSettingsL()
+    {
+    // Create a new settings object
+    CCbsSettings* object = 
+        CCbsSettings::NewL( *this, iCbsServer.Database().SettingsL(), 
+            iCbsServer.Receiver() );
+    
+    // Add the object to the object container to generate unique id
+    iCbsServer.Container().AddL( object );
+
+    // Add object to object index; this returns a unique handle so 
+    // we can get it again
+    TInt handle( iCbsServer.ObjectIx().AddL( object ) );
+
+    // Write the handle to client
+    TPckg< TInt > handlePckg( handle );
+    TRAPD( result, iCurrentMessage.WriteL( 3, handlePckg ) );
+
+    if ( result != KErrNone )
+        {
+        // Writing failed, the client called the server in a wrong way
+        iCbsServer.ObjectIx().Remove( handle );
+        PanicClient( ECbsBadDescriptor );
+        }
+    else
+        {
+        Message().Complete( KErrNone );
+        }        
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSession::NewTopicListL
+// Create a new subsession, topic list, for the session.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+void CCbsSession::NewTopicListL()
+    {
+    // Create a new topic list object
+    CCbsTopicList* object = 
+        CCbsTopicList::NewL( *this, iCbsServer.Database().TopicListL(),
+            iCbsServer.Receiver() );
+
+    // Add the object to the object container to generate unique id
+    iCbsServer.Container().AddL( object );
+
+    // Add object to object index; this returns a unique handle 
+    // so we can get it again
+    TInt handle( iCbsServer.ObjectIx().AddL( object ) );
+
+    // Write the handle to client
+    TPckg< TInt > handlePckg2( handle );
+    TRAPD( result, iCurrentMessage.WriteL( 3, handlePckg2 ) );
+
+    if ( result != KErrNone )
+        {
+        // Writing failed, the client called the server in a wrong way
+        iCbsServer.ObjectIx().Remove( handle );
+        PanicClient( ECbsBadDescriptor );
+        }
+    else
+        {
+        Message().Complete( KErrNone );
+        }    
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSession::NewTopicCollectionL
+// Create a new subsession, topic collection, for the session.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+void CCbsSession::NewTopicCollectionL()
+    {
+    // Create a new topic list object
+    CCbsTopicCollection* object = 
+        CCbsTopicCollection::NewL( *this, 
+            iCbsServer.Database().TopicCollectionL(),
+            iCbsServer.Database().TopicListL() );
+
+    // Add the object to the object container to generate unique id
+    iCbsServer.Container().AddL( object );
+
+    // Add object to object index; this returns a unique handle 
+    // so we can get it again
+    TInt handle( iCbsServer.ObjectIx().AddL( object ) );    
+
+    // Write the handle to client
+    TPckg< TInt > handlePckg2( handle );
+    TRAPD( result, iCurrentMessage.WriteL( 3, handlePckg2 ) );
+
+    if ( result != KErrNone )
+        {
+        // Writing failed, the client called the server in a wrong way
+        iCbsServer.ObjectIx().Remove( handle );
+        PanicClient( ECbsBadDescriptor );
+        }
+    else
+        {
+        Message().Complete( KErrNone );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSession::NewTopicMessagesL
+// Create a new subsession, topic messages, for the session.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+void CCbsSession::NewTopicMessagesL()
+    {
+    // Create a new topic list object
+    CCbsTopicMessages* object = 
+        CCbsTopicMessages::NewL( *this, 
+            iCbsServer.Database().TopicMessagesL(),
+            iCbsServer.Receiver() );
+
+    // Add the object to the object container to generate unique id
+    iCbsServer.Container().AddL( object );
+
+    // Add object to object index; this returns a unique handle 
+    // so we can get it again
+    TInt handle( iCbsServer.ObjectIx().AddL( object ) );
+
+    // Write the handle to client
+    TPckg< TInt > handlePckg2( handle );
+    TRAPD( result, iCurrentMessage.WriteL( 3, handlePckg2 ) );
+
+    if ( result != KErrNone )
+        {
+        // Writing failed, the client called the server in a wrong way
+        iCbsServer.ObjectIx().Remove( handle );
+        PanicClient( ECbsBadDescriptor );
+        }
+    else
+        {
+        Message().Complete( KErrNone );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSession::NewMcnSubsessionL
+// Create a new MCN subsession.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+void CCbsSession::NewMcnSubsessionL()
+    {
+    // Create a new settings object
+    CCbsMcnSession* object = 
+        CCbsMcnSession::NewL( *this, iCbsServer.Receiver() );
+    
+    // Add the object to the object container to generate unique id
+    iCbsServer.Container().AddL( object );
+
+    // Add object to object index; this returns a unique handle so 
+    // we can get it again
+    TInt handle( iCbsServer.ObjectIx().AddL( object ) );
+
+    // Write the handle to client
+    TPckg< TInt > handlePckg( handle );
+    TRAPD( result, iCurrentMessage.WriteL( 3, handlePckg ) );
+
+    if ( result != KErrNone )
+        {
+        // Writing failed, the client called the server in a wrong way
+        iCbsServer.ObjectIx().Remove( handle );
+        PanicClient( ECbsBadDescriptor );
+        }   
+    else
+        {
+        Message().Complete( KErrNone );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSession::GetCurrentMcnInfoL
+// Return the current cell info message to the client.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+void CCbsSession::GetCurrentMcnInfoL()
+    {
+    TBuf<KCbsMcnMessageMaxLength> buf;    
+    
+    // First, read topic number from the client
+
+    TInt topicNumber( 0 );
+    topicNumber = iCurrentMessage.Int1();
+
+    TInt infoReceived( KErrNone );
+    if ( topicNumber == KCellInfoTopic )
+        {
+        infoReceived = iCbsServer.Receiver().GetCurrentMessage( buf, KCellInfoTopic );
+        }
+    else if ( topicNumber == KHomeZoneTopic )
+        {
+        infoReceived = iCbsServer.Receiver().GetCurrentMessage( buf, KHomeZoneTopic );
+        }
+    else
+        {
+        infoReceived = KErrNotSupported;
+        }
+
+    TRAPD( result, iCurrentMessage.WriteL( 0, buf ) );
+    
+    if ( result != KErrNone )
+        {
+        PanicClient( ECbsBadDescriptor );
+        }
+    else
+        {
+        Message().Complete( infoReceived );
+        }    
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSession::Server
+// Return the server instance
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+CCbsServer& CCbsSession::Server()
+    {
+    return iCbsServer;
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerSrc/CCbsSetFilterSettingHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,160 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsSetFilterSettingHandler 
+*                class member functions
+*
+*/
+
+
+//  INCLUDE FILES
+		/*****************************************************
+		*	Series 60 Customer / ETel
+		*	Series 60  ETel API
+		*****************************************************/
+#include <etelmm.h>
+#include <mmlist.h>
+#include "CCbsSetFilterSettingHandler.h"
+#include "CCbsRecEtel.h"
+#include "CCbsRecEtelMonitor.h"
+#include "CbsServerConstants.h"
+#include "CbsServerPanic.h"
+#include "CbsLogger.h"
+
+
+// ==================== LOCAL FUNCTIONS =====================================
+
+
+// ================= MEMBER FUNCTIONS =======================================
+
+// -----------------------------------------------------------------------------
+// CCbsSetFilterSettingHandler::CCbsSetFilterSettingHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCbsSetFilterSettingHandler::CCbsSetFilterSettingHandler( 
+    CCbsRecEtel& aEtel, 
+    MCbsEtelMessaging& aMessaging 
+    ) : CActive( EPriorityStandard ),
+    iEtel( aEtel ),
+    iSmsMessaging( aMessaging )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSetFilterSettingHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCbsSetFilterSettingHandler::ConstructL()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSetFilterSettingHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCbsSetFilterSettingHandler* CCbsSetFilterSettingHandler::NewL( 
+    CCbsRecEtel& aEtel, 
+    MCbsEtelMessaging& aMessaging )
+    {
+    CCbsSetFilterSettingHandler* self = 
+        new ( ELeave ) CCbsSetFilterSettingHandler( aEtel, aMessaging );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+    
+// Destructor
+CCbsSetFilterSettingHandler::~CCbsSetFilterSettingHandler()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsSetFilterSettingHandler::~CCbsSetFilterSettingHandler()"); 
+    Cancel();
+    CBSLOGSTRING("CBSSERVER: <<< CCbsSetFilterSettingHandler::~CCbsSetFilterSettingHandler()"); 
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSetFilterSettingHandler::SetFilterSetting
+// Requests ETel to change the filter setting.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+		/*****************************************************
+		*	Series 60 Customer / ETel
+		*	Series 60  ETel API
+		*****************************************************/
+void CCbsSetFilterSettingHandler::SetFilterSetting( 
+    RMobileBroadcastMessaging::TMobilePhoneBroadcastFilter aSetting )
+    {
+    if ( IsActive() )
+        {
+        Cancel();
+        }
+    iSmsMessaging.SetFilterSetting( iStatus, aSetting );
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSetFilterSettingHandler::RunL
+// Called after ETel has completed the SetFilterSetting request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsSetFilterSettingHandler::RunL()   
+    {
+    if ( iStatus != KErrNone )
+        {        
+        // Causes a call to RunError()
+        User::Leave( iStatus.Int() );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSetFilterSettingHandler::DoCancel
+// Cancels an outstanding SetFilterSetting request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsSetFilterSettingHandler::DoCancel()   
+    {
+    iSmsMessaging.SetFilterSettingCancel();
+    }
+    
+// -----------------------------------------------------------------------------
+// CCbsSetFilterSettingHandler::RunError
+// Is called if RunL() leaves.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//    
+TInt CCbsSetFilterSettingHandler::RunError( TInt aError )
+    {
+    CBSLOGSTRING2("CBSSERVER: >>> CCbsSetFilterSettingHandler::RunError(): Error code: %d", aError ); 
+    CBSLOGSTRING("CBSSERVER: <<< CCbsSetFilterSettingHandler::RunError(), returning KErrNone." );
+    
+    // To prevent ARMV5 compiler warnings
+    if ( aError )
+        {
+        aError = KErrNone;
+        }
+    return KErrNone; 
+    }
+
+
+// ================= OTHER EXPORTED FUNCTIONS ===============================
+
+
+//  End of File 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerSrc/CCbsSettings.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,426 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsSettings class 
+*                member functions. 
+*    
+*                The server-side CbsClient subsession for modifying settings.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "CbsCommon.h"
+#include "CbsServerPanic.h"
+#include "CbsServerConstants.h"
+#include "CCbsSettings.h"
+#include "CCbsDbImpSettings.H"
+#include "CCbsRecEtel.h"
+#include "CCbsServer.h"
+#include "CbsLogger.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCbsSettings::CCbsSettings
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCbsSettings::CCbsSettings( 
+    CCbsSession& aSession, 
+    CCbsDbImpSettings& aSettings, 
+    CCbsRecEtel& aReceiver )
+    : CCbsObject( aSession ), 
+    iSettings( aSettings ), 
+    iReceiver( aReceiver )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSettings::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCbsSettings::ConstructL()
+    {
+    // Add itself as an observer.
+    iSettings.AddObserverL( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSettings::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCbsSettings* CCbsSettings::NewL( 
+    CCbsSession& aSession, 
+    CCbsDbImpSettings& aSettings, 
+    CCbsRecEtel& aReceiver )
+    {
+    CCbsSettings* self = 
+        new ( ELeave ) CCbsSettings( aSession, aSettings, aReceiver );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();    
+    return self;
+    }
+
+// Destructor
+CCbsSettings::~CCbsSettings()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsSettings::~CCbsSettings()"); 
+    iSettings.RemoveObserver( this );
+    CBSLOGSTRING("CBSSERVER: <<< CCbsSettings::~CCbsSettings()"); 
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSettings::HandleRequestsL
+// Handles the requests for this subsession.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCbsSettings::HandleRequestsL( 
+    const RMessage2& aMessage )
+    {    
+    CBSLOGSTRING("CBSSERVER: >>> CCbsSettings::HandleRequestsL()");
+    
+    TBool requestHandled( ETrue );
+       
+    // Check needed capabilities    
+    TBool hasCapWrite( EFalse );
+    hasCapWrite = aMessage.HasCapability( ECapabilityWriteDeviceData );
+    
+    CBSLOGSTRING2("CBSSERVER: CCbsSettings::HandleRequestsL(), caps checked: %d", hasCapWrite );
+    
+    // Get the request
+    TInt function = aMessage.Function();
+    
+    // If caps are not ok, leave
+    if ( ( function == ECbsSetReceptionStatus || 
+        function == ECbsSetTopicDetectionStatus ||
+        function == ECbsSetLanguages ) &&
+        !hasCapWrite )
+        {
+        CBSLOGSTRING("CBSSERVER: CCbsSettings::HandleRequestsL(): Caps NOT OK, leaving with KErrPermissionDenied...");
+        User::Leave( KErrPermissionDenied );
+        }               
+        
+    // Handle the requests for the subsession
+    switch ( function )
+        {
+        case ECbsCloseSettingsSubsession:           
+            CloseSettings();
+            aMessage.Complete( KErrNone );
+            break;
+
+        case ECbsGetReceptionStatus:
+            GetReceptionStatusL();
+            break;
+
+        case ECbsSetReceptionStatus:            
+            SetReceptionStatusL();
+            break;
+
+        case ECbsGetTopicDetectionStatus:
+            GetTopicDetectionStatusL();
+            break;
+
+        case ECbsSetTopicDetectionStatus:
+            SetTopicDetectionStatusL();
+            break;
+
+        case ECbsGetLanguages:
+            GetLanguagesL();
+            break;
+
+        case ECbsSetLanguages:
+            SetLanguagesL();
+            break;
+
+        case ECbsNotifySettingsChanged:
+            NotifySettingsChanged();
+            break;
+
+        case ECbsNotifySettingsChangedCancel:            
+            NotifySettingsChangedCancel();
+            break;
+        default:
+            requestHandled = EFalse;
+            break;
+        }
+
+    CBSLOGSTRING2("CBSSERVER: <<< CCbsSettings::HandleRequestsL(), returning requestHandled: %d", requestHandled );
+    return requestHandled;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSettings::TopicDetectionStatusChangedIndL
+// Called when the topic detection is changed.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsSettings::TopicDetectionStatusChangedIndL()
+    {
+    // Notify the client in case there is a pending notification request.
+    NotifyClientL( ECbsModifiedTopicDetectionStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSettings::ReceptionStatusChangedIndL
+// Called when reception status is changed.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsSettings::ReceptionStatusChangedIndL()
+    {
+    // Notify the client in case there is a pending notification request.
+    NotifyClientL( ECbsModifiedReceptionStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSettings::LanguagesChangedIndL
+// Called when reception status is changed.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsSettings::LanguagesChangedIndL()
+    {
+    // Notify the client in case there is a pending notification request.
+    NotifyClientL( ECbsModifiedLanguages );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSettings::LimitedReceptionStatusChangedIndL
+// Called when reception status is changed.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsSettings::LimitedReceptionStatusChangedIndL()
+    {
+    // Notify the client in case there is a pending notification request.
+    NotifyClientL( ECbsModifiedLimitedReceptionStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSettings::CleanupTimeChangedIndL
+// Called when clean up time of read messages is changed.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsSettings::CleanupTimeChangedIndL()
+    {
+    // Notify the client in case there is a pending notification request.
+    NotifyClientL( ECbsModifiedCleanupTime );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSettings::CloseSettings
+// Close the subsession.
+// Note that the method will delete itself, so the object is no
+// longer valid after the call.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsSettings::CloseSettings()
+    {
+    // Removes the object.
+    Session().Server().DeleteObjectByHandle( Message().Int3() );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSettings::GetReceptionStatusL
+// Passes the reception status from the database to the client.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsSettings::GetReceptionStatusL()
+    {
+    // First, get the reception status from the database.
+    TBool receptionStatus( EFalse );
+    iSettings.GetReceptionStatus( receptionStatus );
+
+    // Write the reception status to the client side.
+    TPckgBuf< TBool > statusPckg( receptionStatus );
+    Message().WriteL( 0, statusPckg );
+
+    // Complete the request.
+    Message().Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSettings::SetReceptionStatusL
+// Change the reception status to the requested one.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsSettings::SetReceptionStatusL()
+    {
+    // Read the reception status from the client side and then
+    // change the current status to the requested one.
+    TPckgBuf< TBool > statusPckg( EFalse );
+    Message().ReadL( 0, statusPckg );
+
+    // Change the status.
+    TBool status( statusPckg() );
+    iSettings.SetReceptionStatusL( status );
+    iReceiver.ApplyStateChangesL();
+
+    // Complete the request.
+    Message().Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSettings::GetTopicDetectionStatusL
+// Return the current topic detection status to the client.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsSettings::GetTopicDetectionStatusL()
+    {
+    // First, get the topic detection status.
+    TBool topicDetectionStatus( EFalse );
+    iSettings.GetTopicDetectionStatus( topicDetectionStatus );
+
+    // Write the topic detection status to the client side.
+    TPckgBuf< TBool > statusPckg( topicDetectionStatus );
+    Message().WriteL( 0, statusPckg );
+
+    // Complete the request.
+    Message().Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSettings::SetTopicDetectionStatusL
+// Change the topic detection status to the requested one.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsSettings::SetTopicDetectionStatusL()
+    {
+    // Read the topic detection status from the client side and then
+    // change the current status to the requested one.
+    TPckgBuf< TBool > statusPckg( EFalse );
+    Message().ReadL( 0, statusPckg );
+ 
+    iSettings.SetTopicDetectionStatusL( statusPckg() );  
+    iReceiver.ApplyStateChangesL();
+
+    // Complete the request.
+    Message().Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSettings::GetLanguagesL
+// Return the preferred languages to the client.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsSettings::GetLanguagesL()
+    {
+    // Get the language settings.
+    TCbsDbLanguages language;
+    iSettings.GetLanguages( language );
+    
+    // Write the preferred languages to the client side.
+    TPckgBuf< TCbsSettingsLanguages > languagePckg( language );
+    Message().WriteL( 0, languagePckg );
+
+    // Complete the request.
+    Message().Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSettings::SetLanguagesL
+// Sets preferred languages.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsSettings::SetLanguagesL()
+    {
+    // Read the preferred languages from the client side and then
+    // change the current languages to the requested.
+    TPckgBuf< TCbsSettingsLanguages > languagePckg;
+    Message().ReadL( 0, languagePckg );
+
+    // Update db's language settings.
+    TCbsDbLanguages languages( languagePckg() );
+    iSettings.SetLanguagesL( languages );
+    
+    // Complete the request.
+    Message().Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSettings::NotifySettingsChanged
+// Make request to notify when settings are changed.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsSettings::NotifySettingsChanged()
+    {
+    // If there is already a pending request, cancel it.
+    if ( iIsMessage )
+        {
+        NotifySettingsChangedCancel();
+        }
+
+    // And then save the message.
+    iMessage = Message();
+    iIsMessage = ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSettings::NotifySettingsChangedCancel
+// Cancel the request to notify when settings are changed.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsSettings::NotifySettingsChangedCancel()
+    {               
+    if ( iIsMessage )
+        {
+        iMessage.Complete( KErrCancel );
+        }
+
+    iIsMessage = EFalse;
+    Message().Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsSettings::NotifyClientL
+// Notifies the client (if there is a pending request).
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsSettings::NotifyClientL( 
+    TCbsSettingsEvent aEvent )
+    {
+    // If there is a pending request, then process it.
+    if ( iIsMessage )
+        {
+        // Make a pointer descriptor
+        TPckg<TCbsSettingsEvent> eventPckg( aEvent );
+        iMessage.WriteL( 0, eventPckg );
+                
+        iMessage.Complete( KErrNone );
+        iIsMessage = EFalse;
+        }       
+    }
+
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+//  End of File  
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerSrc/CCbsShutdownMonitor.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,138 @@
+/*
+* 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:  This module contains the implementation of CCbsShutdownMonitor class 
+*                member functions.    
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32property.h>
+#include "CCbsShutdownMonitor.h"
+#include "CCbsServer.h"
+#include <startupdomainpskeys.h>
+#include "CbsLogger.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCbsShutdownMonitor::CCbsShutdownMonitor
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCbsShutdownMonitor::CCbsShutdownMonitor( CCbsServer& aServer )
+    : CActive( EPriorityStandard ),
+    iServer( aServer )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsShutdownMonitor::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCbsShutdownMonitor::ConstructL()
+    {
+    CActiveScheduler::Add( this );
+    
+    // Attach to startup property
+    iProperty.Attach( KPSUidStartup, KPSGlobalSystemState );    
+    IssueRequest();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsShutdownMonitor::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCbsShutdownMonitor* CCbsShutdownMonitor::NewL( CCbsServer& aServer )
+    {
+    CCbsShutdownMonitor* self = 
+        new ( ELeave ) CCbsShutdownMonitor( aServer );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+    
+// Destructor
+CCbsShutdownMonitor::~CCbsShutdownMonitor()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsShutdownMonitor::~CCbsShutdownMonitor()"); 
+    Cancel();
+	iProperty.Close();
+	CBSLOGSTRING("CBSSERVER: <<< CCbsShutdownMonitor::~CCbsShutdownMonitor()"); 
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsShutdownMonitor::IssueRequest
+// Requests that we are notified when the system state changes.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsShutdownMonitor::IssueRequest() 
+    {
+    if ( !IsActive() )
+        {
+        // Subscribe again
+    	iProperty.Subscribe( iStatus );
+	    SetActive();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsShutdownMonitor::RunL
+// Becomes active when the system state changes.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsShutdownMonitor::RunL()
+    {
+    if ( iStatus == KErrNone )
+        {
+        // Resubscribe before processing new value to prevent missing updates        
+        IssueRequest();
+        
+        // Property updated, get new value
+    	TInt state( 0 );
+    	TInt error( KErrNone );
+    	error = iProperty.Get( state );
+    	
+    	if ( !error )
+    	    {
+#ifdef RD_STARTUP_CHANGE
+        	if ( state == ESwStateShuttingDown )
+        		{
+        		iServer.Shutdown();
+        		}
+#endif   	    
+    	    }
+        }        
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsShutdownMonitor::DoCancel
+// Cancels an outstanding Subscribe request.  
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsShutdownMonitor::DoCancel()
+    {
+    iProperty.Cancel();   
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerSrc/CCbsTopicCollection.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,286 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsTopicCollection class 
+*                member functions. 
+* 
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "CbsCommon.h"
+#include "CCbsSession.h"
+#include "CCbsTopicCollection.h"
+#include "CCbsDbImpTopicCollection.h"
+#include "CCbsDbImpTopicList.h"
+#include "CbsServerConstants.h"
+#include "CCbsServer.h"
+#include "CbsLogger.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCbsTopicCollection::CCbsTopicCollection
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCbsTopicCollection::CCbsTopicCollection( 
+    CCbsSession& aSession, 
+    CCbsDbImpTopicCollection& aCollection, 
+    CCbsDbImpTopicList& aList )    
+    : CCbsObject( aSession ), 
+    iCollection( aCollection ), 
+    iTopicList ( aList )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicCollection::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicCollection::ConstructL()
+    {
+    iCollection.AddObserverL( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicCollection::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCbsTopicCollection* CCbsTopicCollection::NewL( 
+    CCbsSession& aSession, 
+    CCbsDbImpTopicCollection& aCollection,
+    CCbsDbImpTopicList& aList )
+    {
+    // Normal two phase construction.
+    CCbsTopicCollection* self = 
+        new ( ELeave ) CCbsTopicCollection( aSession, aCollection, aList );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// Destructor
+CCbsTopicCollection::~CCbsTopicCollection()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsTopicCollection::~CCbsTopicCollection()"); 
+    // Remove from the observers.
+    iCollection.RemoveObserver( this );
+    CBSLOGSTRING("CBSSERVER: <<< CCbsTopicCollection::~CCbsTopicCollection()");
+    }
+    
+// -----------------------------------------------------------------------------
+// CCbsTopicCollection::HandleRequestsL
+// Passes the requests to proper functions.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//    
+TBool CCbsTopicCollection::HandleRequestsL( 
+    const RMessage2& aMessage )
+    {    
+    CBSLOGSTRING("CBSSERVER: >>> CCbsTopicCollection::HandleRequestsL()");
+    
+    TBool requestHandled( ETrue );
+
+    // Handle the requests.
+    switch ( aMessage.Function() )
+        {
+        case ECbsCloseTopicCollectionSubsession:
+            CloseCollection();
+            aMessage.Complete( KErrNone );
+            break;
+
+        case ECbsGetTopicInfoCount:                 
+            GetTopicCountL();
+            break;
+
+        case ECbsGetTopicInfo:                      
+            GetTopicInfoL();
+            break;
+
+        case ECbsTopicInList:                       
+            TopicInListL();
+            break;
+
+        case ECbsNotifyOnChange:
+            NotifyOnChange();
+            break;
+    
+        case ECbsNotifyOnChangeCancel:
+            NotifyOnChangeCancel();
+            break;
+
+        default:
+            requestHandled = EFalse;
+            break;
+        }
+              
+    CBSLOGSTRING2("CBSSERVER: <<< CCbsTopicCollection::HandleRequestsL(), returning requestHandled: %d", requestHandled );    
+    return requestHandled;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicCollection::TopicCollectionContentsChangedInd
+// Called whenever topic collection contents are changed
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicCollection::TopicCollectionContentsChangedInd()
+    {
+    // Notify if necessary.
+    Notify();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicCollection::CloseCollection
+// Closes the subsession.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicCollection::CloseCollection()
+    {
+    // Removes the object.
+    Session().Server().DeleteObjectByHandle( Message().Int3() );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicCollection::GetTopicCountL
+// Writes the number of topics in the topic collection to the client.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicCollection::GetTopicCountL()
+    {
+    TInt count;
+    iCollection.GetTopicIdentityCount( count );
+    // Write the count to the client side.
+    TPckgBuf< TInt > pckg( count );
+    Message().WriteL( 0, pckg );
+
+    // Complete the request.
+    Message().Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicCollection::GetTopicInfoL
+// Writes the topic identity requested by the client to the client side. 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicCollection::GetTopicInfoL()
+    {
+    // Get the index from the client
+    TInt index( 0 );
+    index = Message().Int0();
+
+    TCbsTopicInfo info;
+    iCollection.GetTopicIdentityL( index, info );
+
+    // Write the count to the client side.
+    TPckgBuf< TCbsTopicInfo > pckg( info );
+    Message().WriteL( 1, pckg );
+
+    // Complete the request.
+    Message().Complete( KErrNone );
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicCollection::TopicInListL
+// Writes a truth value to the client determining the existence 
+// of a topic in the current topic list. 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicCollection::TopicInListL()
+    {
+    // Get the topic index from the client
+    TInt index( 0 );
+    index = Message().Int0();
+      
+    // Check if this topic exists in the topic list.
+    TCbsTopicInfo topicInfo;
+    iCollection.GetTopicIdentityL( index, topicInfo );
+
+    TBool inList( iTopicList.TopicIndexInList( topicInfo.iNumber ) >= 0 );
+
+    // Write the result back to the client.
+    TPckgBuf< TBool > pckg( inList );
+    Message().WriteL( 1, pckg );
+
+    // Complete the request.
+    Message().Complete( KErrNone );
+
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicCollection::NotifyOnChange
+// Sets up a notification so that the client will be notified when the 
+// collecton is changed. 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicCollection::NotifyOnChange()
+    {
+    // Just create a pending request.
+    if ( iIsMessage )
+        {
+        NotifyOnChangeCancel();
+        }
+
+    iIsMessage = ETrue;
+    iMessage = Message();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicCollection::NotifyOnChangeCancel
+// Cancels the pending request. 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicCollection::NotifyOnChangeCancel()
+    {
+    // Cancel the notification.
+    if ( iIsMessage )
+        {
+        iMessage.Complete( KErrCancel );
+        }
+
+    iIsMessage = EFalse;
+    Message().Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicCollection::Notify
+// Notifies the client. 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicCollection::Notify()
+    {
+    // Notify, if necessary
+    if ( iIsMessage ) 
+        {
+        iMessage.Complete( KErrNone );
+        }    
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS ==============
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerSrc/CCbsTopicList.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,697 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsTopicList class 
+*                member functions. 
+* 
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CbsCommon.h"
+#include "CbsServerConstants.h"
+#include "CCbsSession.h"
+#include "CCbsTopicList.h"
+
+#include "CCbsDbImpTopicList.h"
+#include "CCbsRecEtel.h"
+#include "CCbsServer.h"
+#include "CbsLogger.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCbsTopicList::CCbsTopicList
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCbsTopicList::CCbsTopicList( 
+    CCbsSession& aSession, 
+    CCbsDbImpTopicList& aTopicList, 
+    CCbsRecEtel& aReceiver )
+    : CCbsObject( aSession ), 
+    iTopicList( aTopicList ), 
+    iReceiver( aReceiver ), 
+    iIsMessage( EFalse )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicList::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicList::ConstructL()
+    {
+    iTopicList.AddObserverL( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicList::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCbsTopicList* CCbsTopicList::NewL( 
+    CCbsSession& aSession, 
+    CCbsDbImpTopicList& aTopicList, 
+    CCbsRecEtel& aReceiver )
+    {
+    CCbsTopicList* self = 
+            new ( ELeave ) CCbsTopicList( aSession, aTopicList, aReceiver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+   
+// Destructor
+CCbsTopicList::~CCbsTopicList()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsTopicList::~CCbsTopicList()");
+    iTopicList.RemoveObserver( this );
+    CBSLOGSTRING("CBSSERVER: <<< CCbsTopicList::~CCbsTopicList()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicList::HandleRequestsL
+// Handle the requests for the object. 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+TBool CCbsTopicList::HandleRequestsL( 
+    const RMessage2& aMessage )
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsTopicList::HandleRequestsL()");
+    
+    TBool requestHandled( ETrue );
+    
+    // Handle all requests for the subsession
+    switch ( aMessage.Function() )
+        {
+        case ECbsCloseTopicListSubsession:
+            CloseTopicList();
+            aMessage.Complete( KErrNone );
+            break;
+        case ECbsGetTopicCount:
+            GetTopicCountL();
+            break;
+    
+        case ECbsGetTopic:
+            GetTopicL();
+            break;
+        
+        case ECbsFindTopicByNumber:
+            FindTopicByNumberL();
+            break;
+
+        case ECbsGetNextAndPrevTopicNumber:
+            GetNextAndPrevTopicNumberL();
+            break;
+
+        case ECbsDeleteTopic:
+            DeleteTopicL();
+            break;
+
+        case ECbsChangeTopicNameAndNumber:
+            ChangeTopicNameAndNumberL();
+            break;
+
+        case ECbsChangeTopicSubscriptionStatus:
+            ChangeTopicSubscriptionStatusL();
+            break;
+
+        case ECbsChangeTopicHotmarkStatus:
+            ChangeTopicHotmarkStatusL();
+            break;
+
+        case ECbsAddTopic:
+            AddTopicL();
+            break;
+
+        case ECbsNotifyOnEvent:
+            NotifyOnEvent();
+            break;
+
+        case ECbsNotifyOnEventCancel:
+            NotifyOnEventCancel();
+            break;
+
+        case ECbsGetNewTopicsCount:
+            GetNewTopicsCountL();
+            break;
+
+        case ECbsGetLatestTopicNumber:
+            GetLatestTopicNumberL();
+            break;
+
+        case ECbsGetUnreadMessageCount:
+            GetUnreadMessageCountL();
+            break;
+
+        case ECbsGetHotmarkedMessageHandle:
+            GetHotmarkedMessageHandleL();
+            break;
+
+        case ECbsDeleteAll:        
+            DeleteAllL();
+            break;
+
+        case ECbsGetUnreadHotmarkedMessageCount:
+            GetUnreadHotmarkedMessageCountL();
+            break;
+        
+        default:
+            requestHandled = EFalse;
+            break;
+        }    
+
+    // Return truth value indicating whether it was possible 
+    // to handle the request or not.    
+    
+    CBSLOGSTRING2("CBSSERVER: <<< CCbsTopicList::HandleRequestsL(), returning requestHandled: %d", requestHandled );
+    
+    return requestHandled;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicList::TopicListInitializedIndL
+// Called when the topic list is initialized.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicList::TopicListInitializedIndL()
+    {
+    // Notification.
+    NotifyClientL( ECbsTopicListInitialized, 0 );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicList::TopicAddedIndL
+// Called whenever a topic is created. 
+// If necessary, the client will be notified.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicList::TopicAddedIndL( 
+    const TCbsDbTopicNumber& aNumber )
+    {
+    // Notification.
+    NotifyClientL( ECbsTopicAdded, aNumber );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicList::TopicDeletedIndL
+// Called whenever a topic is deleted.  
+// If necessary, the client will be notified.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicList::TopicDeletedIndL( 
+    const TCbsDbTopicNumber& aNumber )
+    {
+    // Notification.
+    NotifyClientL( ECbsTopicDeleted, aNumber );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicList::TopicModifiedIndL
+// Called whenever a topic is modified.  
+// If necessary, the client will be notified.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicList::TopicModifiedIndL( 
+    const TCbsDbTopicNumber& aNumber )
+    {
+    // Notification.
+    NotifyClientL( ECbsTopicModified, aNumber );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicList::TopicNewMessageReceivedIndL
+// Called whenever a new message has been received.   
+// If necessary, the client will be notified.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+void CCbsTopicList::TopicNewMessageReceivedIndL( 
+    const TCbsDbMessageHandle& aHandle )
+    {
+    TCbsTopicNumber topic( iTopicList.ExtractTopicNumber( aHandle ) );
+    NotifyClientL( ECbsTopicReceivedNewMessage, topic );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicList::CloseTopicList
+// Closes and destroys the subsession. 
+// Note that after the call has completed, the object is no longer
+// valid. It is also left for the callee's task to complete 
+// the request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicList::CloseTopicList()
+    {
+    // Removes the object.
+    Session().Server().DeleteObjectByHandle( Message().Int3() );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicList::GetTopicCountL
+// Returns the total number of topics to the client.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicList::GetTopicCountL()
+    {
+    // Write the topic count to the client side.
+    TInt count( 0 );
+    iTopicList.GetTopicCount( count );
+    TPckgBuf< TInt > pckg( count );
+
+    Message().WriteL( 0, pckg );
+
+    // Complete the request
+    Message().Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicList::GetTopicL
+// Returns the requested topic to the client.
+// Retrieves topic information with an index to topic list.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicList::GetTopicL()
+    {
+    // First, read the index from the client side
+    TInt topicIndex( 0 );
+    topicIndex = Message().Int0();
+
+    // Then read the topic from the topic list
+    TPckgBuf< TCbsTopic > pckgTopic;
+    TRAPD( errorCode, iTopicList.GetTopicL( topicIndex, pckgTopic() ) );
+
+    if ( errorCode == KErrNone )
+        {
+        // Finally, write the topic information to the client side
+        Message().WriteL( 1, pckgTopic );
+        }
+
+    // Complete the request.
+    Message().Complete( errorCode );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicList::FindTopicByNumberL
+// Finds a topic by number and returns it to the client.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicList::FindTopicByNumberL()
+    {
+    // First, read the number from the client side
+    TInt topicNumber( 0 );
+    topicNumber = Message().Int0();    
+    
+    // Find topic by handle
+    TPckgBuf< TCbsTopic > pckgTopic;
+    iTopicList.FindTopicByNumberL( static_cast<TUint16> ( topicNumber ), 
+        pckgTopic() );
+
+    // Finally, write the topic information to the client side
+    Message().WriteL( 1, pckgTopic );
+
+    // Complete the request.
+    Message().Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicList::DeleteTopicL
+// Deletes a topic by its number and returns it to the client.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicList::DeleteTopicL()
+    {
+    // First, read the handle from the client side    
+    TInt topicNumber( 0 );
+    topicNumber = Message().Int0();
+
+    // Delete the topic
+    iTopicList.DeleteTopicL( static_cast<TUint16> ( topicNumber ) );
+
+    iReceiver.DeleteSimTopicL( static_cast<TUint16> ( topicNumber ), EFalse );
+
+    iReceiver.ApplyStateChangesL();
+
+    // Complete the request
+    Message().Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicList::ChangeTopicNameAndNumberL
+// Changes a topic name and number.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicList::ChangeTopicNameAndNumberL()
+    {
+    TCbsDbTopicName name;
+    TInt oldNumber( 0 );
+    TInt newNumber( 0 );
+
+    oldNumber = Message().Int0();
+    newNumber = Message().Int1();
+    Message().ReadL( 2, name );
+
+    // First find the topic.
+    TCbsDbTopic topic;
+    iTopicList.FindTopicByNumberL( static_cast<TUint16> ( oldNumber ), topic );
+
+    // Then do the operations.
+    iTopicList.UpdateTopicNameAndNumberL( static_cast<TUint16> ( oldNumber ), 
+        static_cast<TUint16> ( newNumber ), name );
+
+    // Now we may need to change the subscriptions
+    if ( oldNumber != newNumber )
+        {
+        iReceiver.DeleteSimTopicL( static_cast<TUint16> ( oldNumber ), EFalse );
+        }
+
+    // Complete the request.
+    Message().Complete( KErrNone );
+    }
+        
+// -----------------------------------------------------------------------------
+// CCbsTopicList::ChangeTopicSubscriptionStatusL
+// Changes topic subscription status.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicList::ChangeTopicSubscriptionStatusL()
+    {
+    TInt topicNumber( 0 );
+    TPckgBuf< TBool > pckgStatus;
+    
+    topicNumber = Message().Int0();
+    Message().ReadL( 1, pckgStatus );
+
+    // First find the topic.
+    TCbsDbTopic topic;
+    iTopicList.FindTopicByNumberL( static_cast<TUint16> ( topicNumber ), topic );
+
+    // Then update.
+    iTopicList.UpdateTopicSubscriptionStatusL( static_cast<TUint16> ( topicNumber ), pckgStatus() );
+    iReceiver.ApplyStateChangesL();
+
+    // Complete the request.
+    Message().Complete( KErrNone );
+    }
+     
+// -----------------------------------------------------------------------------
+// CCbsTopicList::ChangeTopicHotmarkStatusL
+// Changes topic hotmark status.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicList::ChangeTopicHotmarkStatusL()
+    {
+    TPckgBuf< TBool > pckgStatus;
+    TInt topicNumber( 0 );
+    topicNumber = Message().Int0();
+    Message().ReadL( 1, pckgStatus );
+
+    // Then update
+    iTopicList.UpdateTopicHotmarkStatusL( static_cast<TUint16> ( topicNumber ), pckgStatus() );
+
+    // Complete the request.
+    Message().Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicList::AddTopicL
+// Adds a topic to the list.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicList::AddTopicL()
+    {
+    // First, get the topic information from the client side
+    TPckgBuf< TCbsTopic > pckgTopic;
+    Message().ReadL( 0, pckgTopic );
+
+    // It is not allowed to set protected.
+    if ( pckgTopic().iProtected )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    // Add the topic, not detected automatically
+    iTopicList.AddTopicL( pckgTopic(), EFalse );
+
+    // Load the default topic stream
+    iTopicList.LoadDefaultTopicStreamL();
+    
+    // Write updated data to the client side (only handle is updated)
+    Message().WriteL( 0, pckgTopic );
+    
+    // Complete the request
+    Message().Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicList::NotifyOnEvent
+// Sets up a pending notification request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicList::NotifyOnEvent()
+    {
+    if ( iIsMessage )
+        {
+        NotifyOnEventCancel();
+        }
+
+    iMessage = Message();
+    iIsMessage = ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicList::NotifyOnEventCancel
+// Cancels a pending notification request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicList::NotifyOnEventCancel()
+    {
+    // Cancel the pending notify request.
+    if ( iIsMessage )
+        {
+        iMessage.Complete( KErrCancel );
+        iIsMessage = EFalse;
+        }
+
+    // Complete the request.
+    Message().Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicList::GetNewTopicsCountL
+// Returns the number of "new" topics to the client.
+// By new it is referred to topics that are created because of 
+// topic detection since last power on.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicList::GetNewTopicsCountL()
+    {
+    TPckgBuf< TInt > pckg( Session().TotalTopicsDetected() );
+    Message().WriteL( 0, pckg );
+
+    // Complete the request
+    Message().Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicList::GetLatestTopicNumberL
+// Retrieves the number of the topic that was added
+// last to the topic list.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicList::GetLatestTopicNumberL()
+    {
+    TCbsTopicNumber number( 0 );
+    TInt result( iTopicList.GetLatestTopicNumber( number ) );
+    if ( result == KErrNone )
+        {
+        TPckgBuf<TCbsTopicNumber> pckg( number );
+        Message().WriteL( 0, pckg );
+        Message().Complete( KErrNone );
+        }
+    else
+        {
+        User::Leave( result );
+        }
+    }
+   
+// -----------------------------------------------------------------------------
+// CCbsTopicList::GetUnreadMessageCountL
+// Returns the total amount of unread messages.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+void CCbsTopicList::GetUnreadMessageCountL()
+    {
+    // Get unread message count from the database.
+    TPckgBuf<TInt> pckg( 0 );
+    iTopicList.GetUnreadMessageCount( pckg() );
+
+    Message().WriteL( 0, pckg );
+
+    // Complete the request.
+    Message().Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicList::GetHotmarkedMessageHandleL
+// Returns a handle to the latest (that is not yet taken) 
+// hotmarked message handle.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+void CCbsTopicList::GetHotmarkedMessageHandleL()
+    {
+    // Get the hotmarked message handle.
+    TCbsMessageHandle handle( 0 );
+    iTopicList.GetHotmarkedMessageHandleL( handle );
+
+    // And then write it to the client.
+    TPckgBuf< TCbsMessageHandle > pckg( handle );
+    Message().WriteL( 0, pckg );
+
+    // Complete the request.
+    Message().Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicList::GetUnreadHotmarkedMessageCountL
+// Returns the number of hotmarked, unread messages.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicList::GetUnreadHotmarkedMessageCountL()
+    {
+    TInt number( iTopicList.UnreadHotmarkedMessageCount() );
+    TPckgBuf<TInt> pckgNumber( number );
+    Message().WriteL( 0, pckgNumber );
+    Message().Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicList::DeleteAllL
+// Deletes all topics.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicList::DeleteAllL()
+    {
+    // Delete all topic from the SIM card
+    iReceiver.DeleteAllSimTopicsL();
+    
+    // Delete all topic from the server store
+    iTopicList.InitializeListL( EFalse );
+    iReceiver.ApplyStateChangesL();
+
+    Message().Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicList::NotifyClientL
+// If there is a pending notify request, notifies 
+// the client.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicList::NotifyClientL( 
+    TCbsTopicListEvent aEvent, 
+    TCbsTopicNumber aNumber )
+    {
+    // If there is a pending request, then process it.
+    if ( iIsMessage )
+        {
+        // First check if the client is interested of the topics.
+        TInt requested( iMessage.Int0() );
+        if ( ( requested & aEvent ) )
+            {
+            // The client is interested of the event, so notify the client.
+            // Make up a pointer descriptors.
+            TPtr8 eventPtr( reinterpret_cast<TText8*>(&aEvent),
+                    sizeof( TCbsTopicListEvent ),
+                    sizeof( TCbsTopicListEvent) );
+
+            TPtr8 numberPtr( reinterpret_cast<TText8*>(&aNumber),
+                    sizeof( TCbsTopicNumber ),
+                    sizeof( TCbsTopicNumber) );
+            // Write through the pointer descriptors.
+            iMessage.WriteL( 1, eventPtr );
+            iMessage.WriteL( 2, numberPtr );
+
+            iMessage.Complete( KErrNone );
+            iIsMessage = EFalse;
+            }        
+        }        
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicList::GetNextAndPrevTopicNumberL
+// Retrieves and returns the numbers of topics that
+// precede and succeed the given topic in topic list.
+// Also returns two flags indicating whether the
+// given topic is the first and/or the last topic in list.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicList::GetNextAndPrevTopicNumberL()
+    {
+    // Retrieve the requested topic number
+    TPckgBuf<TCbsTopicNumber> pckgCurrentTopic( 0 );
+    Message().ReadL( 0, pckgCurrentTopic );
+
+    // Determine requested information
+    TCbsTopicNumber nextTopic( 0 );
+    TCbsTopicNumber prevTopic( 0 );
+    TInt position( 0 );
+    iTopicList.GetNextAndPrevTopicNumberL(
+        pckgCurrentTopic(), nextTopic, prevTopic, position );
+
+    // Write results back
+    TPckgBuf<TCbsNextPrevTopicAndPosition> pckgResults;
+    pckgResults().iNextTopic = nextTopic;
+    pckgResults().iPrevTopic = prevTopic;
+    pckgResults().iPosition = position;
+    Message().WriteL( 1, pckgResults );
+
+    // Complete request
+    Message().Complete( KErrNone );
+    }
+
+
+// ================= OTHER EXPORTED FUNCTIONS ==============
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerSrc/CCbsTopicMessages.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,422 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsTopicMessages class 
+*                member functions. 
+* 
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include "CbsCommon.h"
+#include "CbsServerPanic.h"
+#include "CCbsTopicMessages.h"
+#include "CCbsSession.h"
+#include "CbsServerConstants.h"
+#include "CCbsDbImpTopicMessages.h"
+#include "CCbsServer.h"
+#include "CbsLogger.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCbsTopicMessages::CCbsTopicMessages
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCbsTopicMessages::CCbsTopicMessages( 
+    CCbsSession& aSession, 
+    CCbsDbImpTopicMessages& aMessages,
+    CCbsRecEtel& aReceiver )
+    : CCbsObject( aSession ), 
+    iMessages( aMessages ),     
+    iLocked( 0 ),
+    iReceiver( aReceiver )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCbsTopicMessages::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCbsTopicMessages* CCbsTopicMessages::NewL( 
+    CCbsSession& aSession, 
+    CCbsDbImpTopicMessages& aMessages,
+    CCbsRecEtel& aReceiver )
+    {
+    // Normal two phase construction
+    CCbsTopicMessages* self = 
+            new ( ELeave ) CCbsTopicMessages( aSession, aMessages, aReceiver );
+    return self;
+    }
+
+    
+// Destructor
+CCbsTopicMessages::~CCbsTopicMessages()    
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsTopicMessages::~CCbsTopicMessages()");
+    CBSLOGSTRING("CBSSERVER: <<< CCbsTopicMessages::~CCbsTopicMessages()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicMessages::HandleRequestsL
+// Handle the requests for the object.
+// Passes requests to proper functions
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCbsTopicMessages::HandleRequestsL( 
+    const RMessage2& aMessage )
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsTopicMessages::HandleRequestsL()");
+    TBool requestHandled ( ETrue );
+    // Handle the requests that are for the subsession.
+    switch ( aMessage.Function() )
+        {
+        case ECbsCloseTopicMessagesSubsession:                
+            CloseTopicMessages();
+            aMessage.Complete( KErrNone );
+            break;
+    
+        case ECbsGetMessageCount:                
+            GetMessageCountL();            
+            break;
+
+        case ECbsGetMessage:
+            GetMessageL();                
+            break;
+
+        case ECbsFindMessageByHandle:                               
+            FindMessageByHandleL();            
+            break;
+
+        case ECbsGetMessageIndexByHandle:                
+            GetMessageIndexByHandleL();            
+            break;
+
+        case ECbsGetNextAndPrevMsgHandle:                
+            GetNextAndPrevMsgHandleL();            
+            break;
+   
+        case ECbsDeleteMessage:                
+            DeleteMessageL( iReceiver );            
+            break;
+
+        case ECbsSaveMessage:                
+            SaveMessageL( iReceiver );            
+            break;
+
+        case ECbsLockMessage:            
+            LockMessageL();            
+            break;
+
+        case ECbsReadMessage:                
+            ReadMessageL( iReceiver );            
+            break;
+
+        case ECbsGetMessageContents:                
+            GetMessageContentsL();            
+            break;
+
+        default:
+            requestHandled = EFalse;
+            break;
+        }    
+    CBSLOGSTRING2("CBSSERVER: <<< CCbsTopicMessages::HandleRequestsL(), returning requestHandled: %d", requestHandled );   
+    return requestHandled;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicMessages::CloseTopicMessages
+// Closes the subsession.  
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicMessages::CloseTopicMessages()
+    {
+    // Removes the object.
+    Session().Server().DeleteObjectByHandle( Message().Int3() );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicMessages::GetMessageCountL
+// Returns the total amount of messages to the client.   
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicMessages::GetMessageCountL()
+    {
+    // First, get the handle from the client    
+    TInt topicNumber( 0 );
+    topicNumber = Message().Int0();
+
+    // Then, get the message count from the database.
+    TInt count( 0 );
+    iMessages.GetMessageCountL( static_cast<TUint16> ( topicNumber ), count );
+    
+    // Write the message count to the client side.
+    TPckgBuf< TInt > pckgCount( count );
+    Message().WriteL( 1, pckgCount );
+
+    // Complete the request.
+    Message().Complete( KErrNone );
+
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicMessages::GetMessageL
+// Returns the requested message to the client. 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicMessages::GetMessageL()
+    {  
+    // Read the parameters from the client side
+    TInt topicNumber( 0 );
+    TInt index( 0 );
+    topicNumber = Message().Int0();
+    index = Message().Int1();
+    
+    // Then get the message from database.
+    TPckgBuf< TCbsDbMessage > pckgMessage;
+    iMessages.GetMessageL( static_cast<TUint16> ( topicNumber ), index, pckgMessage() );
+
+    // And finally write the message information to the client side
+    Message().WriteL( 2, pckgMessage );
+
+    // And complete the request.
+    Message().Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicMessages::FindMessageByHandleL
+// Finds a message by its handle. 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicMessages::FindMessageByHandleL()
+    {
+    // Read the parameters from the client side.
+    TPckgBuf< TCbsMessageHandle > pckgHandle( 0 );
+    Message().ReadL( 0, pckgHandle );
+
+    // Find the message.
+    TPckgBuf< TCbsMessage > pckgMessage;
+    iMessages.FindMessageByHandleL( pckgHandle(), pckgMessage() );
+
+    // Write the result to the client side.
+    Message().WriteL( 1, pckgMessage );
+
+    // Complete the request.
+    Message().Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicMessages::GetMessageIndexByHandleL
+// Returns message index in topic by message handle.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicMessages::GetMessageIndexByHandleL()
+    {
+    TPckgBuf< TCbsMessageHandle > pckgHandle( 0 );
+    Message().ReadL( 0, pckgHandle );
+
+    TInt index( iMessages.FindMessagePositionByHandleL( pckgHandle() ) );
+
+    TPckgBuf< TInt > pckgIndex( index );
+    Message().WriteL( 1, pckgIndex );
+
+    Message().Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicMessages::DeleteMessageL
+// Deletes a message.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicMessages::DeleteMessageL( const CCbsRecEtel& aReceiver )
+    {
+    // Read the handle from the client side.
+    TPckgBuf< TCbsMessageHandle > pckgHandle( 0 );
+    Message().ReadL( 0, pckgHandle );
+
+    // And then try to delete the message.
+    iMessages.DeleteMessageL( pckgHandle(), aReceiver );
+
+    // Finally, complete the request.
+    Message().Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicMessages::SaveMessageL
+// Saves a message.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//   
+void CCbsTopicMessages::SaveMessageL( const CCbsRecEtel& aReceiver )
+    {
+    // Read the parameter from the client side.
+    TPckgBuf< TCbsMessageHandle > pckgHandle( 0 );
+    Message().ReadL( 0, pckgHandle );
+
+    // Save the message.
+    iMessages.SaveMessageL( pckgHandle(), aReceiver );
+
+    // Complete the request.
+    Message().Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicMessages::LockMessageL
+// Locks a message.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicMessages::LockMessageL()
+    {
+    // Read the parameter from the client side.
+    TPckgBuf< TCbsMessageHandle > pckgHandle( 0 );
+    Message().ReadL( 0, pckgHandle );
+
+    TCbsDbMessageHandle handle( pckgHandle() );
+
+    if ( handle != iLocked )
+        {
+        iMessages.LockMessageL( iLocked, handle );
+        iLocked = handle;
+        }
+
+    // Complete the request.
+    Message().Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicMessages::ReadMessageL
+// Reads a message.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicMessages::ReadMessageL( const CCbsRecEtel& aReceiver )
+    {
+    // Read parameter from the client side.
+    TPckgBuf< TCbsMessageHandle > pckgHandle( 0 );
+    Message().ReadL( 0, pckgHandle );
+
+    // Perform the operation.
+    iMessages.ReadMessageL( pckgHandle(), aReceiver );
+
+    // Complete the request.
+    Message().Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicMessages::GetMessageContentsL
+// Returns the content of the message to the client.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicMessages::GetMessageContentsL()
+    {
+    // Read the parameters from the client side.
+    TPckgBuf< TCbsMessageHandle > pckgHandle( 0 );
+    Message().ReadL( 0, pckgHandle );
+
+    TInt bufSize( 0 );
+    bufSize = Message().Int1();
+
+    TCbsDbMessage message;
+    iMessages.FindMessageByHandleL( pckgHandle(), message );
+    
+    if ( message.iLength != 0 )
+        {
+        // Message is not empty. 
+        // First allocate memory and then get the contents.
+        // Finally write data to client side.
+        TInt size ( ( message.iLength < bufSize ) ? 
+            message.iLength : bufSize );
+
+        // guaranteed to allocate n bytes, n >= size
+        HBufC* buffer = HBufC::NewLC( size );    // on CS
+
+        TPtr16 pointer( buffer->Des() );
+        pointer.Zero();
+
+        // Note: parameter 'size' required, since MaxLength 
+        // may be > bufSize
+        iMessages.GetMessageContentsL( pckgHandle(), pointer, size );
+
+#ifndef _DEBUG
+        Message().WriteL( 2, pointer );
+#else
+        TRAPD( result, Message().WriteL( 2, pointer ) );
+        if ( result != KErrNone )
+            {
+            RDebug::Print(_L("Server buffer length: %d, max: %d"), 
+                pointer.Length(), pointer.MaxLength());
+            __DEBUGGER();
+            User::Leave( result );
+            }
+        
+#endif
+        CleanupStack::PopAndDestroy(); // buffer
+        }
+
+    // Complete the request.
+    Message().Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsTopicMessages::GetNextAndPrevMsgHandleL
+// Retrieves and returns the handles of messages that
+// precede and succeed the given message in topic.
+// Also returns two flags indicating whether the
+// given message is the first and/or the last message in topic.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsTopicMessages::GetNextAndPrevMsgHandleL()
+    {
+    // Retrieve the requested topic number
+    TPckgBuf< TCbsMessageHandle > pckgCurrentMsg( 0 );
+    Message().ReadL( 0, pckgCurrentMsg );
+
+    // Determine requested information
+    TCbsMessageHandle nextMsg(0);
+    TCbsMessageHandle prevMsg(0);
+    TInt position(0);
+    iMessages.GetNextAndPrevMsgHandleL(
+        pckgCurrentMsg(), nextMsg, prevMsg, position);
+
+    // Write results back
+    TPckgBuf< TCbsNextPrevMsgAndPosition > pckgResults;
+    pckgResults().iPrevMsg = prevMsg;
+    pckgResults().iNextMsg = nextMsg;
+    pckgResults().iPosition = position;
+
+    Message().WriteL( 1, pckgResults );
+
+    // Complete request
+    Message().Complete( KErrNone );
+
+    }
+        
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerSrc/CbsServerPanic.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Contains a single function, CbsServerPanic(), which panics the 
+                 server displaying an error code.
+                 member functions.
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CbsServerConstants.h"
+#include "CbsServerPanic.h"
+
+// ==================== LOCAL FUNCTIONS ====================
+
+// -----------------------------------------------------------------------------
+// CbsServerPanic
+// Panics the server
+// Returns: None
+// -----------------------------------------------------------------------------
+//
+GLDEF_C void CbsServerPanic( 
+    TCbsServerPanic aPanic )
+    {
+    User::Panic( KCbsServerName, aPanic );
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerSrc/CbsStreamHelper.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 two helper functions for the database: 
+*                 read and write a boolean value into a stream.
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CbsStreamHelper.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CbsStreamHelper::ReadBoolL
+// Reads a boolen value from a stream.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CbsStreamHelper::ReadBoolL( 
+    RReadStream& aStream )
+    {
+    TInt8 integer;
+    aStream >> integer;
+
+    TBool result( ETrue );
+    switch ( integer )
+        {
+        case 0:
+            result = EFalse;
+            break;
+
+        case 1:
+            result = ETrue;
+            break;
+
+        default:
+            User::Leave( KErrCorrupt );
+            break;
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CbsStreamHelper::WriteBoolL
+// Writes a boolen value to a stream.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CbsStreamHelper::WriteBoolL( 
+    RWriteStream& aStream, 
+    TBool aBool )
+    {
+    TInt8 integer;
+    if ( aBool == EFalse ) 
+        {
+        integer = 0;
+        }
+    else 
+        {
+        integer = 1;
+        }
+    aStream << integer;
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerSrc/CbsUtils.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,211 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CbsUtils class 
+*                 member functions.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <f32file.h>
+#include <barsc.h>
+#include <bautils.h>
+#include <sysutil.h>            // FFS critical level check
+#include "CbsUtils.h"
+#include <hal.h>
+#include <centralrepository.h>
+#include <UiklafInternalCRKeys.h>
+#include <data_caging_path_literals.hrh> 
+#include "CbsLogger.h"
+
+
+// ================= CONSTANTS =======================
+
+const TInt KRamMemoryCriticalLevel = 1500000;   // KRAMLOWTHRESHOLD = 1500000
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+
+// -----------------------------------------------------------------------------
+// CbsUtils::FindAndOpenDefaultResourceFileLC
+// Searches and opens the DLL default resource file.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CbsUtils::FindAndOpenDefaultResourceFileLC(
+    RFs& aFs, 
+    RResourceFile& aResFile )
+    {
+    // default resource file path
+
+	_LIT(KDirAndFile,"z:CbsServer.rsc"); 
+
+	TParse* fp = new(ELeave) TParse(); 
+	fp->Set(KDirAndFile, &KDC_RESOURCE_FILES_DIR, NULL); 
+
+    static const TInt KDefResFileSignature = 4;
+
+    // Find the resource file
+    TFileName fileName( fp->FullName() ); 
+    BaflUtils::NearestLanguageFile( aFs, fileName );
+
+    // Open the resource file
+    aResFile.OpenL( aFs, fileName );
+    // Push close operation in tbe cleanup stack
+    CleanupClosePushL( aResFile );
+
+    aResFile.ConfirmSignatureL( KDefResFileSignature );
+
+	delete fp;
+    }
+
+// -----------------------------------------------------------------------------
+// CbsUtils::FFSCriticalLevelCheckL
+// Checks that there is space for writing data on FFS.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CbsUtils::FFSCriticalLevelCheckL( 
+    const TInt aBytesToWrite, 
+    RFs& aFs )
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CbsUtils::FFSCriticalLevelCheckL()");
+    
+    // Checks RAM memory critical level.
+    if (RamMemCriticalLevelCheckL( aBytesToWrite ))
+        {
+        User::Leave( KErrDiskFull );    // returns KErrDiskFull -> no changes to clients
+        }
+
+    // Checks RAM disk critical level
+    if ( SysUtil::FFSSpaceBelowCriticalLevelL( &aFs, aBytesToWrite ) )
+        {
+        User::Leave( KErrDiskFull );
+        }
+        
+    CBSLOGSTRING("CBSSERVER: <<< CbsUtils::FFSCriticalLevelCheckL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CbsUtils::RamMemCriticalLevelCheckL
+// Checks that there is space for allocating data in memory.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CbsUtils::RamMemCriticalLevelCheckL( 
+    const TInt aBytesToWrite)
+    {
+    
+    // Read the critical threahold RAM memory level from the repository.
+    TInt thresholdVal;
+    CRepository* repository = CRepository::NewLC( KCRUidUiklaf );
+    if (repository->Get( KUikOOMRamLowThreshold, thresholdVal ) != KErrNone)
+        {
+        thresholdVal = KRamMemoryCriticalLevel;
+        }
+    CleanupStack::PopAndDestroy( repository );
+
+    TInt freeMem = 0;
+    HAL::Get(HAL::EMemoryRAMFree, freeMem);
+    if ( freeMem > (thresholdVal + aBytesToWrite) )
+        {
+        return EFalse;
+        }
+  
+    return ETrue;
+    }
+// -----------------------------------------------------------------------------
+// CbsUtils::VolumeCriticalLevelCheckL
+// Leaves with KErrDiskFull if writing aBytesToWrite bytes 
+// to the RAM File System would reduce the free space on RAM 
+// under the critical level.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CbsUtils::VolumeCriticalLevelCheckL( 
+    const TDesC& aFileName, 
+    TInt aBytesToWrite, 
+    const RFs& aFs )
+    {
+    // Convert file name to a volume number
+    TInt volumeNumber;
+    aFs.CharToDrive( aFileName[0], volumeNumber );
+
+    // Find out if the volume has enough free space
+    TVolumeInfo volume;
+    User::LeaveIfError( aFs.Volume( volume, volumeNumber ) );
+    if ( volume.iFree < aBytesToWrite )
+        {
+        User::Leave( KErrDiskFull );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CbsUtils::ExistsL
+// Returns ETrue, if the file aFile exists.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CbsUtils::ExistsL( 
+    const RFs& aFs, 
+    const TDesC& aFile )
+    {
+    TParse filename;
+    aFs.Parse( aFile, filename );
+
+    TBool returnCode( EFalse );
+	TUint attributes;
+
+    TInt result( aFs.Att( filename.FullName(), attributes ) );
+    if ( result == KErrNone )
+        {
+        returnCode = ETrue;
+        }
+    else if ( result == KErrNotFound ) 
+        {
+        returnCode = EFalse;
+        }
+    else 
+        {
+        User::Leave( result );
+        }
+    return returnCode;  
+    }
+
+// -----------------------------------------------------------------------------
+// CbsUtils::DeleteFileL
+// Deletes the given file.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CbsUtils::DeleteFileL( 
+    RFs& aFs, 
+    const TDesC& aFile )
+    {
+    TInt result( aFs.Delete( aFile ) );
+    if ( result != KErrNone && 
+        result != KErrNotFound && 
+        result != KErrPathNotFound )
+        {
+        User::Leave( result );
+        }
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerSrc/Ccbsreccollector.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,584 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsRecDecoder class 
+*                member functions.
+*    
+*                This class represents a collector, which stores pages of multipaged 
+*                messages. Complete messages are assembled and returned back to 
+*                the caller of CollectL() method.
+*  
+*                CCbsRecCollector stores message pages in a number of dynamic arrays.
+*                If all but one page of a message are present in collector, and
+*                the remaining page is received, the pages will be assembled and
+*                the corresponding message chain deleted.
+* 
+*                The maximum number of incomplete messages stored in collector at once
+*                is fixed and determined by KMaxCollectorMessages in CCbsRecCollector.cpp.
+* 
+*                CCbsRecCollector implements a circular list to contain message.
+*                Each incomplete message occupies a slot in this list. If the list already
+*                contains KMaxCollectorMessages messages, the next received multipaged
+*                message will delete all received pages of the oldest message in list.
+* 
+*                On receival of a message page, the collector compares network information
+*                (PLMN, LAC, CellId) of both messages to decide whether pages are of
+*                the same message. In short, for pages to be of the same message
+*                their network information have to meet the requirements set by the 
+*                geographical scope of the already collected page.
+*                See ETSI GSM 03.41 for a detailed description. 
+*
+*/
+
+
+// INCLUDE FILES
+#include "CbsServerPanic.h"
+#include "CCbsRecCollector.h"
+#include "CCbsRecMessage.h"
+#include "CCbsMessageFactory.h"
+#include "CCbsMessageCleanUpTimer.h"
+#include "CbsLogger.h"
+
+// CONSTANTS
+
+// Maximum number of pages in a single CB message.
+const TInt KMaxMessagePages = 15;
+
+// Maximum number of partial messages contained in the collector list.
+const TInt KMaxCollectorMessages = 10;
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCbsRecCollector::CCbsRecCollector
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCbsRecCollector::CCbsRecCollector( CCbsMessageFactory& aFactory )
+    : iRootNodeIterator( 0 ),
+    iFactory( aFactory )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecCollector::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCbsRecCollector::ConstructL()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsRecCollector::ConstructL()");
+
+    // initialize the root node array
+    iRootNodeArray = new ( ELeave ) CArrayPtrFlat< CMessageBuffer >
+        ( KMaxCollectorMessages );
+    iRootNodeArray->SetReserveL( KMaxCollectorMessages );
+    iMessageCleanupTimerArray = new ( ELeave ) CArrayPtrFlat< CCbsMessageCleanupTimer >
+        ( KMaxCollectorMessages );
+
+    for ( TInt i( 0 ); i < KMaxCollectorMessages; i++)
+        {
+        CMessageBuffer* array = new ( ELeave )
+            CMessageBuffer( KMaxMessagePages );
+        CleanupStack::PushL( array );
+        iRootNodeArray->AppendL( array );
+
+		CCbsMessageCleanupTimer* messageCleanUpTimer = CCbsMessageCleanupTimer::NewL( *this, *array );
+		iMessageCleanupTimerArray->AppendL( messageCleanUpTimer );
+        
+        CleanupStack::Pop(); // array
+        }
+    CBSLOGSTRING("CBSSERVER: <<< CCbsRecCollector::ConstructL()");
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCbsRecCollector::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+ CCbsRecCollector* CCbsRecCollector::NewL( CCbsMessageFactory& aFactory )
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsRecCollector::NewL()");
+
+    CCbsRecCollector* self = new ( ELeave ) CCbsRecCollector( aFactory );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    CBSLOGSTRING("CBSSERVER: <<< CCbsRecCollector::NewL()");
+    return self;
+    }
+    
+// Destructor
+CCbsRecCollector::~CCbsRecCollector()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsRecCollector::~CCbsRecCollector()");
+
+    if ( iRootNodeArray )
+        {
+        TInt rootArrayLength( iRootNodeArray->Count() );
+        for ( TInt i( 0 ); i < rootArrayLength; i++ )
+            {
+            iRootNodeArray->At( i )->ResetAndDestroy();
+            }
+        iRootNodeArray->ResetAndDestroy();
+        delete iRootNodeArray;
+        }
+
+    if ( iMessageCleanupTimerArray )
+        {
+        iMessageCleanupTimerArray->ResetAndDestroy();
+        delete iMessageCleanupTimerArray;
+        }
+
+    CBSLOGSTRING("CBSSERVER: <<< CCbsRecCollector::~CCbsRecCollector()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecCollector::CollectL
+// Adds a message to the location pointed by iRootNodeIterator.
+//   
+// Checks if all pages of message are present. If all pages
+// are present, sets aCompleted to ECbsMessageComplete,
+// combines message pages into a single message, destroys
+// pages from the list and returns the complete message
+// to caller in aMessage.
+
+// Algorithm:
+//   1.  Check if other pages of this message exist in list.
+//       (serial number and message identifier match)
+//   2.  True: Check if the other messages in chain need
+//       to be deleted. This is based on geographical scope
+//       and network information.
+//       Add this message to the correct message chain.
+//       False: Add this message to the chain pointed
+//       by the iRootNodeIterator.
+//   3.  Seek out the position in the chosed message chain so that
+//       the page number sequence remains ordered (1, 2, .., n)
+//   4.  Add the page to the correct position in chain.
+//   5.  Check if all pages of this message exist (number count).
+//   6.  True: Combine message pages into a single message
+//       and return this page to the caller. Set aCompleted
+//       to ECbsMessageComplete.
+//       False: Set aCompleted to ECbsMessageIncomplete.
+//
+// Note: Ownership of aMessage assumed. aMessage assumed to be
+// on cleanup stack.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+CCbsMessage* CCbsRecCollector::CollectL( 
+    CCbsMessage* aMessage, TInt aMessageType )  
+    {
+	CBSLOGSTRING("CBSSERVER: >>> CCbsRecCollector::CollectL()");
+
+    // 1.
+    CMessageBuffer* array = FindChainContainingPage( *aMessage );
+    CCbsMessage* mergedMessage = NULL;
+
+    if ( array  ) 
+        {		
+        CBSLOGSTRING("CBSSERVER: CCbsRecCollector::CollectL(): array != NULL");
+
+        // 2. (True), 3.
+        __ASSERT_DEBUG( array->Count() > 0, 
+            CbsServerPanic( ECbsCollectorArrayEmpty ) );
+
+        // Check geographical scope and network info to decide whether
+        // existing pages in this chain should be deleted.
+        TBool preserveExistingPages( 
+            CheckPageAreaInfoMatch( *aMessage, *array->At( 0 ) ) );
+		
+        CBSLOGSTRING2("CBSSERVER: CCbsRecCollector::CollectL(): preserveExistingPages: %d", preserveExistingPages );
+
+        if ( preserveExistingPages ) 
+            {			
+            CBSLOGSTRING("CBSSERVER: CCbsRecCollector::CollectL(): Adding msg to chain...");
+            // aMessage is deleted, if it is a duplicate.
+            AddMessageToChainL( aMessage, *array );			
+            CBSLOGSTRING("CBSSERVER: CCbsRecCollector::CollectL(): Adding msg to chain OK.");
+            }
+        else 
+            {			
+            CBSLOGSTRING("CBSSERVER: CCbsRecCollector::CollectL(): Deleting chain...");
+            DeleteChainL( *array );			
+            CBSLOGSTRING("CBSSERVER: CCbsRecCollector::CollectL(): Deleting chain OK.");
+            array->InsertL( 0, aMessage );			
+            CBSLOGSTRING("CBSSERVER: CCbsRecCollector::CollectL(): Msg added to array.");
+            }
+        // aMessage, ownership transferred to msg chain or
+        // aMessage has been deleted by AddMessageToChainL
+        CleanupStack::Pop(); 
+
+        // 5. Check if this chain contains all pages of the message.
+        if ( AllPagesPresent( *array ) )
+            {			
+            CBSLOGSTRING("CBSSERVER: CCbsRecCollector::CollectL(): All pages present, merging...");
+
+            // 6. merge creates a new copy of this message
+            // leaves a pointer to msg to cleanup stack
+            mergedMessage = MergePagesLC( *array ); // on CS			
+            CBSLOGSTRING("CBSSERVER: CCbsRecCollector::CollectL(): Merging OK.");
+
+			// we stop timer if its livecast message
+			if ( aMessageType == ECbsMessageLivecast )
+				{				
+                CBSLOGSTRING("CBSSERVER: CCbsRecCollector::CollectL(): Msg type == ECbsMessageLivecast, stopping timer.");
+
+				TKeyArrayFix key(0, ECmpTUint16);
+				TInt index;
+				iRootNodeArray->Find( array, key, index);
+				iMessageCleanupTimerArray->At( index )->StopTimer();
+                
+                CBSLOGSTRING("CBSSERVER: CCbsRecCollector::CollectL(): Timer stopped.");
+				}
+
+			CBSLOGSTRING("CBSSERVER: CCbsRecCollector::CollectL(): Deleting chain...");
+            DeleteChainL( *array );
+			CBSLOGSTRING("CBSSERVER: CCbsRecCollector::CollectL(): Deleting chain OK.");
+
+            CleanupStack::Pop(); // mergedMessage
+            }
+        }
+    else
+        {		
+        CBSLOGSTRING("CBSSERVER: CCbsRecCollector::CollectL(): array == NULL");
+
+		// if message pagenumber does not start from 1, its not inserted to chain.
+		if ( aMessage->ThisPage () == 1 ) 
+			{			
+            CBSLOGSTRING("CBSSERVER: CCbsRecCollector::CollectL(): aMessage->ThisPage () == 1");
+
+			// 2. (False)
+			// add this page as the first node in chain pointed by 
+			// iRootNodeIterator. Delete any pages contained in the chain
+			// occuping this location first.
+			array = iRootNodeArray->At( iRootNodeIterator );
+			DeleteChainL( *array );
+			array->InsertL( 0, aMessage );
+			CleanupStack::Pop(); // aMessage, ownership transferred to msg chain.
+			iRootNodeIterator++;
+			// Return to the first message, if passed the
+			// maximum messages.
+			iRootNodeIterator %= KMaxCollectorMessages;
+
+			if ( aMessageType == ECbsMessageLivecast )
+				{				
+                CBSLOGSTRING("CBSSERVER: CCbsRecCollector::CollectL(): aMessageType == ECbsMessageLivecast");
+
+				// start timeout timer for livecast message
+				TKeyArrayFix key(0, ECmpTUint16);
+				TInt index;
+				iRootNodeArray->Find( array, key, index);
+				iMessageCleanupTimerArray->At( index )->StartTimer();
+				
+                CBSLOGSTRING("CBSSERVER: CCbsRecCollector::CollectL(): Timer started.");
+				}
+			}
+		else
+			{			
+            CBSLOGSTRING("CBSSERVER: CCbsRecCollector::CollectL(): CleanupStack::Pop()");
+			CleanupStack::Pop();
+			}
+        }
+    // mergedMessage == NULL if msg not completed,
+    // otherwise return the complete message
+	CBSLOGSTRING("CBSSERVER: <<< CCbsRecCollector::CollectL(), returning mergedMessage.");
+
+    return mergedMessage;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecCollector::DeleteChainL
+// Deletes all message pages contained in aArray.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+void CCbsRecCollector::DeleteChainL( 
+    CMessageBuffer& aArray ) const
+    {
+    aArray.ResetAndDestroy();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecCollector::AllPagesPresent
+// Returns ETrue if all pages of the message of aArray are present.
+// Counts pages in message chain aArray and compares the result
+// against the total number of pages in the message.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+TBool CCbsRecCollector::AllPagesPresent( 
+    const CMessageBuffer& aArray ) const
+    {
+    TBool result( ETrue );
+    if ( TUint( aArray.Count() ) < aArray.At( 0 )->TotalPages() )
+        {
+        result = EFalse;        
+        }
+    
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecCollector::MergePagesLC
+// Returns a complete message in aMessage.
+// Merges all pages in message chain aArray and returns
+// a pointer to the resulting assembled message. The pointer
+// is also left on the cleanup stack.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CCbsMessage* CCbsRecCollector::MergePagesLC( 
+    CMessageBuffer& aArray ) const
+    {
+    if ( aArray.Count() <= 0 )
+        {
+        User::Leave( KErrNotFound );
+        }
+    // Create a new message based on first message page in the chain.
+    CCbsMessage* message = iFactory.CreateMessageL( *aArray.At( 0 ) );
+
+    CleanupStack::PushL( message ); // left on cleanup stack
+
+    // Traverse through the chain and merge contents.
+    TInt length( 0 );
+    TInt count( aArray.Count() );
+
+    // If this is a Livecast message, use the 8-bit representation
+    // (message not decoded).
+    if ( message->IsLivecastMessage() )
+        {
+        for ( TInt j( 0 ); j < count; j++ )
+            {
+            length += aArray.At( j )->Contents8().Length();
+            }
+        
+        __ASSERT_DEBUG( length >= 0, CbsServerPanic( ECbsCollectorMergeFailed ) );
+
+        message->ReserveContentSize8L( length );
+        count = aArray.Count();
+        
+        for ( TInt i( 1 ); i < count; i++ ) 
+            {
+            message->AppendContent8( aArray.At( i )->Contents8() );
+            }
+        }
+    // Else use the 16-bit representation (message already decoded)
+    else
+        {
+        for ( TInt j( 0 ); j < count; j++ )
+            {
+            length += aArray.At( j )->Contents().Length();
+            }
+    
+	    __ASSERT_DEBUG( length >= 0, CbsServerPanic( ECbsCollectorMergeFailed ) );
+
+	    message->ReserveContentSizeL( length );
+	    count = aArray.Count();
+
+    // Append the rest of the pages (first page handled earlier)
+	    for ( TInt i( 1 ); i < count; i++ ) 
+	        {
+	        message->AppendContent( aArray.At( i )->Contents() );
+	        }
+        }
+    return message;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecCollector::FindChainContainingPage
+// Returns the buffer containing pages of same message.
+// Finds and returns a message chain which already contains pages
+// of aMessage's message. If none is found, NULL is returned.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CMessageBuffer* CCbsRecCollector::FindChainContainingPage( 
+    const CCbsMessage& aMessage ) const
+    {
+    TBool quitSeek( EFalse );
+    TInt seekIterator( 0 );
+    TCbsDbMessageKey key( aMessage.Key() );
+    TCbsDbTopicNumber topicNumber( aMessage.TopicNumber() );
+    CMessageBuffer* array = NULL;
+    
+    // find out if the root array contains pages of this message
+    while ( ( seekIterator < KMaxCollectorMessages ) && !quitSeek  )
+        {
+        array = iRootNodeArray->At( seekIterator );
+        if ( array->Count() > 0 ) 
+            {
+            CCbsMessage* msg = array->At( 0 );
+            if ( key == msg->Key() && topicNumber == msg->TopicNumber() )
+                {
+                quitSeek = ETrue;
+                }
+            }
+        seekIterator++;
+        }
+
+    if ( !quitSeek )
+        {
+        array = NULL;
+        }
+    
+    return array;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecCollector::AddMessageToChainL
+// Adds message page aMessage to the correct position in message chain aArray
+//        
+// Message chains are ordered in ascending page number order.
+// Duplicate pages are not accepted.
+//
+// Ownership of aMessage is transferred to aArray, if the given page
+// hasn't been already collected. The given page will be deleted,
+// if it already exists in the chain.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsRecCollector::AddMessageToChainL( 
+    CCbsMessage* aMessage, 
+    CMessageBuffer& aArray ) const
+    {
+    // Find out a position for this page in the chain.
+    TInt chainLength( aArray.Count() );    
+    TInt insertPosition( -1 );
+    TBool duplicate( EFalse );
+
+    for ( TInt i( 0 ); ( i < chainLength ) && !duplicate; i++ )
+        {
+        CCbsMessage* msg = aArray.At( i );
+        if ( insertPosition == -1 && msg->ThisPage() > aMessage->ThisPage() )
+            {
+            insertPosition = i;
+            }
+        else if ( msg->ThisPage() == aMessage->ThisPage() )
+            {
+            duplicate = ETrue; // This page has been already collected
+            delete aMessage;
+            }
+        }
+
+    // If this message was not a duplicate, add it to the chain
+    if ( !duplicate )
+        {
+        if ( insertPosition == -1 )
+            {
+            aArray.AppendL( aMessage );
+            }
+        else
+            {
+            aArray.InsertL( insertPosition, aMessage );
+            }
+        }    
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecCollector::CheckPageAreaInfoMatch
+// Checks if these pages can be merged. Returns ETrue, if merging is acceptable.
+//   
+// Decision is based network information and geographical scope of 
+// pages. Network information consists of cell id, location area code
+// and operator id.
+// 
+// Assumption: aPage1 and aPage have identical message
+// identifiers and serial numbers. 
+// Returns ETrue if the pages are of same message.
+// On EFalse previous pages should be deleted.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCbsRecCollector::CheckPageAreaInfoMatch( 
+    const CCbsMessage& aPage1, 
+    const CCbsMessage& aPage2 ) const
+    {   
+    RMobilePhone::TMobilePhoneNetworkInfoV1 info1;
+    RMobilePhone::TMobilePhoneNetworkInfoV1 info2;
+
+    aPage1.GetPLMN( info1 );
+    aPage2.GetPLMN( info2 );
+
+    TBool result( EFalse );
+
+    if ( info1.iCountryCode == KRecMessageNoNetworkInfo || 
+        info2.iCountryCode == KRecMessageNoNetworkInfo )
+        {
+        // Network info is unavailable; we must assume that the aPage1
+        // is of the same page area as aPage2, so we return ETrue
+        // unconditionally.
+        result = ETrue;
+        }
+
+    if ( info1.iCountryCode == info2.iCountryCode && 
+        info1.iNetworkId == info2.iNetworkId )
+        // PLMN match
+        {
+        if ( aPage1.LAC() == aPage2.LAC() )
+            // LAC match
+            {
+            if ( aPage1.CellId() == aPage2.CellId() )
+                // Cell match
+                {
+                // Full network information match
+                result = ETrue;
+                }
+            else
+                {
+                // Cell mismatch
+                if ( aPage1.GeographicalScope() == 
+                    ECbsRecGeographicalScopeCell )
+                    // Cell id mismatch and scoped cell wide.
+                    {
+                    result = EFalse;
+                    }
+                else
+                    // Cell id mismatch, not scoped cell wide.
+                    {
+                    result = ETrue;
+                    }
+                }
+            }            
+        else
+            // LAC mismatch
+            {
+            if ( aPage1.GeographicalScope() == 
+                ECbsRecGeographicalScopePLMN )
+                {
+                // LAC mismatch but scoped operator-wide
+                result = ETrue;
+                }
+            else
+                {
+                // LAC mismatch and not scoped operator-wide
+                result = EFalse;
+                }
+            }
+        }
+    else
+        // PLMN mismatch
+        {
+        result = EFalse; // operator mismatch
+        }
+
+    return result;    
+    }
+
+
+// ================= OTHER EXPORTED FUNCTIONS ==============
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerSrc/Ccbsrecdecoder.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,368 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsRecDecoder class 
+*                member functions.
+*    
+*                CCCbsRecDecoder handles decoding of message contents.
+*
+*                CbsServer receives messages stored in 8-bit descriptors
+*                from ETel. This class converts them into 16-bit descriptors
+*                and decodes the message representation into UCS-2 (which
+*                is used by Symbian OS internally). 
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32svr.h>
+#include <charconv.h>
+#include "CbsServerConstants.h"
+#include "CCbsRecDecoder.h"
+#include "CCbsMessage.h"
+#include "CCbsRecMessage.h"
+#include "CCbsRecWcdmaMessage.h"
+#include "CbsLogger.h"
+
+// CONSTANTS
+
+// Max characters in generated unicode 
+const TInt KMaxCharsInGeneratedUnicode = 128;   
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCbsMcnSession::CCbsMcnSession
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCbsRecDecoder::CCbsRecDecoder()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecDecoder::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCbsRecDecoder::ConstructL()
+    {
+    iConverter = CCnvCharacterSetConverter::NewL();
+    User::LeaveIfError( iFs.Connect() );
+    }     
+
+// -----------------------------------------------------------------------------
+// CCbsRecDecoder::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCbsRecDecoder* CCbsRecDecoder::NewL()
+    {
+    CCbsRecDecoder* self = new(ELeave) CCbsRecDecoder;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+    
+// Destructor
+CCbsRecDecoder::~CCbsRecDecoder()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsRecDecoder::~CCbsRecDecoder()");    
+    iFs.Close();
+    delete iConverter;
+    CBSLOGSTRING("CBSSERVER: <<< CCbsRecDecoder::~CCbsRecDecoder()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecDecoder::DecodeL
+// Decodes 7-bit, 8-bit and 16-bit representations into UCS-2.
+// If the message has a language indication prefixed
+// in the message body, the indication is removed.
+// Compressed messages are not supported.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsRecDecoder::DecodeL( 
+    CCbsMessage& aMessage )
+    {
+    if ( aMessage.IsCompressed() )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    // Convert message into plaintext.
+    DoDecodeL( aMessage );
+
+    // 8-bit representation not needed anymore.
+    aMessage.ReleaseEightBitRepresentation();
+
+    // Determine language of this message (from header or content),
+    aMessage.ResolveLanguage();
+
+    // Remove language indication, if present, from message.
+    aMessage.RemoveLanguageIndicationFromBodyL();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecDecoder::DoDecodeL
+// Decodes the given message's content. 
+// Decodes aMessage's 7-bit/Unicode representation
+// into internal Unicode representation.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsRecDecoder::DoDecodeL( 
+    CCbsMessage& aMessage )
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsRecDecoder::DoDecodeL()");
+    
+    TCbsRecAlphabet alphabet( aMessage.Alphabet() );
+    if ( alphabet == ECbsRecAlphabetDefault || 
+         alphabet == ECbsRecAlphabetUnspecified )
+        {
+        DefaultAlphabetDecodeL( aMessage );
+        }
+    else if ( alphabet == ECbsRecAlphabet8bit )
+        {
+        EightbitAlphabetDecodeL( aMessage );
+        }
+    else
+        {
+        UnicodeDecodeL( aMessage );
+        }
+    CBSLOGSTRING("CBSSERVER: <<< CCbsRecDecoder::DoDecodeL()");
+    }
+    
+// -----------------------------------------------------------------------------
+// CCbsRecDecoder::UnicodeDecodeL
+// Decodes 8-bit and Unicode message representations.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsRecDecoder::UnicodeDecodeL( 
+    CCbsMessage& aMsg )
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsRecDecoder::UnicodeDecodeL()");
+    
+    TPtrC8 contents( aMsg.Contents8() );
+
+    // Reserve enough space for the actual contents plus
+    // the CR key
+    aMsg.ReserveContentSizeL( contents.Length()+1 );
+
+    // Check if the message is preceded with language.
+    if( aMsg.DCS() == DCS_MPLI_UCS2 )
+        {
+        // The language is encoded as 7-bit USSD. Unpack that
+        // and add CR after the language to match the default
+        // alphabet case.
+        TBuf<3> language;
+        language.Copy( contents.Left(2) );
+        language[1] <<= 1;
+        language[1] |= (language[0] & 0x80) >> 7;
+        language[0] &= 0x7f;
+        language.Append( EKeyEnter );
+        aMsg.AppendContent( language );
+
+        // Skip the language indication
+        contents.Set( contents.Mid(2) );
+        }
+
+    // The rest of the message is UCS2 encoded Unicode. 
+    // Make sure the byte order is correct.
+    HBufC* text = HBufC::NewL( contents.Length() / 2 );
+    CleanupStack::PushL( text );
+
+    TPtr ptr( text->Des() );
+    TInt length( contents.Length() );
+
+    // If the length is an odd number, remove the last character.
+    if ( length & 0x01 )
+        {
+        length -= 1;
+        }
+
+    for ( TInt i( 0 ); i < length; i += 2 )
+        {
+        ptr.Append( ( contents[ i ] << 8 ) + contents[ i + 1 ] );
+        }
+
+    aMsg.AppendContent( RemoveTrailingCR( *text ) );
+    CleanupStack::PopAndDestroy();
+    
+    CBSLOGSTRING("CBSSERVER: <<< CCbsRecDecoder::UnicodeDecodeL()");
+    }
+   
+// -----------------------------------------------------------------------------
+// CCbsRecDecoder::DefaultAlphabetDecodeL
+// Decodes 7-bit message representation.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsRecDecoder::DefaultAlphabetDecodeL( 
+    CCbsMessage& aMsg )
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsRecDecoder::DefaultAlphabetDecodeL()");
+    
+    // Check that the converter is available
+    CCnvCharacterSetConverter* characterSetConverter = 
+        CCnvCharacterSetConverter::NewLC(); // on CS
+
+    CCnvCharacterSetConverter::TAvailability availability = 
+        characterSetConverter->PrepareToConvertToOrFromL(
+            KCharacterSetIdentifierSms7Bit, iFs );
+
+    if ( availability == CCnvCharacterSetConverter::ENotAvailable )
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    // Allocate a buffer for the cleartext message
+    TBuf8< KCbsMaxCharsInPage + 1 > realMsg;
+
+    // Get a pointer to the encoded message
+    TPtrC8 msgPartOfEtelMsg = aMsg.Contents8();
+
+    // Length of the cleartext message.
+    TInt messageLength( ( msgPartOfEtelMsg.Length() * 8 ) / 7 );
+
+    static const TUint mask_table[ 8 ] = 
+			    { 0x7F, 0x01,0x03,0x07,0x0F,0x1F,0x3F,0x7F };
+    TUint8  si,di;            // Indexes
+    TInt  tmp_modulo;         // Temporary; to improve efficiency
+    si = 0;
+
+    // The location of the current 7-bit character determines the
+    // action to be taken. Only every 7th character is not divided into
+    // two bytes. All other characters will have to be contructed by
+    // combining bits of two consequent bytes.
+
+    for ( di = 0; di < messageLength; di++ )
+	    {
+	    TUint num2 = 0;
+	    tmp_modulo = di % 8;
+	    switch ( tmp_modulo )
+	        {
+	        case 0:
+		        num2 = msgPartOfEtelMsg[ si ] & 0x7F;
+		        realMsg.Append( num2 );
+		        break;
+	        case 7:
+		        num2 = ( msgPartOfEtelMsg[ si ] >> 1 ) & 0x7F;
+		        realMsg.Append( num2 );
+		        si++;
+		        break;
+	        default:
+	            num2 = msgPartOfEtelMsg[ si ] >> ( 8 - ( tmp_modulo ) );
+	            num2 &= mask_table[ tmp_modulo ];
+	            num2 |= msgPartOfEtelMsg[ si + 1 ] << ( tmp_modulo );
+	            num2 &= 0x7F;
+	            realMsg.Append( num2 );
+	            si++;
+	        break;
+	        }//switch( tmp_modulo )
+	    }//for
+
+    TBuf16<KMaxCharsInGeneratedUnicode> generatedUnicode;
+    TInt state( CCnvCharacterSetConverter::KStateDefault ); // has to be ref.
+    
+    // Remove all trailing control characters from the end of the Cell info msg
+    TBuf8<KCbsMaxCharsInPage> cleanedMsg;
+    if ( aMsg.TopicNumber() == KCellInfoTopic )
+        {
+        cleanedMsg = RemoveTrailingControlChars( realMsg );
+        User::LeaveIfError( characterSetConverter->ConvertToUnicode(
+            generatedUnicode, cleanedMsg, state ) );
+        }
+    else
+        {
+        User::LeaveIfError( characterSetConverter->ConvertToUnicode(
+            generatedUnicode, realMsg, state ) );
+        } 
+    
+    CleanupStack::PopAndDestroy(); // characterSetConverter
+    
+    aMsg.ReserveContentSizeL( messageLength );
+    aMsg.AppendContent( RemoveTrailingCR( generatedUnicode ) );
+    
+    CBSLOGSTRING("CBSSERVER: <<< CCbsRecDecoder::DefaultAlphabetDecodeL()");
+    }
+    
+// -----------------------------------------------------------------------------
+// CCbsRecDecoder::EightbitAlphabetDecodeL
+// Decodes 8-bit message representation.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsRecDecoder::EightbitAlphabetDecodeL( 
+    CCbsMessage& aMsg )
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsRecDecoder::EightbitAlphabetDecodeL()");
+    
+    // Copy 8-bit representation to 16-bit
+    HBufC* hbuf = HBufC::NewL( aMsg.Contents8().Length() );
+    CleanupStack::PushL( hbuf );
+    
+    TPtr16 ptr16 = hbuf->Des();     
+    ptr16.Copy( aMsg.Contents8() );        
+    
+    // Reserve enough space for the actual contents    
+    aMsg.ReserveContentSizeL( aMsg.Contents8().Length() );  
+    aMsg.AppendContent( RemoveTrailingCR( *hbuf ) );
+    
+    CleanupStack::PopAndDestroy( hbuf );
+    
+    CBSLOGSTRING("CBSSERVER: <<< CCbsRecDecoder::EightbitAlphabetDecodeL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecDecoder::RemoveTrailingCR
+// Removes the trailing CRs from a message.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TPtrC CCbsRecDecoder::RemoveTrailingCR( 
+    const TDesC& aText )
+    {
+    TInt i( aText.Length() );
+    for ( ; i > 0 && aText[ i - 1 ] == EKeyEnter; i-- )
+        {
+        // nothing
+        }
+
+    return aText.Left( i );
+    }
+    
+// -----------------------------------------------------------------------------
+// CCbsRecDecoder::RemoveTrailingControlChars
+// Removes the trailing control characters from a message.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TPtrC8 CCbsRecDecoder::RemoveTrailingControlChars( 
+    const TDesC8& aText )
+    {
+    TInt i( aText.Length() );
+    for ( ; i > 0 && ( aText[ i - 1 ] == EKeyEnter || aText[ i - 1 ] == EKeyLineFeed ); i-- )
+        {
+        // nothing
+        }
+
+    return aText.Left( i );
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerSrc/Ccbsrecetel.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,942 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 class creates the ETEL receiver package subcomponents, handles
+*                incoming CBS messages and communicates with the server interface.
+*      
+*
+*/
+
+
+// INCLUDE FILES
+
+		/*****************************************************
+		*	Series 60 Customer / ETel
+		*	Series 60  ETel API
+		*****************************************************/
+#include <etelmm.h>
+#include <mmlist.h> // CMobilePhoneBroadcastIdList
+#include <mmtsy_names.h>
+
+#include "CbsServerConstants.h"
+#include "CbsServerPanic.h"
+#include "CCbsDbImp.H"
+#include "CCbsDbImpTopicList.h"
+#include "CCbsDbImpSettings.H"
+#include "CCbsRecCollector.h"
+#include "CCbsRecDecoder.h"
+#include "CCbsRecEtel.h"
+#include "CCbsRecEtelMonitor.h"
+#include "CCbsRecNetworkListener.h"
+#include "CCbsRecMessage.h"
+#include "CCbsReceiverHelper.h"
+#include "CbsUtils.h"
+
+#include "CCbsEtelMessaging.h"
+#include "MCbsEtelMessaging.h"
+#include "MCbsMcnSubscriptionsProvider.h"
+#include "CCbsSetFilterSettingHandler.h"
+
+#include "CCbsRecWcdmaMessage.h"
+#include "CCbsMessageFactory.h"
+#include "CCbsLivecastHandler.h"
+#include "CbsLogger.h"
+
+#include <centralrepository.h>  // for local variation
+#include "cbsinternalcrkeys.h"  // for local variation
+#include "cbsvariant.hrh"       // for local variation
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCbsRecEtel::CCbsRecEtel
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+		/*****************************************************
+		*	Series 60 Customer / ETel
+		*	Series 60  ETel API
+		*****************************************************/
+CCbsRecEtel::CCbsRecEtel()
+    : iReception( RMobileBroadcastMessaging::EBroadcastAcceptAll ), 
+      iCellInfoReceived( EFalse ),
+      iReceptionEnabled( EFalse ),
+      iLimitedReception( EFalse ),
+      iStartTime( 0 ),
+      iEndTime( 0 ),
+      iHomeZoneReceived( EFalse ),
+      iNewSimTopicsAdded( EFalse )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecEtel::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCbsRecEtel::ConstructL()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsRecEtel::ConstructL()");
+
+    iSubscriptionProviders = new ( ELeave ) 
+        CArrayFixFlat< MCbsMcnSubscriptionsProvider* >( 1 );
+
+    iDecoder = CCbsRecDecoder::NewL();
+    
+    // Establish a session with the ETel server. 
+    ConnectToEtelL();
+
+    // Create a listener to monitor network state changes,
+    iNetworkListener = CCbsRecNetworkListener::NewL( iGsmPhone );
+
+    // Construct the command handlers
+    iFilterSettingHandler = CCbsSetFilterSettingHandler::NewL( *this, *iMessaging );
+
+    // Create the message factory
+    iFactory = CCbsMessageFactory::NewL( *this );    
+    
+    // Message page collector
+    iCollector = CCbsRecCollector::NewL( *iFactory );
+
+    // LC message handler
+    iLivecastHandler = CCbsLivecastHandler::NewL( *this );
+
+    // Message monitor
+    iEtelMonitor = CCbsRecEtelMonitor::NewL( *this, *iMessaging, *iFactory, *iLivecastHandler );    
+    
+    // Fetch local variation bits from CenRep    
+    CRepository* repository = CRepository::NewL( KCRUidCbsVariation );    
+    TInt err = repository->Get( KCbsVariationFlags, iLVBits );  
+    if ( err )
+        {
+        iLVBits = 0;
+        }  
+    CBSLOGSTRING2("CBSSERVER: CCbsRecEtel::ConstructL(): CenRep error: %d", err );   
+    delete repository;
+
+    CBSLOGSTRING("CBSSERVER: <<< CCbsRecEtel::ConstructL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecEtel::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCbsRecEtel* CCbsRecEtel::NewL()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsRecEtel::NewL()");
+
+    CCbsRecEtel* self = new ( ELeave ) CCbsRecEtel;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    CBSLOGSTRING("CBSSERVER: <<< CCbsRecEtel::NewL()");
+    return self;
+    }
+    
+// Destructor 
+		/*****************************************************
+		*	Series 60 Customer / ETel
+		*	Series 60  ETel API
+		*****************************************************/
+CCbsRecEtel::~CCbsRecEtel()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsRecEtel::~CCbsRecEtel()");
+    
+    // Disable CB reception, ignore result    
+    TRAP_IGNORE( SetReceptionStatusL( 
+        RMobileBroadcastMessaging::EBroadcastAcceptNone ) );
+    
+    delete iNetworkListener;
+    delete iEtelMonitor;
+    delete iFilterSettingHandler;
+    delete iLivecastHandler;
+
+    if ( iMessaging )
+        {
+        iMessaging->Close(); // owned by CCbsEtelFactory
+        }        
+    delete iMessaging;
+    
+    delete iCollector;
+    delete iDecoder;    
+    delete iFactory;
+    delete iSubscriptionProviders;
+
+    iCustomPhone.Close();
+    iGsmPhone.Close();
+    iEtelServer.Close();
+        
+    CBSLOGSTRING("CBSSERVER: <<< CCbsRecEtel::~CCbsRecEtel()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecEtel::HandleMessageReceivedL
+// Handles a received CBS message page. 
+//  
+// The message have
+// to be decoded, uncompressed and collected only if
+// certain conditions hold. These are checked first.
+//
+// The handling sequence is as follows:    
+// 1.  If the reception is off, reject this message.
+// 2.  If the user has set a time limit for receiving messages,
+//     check if the current time is such that the message
+//     should not be received.
+// 3.  Check whether message's language has been subscribed.
+//     Reject the message if not. If message id a Class 0 message,
+//     do not reject, since the msg should be shown.
+// 4.  If the topic detection is enabled and this message
+//     is of an unknown topic, add the new topic and
+//     reject this message (since the new topic cannot
+//     be subscribed at this point).
+// 5.  If the same message exists in the database, this
+//     message is ignored.
+// 6.  The decoder decodes the page.
+// 7.  If the message is multipaged, it is given to 
+//     the message collector.
+// 8.  A complete message is forwarded to CCbsReceiverHelper,
+//     which either stores the message into the database
+//     or handles it as an index message.
+//
+// This function is called from CCbsRecEtelMonitor::RunL().
+//
+// Note: Message reception status check may be unnecessary,
+//       if the ETel Monitor instance handles the check.
+//
+// Note: Message subscription check is necessary here.
+//       UI client's subscriptions might differ from MCN client's
+//       subscriptions.
+//
+// Note: Language cannot be read from the header if the
+//       language information is stored in the content of
+//       the message. This is particulary troublesome, if 
+//       the message is compressed. 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsRecEtel::HandleMessageReceivedL( 
+    CCbsMessage* aMessage )
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsRecEtel::HandleMessageReceivedL()");
+    
+    CleanupStack::PushL( aMessage ); // take ownership
+       
+    // Decode a message. Language indication prefix, if any, is also
+    // removed here. A leave occurs if the message is compressed.
+    iDecoder->DecodeL( *aMessage );
+
+    // Add network information to message.
+    TInt error = AddNetworkInfo( *aMessage );
+
+    // If the message is a cell info, extract the information.
+    if ( aMessage->TopicNumber() == KCellInfoTopic )
+        {
+        if ( KErrNone == error )
+            {
+            ExtractCellInformation( *aMessage );
+            }
+        else
+            {
+            iCellInfoReceived = EFalse;
+            }
+        }
+    else if ( aMessage->TopicNumber() == KHomeZoneTopic )
+        {
+        if ( KErrNone == error )
+            {
+            ExtractHomeZoneInformation( *aMessage );
+            }
+        else
+            {
+            iHomeZoneReceived = EFalse;
+            }
+        }
+
+    // Route the message to all MCN client session-objects.
+    RouteMessageL( *aMessage );
+
+    // 1. If the reception is off, reject this message.
+    // 2. If the time of the day is such that the user has decided
+    //    not to receive any messages, reject this message.
+    // 3. Check whether message's language has been subscribed
+    // 4. Check if the topic of this message is not in the topic list
+    //    and the topic detection is enabled.
+    // 5. Check if the topic of this message has been subscribed.
+    // 6. Check if this message already exists in the database.    
+    
+    // This variable must be local, since if the common reception status
+    // is used, this check can mess it up.
+    TBool uiReceptionEnabled( EFalse );
+    iInterface->Database().SettingsL().GetReceptionStatus( uiReceptionEnabled );
+
+    if ( !uiReceptionEnabled ||
+        ( iInterface->LanguageOfMessageSubscribedL( *aMessage ) == EFalse &&
+        aMessage->RequiresImmediateDisplay() == EFalse ) ||
+        iInterface->CheckForNewTopicL( *aMessage ) ||
+        iInterface->CheckForSubscriptionAndExistenceL( *aMessage ) == EFalse )
+        {
+        CBSLOGSTRING("CBSSERVER: CCbsRecEtel::HandleMessageReceivedL(): Rejecting msg, PopAndDestroy().");
+        CleanupStack::PopAndDestroy( aMessage );
+        }  
+    else
+        {
+        // Check if this message is multipaged and if it is, 
+        // give it to the message collector. If it isn't,
+        // forward the message to the receiver helper
+        if ( aMessage->TotalPages() > 1 )
+            {
+            CBSLOGSTRING2("CBSSERVER: CCbsRecEtel::HandleMessageReceivedL(): Multipaged msg, total pages: %d.", aMessage->TotalPages() );
+            
+            // Ensure that the network info is available. 
+            // If not, reject the message, because info is required to collect
+            // pages of a multipaged message.
+            if ( KErrNone != error )
+                {
+                CBSLOGSTRING2("CBSSERVER: CCbsRecEtel::HandleMessageReceivedL(): AddNetworkInfo error: %d, PopAndDestroy().", error );
+                CleanupStack::PopAndDestroy( aMessage );
+                }
+            else
+                {
+                // Ownership of aMessage transferred to iCollector with
+                // aMessage left on the cleanup stack.
+                CBSLOGSTRING("CBSSERVER: CCbsRecEtel::HandleMessageReceivedL(): Calling iCollector->CollectL()...");                
+                CCbsMessage* completedMsg = iCollector->CollectL( aMessage, ECbsMessageTypeUnspecified );
+                CBSLOGSTRING("CBSSERVER: CCbsRecEtel::HandleMessageReceivedL(): iCollector->CollectL() finished OK.");
+                
+                if ( completedMsg )
+                    {
+                    // Message pages combined => Handle like a single-paged msg.
+                    // Result code ignored.
+                    CleanupStack::PushL( completedMsg );
+                    CBSLOGSTRING("CBSSERVER: CCbsRecEtel::HandleMessageReceivedL(): MULTIPAGED: Calling iInterface->HandleReceivedMessageL()...");
+                    iInterface->HandleReceivedMessageL( *completedMsg );
+                    CBSLOGSTRING("CBSSERVER: CCbsRecEtel::HandleMessageReceivedL(): MULTIPAGED: iInterface->HandleReceivedMessageL() finished OK.");
+                    CleanupStack::PopAndDestroy( completedMsg );
+                    }
+                }            
+            }
+        else
+            {
+            // single page    
+            CBSLOGSTRING("CBSSERVER: CCbsRecEtel::HandleMessageReceivedL(): SINGLEPAGED: Calling iInterface->HandleReceivedMessageL()...");
+            iInterface->HandleReceivedMessageL( *aMessage );
+            CBSLOGSTRING("CBSSERVER: CCbsRecEtel::HandleMessageReceivedL(): SINGLEPAGED: iInterface->HandleReceivedMessageL() finished OK.");
+            CleanupStack::PopAndDestroy( aMessage );
+            }
+        }
+    CBSLOGSTRING("CBSSERVER: <<< CCbsRecEtel::HandleMessageReceivedL()");                                
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecEtel::AddNetworkInfo
+// This method blocks if no current network info is 
+// available and the call to retrieve information blocks.
+//  
+// Augments aMessage with current network information (i.e., PLMN, LAC
+// and Cell ID). Does nothing if the network listener iListener
+// is unavailable.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+		/*****************************************************
+		*	Series 60 Customer / ETel
+		*	Series 60  ETel API
+		*****************************************************/
+TInt CCbsRecEtel::AddNetworkInfo( 
+    CCbsMessage& aMessage ) const
+    {
+    TInt result( KErrNone );
+
+    RMobilePhone::TMobilePhoneNetworkInfoV1 info;
+    RMobilePhone::TMobilePhoneLocationAreaV1 area;
+
+    result = iNetworkListener->GetCurrentNetworkInfo( info, area );
+    
+    if ( result == KErrNone )
+        {
+        aMessage.SetNetworkInfo( info, area );
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecEtel::SetInterface
+// Sets the interface to which all accepted messages are given.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsRecEtel::SetInterface( 
+    CCbsReceiverHelper* aInterface )
+    {
+    __ASSERT_DEBUG( aInterface != 0, User::Panic( _L( "InterfaceNull" ), 0 ) );
+    iInterface = aInterface;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecEtel::AddSubscriptionProviderL
+// MCN client sessions register to CCbsRecEtel using this function.
+// 
+// When topic subscriptions are gathered during execution of
+// ApplyStateChangesL(), subscriptions of each registered subscription
+// provider are added to the CBMI list that determines which
+// topics are received.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsRecEtel::AddSubscriptionProviderL( 
+    MCbsMcnSubscriptionsProvider* aProvider )
+    {
+    __TEST_INVARIANT;
+    if ( !aProvider )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    iSubscriptionProviders->AppendL( aProvider );
+
+    __TEST_INVARIANT;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecEtel::RemoveSubscriptionProviderL
+// Removes a MCN topic subscription provider.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsRecEtel::RemoveSubscriptionProviderL(
+    const MCbsMcnSubscriptionsProvider* aProvider )
+    {
+    __TEST_INVARIANT;
+    if ( !aProvider )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    TInt count( iSubscriptionProviders->Count() );
+    for ( TInt i( 0 ); i < count; i++ )
+        {
+        if ( iSubscriptionProviders->At( i ) == aProvider )
+            {
+            iSubscriptionProviders->Delete( i );
+            ApplyStateChangesL();
+            __TEST_INVARIANT;
+            return;
+            }
+        }
+
+#ifdef _DEBUG
+    CbsServerPanic( EMcnProviderNotFound );
+#endif
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecEtel::ApplyStateChangesL
+// Retrieves current subscriptions and settings from DB.
+// 
+// Reception should be enabled if:
+// 1) User has enabled it or
+// 2) There are MCN clients with outstanding message routing
+// requests or
+// 3) New topics were found from SIM card and they were added to Topic list
+//
+// If the reception is enabled, all topics and languages
+// are subscribed from ETel. Filtering is done in CbsServer
+// on receival of a CB message (see HandleMessageReceivedL()).
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+		/*****************************************************
+		*	Series 60 Customer / ETel
+		*	Series 60  ETel API
+		*****************************************************/
+void CCbsRecEtel::ApplyStateChangesL()
+    {
+	CBSLOGSTRING("CBSSERVER: >>> CCbsRecEtel::ApplyStateChangesL()");
+
+    // Determine reception status: If any MCN client requests messages or new
+    // SIM Topics have just been addded, then reception should be enabled. 
+    // Otherwise UI client reception setting is used.
+    TUint numberOfMcnSubscriptions( NumberOfMcnSubscriptions() );
+    CBSLOGSTRING2("CBSSERVER: CCbsRecEtel::ApplyStateChangesL(): numberOfMcnSubscriptions: %d", numberOfMcnSubscriptions );
+
+    TBool receptionStatus( EFalse );
+    TInt errorCode( KErrNone );
+    TRAP( errorCode, iInterface->Database().SettingsL().GetReceptionStatus( receptionStatus ) );
+    CBSLOGSTRING2("CBSSERVER: CCbsRecEtel::ApplyStateChangesL(): Database reception status: %d", receptionStatus );
+
+    TBool receptionEnabled( EFalse );
+    
+    // Variated feature    
+    if ( iLVBits & KCbsLVFlagTopicSubscription )
+        {
+        receptionEnabled = ( receptionStatus || numberOfMcnSubscriptions > 0 || iNewSimTopicsAdded );
+        }
+    else
+        {
+        receptionEnabled = ( receptionStatus || numberOfMcnSubscriptions > 0 );
+        }
+    CBSLOGSTRING2("CBSSERVER: CCbsRecEtel::ApplyStateChangesL(): Should reception be enabled: %d", receptionEnabled );
+
+    // Check if the reception status should be changed
+    if ( receptionEnabled != iReceptionEnabled )
+        {
+        CBSLOGSTRING("CBSSERVER: CCbsRecEtel::ApplyStateChangesL(): Changing reception status.");
+
+        if ( !receptionEnabled )
+            {
+            // Set reception off
+            SetReceptionStatusL( RMobileBroadcastMessaging::EBroadcastAcceptNone );
+            CBSLOGSTRING("CBSSERVER: CCbsRecEtel::ApplyStateChangesL(): Changing reception status, status set OFF.");
+            }
+        else
+            {
+            // Set reception on
+            SetReceptionStatusL( RMobileBroadcastMessaging::EBroadcastAcceptAll );
+            CBSLOGSTRING("CBSSERVER: CCbsRecEtel::ApplyStateChangesL(): Changing reception status, status set ON.");
+            }
+        }
+	CBSLOGSTRING("CBSSERVER: <<< CCbsRecEtel::ApplyStateChangesL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecEtel::GetCurrentMessage
+// Returns the current information message.
+// The information is retrieved from the last cell information or HomeZone
+// message.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCbsRecEtel::GetCurrentMessage( 
+    TDes& aInfoMessage,
+    TInt aTopicNumber )
+    {
+    // Handle the cell info message (topic 50)
+    if ( aTopicNumber == KCellInfoTopic && iCellInfoReceived )
+        {
+        RMobilePhone::TMobilePhoneNetworkInfoV1 networkInfo;
+        RMobilePhone::TMobilePhoneLocationAreaV1 area;
+
+        iNetworkListener->GetCurrentNetworkInfo( networkInfo, area );
+
+        if ( iCellInfoLAC == area.iLocationAreaCode &&
+             iCellInfoCellId == area.iCellId &&
+             iCellInfoPLMN.iCountryCode == networkInfo.iCountryCode &&
+             iCellInfoPLMN.iNetworkId == networkInfo.iNetworkId )
+            {
+            aInfoMessage.Copy( iCurrentCellInfoMessage );
+            return KErrNone;
+            }
+        iCellInfoReceived = EFalse;
+        }
+    // Handle the HomeZone message (topic 221)
+    else if ( aTopicNumber == KHomeZoneTopic && iHomeZoneReceived )
+        {
+        RMobilePhone::TMobilePhoneNetworkInfoV1 networkInfo;
+        RMobilePhone::TMobilePhoneLocationAreaV1 area;
+
+        iNetworkListener->GetCurrentNetworkInfo( networkInfo, area );
+
+        if ( iHomeZoneLAC == area.iLocationAreaCode &&
+             iHomeZoneCellId == area.iCellId &&
+             iHomeZonePLMN.iCountryCode == networkInfo.iCountryCode &&
+             iHomeZonePLMN.iNetworkId == networkInfo.iNetworkId )
+            {
+            aInfoMessage.Copy( iCurrentHomeZoneMessage );
+            return KErrNone;
+            }
+        iHomeZoneReceived = EFalse;
+        }
+
+    return KErrNotFound;            
+    }
+
+// ---------------------------------------------------------
+// LoadSimTopicsL() 
+// Loads topics from SIM, if any exists. Saves them into DB.
+// ---------------------------------------------------------
+		/*****************************************************
+		*	Series 60 Customer / ETel
+		*	Series 60  ETel API
+		*****************************************************/
+TInt CCbsRecEtel::LoadSimTopicsL()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsRecEtel::LoadSimTopicsL()");
+    
+    TInt result( iCustomPhone.StartSimCbTopicBrowsing() );
+    CBSLOGSTRING2("CBSSERVER: CCbsRecEtel::LoadSimTopicsL(): StartSimCbTopicBrowsing() returned: %d.", result);
+
+    if ( result != KErrNone )
+        {
+        CBSLOGSTRING2("CBSSERVER: <<< CCbsRecEtel::LoadSimTopicsL(), returning %d.", result);
+        return result;
+        }
+
+    // Retrieve topics one at time from SIM and store them into DB.
+    RMmCustomAPI::TSimCbTopic topic;
+    TInt error( KErrNone );
+    while ( ( error = iCustomPhone.GetNextSimCbTopic( topic ) ) == KErrNone )
+        {
+        CBSLOGSTRING2("CBSSERVER: CCbsRecEtel::LoadSimTopicsL(): GetNextSimCbTopic() returned KErrNone. (%d)", error );
+        TRAPD( result, iInterface->AddSimTopicL( topic.iNumber, topic.iName ) );
+        
+        // Indicate that at least one new SIM Topic was added to Topic list
+        if ( !result )
+            {
+            // Variated feature
+            if ( iLVBits & KCbsLVFlagTopicSubscription )
+                {
+                iNewSimTopicsAdded = ETrue;
+                CBSLOGSTRING("CBSSERVER: CCbsRecEtel::LoadSimTopicsL(), iNewSimTopicsAdded = ETRUE" );
+                }            
+            }
+        }
+    CBSLOGSTRING2("CBSSERVER: CCbsRecEtel::LoadSimTopicsL(), GetNextSimCbTopic error: %d.", error);
+    CBSLOGSTRING2("CBSSERVER: CCbsRecEtel::LoadSimTopicsL(), AddSimTopicL result: %d.", result);
+    
+    // To prevent ARMV5 compiler warning
+    if ( error )
+        {
+        error = KErrNone;    
+        }        
+
+	CBSLOGSTRING("CBSSERVER: <<< CCbsRecEtel::LoadSimTopicsL(), returning KErrNone.");
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------
+// DeleteSimTopicL
+// Delete the SIM topic. If the SIM topic does not exist, 
+// ignore, because that's what we actually want.
+// ---------------------------------------------------------
+		/*****************************************************
+		*	Series 60 Customer / ETel
+		*	Series 60  ETel API
+		*****************************************************/
+void CCbsRecEtel::DeleteSimTopicL( const TUint16 aNumber, const TBool aDeleteAll ) 
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsRecEtel::DeleteSimTopicL()");
+    
+    TInt number( aNumber );
+
+    // All other errors than KErrNotFound are thrown.
+    TInt ret( iCustomPhone.DeleteSimCbTopic( number ) );
+    CBSLOGSTRING2("CBSSERVER: CCbsRecEtel::DeleteSimTopicL(): DeleteSimCbTopic() returned: %d.", ret);
+    
+#ifdef __WINS__
+    CBSLOGSTRING2("CBSSERVER: CCbsRecEtel::DeleteSimTopicL(): DeleteSimCbTopic() returned: %d", ret );
+#else
+    if ( ret != KErrNotFound )
+        {
+        CBSLOGSTRING2("CBSSERVER: CCbsRecEtel::DeleteSimTopicL(): DeleteSimCbTopic() returned: %d", ret );
+        User::LeaveIfError( ret );
+        }
+
+#endif
+    // Delete one by one from cache only if we are deleting just one topic from the SIM card
+    if ( !aDeleteAll )
+        {
+        // Delete from local array    
+        iInterface->DeleteFromSimTopicCache( aNumber );
+        }    
+        
+    CBSLOGSTRING("CBSSERVER: <<< CCbsRecEtel::DeleteSimTopicL()");
+    }
+
+// ---------------------------------------------------------
+// CCbsRecEtel::DeleteAllSimTopicsL
+// Deletes all topics from the SIM card.
+// (other items were commented in a header).
+// ---------------------------------------------------------
+		/*****************************************************
+		*	Series 60 Customer / ETel
+		*	Series 60  ETel API
+		*****************************************************/
+
+void CCbsRecEtel::DeleteAllSimTopicsL()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsRecEtel::DeleteAllSimTopicsL()");
+    
+    TInt count = iInterface->SimTopics().Count();
+    CBSLOGSTRING2("CBSSERVER: CCbsRecEtel::DeleteAllSimTopicsL(): SIM Topic count: %d", count );    
+    
+    for ( TInt i( 0 ); i < count; i++ )
+        {
+        TInt topicNum = iInterface->SimTopics().At( i );
+        CBSLOGSTRING2("CBSSERVER: CCbsRecEtel::DeleteAllSimTopicsL(): SIM Topic number: %d", topicNum );    
+        DeleteSimTopicL( topicNum, ETrue );
+        }
+    
+    // Delete all topics from the cache
+    iInterface->SimTopics().Reset();
+            
+    CBSLOGSTRING("CBSSERVER: <<< CCbsRecEtel::DeleteAllSimTopicsL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecEtel::ConnectToEtelL
+// Establishes a connection with the EPOC Telephony Server server.
+// Also opens the necessary EPOC Telephony Server resources such as RPhone and
+// RAdvGsmSmsMessaging sessions.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+		/*****************************************************
+		*	Series 60 Customer / ETel
+		*	Series 60  ETel API
+		*****************************************************/
+
+		/*****************************************************
+		*	Series 60 Customer / TSY
+		*	Needs customer TSY implementation
+		*****************************************************/
+void CCbsRecEtel::ConnectToEtelL()
+    {
+    TInt result( KErrNone );
+
+    // Connect to ETel
+    User::LeaveIfError( iEtelServer.Connect() );
+
+    // Load Phone TSY module
+    result = iEtelServer.LoadPhoneModule( KMmTsyModuleName );
+    if ( result != KErrNone )
+        {
+        User::Leave( result );
+        }
+
+    // This function retrieves the total number of phones supported by all 
+	// the currently loaded EPOC Telephony Server (TSY) modules.
+    TInt phoneCount( 0 );
+    User::LeaveIfError( iEtelServer.EnumeratePhones( phoneCount ) );
+
+    // This function retrieves information associated with the specified phone
+	RTelServer::TPhoneInfo phoneInfo;	
+	while ( phoneCount-- )
+		{
+        User::LeaveIfError( iEtelServer.GetPhoneInfo( phoneCount, 
+            phoneInfo ) );
+
+        if ( phoneInfo.iName == KMmTsyPhoneName )
+            {
+            phoneCount = 0;
+            }
+		}
+
+    // Open GSM phone
+    result = iGsmPhone.Open( iEtelServer, phoneInfo.iName );    
+    if ( result != KErrNone )
+        {
+        User::Leave( result );
+        }
+
+    // Create an EPOC Telephony Server messaging instance
+    iMessaging = CCbsEtelMessaging::NewL();
+
+    // Open SMS Messaging
+    result = iMessaging->Open( iGsmPhone );
+    if ( result != KErrNone )
+        {
+        User::Leave( result );
+        }
+
+    // Opens a custom phone subsession by name
+    result = iCustomPhone.Open( iGsmPhone );
+    if ( result != KErrNone )
+        {
+        User::Leave( result );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecEtel::SetReceptionStatusL
+// Sets the requested CB reception status aStatus to ME.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+		/*****************************************************
+		*	Series 60 Customer / ETel
+		*	Series 60  ETel API
+		*****************************************************/
+void CCbsRecEtel::SetReceptionStatusL(
+    RMobileBroadcastMessaging::TMobilePhoneBroadcastFilter aSetting )
+    {    
+    if ( iEtelMonitor )
+        {
+        if ( aSetting == RMobileBroadcastMessaging::EBroadcastAcceptNone )
+            {            
+            iEtelMonitor->Cancel();
+            }
+        else
+            {
+            iEtelMonitor->IssueRequest();
+            }
+        }
+
+    if ( iMessaging )
+        {        
+        iFilterSettingHandler->SetFilterSetting( aSetting );
+        }
+
+    iReceptionEnabled = ( aSetting == RMobileBroadcastMessaging::EBroadcastAcceptAll );
+    
+    // Variated feature
+    if ( iLVBits & KCbsLVFlagTopicSubscription )
+        {
+        // Set reception setting on also for UI, 
+        // if new topics were added from the SIM card
+        if ( iNewSimTopicsAdded )
+            {
+            iInterface->Database().SettingsL().SetReceptionStatusL( ETrue );
+            iNewSimTopicsAdded = EFalse;
+            }
+        }    
+    }  
+
+// -----------------------------------------------------------------------------
+// CCbsRecEtel::NumberOfMcnSubscriptions
+// Returns the total number of topic subscriptions made by
+// MCN clients registered to the server.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUint CCbsRecEtel::NumberOfMcnSubscriptions() const
+    {
+    TUint count( 0 );
+    TInt mcnClientCount( iSubscriptionProviders->Count() );
+    for ( TInt i( 0 ); i < mcnClientCount; i++ )
+        {
+        count += iSubscriptionProviders->At( i )->NumberOfSubscriptions();
+        }
+    return count;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecEtel::RouteMessageL
+// Passes the given CB message to each registered subscriptions
+// provider  
+// a subscription provider is a MCN client wishing
+// CB message routing service
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsRecEtel::RouteMessageL( 
+    const CCbsMessage& aMessage )
+    {
+	CBSLOGSTRING("CBSSERVER: >>> CCbsRecEtel::RouteMessageL()");
+
+    TInt count( iSubscriptionProviders->Count() );    
+    CBSLOGSTRING2("CBSSERVER: CCbsRecEtel::RouteMessageL(): Provider count: %d", count);
+
+    for ( TInt i( 0 ); i < count; i++ )
+        {
+        CBSLOGSTRING2("CBSSERVER: CCbsRecEtel::RouteMessageL(): Routing to provider: %d", i );
+        iSubscriptionProviders->At( i )->RouteMessageL( aMessage );
+        }
+
+	CBSLOGSTRING("CBSSERVER: <<< CCbsRecEtel::RouteMessageL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecEtel::ExtractCellInformation
+// Copies Current cell information (district info, MCN)
+// into receiver's cache.
+// 
+// This way MCN clients can be provided the current
+// cell information message even without message routing service.
+// 
+// The given message is assumed to be a valid cell information
+// message (CB message of topic 050).
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsRecEtel::ExtractCellInformation( 
+    const CCbsMessage& aMessage )
+    {
+
+    iCurrentCellInfoMessage.Copy( aMessage.Contents() );
+    aMessage.GetPLMN( iCellInfoPLMN );
+    iCellInfoLAC = aMessage.LAC();
+    iCellInfoCellId = aMessage.CellId();
+
+    iCellInfoReceived = ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecEtel::ExtractHomeZoneInformation
+// Copies Current HomeZone information into receiver's cache.
+// 
+// This way MCN clients can be provided the current HomeZone
+// message even without message routing service.
+// 
+// The given message is assumed to be a valid HomeZone
+// message (CB message of topic 221).
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsRecEtel::ExtractHomeZoneInformation( 
+    const CCbsMessage& aMessage )
+    {
+    iCurrentHomeZoneMessage.Copy( aMessage.Contents() );
+    aMessage.GetPLMN( iHomeZonePLMN );
+    iHomeZoneLAC = aMessage.LAC();
+    iHomeZoneCellId = aMessage.CellId();
+
+    iHomeZoneReceived = ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecEtel::Collector
+// Returns the message collector reference.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CCbsRecCollector& CCbsRecEtel::Collector()
+    {
+    return *iCollector;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecEtel::Interface
+// Returns the receiver helper reference.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//    
+CCbsReceiverHelper& CCbsRecEtel::Interface() const
+    {
+    return *iInterface;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecEtel::__DbgTestInvariant
+// Checks that the object is in a valid state, and panics if it is not.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsRecEtel::__DbgTestInvariant() const
+    {
+#if defined (_DEBUG)
+    if ( iSubscriptionProviders == NULL ||
+        iEtelMonitor == NULL || iMessaging == NULL || iInterface == NULL ||
+        iDecoder == NULL || iCollector ==NULL || iNetworkListener == NULL )
+        {
+        User::Invariant();
+        }    
+#endif // _DEBUG
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS ==============
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerSrc/Ccbsrecetelmonitor.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,214 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsRecEtelMonitor class 
+*                member functions.    
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include <e32math.h>
+#include "CbsServerConstants.h"
+#include "CCbsRecEtel.h"
+#include "CCbsRecEtelMonitor.h"
+#include "CCbsRecMessage.h"
+#include "CCbsRecWcdmaMessage.h"
+#include "CCbsMessageFactory.h"
+#include "CbsServerPanic.h"
+#include "CCbsLivecastHandler.h"
+#include <featmgr.h>
+#include <bldvariant.hrh> // for feature definitions
+#include "CbsLogger.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCbsRecEtelMonitor::CCbsRecEtelMonitor
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCbsRecEtelMonitor::CCbsRecEtelMonitor( 
+    CCbsRecEtel& aEtel, 
+    MCbsEtelMessaging& aMessaging,
+    CCbsMessageFactory& aFactory,
+    CCbsLivecastHandler& aLivecastHandler )
+    : CActive( EPriorityStandard ),
+    iEtel( aEtel ), 
+    iSmsMessaging( aMessaging ),        
+    iMsgAttributesPckg( iAttributes ),   // Message attributes
+    iFactory( aFactory ),
+    iLivecastHandler( aLivecastHandler ),
+    iNewstickerSupported( EFalse )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecEtelMonitor::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCbsRecEtelMonitor::ConstructL()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsRecEtelMonitor::ConstructL()");
+
+    CActiveScheduler::Add( this );    
+
+    // Sets up TLS, must be done before FeatureManager is used.
+    FeatureManager::InitializeLibL();
+
+    // Check if Newsticker feature is supported
+    if ( FeatureManager::FeatureSupported( KFeatureIdNewsticker ) )
+        {
+        iNewstickerSupported = ETrue;
+        CBSLOGSTRING("CBSSERVER: CCbsRecEtelMonitor::ConstructL(): Newsticker supported.");
+        }
+    else
+        {
+        CBSLOGSTRING("CBSSERVER: CCbsRecEtelMonitor::ConstructL(): Newsticker NOT supported.");
+        }
+
+    // Frees the TLS! Must be done after FeatureManager is used.
+    FeatureManager::UnInitializeLib();
+    
+    CBSLOGSTRING("CBSSERVER: <<< CCbsRecEtelMonitor::ConstructL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecEtelMonitor::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCbsRecEtelMonitor* CCbsRecEtelMonitor::NewL( 
+    CCbsRecEtel& aEtel, 
+    MCbsEtelMessaging& aSmsMessaging,
+    CCbsMessageFactory& aFactory,
+    CCbsLivecastHandler& aLivecastHandler )
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsRecEtelMonitor::NewL()");
+
+    CCbsRecEtelMonitor* self = 
+        new ( ELeave ) CCbsRecEtelMonitor( aEtel, aSmsMessaging, aFactory, aLivecastHandler );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    CBSLOGSTRING("CBSSERVER: <<< CCbsRecEtelMonitor::NewL()");
+    return self;
+    }
+    
+// Destructor
+CCbsRecEtelMonitor::~CCbsRecEtelMonitor()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsRecEtelMonitor::~CCbsRecEtelMonitor()");
+    Cancel();
+    CBSLOGSTRING("CBSSERVER: <<< CCbsRecEtelMonitor::~CCbsRecEtelMonitor()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecEtelMonitor::IssueRequest
+// Requests EPOC Telephony Server to forward next received CB message to this object.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsRecEtelMonitor::IssueRequest() 
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsRecEtelMonitor::IssueRequest()");
+
+    if ( !IsActive() )
+        {
+        iMsgData.FillZ();
+        iSmsMessaging.ReceiveMessage( iStatus, iMsgData, iMsgAttributesPckg );
+        SetActive(); 
+        }
+    CBSLOGSTRING("CBSSERVER: <<< CCbsRecEtelMonitor::IssueRequest()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecEtelMonitor::RunL
+// Becomes active when EPOC Telephony Server has copied a CB message to 
+// iMsgData. The message is then given to CCbsRecEtel for
+// processing.
+// Finally this function re-issues the ReceiveMessage request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsRecEtelMonitor::RunL()
+    {
+    CBSLOGSTRING2("CBSSERVER: >>> CCbsRecEtelMonitor::RunL(), iStatus: %d", iStatus.Int() );
+
+    if ( iStatus == KErrNone )
+        {
+        CCbsMessage* currentMessage = NULL;
+        TCbsMessageType msgType( ECbsMessageTypeUnspecified );
+		
+        CBSLOGSTRING("CBSSERVER: CCbsRecEtelMonitor::RunL(): Calling CreateMessageL()..." );
+        currentMessage = iFactory.CreateMessageL( iMsgData, iAttributes, msgType );        
+        CBSLOGSTRING("CBSSERVER: CCbsRecEtelMonitor::RunL(): CreateMessageL() called OK." );
+
+        if ( currentMessage )
+            {            
+            if ( msgType == ECbsMessageLivecast )
+                {				
+                CBSLOGSTRING("CBSSERVER: CCbsRecEtelMonitor::RunL(): LC message" );
+
+				if ( iNewstickerSupported )
+					{
+	                // Ownership of currentMessage transferred to iLivecastHandler
+	                CBSLOGSTRING("CBSSERVER: CCbsRecEtelMonitor::RunL(): Calling HandleLivecastMessageL()..." );
+	                TInt lcResult( KErrNone );
+	                TRAP( lcResult, iLivecastHandler.HandleLivecastMessageL( currentMessage ) );                
+	                CBSLOGSTRING2("CBSSERVER: CCbsRecEtelMonitor::RunL(): HandleLivecastMessageL() finished, result: %d", lcResult );
+					}
+                else 
+                	{
+                	CBSLOGSTRING("CBSSERVER: CCbsRecEtelMonitor::RunL(): NewsSticker is not supported" );
+                	}
+                }
+            else
+                {				
+                CBSLOGSTRING("CBSSERVER: CCbsRecEtelMonitor::RunL(): Normal message" );
+
+                // Ownership of currentMessage transferred to iEtel
+                CBSLOGSTRING("CBSSERVER: CCbsRecEtelMonitor::RunL(): Calling HandleMessageReceivedL()..." );
+                TInt result( KErrNone );
+                TRAP( result, iEtel.HandleMessageReceivedL( currentMessage ) );                
+                CBSLOGSTRING2("CBSSERVER: CCbsRecEtelMonitor::RunL(): HandleMessageReceivedL() finished, result: %d", result );
+                }            
+            }
+
+        // Renew the request
+        IssueRequest();
+        }
+	CBSLOGSTRING("CBSSERVER: <<< CCbsRecEtelMonitor::RunL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecEtelMonitor::DoCancel
+// Cancels an outstanding ReceiveMessage request.  
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsRecEtelMonitor::DoCancel()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsRecEtelMonitor::DoCancel()" );
+    iSmsMessaging.ReceiveMessageCancel();
+    CBSLOGSTRING("CBSSERVER: <<< CCbsRecEtelMonitor::DoCancel()" );
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/ServerSrc/Ccbsrecnetworklistener.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,351 @@
+/*
+* Copyright (c) 2003-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsRecNetworkListener class 
+*                member functions.   
+*
+*/
+
+
+
+//  INCLUDES
+#include <e32base.h>
+#include <e32svr.h>
+#include <etelmm.h>
+#include "CCbsRecNetworkListener.h"
+#include "CbsLogger.h"
+ 
+// CONSTANTS
+
+/// Network listener's priority in active scheduler.
+const TInt KCbsRecNetworkListenerPriority = CActive::EPriorityStandard + 5;
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCbsRecNetworkListener::CCbsRecNetworkListener
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCbsRecNetworkListener::CCbsRecNetworkListener( 
+    RMobilePhone& aPhone )
+    : CActive( KCbsRecNetworkListenerPriority ), 
+      iNetworkInfoRetrieved( EFalse ), 
+      iPhone( aPhone ),
+      iNetworkInfoPckg( iNetworkInfo ),
+      iGetCurrentNetworkActive( EFalse ),
+      iNotifyNwRegChange( EFalse ) 
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecNetworkListener::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCbsRecNetworkListener::ConstructL()
+    {
+    CActiveScheduler::Add( this );
+    IssueGetCurrentNwRequest();
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecNetworkListener::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCbsRecNetworkListener* CCbsRecNetworkListener::NewL( 
+    RMobilePhone& aPhone )
+    {
+    CCbsRecNetworkListener* self = 
+        new (ELeave) CCbsRecNetworkListener( aPhone );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// Destructor
+CCbsRecNetworkListener::~CCbsRecNetworkListener()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsRecNetworkListener::~CCbsRecNetworkListener()");
+    Cancel();
+    CBSLOGSTRING("CBSSERVER: <<< CCbsRecNetworkListener::~CCbsRecNetworkListener()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecMessage::GetCurrentNetworkInfo
+// Fetches the current networking info.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCbsRecNetworkListener::GetCurrentNetworkInfo(
+    RMobilePhone::TMobilePhoneNetworkInfoV1& aNetworkInfo, 
+    RMobilePhone::TMobilePhoneLocationAreaV1& aArea )
+    {
+    TInt errorCode;
+    if ( !iNetworkInfoRetrieved )
+        {
+        // No network state change notification arrived yet
+        errorCode = KErrNotFound;
+        }
+    else
+        {
+        // Get both infos from member variables        
+        aNetworkInfo = iNetworkInfo;
+        aArea = iArea;
+        errorCode = KErrNone;
+        }
+    return errorCode;
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecMessage::RunL
+// Called after NotifyCurrentNetworkChange is completed by EPOC Telephony Server.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsRecNetworkListener::RunL()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsRecNetworkListener::RunL()");
+    if ( iGetCurrentNetworkActive )
+        {   
+        // Current request is getting current active network
+        HandleGetCurrentNetworkResult();
+        }
+    else
+        {
+        if ( iNotifyNwRegChange )
+            {
+            // Current request is notifying network registeration change
+            HandleNotifyNetworkRegistrationStatusChangeResult();
+            }
+        else
+            {
+            // Current request is notifying current network state change
+            HandleNotifyCurrentNetworkChangeResult();
+            }
+        }
+    CBSLOGSTRING("CBSSERVER: <<< CCbsRecNetworkListener::RunL()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecMessage::DoCancel
+// Called whenever the listener has been requested to cancel.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsRecNetworkListener::DoCancel()
+    {
+    // Cancel current request. Ongoing request can be:
+    // GetCurrentNetwork, NotifyNetworkRegistrationStatusChange and 
+    // NotifyCurrentNetworkChange.
+    
+    // Check if the initialization phase was going on
+    if ( iGetCurrentNetworkActive )
+        {   
+        iPhone.CancelAsyncRequest( EMobilePhoneGetCurrentNetwork );
+        iGetCurrentNetworkActive = EFalse;
+        }
+    else
+        {
+        // Check if the notification of network registration state change
+        if ( iNotifyNwRegChange )
+            {
+            iPhone.CancelAsyncRequest( EMobilePhoneNotifyNetworkRegistrationStatusChange );
+            iNotifyNwRegChange = EFalse;
+            }
+        else
+            {
+            // Current request is notification of current network change
+            iPhone.CancelAsyncRequest( EMobilePhoneNotifyCurrentNetworkChange );
+            }    
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecNetworkListener::IssueGetCurrentNwRequest
+// Requests getting current network information from EPOC Telephony Server.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsRecNetworkListener::IssueGetCurrentNwRequest()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsRecNetworkListener::\
+                  IssueGetCurrentNwRequest()");
+    if ( !IsActive() )
+        {
+        iPhone.GetCurrentNetwork( iStatus, iNetworkInfoPckg, iArea );
+        SetActive();
+        iGetCurrentNetworkActive = ETrue;
+        }
+    else
+        {
+        CBSLOGSTRING("CBSSERVER: CCbsRecNetworkListener::\
+                     IssueGetCurrentNwRequest(), Aready active");
+        }
+    CBSLOGSTRING("CBSSERVER: <<< CCbsRecNetworkListener::\
+                  IssueGetCurrentNwRequest()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecNetworkListener::IssueNotifyNwRegChangeRequest
+// Requests notification of network registration state change 
+// from EPOC Telephony Server.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsRecNetworkListener::IssueNotifyNwRegChangeRequest()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsRecNetworkListener::\
+                  IssueNotifyNwRegChangeRequest()");
+    if ( !IsActive() )
+        {
+        iPhone.NotifyNetworkRegistrationStatusChange( iStatus, iRegistration );
+        SetActive();
+        iNotifyNwRegChange = ETrue;
+        }
+    else
+        {
+        CBSLOGSTRING("CBSSERVER: CCbsRecNetworkListener::\
+                     IssueNotifyNwRegChangeRequest(), Aready active");
+        }
+    CBSLOGSTRING("CBSSERVER: <<< CCbsRecNetworkListener::\
+                  IssueNotifyNwChangeRequest()");
+    }
+
+// -----------------------------------------------------------------------------
+// CCbsRecNetworkListener::IssueNotifyNwChangeRequest
+// Requests notification of network state change from EPOC Telephony Server.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsRecNetworkListener::IssueNotifyNwChangeRequest()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsRecNetworkListener::\
+                  IssueNotifyNwChangeRequest");
+    if ( !IsActive() )
+        {
+        iPhone.NotifyCurrentNetworkChange( iStatus, iNetworkInfoPckg, iArea );
+        SetActive();
+        }
+    else
+        {
+        CBSLOGSTRING("CBSSERVER: CCbsRecNetworkListener::\
+                     IssueNotifyNwChangeRequest(), Aready active");
+        }
+    CBSLOGSTRING("CBSSERVER: <<< CCbsRecNetworkListener::\
+                  IssueNotifyNwChangeRequest()");
+    }
+
+
+// -----------------------------------------------------------------------------
+// When the current request is GetCurrentNetwork, handle the return result
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsRecNetworkListener::HandleGetCurrentNetworkResult()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsRecNetworkListener::\
+                  HandleGetCurrentNetworkResult");
+    iGetCurrentNetworkActive = EFalse;
+
+    if ( KErrNone == iStatus.Int() )
+        {
+        // Get the network information successfully
+        // Submit the notify current network change request.
+        iNetworkInfoRetrieved = ETrue;
+        IssueNotifyNwChangeRequest();
+        }
+    else
+        {
+        // Run into some problems to get network information,
+        // submit the request of notification of network registration
+        // state change
+        CBSLOGSTRING2("CBSSERVER: CCbsRecNetworkListener::\
+        HandleGetCurrentNetworkResult, iStatus is %d", iStatus.Int());
+        IssueNotifyNwRegChangeRequest();
+        } 
+    CBSLOGSTRING("CBSSERVER: <<< CCbsRecNetworkListener::\
+                  HandleGetCurrentNetworkResult");
+    }
+
+// -----------------------------------------------------------------------------
+// When the current request is NotifyNetworkRegistrationStatusChange, 
+// handle the return result
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsRecNetworkListener::HandleNotifyNetworkRegistrationStatusChangeResult()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsRecNetworkListener::\
+                  HandleNotifyNetworkRegistrationStatusChangeResult()");
+
+    if ( KErrNone == iStatus.Int() )
+        {
+        CBSLOGSTRING2("CBSSERVER: CCbsRecNetworkListener::\
+                       HandleNotifyNetworkRegistrationStatusChangeResult(), \
+                       registration status is %d", iRegistration);
+  
+        if ( ( RMobilePhone::ERegisteredOnHomeNetwork == 
+               iRegistration ) ||
+             ( RMobilePhone::ERegisteredRoaming == iRegistration ) )
+            {
+            // ME successfully registered on network, submit GetCurrentNetwork 
+            // request to get current network information
+            iNotifyNwRegChange = EFalse;
+            IssueGetCurrentNwRequest();
+            }
+        else
+            {
+            // ME didn't successfully registered on network.
+            // Resubmit this request.
+            IssueNotifyNwRegChangeRequest();
+            }
+        }
+    else
+        {
+        CBSLOGSTRING2("CBSSERVER: CCbsRecNetworkListener::\
+                       HandleNotifyNetworkRegistrationStatusChangeResult, \
+                       iStatus is %d", iStatus.Int() );
+        IssueNotifyNwRegChangeRequest();
+        }
+
+    CBSLOGSTRING("CBSSERVER: <<< CCbsRecNetworkListener::\
+                  HandleNotifyNetworkRegistrationStatusChangeResult()");
+    }
+
+// -----------------------------------------------------------------------------
+// When the current request is NotifyCurrentNetworkChange, 
+// handle the return result
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCbsRecNetworkListener::HandleNotifyCurrentNetworkChangeResult()
+    {
+    CBSLOGSTRING("CBSSERVER: >>> CCbsRecNetworkListener::\
+                  HandleNotifyCurrentNetworkChangeResult()");
+
+    CBSLOGSTRING2("CBSSERVER: CCbsRecNetworkListener::\
+                   HandleNotifyCurrentNetworkChangeResult, \
+                   iStatus is %d", iStatus.Int());
+    iNetworkInfoRetrieved = ( KErrNone == iStatus.Int() ) ? ETrue : EFalse;
+    IssueNotifyNwChangeRequest();
+
+    CBSLOGSTRING("CBSSERVER: <<< CCbsRecNetworkListener::\
+                  HandleNotifyCurrentNetworkChangeResult()");
+    }
+
+//  End of File  
Binary file cbs/cbsserver/conf/cbsserver.confml has changed
Binary file cbs/cbsserver/conf/cbsserver_1020298F.crml has changed
Binary file cbs/cbsserver/conf/cbsserver_102078EE.crml has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsserver/loc/CbsServer.loc	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This is the localisation file of CBS Server.
+*
+*/
+
+
+// LOCALISATION STRINGS:
+
+// d: SIM topic description
+// l: list_single_graphic_heading_pane_t1
+// w: S90DialogListBox
+#define qtn_cb_litext_sim_topic             "SIM topic"
+
+// d: This text is used when adding a Index topic to database. 
+// l: list_single_graphic_heading_pane_t1
+// w: S90DialogListBox
+#define qtn_cb_litext_index                 "Index"
+
+// d: This text is used when adding Standard Topic List to database. 
+// l: list_single_graphic_heading_pane_t1
+// w: S90DialogListBox
+#define qtn_cb_litext_standard_topic_list   "Default Topic List"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsui/resources/Copy of cbs_app.docml	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,1 @@
+<hbdocument version="0.1" context="cbs_app_xml">
 <object name="t:config" type="QObject">
    <object name="t:settings" type="HbAction">
    <localizedstring name="text" value="Settings" comment="txt_cbs_settings" /> 
    </object>
    <object name="t:exit" type="HbAction">
    <localizedstring name="text" value="Exit" comment="txt_cbs_exit" /> 
    </object>
    <object name="t:help" type="HbAction">
    <localizedstring name="text" value="Help" comment="txt_cbs_help" /> 
    </object>
    <object name="t:toggle_reception" type="HbAction">
    <localizedstring name="text" value="Activate" comment="txt_cbs_activate" /> 
    </object>
    <object name="t:add_topic" type="HbAction">
    <localizedstring name="text" value="Add topic" comment="txt_cbs_add_topic" /> 
    </object>
    </object>

    <object name="t:open" type="HbAction">
    <localizedstring name="text" value="Open" comment="txt_cbs_open" /> 
    </object>
    
    <object name="t:subscribe" type="HbAction">
    <localizedstring name="text" value="Subscribe" comment="txt_cbs_subscribe" /> 
    </object>
    
    <object name="t:unsubscribe" type="HbAction">
    <localizedstring name="text" value="Unsubscribe" comment="txt_cbs_unsubscribe" /> 
    </object>
    <object name="t:hotmark" type="HbAction">
    <localizedstring name="text" value="Hotmark" comment="txt_cbs_hotmark"/> 
    </object>
        <object name="t:unhotmark" type="HbAction">
    <localizedstring name="text" value="Unhotmark" comment="txt_cbs_unhotmark"/> 
    </object>
    <object name="t:delete" type="HbAction">
    <localizedstring name="text" value="Delete" comment="txt_cbs_delete"/> 
    </object>

    <object name="t:edit" type="HbAction">
    <localizedstring name="text" value="Edit" comment="txt_cbs_edit"/> 
    </object>
  
      <!-- Main view -->
    <widget name="t:view" type="CbsUiTopicListView">
        <localizedstring name="title" value="Cell broadcast" comment="txt_cbs_title"/>
        <widget name="t:menu" type="HbMenu" role="HbView:menu">
            <ref object="t:settings" role="HbMenu:addAction" /> 
            <ref object="t:help" role="HbMenu:addAction" /> 
            <ref object="t:exit" role="HbMenu:addAction" /> 
        </widget>
        <widget name="t:toolbar" type="HbToolBar" role="HbView:toolBar">
            <ref object="t:toggle_reception" role="HbToolBar:addAction" /> 
            <ref object="t:add_topic" role="HbToolBar:addAction" /> 
        </widget>
        <widget name="content" role="HbView:widget" type="HbWidget">
            <widget name="t:topicIndex" type="HbListWidget">
                <sizepolicy verticalPolicy="MinimumExpanding" verticalStretch="0" />
                <sizepolicy horizontalPolicy="MinimumExpanding" horizontalStretch="0" />
                <sizehint type="MINIMUM" width="360" />
                <sizehint type="MAXIMUM" width="640" />
                <sizehint type="PREFERRED" width="360" /> 
                <sizehint type="FIXED" height="50" />
            </widget>
            <widget name="t:label" type="HbLabel">
                <localizedstring name="text" value="Topics" comment="txt_cbs_topics"/>   
            </widget>
            <widget name="t:ListWidget" type="HbListWidget">
                <sizepolicy verticalPolicy="Expanding" verticalStretch="1" />
                <sizepolicy horizontalPolicy="MinimumExpanding" horizontalStretch="0" />
                <sizehint type="MINIMUM" width="360" />
                <sizehint type="MAXIMUM" width="640" />
                <sizehint type="PREFERRED" width="360" /> 
                <sizehint type="PREFERRED" height="500" />
            </widget>
        </widget>
  </widget>
        
  <!-- portrait layout -->
    <section name="portrait">
        <widget name="content">
            <layout type="anchor">
                <anchoritem src="" srcEdge="TOP" dst="t:topicIndex" dstEdge="TOP" spacing="0" />
                <anchoritem src="" srcEdge="LEFT" dst="t:topicIndex" dstEdge="LEFT" spacing="0" />
                <anchoritem src="t:topicIndex" srcEdge="BOTTOM" dst="t:label" dstEdge="TOP" spacing="0" />               
                <anchoritem src="t:label" srcEdge="BOTTOM" dst="t:ListWidget" dstEdge="TOP" spacing="0" />
                <anchoritem src="" srcEdge="BOTTOM" dst="t:toolbar" dstEdge="TOP" spacing="0" />
                <anchoritem src="" srcEdge="CENTERH" dst="t:toolbar" dstEdge="CENTERH" spacing="0" />            
                </layout>
        </widget>
    </section>

  <!-- Connect toolbar signals -->
  <connect sender="t:add_topic" signal="triggered(bool)" receiver="t:view" slot="addNewTopic()" />
  <connect sender="t:toggle_reception" signal="triggered(bool)" receiver="t:view" slot="toggleReception()" />
</hbdocument>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbs/cbsui/rom/cbsuiresources.iby	Wed Jul 21 18:26:52 2010 +0300
@@ -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: CBS resources rom build file
+*
+*/
+
+
+#ifndef __CBSUI_RESOURCES_IBY__
+#define __CBSUI_RESOURCES_IBY__
+
+#ifdef __CELL_BROADCAST
+
+data=DATAZ_\resource\apps\cbsui.rsc          S60_APP_RESOURCE(cbsui.rsc)
+
+#endif // __CELL_BROADCAST
+
+#endif // __CBSUI_RESOURCES_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/bmarm/psuiu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,15 @@
+EXPORTS
+	NewL__19CPsuiResourceLoader @ 1 NONAME R3UNUSED ; CPsuiResourceLoader::NewL(void)
+	CreateCFObsL__14CPsuiContainer @ 2 NONAME R3UNUSED ; CPsuiContainer::CreateCFObsL(void)
+	CreateCWObsL__14CPsuiContainer @ 3 NONAME R3UNUSED ; CPsuiContainer::CreateCWObsL(void)
+	CreateCliObsL__14CPsuiContainer @ 4 NONAME R3UNUSED ; CPsuiContainer::CreateCliObsL(void)
+	NewLC__19CPsuiResourceLoader @ 5 NONAME R3UNUSED ; CPsuiResourceLoader::NewLC(void)
+	NewL__14CPsuiContainer @ 6 NONAME R3UNUSED ; CPsuiContainer::NewL(void)
+	NewL__14CPsuiDivertObsR14CPsuiContainer @ 7 NONAME R3UNUSED ; CPsuiDivertObs::NewL(CPsuiContainer &)
+	NewL__15CPsuiBarringObsR14CPsuiContainer @ 8 NONAME R3UNUSED ; CPsuiBarringObs::NewL(CPsuiContainer &)
+	NewL__15CPsuiWaitingObsR14CPsuiContainer @ 9 NONAME R3UNUSED ; CPsuiWaitingObs::NewL(CPsuiContainer &)
+	NewL__16CPsuiCliObserverR14CPsuiContainer @ 10 NONAME R3UNUSED ; CPsuiCliObserver::NewL(CPsuiContainer &)
+	CreateCBObsL__14CPsuiContainer @ 11 NONAME R3UNUSED ; CPsuiContainer::CreateCBObsL(void)
+	DeleteAndCreateNoteMaster__14CPsuiContainer @ 12 NONAME R3UNUSED ; CPsuiContainer::DeleteAndCreateNoteMaster(void)
+	GetNoteMaster__14CPsuiContainer @ 13 NONAME R3UNUSED ; CPsuiContainer::GetNoteMaster(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/bwins/psuiu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,13 @@
+EXPORTS
+	?CreateCBObsL@CPsuiContainer@@QAEPAVCPsuiBarringObs@@XZ @ 1 NONAME ; class CPsuiBarringObs * CPsuiContainer::CreateCBObsL(void)
+	?CreateCFObsL@CPsuiContainer@@QAEPAVCPsuiDivertObs@@XZ @ 2 NONAME ; class CPsuiDivertObs * CPsuiContainer::CreateCFObsL(void)
+	?CreateCWObsL@CPsuiContainer@@QAEPAVCPsuiWaitingObs@@XZ @ 3 NONAME ; class CPsuiWaitingObs * CPsuiContainer::CreateCWObsL(void)
+	?CreateCliObsL@CPsuiContainer@@QAEPAVCPsuiCliObserver@@XZ @ 4 NONAME ; class CPsuiCliObserver * CPsuiContainer::CreateCliObsL(void)
+	?NewL@CPsuiBarringObs@@SAPAV1@AAVCPsuiContainer@@@Z @ 5 NONAME ; class CPsuiBarringObs * CPsuiBarringObs::NewL(class CPsuiContainer &)
+	?NewL@CPsuiCliObserver@@SAPAV1@AAVCPsuiContainer@@@Z @ 6 NONAME ; class CPsuiCliObserver * CPsuiCliObserver::NewL(class CPsuiContainer &)
+	?NewL@CPsuiContainer@@SAPAV1@XZ @ 7 NONAME ; class CPsuiContainer * CPsuiContainer::NewL(void)
+	?NewL@CPsuiDivertObs@@SAPAV1@AAVCPsuiContainer@@@Z @ 8 NONAME ; class CPsuiDivertObs * CPsuiDivertObs::NewL(class CPsuiContainer &)
+	?NewL@CPsuiResourceLoader@@SAPAV1@XZ @ 9 NONAME ; class CPsuiResourceLoader * CPsuiResourceLoader::NewL(void)
+	?NewL@CPsuiWaitingObs@@SAPAV1@AAVCPsuiContainer@@@Z @ 10 NONAME ; class CPsuiWaitingObs * CPsuiWaitingObs::NewL(class CPsuiContainer &)
+	?NewLC@CPsuiResourceLoader@@SAPAV1@XZ @ 11 NONAME ; class CPsuiResourceLoader * CPsuiResourceLoader::NewLC(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/data/psui.rss	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,192 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 of Phone Setting UI Notes
+*
+*/
+
+
+//  RESOURCE IDENTIFIER
+NAME PSUI 
+
+//  INCLUDES
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.mbg>
+#include <avkon.hrh>
+#include <avkon.loc>
+#include <EIKCORE.rsg>
+#include <eikon.rh>
+#include "eikon.rsg"
+#include <psui.loc>
+
+//  RESOURCE DEFINITIONS
+RESOURCE RSS_SIGNATURE { }
+
+//---------------------------------------------------------------------------
+//  resources for basic service group strings
+//---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_bs_alpha_0  { buf = text_bs_alpha_0;  }
+RESOURCE TBUF r_bs_alpha_10 { buf = text_bs_alpha_10; }
+RESOURCE TBUF r_bs_alpha_11 { buf = text_bs_alpha_11; }
+RESOURCE TBUF r_bs_alpha_12 { buf = text_bs_alpha_12; }
+RESOURCE TBUF r_bs_alpha_13 { buf = text_bs_alpha_13; }
+RESOURCE TBUF r_bs_alpha_16 { buf = text_bs_alpha_16; }
+RESOURCE TBUF r_bs_alpha_19 { buf = text_bs_alpha_19; }
+RESOURCE TBUF r_bs_alpha_20 { buf = text_bs_alpha_20; }
+RESOURCE TBUF r_bs_alpha_21 { buf = text_bs_alpha_21; }
+RESOURCE TBUF r_bs_alpha_22 { buf = text_bs_alpha_22; }
+RESOURCE TBUF r_bs_alpha_24 { buf = text_bs_alpha_24; }
+RESOURCE TBUF r_bs_alpha_25 { buf = text_bs_alpha_25; }
+RESOURCE TBUF r_bs_alpha_26 { buf = text_bs_alpha_26; }
+RESOURCE TBUF r_bs_alpha_27 { buf = text_bs_alpha_27; }
+RESOURCE TBUF r_bs_alpha_89 { buf = text_bs_alpha_89; }
+RESOURCE TBUF r_bs_alpha_20_vt { buf = qtn_bs_alpha_20_vt; }
+RESOURCE TBUF r_bs_alpha_30 { buf = qtn_bs_alpha_30; }
+
+RESOURCE TBUF r_text_divert_active   { buf = qtn_div_heading_active;   }
+RESOURCE TBUF r_text_divert_inactive { buf = qtn_div_heading_inactive; }
+
+//--------------------------------------------------------------------------- 
+//  resources for note texts
+//---------------------------------------------------------------------------
+//
+
+//divert specific
+RESOURCE TBUF r_to_number            { buf = qtn_div_quest_number;}
+RESOURCE TBUF r_delay_time           { buf = qtn_div_quest_delay_time;}
+RESOURCE TBUF r_text_ss_detail_delay_sec { buf = text_ss_detail_delay_sec;}
+RESOURCE TBUF r_activate_note        { buf = text_divert_activated;}
+RESOURCE TBUF r_plural_activate_note { buf = qtn_div_conf_activateall;}
+RESOURCE TBUF r_cancel_note          { buf = text_divert_canceled;}
+RESOURCE TBUF r_plural_cancel_note   { buf = qtn_div_conf_cancelall;}
+RESOURCE TBUF r_not_active_note      { buf = text_divert_inactive;}
+RESOURCE TBUF r_divert_active        { buf = qtn_divert_active;}
+RESOURCE TBUF r_voip_divert_not_supported { buf = qtn_voip_divert_not_supported;}
+
+//call waiting specific
+RESOURCE TBUF r_cw_active_note        { buf = text_call_waiting_activated;}
+RESOURCE TBUF r_cw_cancel_note        { buf = text_call_waiting_cancelled;}
+RESOURCE TBUF r_cw_not_active_note    { buf = text_call_waiting_not_active;}
+RESOURCE TBUF r_cw_not_provisioned_note {buf = qtn_cw_note_not_provisioned;}
+
+//call barring specific
+RESOURCE TBUF r_cb_active_note        { buf = text_barring_activated;}
+RESOURCE TBUF r_cb_cancel_note        { buf = text_barring_canceled;}
+RESOURCE TBUF r_cb_plural_cancel_note { buf = qtn_barr_conf_cancelall;}
+RESOURCE TBUF r_barring_not_active_note { buf = text_barring_not_active;}
+RESOURCE TBUF r_password_changed_note { buf = text_password_changed;}
+RESOURCE TBUF r_password_blocked_note { buf = qtn_paswd_info_code_blocked;}
+RESOURCE TBUF r_contact_service_note  { buf = qtn_ss_barring_operation_not_successfull;}
+
+ 
+//cli specific
+RESOURCE TBUF r_clir_active_note      { buf = text_clir_active;}
+RESOURCE TBUF r_clir_inactive_note    { buf = text_clir_not_active;}
+RESOURCE TBUF r_clip_active_note      { buf = text_clip_active;}
+RESOURCE TBUF r_clip_inactive_note    { buf = text_clip_not_active;}
+RESOURCE TBUF r_colr_active_note      { buf = text_colr_active;}
+RESOURCE TBUF r_colr_inactive_note    { buf = text_colr_not_active;}
+RESOURCE TBUF r_colp_active_note      { buf = text_colp_active;}
+RESOURCE TBUF r_colp_inactive_note    { buf = text_colp_not_active;}
+
+//general error
+RESOURCE TBUF r_password_error_note   { buf = text_password_error;}
+RESOURCE TBUF r_not_done_note         { buf = text_not_done;}
+RESOURCE TBUF r_request_cancelled_note { buf = text_unconfirmed;}
+RESOURCE TBUF r_not_allowed           { buf = text_not_allowed;}
+RESOURCE TBUF r_services_in_conflict  { buf = qtn_srvrq_info_confl;}
+RESOURCE TBUF r_result_unknown        { buf = text_result_unknown;}
+RESOURCE TBUF r_no_service            { buf = text_no_service;}
+RESOURCE TBUF r_request_rejected      { buf = text_request_rejected;}
+ 
+//-----------------------------------------------------------------------------
+//  resource for confirmation query
+//-----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_confirmation_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_BACK;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control = AVKON_CONFIRMATION_QUERY
+                {
+                layout = EConfirmationQueryLayout;
+                label = qtn_div_quest_number;
+                animation = R_QGN_NOTE_INFO_ANIM;
+                };
+            }
+        };
+    }
+
+//----------------------------------------------------
+//  resources for softkeys
+//----------------------------------------------------
+//
+RESOURCE CBA r_psui_softkeys_number_back
+    {
+    buttons = 
+        { 
+        CBA_BUTTON {id = EAknSoftkeySelect; txt = qtn_div_softk_number;},
+        CBA_BUTTON {id = EAknSoftkeyCancel; txt = text_softkey_back;},
+        CBA_BUTTON {id = EAknSoftkeySelect; txt = qtn_div_softk_number;}
+        };
+    }
+
+RESOURCE CBA r_psui_softkeys_details_back
+    {
+    buttons = 
+        { 
+        CBA_BUTTON {id = EAknSoftkeySelect; txt = qtn_div_softk_detail;},
+        CBA_BUTTON {id = EAknSoftkeyCancel; txt = text_softkey_back;},
+        CBA_BUTTON {id = EAknSoftkeySelect; txt = qtn_div_softk_detail;}
+        };
+    }
+
+//----------------------------------------------------
+//  resources for header texts in status lists
+//----------------------------------------------------
+//
+RESOURCE TBUF r_cw_status_heading { buf = qtn_cw_status_heading; }
+RESOURCE TBUF r_barr_status_heading { buf = qtn_barr_heading_active; }
+
+//----------------------------------------------------
+//  miscellanous new resources, added to the end so that
+//  binary compatibility is maintained
+//----------------------------------------------------
+//
+RESOURCE TBUF r_barring_active_note { buf = text_barring_active;}
+RESOURCE TBUF r_net_info_lost { buf = text_net_info_lost;}
+RESOURCE TBUF r_cw_active_no_bsc_note { buf = text_call_waiting_active;}
+
+//---------------------------------------------------- 
+// resources for CNAP inquiry
+//----------------------------------------------------
+//
+RESOURCE TBUF r_cnap_active { buf = qtn_cnap_active;}
+RESOURCE TBUF r_cnap_inactive { buf = qtn_cnap_not_active;}
+
+//---------------------------------------------------- 
+// resources for Offline mode
+//----------------------------------------------------
+//
+RESOURCE TBUF r_offline_mode { buf = qtn_offline_not_possible;}
+RESOURCE TBUF r_offline_mode_sap { buf = qtn_offline_not_possible_sap;}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/data/psui_stub.pkg	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,33 @@
+;
+; 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: For packing psui stub component.
+;
+; psui_stub.pkg
+
+; Languages
+&EN
+
+; Header
+#{"psui"},(0x100059C6),1,0,0,TYPE=SA
+
+;Localised Vendor name
+%{"Nokia"}
+
+;Unique Vendor name
+:"Nokia"
+
+; Target
+
+""-"z:\sys\bin\psui.dll"
+""-"z:\resource\psui.rsc" 
\ No newline at end of file
Binary file cellular/psetnotesui/data/psui_stub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/eabi/psuiu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,29 @@
+EXPORTS
+	_ZN14CPsuiContainer12CreateCBObsLEv @ 1 NONAME
+	_ZN14CPsuiContainer12CreateCFObsLEv @ 2 NONAME
+	_ZN14CPsuiContainer12CreateCWObsLEv @ 3 NONAME
+	_ZN14CPsuiContainer13CreateCliObsLEv @ 4 NONAME
+	_ZN14CPsuiContainer4NewLEv @ 5 NONAME
+	_ZN14CPsuiDivertObs4NewLER14CPsuiContainer @ 6 NONAME
+	_ZN15CPsuiBarringObs4NewLER14CPsuiContainer @ 7 NONAME
+	_ZN15CPsuiWaitingObs4NewLER14CPsuiContainer @ 8 NONAME
+	_ZN16CPsuiCliObserver4NewLER14CPsuiContainer @ 9 NONAME
+	_ZN19CPsuiResourceLoader4NewLEv @ 10 NONAME
+	_ZN19CPsuiResourceLoader5NewLCEv @ 11 NONAME
+	_ZTI14CPsuiContainer @ 12 NONAME
+	_ZTI14CPsuiDivertObs @ 13 NONAME
+	_ZTI15CPsuiBarringObs @ 14 NONAME
+	_ZTI15CPsuiNoteMaster @ 15 NONAME
+	_ZTI15CPsuiWaitingObs @ 16 NONAME
+	_ZTI16CPsuiCliObserver @ 17 NONAME
+	_ZTI19CPsuiNoteController @ 18 NONAME
+	_ZTI19CPsuiResourceLoader @ 19 NONAME
+	_ZTV14CPsuiContainer @ 20 NONAME
+	_ZTV14CPsuiDivertObs @ 21 NONAME
+	_ZTV15CPsuiBarringObs @ 22 NONAME
+	_ZTV15CPsuiNoteMaster @ 23 NONAME
+	_ZTV15CPsuiWaitingObs @ 24 NONAME
+	_ZTV16CPsuiCliObserver @ 25 NONAME
+	_ZTV19CPsuiNoteController @ 26 NONAME
+	_ZTV19CPsuiResourceLoader @ 27 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -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:  Project information
+*
+*/
+
+
+#include <platform_paths.hrh>
+ 
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+../group/psui.mmp
+
+PRJ_EXPORTS
+../inc/psuiresourceloader.h |../../../inc/psuiresourceloader.h
+../data/psui_stub.sis       /epoc32/data/z/system/install/psui_stub.sis
+
+// IBY Files
+../rom/psui.iby             CORE_APP_LAYER_IBY_EXPORT_PATH(psui.iby)
+../rom/psuiresources.iby    LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(psuiresources.iby)
+
+// LOC files
+../loc/psui.loc             MW_LAYER_LOC_EXPORT_PATH(psui.loc)
+
+ 
+//End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/group/psui.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,73 @@
+/*
+* 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:  Project specification file for the Phonesettings Notes Ui
+*
+*/
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+// Capability assignment.
+CAPABILITY CAP_GENERAL_DLL
+
+TARGET    psui.dll
+TARGETTYPE dll
+UID 0x1000008d 0x100059C6
+
+SOURCEPATH ../src 
+SOURCE psuibarringobs.cpp 
+SOURCE psuiwaitingobs.cpp 
+SOURCE psuidivertobs.cpp 
+SOURCE psuinotemaster.cpp 
+SOURCE psuiresourceloader.cpp 
+SOURCE psuicontainer.cpp 
+SOURCE psuicliobserver.cpp 
+SOURCE psuivariationproxy.cpp 
+#ifdef RD_PHONE_NG
+SOURCE psuiquerydialog.cpp 
+#endif // RD_PHONE_NG
+SOURCE psuireqobserver.cpp 
+SOURCE psuinotecontroller.cpp 
+
+START RESOURCE ../data/psui.rss 
+HEADER
+TARGETPATH RESOURCE_FILES_DIR
+// Language definition
+LANGUAGE_IDS
+
+END  // RESOURCE
+
+SYSTEMINCLUDE     ../../../inc
+
+USERINCLUDE    . ../inc 
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY bafl.lib 
+LIBRARY euser.lib 
+LIBRARY cone.lib 
+LIBRARY aknnotify.lib
+LIBRARY eikcoctl.lib 
+LIBRARY avkon.lib 
+LIBRARY commonengine.lib 
+LIBRARY etelmm.lib
+LIBRARY featmgr.lib 
+LIBRARY numbergrouping.lib
+LIBRARY servicerequest.lib
+LIBRARY centralrepository.lib
+#ifdef RD_PHONE_NG
+LIBRARY eikdlg.lib
+LIBRARY eikcore.lib
+#endif // RD_PHONE_NG
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/inc/psuiinternalconstants.h	Wed Jul 21 18:26:52 2010 +0300
@@ -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:  Constant values for the Phone Setting UI Notes
+*
+*/
+
+#ifndef CPSUIINTERNALCONSTANTS_H
+#define CPSUIINTERNALCONSTANTS_H
+
+// INCLUDES
+
+//CONSTANTS
+const TInt KPSUINoBscGroup = 255;      //unknown basic service group
+const TInt KPSUIDetailsText = 64;      //max. length of text in detailed note
+const TText KLRMarker = 0x200E;        //LRM marker
+
+// Phone Setting Notes UI's Note Controller Singleton UID
+static const TUid KUidNoteControllerSingleton = { 0x0C };
+
+_LIT( KPSUIListDivider, "\n" );        //list row divisor
+
+// Type of Call Forwarding request.
+//   EPsuiNoCF - not a call forwarding request
+//   EPsuiCFNry - call forwarding with number and timeout information
+//   EPsuiCFOther - call forwarding with number information
+enum TCFType
+    {
+    EPsuiNoCF = 1,
+    EPsuiCFNry, 
+    EPsuiCFOther
+    };
+
+// Note types.
+enum TPsuiNoteTypes
+    {
+    EPsuiConfirmationNote,
+    EPsuiWaitingNote,
+    EPsuiErrorNote,
+    EPsuiInformationNote
+    };
+
+#endif //CPSUIINTERNALCONSTANTS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/inc/psuinotecontroller.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,161 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*     Singleton class for controlling notes. 
+*
+*/
+
+
+#ifndef PSUINOTECONTROLLER_H
+#define PSUINOTECONTROLLER_H
+
+// INCLUDES
+#include <coemain.h>
+#include "psuinotemaster.h" 
+
+// CLASS DECLARATION
+
+class CPsuiNoteController : public CCoeStatic
+    {
+    public:  
+
+        /**    
+         * Returns an instance of this class. When called for the first
+         * time, a new instance is created and returned.  After that,
+         * calling InstanceL returns the same instance that was created
+         * earlier.
+         *   
+         * @return A pointer to a CPsuiNoteController object    
+         */    
+        static CPsuiNoteController* InstanceL();   
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CPsuiNoteController();
+
+        /**
+        * Shows the requested note. 
+        *
+        * @param aType Type of note to be shown
+        *    Error, confirmation, warning and waiting notes are supported.
+        * @param aResourceID Content text's resource ID for the note
+        */
+        void ShowNoteL( TPsuiNoteTypes aType, TInt aResourceID );
+
+        /**    
+        * Shows the basic service list assosiated with supplementary service
+        * activation or status check.
+        * 
+        * @param aResourceHeading Heading for the list
+        * @param aBsc List of basic service groups
+        */
+        void ShowBscListL( 
+            TInt aResourceHeading, 
+            TUint8 aBsc[KPSUIMaxBscNumber] );
+
+        /* 
+        * Same as above, except intended for CF basic service lists.
+        *
+        * @param aResourceHeading Heading for the list
+        * @param aList List of basic service groups and their statuses 
+        *              and settings
+        * @param aCFType Type of call forwarding
+        * @param aIndex Index of list item user has selected
+        * @return user action ID, i.e. what kind of list to show next
+        */
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/ 
+        TCFType ShowBscCFListL( 
+            TInt aResourceHeading, 
+            CMobilePhoneCFList& aList, 
+            TCFType aCFType,
+            TInt& aIndex );
+
+        /**
+        * Shows detailed info about the selected basic service group.
+        *
+        *   @param  aCFType Type of Call Forwarding, defines softkeys
+        *   @param  aSetting List of basic service groups and their statuses
+        *                    and settings
+        */
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/ 
+        void ShowCfInfoL( 
+            TCFType& aCFType,
+            const RMobilePhone::TMobilePhoneCFInfoEntryV1& aSetting );
+
+        /*
+        * Returns correct resource ID based on error code.
+        * 
+        *   @param aErrorCode Error code for which the resource ID is needed
+        *   @return Resource ID for the string text in the error note
+        */
+        TInt SetErrorNoteResourceID ( const TInt aErrorCode );
+        
+        /**
+        * Removes all notes that are being displayed by us.
+        */
+        void RemoveNotesL();
+
+        /**
+        * Kills waiting note when the request is completed.
+        */
+        void KillStaticNoteL();
+
+        /**
+        * Sets the connection to engine. 
+        * This is needed to provide user the possibility to cancel
+        * pending requests. All the pointers are set with same
+        * command, if in the future the amount of parameters comes
+        * too large, redesigning might be worth doing. 
+        *
+        * @param aWaitingEngine Reference to Phone Settings' object
+        * @param aBarringEngine Reference to Phone Settings' object
+        * @param aDivertEngine Reference to Phone Settings' object
+        * @param aCliEngine Reference to Phone Settings' object
+        */
+        void SetEngineContacts( MPsetCallWaiting* aWaitingEngine,
+            MPsetCallBarring* aBarringEngine, 
+            MPsetCallDiverting* aDivertEngine,
+            MPsetCli* aCliEngine);
+
+
+    private:
+
+        /**    
+         * Default constructor is private because we are using the
+         * singleton design pattern.
+         */    
+        CPsuiNoteController();  
+        
+        /**
+        * By default EPOC constructor is private.
+        */
+        void ConstructL();
+                        
+        
+    private:
+    
+        // Note Master does the actual showing of notes and lists
+        CPsuiNoteMaster* iNote;
+    };
+    
+#endif // PSUINOTECONTROLLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/inc/psuinotemaster.h	Wed Jul 21 18:26:52 2010 +0300
@@ -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:  
+*   CPsuiNoteMaster class is responsible for showing notes. It has also capa-
+*   bilities to show bsc list that is common for different features.
+*   Pending supplementary service request can be cancelled by the user.
+*
+*/
+
+
+#ifndef CPSUINOTEMASTER_H
+#define CPSUINOTEMASTER_H
+
+// INCLUDES
+#include <aknnotewrappers.h>
+#include <bldvariant.hrh>
+#include "psuiconstants.h" 
+#include "psuiinternalconstants.h" 
+#include "psetcalldiverting.h" 
+ 
+// FORWARD DECLARATIONS
+class MPsetCallWaiting;
+class MPsetCallBarring;
+class MPsetCli;
+class CAknWaitDialog;
+class CAknGlobalNote;
+class CAknPopupList;
+class CAknSinglePopupMenuStyleListBox;
+class CServiceRequest;
+class CPsuiReqObserver;
+class CPsuiQueryDialog;
+
+// CLASS DECLARATION
+
+/**
+*  CPsuiNoteMaster class is responsible for showing notes. It has also capa-
+*  bilities to show bsc list that is common for different features.
+*  Pending supplementary service request can be cancelled by the user.
+*  @lib psui.lib
+*  @since 1.0
+*/
+class CPsuiNoteMaster : public CBase
+    {
+    public: // Constructors and destructor
+                
+        /**
+        * Symbian OS two-phased constructor.
+        * 
+        * @return Returns CPsuiNoteMaster-pointer.
+        */
+        static CPsuiNoteMaster* NewL();
+        
+        /**
+        * Destructor 
+        */
+        ~CPsuiNoteMaster();
+    
+    private:
+        /**
+        * Symbian 2nd phase constructor.
+        */
+        void ConstructL();
+    
+    
+    public: //new
+        
+        /**
+        * Sets the connection to engine. 
+        * This is needed to provide user the possibility to cancel
+        * pending requests. All the pointers are set with same
+        * command, if in the future the amount of parameters comes
+        * too large, redesigning might be worth doing. 
+        *
+        * @param aWaitingEngine Reference to Phone Settings' object
+        * @param aBarringEngine Reference to Phone Settings' object
+        * @param aDivertEngine Reference to Phone Settings' object
+        * @param aCliEngine Reference to Phone Settings' object
+        */
+        void SetEngineContacts( MPsetCallWaiting* aWaitingEngine,
+            MPsetCallBarring* aBarringEngine, 
+            MPsetCallDiverting* aDivertEngine,
+            MPsetCli* aCliEngine);
+        
+        /**
+        * Shows the requested note. 
+        *
+        * @param aType Type of note to be shown
+        *    Error, confirmation, warning and waiting notes are supported.
+        * @param aResourceID Content text's resource ID for the note
+        */
+        void ShowNoteL( TPsuiNoteTypes aType, TInt aResourceID );
+        
+        /**
+        * Kills waiting note when the request is completed.
+        */
+        void KillStaticNoteL();
+        
+        /**    
+        * Shows the basic service list assosiated with supplementary service
+        * activation or status check.
+        * 
+        * @param aResourceHeading Heading for the list
+        * @param aBsc List of basic service groups
+        */
+        void ShowBscListL( 
+            TInt aResourceHeading, 
+            TUint8 aBsc[KPSUIMaxBscNumber] );
+        
+        /* 
+        * Same as above, except intended for CF basic service lists.
+        *
+        * @param aResourceHeading Heading for the list
+        * @param aList List of basic service groups and their statuses 
+        *              and settings
+        * @param aCFType Type of call forwarding
+        * @param aIndex Index of list item user has selected
+        * @return user action ID, i.e. what kind of list to show next
+        */
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/ 
+        TCFType ShowBscCFListL( 
+            TInt aResourceHeading, 
+            CMobilePhoneCFList& aList, 
+            TCFType aCFType,
+            TInt& aIndex );
+        
+        /**
+        * Shows detailed info about the selected basic service group.
+        *
+        *   @param  aCFType Type of Call Forwarding, defines softkeys
+        *   @param  aSetting List of basic service groups and their statuses
+        *                    and settings
+        */
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/ 
+        void ShowCfInfoL( 
+            TCFType& aCFType,
+            const RMobilePhone::TMobilePhoneCFInfoEntryV1& aSetting );
+        
+        /**
+        * Shows request cancelled note.
+        */
+        void ShowCancelRequestNoteL();
+        
+        /*
+        * Returns correct resource ID based on error code.
+        * 
+        *   @param aErrorCode Error code for which the resource ID is needed
+        *   @return Resource ID for the string text in the error note
+        */
+        TInt SetErrorNoteResourceID ( const TInt aErrorCode );
+                    
+        /**
+        * Called when service request
+        * is cancelled by the user.
+        */
+        void RequestNoteCancelledL();
+        
+    protected:
+    
+    
+    private: //new
+        
+        void AppendCFNumber( TDes& aString, const TDesC& aNumber);
+
+        void CreateListBoxL( 
+            TCFType aCFType, CAknSinglePopupMenuStyleListBox* aList );
+
+        void KillRequestL();
+
+        void SetTitleL( const TInt& aResourceHeading );        
+
+        HBufC* SetBsGroupLC( TUint8 aBscCode );                       
+
+        TBasicServiceGroups ChangeToGSM( const TInt& aBsc );
+        
+    private: // Member variables
+        
+        // General Service request
+        CServiceRequest*        iServiceRequest;
+        // Call Barrings engine
+        MPsetCallBarring*       iBarringEngine; 
+        // Reference to Call Waiting engine
+        MPsetCallWaiting*       iWaitingEngine;
+        // Reference to Call Diverts engine
+        MPsetCallDiverting*     iDivertEngine;
+        // Reference to Calling Identity engine
+        MPsetCli*               iCliEngine;
+        // There is an active request
+        TBool                   iRequesting;
+        // Basic Service Groups list
+        CAknPopupList*          iPopupList;
+        // Request note cancel observer
+        CPsuiReqObserver*       iReqObserver;
+        // Diverts additional information query
+        CPsuiQueryDialog*        iQuery;
+
+    };       
+#endif    //CPSUINOTEMASTER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/inc/psuiquerydialog.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,74 @@
+/*
+* 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:  Query dialog for handling key events.
+*
+*/
+
+/*
+*/
+
+#ifndef CPSUIQUERYDIALOG_H
+#define CPSUIQUERYDIALOG_H
+
+//  INCLUDES
+#include <AknQueryDialog.h> 
+
+NONSHARABLE_CLASS ( CPsuiQueryDialog ) : public CAknQueryDialog
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Symbian OS two-phased constructor.
+        * 
+        * @return Returns CPsuiQueryDialog -pointer.
+        */
+        static CPsuiQueryDialog* NewL( CAknQueryDialog::TTone aTone );
+
+        /**
+        * Constructor
+        */
+        CPsuiQueryDialog( CAknQueryDialog::TTone aTone );  
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CPsuiQueryDialog();  
+
+        
+    protected:
+
+        /**
+        * From CCoeControl  Handle key events. When a key event occurs, 
+        *                   CONE calls this function for each control on the control stack, 
+        *                   until one of them returns EKeyWasConsumed to indicate that it processed the key event.  
+        * @param aKeyEvent  The key event.
+        * @param aType      The type of the event: EEventKey, EEventKeyUp or EEventKeyDown.
+        * @return           Indicates whether or not the key event was used by this control.
+        */
+        TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
+
+        /**
+        * From CEikdialog   This function is called by the EIKON framework 
+        *                   if the user activates a button in the button panel. 
+        *                   It is not called if the Cancel button is activated, 
+        *                   unless the EEikDialogFlagNotifyEsc flag is set.
+        * @param aButtonId  The ID of the button that was activated
+        * @return           Should return ETrue if the dialog should exit, and EFalse if it should not.
+        */
+        TBool OkToExitL( TInt aCommand );        
+    };
+
+#endif // CPSUIQUERYDIALOG_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/inc/psuireqobserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,68 @@
+/*
+* 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: Declaration of CPsuiReqObserver class.
+*
+*/
+
+
+#ifndef CPSUIREQOBSERVER_H
+#define CPSUIREQOBSERVER_H
+
+// INCLUDES
+#include <mservicerequestobserver.h>          
+#include "psuinotemaster.h" 
+
+// FORWARD DECLARATIONS
+ 
+// CLASS DECLARATION
+
+/**
+*  CPsuiReqObserver class is responsible for observe request note cancel.
+*  @since 3.2
+*/
+NONSHARABLE_CLASS ( CPsuiReqObserver ) : public CBase , public MServiceRequestObserver
+    {
+    public: // Constructors and destructor
+                
+        /**
+        * Symbian OS two-phased constructor.
+        * 
+        */
+        static CPsuiReqObserver* NewL( CPsuiNoteMaster& aNoteMaster );
+        
+        /**
+        * Destructor 
+        */
+        ~CPsuiReqObserver();
+    
+    private:
+        CPsuiReqObserver( CPsuiNoteMaster& aNoteMaster );
+    
+    public: //new
+          
+    protected:        
+        /**
+        * From MServiceRequestObserver. Called when service request
+        * is cancelled by the user.
+        */
+        void MServiceRequestNoteCancelledL( TBool aCancelledWithEscape );
+        
+    private: //new
+           
+    private: // Member variables
+    
+        CPsuiNoteMaster& iNoteMaster;
+        
+        };       
+#endif    //CPSUIREQOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/inc/psuiresourceloader.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2002,2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Loads resources from file. 
+*
+*/
+
+
+#ifndef CPSUIRESOURCELOADER_H
+#define CPSUIRESOURCELOADER_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class RConeResourceLoader;
+
+// CLASS DECLARATION
+/**
+* A helper class for loading dll-specific resource files on demand. 
+* Searches and loads the specified resource file to the CONE environment 
+* (CCoeEnv) -object (accessible as iCoeEnv in CONE-related classes). 
+* After calling NewL the user can access the resources directly via 
+* the CONE environment. The resources in the file are accessible until 
+* the CPsuiResourceLoader object is destroyed. The resource file must be 
+* a well-formed UIKON resource file with NAME and RSS_SIGNATURE specified.
+*
+* @lib psui.lib
+* @since 1.0
+*/
+class CPsuiResourceLoader : public CBase
+    {
+    public:  // Constructors & destructor
+
+         /**
+         * Symbian OS 1st phase constructor. Creates and returns a new
+         * resource loader object. 
+         * Loads resource from any drive. If this function is succesful
+         * (doesn't leave) the resources in the file are usable through
+         * CCoeEnv.
+         * 
+         * @return new object of this class holding a reference to the
+         *                      resource file.
+         *
+         * @exception KErrNotFound  if the resource file is not found.
+         * @exception KErrNoMemory  if out of memory.
+         * @exception error         from CCoeEnv::AddResourceFileL.
+         */
+        IMPORT_C static CPsuiResourceLoader* NewL();
+
+         /**
+         * Same as NewL, but leaves the created object onto the cleanup stack.
+         * @see NewL
+         */
+        IMPORT_C static CPsuiResourceLoader* NewLC();
+
+         /* Destructor */
+        ~CPsuiResourceLoader();
+
+    protected:  // private constructor
+
+        void ConstructL();
+
+    private:  // member variables
+
+        // CONE resource loader
+        RConeResourceLoader* iResourceLoader;
+    };
+
+#endif  // CPSUIRESOURCELOADER_H
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/inc/psuivariationproxy.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,80 @@
+/*
+* 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:  
+*       CPsuiVariationProxy class is proxy class for 
+*       central repository variation
+*       (Call waiting/distinguish between not provisioned and not activated).
+*  
+*
+*/
+
+
+#ifndef PSUIVARIATIONPROXY_H
+#define PSUIVARIATIONPROXY_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CRepository;
+
+// CONSTANTS
+const TUint KCallWaitingDistiquishNotProvisioned = 0x00000001;
+
+// CLASS DECLARATION
+/**
+*  CPsuiVariationProxy class is proxy class for central repository variation
+*  @lib psui.lib
+*  @since 1.0
+*/
+NONSHARABLE_CLASS ( CPSuiVariationProxy ): public CBase 
+{
+public: //constructor & destructor
+
+    /* Symbian OS 2-phase Constructor. */
+    static CPSuiVariationProxy* NewL();
+    
+    /* Destructor */
+    ~CPSuiVariationProxy();
+    
+public:
+    /**
+    * Check from member variable 'iFeatures' is the requested feature active.
+    *
+    * @param aFeature is uid for used central repository variable.
+    * @return returns TBool type ETrue/EFalse is current feature enabled or not
+    */
+    
+    TBool FeatureEnabled( TUint aFeature ) const;
+
+private:
+    
+    /**
+    * Constructor
+    *
+    * Open CenRep, read data into 'iFeatures' and close CenRep
+    * 
+    */
+    void ConstructL();
+    
+private:
+    /* Default constructor */
+    CPSuiVariationProxy();
+private:
+    // Saves cen rep data. Readed in ConstructL()
+    TInt iFeatures;
+    
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/loc/psui.loc	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,305 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 Phone Settings UI Notes
+*
+*/
+
+
+//  LOCALISATION STRINGS
+
+//SUCCESFUL ACTIVATION
+//d: confirmation note when divert succesfully actived
+//l: popup_note_window
+#define text_divert_activated "Divert activated"
+
+//d: confirmation note when several diverts succesfully actived
+//l: popup_note_window
+#define qtn_div_conf_activateall "Diverts activated"
+
+//d: left sofktey
+//l: control_pane_t1/opt7
+#define qtn_div_softk_number "Number"
+
+//d: softkey text
+//l: control_pane_t1/opt7
+#define qtn_div_softk_detail "Details"
+
+//d: item when divert succesfully activated
+//d: (was previously qtn_div_check_number)
+//l: popup_note_image_window
+#define qtn_div_quest_number "To number: "
+
+//d: item when divert succesfully activated
+//d: (was previously qtn_div_check_delay)
+//l: popup_note_image_window
+#define qtn_div_quest_delay_time "Delay time: "
+
+//d: item when divert succesfully activated
+//l: popup_note_image_window
+#define text_ss_detail_delay_sec "%N seconds"
+
+//d: confirmation note when inquiry for divert active status
+//l: popup_note_window
+#define qtn_divert_active "Divert active"
+
+//DEACTIVATION OF CALL FORWARDING
+//d: confirmation note when divert is not active
+//l: popup_note_window
+#define text_divert_deactivated "Divert deactivated"
+
+//d: confirmation note when divert cancelled
+//l: popup_note_window
+#define text_divert_canceled "Divert cancelled"
+
+//d: confirmation note when several diverts cancelled
+//l: popup_note_window
+#define qtn_div_conf_cancelall "Diverts cancelled"
+
+//d: heading to the list of services divert is inactive for
+//l: heading_pane_t1
+#define qtn_div_heading_inactive "Inactive for:"
+
+//INTERROGATION OF CALL FORWARDING
+//d: confirmation note when divert is not active
+//l: popup_note_window
+#define text_divert_inactive "Divert not active"
+
+//    STATUS QUERY    
+//d: information note 1st row when receiving status from the network
+//l: popup_note_image_window
+#define qtn_div_info_easy "Divert to: "
+
+//d: information note 2nd row when diverted to voice mailbox 
+//l: popup_note_image_window
+#define qtn_div_info_voice_mailbox "Voice mailbox"
+
+//d: information note 2nd row when diverted to none 
+//l: popup_note_image_window
+#define qtn_div_info_to_none "None"
+
+//d: heading to the list where cf is active
+//l: heading_pane_t1
+#define qtn_div_heading_active "Active for:"
+
+//ERROR CASES
+//d: information note text when network has lost some cf information
+//l: popup_note_window
+#define text_net_info_lost "Check network services"
+
+//d: information note text when voice unconditional cf active 
+//d: and in call setup state
+//l: popup_note_window
+#define text_incoming_calls_diverted "Note: all incoming calls diverted"
+
+//d: information note text when voice conditional cf active 
+//d: and in call setup state
+//l: popup_note_window
+#define text_some_inc_calls_diverted "Note: you have active diverts"
+
+//d: error note text when entering invalid phone number
+//l: popup_note_window
+#define text_invalid_number "Invalid phone number"
+
+//d: information note that divert does not affect Internet calls 
+//d: when divert is actived
+//l: popup_note_window
+//w:
+//r: 3.0
+//
+#define qtn_voip_divert_not_supported "Diverting calls does not affect Internet calls"
+
+//TELECOMMUNICATION SERVICES
+//d: basic service group name, all tele and bearer services
+//l: list_single_pane_t1_cp2 
+#define text_bs_alpha_0 "All services"
+
+//d: basic service group name, all teleservices
+//l: list_single_pane_t1_cp2
+#define text_bs_alpha_10 "Voice, fax and messages"
+
+//d: basic service group name, telephony services
+//l: list_single_pane_t1_cp2
+#define text_bs_alpha_11 "Voice calls"
+
+//d: basic service group name, all data teleservices
+//l: list_single_pane_t1_cp2 
+#define text_bs_alpha_12 "Fax and messages"
+
+//d: basic service group name, facsimile services
+//l: list_single_pane_t1_cp2 
+#define text_bs_alpha_13 "Fax"
+
+//d: basic service group name, short message services
+//l: list_single_pane_t1_cp2 
+#define text_bs_alpha_16 "Messages"
+
+//d: basic service group name, all teleservices except sms
+//l: list_single_pane_t1_cp2 
+#define text_bs_alpha_19 "Voice calls and fax"
+
+//d: basic service group name, bearer services
+//l: list_single_pane_t1_cp2 
+#define text_bs_alpha_20 "Data services"
+
+//d: basic service group name, all async services
+//l: list_single_pane_t1_cp2 
+#define text_bs_alpha_21 "Asynchronous services"
+
+//d: basic service group name, all sync services
+//l: list_single_pane_t1_cp2 
+#define text_bs_alpha_22 "Synchronous services"
+
+//d: basic service group name, all data circuit sync
+//l: list_single_pane_t1_cp2 
+#define text_bs_alpha_24 "Synchronous data services"
+
+//d: basic service group name, all data circuit async
+//l: list_single_pane_t1_cp2 
+#define text_bs_alpha_25 "Asynchronous data services"
+
+//d: basic service group name, all dedicated packet accesses
+//l: list_single_pane_t1_cp2 
+#define text_bs_alpha_26 "Packet data"
+
+//d: basic service group name, all dedicated PAD accesses
+//l: list_single_pane_t1_cp2 
+#define text_bs_alpha_27 "PAD access"
+
+//d: basic service group name, alternate line services
+//l: list_single_pane_t1_cp2 
+#define text_bs_alpha_89 "Alternate line services"
+
+//d: basic service group name, video telephony services
+//l: list_single_pane_t1_cp2
+#define qtn_bs_alpha_30 "Video calls"
+
+//d: basic service group name, data and video services
+//l: list_single_pane_t1_cp2
+#define qtn_bs_alpha_20_vt "Data and video services"
+
+
+//CALL WAITING 
+//d: information note when call waiting is succesfully activated
+//l: popup_note_window
+#define text_call_waiting_activated "Call waiting activated"
+
+//d: information note when call waiting is succesfully cancelled
+//l: popup_note_window
+#define text_call_waiting_cancelled "Call waiting cancelled"
+
+//d: heading to the popup window displaying the result of call waiting inquiry
+//l: heading_pane_t1
+#define qtn_cw_status_heading "Active for:" 
+
+//d: information note when call waiting status asked, but no service active
+//l: popup_note_window
+#define text_call_waiting_not_active "Call waiting not active"
+
+//d: information note when call waiting status asked, 
+//d: but no basic service groups available
+//l: popup_note_window
+#define text_call_waiting_active "Call waiting active"
+
+
+//d: information note when call waiting status asked, but not provisioned
+//l: popup_note_window
+//r: 3.1
+#define qtn_cw_note_not_provisioned "Call waiting not provisioned"
+
+
+
+//CALL BARRING
+//d: heading to the popup window displaying the result of call barring inquiry
+//l: heading_pane_t1
+#define qtn_barr_heading_active "Active for:"
+          
+//d: confirmation note when barring is activated
+//l: popup_note_window
+#define text_barring_activated "Barring activated"
+
+//d: confirmation note when barring is cancelled
+//l: popup_note_window
+#define text_barring_canceled "Barring cancelled"
+
+//d: confirmation note when several barrings are cancelled
+//l: popup_note_window
+#define qtn_barr_conf_cancelall "Barrings cancelled"
+
+//d: result when interrogation of call barring reveals that barring not active
+//l: popup_note_window
+#define text_barring_not_active "Barring not active"
+
+//d: result when interrogation of call barring reveals that barring is active
+//l: popup_note_window
+#define text_barring_active "Barring active"
+
+//d: the barring password is incorrect
+//l: popup_note_window
+#define text_password_error "Password error"
+
+//d: barring password has been changed
+//l: popup_note_window
+#define text_password_changed "Password changed"
+
+//d: barring password has been blocked
+//l: popup_note_window
+#define qtn_paswd_info_code_blocked "Password blocked"
+
+//d: barring contact service needed
+//l: popup_note_window
+#define qtn_ss_barring_operation_not_successfull "Barring operation not successful. Contact your service provider"
+
+
+//CLI-notes
+//d: confirmation note when clir queried, positive answer
+//l: popup_note_window
+#define text_clir_active "Own No. not sent on calling"
+
+//d: confirmation note when clir queried, negative answer
+//l: popup_note_window
+#define text_clir_not_active "Own No. sent on calling"
+
+//d: confirmation note when clip queried, positive answer
+//l: popup_note_window
+#define text_clip_active "Number of caller is shown"
+
+//d: confirmation note when clip queried, negative answer
+//l: popup_note_window
+#define text_clip_not_active "Number of caller is not shown"
+
+//d: confirmation note when colp queried, positive answer
+//l: popup_note_window
+#define text_colp_active "Answering number is shown"
+
+//d: confirmation note when colp queried, negative answer
+//l: popup_note_window
+#define text_colp_not_active "Answering number is not shown"
+
+//d: confirmation note when colr queried, positive answer
+//l: popup_note_window
+#define text_colr_active "Own No. not sent on answering"
+
+//d: confirmation note when colr queried, negative answer
+//l: popup_note_window
+#define text_colr_not_active "Own No. sent on answering"
+
+//d: confirmation note when cnap queried, positive answer
+//l: popup_note_window
+#define qtn_cnap_active "Name of caller is shown" 
+
+//d: confirmation note when cnap queried, negative answer
+//l: popup_note_window
+#define qtn_cnap_not_active "Name of caller is not shown"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/rom/psui.iby	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* 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 psui stub compoment.
+*
+*/
+
+
+#ifndef __PSUI_IBY__
+#define __PSUI_IBY__
+
+REM PhoneSettings Notes UI
+
+file=ABI_DIR\BUILD_DIR\psui.dll       SHARED_LIB_DIR\psui.dll
+
+data=ZSYSTEM\install\psui_stub.sis    System\Install\psui_stub.sis
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/rom/psuiresources.iby	Wed Jul 21 18:26:52 2010 +0300
@@ -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: IBY file for psui resources.
+*
+*/
+
+
+#ifndef __PSUI_RESOURCES_IBY__
+#define __PSUI_RESOURCES_IBY__
+
+//Resource file(s) for Psui
+
+data=DATAZ_\RESOURCE_FILES_DIR\psui.rsc                                RESOURCE_FILES_DIR\psui.rsc
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/src/psuibarringobs.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -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:  Shows notes related to Call Barrings operations.
+*
+*/
+
+
+// INCLUDE FILES
+#include <psui.rsg> 
+#include <psuicontainer.h> 
+#include <exterror.h>
+#include <etelsat.h>
+
+#include "psuiinternalconstants.h" 
+#include "psuinotecontroller.h" 
+
+//  MEMBER FUNCTIONS
+// ---------------------------------------------------------------------------
+// Symbian OS two-phased Constructor.
+// ---------------------------------------------------------------------------
+EXPORT_C CPsuiBarringObs* CPsuiBarringObs::NewL( CPsuiContainer& aContainer )
+    {
+    CPsuiBarringObs* self = new( ELeave ) CPsuiBarringObs;
+    self->SetContainer( aContainer );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets container.
+// ---------------------------------------------------------------------------
+void CPsuiBarringObs::SetContainer( CPsuiContainer& aContainer )
+    {
+    iContainer = &aContainer;
+    }
+
+// ---------------------------------------------------------------------------
+// Handles changing of barring mode.
+// ---------------------------------------------------------------------------
+void CPsuiBarringObs::HandleBarringModeChangedL( TBarringProgram /* aType */, 
+                                                TBarringStatus aStatus, 
+                                                TBool aPlural )
+    {
+    if ( aStatus == EBarringStatusActive )
+        {
+        CPsuiNoteController::InstanceL()->ShowNoteL(
+            EPsuiConfirmationNote, 
+            R_CB_ACTIVE_NOTE );
+        }
+    else if ( aStatus == EBarringStatusInactive && !aPlural )
+        {
+        CPsuiNoteController::InstanceL()->ShowNoteL(
+            EPsuiConfirmationNote, 
+            R_CB_CANCEL_NOTE );
+        }
+    
+    else if ( aStatus == EBarringStatusInactive && aPlural )
+        {
+        CPsuiNoteController::InstanceL()->ShowNoteL(
+            EPsuiConfirmationNote, 
+            R_CB_PLURAL_CANCEL_NOTE );
+        }
+    }  
+
+// ---------------------------------------------------------------------------
+// Handles the get status notifications.
+// ---------------------------------------------------------------------------
+void CPsuiBarringObs::HandleBarringModeStatusL( TUint8 aBsc[KPSUIMaxBscNumber],
+                                               TBarringStatus aStatus )
+    {
+    if ( aStatus != EBarringStatusActive )
+        {
+        CPsuiNoteController::InstanceL()->ShowNoteL(
+            EPsuiConfirmationNote, 
+            R_BARRING_NOT_ACTIVE_NOTE );
+        }
+    else
+        {
+        //if no bsc-list, show "Barring active" note
+        if ( aBsc[0] == KPSUINoBscGroup )
+            {
+            CPsuiNoteController::InstanceL()->ShowNoteL(
+                EPsuiConfirmationNote, 
+                R_BARRING_ACTIVE_NOTE );
+            }
+        //otherwise show bsc-list
+        else
+            {
+            CPsuiNoteController::InstanceL()->ShowBscListL(
+                R_BARR_STATUS_HEADING, 
+                aBsc );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handles showing of error notes.
+// ---------------------------------------------------------------------------
+void CPsuiBarringObs::HandleBarringErrorL( TInt aReason )
+    {
+    if ( aReason != KErrSatControl  )
+        {
+        TInt errorResource( 
+            CPsuiNoteController::InstanceL()->SetErrorNoteResourceID( aReason ) ); 
+        CPsuiNoteController::InstanceL()->ShowNoteL( EPsuiErrorNote, errorResource );
+        }
+    } 
+
+// ---------------------------------------------------------------------------
+// Handles requesting notes (show/hide).
+// ---------------------------------------------------------------------------
+void CPsuiBarringObs::HandleCBRequestingL( TBool aOngoing, TBool aInterrupted )
+    {
+    if ( aInterrupted )
+        {
+        // if interrupted, means that incoming call and all notes must
+        // be immediately destroyed.
+        CPsuiNoteController::InstanceL()->RemoveNotesL();
+        return;
+        }
+    if ( aOngoing )
+        {
+        // show requesting note
+        CPsuiNoteController::InstanceL()->ShowNoteL( 
+            EPsuiWaitingNote, 
+            -1 );
+        }
+    else
+        {
+        // hide requesting note
+        CPsuiNoteController::InstanceL()->KillStaticNoteL();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handles call barring password notes.
+// ---------------------------------------------------------------------------
+void CPsuiBarringObs::CbPasswordChangedL( TBool aSuccess )
+    {
+    if ( aSuccess )
+        {
+        CPsuiNoteController::InstanceL()->ShowNoteL( 
+            EPsuiConfirmationNote, 
+            R_PASSWORD_CHANGED_NOTE );
+        }
+    else
+        {
+        HandleBarringErrorL( KErrGsmSSNegativePasswordCheck );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Sets engine contact for observer.
+// ---------------------------------------------------------------------------
+void CPsuiBarringObs::SetEngineContact( MPsetCallBarring* aBarringEngine )
+    {
+    CPsuiNoteController::InstanceL()->SetEngineContacts( 
+        NULL, 
+        aBarringEngine, 
+        NULL, 
+        NULL );
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/src/psuicliobserver.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,189 @@
+/*
+* 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:  Shows notes related to Call Identity operations.
+*
+*/
+
+
+// INCLUDE FILES
+#include <psui.rsg> 
+#include <featmgr.h>
+#include <etelsat.h>
+ 
+#include "psuicliobserver.h" 
+#include "psuicontainer.h" 
+#include "psuinotecontroller.h" 
+
+//  MEMBER FUNCTIONS
+
+// ---------------------------------------------------------------------------
+// Symbian OS two-phased constructor.
+// ---------------------------------------------------------------------------
+EXPORT_C CPsuiCliObserver* CPsuiCliObserver::NewL( CPsuiContainer& aContainer )
+    {
+    CPsuiCliObserver* self = new( ELeave ) CPsuiCliObserver;
+    CleanupStack::PushL( self );
+    // Sets up TLS, must be done before FeatureManager is used.
+    FeatureManager::InitializeLibL();    
+    CleanupStack::Pop( self );
+    self->SetContainer( aContainer );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Handles calling identity notes.
+// ---------------------------------------------------------------------------
+void CPsuiCliObserver::CliInformationL( TPsuiCli aType )
+    {
+    TInt resourceID = R_NOT_DONE_NOTE;
+    switch( aType ) 
+        {
+        case EPsuiClirOn:
+            resourceID = R_CLIR_ACTIVE_NOTE;
+            break;
+        case EPsuiClirOff:
+            resourceID = R_CLIR_INACTIVE_NOTE;
+            break;
+        case EPsuiClipOn:
+            resourceID = R_CLIP_ACTIVE_NOTE;
+            break;
+        case EPsuiClipOff:
+            resourceID = R_CLIP_INACTIVE_NOTE;
+            break;
+        case EPsuiColrOn:
+            resourceID = R_COLR_ACTIVE_NOTE;
+            break;
+        case EPsuiColrOff:
+            resourceID = R_COLR_INACTIVE_NOTE;
+            break;
+        case EPsuiColpOn:
+            resourceID = R_COLP_ACTIVE_NOTE;
+            break;
+        case EPsuiColpOff:
+            resourceID = R_COLP_INACTIVE_NOTE;
+            break;
+        case EPsuiCliUnknown:
+        default:
+            resourceID = R_NOT_DONE_NOTE;
+            break;
+        }
+    CPsuiNoteController::InstanceL()->ShowNoteL( 
+        EPsuiConfirmationNote, 
+        resourceID );
+    }
+
+// ---------------------------------------------------------------------------
+// Handles requesting notes (show/hide).
+// ---------------------------------------------------------------------------
+void CPsuiCliObserver::HandleCliRequestingL( TBool aOngoing, TBool aInterrupted )
+    {
+    if ( aInterrupted )
+        {
+        CPsuiNoteController::InstanceL()->RemoveNotesL();
+        }
+    else
+        {
+        if ( aOngoing )
+            {
+            CPsuiNoteController::InstanceL()->ShowNoteL( 
+                EPsuiWaitingNote, -1 );    
+            }
+        else
+            {
+            CPsuiNoteController::InstanceL()->KillStaticNoteL();
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Sets engine contact for observer.
+// ---------------------------------------------------------------------------
+void CPsuiCliObserver::SetEngineContact( MPsetCli* aEngine )
+    {
+    CPsuiNoteController::InstanceL()->SetEngineContacts( 
+        NULL, 
+        NULL, 
+        NULL, 
+        aEngine );
+    }
+
+// ---------------------------------------------------------------------------
+// Handles Cnap status requests.
+// ---------------------------------------------------------------------------
+void CPsuiCliObserver::HandleCnapStatusL( TInt 
+    aStatus 
+    )
+    {
+    if ( FeatureManager::FeatureSupported( KFeatureIdPhoneCnap ) )
+        {
+        switch ( aStatus )
+            {
+            case RMobilePhone::EIdServiceActivePermanent:        
+            case RMobilePhone::EIdServiceActiveDefaultAllowed:
+                CPsuiNoteController::InstanceL()->ShowNoteL( 
+                    EPsuiConfirmationNote, 
+                    R_CNAP_ACTIVE );
+                break;
+            case RMobilePhone::EIdServiceActiveDefaultRestricted:
+            case RMobilePhone::EIdServiceNotProvisioned:
+                CPsuiNoteController::InstanceL()->ShowNoteL( 
+                    EPsuiConfirmationNote, 
+                    R_CNAP_INACTIVE );
+                break;
+            default:
+                CPsuiNoteController::InstanceL()->ShowNoteL( 
+                    EPsuiConfirmationNote, 
+                    R_NOT_DONE_NOTE );
+                break;
+            }
+        }
+    else
+        {
+        CPsuiNoteController::InstanceL()->ShowNoteL( 
+            EPsuiConfirmationNote, 
+            R_NOT_DONE_NOTE );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handles errors.
+// ---------------------------------------------------------------------------
+void CPsuiCliObserver::HandleCliErrorL( TInt aError )
+    {
+    if ( aError != KErrSatControl  )
+        {
+        TInt errorResource = 
+            CPsuiNoteController::InstanceL()->SetErrorNoteResourceID( aError );
+        CPsuiNoteController::InstanceL()->ShowNoteL( EPsuiErrorNote, errorResource );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Sets container.
+// ---------------------------------------------------------------------------
+void CPsuiCliObserver::SetContainer( CPsuiContainer& aContainer )
+    {
+    iContainer = &aContainer;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor.
+// ---------------------------------------------------------------------------
+CPsuiCliObserver::~CPsuiCliObserver()
+    {
+    //Remove FeatureManager
+    FeatureManager::UnInitializeLib();    
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/src/psuicontainer.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,84 @@
+/*
+* 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:  Container object for the PSetNotes objects. 
+*
+*/
+
+
+//INCLUDES
+#include <psuicontainer.h> 
+
+#include "psuiresourceloader.h" 
+
+// ---------------------------------------------------------------------------
+// Symbian OS two-phased constructor.
+// ---------------------------------------------------------------------------
+EXPORT_C CPsuiContainer* CPsuiContainer::NewL()
+    {
+    CPsuiContainer* self = new ( ELeave ) CPsuiContainer;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian OS 2nd phase constructor.
+// ---------------------------------------------------------------------------
+void CPsuiContainer::ConstructL()
+    {
+    iAppEngineResourceLoader = CPsuiResourceLoader::NewL();
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor. 
+// ---------------------------------------------------------------------------
+CPsuiContainer::~CPsuiContainer()
+    {
+    delete iAppEngineResourceLoader;
+    }
+
+// ---------------------------------------------------------------------------
+// Creates cli observer. Ownership of the class is transferred.
+// ---------------------------------------------------------------------------
+EXPORT_C CPsuiCliObserver* CPsuiContainer::CreateCliObsL()
+    {    
+    return CPsuiCliObserver::NewL( *this );
+    }
+
+// ---------------------------------------------------------------------------
+// Creates call waiting observer. Ownership of the class is transferred.
+// ---------------------------------------------------------------------------
+EXPORT_C CPsuiWaitingObs* CPsuiContainer::CreateCWObsL()
+    {    
+    return CPsuiWaitingObs::NewL( *this );
+    }
+
+// ---------------------------------------------------------------------------
+// Creates call forward observer. Ownership of the class is transferred.
+// ---------------------------------------------------------------------------
+EXPORT_C CPsuiDivertObs* CPsuiContainer::CreateCFObsL()
+    {    
+    return CPsuiDivertObs::NewL( *this );
+    }
+
+// ---------------------------------------------------------------------------
+// Creates call barring observer. Ownership of the class is transferred.
+// ---------------------------------------------------------------------------
+EXPORT_C CPsuiBarringObs* CPsuiContainer::CreateCBObsL()
+    {    
+    return CPsuiBarringObs::NewL( *this );
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/src/psuidivertobs.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,211 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Shows notes and lists for Divert supplementary service
+*
+*/
+
+
+// INCLUDE FILES
+#include <psui.rsg> 
+#include <mmlist.h>
+#include <featmgr.h> 
+#include <psuicontainer.h> 
+#include <etelsat.h>
+
+#include "psuinotecontroller.h" 
+
+
+// ---------------------------------------------------------------------------
+// Symbian OS two-phased constructor.
+// ---------------------------------------------------------------------------
+EXPORT_C CPsuiDivertObs* CPsuiDivertObs::NewL( CPsuiContainer& aContainer )
+    {
+    CPsuiDivertObs* self = new ( ELeave ) CPsuiDivertObs;
+    self->SetContainer( aContainer );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets container.
+// ---------------------------------------------------------------------------
+void CPsuiDivertObs::SetContainer( CPsuiContainer& aContainer )
+    {
+    iContainer = &aContainer;
+    }
+
+// ---------------------------------------------------------------------------
+// Handles changing of diverting.
+// ---------------------------------------------------------------------------
+void CPsuiDivertObs::HandleDivertingChangedL( 
+    const TCallDivertSetting& aSetting, 
+    TBool aPlural )
+    {    
+    switch( aSetting.iStatus )
+        {
+        case EDivertingStatusActive:
+            if ( aPlural )
+                {
+                CPsuiNoteController::InstanceL()->ShowNoteL( 
+                    EPsuiConfirmationNote, R_PLURAL_ACTIVATE_NOTE );
+                }
+            else
+                {
+                CPsuiNoteController::InstanceL()->ShowNoteL( 
+                    EPsuiConfirmationNote, R_ACTIVATE_NOTE );
+                }
+            
+            // Diverting calls does not affect Internet calls    
+            if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) &&
+                 aSetting.iServiceGroup == EServiceGroupVoice )
+                {
+                CPsuiNoteController::InstanceL()->ShowNoteL( 
+                    EPsuiInformationNote, R_VOIP_DIVERT_NOT_SUPPORTED );
+                }
+            break;
+        case EDivertingStatusNotRegistered:
+        case EDivertingStatusInactive:
+            if ( aPlural )
+                {
+                CPsuiNoteController::InstanceL()->ShowNoteL( 
+                    EPsuiConfirmationNote, R_PLURAL_CANCEL_NOTE );
+                }
+            else
+                {
+                CPsuiNoteController::InstanceL()->ShowNoteL( 
+                    EPsuiConfirmationNote, R_CANCEL_NOTE );
+                }
+            break;
+        case EDivertingStatusNotProvisioned:
+        case EDivertingStatusUnknown:
+        default:
+            CPsuiNoteController::InstanceL()->ShowNoteL( 
+                EPsuiConfirmationNote, R_NOT_DONE_NOTE );
+        }
+    }  
+
+// ---------------------------------------------------------------------------
+// Handles the get status notifications.
+// ---------------------------------------------------------------------------
+/*****************************************************
+*    Series 60 Customer / ETel
+*    Series 60  ETel API
+*****************************************************/ 
+void CPsuiDivertObs::HandleDivertingStatusL( CMobilePhoneCFList&  aSetting, 
+                                            TBool /*aPlural*/ )
+    {
+    TInt index = 0;
+    TCFType action = EPsuiCFOther;
+    
+    //check the first item
+    RMobilePhone::TMobilePhoneCFInfoEntryV1 cfInfo;
+    cfInfo = aSetting.GetEntryL( index );
+    switch( cfInfo.iStatus )
+        {
+        case RMobilePhone::ECallForwardingStatusNotActive:
+            CPsuiNoteController::InstanceL()->ShowBscCFListL( 
+                R_TEXT_DIVERT_INACTIVE, 
+                aSetting, 
+                EPsuiNoCF, 
+                index );
+            break;
+        case RMobilePhone::ECallForwardingStatusActive:
+            while ( action != EPsuiNoCF )
+                {
+                if ( cfInfo.iTimeout > 0 ) //cfnry involved
+                    {
+                    action = EPsuiCFNry;
+                    }
+                else // other type of cf
+                    {
+                    action = EPsuiCFOther;
+                    }
+                action = CPsuiNoteController::InstanceL()->ShowBscCFListL(
+                    R_TEXT_DIVERT_ACTIVE,  
+                    aSetting,
+                    action, 
+                    index );
+                
+                if ( action != EPsuiNoCF ) //EPsuiCFNry or EPsuiCFOther                
+                    {
+                    cfInfo = aSetting.GetEntryL( index );                
+                    // display details-view with time and number
+                    CPsuiNoteController::InstanceL()->ShowCfInfoL( action, cfInfo );
+                    }
+                }
+            break;
+        case RMobilePhone::ECallForwardingStatusNotRegistered:
+            CPsuiNoteController::InstanceL()->ShowNoteL( 
+                EPsuiConfirmationNote, 
+                R_NOT_ACTIVE_NOTE );
+            break;
+        case RMobilePhone::ECallForwardingStatusNotProvisioned:
+            CPsuiNoteController::InstanceL()->ShowNoteL( 
+                EPsuiConfirmationNote, 
+                R_NOT_ALLOWED );
+            break;
+        default:
+            CPsuiNoteController::InstanceL()->ShowNoteL( 
+                EPsuiConfirmationNote, 
+                R_NOT_DONE_NOTE );
+            break;
+        }        
+    }
+
+// ---------------------------------------------------------------------------
+// Handles showing of error notes.
+// ---------------------------------------------------------------------------
+void CPsuiDivertObs::HandleDivertingErrorL( TInt aReason )
+    {
+    if ( aReason != KErrSatControl  )
+        {
+        TInt errorResource = 
+            CPsuiNoteController::InstanceL()->SetErrorNoteResourceID( aReason );
+        CPsuiNoteController::InstanceL()->ShowNoteL( EPsuiErrorNote, errorResource );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handles requesting notes (show/hide).
+// ---------------------------------------------------------------------------
+void CPsuiDivertObs::HandleCFRequestingL( TBool aTrue, TBool aInterrupted )
+    {
+    if ( aInterrupted )
+        {
+        CPsuiNoteController::InstanceL()->RemoveNotesL();
+        return;
+        }
+    if ( aTrue )
+        {
+        CPsuiNoteController::InstanceL()->ShowNoteL( 
+            EPsuiWaitingNote, -1 );
+        }
+    else
+        {
+        CPsuiNoteController::InstanceL()->KillStaticNoteL();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Sets engine contact for observer.
+// ---------------------------------------------------------------------------
+void CPsuiDivertObs::SetEngineContact( MPsetCallDiverting* aDivertEngine )
+    {
+    CPsuiNoteController::InstanceL()->SetEngineContacts( 
+        NULL, 
+        NULL, 
+        aDivertEngine, 
+        NULL );
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/src/psuinotecontroller.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,151 @@
+/*
+* 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 CPsuiNoteController class.
+*
+*/
+
+
+// INCLUDE FILES
+#include "psuinotecontroller.h" 
+#include "psuiinternalconstants.h" 
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CPsuiNoteController::CPsuiNoteController
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPsuiNoteController::CPsuiNoteController() : CCoeStatic( KUidNoteControllerSingleton )
+    {
+    }
+
+// Destructor
+CPsuiNoteController::~CPsuiNoteController()
+    {
+    delete iNote;
+    iNote = NULL; 
+    }
+
+// ---------------------------------------------------------
+// CPsuiNoteController::InstanceL
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+CPsuiNoteController* CPsuiNoteController::InstanceL()
+    {
+    CPsuiNoteController* instance = static_cast<CPsuiNoteController*>(
+        CCoeEnv::Static( KUidNoteControllerSingleton ) );
+    if ( !instance )
+        {
+        instance = new ( ELeave ) CPsuiNoteController;
+        CleanupStack::PushL( instance );
+        instance->ConstructL();
+        CleanupStack::Pop( instance );
+        }
+    return instance;
+    }
+
+// -----------------------------------------------------------------------------
+// CPsuiNoteController::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CPsuiNoteController::ConstructL()
+    {
+    iNote = CPsuiNoteMaster::NewL();
+    }
+
+// ---------------------------------------------------------
+// CPsuiNoteController::ShowNoteL
+// ---------------------------------------------------------
+//
+void CPsuiNoteController::ShowNoteL( TPsuiNoteTypes aType, TInt aResourceID )
+    {
+      iNote->ShowNoteL( aType, aResourceID );
+    }       
+
+// ---------------------------------------------------------
+// CPsuiNoteController::ShowBscListL
+// ---------------------------------------------------------
+//
+void CPsuiNoteController::ShowBscListL( TInt aResourceHeading, TUint8 aBsc[KPSUIMaxBscNumber] )
+    {
+      iNote->ShowBscListL( aResourceHeading, aBsc );
+    }
+
+// ---------------------------------------------------------
+// CPsuiNoteController::SetErrorNoteResourceID
+// ---------------------------------------------------------
+//
+TInt CPsuiNoteController::SetErrorNoteResourceID ( const TInt aErrorCode )
+    {
+      return iNote->SetErrorNoteResourceID( aErrorCode );
+    }
+
+// ---------------------------------------------------------
+// CPsuiNoteController::RemoveNotesL
+// ---------------------------------------------------------
+//
+void CPsuiNoteController::RemoveNotesL()
+    {
+      delete iNote;
+      iNote = NULL;
+      iNote = CPsuiNoteMaster::NewL();
+    }
+
+// ---------------------------------------------------------
+// CPsuiNoteController::KillStaticNoteL
+// ---------------------------------------------------------
+//
+void CPsuiNoteController::KillStaticNoteL()
+    {
+      iNote->KillStaticNoteL();
+    }
+
+// ---------------------------------------------------------
+// CPsuiNoteController::SetEngineContacts
+// ---------------------------------------------------------
+//
+void CPsuiNoteController::SetEngineContacts( MPsetCallWaiting* aWaitingEngine,
+    MPsetCallBarring* aBarringEngine, MPsetCallDiverting* aDivertEngine,
+    MPsetCli* aCliEngine )
+    {
+    iNote->SetEngineContacts( aWaitingEngine, aBarringEngine,
+        aDivertEngine, aCliEngine );    
+    }
+
+// ---------------------------------------------------------
+// CPsuiNoteController::ShowBscCFListL
+// ---------------------------------------------------------
+//
+TCFType CPsuiNoteController::ShowBscCFListL( TInt aResourceHeading, 
+    CMobilePhoneCFList& aList, TCFType aCFType, TInt& aIndex )
+    {
+    return iNote->ShowBscCFListL( aResourceHeading, aList,
+        aCFType, aIndex );  
+    }
+
+// ---------------------------------------------------------
+// CPsuiNoteController::ShowCfInfoL
+// ---------------------------------------------------------
+//
+void CPsuiNoteController::ShowCfInfoL( TCFType& aCFType,
+    const RMobilePhone::TMobilePhoneCFInfoEntryV1& aSetting )
+    {
+    iNote->ShowCfInfoL( aCFType, aSetting );    
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/src/psuinotemaster.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,772 @@
+/*
+* 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:  Note master class shows the actual notes.
+*
+*/
+
+
+// INCLUDE FILES
+#include <psui.rsg> 
+#include <aknlists.h>               
+#include <psuicontainer.h> 
+#include <StringLoader.h> 
+#include <exterror.h>               
+#include <gsmerror.h>
+#include <mmlist.h>
+#include <featmgr.h>
+#include <NumberGrouping.h> 
+#include <cservicerequest.h>
+#include <e32property.h>
+#include <BTSapDomainPSKeys.h> 
+
+#include "psuiinternalconstants.h" 
+#include "psuinotemaster.h" 
+#include "psuireqobserver.h" 
+#include "psuiquerydialog.h" 
+ 
+#include <centralrepository.h>
+#include <NumberGroupingCRKeys.h> 
+// MACROS
+
+#ifdef _DEBUG
+
+#define RDEBUG(X)             RDebug::Print(X);
+#define RDEBUG_INT(X,Y)       RDebug::Print(X,Y);
+#else           
+#define RDEBUG(X)
+#define RDEBUG_INT(X,Y)
+#endif
+
+//  MEMBER FUNCTIONS
+
+// ---------------------------------------------------------------------------
+// Symbian OS two-phased constructor.
+// ---------------------------------------------------------------------------
+CPsuiNoteMaster* CPsuiNoteMaster::NewL()
+    {  
+    CPsuiNoteMaster* self = new( ELeave ) CPsuiNoteMaster;
+    CleanupStack::PushL( self );
+    // Sets up TLS, must be done before FeatureManager is used.
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CPsuiNoteMaster::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CPsuiNoteMaster::ConstructL()
+    {
+    iReqObserver = CPsuiReqObserver::NewL( *this );
+    FeatureManager::InitializeLibL(); 
+    
+    iServiceRequest = CServiceRequest::NewL( *iReqObserver );
+ 
+    }
+
+
+// ---------------------------------------------------------------------------
+// Destructor.
+// ---------------------------------------------------------------------------
+CPsuiNoteMaster::~CPsuiNoteMaster()
+    {
+    //Remove FeatureManager
+    FeatureManager::UnInitializeLib();
+
+    delete iServiceRequest;
+    
+    delete iReqObserver;
+    
+    if ( iQuery )
+        {
+        delete iQuery;
+        iQuery = NULL;
+        }
+    
+    if ( iPopupList )
+        {
+        iPopupList->CancelPopup();
+        iPopupList = NULL;
+        }
+    
+    iBarringEngine = NULL;
+    iDivertEngine = NULL;
+    iWaitingEngine = NULL;
+    iCliEngine = NULL;
+    
+    }
+
+// ---------------------------------------------------------------------------
+// CPsuiNoteMaster::SetEngineContacts()
+// ---------------------------------------------------------------------------
+void CPsuiNoteMaster::SetEngineContacts( MPsetCallWaiting* aWaitingEngine,
+                                        MPsetCallBarring* aBarringEngine, 
+                                        MPsetCallDiverting* aDivertEngine, 
+                                        MPsetCli* aCliEngine )
+    {
+    iWaitingEngine = aWaitingEngine;
+    iBarringEngine = aBarringEngine;
+    iDivertEngine = aDivertEngine;
+    iCliEngine = aCliEngine;
+    }
+
+// ---------------------------------------------------------------------------
+// CPsuiNoteMaster::ShowNoteL()
+// ---------------------------------------------------------------------------
+void CPsuiNoteMaster::ShowNoteL( TPsuiNoteTypes aType, TInt aResourceID )
+    {
+    if ( aResourceID < 0 )
+        {
+        if ( aType  == EPsuiWaitingNote )
+            {
+            iRequesting = ETrue;
+            iServiceRequest->StartL( KNullDesC );
+            }
+        return; 
+        }
+
+    HBufC* string = StringLoader::LoadLC( aResourceID );    
+    
+    switch ( aType )
+        {
+        case EPsuiConfirmationNote:
+            {
+            iServiceRequest->ShowCompletionNoteL( 
+            ETrue,                                        // aShowNote
+            KErrNone,                                     // aError
+            CServiceRequest::ESerqGlobalConfirmationNote, // aNoteType 
+            string->Des() );                              // aText 
+            break;
+            }
+        case EPsuiErrorNote:
+            {
+            CServiceRequest::TSerqNoteType errorType = CServiceRequest::ESerqGlobalErrorNote;
+            if ( aResourceID == R_NO_SERVICE ||
+                aResourceID == R_NOT_ALLOWED )
+                {
+                errorType = CServiceRequest::ESerqGlobalInformationNote;
+                }
+            iServiceRequest->ShowCompletionNoteL( 
+            ETrue, 
+            KErrNone, 
+            errorType, 
+            string->Des() );
+            break;
+            }
+        case EPsuiInformationNote:
+            {
+            iServiceRequest->ShowCompletionNoteL( 
+            ETrue, 
+            KErrNone, 
+            CServiceRequest::ESerqGlobalInformationNote, 
+            string->Des() );
+            }
+        default:
+            break;
+        }
+    CleanupStack::PopAndDestroy( string );
+    string = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CPsuiNoteMaster::KillStaticNoteL()
+// ---------------------------------------------------------------------------
+void CPsuiNoteMaster::KillStaticNoteL()
+    {
+    if ( iRequesting )
+        {
+        delete iServiceRequest;
+        iServiceRequest = NULL;
+        iServiceRequest = CServiceRequest::NewL( *iReqObserver );
+        iRequesting =EFalse;
+        }
+     
+    }
+
+// ---------------------------------------------------------------------------
+// CPsuiNoteMaster::KillRequestL()
+// ---------------------------------------------------------------------------
+void CPsuiNoteMaster::KillRequestL()
+    {
+    if ( iWaitingEngine )
+        {
+        iWaitingEngine->CancelProcess();    
+        }
+    else if ( iBarringEngine )
+        {
+        iBarringEngine->CancelCurrentRequest();
+        }
+    else if ( iDivertEngine )
+        {
+        iDivertEngine->CancelCurrentRequest();
+        }
+    else if ( iCliEngine )
+        {
+        ShowCancelRequestNoteL();
+        iCliEngine->CancelAll();
+        }
+    }
+// ---------------------------------------------------------------------------
+// CPsuiNoteMaster::ShowBscListL()
+// ---------------------------------------------------------------------------
+void CPsuiNoteMaster::ShowBscListL( TInt aResourceHeading, 
+                                   TUint8 aBsc[KPSUIMaxBscNumber] )
+    {
+    if ( !iWaitingEngine && 
+         !iBarringEngine && 
+         !iDivertEngine  &&
+         !iCliEngine ) 
+        {
+        return;
+        }
+
+    if ( aResourceHeading < 0 )
+        {
+        User::Leave( KErrArgument );
+        }
+    
+    CAknSinglePopupMenuStyleListBox* list = 
+        new ( ELeave ) CAknSinglePopupMenuStyleListBox;
+    CleanupStack::PushL( list );
+    
+    CreateListBoxL( EPsuiNoCF, list );
+    
+    CDesCArray* items = new ( ELeave ) CDesCArrayFlat( KPSUIMaxBscNumber );
+    CleanupStack::PushL( items );
+    
+    CTextListBoxModel* model = list->Model();
+    if ( !model )
+        {
+        User::Leave( KErrGeneral );
+        }
+    model->SetItemTextArray( items );
+    model->SetOwnershipType( ELbmOwnsItemArray );
+    CleanupStack::Pop( items );   // listbox model now owns this
+    
+    SetTitleL( aResourceHeading );
+    
+    TUint8 numberOfBsc = 0;
+    HBufC* string = NULL;
+    while ( ( aBsc[numberOfBsc] != KPSUINoBscGroup ) &&
+            ( numberOfBsc < KPSUIMaxBscNumber ) )
+        {        
+        TUint8 bscCode = aBsc[numberOfBsc];        
+        string = SetBsGroupLC( bscCode );
+        
+        if ( string )
+            {
+            items->AppendL( *string );
+            CleanupStack::PopAndDestroy( string );
+            }
+        numberOfBsc++;
+        }        
+    
+    iPopupList->ExecuteLD();
+    iPopupList = NULL;
+    CleanupStack::PopAndDestroy( list );
+    }    
+
+// ---------------------------------------------------------------------------
+// Shows additional divert information.
+// ---------------------------------------------------------------------------
+/*****************************************************
+*    Series 60 Customer / ETel
+*    Series 60  ETel API
+*****************************************************/ 
+void CPsuiNoteMaster::ShowCfInfoL( TCFType& aCFType,
+                                  const RMobilePhone::TMobilePhoneCFInfoEntryV1& aSetting )
+    {
+    if ( aCFType == EPsuiNoCF )
+        {
+        User::Leave( KErrArgument );
+        }
+    
+    // Get base text and set phone number into it.
+    // Note that two characters are reserved for LRM markers.
+    TBuf<KPSUIDetailsText+2> string;    
+    StringLoader::Load( string, R_TO_NUMBER );
+    string.Append( KPSUIListDivider ); 
+
+    TInt pngErr( KErrNone );
+    TInt pngSupported( 0 );
+    CRepository* repository = CRepository::NewL( KCRUidNumberGrouping );
+    pngErr = repository->Get( KNumberGrouping, pngSupported );
+    delete repository;
+        
+    if ( KErrNone == pngErr && pngSupported != 0 )
+        {
+        CPNGNumberGrouping* numberGrouping = 
+            CPNGNumberGrouping::NewL( KPSUIMaxPSUIItemLength );
+        CleanupStack::PushL( numberGrouping );
+
+        //Check that number fits (with or w/o number formatting).
+        if ( (aSetting.iNumber.iTelNumber.Length() + 2) <= numberGrouping->MaxDisplayLength() )
+            {
+            numberGrouping->Set( aSetting.iNumber.iTelNumber );
+            AppendCFNumber( string, numberGrouping->FormattedNumber() );
+            }
+        else
+            {
+            AppendCFNumber( string, aSetting.iNumber.iTelNumber );
+            }
+        CleanupStack::PopAndDestroy( numberGrouping );
+        }
+    else
+        {
+        AppendCFNumber( string, aSetting.iNumber.iTelNumber );
+        }
+
+    //AVKON utils check whether or not conversion is needed
+    AknTextUtils::DisplayTextLanguageSpecificNumberConversion( string );    
+    string.Append( KPSUIListDivider );
+    
+    // Add delay time.
+    if ( aCFType == EPsuiCFNry )  
+        {
+        //Header + divider.
+        HBufC* delayTime = StringLoader::LoadLC( R_DELAY_TIME );
+        string.Append( *delayTime );
+        CleanupStack::PopAndDestroy( delayTime );
+        string.Append( KPSUIListDivider );
+        
+        TBuf<KPSUIMaxPSUIItemLength> writeBuffer;
+        HBufC* readBuffer = StringLoader::LoadLC( R_TEXT_SS_DETAIL_DELAY_SEC );
+        // format time, -1 means that there is no index in the key string.
+        StringLoader::Format( writeBuffer, *readBuffer, -1, aSetting.iTimeout );
+        CleanupStack::PopAndDestroy( readBuffer );
+        
+        string.Append( writeBuffer );
+        }
+    
+    iQuery = CPsuiQueryDialog::NewL( CAknQueryDialog::ENoTone );
+    TInt command( iQuery->ExecuteLD( R_CONFIRMATION_QUERY, string ) );
+    if( command == EKeyNo )
+        {
+        // End -key was pressed so don't relaunch previous query
+        aCFType = EPsuiNoCF;            
+        }
+    iQuery = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// Shows request cancelled note.
+// ---------------------------------------------------------------------------
+void CPsuiNoteMaster::ShowCancelRequestNoteL()
+    {
+    if ( iRequesting )
+        {
+        ShowNoteL( EPsuiInformationNote, R_REQUEST_CANCELLED_NOTE );    
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Returns resource ID for the most common error codes.
+// ---------------------------------------------------------------------------
+//
+TInt CPsuiNoteMaster::SetErrorNoteResourceID ( const TInt aErrorCode )
+    {
+    RDEBUG_INT( _L("PSUI.SetErrorNoteResourceID - code %d: "), aErrorCode )
+    TInt resourceID = KErrNone;    
+    switch ( aErrorCode  )
+        {
+        case KErrGsmSSSubscriptionViolation:
+            resourceID = R_CONTACT_SERVICE_NOTE;
+            break;            
+        case KErrGsmSSUnknownSubscriber:
+        case KErrGsmSSAbsentSubscriber:        
+        case KErrGsmSSIllegalOperation:
+        case KErrGsmSSIllegalSubscriber:
+        case KErrGsmSSIllegalEquipment:
+        case KErrGsmSSCallBarred:
+        case KErrGsmSSDataMissing:
+            resourceID = R_NOT_ALLOWED;
+            break;
+        case KErrGsmSSIncompatibility:
+            resourceID = R_SERVICES_IN_CONFLICT;
+            break;
+        case KErrGsmSSSystemFailure:
+            resourceID = R_RESULT_UNKNOWN;
+            break;        
+        case KErrGsmSSUnexpectedDataValue:
+        case KErrGsmSSResourcesUnavailable:
+            resourceID = R_REQUEST_REJECTED;
+            break;
+        case KErrGsmSSNegativePasswordCheck:
+        case KErrGsmSSPasswordRegistrationFailure:
+            resourceID = R_PASSWORD_ERROR_NOTE;
+            break;
+        case KErrGsmSSPasswordAttemptsViolation:
+            resourceID = R_PASSWORD_BLOCKED_NOTE;
+            break;
+        case KErrGsmSMSNoNetworkService:
+        case KErrGsmNoService:
+            resourceID = R_NO_SERVICE;
+            break;
+        case KErrSsActivationDataLost: 
+            resourceID = R_NET_INFO_LOST;
+            break;
+        case KErrGsmOfflineOpNotAllowed:
+            if ( FeatureManager::FeatureSupported( KFeatureIdOfflineMode ) )
+                {
+                TInt value = EBTSapNotConnected;
+                RProperty::Get(
+                    KPSUidBluetoothSapConnectionState,
+                    KBTSapConnectionState,
+                    value );
+                if ( value == EBTSapConnected )
+                    {
+                    resourceID = R_OFFLINE_MODE_SAP;    
+                    }
+                else
+                    {
+                    resourceID = R_OFFLINE_MODE;    
+                    }     
+                 }
+            break;            
+        default:
+            resourceID = R_NOT_DONE_NOTE;
+            break; 
+        }
+    return resourceID;
+    }
+
+// ---------------------------------------------------------------------------
+// CPsuiNoteMaster::ShowBscCFListL()
+// ---------------------------------------------------------------------------
+/*****************************************************
+*    Series 60 Customer / ETel
+*    Series 60  ETel API
+*****************************************************/ 
+TCFType CPsuiNoteMaster::ShowBscCFListL( TInt aResourceHeading, 
+                                        CMobilePhoneCFList& aList, 
+                                        TCFType aCFType,
+                                        TInt& aIndex )
+    {
+    //note master was deleted - do not create another bsc-list
+    if ( !iWaitingEngine && 
+         !iBarringEngine && 
+         !iDivertEngine  &&
+         !iCliEngine ) 
+        {
+        return EPsuiNoCF;
+        }
+
+    if ( aResourceHeading < 0 )
+        {
+        User::Leave( KErrArgument );
+        }
+    
+    CAknSinglePopupMenuStyleListBox* list = 
+        new ( ELeave ) CAknSinglePopupMenuStyleListBox;
+    CleanupStack::PushL( list );
+    
+    CreateListBoxL( aCFType, list );
+    
+    CDesCArray* items = new ( ELeave ) CDesCArrayFlat( KPSUIMaxBscNumber );
+    CleanupStack::PushL( items );
+    
+    CTextListBoxModel* model = list->Model();
+    if ( !model )
+        {
+        User::Leave( KErrGeneral );
+        }
+    model->SetItemTextArray( items );
+    model->SetOwnershipType( ELbmOwnsItemArray );
+    CleanupStack::Pop( items );
+    
+    SetTitleL( aResourceHeading );
+    
+    TInt entries = aList.Enumerate();
+    TInt numberOfBscs = 0;
+    RMobilePhone::TMobilePhoneCFInfoEntryV1 cfInfo;
+    HBufC* string = NULL;
+    while ( entries > numberOfBscs )
+        {
+        cfInfo = aList.GetEntryL( numberOfBscs );
+        string = SetBsGroupLC( 
+            static_cast <TUint8> ( ChangeToGSM( cfInfo.iServiceGroup ) ) );
+        // if no string was retrieved, ignore it.
+        if ( string )
+            {
+            items->AppendL( *string );
+            CleanupStack::PopAndDestroy( string );            
+            }
+        numberOfBscs++;
+        }
+    list->SetCurrentItemIndex( aIndex );
+    
+    TInt popupRet = iPopupList->ExecuteLD();
+    aIndex = list->CurrentItemIndex();
+    iPopupList = NULL;
+    CleanupStack::PopAndDestroy( list );
+    
+    if ( popupRet ) // if number or details softkey pressed
+        {
+        return aCFType;
+        }    
+    return EPsuiNoCF;
+    }    
+
+// ---------------------------------------------------------------------------
+// CPsuiNoteMaster::CreateListBoxL
+// ---------------------------------------------------------------------------
+void CPsuiNoteMaster::CreateListBoxL( TCFType aCFType, 
+                                     CAknSinglePopupMenuStyleListBox* aList )
+    {
+    TInt resourceId = 0;
+    if ( aCFType == EPsuiNoCF )
+        {
+        resourceId = R_AVKON_SOFTKEYS_BACK;
+        }
+    else if ( aCFType == EPsuiCFOther )
+        {    
+        resourceId = R_PSUI_SOFTKEYS_NUMBER_BACK;
+        }
+    else
+        {
+        resourceId = R_PSUI_SOFTKEYS_DETAILS_BACK;
+        }
+    
+    // Create popup list
+    iPopupList = CAknPopupList::NewL( aList, resourceId );
+    aList->ConstructL( iPopupList, CEikListBox::ELeftDownInViewRect );
+    aList->CreateScrollBarFrameL( ETrue );
+    aList->ScrollBarFrame()->SetScrollBarVisibilityL( 
+        CEikScrollBarFrame::EOff, 
+        CEikScrollBarFrame::EAuto );
+    }
+
+// ---------------------------------------------------------------------------
+// CPsuiNoteMaster::SetTitleL
+// ---------------------------------------------------------------------------
+void CPsuiNoteMaster::SetTitleL( const TInt& aResourceHeading )
+    {
+    TRAPD ( ignore, 
+        HBufC* string = StringLoader::LoadLC( aResourceHeading );
+        iPopupList->SetTitleL( *string );
+        CleanupStack::PopAndDestroy( string );
+        );
+    if ( ignore )
+        {
+        HBufC16* emptyHeader = NULL;
+        iPopupList->SetTitleL( emptyHeader->Des() );
+        delete emptyHeader;
+        }    
+    }
+// ---------------------------------------------------------------------------
+// CPsuiNoteMaster::AppendCFNumber
+// ---------------------------------------------------------------------------
+void CPsuiNoteMaster::AppendCFNumber( TDes& aString, const TDesC& aNumber )
+    {
+        aString.Append( KLRMarker );
+        aString.Append( aNumber );
+        aString.Append( KLRMarker );
+    }
+// ---------------------------------------------------------------------------
+// CPsuiNoteMaster::SetBsGroupLC
+// ---------------------------------------------------------------------------
+HBufC* CPsuiNoteMaster::SetBsGroupLC( TUint8 aBscCode )
+    {
+    HBufC* string = NULL;
+    switch( aBscCode )
+        {
+        case 0:
+            string = StringLoader::LoadLC( R_BS_ALPHA_0 );
+            break;
+        case 10:
+            string = StringLoader::LoadLC( R_BS_ALPHA_10 );
+            break;
+        case 11:
+            string = StringLoader::LoadLC( R_BS_ALPHA_11 );
+            break;
+        case 12:
+            string = StringLoader::LoadLC( R_BS_ALPHA_12 );
+            break;  
+        case 13:
+            string = StringLoader::LoadLC( R_BS_ALPHA_13 );
+            break;
+        case 16:
+            string = StringLoader::LoadLC( R_BS_ALPHA_16 );
+            break;
+        case 19:
+            string = StringLoader::LoadLC( R_BS_ALPHA_19 );
+            break;
+        case 20:
+            if ( FeatureManager::FeatureSupported( KFeatureIdCsVideoTelephony ) )
+                {
+                string = StringLoader::LoadLC( R_BS_ALPHA_20_VT );
+                }
+            else
+                {
+                string = StringLoader::LoadLC( R_BS_ALPHA_20 );
+                }
+            break;
+        case 21:
+            string = StringLoader::LoadLC( R_BS_ALPHA_21 );
+            break;
+        case 22:
+            string = StringLoader::LoadLC( R_BS_ALPHA_22 );
+            break;
+        case 24:
+            string = StringLoader::LoadLC( R_BS_ALPHA_24 );
+            break;
+        case 25:
+            string = StringLoader::LoadLC( R_BS_ALPHA_25 );
+            break;
+        case 26:
+            string = StringLoader::LoadLC( R_BS_ALPHA_26 );
+            break;
+        case 27:
+            string = StringLoader::LoadLC( R_BS_ALPHA_27 );
+            break;
+        case 30:
+            string = StringLoader::LoadLC( R_BS_ALPHA_30 );
+            break;
+        case 89:
+            string = StringLoader::LoadLC( R_BS_ALPHA_89 );
+            break;
+        default:
+            // all the services that are not displayed to ui
+            break;
+        }
+    return string;
+    }
+
+// ---------------------------------------------------------
+// CPsuiNoteMaster::ChangeToGSM
+//
+// ---------------------------------------------------------
+TBasicServiceGroups CPsuiNoteMaster::ChangeToGSM( const TInt& aBsc )
+    {
+    switch ( aBsc )
+        {               
+        case RMobilePhone::EAllServices:
+            return EAllTeleAndBearer;
+        case RMobilePhone::EAllTele:
+            return EAllTele;
+        case RMobilePhone::EVoiceService:
+        case RMobilePhone::ETelephony:
+            return ETelephony;
+        case RMobilePhone::EAllDataTele:
+            return EAllDataTele;
+        case RMobilePhone::EFaxService:
+            return EFax;
+        case RMobilePhone::EShortMessageService:
+            return ESms;
+        case RMobilePhone::EAllDataExSms:
+            return EAllDataExSms;
+        case RMobilePhone::EAllTeleExcSms:
+            return EAllTeleExcSms;
+        case RMobilePhone::EAllPlmnTele:
+            return EAllPlmnTele;
+        case RMobilePhone::EPlmnTele1:
+            return EPlmnTele1;
+        case RMobilePhone::EPlmnTele2:
+            return EPlmnTele2;
+        case RMobilePhone::EPlmnTele3:
+            return EPlmnTele3;
+        case RMobilePhone::EPlmnTele4:
+            return EPlmnTele4;
+        case RMobilePhone::EPlmnTele5:
+            return EPlmnTele5;
+        case RMobilePhone::EPlmnTele6:
+            return EPlmnTele6;
+        case RMobilePhone::EPlmnTele7:
+            return EPlmnTele7;
+        case RMobilePhone::EPlmnTele8:
+            return EPlmnTele8;
+        case RMobilePhone::EPlmnTele9:
+            return EPlmnTele9;
+        case RMobilePhone::EPlmnTeleA:
+            return EPlmnTeleA;
+        case RMobilePhone::EPlmnTeleB:
+            return EPlmnTeleB;
+        case RMobilePhone::EPlmnTeleC:
+            return EPlmnTeleC;
+        case RMobilePhone::EPlmnTeleD:
+            return EPlmnTeleD;
+        case RMobilePhone::EPlmnTeleE:
+            return EPlmnTeleE;
+        case RMobilePhone::EPlmnTeleF:
+            return EPlmnTeleF;
+        case RMobilePhone::EAllBearer:
+            return EAllBearer;
+        case RMobilePhone::EAllAsync:
+            return EAllAsync;
+        case RMobilePhone::EAllSync:
+            return EAllSync;
+        case RMobilePhone::ECircuitDataService:
+        case RMobilePhone::ESyncData:
+            return ESyncData;
+        case RMobilePhone::EPacketDataService:
+        case RMobilePhone::EAsyncData:
+            return EAsyncData;
+        case RMobilePhone::EPacketData:
+            return EPacketData;
+        case RMobilePhone::EPadAccess:
+            return EPadAccess;
+        case RMobilePhone::EAllPlmnBearer:
+            return EAllPlmnBearer;
+        case RMobilePhone::EPlmnBearerServ1:
+            return EPlmnBearerServ1;
+        case RMobilePhone::EPlmnBearerServ2:
+            return EPlmnBearerServ2;
+        case RMobilePhone::EPlmnBearerServ3:
+            return EPlmnBearerServ3;
+        case RMobilePhone::EPlmnBearerServ4:
+            return EPlmnBearerServ4;
+        case RMobilePhone::EPlmnBearerServ5:
+            return EPlmnBearerServ5;
+        case RMobilePhone::EPlmnBearerServ6:
+            return EPlmnBearerServ6;
+        case RMobilePhone::EPlmnBearerServ7:
+            return EPlmnBearerServ7;
+        case RMobilePhone::EPlmnBearerServ8:
+            return EPlmnBearerServ8;
+        case RMobilePhone::EPlmnBearerServ9:
+            return EPlmnBearerServ9;
+        case RMobilePhone::EPlmnBearerServA:
+            return EPlmnBearerServA;
+        case RMobilePhone::EPlmnBearerServB:
+            return EPlmnBearerServB;
+        case RMobilePhone::EPlmnBearerServC:
+            return EPlmnBearerServC;
+        case RMobilePhone::EPlmnBearerServD:
+            return EPlmnBearerServD;
+        case RMobilePhone::EPlmnBearerServE:
+            return EPlmnBearerServE;
+        case RMobilePhone::EPlmnBearerServF:
+            return EPlmnBearerServF;
+        case RMobilePhone::EAuxVoiceService:
+        case RMobilePhone::EAltTele:
+            return EAltTele;
+        case RMobilePhone::EServiceUnspecified:
+        default:
+            return EUnknown;
+        }
+    }
+    
+// -----------------------------------------------------------------------------
+// CPsuiNoteMaster::RequestNoteCancelledL
+// Called when the Requesting note is cancelled by the user.
+// -----------------------------------------------------------------------------
+//
+void CPsuiNoteMaster::RequestNoteCancelledL()
+    {
+    KillRequestL();
+    iRequesting = EFalse;        
+    }    
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/src/psuiquerydialog.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,76 @@
+/*
+* 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:  Query dialog for handling key events.
+*
+*/
+
+
+// INCLUDE FILES
+#include "psuiquerydialog.h" 
+
+// ================= MEMBER FUNCTIONS =======================
+
+// C++ default constructor can NOT contain any code, that
+// might leave.
+//
+CPsuiQueryDialog::CPsuiQueryDialog( CAknQueryDialog::TTone aTone ) :
+    CAknQueryDialog( aTone ) 
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian OS two-phased constructor.
+// ---------------------------------------------------------------------------
+CPsuiQueryDialog* CPsuiQueryDialog::NewL( CAknQueryDialog::TTone aTone )
+    {  
+    CPsuiQueryDialog* self = new( ELeave )CPsuiQueryDialog( aTone );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+// 
+CPsuiQueryDialog::~CPsuiQueryDialog()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CPsuiQueryDialog::OfferKeyEventL
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CPsuiQueryDialog::OfferKeyEventL( const TKeyEvent& aKeyEvent,
+    TEventCode aType )
+    {
+    if ( ( aKeyEvent.iScanCode == EStdKeyNo || aKeyEvent.iCode == EKeyNo  ) &&
+         aType == EEventKeyUp )
+        {
+        // End -key was pressed, so exit this query dialog
+        TryExitL( EKeyNo );
+        }
+
+    return EKeyWasNotConsumed;
+    }
+
+// ---------------------------------------------------------------------------
+// CPsuiQueryDialog::OkToExitL
+// ---------------------------------------------------------------------------
+//
+TBool CPsuiQueryDialog::OkToExitL( TInt /*aCommand*/ )
+    {
+    // Dismiss query
+    return ETrue;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/src/psuireqobserver.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* 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:  Request observer.
+*
+*/
+
+
+// INCLUDE FILES
+#include <psuicontainer.h> 
+
+#include "psuireqobserver.h" 
+  
+// MACROS
+
+// MEMBER FUNCTIONS
+
+// ---------------------------------------------------------------------------
+// Symbian OS two-phased constructor.
+// ---------------------------------------------------------------------------
+CPsuiReqObserver* CPsuiReqObserver::NewL( CPsuiNoteMaster& aNoteMaster )
+    {  
+    return new( ELeave ) CPsuiReqObserver( aNoteMaster );
+    }
+
+CPsuiReqObserver::CPsuiReqObserver( CPsuiNoteMaster& aNoteMaster ):
+    iNoteMaster(aNoteMaster)
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor.
+// ---------------------------------------------------------------------------
+CPsuiReqObserver::~CPsuiReqObserver()
+    {
+    }
+ 
+// -----------------------------------------------------------------------------
+// CPsuiNoteMaster::MServiceRequestNoteCancelledL
+// Called when the Requesting note is cancelled by the user.
+// -----------------------------------------------------------------------------
+//
+void CPsuiReqObserver::MServiceRequestNoteCancelledL( TBool /*aCancelledWithEscape*/ )
+    {
+    iNoteMaster.RequestNoteCancelledL();
+    }    
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/src/psuiresourceloader.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2002-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:  Loads resources from file.
+*
+*/
+
+
+// INCLUDE FILES
+#include <coemain.h>
+#include <ConeResLoader.h> 
+
+#include "psuiresourceloader.h" 
+
+// CONSTANTS
+_LIT( KPsuiResourceFileNameAndPath, "Z:\\resource\\Psui.rsc" );
+
+// MEMBER FUNCTIONS 
+//-----------------------------------------------------------------------------
+// Symbian OS two-phased constructor.
+//-----------------------------------------------------------------------------
+EXPORT_C CPsuiResourceLoader* CPsuiResourceLoader::NewL()
+    {
+    CPsuiResourceLoader* self = CPsuiResourceLoader::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+//-----------------------------------------------------------------------------
+// Symbian OS two-phased constructor.
+//-----------------------------------------------------------------------------
+EXPORT_C CPsuiResourceLoader* CPsuiResourceLoader::NewLC()
+    {
+    CPsuiResourceLoader* self = new( ELeave ) CPsuiResourceLoader;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+//-----------------------------------------------------------------------------
+// Destructor.
+//-----------------------------------------------------------------------------
+CPsuiResourceLoader::~CPsuiResourceLoader()
+    {
+    if ( iResourceLoader )
+        {
+        iResourceLoader->Close();
+        }
+    delete iResourceLoader;
+    iResourceLoader = NULL;
+    }
+
+// ----------------------------------------------------------------------------
+// 
+// Creates the resource loader and connects it with environment.
+// 
+// ----------------------------------------------------------------------------
+//
+void CPsuiResourceLoader::ConstructL()
+    {
+    iResourceLoader = new ( ELeave ) RConeResourceLoader( *CCoeEnv::Static() ); 
+    TFileName fileName ( KPsuiResourceFileNameAndPath ); 
+    iResourceLoader->OpenL( fileName );
+    }
+//  End of File  
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/src/psuivariationproxy.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation of CPSuiVariationProxy class.
+*
+*
+*/
+
+
+#include "psuivariationproxy.h" 
+#include <centralrepository.h>
+#include <settingsinternalcrkeys.h> 
+
+CPSuiVariationProxy::CPSuiVariationProxy()
+    {   
+    }
+    
+CPSuiVariationProxy::~CPSuiVariationProxy()
+    {       
+    }
+    
+CPSuiVariationProxy* CPSuiVariationProxy::NewL()
+    {
+    CPSuiVariationProxy* self = new ( ELeave ) CPSuiVariationProxy();  
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );         
+    return self;
+    }
+    
+void CPSuiVariationProxy::ConstructL()
+    {
+    TInt setting = 0;
+    CRepository* centralRepository = CRepository::NewLC( KCRUidPhoneSettings );
+    centralRepository->Get( KPSetCallWaiting, setting );
+    if( setting )
+        {
+        iFeatures |= KCallWaitingDistiquishNotProvisioned;  
+        }
+    CleanupStack::PopAndDestroy( centralRepository );
+    }
+    
+TBool CPSuiVariationProxy::FeatureEnabled( TUint aFeature ) const
+    {
+    return aFeature&iFeatures;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/src/psuiwaitingobs.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,168 @@
+/*
+* 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:  Handles requests for showing Call Waiting notes.
+*
+*/
+
+
+// INCLUDE FILES
+#include <psui.rsg> 
+#include <psuicontainer.h> 
+#include <etelsat.h>
+ 
+#include "psuiinternalconstants.h" 
+#include "psuinotecontroller.h" 
+#include "psuivariationproxy.h" 
+
+//  MEMBER FUNCTIONS
+// ---------------------------------------------------------------------------
+// Symbian OS two-phased Constructor.
+// ---------------------------------------------------------------------------
+EXPORT_C CPsuiWaitingObs* CPsuiWaitingObs::NewL( CPsuiContainer& aContainer )
+    {
+    CPsuiWaitingObs* self = new( ELeave ) CPsuiWaitingObs;
+    CleanupStack::PushL( self );
+    self->ConstructL( aContainer );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian OS 2nd phase Constructor.
+// ---------------------------------------------------------------------------
+void CPsuiWaitingObs::ConstructL( CPsuiContainer& aContainer )
+    {
+    iContainer = &aContainer;
+  
+    CPSuiVariationProxy* variationProxy = CPSuiVariationProxy::NewL();
+    CleanupStack::PushL( variationProxy );
+    iCallWaitingDistinguishEnabled = variationProxy->FeatureEnabled( KCallWaitingDistiquishNotProvisioned);
+    CleanupStack::PopAndDestroy( variationProxy );
+    
+    }
+
+// ---------------------------------------------------------------------------
+// Handles changing of call waiting.
+// ---------------------------------------------------------------------------
+void CPsuiWaitingObs::HandleCallWaitingChangedL
+( const MPsetCallWaiting::TSetCallWaiting aSetting, const TInt /* aResult */ )
+    {
+    if ( aSetting == MPsetCallWaiting::EActivateCallWaiting )
+        {
+        CPsuiNoteController::InstanceL()->ShowNoteL( 
+            EPsuiConfirmationNote, R_CW_ACTIVE_NOTE );
+        }
+    else if ( aSetting == MPsetCallWaiting::EDeactivateCallWaiting )
+        {
+        CPsuiNoteController::InstanceL()->ShowNoteL( 
+            EPsuiConfirmationNote, R_CW_CANCEL_NOTE );
+        }
+    }  
+
+// ---------------------------------------------------------------------------
+// Sets engine contact for observer.
+// ---------------------------------------------------------------------------
+void CPsuiWaitingObs::SetEngineContact( MPsetCallWaiting& aEngineContact )
+    {
+    CPsuiNoteController::InstanceL()->SetEngineContacts( 
+        &aEngineContact, NULL, NULL, NULL );
+    }
+
+// ---------------------------------------------------------------------------
+// Handles requesting notes (show/hide).
+// ---------------------------------------------------------------------------
+void CPsuiWaitingObs::HandleCWRequestingL( TBool aOngoing, TBool aInterrupted )
+    {
+    if ( aInterrupted )
+        {
+        CPsuiNoteController::InstanceL()->RemoveNotesL();
+        return;
+        }
+    
+    if ( aOngoing )
+        {
+        CPsuiNoteController::InstanceL()->ShowNoteL( 
+            EPsuiWaitingNote, -1 );
+        }
+    else
+        {
+        CPsuiNoteController::InstanceL()->KillStaticNoteL();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handles the get status notifications.
+// ---------------------------------------------------------------------------
+//
+void CPsuiWaitingObs::HandleCallWaitingGetStatusL( 
+    const MPsetCallWaiting::TGetCallWaitingStatus aStatus, 
+    TUint8 aBsc[KPSUIMaxBscNumber] )
+    {
+    
+    if ( iCallWaitingDistinguishEnabled && aStatus == MPsetCallWaiting::EStatusNotProvisioned )
+        {
+        CPsuiNoteController::InstanceL()->ShowNoteL( 
+            EPsuiConfirmationNote, R_CW_NOT_PROVISIONED_NOTE );
+        }
+    else if ( aStatus != MPsetCallWaiting::EStatusActive )
+        {
+        CPsuiNoteController::InstanceL()->ShowNoteL( 
+            EPsuiConfirmationNote, R_CW_NOT_ACTIVE_NOTE );
+        }
+    else
+        {
+        if( iCallWaitingDistinguishEnabled )
+            {
+                
+            //show only "CW active" even if the bsc list is present. 
+            //This change is to fix the error ENYI-6DYFKZ
+            CPsuiNoteController::InstanceL()->ShowNoteL( EPsuiConfirmationNote, 
+                R_CW_ACTIVE_NO_BSC_NOTE );
+            }
+        else
+            {
+                
+            //if no bsc-list present, show only "CW active"
+            if ( aBsc[0] == KPSUINoBscGroup )
+                {
+                CPsuiNoteController::InstanceL()->ShowNoteL( EPsuiConfirmationNote, 
+                R_CW_ACTIVE_NO_BSC_NOTE );
+                }
+            else
+                {
+            
+                CPsuiNoteController::InstanceL()->ShowBscListL( 
+                R_CW_STATUS_HEADING, 
+                aBsc );
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// This function handles errors in call waiting requests.
+// ---------------------------------------------------------------------------
+//
+void CPsuiWaitingObs::HandleCWErrorL( TInt aReason )
+    {
+    if ( aReason != KErrSatControl  )
+        {
+        TInt errorResource(
+            CPsuiNoteController::InstanceL()->SetErrorNoteResourceID( aReason ) );
+            
+        CPsuiNoteController::InstanceL()->ShowNoteL( EPsuiErrorNote, errorResource );
+        }
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/tsrc/public/basic/BWINS/T_PSetNotesUiU.DEF	Wed Jul 21 18:26:52 2010 +0300
@@ -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/cellular/psetnotesui/tsrc/public/basic/EABI/T_PSetNotesUiU.DEF	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z16CreateTestSuiteLv @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/tsrc/public/basic/Src/T_PSetNotesUi.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,152 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation of T_PSetNotesUi class.
+*
+*/
+
+
+//  CLASS HEADER
+#include "T_PSetNotesUi.h"
+
+//  EXTERNAL INCLUDES
+#include <EUnitMacros.h>
+#include <EUnitDecorators.h>
+#include <psuicontainer.h>
+
+//  INTERNAL INCLUDES
+
+
+// CONSTRUCTION
+T_PSetNotesUi* T_PSetNotesUi::NewL()
+    {
+    T_PSetNotesUi* self = T_PSetNotesUi::NewLC();
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+T_PSetNotesUi* T_PSetNotesUi::NewLC()
+    {
+    T_PSetNotesUi* self = new( ELeave ) T_PSetNotesUi();
+    CleanupStack::PushL( self );
+
+    self->ConstructL();
+
+    return self;
+    }
+
+// Destructor (virtual by CBase)
+T_PSetNotesUi::~T_PSetNotesUi()
+    {
+    }
+
+// Default constructor
+T_PSetNotesUi::T_PSetNotesUi()
+    {
+    }
+
+// Second phase construct
+void T_PSetNotesUi::ConstructL()
+    {
+    // The ConstructL from the base class CEUnitTestSuiteClass must be called.
+    // It generates the test case table.
+    CEUnitTestSuiteClass::ConstructL();
+    }
+
+//  METHODS
+
+
+void T_PSetNotesUi::SetupL(  )
+    {
+    iContainer = CPsuiContainer::NewL();
+    }
+    
+
+void T_PSetNotesUi::Teardown(  )
+    {
+    delete iContainer;
+    }
+ 
+void T_PSetNotesUi::T_TestL()
+    {
+    }
+    
+void T_PSetNotesUi::T_Test2L()
+    {
+    CPsuiWaitingObs* waitingObs = iContainer->CreateCWObsL();
+    delete waitingObs;
+    }
+    
+void T_PSetNotesUi::T_Test3L()
+    {
+    CPsuiDivertObs* divertObs = iContainer->CreateCFObsL();
+    delete divertObs;
+    }    
+    
+void T_PSetNotesUi::T_Test4L()
+    {
+    CPsuiBarringObs* cbObs = iContainer->CreateCBObsL();
+    delete cbObs;
+    }
+
+void T_PSetNotesUi::T_Test5L()
+    {
+    CPsuiCliObserver* cliObs = iContainer->CreateCliObsL();
+    delete cliObs;
+    }     
+             
+//  TEST TABLE
+EUNIT_BEGIN_TEST_TABLE(
+    T_PSetNotesUi,
+    "Add test suite description here.",
+    "MODULE" )
+
+EUNIT_TEST(
+    "CPsuiContainer::NewL",
+    "",
+    "CPsuiContainer::NewL",
+    "FUNCTIONALITY",
+    SetupL, T_TestL, Teardown)
+
+EUNIT_TEST(
+    "CreateCWObsL",
+    "",
+    "CreateCWObsL",
+    "FUNCTIONALITY",
+    SetupL, T_Test2L, Teardown)    
+
+EUNIT_TEST(
+    "CreateCFObsL",
+    "",
+    "CreateCFObsL",
+    "FUNCTIONALITY",
+    SetupL, T_Test3L, Teardown)  
+    
+EUNIT_TEST(
+    "CreateCBObsL",
+    "",
+    "CreateCBObsL",
+    "FUNCTIONALITY",
+    SetupL, T_Test4L, Teardown)
+
+EUNIT_TEST(
+    "CreateCliObsL",
+    "",
+    "CreateCliObsL",
+    "FUNCTIONALITY",
+    SetupL, T_Test5L, Teardown)        
+      
+EUNIT_END_TEST_TABLE
+
+//  END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/tsrc/public/basic/Src/T_PSetNotesUi.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,83 @@
+/*
+* 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: Declaration of T_PSetNotesUi class.
+*
+*/
+
+
+#ifndef __T_PSETNOTESUI_H__
+#define __T_PSETNOTESUI_H__
+
+//  EXTERNAL INCLUDES
+#include <CEUnitTestSuiteClass.h>
+#include <EUnitDecorators.h>
+
+
+//  INTERNAL INCLUDES
+
+
+//  FORWARD DECLARATIONS
+class CPsuiContainer;
+
+//  CLASS DEFINITION
+/**
+ * TODO Auto-generated EUnit test suite
+ *
+ */
+NONSHARABLE_CLASS( T_PSetNotesUi )
+	: public CEUnitTestSuiteClass
+    {
+    public:     // Constructors and destructors
+
+        /**
+         * Two phase construction
+         */
+        static T_PSetNotesUi* NewL();
+        static T_PSetNotesUi* NewLC();
+        /**
+         * Destructor
+         */
+        ~T_PSetNotesUi();
+
+    private:    // Constructors and destructors
+
+        T_PSetNotesUi();
+        void ConstructL();
+
+    private:    // New methods
+
+         void SetupL();
+        
+         void Teardown();
+        
+         void T_TestL();
+         void T_Test2L();
+         void T_Test3L();
+         void T_Test4L();
+         void T_Test5L();
+         void T_Test6L();
+         void T_Test7L();
+        
+
+    private:    // Data
+		
+        CPsuiContainer* iContainer;
+        
+        EUNIT_DECLARE_TEST_TABLE; 
+
+    };
+
+#endif      //  __T_PSETNOTESUI_H__
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/tsrc/public/basic/Src/T_PSetNotesUi_DllMain.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* 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: Entry point for psetnotesui test.
+*
+*/
+
+
+//  CLASS HEADER
+#include "T_PSetNotesUi.h"
+
+//  EXTERNAL INCLUDES
+#include <CEUnitTestSuite.h>
+
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return T_PSetNotesUi::NewL();
+    }
+
+#ifndef EKA2
+GLDEF_C TInt E32Dll( TDllReason )
+	{
+	return KErrNone;
+	}
+#endif
+
+//  END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/tsrc/public/basic/group/T_PSetNotesUi.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -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:  Project specification file
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET          T_PSetNotesUi.dll
+TARGETTYPE      dll
+TARGETPATH      /DigiaEUnit/Tests
+UID             0x1000af5a 0x01700000
+
+CAPABILITY              ALL -TCB -DRM
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../Src
+SOURCE                  T_PSetNotesUi.cpp
+
+// Sources required by the test suite
+SOURCEPATH              ../Src
+SOURCE                  T_PSetNotesUi_DllMain.cpp
+
+USERINCLUDE             ../Src
+
+SYSTEMINCLUDE           /epoc32/include/Digia/EUnit
+MW_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY                 EUnit.lib
+LIBRARY                 EUnitUtil.lib
+LIBRARY                 euser.lib
+LIBRARY                 psui.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/tsrc/public/basic/group/T_PSetNotesUi.pkg	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,33 @@
+;
+; 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: For packing psetnotesui test component.
+;
+; Supported languages
+&en
+
+; Package header (one name for each supported language)
+#{"T_PSetNotesUi"},(0x01700000),1,0,0
+
+;Localised Vendor name
+%{"Nokia Test EN"}
+
+;Unique Vendor name
+:"Vendor"
+
+;Key and certificate
+*"rd-key.pem","rd.cer"
+
+; Language independent files that are always installed
+"\epoc32\release\armv5\urel\T_PSetNotesUi.dll"-"C:\DigiaEUnit\Tests\T_PSetNotesUi.dll"
+"\epoc32\release\armv5\urel\T_PSetNotesUi.dll"-"C:\sys\bin\T_PSetNotesUi.dll"
Binary file cellular/psetnotesui/tsrc/public/basic/group/T_PSetNotesUi.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/tsrc/public/basic/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file
+*
+*/
+
+#include  <platform_paths.hrh>
+
+PRJ_PLATFORMS
+    ARMV5 GCCE WINSCW
+
+PRJ_EXPORTS
+//../rom/T_PSetNotesUI.iby                 CORE_APP_LAYER_IBY_EXPORT_PATH(T_PSetNotesUI.iby)
+
+PRJ_MMPFILES
+
+PRJ_TESTMMPFILES
+T_PSetNotesUi.mmp
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/psetnotesui/tsrc/public/basic/rom/T_PSetNotesUI.iby	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,23 @@
+/*
+* 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
+ *
+*/
+
+#ifndef __T_PSETNOTESUI_IBY__
+#define __T_PSETNOTESUI_IBY__
+ 
+file= ABI_DIR\BUILD_DIR\T_PSetNotesUI.dll   SHARED_LIB_DIR\T_PSetNotesUI.dll
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/servicerequest/bmarm/servicerequestu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,6 @@
+EXPORTS
+	NewL__15CServiceRequestR23MServiceRequestObserver @ 1 NONAME R3UNUSED ; CServiceRequest::NewL(MServiceRequestObserver &)
+	ShowCompletionNoteL__15CServiceRequestiiQ215CServiceRequest13TSerqNoteTypeRC7TDesC16 @ 2 NONAME ; CServiceRequest::ShowCompletionNoteL(int, int, CServiceRequest::TSerqNoteType, TDesC16 const &)
+	StartL__15CServiceRequestRC7TDesC16 @ 3 NONAME R3UNUSED ; CServiceRequest::StartL(TDesC16 const &)
+	"_._15CServiceRequest" @ 4 NONAME R3UNUSED ; CServiceRequest::~CServiceRequest(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/servicerequest/bwins/servicerequestu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,6 @@
+EXPORTS
+	??1CServiceRequest@@UAE@XZ @ 1 NONAME ; public: virtual __thiscall CServiceRequest::~CServiceRequest(void)
+	?NewL@CServiceRequest@@SAPAV1@AAVMServiceRequestObserver@@@Z @ 2 NONAME ; public: static class CServiceRequest * __cdecl CServiceRequest::NewL(class MServiceRequestObserver &)
+	?ShowCompletionNoteL@CServiceRequest@@QAEXHHW4TSerqNoteType@1@ABVTDesC16@@@Z @ 3 NONAME ; public: void __thiscall CServiceRequest::ShowCompletionNoteL(int,int,enum CServiceRequest::TSerqNoteType,class TDesC16 const &)
+	?StartL@CServiceRequest@@QAEXABVTDesC16@@@Z @ 4 NONAME ; public: void __thiscall CServiceRequest::StartL(class TDesC16 const &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/servicerequest/data/servicerequest.rss	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,111 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 general Service Request
+*
+*/
+
+
+
+// RESOURCE IDENTIFIER
+NAME SERQ
+
+// INCLUDES
+
+#include <eikon.rh>
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.hrh>
+#include <avkon.mbg>
+
+#include <avkon.loc>
+#include "servicerequest.hrh" 
+
+RESOURCE RSS_SIGNATURE { }
+
+
+// -----------------------------------------------------------------------------
+// 
+// r_serq_requesting_wait_note
+// Wait dialog for the servivce request.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_serq_requesting_wait_note
+    {
+    flags = EAknWaitNoteFlags  | EEikDialogFlagWait;
+    buttons=R_AVKON_SOFTKEYS_QUIT;
+    items=
+        {
+        DLG_LINE
+            {
+            type=EAknCtNote;
+            id = ESerqRequestingNote;
+            control= AVKON_NOTE 
+                { 
+                layout = EWaitLayout;
+                singular_label = text_sending;
+                animation = R_QGN_GRAF_WAIT_BAR_ANIM;
+                };
+            }
+        };
+    }
+
+// Used texts in notes:
+
+RESOURCE TBUF r_text_unconfirmed
+    {
+    buf = text_unconfirmed;
+    }
+
+RESOURCE TBUF r_text_not_done
+    {
+    buf = text_not_done;
+    }
+
+RESOURCE TBUF r_text_not_allowed
+    {
+    buf = text_not_allowed;
+    }
+
+RESOURCE TBUF r_text_result_unknown
+    {
+    buf = text_result_unknown;
+    }
+
+RESOURCE TBUF r_text_done
+    {
+    buf = text_done;
+    }
+
+RESOURCE TBUF r_text_no_service
+    {
+    buf = text_no_service;
+    }
+
+RESOURCE TBUF r_qtn_srvrq_info_confl
+    {
+    buf = qtn_srvrq_info_confl;
+    }
+
+RESOURCE TBUF r_text_request_rejected
+    {
+    buf = text_request_rejected;
+    }
+    
+RESOURCE TBUF r_password_error_note  
+    { 
+    buf = qtn_mem_card_unlock_error;
+    }    
+  
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/servicerequest/data/servicerequest_stub.pkg	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,33 @@
+;
+; 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:
+;
+; servicerequest_stub.pkg
+
+; Languages
+&EN
+
+; Header
+#{"servicerequest"},(0x10005A3D),1,0,0,TYPE=SA
+
+;Localised Vendor name
+%{"Nokia"}
+
+;Unique Vendor name
+:"Nokia"
+
+; Target
+
+""-"z:\sys\bin\servicerequest.dll"
+""-"z:\resource\ServiceRequest.rsc"
Binary file cellular/servicerequest/data/servicerequest_stub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/servicerequest/eabi/servicerequestu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,10 @@
+EXPORTS
+	_ZN15CServiceRequest19ShowCompletionNoteLEiiNS_13TSerqNoteTypeERK7TDesC16 @ 1 NONAME
+	_ZN15CServiceRequest4NewLER23MServiceRequestObserver @ 2 NONAME
+	_ZN15CServiceRequest6StartLERK7TDesC16 @ 3 NONAME
+	_ZN15CServiceRequestD0Ev @ 4 NONAME
+	_ZN15CServiceRequestD1Ev @ 5 NONAME
+	_ZN15CServiceRequestD2Ev @ 6 NONAME
+	_ZTI15CServiceRequest @ 7 NONAME
+	_ZTV15CServiceRequest @ 8 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/servicerequest/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 Service Request module
+*
+*/
+
+#include  <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../inc/cservicerequest.h            |../../../inc/cservicerequest.h
+../inc/mservicerequestobserver.h    |../../../inc/mservicerequestobserver.h
+../data/servicerequest_stub.sis     /epoc32/data/z/system/install/servicerequest_stub.sis
+../rom/servicerequest.iby           CORE_APP_LAYER_IBY_EXPORT_PATH(servicerequest.iby)
+../rom/servicerequestresources.iby  LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(servicerequestresources.iby)
+
+PRJ_MMPFILES
+../group/servicerequest.mmp
+ 
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/servicerequest/group/servicerequest.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* 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:  General Service Request module
+*
+*/
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+// Capability assignment.
+CAPABILITY CAP_GENERAL_DLL
+
+TARGET          servicerequest.dll
+TARGETTYPE      DLL
+UID             0x1000008d 0x10005A3D
+
+SOURCEPATH      ../src
+SOURCE          cservicerequest.cpp 
+
+// Resource files
+START RESOURCE ../data/servicerequest.rss 
+TARGETPATH RESOURCE_FILES_DIR
+HEADER
+LANGUAGE_IDS
+END
+
+USERINCLUDE     ../inc
+
+SYSTEMINCLUDE   ../../../inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib cone.lib avkon.lib commonengine.lib
+LIBRARY         aknnotify.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/servicerequest/inc/cservicerequest.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,207 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Interface for service request
+*
+*/
+
+
+
+#ifndef CSERVICEREQUEST_H
+#define CSERVICEREQUEST_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <AknProgressDialog.h> 
+
+// FORWARD DECLARATIONS
+class MServiceRequestObserver;
+class CAknWaitDialog;
+class RConeResourceLoader;
+
+// CLASS DECLARATION
+
+/**
+*  Interface for service request
+*
+* -Create instance by calling the static NewL method. User must implement the
+*  observer interface MServiceRequestObserver. Cancelling the wait note is 
+*  informed through this API.
+*
+*  iServiceRequest = CServiceRequest::NewL( *this );
+*
+*
+* -The instance can be deleted at any time and all notes are dismissed.
+*
+*  delete iServiceRequest;
+*
+*
+* -The wait note can be launched by calling StartL function:
+*
+*  iServiceRequest->StartL();
+*
+*  By default the text "Requesting" is used, but the user may give the text
+*  as a parameter:
+*
+*  iServiceRequest->StartL( _L("Please wait...") );
+*
+*  Call to the StartL function will delete own notes visible at the call time.
+*
+*
+* -Wait note can deleteted by calling the ShowCompletionNoteL function. This removes
+*  all own notes. If the user wants to show a completion note for the request,
+*  the parameter aShowNote must be set to ETrue. Creation of a new note may leave.
+*  By deafult the Supplementary Service UI specification texts and note types are
+*  used. The user may override some parameters, like note type and text. By default,
+*  the error code is converted into note, e.g.:
+*      KErrNone, Global confirmation note "Done"
+*      KErrCancel, Local information note "Request not confirmed"
+*      KErrAccessDenied, Global information note "Not allowed"
+*  and so on.
+*
+*
+*
+*  @lib ServiceRequest.lib
+*  @since 1.2
+*/
+class CServiceRequest : public CActive, public MProgressDialogCallback
+    {
+    public:  // Constructors and destructor
+
+        // Used note types
+        enum TSerqNoteType
+            {
+            ESerqDefault,
+            ESerqLocalInformationNote,
+            ESerqLocalConfirmationNote,
+            ESerqGlobalInformationNote,
+            ESerqGlobalErrorNote,
+            ESerqGlobalConfirmationNote
+            };
+
+        
+        /**
+        * Two-phased constructor.
+        * @param aObserver Oberver to inform cancelling.
+        * @return New CServiceRequest object.
+        */
+        IMPORT_C static CServiceRequest* NewL( MServiceRequestObserver& aObserver );
+        
+        /**
+        * Destructor.
+        */
+        IMPORT_C virtual ~CServiceRequest();
+
+    public: // New functions
+        
+        /**
+        * Starts a wait note.
+        * @since 1.2
+        * @param aText "Requesting" text is used, if this descriptor's
+        *              lenght is zero.
+        */
+        IMPORT_C void StartL( const TDesC& aText = KNullDesC() );
+
+        /**
+        * Removes wait note and shows new note if wanted.
+        * If aShowNote = EFalse, this function won't leave!
+        * Removal of the wait note is guaranteed in leave cases also.
+        * @since 1.2
+        * @param aShowNote ETrue: a note is shown 
+        *                  EFalse: no additional note is shown
+        * @param aError Used in default notes. The default note type and used
+        *               text is decided based on this value. These vales are
+        *               overridden if note type or used text is geven as a
+        *               parameter.
+        * @param aNoteType Type of the note. If EDefault is used, then the
+        *                  aError parameter is checked.
+        * @param aText Given text. If lenght is zero, aError parameter is checked.
+        */
+        IMPORT_C void ShowCompletionNoteL( 
+            TBool aShowNote = ETrue,
+            TInt aError = KErrNone,
+            TSerqNoteType aNoteType = ESerqDefault,
+            const TDesC& aText = KNullDesC() );
+
+    protected: // From baseclasses
+
+        // From MProgressDialogCallback
+        void DialogDismissedL( TInt aButtonId );
+
+        // From CActive
+        void RunL();
+
+        // From CActive
+        void DoCancel();
+        
+        /**
+        * From CActive
+        * @param aError
+        * @return TInt
+        */
+        TInt RunError(TInt aError);
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CServiceRequest( MServiceRequestObserver& aObserver );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Zeroes data members
+        */
+        void Reset();
+
+        /**
+        * Gets default note implementation for give error value.
+        */
+        static void GetDefaultNote( 
+            const TInt aError , 
+            TSerqNoteType& aNoteType , 
+            TInt& aResourceId );
+
+        /**
+        * Launches given note. Text is fetched from iNoteText.
+        */
+        void LaunchNoteL( const TSerqNoteType aNoteType);
+
+    private:    // Data
+        // Service request observer
+        MServiceRequestObserver& iObserver;
+
+        // Requesting wait note:
+        CAknWaitDialog* iRequestingNote;
+
+        // Resource loader
+        RConeResourceLoader* iResourceLoader;
+
+        // Text for note
+        HBufC* iNoteText;
+
+        // Enables instance deletion in call back.
+        TBool* iDestroyed;
+         
+        // Reserved pointer for future extension
+        TAny* iReserved;
+    };
+
+#endif      // CSERVICEREQUEST_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/servicerequest/inc/mservicerequestobserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 service request
+*
+*/
+
+
+
+#ifndef MSERVICEREQUESTOBSERVER_H
+#define MSERVICEREQUESTOBSERVER_H
+
+// CLASS DECLARATION
+
+/**
+*  Observer interface for service request
+*
+*  @lib ServiceRequest.lib
+*  @since 1.2
+*/
+class MServiceRequestObserver
+    {
+    public: // New functions
+        
+        /**
+        * Called when user cancel the service request.
+        * @since 1.2
+        * @param aCancelledWithEscape ETrue: cancalled with esc key. 
+        *                             EFalse: cancelled with softkey (normal).
+        */
+        virtual void MServiceRequestNoteCancelledL( 
+            TBool aCancelledWithEscape ) = 0;
+    };
+
+#endif      // MSERVICEREQUESTOBSERVER_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/servicerequest/inc/servicerequest.hrh	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definitions used in Service Request module
+*
+*/
+
+
+#ifndef SERVICEREQUEST_HRH
+#define SERVICEREQUEST_HRH
+
+
+// DATA TYPES
+enum TSerqNotes
+    {
+    ESerqRequestingNote = 1
+    };  
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/servicerequest/rom/servicerequest.iby	Wed Jul 21 18:26:52 2010 +0300
@@ -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 __SERVICEREQUEST_IBY__
+#define __SERVICEREQUEST_IBY__
+
+file=ABI_DIR\BUILD_DIR\servicerequest.dll  SHARED_LIB_DIR\servicerequest.dll
+
+data=ZSYSTEM\install\servicerequest_stub.sis    System\Install\servicerequest_stub.sis
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/servicerequest/rom/servicerequestresources.iby	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,24 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*/
+
+
+#ifndef __SERVICEREQUESTRESOURCES_IBY__
+#define __SERVICEREQUESTRESOURCES_IBY__
+
+data=DATAZ_\RESOURCE_FILES_DIR\SERVICEREQUEST.rsc           RESOURCE_FILES_DIR\SERVICEREQUEST.rsc
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/servicerequest/src/cservicerequest.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,401 @@
+/*
+* 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:  Interface for service request
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "cservicerequest.h" 
+#include    "mservicerequestobserver.h" 
+#include    <servicerequest.rsg> 
+
+#include    <AknWaitDialog.h> 
+#include    <AknGlobalNote.h> 
+#include    <aknnotewrappers.h>
+#include    <avkon.hrh>
+
+#include    <StringLoader.h> 
+#include    <gsmerror.h>
+#include    <exterror.h>
+#include    <ConeResLoader.h> 
+#include    <textresolver.h>
+
+
+// CONSTANTS
+_LIT( KSerqResourcesWithFullPath,"z:\\resource\\ServiceRequest.rsc" );
+ 
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CServiceRequest::CServiceRequest
+// C++ default constructor can NOT contain any code that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CServiceRequest::CServiceRequest( MServiceRequestObserver& aObserver )
+: CActive(EPriorityStandard) , iObserver( aObserver )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CServiceRequest::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CServiceRequest::ConstructL()
+    {
+    iResourceLoader = new(ELeave) RConeResourceLoader( *CCoeEnv::Static() ); 
+    TFileName fileName( KSerqResourcesWithFullPath ); 
+    iResourceLoader->OpenL(fileName);
+    }
+
+// -----------------------------------------------------------------------------
+// CServiceRequest::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CServiceRequest* CServiceRequest::NewL( MServiceRequestObserver& aObserver )
+    {
+    CServiceRequest* self = new( ELeave ) CServiceRequest( aObserver );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// Destructor
+EXPORT_C CServiceRequest::~CServiceRequest()
+    {
+    Reset();
+
+    if ( iResourceLoader )
+        {
+        iResourceLoader->Close();
+        }
+    delete iResourceLoader;
+    iResourceLoader = NULL;
+
+    // If instance is deleted in call back - inform the function.
+    if ( iDestroyed )
+        {
+        *iDestroyed = ETrue;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CServiceRequest::Reset
+// Deletes used member data
+// -----------------------------------------------------------------------------
+//
+void CServiceRequest::Reset()
+    {
+    Cancel();
+
+    delete iRequestingNote;
+    iRequestingNote = NULL;
+    
+    delete iNoteText;
+    iNoteText = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CServiceRequest::StartL
+// Launches the request note.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CServiceRequest::StartL( const TDesC& aText )
+    {
+ 
+    // delete possible old data:
+    Reset();
+
+    // Choose alternative "requesting" text if given
+    if ( aText.Length() )
+        {
+        iNoteText = aText.AllocL();
+        }
+
+    // Create note and launch it.
+    CAknWaitDialog* requestingNote = new(ELeave) CAknWaitDialog(
+        (REINTERPRET_CAST(CEikDialog**,&iRequestingNote)) , ETrue );
+    iRequestingNote = requestingNote;
+    requestingNote->PrepareLC( R_SERQ_REQUESTING_WAIT_NOTE );
+    if ( iNoteText )
+        {
+        requestingNote->SetTextL( iNoteText->Des() );
+        }
+    requestingNote->SetCallback( this );
+    requestingNote->RunLD();
+    }
+
+// -----------------------------------------------------------------------------
+// CServiceRequest::DialogDismissedL
+// Called when the note is cancelled. Observer call made asyncronously.
+// -----------------------------------------------------------------------------
+//
+void CServiceRequest::DialogDismissedL( TInt aButtonId )
+    {
+    Cancel();
+
+    if ( aButtonId == EAknSoftkeyQuit || aButtonId == EEikBidCancel )
+        { 
+        // Activate new request
+        TRequestStatus* status = &iStatus;
+        User::RequestComplete( status, aButtonId );
+        SetActive();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CServiceRequest::ShowCompletionNoteL
+// Removes the wait note and shows another note if needed.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CServiceRequest::ShowCompletionNoteL( 
+    TBool aShowNote,
+    TInt aError,
+    TSerqNoteType aNoteType,
+    const TDesC& aText )
+    {
+    // delete old instances
+    Reset();
+
+    // if new notes are not required
+    if ( !aShowNote )
+        {
+        return;
+        }
+
+    // Check default note appearance
+    TInt defaultTextId;
+    TSerqNoteType defaultNoteType;
+    GetDefaultNote( aError , defaultNoteType , defaultTextId );
+
+    // Choose text
+    if ( aText.Length() )
+        {
+        iNoteText = aText.AllocL();
+        }
+    else
+        {
+        // read from resources
+        iNoteText = StringLoader::LoadL( defaultTextId, CCoeEnv::Static() );
+        }
+
+    // Choose note type
+    TSerqNoteType noteType;
+    if ( aNoteType != ESerqDefault )
+        {
+        noteType = aNoteType;
+        }
+    else
+        {
+        noteType = defaultNoteType;
+        }
+
+    // Start note
+    LaunchNoteL( noteType );
+    }
+
+// -----------------------------------------------------------------------------
+// CServiceRequest::GetDefaultNote
+// Decides note type based on the given error value.
+// -----------------------------------------------------------------------------
+//
+void CServiceRequest::GetDefaultNote( 
+    const TInt aError,
+    TSerqNoteType& aNoteType,
+    TInt& aResourceId )
+    {
+    switch ( aError  )
+        {
+        case KErrNone:
+            aResourceId = R_TEXT_DONE;
+            aNoteType = ESerqGlobalConfirmationNote;
+            break;
+        case KErrCancel:
+            aResourceId = R_TEXT_UNCONFIRMED;
+            aNoteType = ESerqLocalInformationNote;
+            break;
+        case KErrInUse:
+        case KErrAccessDenied:
+        case KErrGsmSSUnknownSubscriber:
+        case KErrGsmSSAbsentSubscriber:        
+        case KErrGsmSSIllegalOperation:
+        case KErrGsmSSIllegalSubscriber:
+        case KErrGsmSSSubscriptionViolation:
+        case KErrGsmSSIllegalEquipment:
+            aResourceId = R_TEXT_NOT_ALLOWED;
+            aNoteType = ESerqGlobalInformationNote;
+            break;
+        case KErrGsmSSCallBarred:       
+        case KErrGsmSSIncompatibility:
+            aResourceId = R_QTN_SRVRQ_INFO_CONFL;
+            aNoteType = ESerqGlobalInformationNote;
+            break;
+        case KErrGsmSSSystemFailure:
+            aResourceId = R_TEXT_RESULT_UNKNOWN;
+            aNoteType = ESerqGlobalInformationNote;
+            break;        
+        case KErrGsmSSErrorStatus:
+        case KErrGsmSSUnexpectedDataValue:
+        case KErrGsmSSResourcesUnavailable:
+            aResourceId = R_TEXT_REQUEST_REJECTED;
+            aNoteType = ESerqGlobalInformationNote;
+            break;
+        case KErrGsmSSPasswordAttemptsViolation:
+        case KErrGsmSSNegativePasswordCheck:
+        case KErrGsmSSPasswordRegistrationFailure:
+            aResourceId = R_PASSWORD_ERROR_NOTE;
+            aNoteType = ESerqGlobalErrorNote;
+            break;
+        case KErrGsmNoService:
+            aResourceId = R_TEXT_NO_SERVICE;
+            aNoteType = ESerqGlobalInformationNote;
+            break;
+        default:
+            aResourceId = R_TEXT_NOT_DONE;
+            aNoteType = ESerqGlobalInformationNote;
+            break; 
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CServiceRequest::LaunchNoteL
+// Launches given note type. Text is got from iNoteText member variable.
+// -----------------------------------------------------------------------------
+//
+void CServiceRequest::LaunchNoteL( const TSerqNoteType aNoteType)
+    {
+    
+    switch ( aNoteType )
+        {
+        case ESerqLocalInformationNote:
+        case ESerqLocalConfirmationNote:
+            {
+            CAknResourceNoteDialog* dlg = NULL;
+            if ( aNoteType == ESerqLocalInformationNote )
+                {
+                dlg = new ( ELeave ) CAknInformationNote( ETrue );
+                }
+            else
+                {
+                dlg = new ( ELeave ) CAknConfirmationNote( ETrue );
+                }
+            dlg->ExecuteLD(  iNoteText->Des() );
+
+            delete iNoteText;
+            iNoteText = NULL;
+            break;
+            }
+        case ESerqGlobalInformationNote:
+        case ESerqGlobalErrorNote:
+        case ESerqGlobalConfirmationNote:
+            {
+            CAknGlobalNote* dlg = CAknGlobalNote::NewLC();
+            if ( aNoteType == ESerqGlobalInformationNote )
+                {
+                dlg->ShowNoteL( EAknGlobalInformationNote , iNoteText->Des() );
+                }
+            else if ( aNoteType == ESerqGlobalErrorNote )
+                {
+                dlg->ShowNoteL( EAknGlobalErrorNote , iNoteText->Des() );
+                }
+            else
+                {
+                dlg->ShowNoteL( EAknGlobalConfirmationNote , iNoteText->Des() );
+                }
+            CleanupStack::PopAndDestroy( dlg );
+            delete iNoteText;
+            iNoteText = NULL;
+            break;
+            }
+        default:
+            User::Invariant();
+            break;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CServiceRequest::RunL
+// Calls observer interface to tell that the notes has been dismissed.
+// -----------------------------------------------------------------------------
+//
+void CServiceRequest::RunL()
+    {
+    __ASSERT_ALWAYS( !iDestroyed, User::Invariant() );
+
+    TBool destr = EFalse; // Destructor changes to ETrue if deleted.
+    iDestroyed = &destr;
+
+    // Object still exists and the note is cancelled:
+    TRAPD( error , 
+        iObserver.MServiceRequestNoteCancelledL( iStatus.Int() == EEikBidCancel ) );
+    
+    // All OK
+    if ( error == KErrNone )
+        {
+        if ( !destr )
+            {
+            iDestroyed = NULL;
+            }
+        return;
+        }
+
+    // We got an error value.
+    if ( !destr )
+        {
+        iDestroyed = NULL;
+        User::Leave( error );
+        }
+    else
+        {
+        CTextResolver* textResolver = CTextResolver::NewLC();
+        HBufC* buffer = textResolver->ResolveErrorString( error ).AllocLC();
+        CAknGlobalNote* note = CAknGlobalNote::NewLC();
+        note->ShowNoteL( EAknGlobalErrorNote, *buffer );
+        CleanupStack::PopAndDestroy( note );
+        CleanupStack::PopAndDestroy( buffer ); 
+        CleanupStack::PopAndDestroy( textResolver );
+        }
+    }
+
+// ---------------------------------------------------------
+// CServiceRequest::RunError
+// Called when RunL leaves
+// (other items were commented in a header). 
+// ---------------------------------------------------------
+// 
+TInt CServiceRequest::RunError( TInt /*aError*/ )
+    {
+    return KErrNone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CServiceRequest::DoCancel
+// Does nothing. Must be implemented due inheritance.
+// -----------------------------------------------------------------------------
+//
+void CServiceRequest::DoCancel()
+    {
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/bwins/sssettingsu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,32 @@
+EXPORTS
+	??0RCustomerServiceProfileCache@@QAE@XZ @ 1 NONAME ; RCustomerServiceProfileCache::RCustomerServiceProfileCache(void)
+	??0RSSSettings@@QAE@XZ @ 2 NONAME ; RSSSettings::RSSSettings(void)
+	??1CSSSettingsRefreshContainer@@UAE@XZ @ 3 NONAME ; CSSSettingsRefreshContainer::~CSSSettingsRefreshContainer(void)
+	??1RCustomerServiceProfileCache@@QAE@XZ @ 4 NONAME ; RCustomerServiceProfileCache::~RCustomerServiceProfileCache(void)
+	?Cancel@RSSSettings@@QAEXW4TSSSettingsSetting@@AAVMSSSettingsObserver@@@Z @ 5 NONAME ; void RSSSettings::Cancel(enum TSSSettingsSetting, class MSSSettingsObserver &)
+	?CancelAll@RSSSettings@@QAEXAAVMSSSettingsObserver@@@Z @ 6 NONAME ; void RSSSettings::CancelAll(class MSSSettingsObserver &)
+	?ChangedCspTable@RCustomerServiceProfileCache@@QAEHAAVTDes8@@0@Z @ 7 NONAME ; int RCustomerServiceProfileCache::ChangedCspTable(class TDes8 &, class TDes8 &)
+	?Close@RCustomerServiceProfileCache@@QAEXXZ @ 8 NONAME ; void RCustomerServiceProfileCache::Close(void)
+	?Close@RSSSettings@@QAEXXZ @ 9 NONAME ; void RSSSettings::Close(void)
+	?CspCPHSTeleservices@RCustomerServiceProfileCache@@QAEHAAW4TCspCPHSTeleservices@RMobilePhone@@@Z @ 10 NONAME ; int RCustomerServiceProfileCache::CspCPHSTeleservices(enum RMobilePhone::TCspCPHSTeleservices &)
+	?CspCPHSValueAddedServices@RCustomerServiceProfileCache@@QAEHAAW4TCspValueAdded@RMobilePhone@@@Z @ 11 NONAME ; int RCustomerServiceProfileCache::CspCPHSValueAddedServices(enum RMobilePhone::TCspValueAdded &)
+	?CspCallCompletion@RCustomerServiceProfileCache@@QAEHAAW4TCspCallCompletion@RMobilePhone@@@Z @ 12 NONAME ; int RCustomerServiceProfileCache::CspCallCompletion(enum RMobilePhone::TCspCallCompletion &)
+	?CspCallOffering@RCustomerServiceProfileCache@@QAEHAAW4TCspCallOffering@RMobilePhone@@@Z @ 13 NONAME ; int RCustomerServiceProfileCache::CspCallOffering(enum RMobilePhone::TCspCallOffering &)
+	?CspCallRestriction@RCustomerServiceProfileCache@@QAEHAAW4TCspCallRestriction@RMobilePhone@@@Z @ 14 NONAME ; int RCustomerServiceProfileCache::CspCallRestriction(enum RMobilePhone::TCspCallRestriction &)
+	?CspTeleServices@RCustomerServiceProfileCache@@QAEHAAW4TCspTeleservices@RMobilePhone@@@Z @ 15 NONAME ; int RCustomerServiceProfileCache::CspTeleServices(enum RMobilePhone::TCspTeleservices &)
+	?Get@RSSSettings@@QAEHW4TSSSettingsSetting@@AAH@Z @ 16 NONAME ; int RSSSettings::Get(enum TSSSettingsSetting, int &)
+	?HandleRefresh@RCustomerServiceProfileCache@@QAEHXZ @ 17 NONAME ; int RCustomerServiceProfileCache::HandleRefresh(void)
+	?HandleRefresh@RSSSettings@@QAEHXZ @ 18 NONAME ; int RSSSettings::HandleRefresh(void)
+	?HandleSIMChanged@RSSSettings@@QAEHXZ @ 19 NONAME ; int RSSSettings::HandleSIMChanged(void)
+	?IsValueValidCugIndex@RSSSettings@@QBEHABH@Z @ 20 NONAME ; int RSSSettings::IsValueValidCugIndex(int const &) const
+	?NewL@CSSSettingsRefreshContainer@@SAPAV1@XZ @ 21 NONAME ; class CSSSettingsRefreshContainer * CSSSettingsRefreshContainer::NewL(void)
+	?Open@RCustomerServiceProfileCache@@QAEHXZ @ 22 NONAME ; int RCustomerServiceProfileCache::Open(void)
+	?Open@RSSSettings@@QAEHPAVRTelServer@@@Z @ 23 NONAME ; int RSSSettings::Open(class RTelServer *)
+	?Open@RSSSettings@@QAEHXZ @ 24 NONAME ; int RSSSettings::Open(void)
+	?PreviousCugValue@RSSSettings@@QAEHAAH@Z @ 25 NONAME ; int RSSSettings::PreviousCugValue(int &)
+	?RefreshHandler@CSSSettingsRefreshContainer@@QAEAAVMSSSettingsRefreshHandler@@XZ @ 26 NONAME ; class MSSSettingsRefreshHandler & CSSSettingsRefreshContainer::RefreshHandler(void)
+	?Register@RSSSettings@@QAEHW4TSSSettingsSetting@@AAVMSSSettingsObserver@@@Z @ 27 NONAME ; int RSSSettings::Register(enum TSSSettingsSetting, class MSSSettingsObserver &)
+	?RegisterAll@RSSSettings@@QAEHAAVMSSSettingsObserver@@@Z @ 28 NONAME ; int RSSSettings::RegisterAll(class MSSSettingsObserver &)
+	?ResetPreviousCugValue@RSSSettings@@QAEHXZ @ 29 NONAME ; int RSSSettings::ResetPreviousCugValue(void)
+	?Set@RSSSettings@@QAEHW4TSSSettingsSetting@@H@Z @ 30 NONAME ; int RSSSettings::Set(enum TSSSettingsSetting, int)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/eabi/sssettingsu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,45 @@
+EXPORTS
+	_ZN11RSSSettings11RegisterAllER19MSSSettingsObserver @ 1 NONAME
+	_ZN11RSSSettings13HandleRefreshEv @ 2 NONAME
+	_ZN11RSSSettings16HandleSIMChangedEv @ 3 NONAME
+	_ZN11RSSSettings16PreviousCugValueERi @ 4 NONAME
+	_ZN11RSSSettings21ResetPreviousCugValueEv @ 5 NONAME
+	_ZN11RSSSettings3GetE18TSSSettingsSettingRi @ 6 NONAME
+	_ZN11RSSSettings3SetE18TSSSettingsSettingi @ 7 NONAME
+	_ZN11RSSSettings4OpenEP10RTelServer @ 8 NONAME
+	_ZN11RSSSettings4OpenEv @ 9 NONAME
+	_ZN11RSSSettings5CloseEv @ 10 NONAME
+	_ZN11RSSSettings6CancelE18TSSSettingsSettingR19MSSSettingsObserver @ 11 NONAME
+	_ZN11RSSSettings8RegisterE18TSSSettingsSettingR19MSSSettingsObserver @ 12 NONAME
+	_ZN11RSSSettings9CancelAllER19MSSSettingsObserver @ 13 NONAME
+	_ZN11RSSSettingsC1Ev @ 14 NONAME
+	_ZN11RSSSettingsC2Ev @ 15 NONAME
+	_ZN27CSSSettingsRefreshContainer14RefreshHandlerEv @ 16 NONAME
+	_ZN27CSSSettingsRefreshContainer4NewLEv @ 17 NONAME
+	_ZN27CSSSettingsRefreshContainerD0Ev @ 18 NONAME
+	_ZN27CSSSettingsRefreshContainerD1Ev @ 19 NONAME
+	_ZN27CSSSettingsRefreshContainerD2Ev @ 20 NONAME
+	_ZN28RCustomerServiceProfileCache13HandleRefreshEv @ 21 NONAME
+	_ZN28RCustomerServiceProfileCache15ChangedCspTableER5TDes8S1_ @ 22 NONAME
+	_ZN28RCustomerServiceProfileCache15CspCallOfferingERN12RMobilePhone16TCspCallOfferingE @ 23 NONAME
+	_ZN28RCustomerServiceProfileCache15CspTeleServicesERN12RMobilePhone16TCspTeleservicesE @ 24 NONAME
+	_ZN28RCustomerServiceProfileCache17CspCallCompletionERN12RMobilePhone18TCspCallCompletionE @ 25 NONAME
+	_ZN28RCustomerServiceProfileCache18CspCallRestrictionERN12RMobilePhone19TCspCallRestrictionE @ 26 NONAME
+	_ZN28RCustomerServiceProfileCache19CspCPHSTeleservicesERN12RMobilePhone20TCspCPHSTeleservicesE @ 27 NONAME
+	_ZN28RCustomerServiceProfileCache25CspCPHSValueAddedServicesERN12RMobilePhone14TCspValueAddedE @ 28 NONAME
+	_ZN28RCustomerServiceProfileCache4OpenEv @ 29 NONAME
+	_ZN28RCustomerServiceProfileCache5CloseEv @ 30 NONAME
+	_ZN28RCustomerServiceProfileCacheC1Ev @ 31 NONAME
+	_ZN28RCustomerServiceProfileCacheC2Ev @ 32 NONAME
+	_ZN28RCustomerServiceProfileCacheD1Ev @ 33 NONAME
+	_ZN28RCustomerServiceProfileCacheD2Ev @ 34 NONAME
+	_ZNK11RSSSettings20IsValueValidCugIndexERKi @ 35 NONAME
+	_ZTI19CSSSettingsNotifier @ 36 NONAME
+	_ZTI22CSSSettingsAlsNotifier @ 37 NONAME
+	_ZTI25CSSSettingsRefreshHandler @ 38 NONAME
+	_ZTI27CSSSettingsRefreshContainer @ 39 NONAME
+	_ZTV19CSSSettingsNotifier @ 40 NONAME
+	_ZTV22CSSSettingsAlsNotifier @ 41 NONAME
+	_ZTV25CSSSettingsRefreshHandler @ 42 NONAME
+	_ZTV27CSSSettingsRefreshContainer @ 43 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This file provides the information required for building the
+*                SSSettings.
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT ARMV5
+
+PRJ_EXPORTS
+
+../inc/csssettingsrefreshcontainer.h  |../../../inc/csssettingsrefreshcontainer.h
+../inc/msssettingsrefreshhandler.h    |../../../inc/msssettingsrefreshhandler.h
+
+../group/sssettings_stub.sis          /epoc32/data/z/system/install/sssettings_stub.sis
+
+// IBY files
+../rom/sssettings.iby                 CORE_APP_LAYER_IBY_EXPORT_PATH(sssettings.iby)
+
+PRJ_MMPFILES
+../group/sssettings.mmp
+
+//End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/group/sssettings.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* 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 is project specification file for the SSSettings.
+*
+*/
+
+#include <platform_paths.hrh>
+#include "../logger/sssettingsloggingconf.h" 
+
+
+TARGET          sssettings.dll
+TARGETTYPE      dll
+UID             0x1000008d 0x10005A01
+
+VENDORID        VID_DEFAULT
+
+// Capability assignment.
+CAPABILITY      CAP_GENERAL_DLL
+
+sourcepath    ../src
+SOURCE        rsssettings.cpp 
+SOURCE        csssettingsnotifier.cpp 
+SOURCE        csssettingsalsnotifier.cpp 
+SOURCE        rcustomerserviceprofilecache.cpp 
+SOURCE        csssettingsrefreshcontainer.cpp 
+SOURCE        csssettingsrefreshhandler.cpp 
+SOURCE        csssettingsactiveobject.cpp 
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../logger 
+SYSTEMINCLUDE   ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   ../../../inc
+
+LIBRARY    euser.lib
+LIBRARY    etel.lib // etel connection 
+LIBRARY    customapi.lib // custom etel api 
+LIBRARY    etelmm.lib
+LIBRARY    featmgr.lib 
+LIBRARY    satclient.lib
+LIBRARY    centralrepository.lib
+LIBRARY    cenrepnotifhandler.lib
+LIBRARY    flogger.lib      // logging
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/group/sssettings.pkg	Wed Jul 21 18:26:52 2010 +0300
@@ -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: For packing sssettings component.
+;
+; Languages
+&EN
+
+; Header
+#{"SSSettings"}, (0x10005A01), 10, 1, 0, TYPE=SA
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Files
+"\epoc32\RELEASE\armv5\UREL\SSSettings.dll"-"z:\sys\bin\SSSettings.dll"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/group/sssettings_stub.pkg	Wed Jul 21 18:26:52 2010 +0300
@@ -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: For packing sssettings stub component.
+;
+; Languages
+&EN
+
+; Header
+#{"SSSettings"}, (0x10005A01), 1, 0, 0, TYPE=SA
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Files
+""-"z:\sys\bin\SSSettings.dll"
Binary file cellular/sssettings/group/sssettings_stub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/inc/csssettingsactiveobject.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,139 @@
+/*
+* Copyright (c) 2004-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:  Interface for Active object handling Publish and subscribe 
+*                notify events.
+*
+*/
+
+
+#ifndef CSSSETTINGSACTIVEOBJECT_H
+#define CSSSETTINGSACTIVEOBJECT_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <e32property.h>
+
+
+// CLASS DECLARATION
+
+/**
+*  Interface for Publish and Subscribe notify.
+*
+*  @since   3.0
+*  @lib     SsSettings.lib
+*/
+class MSSSettingsPubSubNotify
+    {
+    public: // New functions
+    
+        virtual void HandlePubSubNotify(
+            const TUid aUid,
+            const TUint32 aKeyId ) = 0;
+    };
+
+/**
+* Interface for Active object handling Publish and subscribe notify events.
+* @lib sssettings.lib
+* @since 3.0
+*/
+NONSHARABLE_CLASS( CSSSettingsActiveObject )
+    : public CActive
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        *
+        * @param aNotifyUid The Uid to be notified.
+        * @param aNotifyKey The key under aNotifyUid to be notified.
+        * @param aNotifyHandler The notifier to be informed about notify events.
+        * @return CSSSettingsActiveObject instance pointer.
+        */
+        static CSSSettingsActiveObject* NewL(
+            const TUid aNotifyUid,
+            const TUint32 aNotifyKey,
+            MSSSettingsPubSubNotify& aNotifyHandler );
+
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSSSettingsActiveObject();
+
+
+    public: // New functions
+        
+        /**
+        * Starts the notify.
+        *
+        * @return Error code.
+        */
+        TInt NotifyKeyChange();
+
+        /**
+        * Cancel notify
+        */
+        void CancelNotify();
+
+
+    protected:  // Functions from base classes
+        
+        /**
+        * From CActive.
+        */
+        void RunL();
+
+        /**
+        * From CActive.
+        */
+        void DoCancel();
+        
+        
+    private:
+    
+        /**
+        * Constructor.
+        */
+        CSSSettingsActiveObject(
+            const TUid aNotifyUid,
+            const TUint32 aNotifyKey,
+            MSSSettingsPubSubNotify& aNotifyHandler );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+
+    private: // Data
+    
+        // Central Repository.
+        RProperty                iProperty;
+        
+        // Uid to be notified.
+        TUid                     iNotifyUid;
+        
+        // Key to be notified.
+        TUint32                  iNotifyKey;
+        
+        // Notify handler.
+        MSSSettingsPubSubNotify* iNotifyHandler;
+
+        // The notify information.
+        TBool                    iNotify;
+    };
+
+#endif // CSSSETTINGSACTIVEOBJECT_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/inc/csssettingsalsnotifier.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,238 @@
+/*
+* 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:  Interface for ALS control
+*
+*/
+
+
+#ifndef CSSSETTINGSALSNOTIFIER_H
+#define CSSSETTINGSALSNOTIFIER_H
+
+//  INCLUDES
+#include <etelmm.h>
+#include <cenrepnotifyhandler.h>
+
+#include "rsssettings.h" 
+#include "csssettingsactiveobject.h" 
+
+// FORWARD DECLARATIONS
+class RMmCustomAPI;
+class CRepository;
+class CCenRepNotifyHandler;
+class RProperty;
+
+
+// CLASS DECLARATION
+
+/**
+*  Interface for Als control.
+*
+*  @since   1.0
+*  @lib     SsSettings.lib
+*/
+class CSSSettingsAlsNotifier :   public CActive,
+    public MCenRepNotifyHandlerCallback,
+    public MSSSettingsPubSubNotify
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aMobilePhone Mobile phone
+        * @param aCustomPhone Pre-opened custom interface.
+        * @param aNotifyHandler Notify changes.
+        */
+        static CSSSettingsAlsNotifier* NewL(
+            RMobilePhone& aMobilePhone,
+            RMmCustomAPI& aCustomPhone,
+            MCenRepNotifyHandlerCallback& aAlsNotifyHandler );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSSSettingsAlsNotifier();
+
+    public: // New functions
+        
+        /**
+        * Starts the notifier.
+        * @return Error code
+        */
+        TInt NotifyAlsChange();
+
+        /**
+        * Cancel notify
+        */
+        void CancelNotify();
+
+        /**
+        * Set Als value.
+        * @param aValue
+        * @return If successful, KErrNone
+        *         KErrNotSupported MS doesn't support ALS
+        */
+        TInt SetAlsValue( TSSSettingsAlsValue aValue );
+
+        /**
+        * Get Als value
+        * @param aValue the value.
+        * @return If successful, KErrNone
+        */
+        TInt GetAlsValue( TSSSettingsAlsValue& aValue );
+
+        /**
+        * Get Als support bits.
+        * @param aPPSupport Product profile support for als
+        * @param aSimSupport Sim support for Als.
+        * @param aCSPSupport CSP ALS support for Als.
+        * @param aCSPSupport CSP ALS error for als.
+        */
+        void GetAlsSupport( TBool& aPPSupport, TBool& aSimSupport, TBool& aCSPSupport, TInt& aCSPError );
+
+        /**
+        * Handle SIM refresh
+        * @return If successful, KErrNone
+        */
+        TInt HandleRefresh();
+
+        
+    protected:  // New functions
+        
+        /**
+        * Gets PP support from ETel.
+        * @param aIsAlsSopportedInPP Is supported.
+        * @return If successful, KErrNone
+        */
+        TInt CheckAlsSupportInProductProfile( TBool& aIsAlsSopportedInPP );
+
+        /**
+        * Gets Sim support from ETel.
+        * @param aIsAlsSopportedInSim Is supported.
+        * @return If successful, KErrNone
+        */
+        TInt CheckAlsSupportInSim( TBool& aIsAlsSopportedInSim );
+
+        /**
+        * Checks Als support from Sim and PP if not checked.
+        * @return If successful, KErrNone
+        */
+        TInt EnsureAlsStatus();
+
+    protected:  // Functions from base classes
+        
+        /**
+        * From CActive.
+        */
+        void RunL();
+
+        /**
+        * From CActive.
+        */
+        void DoCancel();
+
+        /** 
+        * From MCenRepNotifyHandlerCallback
+        */
+        void HandleNotifyInt(
+            TUint32 aId,
+            TInt aNewValue );
+
+        /** 
+        * From MCenRepNotifyHandlerCallback.
+        */
+        void HandleNotifyError(
+            TUint32 aId,
+            TInt aError,
+            CCenRepNotifyHandler* aHandler );
+
+        /**
+        * From MSSSettingsAlsNotify.
+        */
+        void HandlePubSubNotify(
+            const TUid aUid,
+            const TUint32 aKeyId );
+
+    private:
+
+        /**
+        * C++ constructor.
+        */
+        CSSSettingsAlsNotifier( 
+            RMobilePhone& aMobilePhone,
+            RMmCustomAPI& aCustomPhone,
+            MCenRepNotifyHandlerCallback& aAlsNotifyHandler );
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+        // Prohibit copy constructor if not deriving from CBase.
+        CSSSettingsAlsNotifier( const CSSSettingsAlsNotifier& );
+        // Prohibit assigment operator if not deriving from CBase.
+        CSSSettingsAlsNotifier& operator= ( const CSSSettingsAlsNotifier& );
+              
+        /**
+        * Checks if Alternate Line is to be supported in parameter.
+        * @param aContainer The parameter to be checked.
+        * @return ETrue if supported, otherwise EFalse.
+        */
+        TBool CheckIfAlsCSPSupported( const RMobilePhone::TCspCPHSTeleservices aContainer ) const;
+
+    private:
+         
+        //Provides client access to mobile phone functionality provided by TSY.
+        RMobilePhone& iMobilePhone;
+        
+        // Custom phone.
+        RMmCustomAPI& iCustomPhone;                 
+
+        // Does PP support ALS.
+        TBool iPPSupportAls;
+        
+        // Does SIM support ALS.
+        TBool iSimSupportAls;
+        
+        // Does SIM support CSP ALS.
+        TBool iAlsCSPSupport;
+        
+        // CSP ALS error.
+        TInt iAlsCSPError;
+        
+        // Is PP and Sim support checked.
+        TBool iAlsStatusChecked;
+                            
+        // Active ALS, only valid in RunL.
+        RMobilePhone::TMobilePhoneALSLine iSimActiveAls;
+        
+        // Als Notify handler.
+        MCenRepNotifyHandlerCallback*     iAlsNotifyHandler;
+
+        // Central repository for ALS.
+        CRepository*                      iRepository;
+        
+        // Central repository notify handler for ALS.
+        CCenRepNotifyHandler*             iCenRepNotifyHandler;
+
+        // Notifier for ALS support in Product Profile.
+        CSSSettingsActiveObject*          iPPSupportsAlNotifier;
+        
+        // Notifier for ALS support in SIM.
+        CSSSettingsActiveObject*          iSimSupportsAlsNotifier;
+    };
+
+
+#endif      // CSSSETTINGSALSNOTIFIER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/inc/csssettingsnotifier.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,161 @@
+/*
+* 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:  Notifier for changes.
+*
+*/
+
+
+#ifndef CSSSETTINGSNOTIFIER_H
+#define CSSSETTINGSNOTIFIER_H
+
+//  INCLUDES
+#include <cenrepnotifyhandler.h>
+
+#include "rsssettings.h" 
+#include "csssettingsactiveobject.h" 
+
+// FORWARD DECLARATIONS
+class CSSSettingsAlsNotifier;
+
+
+// CLASS DECLARATION
+
+/**
+*  Notifier for changes
+*  @since   1.0
+*  @lib     SsSettings.lib
+*/
+class CSSSettingsNotifier :   public CActive,
+    public MCenRepNotifyHandlerCallback
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * C++ constructor.
+        * @param aSettings reference to RSSSettings
+        */
+        CSSSettingsNotifier( RSSSettings& aSettings );
+
+        /**
+        * Symbian OS constructor. Must be called before usage!
+        */
+        void ConstructL();
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CSSSettingsNotifier();
+
+    public: // New functions
+        
+        /**
+        * Adds observer.
+        * @param aSetting Set observer for this setting
+        * @return KErrNone if succesful.
+        */
+        TInt AddNotifier( TSSSettingsSetting aSetting );
+
+        /**
+        * Removes observer
+        * @param aSetting Remove observer for this setting
+        */
+        void RemoveNotifier( TSSSettingsSetting aSetting );
+
+
+        /**
+        * To get ALS controller.
+        * @return The Als controller. NULL if not supported.
+        */
+        CSSSettingsAlsNotifier* GetAlsHandler();
+
+        /**
+        * Handle SIM refresh
+        * @return Error code
+        */
+        TInt HandleRefresh();
+
+
+    protected:  // Functions from base classes
+        
+        /**
+        * From CActive. This is called when ALS Blocking status
+        * is changed.
+        */
+        void RunL();
+
+        /**
+        * From CActive. ALS blocking change notification is cancelled.
+        */
+        void DoCancel();
+
+        /** 
+        * From MCenRepNotifyHandlerCallback
+        */
+        void HandleNotifyInt(
+            TUint32 aId,
+            TInt aNewValue );
+
+        /** 
+        * From MCenRepNotifyHandlerCallback.
+        */
+        void HandleNotifyError(
+            TUint32 aId,
+            TInt aError,
+            CCenRepNotifyHandler* aHandler );
+
+    private:
+
+        // Prohibit copy constructor if not deriving from CBase.
+        CSSSettingsNotifier( const CSSSettingsNotifier& );
+        // Prohibit assigment operator if not deriving from CBase.
+        CSSSettingsNotifier& operator= ( const CSSSettingsNotifier& );
+        
+   private:
+   
+        // Determines if als supported.
+        TBool AlsSupport( 
+            TBool aPPSupport, 
+            TBool aCSPSupport,
+            TInt aCSPError );
+
+    private:
+        
+        // Settings data
+        RSSSettings&                     iSettings;
+
+        // Als controller
+        CSSSettingsAlsNotifier*          iAls;
+        
+        // valid in RunL
+        RMmCustomAPI::TGetAlsBlockStatus iAlsBlockStatus;
+
+        // Central repository for SSSettings.
+        CRepository*                     iRepository;
+        
+        // Central repository notify handlers. 
+        // Must use multiple handlers to observe all the keys:
+        // KSettingsAlsLine
+        // KSettingsCLIR
+        // KSettingsCUG
+        CCenRepNotifyHandler*            iCenRepAlsNotifyHandler;
+        CCenRepNotifyHandler*            iCenRepClirNotifyHandler;
+        CCenRepNotifyHandler*            iCenRepCugNotifyHandler;
+     
+        // The notified keys.
+        TUint32                          iNotifyKeys;
+    };
+
+#endif      // CSSSETTINGSNOTIFIER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/inc/csssettingsrefreshcontainer.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* 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:  Container class for refresh related implementation.
+*
+*/
+
+
+#ifndef CSSSETTINGSREFRESHCONTAINER_H
+#define CSSSETTINGSREFRESHCONTAINER_H
+
+
+//  INCLUDES
+#include <msssettingsrefreshhandler.h> 
+
+
+// FORWARD DECLARATIONS
+class CSSSettingsRefreshHandler;
+
+
+// CLASS DECLARATION
+
+/**
+* Container class for refresh related implementation.
+* 
+* @since    2.8
+* @lib      SsSettings.lib
+*/
+class CSSSettingsRefreshContainer :
+    public CBase
+    {
+    public: // Constructor and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CSSSettingsRefreshContainer* NewL();
+
+        /**
+        * Destructor.
+        */
+        IMPORT_C ~CSSSettingsRefreshContainer();
+
+
+    public: // New functions
+
+        /**
+        * Return the refresh handler instance.
+        * 
+        * @return The Refresh handler instance.
+        */
+        IMPORT_C MSSSettingsRefreshHandler& RefreshHandler();
+
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CSSSettingsRefreshContainer();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+
+    private:    // Data
+
+        CSSSettingsRefreshHandler* iRefreshHandler;
+    };
+
+#endif      // CSSSETTINGSREFRESHCONTAINER_H  
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/inc/csssettingsrefreshhandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,174 @@
+/*
+* 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:  The Refresh handler to inform SAT refresses.
+*
+*/
+
+
+
+#ifndef CSSSETTINGSREFRESHHANDLER_H
+#define CSSSETTINGSREFRESHHANDLER_H
+
+
+//  INCLUDES
+#include <msssettingsrefreshhandler.h> 
+#include <msatrefreshobserver.h>
+#include <msssettingsrefreshobserver.h> 
+#include <rsssettings.h> 
+#include <rcustomerserviceprofilecache.h> 
+#include <rsatrefresh.h>
+#include <rsatsession.h> 
+#include <cenrepnotifyhandler.h>
+#include "csssettingsactiveobject.h" 
+
+// DATA TYPES
+
+// The needed functionality.
+enum TSSSettingsRefreshFunction
+    {
+    ESSSettingsAllowRefresh = 0, // AllowRefresh functionality.
+    ESSSettingsRefresh      = 1, // Refresh functionality.
+    };
+
+
+// FORWARD DECLARATIONS
+class CSSSettingsNotifyInfo;
+
+
+// CLASS DECLARATION
+
+/**
+*  The Refresh handler to inform SAT refreshes.
+*  This class is extended for BT SAP functionality from 3.0.
+*
+*  @lib SsSettings.lib
+*  @since 2.8
+*/
+class CSSSettingsRefreshHandler :
+    public CBase,
+    public MSSSettingsRefreshHandler,
+    public MSatRefreshObserver,
+    public MSSSettingsPubSubNotify
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CSSSettingsRefreshHandler* NewL();
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CSSSettingsRefreshHandler();
+
+
+    public: // Functions from base classes
+
+        /**
+        * @see MSSSettingsRefreshHandler::NotifyFileChangeL.
+        */
+        void NotifyFileChangeL(
+            MSSSettingsRefreshObserver& aObserver,
+            TSatElementaryFiles aObservedFiles,
+            TSatRefreshType aObservedRefreshType );
+
+        /**
+        * @see MSSSettingsRefreshHandler::CancelNotify.
+        */
+        void CancelNotify();
+
+        /**
+        * @see MSSSettingsRefreshHandler::ChangedCspTable.
+        */
+        TInt ChangedCspTable( 
+            TDes8& aChangedCsps,
+            TDes8& aNewValues );
+
+
+    public: // Functions from base classes
+
+        /**
+        * @see MSatRefreshObserver::AllowRefresh
+        */
+        TBool AllowRefresh(
+            TSatRefreshType aType,
+            const TSatRefreshFiles& aFiles );
+
+        /**
+        * @see MSatRefreshObserver::Refresh
+        */
+        void Refresh(
+            TSatRefreshType aType,
+            const TSatRefreshFiles& aFiles );
+            
+    public: // From base class MSSSettingsPubSubNotify
+        /**
+        * @see MSSSettingsPubSubNotify
+        */
+        void HandlePubSubNotify(
+            const TUid aUid,
+            const TUint32 aKeyId );
+
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CSSSettingsRefreshHandler();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Common function for AllowRefresh and Refresh.
+        * 
+        * @param atype Refresh Type.
+        * @param aFiles Refresh Files.
+        * @param aFunctionality The functionality wanted.
+        * @return Result of functionality.
+        */
+        TBool DoHandleRefresh(
+            TSatRefreshType aType,
+            const TSatRefreshFiles& aFiles,
+            const TSSSettingsRefreshFunction aFunctionality );
+
+    private:    // Data
+         
+        // Container for notify observer.
+        CSSSettingsNotifyInfo*        iNotifyInfo;
+
+        // The RSSSettings handle.
+        RSSSettings                   iRSSSettings;
+
+        // The RCustomerServiceProfileCache handle.
+        RCustomerServiceProfileCache  iRCspCache;
+
+        // The RSatRefresh handle.
+        RSatRefresh*                  iRSatRefresh;
+
+        // The RSatSession handle.
+        RSatSession                   iRSatSession;
+        
+        // Notifier for BT SAP support.
+        CSSSettingsActiveObject*      iBtSapNotifier;
+
+    };
+
+#endif      // CSSSETTINGSREFRESHHANDLER_H  
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/inc/msssettingsrefreshhandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,82 @@
+/*
+* 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:  The Refresh handler to inform SAT refresses.
+*
+*/
+
+
+
+#ifndef MSSSETTINGSREFRESHHANDLER_H
+#define MSSSETTINGSREFRESHHANDLER_H
+
+
+//  INCLUDES
+#include <msssettingsrefreshobserver.h> 
+#include <msatrefreshobserver.h>
+
+
+// FORWARD DECLARATIONS
+class CSSSettingsNotifyContainer;
+
+
+// CLASS DECLARATION
+
+/**
+*  The Refresh handler to inform SAT refresses.
+*
+*  @lib SsSettings.lib
+*  @since 2.8
+*/
+class MSSSettingsRefreshHandler
+    {
+    public: // New functions
+
+        /**
+        * Start the waiting for refresh events.
+        * 
+        * @param aObserver The observer to handle refresh events.
+        * @param aObservedFile The file change to be observed.
+        * @param aObservedRefreshType The refresh type(s) to be observed.
+        */
+        virtual void NotifyFileChangeL(
+            MSSSettingsRefreshObserver& aObserver,
+            TSatElementaryFiles aObservedFile,
+            TSatRefreshType aObservedRefreshType ) = 0;
+
+        /**
+        * Cancel the notification started in NotifyFileChangeL.
+        * 
+        * @param aObserver The observer whose notify to be canceled.
+        * @param aObservedFile The file change to be canceled.
+        * @param aObservedRefreshType The refresh type to be canceled.
+        */
+        virtual void CancelNotify() = 0;
+
+        /**
+        * Get the changed CSP information after Refresh.
+        * 
+        * @param aChangedCsps The changed CSP fields, 
+        *                     type RMobilePhone::TMobilePhoneCspFileV1Pckg.
+        * @param aNewValues The new values of changed CSP fields, 
+        *                   type RMobilePhone::TMobilePhoneCspFileV1Pckg.
+        * @return Error code. KErrNone if successful.
+        */
+        virtual TInt ChangedCspTable( 
+            TDes8& aChangedCsps,
+            TDes8& aNewValues ) = 0;
+    };
+
+#endif      // MSSSETTINGSREFRESHHANDLER_H  
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/inc/sssettingsprivatecrkeys.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,67 @@
+/*
+* 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:  SSSettings private Central Repository keys.
+*
+*/
+
+
+#ifndef SSSETTINGSPRIVATECRKEYS_H
+#define SSSETTINGSPRIVATECRKEYS_H
+
+// INCLUDES
+#include <e32def.h>
+
+// CONSTANTS
+
+/**
+* Supplementary Service Settings API
+* Supplementary and CPHS service settings.
+*/
+const TUid KCRUidSupplementaryServiceSettings = {0x101F87E3};
+
+/**
+* ALS line for outgoing calls, integer value
+*
+* This setting is only for SSSettings internal use.
+*
+* 0 = ALS not supported
+* 1 = Primary line
+* 2 = Secondary line
+*/
+const TUint32 KSettingsAlsLine = 0x00000001;
+
+/**
+* CLIR (Calling Line Idefitication Restriction) mode.
+*
+* 0 = Network default
+* 1 = Explicit invoke
+* 2 = Explicit suppress
+*/
+const TUint32 KSettingsCLIR = 0x00000002;
+
+/**
+* CUG mode.
+*
+*/
+const TUint32 KSettingsCUG = 0x00000003;
+
+/**
+* Previous CUG index.
+*/
+const TUint32 KSettingsPreviousCUGIndex = 0x00000004;
+
+
+#endif      // SSSETTINGSPRIVATECRKEYS_H
+
+// End of file
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/inc/sssettingsprivatepskeys.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,91 @@
+/*
+* 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:  Private Publish and Subscribe keys.
+*
+*/
+
+
+#ifndef SSSETTINGSPRIVATEPSKEYS_H
+#define SSSETTINGSPRIVATEPSKEYS_H
+
+// INCLUDES
+#include <e32def.h>
+
+// CONSTANTS
+
+/**
+* Configuration settings in (U)SIM and product profile
+*/
+const TUid KPSUidSSConfig = {0x101F87E4};
+
+/**
+* Cached Customer Service Profile(CSP) values.
+*
+* This setting is only for SSSettings'
+* internal use, don't use it directly!
+*
+* Bits 24-31 Call Completion Services
+* Bits 16-23 Call Offering Services
+* Bits 8-15 Call Restriction Services
+* Bits 0-7 Cphs Teleservices
+*/
+const TUint32 KSettingsCspCache1 = 0x00000001;
+
+/**
+* Cached Customer Service Profile(CSP) values.
+*
+* This setting is only for SSSettings'
+* internal use, don't use it directly!
+*
+* Bits 24-31 Other Supp Services (03)
+* Bits 16-23  CPSH Teleservices (06)
+* Bits 8-15 CPHS Features (07)
+* Bits 0-7 Cphs Value Added Services
+*/
+const TUint32 KSettingsCspCache2 = 0x00000002;
+
+/**
+* Cached Customer Service Profile(CSP) values.
+*
+* This setting is only for SSSettings'
+* internal use, don't use it directly!
+*
+* Bits 24-31 <not used>
+* Bits 16-23 Information Numbers (D5) 
+* Bits 8-15 Phase 2+ Services (09)
+* Bits 0-7 Number Identifying (08)
+*/
+const TUint32 KSettingsCspCache3 = 0x00000003;
+
+/**
+* Support for ALS in product profile, integer value.
+*
+* Possible values:
+* 0 (not supported)
+* 1 (supported)
+*/
+const TUint32 KSettingsPPSupportsALS = 0x00000004;
+
+/**
+* Support for ALS in SIM, integer value.
+*
+* Possible values:
+* 0 (not supported)
+* 1 (supported)
+*/
+const TUint32 KSettingsSIMSupportsALS = 0x00000005;
+
+#endif      // SSSETTINGSPRIVATEPSKEYS_H
+
+// End of file
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/logger/sssettingslogger.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,73 @@
+/*
+* 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: 
+*       Macro definition file for logging.
+*
+*
+*/
+
+
+
+#ifndef SSSETTINGSLOGGER_H
+#define SSSETTINGSLOGGER_H
+
+#include "sssettingsloggingconf.h" 
+#include <e32std.h>
+#include <flogger.h>
+#include <e32svr.h>
+
+_LIT( KLogsDir,                  "SSS");
+_LIT( KLogFileName,              "SSS.log");
+
+/*
+ We have 3 possible logging methods:
+
+ set SSS_LOGGING_METHOD to 0 to get no logging at all
+ set SSS_LOGGING_METHOD to 1 to get logging via RDebug::Print
+ set SSS_LOGGING_METHOD to 2 to get logging to log file
+
+ Switching on/off is done in the Configuration file (SSSettingsLoggingConf.h)
+ */
+
+#if ( defined (_SSSLOGGING) )
+    #if ( defined (_SSS_LOGGING_TO_FILE))
+        #define SSS_LOGGING_METHOD 2 
+    #else
+        #define SSS_LOGGING_METHOD 1
+    #endif
+#else
+    #define SSS_LOGGING_METHOD 0
+#endif
+
+
+#if (SSS_LOGGING_METHOD==0)
+    #define __SSSLOGSTRING(C)
+    #define __SSSLOGSTRING1(C, X)
+    #define __SSSLOGSTRING2(C, X, Y)
+    #define __SSSLOGSTRING3(C, X, Y, Z)
+#endif
+#if (SSS_LOGGING_METHOD==1)
+    #define __SSSLOGSTRING(C)            RDebug::Print(_L(C));
+    #define __SSSLOGSTRING1(C, X)        RDebug::Print(_L(C),X);
+    #define __SSSLOGSTRING2(C, X, Y)     RDebug::Print(_L(C),X, Y);
+    #define __SSSLOGSTRING3(C, X, Y, Z)  RDebug::Print(_L(C),X, Y, Z);
+#endif
+#if (SSS_LOGGING_METHOD==2)
+    #define __SSSLOGSTRING(C)            {_LIT(tempLogDes,C);RFileLogger::WriteFormat(KLogsDir(),KLogFileName(), EFileLoggingModeAppend, tempLogDes());}
+    #define __SSSLOGSTRING1(C, X)        {_LIT(tempLogDes,C);RFileLogger::WriteFormat(KLogsDir(),KLogFileName(), EFileLoggingModeAppend, TRefByValue<const TDesC>(tempLogDes()),X);}
+    #define __SSSLOGSTRING2(C, X, Y)     {_LIT(tempLogDes,C);RFileLogger::WriteFormat(KLogsDir(),KLogFileName(), EFileLoggingModeAppend, TRefByValue<const TDesC>(tempLogDes()),X,Y);}
+    #define __SSSLOGSTRING3(C, X, Y, Z)  {_LIT(tempLogDes,C);RFileLogger::WriteFormat(KLogsDir(),KLogFileName(), EFileLoggingModeAppend, TRefByValue<const TDesC>(tempLogDes()),X,Y,Z);}
+#endif
+
+#endif // SSSETTINGSLOGGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/logger/sssettingsloggingconf.h	Wed Jul 21 18:26:52 2010 +0300
@@ -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: 
+*        Macro definition file for logging configuration.
+*       (Note:This file has to be separate from the logging header file 
+*             to be able to include it in mmp file. If not we will get warning about not used 
+*             flogger.lib in other logging cases where flogger.lib is not used.)
+*
+*/
+
+
+
+#ifndef SSSCONFIGURATION_H
+#define SSSCONFIGURATION_H
+
+
+#ifdef _DEBUG // logging to file in debug only
+
+/**
+* - Have this line active if you want to have logging for this component
+* - Comment this line out if you don't want any logging for this component
+*/
+#define _SSSLOGGING
+
+/**
+* - Have this line active if you want to have logging to file
+* - Comment this line out if you want to have logging via RDebug::Print 
+*/
+#define _SSS_LOGGING_TO_FILE
+
+#endif // _DEBUG
+
+#endif // SSSCONFIGURATION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/rom/sssettings.iby	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,24 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  IBY file
+ *
+*/
+
+#ifndef __SSSETTINGS_IBY__
+#define __SSSETTINGS_IBY__
+
+file=ABI_DIR\BUILD_DIR\sssettings.dll       SHARED_LIB_DIR\sssettings.dll
+data=ZSYSTEM\install\sssettings_stub.sis    System\Install\sssettings_stub.sis
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/src/csssettingsactiveobject.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,152 @@
+/*
+* Copyright (c) 2004-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:  Interface for Active object handling Pub&Sub notify events.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "csssettingsactiveobject.h" 
+#include    <e32property.h>
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSSSettingsActiveObject::CSSSettingsActiveObject
+// -----------------------------------------------------------------------------
+//
+CSSSettingsActiveObject::CSSSettingsActiveObject(
+    const TUid aNotifyUid,
+    const TUint32 aNotifyKey,
+    MSSSettingsPubSubNotify& aNotifyHandler )
+:   CActive( CActive::EPriorityStandard ),
+    iNotifyUid ( aNotifyUid ),
+    iNotifyKey( aNotifyKey ),
+    iNotifyHandler( &aNotifyHandler ),
+    iNotify( EFalse )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsActiveObject::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CSSSettingsActiveObject::ConstructL()
+    {
+    TInt err = iProperty.Attach(
+        iNotifyUid,
+        iNotifyKey );
+    User::LeaveIfError( err );
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsActiveObject::NewL
+// -----------------------------------------------------------------------------
+//
+CSSSettingsActiveObject* CSSSettingsActiveObject::NewL(
+    const TUid aNotifyUid,
+    const TUint32 aNotifyKey,
+    MSSSettingsPubSubNotify& aNotifyHandler )
+    {
+    CSSSettingsActiveObject* self = 
+        new ( ELeave ) CSSSettingsActiveObject(
+            aNotifyUid,
+            aNotifyKey,
+            aNotifyHandler );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsActiveObject::~CSSSettingsActiveObject
+// -----------------------------------------------------------------------------
+//
+CSSSettingsActiveObject::~CSSSettingsActiveObject()
+    {
+    Cancel();
+    iProperty.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsActiveObject::NotifyKeyChange
+// -----------------------------------------------------------------------------
+//
+TInt CSSSettingsActiveObject::NotifyKeyChange()
+    {
+    TInt err(KErrNone);
+    if ( iNotify || IsActive() )
+        {
+        // Notify already active, so return error code.
+        err = KErrInUse;
+        }
+    else
+        {
+        iProperty.Subscribe( iStatus );
+        SetActive();
+        iNotify = ETrue;
+        }
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsActiveObject::CancelNotifyCancelNotify
+// -----------------------------------------------------------------------------
+//
+void CSSSettingsActiveObject::CancelNotify()
+    {
+    Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsActiveObject::RunL
+// -----------------------------------------------------------------------------
+//
+void CSSSettingsActiveObject::RunL()
+    {
+    TInt err = iStatus.Int();
+    if ( err != KErrCancel && !iNotify )
+        {
+        // Reset the notification.
+        iProperty.Subscribe( iStatus );
+        SetActive();
+        }
+    
+    if ( !err )
+        {
+        if ( iNotifyHandler )
+            {
+            iNotifyHandler->HandlePubSubNotify(
+                iNotifyUid,
+                iNotifyKey );
+            }
+        }
+    }
+
+// ---------------------------------------------------------
+// CSSSettingsActiveObject::DoCancel
+// ---------------------------------------------------------
+//
+void CSSSettingsActiveObject::DoCancel()
+    {
+    iNotify = EFalse;
+    iProperty.Cancel();
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/src/csssettingsalsnotifier.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,703 @@
+/*
+* 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:  Interface for ALS control
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <rmmcustomapi.h>
+#include    <startupdomainpskeys.h>
+#include    <centralrepository.h>
+#include    <sssettingsprivatepskeys.h> // sssettings pub&sub keys. 
+#include    <sssettingsprivatecrkeys.h> // sssettings centrep keys. 
+#include    <PSVariables.h> 
+
+#include    "csssettingsalsnotifier.h" 
+#include    "csssettingsactiveobject.h" 
+#include    "sssettingslogger.h" 
+
+// ================= MEMBER FUNCTIONS =======================
+// -----------------------------------------------------------------------------
+// CSSSettingsAlsNotifier::CSSSettingsAlsNotifier
+// -----------------------------------------------------------------------------
+//
+CSSSettingsAlsNotifier::CSSSettingsAlsNotifier( 
+    RMobilePhone& aMobilePhone,
+    RMmCustomAPI& aCustomPhone,
+    MCenRepNotifyHandlerCallback& aAlsNotifyHandler )
+: CActive( EPriorityStandard ), 
+  iMobilePhone( aMobilePhone ),
+  iCustomPhone( aCustomPhone ),
+  iAlsNotifyHandler( &aAlsNotifyHandler )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CSSSettingsAlsNotifier::ConstructL
+// -----------------------------------------------------------------------------
+// 
+void CSSSettingsAlsNotifier::ConstructL()
+    {
+    iRepository = CRepository::NewL ( KCRUidSupplementaryServiceSettings );
+    iCenRepNotifyHandler = CCenRepNotifyHandler::NewL(
+            *this, 
+            *iRepository, 
+            CCenRepNotifyHandler::EIntKey, 
+            KSettingsAlsLine );
+    iCenRepNotifyHandler->StartListeningL();
+
+    TInt error(KErrNone);
+    error = RProperty::Define(
+        KPSUidSSConfig,
+        KSettingsPPSupportsALS,
+        RProperty::EInt );
+    if( ( error != KErrNone ) && ( error != KErrAlreadyExists ) )
+        {
+        User::Leave ( error );
+        }
+    error = RProperty::Define(
+        KPSUidSSConfig,
+        KSettingsSIMSupportsALS,
+        RProperty::EInt );
+    if( ( error != KErrNone ) && ( error != KErrAlreadyExists ) )
+        {
+        User::Leave ( error );
+        }
+
+    iPPSupportsAlNotifier = CSSSettingsActiveObject::NewL(
+        KPSUidSSConfig,
+        KSettingsPPSupportsALS,
+        *this );
+    iSimSupportsAlsNotifier = CSSSettingsActiveObject::NewL(
+        KPSUidSSConfig,
+        KSettingsSIMSupportsALS,
+        *this );
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsAlsNotifier::NewL
+// -----------------------------------------------------------------------------
+//
+CSSSettingsAlsNotifier* CSSSettingsAlsNotifier::NewL(
+    RMobilePhone& aMobilePhone,
+    RMmCustomAPI& aCustomPhone,
+    MCenRepNotifyHandlerCallback& aAlsNotifyHandler )
+    {
+    CSSSettingsAlsNotifier* self = 
+        new ( ELeave ) CSSSettingsAlsNotifier(  
+            aMobilePhone, 
+            aCustomPhone, 
+            aAlsNotifyHandler );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsAlsNotifier::~CSSSettingsAlsNotifier
+// -----------------------------------------------------------------------------
+// 
+CSSSettingsAlsNotifier::~CSSSettingsAlsNotifier()
+    {
+    delete iPPSupportsAlNotifier;
+    delete iSimSupportsAlsNotifier;
+
+    if( iCenRepNotifyHandler )
+        {
+        iCenRepNotifyHandler->StopListening();
+        }
+    delete iCenRepNotifyHandler;
+    delete iRepository;
+    
+    Cancel();
+    // Do close after active request has been cancelled.
+    iMobilePhone.Close();
+    iCustomPhone.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsAlsNotifier::RunL
+// -----------------------------------------------------------------------------
+//
+void CSSSettingsAlsNotifier::RunL()
+    {
+    __SSSLOGSTRING("[SSS]--> CSSSettingsAlsNotifier::RunL");
+    TInt error = iStatus.Int();
+    if (( error == KErrCancel ) || ( error == KErrNotSupported ))
+        {
+        return;
+        }
+
+    // Reset the request:
+    RMobilePhone::TMobilePhoneALSLine newLine = iSimActiveAls;
+    iMobilePhone.NotifyALSLineChange( iStatus, iSimActiveAls );
+    SetActive();
+    
+    if ( error == KErrNone )
+        {
+        TSSSettingsAlsValue newValue = ESSSettingsAlsNotSupported;
+        if ( newLine == RMobilePhone::EAlternateLinePrimary )
+            {
+            newValue = ESSSettingsAlsPrimary;
+            }
+        else if ( newLine == RMobilePhone::EAlternateLineAuxiliary )
+            {
+            newValue = ESSSettingsAlsAlternate;
+            }
+        else
+            {
+            newValue = ESSSettingsAlsNotSupported;
+            }
+
+        // Inform observer.
+        iAlsNotifyHandler->HandleNotifyInt(
+            KSettingsAlsLine,
+            newValue );
+        }
+    __SSSLOGSTRING("[SSS] <--CSSSettingsAlsNotifier::RunL");
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsAlsNotifier::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CSSSettingsAlsNotifier::DoCancel()
+    {
+    iMobilePhone.CancelAsyncRequest( EMobilePhoneNotifyALSLineChange );    
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsAlsNotifier::NotifyAlsChange
+// -----------------------------------------------------------------------------
+//
+TInt CSSSettingsAlsNotifier::NotifyAlsChange()
+    {
+    __SSSLOGSTRING("[SSS]--> CSSSettingsAlsNotifier::NotifyAlsChange");
+    TInt error = EnsureAlsStatus();
+    if ( error == KErrNone )
+        {
+        error = iPPSupportsAlNotifier->NotifyKeyChange();
+        
+        if ( error == KErrNone || error == KErrAlreadyExists )
+            {
+            error = iSimSupportsAlsNotifier->NotifyKeyChange();
+            if ( error != KErrNone && error != KErrAlreadyExists )
+                {
+                iPPSupportsAlNotifier->CancelNotify();
+                }
+            }   
+        if ( error == KErrNone || error == KErrAlreadyExists )
+            {
+            // Add notifier to Etel side if supported
+            if ( !IsActive() && iSimSupportAls )
+                {
+                iMobilePhone.NotifyALSLineChange( iStatus, iSimActiveAls );
+                SetActive();
+
+                // Everything was ok, so inform that.
+                error = KErrNone;
+                }
+            }
+        }
+    __SSSLOGSTRING("[SSS] <--CSSSettingsAlsNotifier::NotifyAlsChange");
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsAlsNotifier::CancelNotify
+// -----------------------------------------------------------------------------
+//
+void CSSSettingsAlsNotifier::CancelNotify()
+    {
+    iCenRepNotifyHandler->StopListening();
+    iPPSupportsAlNotifier->CancelNotify();
+    iSimSupportsAlsNotifier->CancelNotify();
+    Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsAlsNotifier::SetAlsValue
+// -----------------------------------------------------------------------------
+//
+TInt CSSSettingsAlsNotifier::SetAlsValue( TSSSettingsAlsValue aValue )
+    {
+    __SSSLOGSTRING("[SSS]--> CSSSettingsAlsNotifier::SetAlsValue");
+    TInt error = EnsureAlsStatus();
+    if ( error != KErrNone )
+        {
+        return error;
+        }
+        // If ALS not supported...
+    if ( !iPPSupportAls && !iSimSupportAls && !iAlsCSPSupport )
+        {
+        aValue = ESSSettingsAlsNotSupported;
+        __SSSLOGSTRING1("[SSS]--> CSSSettingsAlsNotifier::SetAlsValue: aValue: %d", aValue);
+        return KErrNone;
+        }
+    
+    // Check if aValue is corrupted.
+    if (( aValue < ESSSettingsAlsNotSupported ) || 
+        ( aValue > ESSSettingsAlsAlternate ))
+        {
+        return KErrArgument;
+        }
+
+    // If ALS is supported on SIM, use that.
+    if ( iSimSupportAls )
+        {
+        __SSSLOGSTRING("[SSS]--> CSSSettingsAlsNotifier::SetAlsValue: SIM ALS supported");
+        // Write to ETel
+        RMobilePhone::TMobilePhoneALSLine simAlsLine;
+        switch ( aValue )
+            {
+            case ESSSettingsAlsPrimary:
+                simAlsLine = RMobilePhone::EAlternateLinePrimary;
+                break;
+            case ESSSettingsAlsAlternate:
+                simAlsLine = RMobilePhone::EAlternateLineAuxiliary;
+                break;
+            default:
+                return KErrNotSupported;
+            }
+        TRequestStatus status;
+        iMobilePhone.SetALSLine( status, simAlsLine );
+        User::WaitForRequest( status );
+        error = status.Int();
+        }
+    else
+        {
+        error = iRepository->Set( KSettingsAlsLine, aValue );
+        __SSSLOGSTRING1("[SSS]--> CSSSettingsAlsNotifier::SetAlsValue: aValue: %d", aValue);
+        }
+
+    __SSSLOGSTRING("[SSS] <--CSSSettingsAlsNotifier::SetAlsValue");
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsAlsNotifier::GetAlsValue
+// -----------------------------------------------------------------------------
+//
+TInt CSSSettingsAlsNotifier::GetAlsValue( TSSSettingsAlsValue& aValue )
+    {
+    __SSSLOGSTRING("[SSS]--> CSSSettingsAlsNotifier::GetAlsValue");
+    TInt error = EnsureAlsStatus();
+    if ( error != KErrNone )
+        {
+        return error;
+        }
+
+    // If ALS not supported...
+    if ( !iPPSupportAls && !iSimSupportAls && !iAlsCSPSupport )
+        {
+        aValue = ESSSettingsAlsNotSupported;
+        __SSSLOGSTRING1("[SSS]--> CSSSettingsAlsNotifier::GetAlsValue: aValue: %d", aValue);
+        return KErrNone;
+        }
+        
+    // Check if aValue is corrupted.
+    if (( aValue < ESSSettingsAlsNotSupported ) || 
+        ( aValue > ESSSettingsAlsAlternate ))
+        {
+        return KErrArgument;
+        }
+
+    // If ALS is supported on SIM, use that.
+    if ( iSimSupportAls )
+        {   
+        // Get from ETel;
+        RMobilePhone::TMobilePhoneALSLine simAlsLine;
+        error = iMobilePhone.GetALSLine( simAlsLine );
+        if ( error != KErrNone )
+            {
+            return error;
+            }
+        switch ( simAlsLine )
+            {
+            case RMobilePhone::EAlternateLineAuxiliary:
+                aValue = ESSSettingsAlsAlternate;
+                break;
+            case RMobilePhone::EAlternateLinePrimary:
+                aValue = ESSSettingsAlsPrimary;
+                break;
+            default:
+                __ASSERT_DEBUG( EFalse , Panic( 
+                    SSSettingsPanicConflictInAls ) );
+                aValue = ESSSettingsAlsNotSupported;
+                error = KErrCorrupt;
+                break;
+            }
+        __SSSLOGSTRING1("[SSS]--> CSSSettingsAlsNotifier::GetAlsValue: SimAls supported: aValue: %d", aValue);
+        }
+    else
+        {
+        error = iRepository->Get( KSettingsAlsLine, (TInt&)aValue );
+         
+        if ( error != KErrNone )
+            {
+            return error;
+            }
+        
+        TInt usedLine = aValue;
+
+        // If used SIM doesn't support ALS set ESSSettingsAlsPrimary line to use.
+        if ( error == KErrNone && usedLine == ESSSettingsAlsNotSupported )
+            {
+            // Set default value
+            error = SetAlsValue( ESSSettingsAlsPrimary );
+            if ( error == KErrNone )
+                {
+                aValue = ESSSettingsAlsPrimary;
+                }
+            }
+        else if (( aValue < ESSSettingsAlsNotSupported ) || 
+                 ( aValue > ESSSettingsAlsAlternate ))
+            {
+            error = KErrCorrupt;
+            }
+        __SSSLOGSTRING1("[SSS]--> CSSSettingsAlsNotifier::GetAlsValue: aValue: %d", aValue);
+        }
+    __SSSLOGSTRING("[SSS] <--CSSSettingsAlsNotifier::GetAlsValue");
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsAlsNotifier::GetAlsSupport
+// -----------------------------------------------------------------------------
+//
+void CSSSettingsAlsNotifier::GetAlsSupport( 
+    TBool& aPPSupport, TBool& aSimSupport, TBool& aCSPSupport, TInt& aCSPError )
+    {
+    __SSSLOGSTRING("[SSS]--> CSSSettingsAlsNotifier::GetAlsSupport");
+    TInt error = EnsureAlsStatus();
+
+    if( error != KErrNone )
+        {
+        __SSSLOGSTRING("[SSS]     If we aren't able to get ALS status we can not support it");
+        // If we aren't able to get ALS status we can not support it.
+        aPPSupport = EFalse;
+        aSimSupport = EFalse;
+        aCSPSupport = EFalse;
+        aCSPError = iAlsCSPError;
+        return;
+        }
+
+    aPPSupport = iPPSupportAls;
+    aSimSupport = iSimSupportAls;
+    aCSPSupport = iAlsCSPSupport;
+    aCSPError = iAlsCSPError;
+    __SSSLOGSTRING1("[SSS]--> CSSSettingsAlsNotifier::GetAlsSupport: iPPSupportAls: %d", iPPSupportAls);
+    __SSSLOGSTRING1("[SSS]--> CSSSettingsAlsNotifier::GetAlsSupport: iSimSupportAls: %d", iSimSupportAls);
+    __SSSLOGSTRING1("[SSS]--> CSSSettingsAlsNotifier::GetAlsSupport: iAlsCSPSupport: %d", iAlsCSPSupport);
+    __SSSLOGSTRING("[SSS] <--CSSSettingsAlsNotifier::GetAlsSupport");
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsAlsNotifier::CheckAlsSupportInProductProfile
+// -----------------------------------------------------------------------------
+//
+TInt CSSSettingsAlsNotifier::CheckAlsSupportInProductProfile( 
+    TBool& aIsAlsSopportedInPP )
+    {
+    __SSSLOGSTRING("[SSS]--> CSSSettingsAlsNotifier::CheckAlsSupportInProductProfile");
+    RMmCustomAPI::TAlsSupport ppAlsSupport;
+
+    TInt error = iCustomPhone.CheckAlsPpSupport( ppAlsSupport );
+
+    if ( ( error == KErrNone ) &&
+         ( ppAlsSupport == RMmCustomAPI::EAlsSupportOn ) )
+        {
+        aIsAlsSopportedInPP = ETrue;
+        }
+    else
+        {
+        aIsAlsSopportedInPP = EFalse;
+        }
+    __SSSLOGSTRING1("[SSS]--> CSSSettingsAlsNotifier::CheckAlsSupportInProductProfile: aIsAlsSopportedInPP: %d", aIsAlsSopportedInPP);
+    __SSSLOGSTRING("[SSS] <--CSSSettingsAlsNotifier::CheckAlsSupportInProductProfile");
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsAlsNotifier::CheckAlsSupportInSim
+// -----------------------------------------------------------------------------
+//
+TInt CSSSettingsAlsNotifier::CheckAlsSupportInSim(
+    TBool& aIsAlsSopportedInSim )
+    {
+    __SSSLOGSTRING("[SSS]--> CSSSettingsAlsNotifier::CheckAlsSupportInSim");
+    RMobilePhone::TMobilePhoneALSLine simAlsSupport;
+    TInt error = iMobilePhone.GetALSLine( simAlsSupport );
+ 
+    if (( error != KErrNone ) ||
+        ( simAlsSupport == RMobilePhone::EAlternateLineUnknown ) || 
+        ( simAlsSupport == RMobilePhone::EAlternateLineNotAvailable ))
+        {
+        aIsAlsSopportedInSim = EFalse;
+        }
+    else
+        {
+        aIsAlsSopportedInSim = ETrue;
+        }
+    __SSSLOGSTRING1("[SSS]--> CSSSettingsAlsNotifier::CheckAlsSupportInSim: aIsAlsSopportedInSim: %d", aIsAlsSopportedInSim);
+    __SSSLOGSTRING("[SSS] <--CSSSettingsAlsNotifier::CheckAlsSupportInSim");
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsAlsNotifier::EnsureAlsStatus
+// -----------------------------------------------------------------------------
+//
+TInt CSSSettingsAlsNotifier::EnsureAlsStatus()
+    {
+    RMobilePhone::TCspCPHSTeleservices params = ( RMobilePhone::TCspCPHSTeleservices )0;
+    TInt error(KErrNone);
+    TInt simState(0);
+    TBool savePPSimAls(0);
+    TBool saveSimAls(0);
+
+    __SSSLOGSTRING("[SSS]--> CSSSettingsAlsNotifier::EnsureAlsStatus");    
+    if ( iAlsStatusChecked )
+       {
+       __SSSLOGSTRING1("[SSS]--> CSSSettingsAlsNotifier::EnsureAlsStatus - Already checked: %d", iAlsStatusChecked);  
+       return KErrNone;
+       }
+   
+    error = RProperty::Get( KPSUidStartup, KPSSimStatus, simState );
+    __SSSLOGSTRING1("[SSS]--> CSSSettingsAlsNotifier::EnsureAlsStatus - KPSUidSIMStatusValue: %d", simState);  
+    __SSSLOGSTRING1("[SSS]--> CSSSettingsAlsNotifier::EnsureAlsStatus - KPSUidSIMStatusValue Error: %d", error);
+
+    if ( error == KErrNone )
+        {
+        // Make sure that SIM state is OK otherwise parameters coming from SIM are mess.
+        if ( simState ==ESimUsable )
+            {
+            // Get Als support from Product Profile.
+            error = CheckAlsSupportInProductProfile( iPPSupportAls );
+            if ( error == KErrNone )
+                {
+                savePPSimAls = ETrue;
+                }            
+            if ( error != KErrNone )
+                {
+                return error;
+                }
+                
+            // Get Als support from SIM.  
+            error = CheckAlsSupportInSim( iSimSupportAls );
+            if ( error == KErrNone )
+                {
+                saveSimAls = ETrue;
+                }                
+            if ( ( error != KErrNone ) && ( error != KErrNotFound ) )
+                {
+                return error;
+                } 
+                
+            // Open connection RCustomerServiceProfileCache.
+            RCustomerServiceProfileCache alsProfileCache;
+            error = alsProfileCache.Open();
+            if ( error != KErrNone )
+                {
+                return error;
+                } 
+                
+            // Get ALS CSP bit from cache.
+            iAlsCSPError = alsProfileCache.CspCPHSTeleservices( params );
+            
+            if ( iAlsCSPError == KErrNone || iAlsCSPError == KErrNotSupported )
+                {
+                // Checks CSP ALS support.
+                iAlsCSPSupport = CheckIfAlsCSPSupported( params );
+                }
+            // If ETEL/TSY responses with error KErrNotReady/KErrServerBusy then CSP value is not correct one
+            // and iAlsStatusChecked is set to EFalse.      
+            else if ( iAlsCSPError == KErrNotReady || iAlsCSPError == KErrServerBusy ) 
+                {
+                iAlsStatusChecked = EFalse;
+                alsProfileCache.Close();
+                return iAlsCSPError;
+                } 
+            // Close connection RCustomerServiceProfileCache.
+            alsProfileCache.Close();   
+
+            // Save PP and SIM als values to P&S.
+            if ( savePPSimAls )
+               {
+               error = RProperty::Set( KPSUidSSConfig, KSettingsPPSupportsALS, iPPSupportAls );
+               if ( error != KErrNone )
+                   {
+                   return error;
+                   }
+               }
+             
+            if ( saveSimAls )
+               {
+               error = RProperty::Set( KPSUidSSConfig, KSettingsSIMSupportsALS, iSimSupportAls );
+               if ( error != KErrNone )
+                   {
+                   return error;
+                   }
+               }
+                                
+            iAlsStatusChecked = ETrue;
+            }
+        else
+            {
+            iAlsStatusChecked = EFalse;    
+            }
+        }    
+    __SSSLOGSTRING1("[SSS]--> CSSSettingsAlsNotifier::EnsureAlsStatus: iAlsStatusChecked: %d", iAlsStatusChecked);
+    __SSSLOGSTRING("[SSS] <--CSSSettingsAlsNotifier::EnsureAlsStatus");
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CSSSettingsAlsNotifier::CheckIfAlsCSPSupported
+// ---------------------------------------------------------------------------
+// 
+TBool CSSSettingsAlsNotifier::CheckIfAlsCSPSupported(
+    const RMobilePhone::TCspCPHSTeleservices aContainer ) const
+    {
+    TBool supported(EFalse);
+
+    if ( ( aContainer & RMobilePhone::KCspALS ) != 0 )
+        {       
+        supported = ETrue;  
+        }
+    return supported;
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsAlsNotifier::HandleNotifyInt
+// -----------------------------------------------------------------------------
+//
+void CSSSettingsAlsNotifier::HandleNotifyInt( TUint32 aId, TInt /*aNewValue*/ )
+    {
+    __SSSLOGSTRING("[SSS] -->CSSSettingsAlsNotifier::HandleNotifyInt");
+    if ( aId == KSettingsAlsLine )
+        {
+        iAlsStatusChecked = EFalse;
+        EnsureAlsStatus();
+
+        // Inform others
+        TSSSettingsAlsValue newLine = ESSSettingsAlsNotSupported;
+        if ( GetAlsValue( newLine ) == KErrNone )
+            {
+            iAlsNotifyHandler->HandleNotifyInt(
+                KSettingsAlsLine,
+                newLine );
+            }
+        }
+    __SSSLOGSTRING("[SSS] <--CSSSettingsAlsNotifier::HandleNotifyInt");
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsAlsNotifier::HandleNotifyError
+// -----------------------------------------------------------------------------
+//
+void CSSSettingsAlsNotifier::HandleNotifyError( TUint32 aId, TInt /*aError*/,
+    CCenRepNotifyHandler* /*aHandler*/ )
+    {
+    if ( aId == KSettingsAlsLine )
+        {
+        // Here you could call the below, if you are sure that it do not cause 
+        // eternal loop
+        // TRAPD( error, aHandler->StartListeningL() );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsAlsNotifier::HandlePubSubNotify
+// -----------------------------------------------------------------------------
+//
+void CSSSettingsAlsNotifier::HandlePubSubNotify( const TUid aUid, const TUint32 aKeyId )
+    {
+    if ( aUid == KPSUidSSConfig )
+        {
+        if ( ( aKeyId == KSettingsPPSupportsALS ) || 
+             ( aKeyId == KSettingsSIMSupportsALS ) )
+            {
+            
+            if ( iAlsStatusChecked == EFalse )
+                {
+                EnsureAlsStatus();
+                }
+            
+            // Inform others
+            TSSSettingsAlsValue newValue = ESSSettingsAlsNotSupported;
+            if ( GetAlsValue( newValue ) == KErrNone )
+                {
+                iAlsNotifyHandler->HandleNotifyInt( 
+                    KSettingsAlsLine,
+                    newValue );
+                }
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsAlsNotifier::HandleRefresh
+// -----------------------------------------------------------------------------
+TInt CSSSettingsAlsNotifier::HandleRefresh()
+    {
+    __SSSLOGSTRING("[SSS]--> CSSSettingsAlsNotifier::HandleRefresh");
+    TInt error = CheckAlsSupportInProductProfile( iPPSupportAls );
+    if ( error == KErrNone )
+        {
+        error = RProperty::Set( 
+            KPSUidSSConfig, 
+            KSettingsPPSupportsALS, 
+            iPPSupportAls );
+        }
+        
+    if ( error != KErrNone )
+        {
+        return error;
+        }
+    
+    error = CheckAlsSupportInSim( iSimSupportAls );
+    if ( error == KErrNone )
+        {
+        error = RProperty::Set(
+            KPSUidSSConfig,
+            KSettingsSIMSupportsALS,
+            iSimSupportAls );
+        }
+        
+    if ( error != KErrNone )
+        {
+        return error;
+        }
+
+    // Inform others
+    TSSSettingsAlsValue newLine;
+    error = GetAlsValue( newLine );
+    if ( error == KErrNone )
+        {
+        SetAlsValue( newLine );
+        }
+
+    __SSSLOGSTRING("[SSS] <--CSSSettingsAlsNotifier::HandleRefresh");
+    return error;
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/src/csssettingsnotifier.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,422 @@
+/*
+* 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:  Notifier for changes.
+*
+*/
+
+
+// INCLUDE FILES
+#include    <rmmcustomapi.h>
+#include    <centralrepository.h>
+#include    <sssettingsprivatecrkeys.h> 
+
+#include    "csssettingsnotifier.h" 
+#include    "msssettingsobserver.h" 
+#include    "csssettingsalsnotifier.h" 
+#include    "sssettingslogger.h" 
+
+
+// DATA TYPES
+
+/**
+* It enumerates all keys to be notified from Central Repository under 
+* KCRUidSupplementaryServiceSettings.
+*
+*   ESSSettingsKeyNone    - No key change to be notified.
+*   ESSSettingsKeyAlsLine - Als line change to be notified.
+*   ESSSettingsKeyClir    - Clir change to be notified.
+*   ESSSettingsKeyCug     - Cug change to be notified.
+*   ESSSettingsKeyAll     - All keys to be notified.
+*/
+enum TSSSettingsCenRepNotifyKey
+    {
+    ESSSettingsKeyNone    = 0x00000000,
+    ESSSettingsKeyAlsLine = 0x00000001,
+    ESSSettingsKeyClir    = 0x00000002,
+    ESSSettingsKeyCug     = 0x00000004,
+
+    // Keep as last.
+    ESSSettingsKeyAll     = 0xFFFFFFFF
+    };
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CSSSettingsNotifier::CSSSettingsNotifier
+// -----------------------------------------------------------------------------
+//
+CSSSettingsNotifier::CSSSettingsNotifier( RSSSettings& aSettings ) 
+: CActive( EPriorityStandard ), 
+  iSettings( aSettings ),
+  iNotifyKeys ( ESSSettingsKeyNone )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CSSSettingsNotifier::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CSSSettingsNotifier::ConstructL()
+    {
+    iAls = CSSSettingsAlsNotifier::NewL( 
+        iSettings.iData->iMobilePhone,
+        *iSettings.iData->iCustomPhone,
+        *this );
+
+    iRepository = CRepository::NewL( KCRUidSupplementaryServiceSettings );
+    
+    iCenRepAlsNotifyHandler = CCenRepNotifyHandler::NewL(
+        *this, 
+        *iRepository,
+        CCenRepNotifyHandler::EIntKey,
+        KSettingsAlsLine );
+    
+    iCenRepClirNotifyHandler = CCenRepNotifyHandler::NewL(
+        *this, 
+        *iRepository,
+        CCenRepNotifyHandler::EIntKey,
+        KSettingsCLIR );
+    
+    iCenRepCugNotifyHandler = CCenRepNotifyHandler::NewL(
+        *this, 
+        *iRepository,
+        CCenRepNotifyHandler::EIntKey,
+        KSettingsCUG );
+    
+    // Start listening all the keys, the notify is handled only if there is
+    // notify request made.
+    iCenRepAlsNotifyHandler->StartListeningL();
+    iCenRepClirNotifyHandler->StartListeningL();
+    iCenRepCugNotifyHandler->StartListeningL();
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsNotifier::~CSSSettingsNotifier
+// -----------------------------------------------------------------------------
+//
+CSSSettingsNotifier::~CSSSettingsNotifier()
+    {
+    Cancel();
+    if( iCenRepAlsNotifyHandler )
+        {
+        iCenRepAlsNotifyHandler->StopListening();
+        }
+
+    if( iCenRepClirNotifyHandler )
+        {
+        iCenRepClirNotifyHandler->StopListening();
+        }
+
+    if( iCenRepCugNotifyHandler )
+        {
+        iCenRepCugNotifyHandler->StopListening();
+        }
+    
+    delete iCenRepAlsNotifyHandler;
+    delete iCenRepClirNotifyHandler;
+    delete iCenRepCugNotifyHandler;
+    delete iRepository;
+    delete iAls;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsNotifier::AddNotifier
+// -----------------------------------------------------------------------------
+//
+TInt CSSSettingsNotifier::AddNotifier( TSSSettingsSetting aSetting )
+    {
+    __SSSLOGSTRING("[SSS]--> CSSSettingsNotifier::AddNotifier");
+    TInt error(KErrNone);
+    switch ( aSetting )
+        {
+        case ESSSettingsCug:
+            iNotifyKeys = ( iNotifyKeys | ESSSettingsKeyCug );
+            break;
+
+        case ESSSettingsClir:
+            iNotifyKeys = ( iNotifyKeys | ESSSettingsKeyClir );
+            break;
+
+        case ESSSettingsAls:
+            error = iAls->NotifyAlsChange();
+            if ( error == KErrNone || error == KErrAlreadyExists )
+                {
+                iNotifyKeys = ( iNotifyKeys | ESSSettingsKeyAlsLine );
+                }
+            break;
+
+        case ESSSettingsAlsBlocking:
+            // Handled via active object
+            if ( !IsActive() )
+                {
+                iSettings.iData->iCustomPhone->NotifyAlsBlockedChanged( 
+                    iStatus, iAlsBlockStatus );
+                SetActive();
+                }
+            else
+                {
+                error = KErrAlreadyExists;
+                }
+            break;
+
+        case ESSSettingsDefaultCug:
+            //CUG default cannot be changed
+            break;
+
+        default:
+            error = KErrNotSupported;
+        }   
+
+    __SSSLOGSTRING1("[SSS]     CSSSettingsNotifier::AddNotifier: error: %d", error );
+    __SSSLOGSTRING("[SSS] <--CSSSettingsNotifier::AddNotifier");
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsNotifier::RemoveNotifier
+// -----------------------------------------------------------------------------
+//
+void CSSSettingsNotifier::RemoveNotifier( TSSSettingsSetting aSetting )
+    {
+    __SSSLOGSTRING("[SSS]--> CSSSettingsNotifier::RemoveNotifier");
+    switch ( aSetting )
+        {
+        case ESSSettingsCug:
+            iNotifyKeys = ( iNotifyKeys & ( ~ESSSettingsKeyCug ) );
+            break;
+
+        case ESSSettingsClir:
+            iNotifyKeys = ( iNotifyKeys & ( ~ESSSettingsKeyClir ) );
+            break;
+
+        case ESSSettingsAls:
+            if ( iAls )
+                {
+                iAls->CancelNotify();
+                }
+            iNotifyKeys = ( iNotifyKeys  & ( ~ESSSettingsKeyAlsLine ) );
+            break;
+
+        case ESSSettingsAlsBlocking:
+            Cancel();
+            break;
+
+        default:
+            break;
+        } 
+    __SSSLOGSTRING("[SSS] <--CSSSettingsNotifier::RemoveNotifier");
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsNotifier::RunL
+// -----------------------------------------------------------------------------
+//
+void CSSSettingsNotifier::RunL()
+    {
+    __SSSLOGSTRING("[SSS]--> CSSSettingsNotifier::RunL");
+    switch ( iStatus.Int() )
+        {
+        case KErrCancel:
+        case KErrNotSupported:
+            return;
+        case KErrNone:
+            // Inform observers
+            switch ( iAlsBlockStatus )
+                {
+                case RMmCustomAPI::EBlockStatusNotSupported: 
+                    iSettings.InformChange( 
+                        ESSSettingsAlsBlocking, 
+                        static_cast <TInt>( 
+                        ESSSettingsAlsBlockingNotSupported ) );
+                    break;
+                case RMmCustomAPI::EBlockStatusActive: 
+                    iSettings.InformChange( 
+                        ESSSettingsAlsBlocking, 
+                        static_cast <TInt>( ESSSettingsAlsBlockingOn ) );
+                    break;
+                case RMmCustomAPI::EBlockStatusInactive: 
+                    iSettings.InformChange( ESSSettingsAlsBlocking,
+                        static_cast <TInt>( ESSSettingsAlsBlockingOff ) );
+                    break;
+                case RMmCustomAPI::EBlockStatusUnknown: 
+                    break;
+                default:
+                    break;
+                }
+            break;
+        default:
+            break;
+        }
+
+    // re-activate request.
+    iSettings.iData->iCustomPhone->NotifyAlsBlockedChanged( 
+        iStatus, iAlsBlockStatus );
+    SetActive();
+
+    __SSSLOGSTRING("[SSS] <--CSSSettingsNotifier::RunL");
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsNotifier::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CSSSettingsNotifier::DoCancel()
+    {
+    iSettings.iData->iCustomPhone->CancelAsyncRequest( 
+        ECustomNotifyAlsBlockedChangedIPC );
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsNotifier::HandleNotifyInt
+// -----------------------------------------------------------------------------
+//
+void CSSSettingsNotifier::HandleNotifyInt( TUint32 aId, TInt aNewValue )
+    {
+    __SSSLOGSTRING2("[SSS] -->CSSSettingsNotifier::HandleNotifyInt aId: %d  aNewValue: %d", aId, aNewValue);
+    // First check CUG mode
+    if ( aId == KSettingsCUG )
+        {
+        // Inform change only if Cug notify request is on.
+        if ( iNotifyKeys & ESSSettingsKeyCug )
+            {
+            iSettings.InformChange(
+                ESSSettingsCug,
+                aNewValue );
+            }
+        }
+
+    // Then CLIR
+    else if ( aId == KSettingsCLIR )
+        {
+        // Inform change only if Clir notify request is on.
+        if ( iNotifyKeys & ESSSettingsKeyClir )
+            {
+            iSettings.InformChange(
+                ESSSettingsClir,
+                aNewValue );
+            }
+        }
+
+    // ALS - not forwarded if not supported
+    else if ( aId == KSettingsAlsLine )
+        {
+        // Inform change only if Als line notify request is on.
+        if ( iNotifyKeys & ESSSettingsKeyAlsLine )
+            {
+            TBool ppSupported(EFalse);
+            TBool simSupported(EFalse);
+            TBool cspSupported(EFalse);
+            TInt cspError(KErrNone);
+            iAls->GetAlsSupport( ppSupported, 
+                                simSupported, 
+                                cspSupported, 
+                                cspError );
+            __SSSLOGSTRING1("[SSS]    ppSupported:  %d", ppSupported);
+            __SSSLOGSTRING1("[SSS]    simSupported: %d", simSupported);
+            __SSSLOGSTRING1("[SSS]    cspSupported: %d", cspSupported);
+            __SSSLOGSTRING1("[SSS]    cspError:     %d", cspError);
+            if ( AlsSupport( ppSupported, cspSupported, cspError ) )
+                {
+                __SSSLOGSTRING1("[SSS] ->InformChange aNewValue:%d", aNewValue);
+                iSettings.InformChange(
+                    ESSSettingsAls,
+                    aNewValue );
+                }
+            else
+                {
+                __SSSLOGSTRING("[SSS] ->InformChange AlsNotSupported ");
+                iSettings.InformChange( 
+                    ESSSettingsAls,
+                    ESSSettingsAlsNotSupported );
+                }
+            }
+        }
+    // Other
+    else
+        {
+        __ASSERT_DEBUG( EFalse, User::Invariant() );
+        }
+    __SSSLOGSTRING("[SSS] <--CSSSettingsNotifier::HandleNotifyInt");
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsNotifier::AlsSupport
+// -----------------------------------------------------------------------------
+//
+TBool CSSSettingsNotifier::AlsSupport( TBool aPPSupport, TBool aCSPSupport,
+    TInt aCSPError )
+    {
+    TBool send(EFalse);
+    // If aCSPSupport is false and CSP doesnt return error then it is not
+    // needed to send notification to clients.
+    if ( aPPSupport || ( aCSPSupport && aCSPError == KErrNone ) ) 
+        {
+        send = ETrue;
+        }
+    
+    return send;
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsNotifier::HandleNotifyError
+// -----------------------------------------------------------------------------
+//
+void CSSSettingsNotifier::HandleNotifyError( TUint32 /*aId*/, TInt /*aError*/,
+    CCenRepNotifyHandler* /*aHandler*/ )
+    {
+    // Here you could call the below, if you are sure that it do not cause 
+    // eternal loop
+    // TRAPD( error, aHandler->StartListeningL() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CSSSettingsNotifier::GetAlsHandler
+// -----------------------------------------------------------------------------
+//
+CSSSettingsAlsNotifier* CSSSettingsNotifier::GetAlsHandler()
+    {
+    __SSSLOGSTRING("[SSS]--> CSSSettingsNotifier::GetAlsHandler");
+    TBool ppSupported(EFalse);
+    TBool simSupported(EFalse);
+    TBool cspSupported(EFalse);
+    TInt cspError(KErrNone);
+    iAls->GetAlsSupport( ppSupported, simSupported, cspSupported, cspError );
+    __SSSLOGSTRING1("[SSS]     CSSSettingsNotifier::GetAlsHandler: ppSupported: %d", ppSupported );
+    __SSSLOGSTRING1("[SSS]     CSSSettingsNotifier::GetAlsHandler: simSupported: %d", simSupported );
+    __SSSLOGSTRING1("[SSS]     CSSSettingsNotifier::GetAlsHandler: cspSupported: %d", cspSupported );
+    if ( ppSupported || simSupported || cspSupported )
+        {
+        __SSSLOGSTRING("[SSS] <--CSSSettingsNotifier::GetAlsHandler: ALS supported");
+        return iAls; // returned only if supported
+        }
+
+    __SSSLOGSTRING("[SSS] <--CSSSettingsNotifier::GetAlsHandler: NULL returned");
+    return NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsNotifier::HandleRefresh
+// -----------------------------------------------------------------------------
+//
+TInt CSSSettingsNotifier::HandleRefresh()
+    {
+    return iAls->HandleRefresh();
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/src/csssettingsrefreshcontainer.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,82 @@
+/*
+* 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:  Container class for refresh related implementation..
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <csssettingsrefreshcontainer.h> 
+#include    "csssettingsrefreshhandler.h" 
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CSSSettingsRefreshContainer::CSSSettingsRefreshContainer
+// -----------------------------------------------------------------------------
+//
+CSSSettingsRefreshContainer::CSSSettingsRefreshContainer()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsRefreshContainer::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CSSSettingsRefreshContainer::ConstructL()
+    {
+    iRefreshHandler = CSSSettingsRefreshHandler::NewL(); 
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsRefreshContainer::NewL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CSSSettingsRefreshContainer* CSSSettingsRefreshContainer::NewL()
+    {
+    CSSSettingsRefreshContainer* self = 
+        new( ELeave ) CSSSettingsRefreshContainer;
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsRefreshContainer::~CSSSettingsRefreshContainer
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CSSSettingsRefreshContainer::~CSSSettingsRefreshContainer()
+    {
+    delete iRefreshHandler;
+    iRefreshHandler = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsRefreshContainer::RefreshHandler
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MSSSettingsRefreshHandler& 
+    CSSSettingsRefreshContainer::RefreshHandler()
+    {
+    return *iRefreshHandler;
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/src/csssettingsrefreshhandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,326 @@
+/*
+* Copyright (c) 2004-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 Refresh handler to inform SAT refresses.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <centralrepository.h>
+#include    <rsatrefresh.h> 
+#include    <BTSapDomainPSKeys.h> // bt sap central repository key. 
+#include    <featmgr.h>
+
+#include    "csssettingsrefreshhandler.h" 
+#include    "sssettingslogger.h" 
+#include    "csssettingsactiveobject.h" 
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+
+// CLASS DECLARATION
+
+/**
+*  The Refresh notify observer info container.
+*
+*  @lib SsSettings.lib
+*  @since 2.6
+*/
+class CSSSettingsNotifyInfo
+:public CBase
+    {
+    public: // Data
+
+        // Refresh observer.
+        MSSSettingsRefreshObserver* iObserver;
+
+        // Observed file.
+        TSatElementaryFiles    iObservedFile;
+
+        // Observed refresh type.
+        TSatRefreshType      iObservedRefreshType;
+    };
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSSSettingsRefreshHandler::CSSSettingsRefreshHandler
+// -----------------------------------------------------------------------------
+//
+CSSSettingsRefreshHandler::CSSSettingsRefreshHandler()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsRefreshHandler::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CSSSettingsRefreshHandler::ConstructL()
+    {
+    __SSSLOGSTRING("[SSS]--> CSSSettingsRefreshHandler::ConstructL");
+    iNotifyInfo = new ( ELeave ) CSSSettingsNotifyInfo;
+
+    User::LeaveIfError ( iRSSSettings.Open() );
+
+    User::LeaveIfError ( iRCspCache.Open() );
+
+    iRSatSession.ConnectL();
+
+    iRSatRefresh = new ( ELeave ) RSatRefresh ( *this);
+    iRSatRefresh->OpenL( iRSatSession );
+    iRSatRefresh->NotifyFileChangeL();
+    
+    if ( FeatureManager::FeatureSupported ( KFeatureIdBtSap ) )
+        {
+        //create the active object instance
+        iBtSapNotifier = CSSSettingsActiveObject::NewL(
+            KPSUidBluetoothSapConnectionState,
+            KBTSapConnectionState,
+            *this );
+
+        //subscribe for key event notifications
+        iBtSapNotifier->NotifyKeyChange();        
+        }        
+    __SSSLOGSTRING("[SSS] <--CSSSettingsRefreshHandler::ConstructL");
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsRefreshHandler::NewL
+// -----------------------------------------------------------------------------
+//
+CSSSettingsRefreshHandler* CSSSettingsRefreshHandler::NewL()
+    {
+    __SSSLOGSTRING("[SSS]--> CSSSettingsRefreshHandler::NewL");
+    CSSSettingsRefreshHandler* self = new( ELeave ) CSSSettingsRefreshHandler;
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    __SSSLOGSTRING("[SSS] <--CSSSettingsRefreshHandler::NewL");
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsRefreshHandler::~CSSSettingsRefreshHandler
+// -----------------------------------------------------------------------------
+//
+CSSSettingsRefreshHandler::~CSSSettingsRefreshHandler()
+    {
+    __SSSLOGSTRING("[SSS]--> CSSSettingsRefreshHandler::~CSSSettingsRefreshHandler");
+    if ( iRSatRefresh )
+        {
+        iRSatRefresh->Cancel();
+        iRSatRefresh->Close();
+        delete iRSatRefresh;
+        iRSatRefresh = NULL;
+        }
+    iRSatSession.Close();
+    iRSSSettings.Close();
+
+    delete iNotifyInfo;
+    iNotifyInfo = NULL;
+
+    if ( FeatureManager::FeatureSupported ( KFeatureIdBtSap ) )
+        {
+        if( iBtSapNotifier )
+            {
+            iBtSapNotifier->CancelNotify();
+            }
+        delete iBtSapNotifier;
+        } 
+        
+    iRCspCache.Close();
+               
+    __SSSLOGSTRING("[SSS] <--CSSSettingsRefreshHandler::~CSSSettingsRefreshHandler");
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsRefreshHandler::NotifyFileChangeL
+// -----------------------------------------------------------------------------
+//
+void CSSSettingsRefreshHandler::NotifyFileChangeL(
+    MSSSettingsRefreshObserver& aObserver,
+    TSatElementaryFiles aObservedFiles,
+    TSatRefreshType aObservedRefreshType )
+    {
+    __SSSLOGSTRING("[SSS]--> CSSSettingsRefreshHandler::NotifyFileChangeL");
+    // Update variables.
+    iNotifyInfo->iObserver = &aObserver;
+    iNotifyInfo->iObservedFile = aObservedFiles;
+    iNotifyInfo->iObservedRefreshType = aObservedRefreshType;
+    __SSSLOGSTRING("[SSS] <--CSSSettingsRefreshHandler::NotifyFileChangeL");
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsRefreshHandler::CancelNotify
+// -----------------------------------------------------------------------------
+//
+void CSSSettingsRefreshHandler::CancelNotify()
+    {
+    iNotifyInfo->iObserver = NULL;    
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsRefreshHandler::ChangedCspTable
+// -----------------------------------------------------------------------------
+//
+TInt CSSSettingsRefreshHandler::ChangedCspTable( 
+    TDes8& aChangedCsps,
+    TDes8& aNewValues )
+    {
+    __SSSLOGSTRING("[SSS]--> CSSSettingsRefreshHandler::ChangedCspTable");
+    return iRCspCache.ChangedCspTable( 
+        aChangedCsps,
+        aNewValues );    
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsRefreshHandler::AllowRefresh
+// -----------------------------------------------------------------------------
+//
+TBool CSSSettingsRefreshHandler::AllowRefresh(
+    TSatRefreshType aType,
+    const TSatRefreshFiles& aFiles )
+    {
+    __SSSLOGSTRING("[SSS]--> CSSSettingsRefreshHandler::AllowRefresh");
+    return DoHandleRefresh( aType, aFiles, ESSSettingsAllowRefresh );
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsRefreshHandler::Refresh
+// -----------------------------------------------------------------------------
+//
+void CSSSettingsRefreshHandler::Refresh(
+    TSatRefreshType aType,
+    const TSatRefreshFiles& aFiles )
+    {
+    __SSSLOGSTRING("[SSS]--> CSSSettingsRefreshHandler::Refresh");
+    DoHandleRefresh(  aType, aFiles, ESSSettingsRefresh );
+    __SSSLOGSTRING("[SSS] <--CSSSettingsRefreshHandler::Refresh");
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsRefreshHandler::DoHandleRefresh
+// -----------------------------------------------------------------------------
+//
+TBool CSSSettingsRefreshHandler::DoHandleRefresh(
+    TSatRefreshType aType,
+    const TSatRefreshFiles& aFiles,
+    const TSSSettingsRefreshFunction aFunctionality )
+    {    
+    __SSSLOGSTRING("[SSS]--> CSSSettingsRefreshHandler::DoHandleRefresh");
+    if ( aFunctionality == ESSSettingsRefresh )
+        {
+        // Refresh handling needed only if the refresh has happened.
+        iRCspCache.HandleRefresh();
+        iRSSSettings.HandleRefresh();
+        }
+
+    TBool cspEfFound =  
+        aFiles.Locate( KCsp1Ef ) != KErrNotFound || 
+        aFiles.Locate( KCsp2Ef ) != KErrNotFound; 
+
+    // KCspEf is no longer provided by SAT but GS and PS seem to depend on it, 
+    // handled here for now. 
+    TBool fileFound =  
+        aFiles.Locate( iNotifyInfo->iObservedFile ) != KErrNotFound || 
+        cspEfFound && iNotifyInfo->iObservedFile == KCspEf; 
+
+
+    // By default refresh is allowed.
+    TBool allow(ETrue);
+
+    // Handle only if there is observer.
+    if ( iNotifyInfo->iObserver )
+        {
+        // Handle only if observer wants to listen this event.
+        if ( iNotifyInfo->iObservedRefreshType & aType )
+            {
+            if ( aType != EFileChangeNotification || fileFound )
+                {
+                if ( aFunctionality == ESSSettingsRefresh )
+                    {
+                    // Inform the observer about the refresh event.
+                    iNotifyInfo->iObserver->Refresh(
+                        aType, iNotifyInfo->iObservedFile );
+                    iRSatRefresh->RefreshEFRead( cspEfFound );
+                    }
+                else // ESSSettingsAllowRefresh
+                    {
+                    // Inform the observer about the coming refresh event.
+                    allow = iNotifyInfo->iObserver->AllowRefresh(
+                        aType, iNotifyInfo->iObservedFile );
+                    }
+                }
+            
+            // If there is no client listening changed files SSSettings has to
+            // check if some CSP file is into the list and send right response
+            // since itself reads CSP files.    
+            if ( !fileFound )
+            	{
+                iRSatRefresh->RefreshEFRead( !cspEfFound );
+                }
+            }
+        else
+            {
+            iRSatRefresh->RefreshEFRead( EFalse );
+            }
+        }
+    else if ( aType == EFileChangeNotification 
+        || aType == ESimInitFileChangeNotification 
+        || aType == ESimInit )
+        {
+        iRSatRefresh->RefreshEFRead( !cspEfFound );
+        }
+    else 
+        {
+        // Do nothing
+        }
+    	    	
+    __SSSLOGSTRING("[SSS] <--CSSSettingsRefreshHandler::DoHandleRefresh");
+    return allow;
+    }
+
+// -----------------------------------------------------------------------------
+// CSSSettingsRefreshHandler::HandlePubSubNotify
+// -----------------------------------------------------------------------------
+//
+void CSSSettingsRefreshHandler::HandlePubSubNotify( const TUid aUid,
+    const TUint32 aKeyId )
+    {
+    __SSSLOGSTRING("[SSS]--> CSSSettingsRefreshHandler::HandlePubSubNotify");
+    if ( aUid == KPSUidBluetoothSapConnectionState && 
+         aKeyId == KBTSapConnectionState )
+        {
+        TInt btSapState(EBTSapNotConnected);
+        //get the current SAP state
+        RProperty::Get( aUid, aKeyId, btSapState );
+        if ( btSapState == EBTSapNotConnected )
+            {
+            // Refresh handling needed only if the BT SAP 
+            // state is not connected.
+            iRCspCache.HandleRefresh();
+            iRSSSettings.HandleRefresh();
+            }
+        __SSSLOGSTRING1("[SSS]    HandlePubSubNotify: btSapState: %d", btSapState);
+        }
+    __SSSLOGSTRING("[SSS] <--CSSSettingsRefreshHandler::HandlePubSubNotify");
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/src/rcustomerserviceprofilecache.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,632 @@
+/*
+* 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:  Customer service profile cache
+*
+*/
+
+
+// INCLUDE FILES
+#include    <bldvariant.hrh> // for feature definitions
+#include    <etel.h>  
+#include    <sssettingsprivatepskeys.h> 
+#include    <centralrepository.h>
+#include    <mmtsy_names.h>
+#include    <featmgr.h>
+      
+#include    "rcustomerserviceprofilecache.h" 
+#include    "sssettingslogger.h" 
+
+// CONSTANTS
+#define KSSSettingsTSYName KMmTsyModuleName
+const TInt KCspCacheTSYNameMaxLength( 80 );
+const TInt KCspCacheETelRetryCount(8);
+const TInt KCspCacheETelRetryTimeout(100000);
+const TInt KCspCacheNoFile(99999);
+_LIT_SECURITY_POLICY_C1(KSSSettingReadPolicy, ECapabilityReadDeviceData);
+_LIT_SECURITY_POLICY_C1(KSSSettingWritePolicy, ECapabilityWriteDeviceData);
+
+
+// ==================== LOCAL FUNCTIONS ====================
+
+
+static TInt CspCacheDoOpenEtelConnection( RTelServer& aEtel, RPhone& aPhone )
+    {
+    TInt phones(0);
+    if ( aEtel.EnumeratePhones( phones) == KErrNone )
+        {
+        for ( TInt p = 0 ; p < phones ; p++ )
+            {
+            TBuf<KCspCacheTSYNameMaxLength> tsyName;
+            if ( aEtel.GetTsyName( p,tsyName ) == KErrNone )
+                {
+                if ( tsyName.CompareF( KSSSettingsTSYName ) == 0 )
+                    {
+                    RTelServer::TPhoneInfo info;
+                    if ( aEtel.GetPhoneInfo( p,info ) == KErrNone )
+                        {
+                        if ( aPhone.Open( aEtel, info.iName ) == KErrNone )
+                            {
+                            return KErrNone;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    return KErrGeneral;
+    }
+
+
+RCustomerServiceProfileCache::TCspCacheData::TCspCacheData():iCspFilePckg( 
+    iCspFile )
+    { 
+    }
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// Constructor
+// -----------------------------------------------------------------------------
+EXPORT_C RCustomerServiceProfileCache::RCustomerServiceProfileCache()
+    {
+    iData = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+EXPORT_C RCustomerServiceProfileCache::~RCustomerServiceProfileCache()
+    {
+    Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CustomerServiceProfileCache::Open
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RCustomerServiceProfileCache::Open()
+    {    
+    __SSSLOGSTRING("[SSS]--> RCustomerServiceProfileCache::Open");
+    TRAPD( error, DoOpenL() );
+    if ( error != KErrNone )
+        {
+        Close();
+        }
+
+    __SSSLOGSTRING1("[SSS]     RCustomerServiceProfileCache::Open: error: %d", error );
+    __SSSLOGSTRING("[SSS] <-- RCustomerServiceProfileCache::Open");
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// CustomerServiceProfileCache::Close
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RCustomerServiceProfileCache::Close()
+    {
+    __SSSLOGSTRING("[SSS]--> RCustomerServiceProfileCache::Close");
+    if ( iData == NULL )
+        {
+        return;
+        }
+
+    iData->iPhone.Close();
+    iData->iEtel.Close();
+    
+    delete iData;
+    iData = NULL;
+
+    delete iOldCspFile;
+    iOldCspFile = NULL;
+
+    FeatureManager::UnInitializeLib();
+    __SSSLOGSTRING("[SSS] <-- RCustomerServiceProfileCache::Close");
+    }
+
+// -----------------------------------------------------------------------------
+// CustomerServiceProfileCache::CspCallCompletion
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RCustomerServiceProfileCache::CspCallCompletion( 
+            RMobilePhone::TCspCallCompletion& aParams )
+    {
+    __SSSLOGSTRING("[SSS]--> RCustomerServiceProfileCache::CspCallCompletion");
+    TInt value(0);
+    TInt error = DoGetValues( value, ESsCspGroup1 );
+    __SSSLOGSTRING1("[SSS]    RCustomerServiceProfileCache::CspCallCompletion: error: %d", error);
+
+    if ( error == KErrNone )
+        {
+        //Read 8 bits are moved to correct place within a TInt.
+        aParams = ( RMobilePhone::TCspCallCompletion ) 
+            ( ( value >> 24 ) & 0xff );
+        }
+
+    __SSSLOGSTRING1("[SSS]    RCustomerServiceProfileCache::CspCallCompletion: value: %d", value);
+    __SSSLOGSTRING("[SSS] <-- RCustomerServiceProfileCache::CspCallCompletion");
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// CustomerServiceProfileCache::CspCallOffering
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RCustomerServiceProfileCache::CspCallOffering( 
+            RMobilePhone::TCspCallOffering& aParams )
+    {
+    __SSSLOGSTRING("[SSS]--> RCustomerServiceProfileCache::CspCallOffering");
+    TInt value(0);
+    TInt error = DoGetValues( value, ESsCspGroup1 );
+    __SSSLOGSTRING1("[SSS]    RCustomerServiceProfileCache::CspCallOffering: error: %d", error);
+
+    if ( error == KErrNone )
+        {
+        //Read 8 bits are moved to correct place within a TInt.
+        aParams = ( RMobilePhone::TCspCallOffering ) 
+            ( ( value >> 16 ) & 0xff );
+        }
+
+    __SSSLOGSTRING1("[SSS]    RCustomerServiceProfileCache::CspCallOffering: value: %d", value);
+    __SSSLOGSTRING("[SSS] <-- RCustomerServiceProfileCache::CspCallOffering");
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// CustomerServiceProfileCache::CspCallRestriction
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RCustomerServiceProfileCache::CspCallRestriction( 
+            RMobilePhone::TCspCallRestriction& aParams )
+    {
+    __SSSLOGSTRING("[SSS]--> RCustomerServiceProfileCache::CspCallRestriction");
+    TInt value(0);
+    TInt error = DoGetValues( value, ESsCspGroup1 );
+    __SSSLOGSTRING1("[SSS]    RCustomerServiceProfileCache::CspCallRestriction: error: %d", error);
+
+    if ( error == KErrNone )
+        {
+        //Read 8 bits are moved to correct place within a TInt.
+        aParams = ( RMobilePhone::TCspCallRestriction )
+            ( ( value >> 8 ) & 0xff );
+        }
+
+    __SSSLOGSTRING1("[SSS]    RCustomerServiceProfileCache::CspCallRestriction: value: %d", value);
+    __SSSLOGSTRING("[SSS] <-- RCustomerServiceProfileCache::CspCallRestriction");
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// CustomerServiceProfileCache::CspCPHSTeleservices
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RCustomerServiceProfileCache::CspCPHSTeleservices( 
+            RMobilePhone::TCspCPHSTeleservices& aParams )
+    {
+    __SSSLOGSTRING("[SSS]--> RCustomerServiceProfileCache::CspCPHSTeleservices");
+    TInt value(0);
+    TInt error = DoGetValues( value, ESsCspGroup1 );
+    __SSSLOGSTRING1("[SSS]    RCustomerServiceProfileCache::CspCPHSTeleservices: error: %d", error);
+
+    if ( error == KErrNone )
+        {
+        //Read 8 bits are moved to correct place within a TInt.
+        aParams = ( RMobilePhone::TCspCPHSTeleservices )
+            ( value & 0xff );
+        }
+
+    __SSSLOGSTRING1("[SSS]    RCustomerServiceProfileCache::CspCPHSTeleservices: value: %d", value);
+    __SSSLOGSTRING("[SSS] <-- RCustomerServiceProfileCache::CspCPHSTeleservices");
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// CustomerServiceProfileCache::HandleRefresh
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RCustomerServiceProfileCache::HandleRefresh()
+    {
+    __SSSLOGSTRING("[SSS]--> RCustomerServiceProfileCache::HandleRefresh");
+    // Save the old CSP information.
+    *iOldCspFile = iData->iCspFile;
+
+    TRequestStatus status;
+    TInt value(0);
+    TInt valueExt(0);
+    iData->iPhone.GetCustomerServiceProfile( status, iData->iCspFilePckg );
+    User::WaitForRequest( status );
+    TInt error = status.Int();
+    __SSSLOGSTRING1("[SSS]    RCustomerServiceProfileCache::HandleRefresh: GetCustomerServiceProfile: error: %d", error);
+
+    if ( error == KErrNone )
+        {
+        // Read 8 bit groups are saved into one TInt. To make room for
+        // all groups, the first read groups are shifted left.
+        value = iData->iCspFile.iCallCompletionServices << 24;
+        value += iData->iCspFile.iCallOfferingServices << 16;
+        value += iData->iCspFile.iCallRestrictionServices << 8;
+        value += iData->iCspFile.iCphsTeleservices;
+
+        // Read 8 bit groups are saved into one TInt. To make room for
+        // all groups, the first read groups are shifted left.
+        valueExt = iData->iCspFile.iTeleservices << 8;        
+        __SSSLOGSTRING1("[SSS]    RCustomerServiceProfileCache::HandleRefresh: valueExt1: %d", valueExt);
+        valueExt += iData->iCspFile.iValueAddedServices;
+        __SSSLOGSTRING1("[SSS]    RCustomerServiceProfileCache::HandleRefresh: valueExt2: %d", valueExt);
+        }
+    else
+        {        
+        value = KErrNotFound;
+        valueExt = KErrNotFound;
+        error = KErrNotSupported;
+        }
+
+    if ( error == KErrNone )
+        {
+        // Cache 2.
+        error = DefineAndSetValue(
+                KPSUidSSConfig,
+                KSettingsCspCache2,
+                valueExt );
+
+        if ( error == KErrNone )
+            {
+            // Cache 1.
+            error = DefineAndSetValue(
+                    KPSUidSSConfig,
+                    KSettingsCspCache1,
+                    value );
+            }
+        }
+    __SSSLOGSTRING1("[SSS]    RCustomerServiceProfileCache::HandleRefresh: error: %d", error);
+    __SSSLOGSTRING("[SSS] <-- RCustomerServiceProfileCache::HandleRefresh");
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// CustomerServiceProfileCache::CspCPHSValueAddedServices
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RCustomerServiceProfileCache::CspCPHSValueAddedServices( 
+    RMobilePhone::TCspValueAdded& aParams )
+    {
+    __SSSLOGSTRING("[SSS]--> RCustomerServiceProfileCache::CspCPHSValueAddedServices");
+    TInt value(0);
+    TInt error = DoGetValues( value, ESsCspGroup2 );
+    __SSSLOGSTRING1("[SSS]    RCustomerServiceProfileCache::CspCPHSValueAddedServices: error: %d", error);
+
+    if ( error == KErrNone )
+        {
+        aParams = ( RMobilePhone::TCspValueAdded )( value & 0xff );
+        }
+
+    __SSSLOGSTRING1("[SSS]    RCustomerServiceProfileCache::CspCPHSValueAddedServices: value: %d", value);
+    __SSSLOGSTRING("[SSS] <-- RCustomerServiceProfileCache::CspCPHSValueAddedServices");
+    return error;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CustomerServiceProfileCache::CspTeleServices
+
+// Include  SM/CB, Reply path, Del. Conf, Prot. ID, Validity Period.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RCustomerServiceProfileCache::CspTeleServices( 
+    RMobilePhone::TCspTeleservices& aParams )
+    {
+    __SSSLOGSTRING("[SSS]--> RCustomerServiceProfileCache::CspTeleServices");
+    TInt value(0);
+    TInt error = DoGetValues( value, ESsCspGroup2 );
+    __SSSLOGSTRING1("[SSS]    RCustomerServiceProfileCache::CspTeleServices: error: %d", error);
+
+    if ( error == KErrNone )
+        {
+        // Read 8 bits are moved to correct place within a TInt.
+        aParams = ( RMobilePhone::TCspTeleservices )
+            ( ( value >> 8 ) & 0xff );
+        }
+
+    __SSSLOGSTRING1("[SSS]    RCustomerServiceProfileCache::CspTeleServices: value: %d", value);
+    __SSSLOGSTRING("[SSS] <-- RCustomerServiceProfileCache::CspTeleServices");
+    return error;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CustomerServiceProfileCache::ChangedCspTable
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RCustomerServiceProfileCache::ChangedCspTable( 
+    TDes8& aChangedCsps,
+    TDes8& aNewValues )
+    {
+    __SSSLOGSTRING("[SSS]--> RCustomerServiceProfileCache::ChangedCspTable");
+    TInt error(KErrNone);
+    if ( !iData || !iOldCspFile )
+        {
+        // CspFiles did not exist.
+        error = KErrCorrupt;
+        }
+    else 
+        {
+        // Set the changed CSP file, done with XORing the old and new CSP file.
+        RMobilePhone::TMobilePhoneCspFileV1Pckg& cspFilePckg = 
+            *reinterpret_cast< RMobilePhone::TMobilePhoneCspFileV1Pckg* >( 
+            &aChangedCsps );
+        RMobilePhone::TMobilePhoneCspFileV1& cspFile = cspFilePckg();
+
+        cspFile.iCallOfferingServices    = ( TUint8 ) ( 
+            iData->iCspFile.iCallOfferingServices ^ 
+            iOldCspFile->iCallOfferingServices );
+
+        cspFile.iCallRestrictionServices = ( TUint8 ) ( 
+            iData->iCspFile.iCallRestrictionServices ^ 
+            iOldCspFile->iCallRestrictionServices );
+
+        cspFile.iOtherSuppServices       = ( TUint8 ) ( 
+            iData->iCspFile.iOtherSuppServices ^ 
+            iOldCspFile->iOtherSuppServices );
+
+        cspFile.iCallCompletionServices  = ( TUint8 ) ( 
+            iData->iCspFile.iCallCompletionServices ^ 
+            iOldCspFile->iCallCompletionServices );
+
+        cspFile.iTeleservices            = ( TUint8 ) ( 
+            iData->iCspFile.iTeleservices ^ 
+            iOldCspFile->iTeleservices );
+
+        cspFile.iCphsTeleservices        = ( TUint8 ) ( 
+            iData->iCspFile.iCphsTeleservices ^ 
+            iOldCspFile->iCphsTeleservices );
+
+        cspFile.iCphsFeatures            = ( TUint8 ) ( 
+            iData->iCspFile.iCphsFeatures ^ 
+            iOldCspFile->iCphsFeatures );
+
+        cspFile.iNumberIdentServices     = ( TUint8 ) ( 
+            iData->iCspFile.iNumberIdentServices ^ 
+            iOldCspFile->iNumberIdentServices );
+
+        cspFile.iPhase2PlusServices      = ( TUint8 ) ( 
+            iData->iCspFile.iPhase2PlusServices ^ 
+            iOldCspFile->iPhase2PlusServices );
+
+        cspFile.iValueAddedServices      = ( TUint8 ) ( 
+            iData->iCspFile.iValueAddedServices ^ 
+            iOldCspFile->iValueAddedServices );
+
+
+        // Set the new values.
+        RMobilePhone::TMobilePhoneCspFileV1Pckg& newCspFilePckg = 
+            *reinterpret_cast< RMobilePhone::TMobilePhoneCspFileV1Pckg* >( 
+            &aNewValues );
+        RMobilePhone::TMobilePhoneCspFileV1& newCpFile = newCspFilePckg();
+
+        newCpFile = iData->iCspFile;
+        }
+
+    __SSSLOGSTRING("[SSS] <-- RCustomerServiceProfileCache::ChangedCspTable");
+    return error;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CustomerServiceProfileCache::DoOpenL
+// -----------------------------------------------------------------------------
+//
+void RCustomerServiceProfileCache::DoOpenL()
+    {
+    __SSSLOGSTRING("[SSS]--> RCustomerServiceProfileCache::DoOpenL");
+    if ( iData )
+        {
+        Close();
+        iData = NULL;
+        }
+
+    FeatureManager::InitializeLibL();
+
+    iData = new ( ELeave ) TCspCacheData;
+    
+    // Retry ETel connection for a few times:
+    TInt error(KErrNone);
+    for ( TInt i = 0 ; i < KCspCacheETelRetryCount ; i++ )
+        {
+        error = iData->iEtel.Connect();
+        if ( error == KErrNone )
+            {
+            break;
+            }
+        User::After( KCspCacheETelRetryTimeout );
+        }
+    User::LeaveIfError( error );
+
+
+    error = iData->iEtel.LoadPhoneModule( KSSSettingsTSYName );
+    if (( error != KErrNone ) && ( error != KErrAlreadyExists ))
+        {
+        User::Leave( error );
+        }
+    User::LeaveIfError( 
+        CspCacheDoOpenEtelConnection( iData->iEtel, iData->iPhone ) );
+
+    // Create and reset old CSP file variable.
+    iOldCspFile = new ( ELeave ) RMobilePhone::TMobilePhoneCspFileV1;
+    DoResetOldCspFile();
+    __SSSLOGSTRING("[SSS] <-- RCustomerServiceProfileCache::DoOpenL");
+    }
+
+
+// -----------------------------------------------------------------------------
+// CustomerServiceProfileCache::DoGetValues
+// -----------------------------------------------------------------------------
+//
+TInt RCustomerServiceProfileCache::DoGetValues( TInt& aValue, TSsGroups aGroup )
+    {
+    __SSSLOGSTRING("[SSS]--> RCustomerServiceProfileCache::DoGetValues");
+    TInt value(0);
+    TInt error(KErrNone);
+    if ( aGroup == ESsCspGroup1 )
+        {
+        error = RProperty::Get( KPSUidSSConfig, KSettingsCspCache1, value );
+        __SSSLOGSTRING1("[SSS]    RCustomerServiceProfileCache::DoGetValues: ESsCspGroup1 value: %d", value);
+        __SSSLOGSTRING1("[SSS]    RCustomerServiceProfileCache::DoGetValues: error: %d", error);
+        }
+    else
+        {
+        error = RProperty::Get( KPSUidSSConfig, KSettingsCspCache2, value );
+        __SSSLOGSTRING1("[SSS]    RCustomerServiceProfileCache::DoGetValues: ESsCspGroup2 value: %d", value);
+        __SSSLOGSTRING1("[SSS]    RCustomerServiceProfileCache::DoGetValues: error: %d", error);
+        }
+    // KErrNotFound if Property has not been defined.
+    if ( error == KErrNotFound && aGroup == ESsCspGroup1 )
+        {
+        error = DefineAndSetValue( KPSUidSSConfig, KSettingsCspCache1, value );
+        }
+    else if ( error == KErrNotFound && aGroup == ESsCspGroup2 )
+        {
+        error = DefineAndSetValue( KPSUidSSConfig, KSettingsCspCache2, value ); 
+        }
+
+    if ( error == KErrNone )
+        {
+        if ( value != KCspCacheNoFile ) 
+            {   
+            __SSSLOGSTRING("[SSS] ---> GetCustomerServiceProfile");             
+            TRequestStatus status;
+            // GetCustomerServiceProfile status returns KErrNotFound if CSP product profile is OFF.
+            iData->iPhone.GetCustomerServiceProfile(
+               status ,
+               iData->iCspFilePckg );
+            User::WaitForRequest( status );
+            error = status.Int();
+            __SSSLOGSTRING1("[SSS] <--- GetCustomerServiceProfile: error: %d", error); 
+             
+            if (( error == KErrNotReady ) || ( error == KErrServerBusy ))
+                {
+                return error;
+                }  
+            }
+        else // CSP has been read return value, if value is KCspCacheNoFile then return KErrNotSupported.
+            {
+            __SSSLOGSTRING("[SSS] CSP file cannot be found from SIM"); 
+            return KErrNotSupported;    
+            }
+
+        if ( error == KErrNone )
+            {
+            if ( aGroup == ESsCspGroup1 )
+                {
+                // Read 8 bit groups are saved into one TInt. To make room for
+                // all groups, the first read groups are shifted left.
+                // All the 8 bit data is available in the below keys.
+
+                // currently only CW supported on the UI level
+                value = iData->iCspFile.iCallCompletionServices << 24;
+                // currently CFU, CFB, CFNRy, CFNRc are supported
+                value += iData->iCspFile.iCallOfferingServices << 16;
+                // complete barring is supported
+                value += iData->iCspFile.iCallRestrictionServices << 8;
+                // contains ALS, 1-bit
+                value += iData->iCspFile.iCphsTeleservices;
+
+                __SSSLOGSTRING1("[SSS]    RCustomerServiceProfileCache::DoGetValues: ESsCspGroup1; value: %d", value);
+                }
+            else
+                {
+                // Read 8 bit groups are saved into one TInt. To make room for
+                // all groups, the first read groups are shifted left.
+
+                // supports SM/CB, Reply path, Del.Conf, Prot.ID, Validity Period
+                value = iData->iCspFile.iTeleservices << 8;
+                // currently PLMN MODE is supported in UI
+                value += iData->iCspFile.iValueAddedServices;
+                __SSSLOGSTRING1("[SSS]    RCustomerServiceProfileCache::DoGetValues: ESsCspGroup2; value: %d", value);
+                }
+            aValue = value;
+            }
+        else
+            {
+            value = KCspCacheNoFile;
+            error = KErrNotSupported;
+            }                        
+        }
+        
+        if (( error == KErrNone ) || ( error == KErrNotSupported ))
+            {
+            TInt defError(0);
+            if ( aGroup == ESsCspGroup1 )
+                {
+                __SSSLOGSTRING("[SSS]   DefineAndSetValue -> KSettingsCspCache1");
+                defError = DefineAndSetValue( KPSUidSSConfig, KSettingsCspCache1, value );
+                }
+            else
+                {
+                __SSSLOGSTRING("[SSS]   DefineAndSetValue -> KSettingsCspCache2");
+                defError = DefineAndSetValue( KPSUidSSConfig, KSettingsCspCache2, value );
+                }
+                
+            // Do not set error if defError is KErrNone. If Define/Set failed then error value is set.
+            if  ( defError != KErrNone )
+                {
+                error = defError;
+                }
+            }
+        
+    __SSSLOGSTRING1("[SSS]    RCustomerServiceProfileCache::DoGetValues: error: %d", error);
+    __SSSLOGSTRING("[SSS] <-- RCustomerServiceProfileCache::DoGetValues");
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// CustomerServiceProfileCache::DoResetOldCspFile
+// -----------------------------------------------------------------------------
+//
+void RCustomerServiceProfileCache::DoResetOldCspFile()
+    {
+    if ( iOldCspFile )
+        {
+        iOldCspFile->iCallOfferingServices = 0;
+        iOldCspFile->iCallRestrictionServices = 0;
+        iOldCspFile->iOtherSuppServices = 0;
+        iOldCspFile->iCallCompletionServices = 0;
+        iOldCspFile->iTeleservices = 0;
+        iOldCspFile->iCphsTeleservices = 0;
+        iOldCspFile->iCphsFeatures = 0;
+        iOldCspFile->iNumberIdentServices = 0;
+        iOldCspFile->iPhase2PlusServices = 0;
+        iOldCspFile->iValueAddedServices = 0;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CustomerServiceProfileCache::DefineAndSetValue
+// -----------------------------------------------------------------------------
+//
+TInt RCustomerServiceProfileCache::DefineAndSetValue( TUid aCategory, 
+        TUint aKey, TInt aValue )
+    {
+    TInt err = RProperty::Define( 
+            aCategory, aKey,
+            RProperty::EInt, KSSSettingReadPolicy,
+            KSSSettingWritePolicy );
+        
+    if ( err == KErrNone || err == KErrAlreadyExists)
+        {
+        err = RProperty::Set( aCategory, aKey, aValue );        
+        }
+    return err;
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/src/rsssettings.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,1195 @@
+/*
+* 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:  Class for getting information about the Clir, Cug, Als and 
+*                Als blocking status in the phone. 
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <bldvariant.hrh> // for feature definitions
+#include    <e32base.h>
+#include    <rmmcustomapi.h>
+#include    <mmtsy_names.h>
+#include    <PSVariables.h> 
+#include    <startupdomainpskeys.h>
+#include    <centralrepository.h> // central repository 
+#include    <sssettingsprivatecrkeys.h> // settings central repository keys. 
+#include    <telservicesinternalcrkeys.h>
+#include    <telservicesvariant.hrh>
+
+#include    "rsssettings.h" 
+#include    "msssettingsobserver.h" 
+#include    "csssettingsnotifier.h" 
+#include    "csssettingsalsnotifier.h" 
+#include    "sssettingslogger.h" 
+
+// CONSTANTS
+_LIT( KPanicCat, "SSSettings" );
+#define KSSSettingsTSYName KMmTsyModuleName
+const TInt KSSSettingsTSYNameMaxLength( 80 );
+const TInt KSSSettingsLastSetting(ESSSettingsDefaultCug);
+const TInt KSSSettingsMaxETelRetryCount(7);
+const TInt KSSSettingsETelRetryCountTimeout(100000); 
+
+// ================= LOCAL FUNCTIONS =======================
+TInt SSSettingsDoOpenEtelConnection( RTelServer& aEtel, RPhone& aPhone )
+    {
+    TInt phones(0);
+    if ( aEtel.EnumeratePhones( phones) == KErrNone )
+        {
+        for ( TInt p = 0 ; p < phones ; p++ )
+            {
+            TBuf<KSSSettingsTSYNameMaxLength> tsyName;
+            if ( aEtel.GetTsyName( p,tsyName ) == KErrNone )
+                {
+                if ( tsyName.CompareF( KSSSettingsTSYName ) == 0 )
+                    {
+                    RTelServer::TPhoneInfo info;
+                    if ( aEtel.GetPhoneInfo( p,info ) == KErrNone )
+                        {
+                        if ( aPhone.Open( aEtel, info.iName ) == KErrNone )
+                            {
+                            return KErrNone;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    return KErrGeneral;
+    }
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// C++ default constructor can NOT contain any code, that
+// might leave.
+//
+EXPORT_C RSSSettings::RSSSettings()
+    {
+    iData = NULL;
+    }
+
+
+// ---------------------------------------------------------
+// RSSSettings::Close
+// ---------------------------------------------------------
+//
+EXPORT_C void RSSSettings::Close()
+   {
+   __SSSLOGSTRING("[SSS]--> RSSSettings::Close");
+   DeleteSettingsData();
+   __SSSLOGSTRING("[SSS] <--RSSSettings::Close");
+   }
+
+// ---------------------------------------------------------
+// RSSSettings::Open#1
+// ---------------------------------------------------------
+//
+EXPORT_C TInt RSSSettings::Open()
+    {
+    __SSSLOGSTRING("[SSS]--> RSSSettings::Open");
+    TInt ret(KErrNone);
+    ret = Open( NULL );
+    __SSSLOGSTRING("[SSS] <--RSSSettings::Open");
+    return ret;
+    }
+
+// ---------------------------------------------------------
+// RSSSettings::Open#3
+// ---------------------------------------------------------
+//
+EXPORT_C TInt RSSSettings::Open( RTelServer* aTelServer )
+    {
+    __SSSLOGSTRING("[SSS]--> RSSSettings::Open3");
+    TRAPD( error, OpenL( aTelServer ) );
+    if ( error != KErrNone )
+        {
+        DeleteSettingsData();
+        }
+    __SSSLOGSTRING("[SSS] <--RSSSettings::Open3");
+    return error;
+
+    }
+
+// ---------------------------------------------------------
+// RSSSettings::OpenL
+// ---------------------------------------------------------
+//
+void RSSSettings::OpenL( RTelServer* aTelServer )
+    {
+    __SSSLOGSTRING("[SSS]--> RSSSettings::OpenL");
+    if ( iData )
+        {
+        DeleteSettingsData();
+        }
+
+    iData = new ( ELeave ) TSSSettingsData;
+
+    iData->iOwnTelServer = ETrue;
+    iData->iTelServer = NULL;
+    iData->iCallBack = NULL;
+    iData->iCallBackSetting = KErrBadDescriptor;
+    iData->iCallBackValue = KErrBadDescriptor;
+    iData->iNotifier = NULL;
+    iData->iCustomPhone = NULL;
+    iData->iCUGDefault = NULL;
+    iData->iRepository = NULL;
+
+    // Create Notifier
+    // ConstructL is called later when the sessions are opened.
+    iData->iNotifier = new ( ELeave ) CSSSettingsNotifier( *this );
+
+    // Crate call back  for async inform
+    TCallBack callBack( InformCallBack, this );
+    iData->iCallBack = new ( ELeave ) 
+        CAsyncCallBack( callBack, CActive::EPriorityStandard );
+
+    // Check central repository connection.
+    iData->iRepository = CRepository::NewL(
+        KCRUidSupplementaryServiceSettings );
+
+    // Check ETel connecion
+    if ( aTelServer )
+        {
+        iData->iOwnTelServer = EFalse;
+        iData->iTelServer = aTelServer;
+        // Given ETel connection must be open.
+        if ( iData->iTelServer->Handle() == 0 )
+            {
+            User::Leave( KErrBadHandle );
+            }
+        }
+    else
+        {
+        iData->iOwnTelServer = ETrue;
+        iData->iTelServer = new ( ELeave ) RTelServer();
+
+        // Retry ETel connection:
+        TInt err(KErrNone);
+        for ( TInt i = 0 ; i < KSSSettingsMaxETelRetryCount ; i++ )
+            {
+            err = iData->iTelServer->Connect();
+            if ( err == KErrNone )
+                {
+                break;
+                }
+            User::After( KSSSettingsETelRetryCountTimeout );
+            }
+
+        User::LeaveIfError( err );
+        }
+
+    // Open phones
+    TInt error = iData->iTelServer->LoadPhoneModule( KSSSettingsTSYName );
+    if (( error != KErrNone ) && ( error != KErrAlreadyExists ))
+        {
+        User::Leave( error );
+        }
+
+    User::LeaveIfError( SSSettingsDoOpenEtelConnection( 
+        *iData->iTelServer, iData->iMobilePhone ) );
+
+    iData->iCustomPhone = new ( ELeave ) RMmCustomAPI;
+    iData->iCustomPhone->Open( iData->iMobilePhone );
+
+
+    // Finish off the notifier construct.
+    iData->iNotifier->ConstructL();
+
+    // Create arrays:
+    for ( TInt i = 0 ; i <= KSSSettingsLastSetting ; i++ )
+        {
+        RSSSettingsObserverArray newArray;
+        User::LeaveIfError( iData->iObservers.Append( newArray ) );
+        }
+
+    //Get default CUG
+    error = GetDefaultCugL( iData->iCUGDefault );
+    if ( error != KErrNone )
+        {
+        //Support legacy, if error occurs
+        iData->iCUGDefault = ESSSettingsCugDefault; 
+        }
+    __SSSLOGSTRING("[SSS] <--RSSSettings::OpenL");
+    }
+
+// ---------------------------------------------------------
+// RSSSettings::DeleteSettingsData
+// ---------------------------------------------------------
+//
+void RSSSettings::DeleteSettingsData()
+    {
+    __SSSLOGSTRING("[SSS]--> RSSSettings::DeleteSettingsData");
+    if ( iData == NULL )
+        {
+        return;
+        }
+
+    // if some event is waiting for the observer calls..
+    if (( iData->iCallBackSetting != KErrBadDescriptor ||
+          iData->iCallBackValue != KErrBadDescriptor ) &&
+          iData->iCallBack )
+        {
+        iData->iCallBack->Cancel();
+        InformCallBack( this );
+        }
+
+    // close array
+    MSSSettingsObserver* observer = FindOneObserver();
+    while ( observer )
+        {
+        CancelAll( *observer );
+        observer = FindOneObserver();
+        }
+
+    iData->iObservers.Reset();
+
+    // delete callback
+    if ( iData->iCallBack )
+        {
+        iData->iCallBack->Cancel();
+        delete iData->iCallBack;
+        iData->iCallBack = NULL;
+        }
+
+    // Delete notifier
+    delete iData->iNotifier;
+    iData->iNotifier = NULL;
+
+    delete iData->iRepository;
+    iData->iRepository = NULL;
+    
+    // close phones
+    if ( iData->iCustomPhone )
+        {
+        iData->iCustomPhone->Close();
+        delete iData->iCustomPhone;
+        iData->iCustomPhone = NULL;
+        }
+
+    iData->iMobilePhone.Close();
+
+    // close ETel session
+    if (( iData->iTelServer ) && ( iData->iOwnTelServer ))
+        {
+        if ( iData->iTelServer->Handle() )
+            {
+            iData->iTelServer->Close();
+            }
+        delete iData->iTelServer;
+        iData->iTelServer = NULL;
+        }
+
+    // delete data object
+    delete iData;
+    iData = NULL;
+    __SSSLOGSTRING("[SSS] <--RSSSettings::DeleteSettingsData");
+    }
+
+// ---------------------------------------------------------
+// RSSSettings::InformCallBack
+// KErrBadDescriptor is used as not defined.
+// ---------------------------------------------------------
+//
+TInt RSSSettings::InformCallBack( TAny* aPtr )
+    {
+    __SSSLOGSTRING("[SSS]--> RSSSettings::InformCallBack");
+    RSSSettings* settings = static_cast <RSSSettings*> ( aPtr );
+
+    if ( !settings->iData )
+        {
+        return KErrNone;
+        }
+
+    // We need to have both setting and value to make observer call.
+    if ( settings->iData->iCallBackSetting == KErrBadDescriptor ||
+         settings->iData->iCallBackValue == KErrBadDescriptor )
+        {
+        settings->iData->iCallBackSetting = KErrBadDescriptor;
+        settings->iData->iCallBackValue = KErrBadDescriptor;
+        return KErrNone;
+        }
+
+    settings->InformChange(
+        (TSSSettingsSetting)settings->iData->iCallBackSetting , 
+        settings->iData->iCallBackValue );
+
+    settings->iData->iCallBackSetting = KErrBadDescriptor;
+    settings->iData->iCallBackValue = KErrBadDescriptor;
+    
+    __SSSLOGSTRING("[SSS] <--RSSSettings::InformCallBack");
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------
+// RSSSettings::InformChange
+// ---------------------------------------------------------
+//
+void RSSSettings::InformChange( TSSSettingsSetting aSetting, TInt aNewValue )
+    {
+    __SSSLOGSTRING("[SSS]--> RSSSettings::InformChange");
+    __ASSERT_DEBUG( iData, Panic( SSSettingsPanicOpenNotDone ) );
+
+    RSSSettingsObserverArray& array = iData->iObservers[aSetting];
+    for ( TInt i = 0 ; i < array.Count() ; i++ )
+        {
+        array[i]->PhoneSettingChanged( aSetting, aNewValue );
+        }
+
+    __SSSLOGSTRING("[SSS] <--RSSSettings::InformChange");
+    }
+
+// ---------------------------------------------------------
+// RSSSettings::RegisterAll
+// ---------------------------------------------------------
+//
+EXPORT_C TInt RSSSettings::RegisterAll( MSSSettingsObserver& aObserver )
+    {
+    __SSSLOGSTRING("[SSS]--> RSSSettings::RegisterAll");
+    __ASSERT_DEBUG( iData, Panic( SSSettingsPanicOpenNotDone ) );
+    if ( !iData )
+        {
+        return KErrBadHandle;
+        }
+
+    TInt error(KErrNone);
+    for ( TInt i = 0 ; i <= KSSSettingsLastSetting ; i++ )
+        {
+        error = Register( static_cast <TSSSettingsSetting >( i ), aObserver );
+        // KErrAlreadyExists: it's already registered.
+        // KErrNotSupported: ALS and ALS blocking may return this.
+        if (( error != KErrNone ) && 
+            ( error != KErrAlreadyExists ) && 
+            ( error != KErrNotSupported ))
+            {
+            CancelAll( aObserver );
+            break;
+            }
+        error = KErrNone;
+        }
+    __SSSLOGSTRING("[SSS] <--RSSSettings::RegisterAll");
+    return error;
+    }
+
+// ---------------------------------------------------------
+// RSSSettings::Register
+// ---------------------------------------------------------
+//
+EXPORT_C TInt RSSSettings::Register( 
+    TSSSettingsSetting aSetting, 
+    MSSSettingsObserver& aObserver )
+    {
+    __SSSLOGSTRING("[SSS]--> RSSSettings::Register");
+    __ASSERT_DEBUG( iData, Panic( SSSettingsPanicOpenNotDone ) );
+    if ( !iData )
+        {
+        return KErrBadHandle;
+        }
+    __ASSERT_DEBUG( aSetting <= KSSSettingsLastSetting, 
+                    Panic( SSSettingsPanicInvalidRequest ) );
+
+    if ( ExistsObserver( aSetting, aObserver ) )
+        {
+        return KErrAlreadyExists;
+        }
+
+    RSSSettingsObserverArray& array = iData->iObservers[aSetting];
+
+    // When the first observer is set, the notifier is activated.
+    TInt error(KErrNone);
+    if ( array.Count() == 0 )
+        {
+        error = iData->iNotifier->AddNotifier( aSetting );
+        // if BT Sim Access Profile(SAP) is turned on then ETEL returns KErrNotReady.
+        if ( error != KErrNone )
+            {
+            __SSSLOGSTRING1("[SSS]--> RSSSettings::Register -> Error code: %d", error );
+            return error;
+            }
+        }
+    error = array.Append( &aObserver );
+
+    __SSSLOGSTRING("[SSS] <--RSSSettings::Register");
+    return error;
+    }
+
+// ---------------------------------------------------------
+// RSSSettings::CancelAll
+// ---------------------------------------------------------
+//
+EXPORT_C void RSSSettings::CancelAll( 
+    MSSSettingsObserver& aObserver )
+    {
+    __SSSLOGSTRING("[SSS]--> RSSSettings::CancelAll");
+    if ( !iData )
+        {
+        return;
+        }
+
+    for ( TInt i = 0 ; i <= KSSSettingsLastSetting ; i++ )
+        {
+        Cancel( static_cast <TSSSettingsSetting> ( i ), aObserver );
+        }
+    __SSSLOGSTRING("[SSS] <--RSSSettings::CancelAll");
+    }
+
+// ---------------------------------------------------------
+// RSSSettings::Cancel
+// ---------------------------------------------------------
+//
+EXPORT_C void RSSSettings::Cancel( 
+    TSSSettingsSetting aSetting,
+    MSSSettingsObserver& aObserver )
+    {
+    __SSSLOGSTRING("[SSS]--> RSSSettings::Cancel");
+    if ( !iData )
+        {
+        return;
+        }
+    __ASSERT_ALWAYS( aSetting <= KSSSettingsLastSetting, 
+                     Panic( SSSettingsPanicInvalidRequest ) );
+
+    RSSSettingsObserverArray& array = iData->iObservers[aSetting];
+
+    TInt index = array.Find( &aObserver );
+    if ( index == KErrNotFound )
+        {
+        return;
+        }
+
+    array.Remove( index );
+    array.Compress();
+
+    // When the last observer is removed the notifier is cancelled.
+    if ( array.Count() == 0 )
+        {
+        iData->iNotifier->RemoveNotifier( aSetting );
+        }
+    __SSSLOGSTRING("[SSS] <--RSSSettings::Cancel");
+    }
+
+// ---------------------------------------------------------
+// RSSSettings::Get
+// ---------------------------------------------------------
+//
+EXPORT_C TInt RSSSettings::Get( TSSSettingsSetting aSetting, TInt& aValue )
+    {
+    __SSSLOGSTRING("[SSS]--> RSSSettings::Get");
+    __ASSERT_DEBUG( iData, Panic( SSSettingsPanicOpenNotDone ) );
+    if ( !iData )
+        {
+        return KErrBadHandle;
+        }
+
+    __ASSERT_DEBUG( aSetting <= KSSSettingsLastSetting, 
+                    Panic( SSSettingsPanicInvalidRequest ) );
+
+    TInt error(KErrNone);
+    TInt value(0);
+    if ( error != KErrNone )
+        {
+        return error;
+        }
+
+    // If Get fails, we try to save the default data.
+    switch ( aSetting )
+        {
+        case ESSSettingsCug:
+            error = GetCug( value );
+            if (( error != KErrNone ) && ( error != KErrNotFound ))
+                {
+                break;
+                }
+            if ( error == KErrNotFound )
+                {
+                error = iData->iRepository->Set(
+                    KSettingsCUG,
+                    iData->iCUGDefault );
+                    
+                if ( error != KErrNone )
+                    {
+                    break;
+                    }
+                value = iData->iCUGDefault;
+                }
+            //If value outside of 0-32767 and not 65535, value is not accepted.
+            if ( iData->iCUGDefault == ESSSettingsAltCugDefault )
+                {
+                if ((( value < ESSSettingsCugSuppress ) || 
+                     ( value > ESSSettingsCugMax )) &&
+                     ( value != ESSSettingsAltCugDefault ))
+                    {
+                    error = KErrCorrupt;
+                    break;
+                    }
+                }
+            //If value outside of 1-32767, it is not accepted.
+            else
+                {
+                if (( value < ESSSettingsCugSuppress ) || 
+                    ( value > ESSSettingsCugMax ))
+                    {
+                    error = KErrCorrupt;
+                    break;
+                    }
+                }
+            aValue = value;
+            break;
+        case ESSSettingsClir:
+            error = iData->iRepository->Get(
+                KSettingsCLIR,
+                value );
+            if ( ( error != KErrNone ) && ( error != KErrNotFound ) )
+                {
+                break;
+                }
+            if ( error == KErrNotFound )
+                {
+                error = iData->iRepository->Set( 
+                    KSettingsCLIR,
+                    ESSSettingsClirNetworkDefault );
+                if ( error != KErrNone )
+                    {
+                    break;
+                    }
+                value = ESSSettingsClirNetworkDefault;
+                }
+
+            if (( value < ESSSettingsClirNetworkDefault ) || 
+                ( value > ESSSettingsClirExplicitSuppress ))
+                {
+                error = KErrCorrupt;
+                break;
+                }
+            aValue = value;
+            break;
+            
+        case ESSSettingsAls:
+            {
+            TInt simState(0);
+            error = RProperty::Get( KPSUidStartup, KPSSimStatus, simState );
+            
+            __SSSLOGSTRING2("[SSS] ESSSettingsAls: SIM State: %d Error: %d", simState, error );
+           if ( error == KErrNone )
+                {
+                error = GetALSSettingValue( value, simState );
+                aValue = value;
+                __SSSLOGSTRING1("[SSS]     RSSSettings::Get: ALS Value: %d", aValue );
+                }
+            break;
+            }
+        case ESSSettingsAlsBlocking:
+            {
+            RMmCustomAPI::TGetAlsBlockStatus alsBlockStatus = 
+                RMmCustomAPI::EBlockStatusUnknown;
+            error = iData->iCustomPhone->GetAlsBlocked( alsBlockStatus );
+
+            if ( error != KErrNone )
+                {
+                aValue = ESSSettingsAlsBlockingNotSupported;
+                return KErrNone;
+                }
+            switch ( alsBlockStatus )
+                {
+                case RMmCustomAPI::EBlockStatusNotSupported: 
+                    aValue = ESSSettingsAlsBlockingNotSupported;
+                    break;
+                case RMmCustomAPI::EBlockStatusActive: 
+                    aValue = ESSSettingsAlsBlockingOn;
+                    break;
+                case RMmCustomAPI::EBlockStatusInactive: 
+                    aValue = ESSSettingsAlsBlockingOff;
+                    break;
+                case RMmCustomAPI::EBlockStatusUnknown: 
+                    error = KErrNotSupported;
+                    break;
+                default:
+                    error = KErrNotSupported;
+                    break;
+                }
+            break;
+            }
+        case ESSSettingsDefaultCug:
+            aValue = iData->iCUGDefault;
+            break;
+        default:
+            error = KErrNotSupported;
+            break;
+        }
+
+    __SSSLOGSTRING("[SSS] <--RSSSettings::Get");
+    __SSSLOGSTRING1("[SSS] <--RSSSettings::Get Error code: %d", error );
+    return error;
+    }
+
+// ---------------------------------------------------------
+// RSSSettings::GetALSSettingValue
+// ---------------------------------------------------------
+//
+TInt RSSSettings::GetALSSettingValue( TInt& aValue, const TInt aSimState )
+    {
+    __SSSLOGSTRING1("[SSS]--> RSSSettings::GetALSSettingValue SIMSTATE: %d", aSimState );
+    TInt value(0);
+    TBool simAlsValue(EFalse);
+    TBool ppAlsValue(EFalse);
+    TBool alsCSPSupport(EFalse);
+    TInt error(KErrNone);
+    /* aValue is set to ESSSettingsAlsNotSupported value because if SimState isnt 
+    ESimUsable or ALS handler doesnt exist then value should always be Not Supported.*/ 
+    aValue = ESSSettingsAlsNotSupported;
+    
+    // als is NULL when ALS is not supported by PP als, SIM als and SIM csp als bits.
+    CSSSettingsAlsNotifier* als = iData->iNotifier->GetAlsHandler();
+    __SSSLOGSTRING1("[SSS] AlsHandler value: %d", als );
+    
+     // Make sure that SIM state is OK otherwise parameters coming from SIM are mess.
+    if ( ( aSimState == ESimUsable ) && als )    
+        {
+        error = als->GetAlsValue( (TSSSettingsAlsValue&) value );
+        if ( error == KErrNone )
+            {
+            if (( value < ESSSettingsAlsNotSupported ) || 
+                ( value > ESSSettingsAlsAlternate ))
+                {
+                error = KErrCorrupt;
+                return error;
+                }
+            
+            TInt alsCSPError(KErrNone);
+            als->GetAlsSupport( ppAlsValue, simAlsValue, alsCSPSupport, alsCSPError );
+            if ( alsCSPError == KErrNotReady || alsCSPError == KErrServerBusy )
+                {
+                __SSSLOGSTRING1("[SSS] ALS - CSP specific Error code: %d", alsCSPError );
+                return alsCSPError;                             
+                }
+                                        
+            // Decides if ALS is wanted to be shown.
+            if ( KErrNotSupported == IsALSSupported( ppAlsValue, simAlsValue, alsCSPSupport, error ) )
+                {
+                value = ESSSettingsAlsNotSupported;
+                }
+            aValue = value;
+            }
+        }
+    __SSSLOGSTRING1("[SSS]<-- RSSSettings::GetALSSettingValue Error: %d", error );
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// RSSSettings::IsALSSupported
+// List all cases when als is shown. If there is some special SIM that doesn't
+// support ALS then add case below and give error code KErrNotSupported.
+// ---------------------------------------------------------------------------
+// 
+TInt RSSSettings::IsALSSupported( TInt aPpAlsValue, TInt aSimAlsValue, 
+    TBool aAlsCspSupport, TInt aAlsCspError ) const
+    {
+    TInt error(KErrNotSupported);
+    
+    __SSSLOGSTRING1("[SSS]    RSSSettings::IsALSSupported ppAlsValue value: %d", aPpAlsValue );
+    __SSSLOGSTRING1("[SSS]    RSSSettings::IsALSSupported simAlsValue value:  %d", aSimAlsValue );
+    __SSSLOGSTRING1("[SSS]    RSSSettings::IsALSSupported alsCSPSupport value: %d", aAlsCspSupport );
+    __SSSLOGSTRING1("[SSS]    RSSSettings::IsALSSupported alsCSPError value: %d", aAlsCspError );
+    
+    // When PP ALS is on and used SIM card suppports CSP ALS then alsCSPSupport returns EFALSE and alsCSPError KErrNotSupported but ALS functionality
+    // needs to be shown therefore KErrNone is returned.
+    if ( aPpAlsValue && !aSimAlsValue && aAlsCspSupport == FALSE && aAlsCspError == KErrNotSupported  )
+        {
+        error = KErrNone;
+        }          
+    else if ( aPpAlsValue && aSimAlsValue && aAlsCspSupport == FALSE )
+        {
+        error = KErrNone;
+        }
+    else if ( aPpAlsValue && aSimAlsValue && aAlsCspSupport == TRUE  )
+        {
+        error = KErrNone;
+        }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
+    else if ( aPpAlsValue && !aSimAlsValue && aAlsCspSupport == FALSE  )
+        {
+        error = KErrNone;
+        }
+    else if ( aPpAlsValue && !aSimAlsValue && aAlsCspSupport == TRUE  )
+        {
+        error = KErrNone;
+        }
+    else if ( !aPpAlsValue && aSimAlsValue && aAlsCspSupport == TRUE  )
+        {
+        error = KErrNone;
+        }
+    else if ( !aPpAlsValue && aSimAlsValue && aAlsCspSupport == FALSE  )
+        {
+        error = KErrNotSupported;
+        }
+    else if ( !aPpAlsValue && !aSimAlsValue && aAlsCspSupport == TRUE  )
+        {
+        error = KErrNone;
+        }
+                            
+    return error;   
+    }
+    
+// ---------------------------------------------------------
+// RSSSettings::Set
+// ---------------------------------------------------------
+//
+EXPORT_C TInt RSSSettings::Set( TSSSettingsSetting aSetting, TInt aValue )
+    {
+    __SSSLOGSTRING("[SSS]--> RSSSettings::Set");
+    __ASSERT_DEBUG( iData, Panic( SSSettingsPanicOpenNotDone ) );
+    if ( !iData )
+        {
+        return KErrBadHandle;
+        }
+
+    __ASSERT_DEBUG( aSetting <= KSSSettingsLastSetting, 
+                    Panic( SSSettingsPanicInvalidRequest ) );
+
+    TInt error(KErrNone);
+    if ( error != KErrNone )
+        {
+        return error;
+        }
+
+    switch ( aSetting )
+        {
+        case ESSSettingsCug:
+            {
+            if ( iData->iCUGDefault == ESSSettingsAltCugDefault )
+                {
+                if ((( aValue < ESSSettingsCugSuppress ) || 
+                    ( aValue > ESSSettingsCugMax )) &&
+                    ( aValue != iData->iCUGDefault ))
+                    {
+                    error = KErrArgument;
+                    break;
+                    }
+                }
+            else
+                {
+                if (( aValue < ESSSettingsCugSuppress ) || 
+                    ( aValue > ESSSettingsCugMax ))
+                    {
+                    error = KErrArgument;
+                    break;
+                    }
+                }
+            if ( error == KErrNone )
+                {
+                error = SetCug( aValue, iData->iCUGDefault );
+                }
+            }
+            break;
+        case ESSSettingsClir:
+            if (( aValue < ESSSettingsClirNetworkDefault ) || 
+                ( aValue > ESSSettingsClirExplicitSuppress ))
+                {
+                error = KErrArgument;
+                break;
+                }
+            error = iData->iRepository->Set(
+                KSettingsCLIR,
+                aValue );
+            break;
+        case ESSSettingsAls:
+            {
+            // ESSSettingsAlsBlockingNotSupported is not allowed to write
+            if (( aValue < ESSSettingsAlsBlockingOff ) || 
+                ( aValue > ESSSettingsAlsAlternate ))
+                {
+                error = KErrArgument;
+                break;
+                }
+
+            CSSSettingsAlsNotifier* als = iData->iNotifier->GetAlsHandler();
+            if ( als )
+                {
+                error = als->SetAlsValue( (TSSSettingsAlsValue)aValue );   
+                }
+            else
+                {
+                error = KErrNotSupported;
+                }
+            break;
+            }
+        case ESSSettingsAlsBlocking:
+            switch ( aValue )
+                {
+                case ESSSettingsAlsBlockingOn:
+                    error = iData->iCustomPhone->SetAlsBlocked( 
+                        RMmCustomAPI::EActivateBlock );
+                    break;
+                case ESSSettingsAlsBlockingOff:
+                    error = iData->iCustomPhone->SetAlsBlocked( 
+                        RMmCustomAPI::EDeactivateBlock );
+                    break;
+                default:
+                    error = KErrArgument;
+                    break;
+                }
+            break;
+        case ESSSettingsDefaultCug:
+            return KErrNotSupported;
+        default:
+            error = KErrArgument;
+            break;
+        }
+
+    if ( error == KErrNone )
+        {
+        // If old request is still waiting, force it to end.
+        if (( iData->iCallBackSetting != KErrBadDescriptor ) ||
+            ( iData->iCallBackValue != KErrBadDescriptor ))
+            {
+            iData->iCallBack->Cancel();
+            InformCallBack( this );
+            }
+
+        // activate call back
+        iData->iCallBackSetting = aSetting;
+        iData->iCallBackValue = aValue;
+        iData->iCallBack->CallBack();
+        }
+    __SSSLOGSTRING("[SSS] <--RSSSettings::Set");
+    return error;
+    }
+
+// ---------------------------------------------------------
+// RSSSettings::HandleSIMChanged
+// ---------------------------------------------------------
+//
+EXPORT_C TInt RSSSettings::HandleSIMChanged()
+    {
+    __SSSLOGSTRING("[SSS]--> RSSSettings::HandleSIMChanged");
+    __ASSERT_DEBUG( iData, Panic( SSSettingsPanicOpenNotDone ) );
+    if ( !iData )
+        {
+        return KErrBadHandle;
+        }
+    TInt error = Set( ESSSettingsCug, iData->iCUGDefault );
+    if ( error != KErrNone )
+        {
+        return error;
+        }
+    else
+        {
+        // Reset also the previous Cug value.
+        error = ResetPreviousCugValue();
+        if ( error != KErrNone )
+            {
+            return error;
+            }
+        }
+
+    error = Set( ESSSettingsClir, ESSSettingsClirNetworkDefault );
+    if ( error != KErrNone )
+        {
+        return error;
+        }
+
+    // Set als to primary only if it's stored in Shared Data.
+    CSSSettingsAlsNotifier* als = iData->iNotifier->GetAlsHandler();
+    if ( als )
+        {
+        TBool simAls(EFalse);
+        TBool ppAls(EFalse);
+        TBool cspAls(EFalse);
+        TInt cspError(KErrNone);
+        als->GetAlsSupport( ppAls, simAls, cspAls, cspError );
+        __SSSLOGSTRING2("[SSS]     RSSSettings::HandleSIMChanged: ppAls: %d, simAls: %d", ppAls, simAls );
+        if ( !simAls )
+            {
+            error = Set( ESSSettingsAls, ESSSettingsAlsPrimary );
+            }
+        }
+    __SSSLOGSTRING("[SSS] <--RSSSettings::HandleSIMChanged");
+    return error;
+    }
+
+// ---------------------------------------------------------
+// RSSSettings::ExistsObserver
+// ---------------------------------------------------------
+//
+TBool RSSSettings::ExistsObserver( TSSSettingsSetting aSetting, 
+                    MSSSettingsObserver& aObserver )
+    {
+    __SSSLOGSTRING("[SSS]--> RSSSettings::ExistsObserver");
+    if ( !iData )
+        {
+        return EFalse;
+        }
+
+    __ASSERT_ALWAYS( aSetting <= KSSSettingsLastSetting, 
+                    Panic( SSSettingsPanicInvalidRequest ) );
+
+    TInt index = iData->iObservers[aSetting].Find( &aObserver );
+    if ( index == KErrNotFound )
+        {
+        return EFalse;
+        }
+
+    __SSSLOGSTRING("[SSS] <--RSSSettings::ExistsObserver");
+    return ETrue;
+    }
+
+// ---------------------------------------------------------
+// RSSSettings::FindOneObserver
+// ---------------------------------------------------------
+//
+MSSSettingsObserver* RSSSettings::FindOneObserver() const
+    {
+    __SSSLOGSTRING("[SSS]--> RSSSettings::FindOneObserver");
+    if ( iData == NULL )
+        {
+        return NULL;
+        }
+
+    for ( TInt settingIndex = 0 ; 
+          settingIndex < iData->iObservers.Count() ; 
+          settingIndex++ )
+        {
+        RSSSettingsObserverArray& array = iData->iObservers[settingIndex];
+        if ( array.Count() )
+            {
+            return array[0];
+            }
+        }
+
+    __SSSLOGSTRING("[SSS] <--RSSSettings::FindOneObserver");
+    return NULL;
+    }
+
+// ---------------------------------------------------------
+// RSSSettings::GetCug
+// ---------------------------------------------------------
+//
+TInt RSSSettings::GetCug( TInt& aValue ) const
+    {
+    __SSSLOGSTRING("[SSS]--> RSSSettings::GetCug");
+    TInt value(KErrNone);
+    TInt error(KErrNone);
+    error = iData->iRepository->Get(
+        KSettingsCUG,
+        value );
+
+    if ( error == KErrNone )
+        {
+        aValue = value;
+        }
+
+    __SSSLOGSTRING1("[SSS]     RSSSettings::GetCug: value: %d", value );
+    __SSSLOGSTRING("[SSS] <--RSSSettings::GetCug");
+    return error;
+    }
+
+// ---------------------------------------------------------
+// RSSSettings::GetDefaultCugL
+// ---------------------------------------------------------
+//
+TInt RSSSettings::GetDefaultCugL( TInt& aValue ) const
+    {
+    __SSSLOGSTRING("[SSS]--> RSSSettings::GetDefaultCugL");
+    TInt value(0);
+    TBool useDefault(EFalse);
+    TInt error(KErrNone);
+    CRepository* repository = CRepository::NewL( KCRUidTelSrvVariation );
+    error = repository->Get(
+            KTelSrvVariationFlags,
+            value );
+    delete repository;
+    repository = NULL;
+    __SSSLOGSTRING1("[SSS]--> RSSSettings::GetDefaultCugL: value: %d", value);
+    
+    if ( error == KErrNotFound )
+        {
+        useDefault = ETrue;
+        }
+    else if ( error != KErrNone )
+        {
+        return error;
+        }
+
+    if (( useDefault ) || 
+       !( value & KTelephonyLVFlagStandardCugIndexing ))
+        {
+        value = ESSSettingsCugDefault;
+        }
+    else
+        {
+        value = ESSSettingsAltCugDefault;
+        }
+    //Return directly (i.e. no shifting).
+    aValue = value;
+
+    __SSSLOGSTRING1("[SSS]--> RSSSettings::GetDefaultCugL: value: %d", value);
+    __SSSLOGSTRING("[SSS] <--RSSSettings::GetDefaultCugL");
+    return error;
+    }
+
+// ---------------------------------------------------------
+// RSSSettings::SetCug
+// Reads existing CUG value from shared data. If new CUG
+// value is between 1 and 32767 (or between 0 and 32767), 
+// value is to shared data.
+// Change also the previous cug to be the old current one.
+// ---------------------------------------------------------
+//
+TInt RSSSettings::SetCug( const TInt aValue, const TInt aCugDefault ) const
+    {
+    __SSSLOGSTRING("[SSS]--> RSSSettings::SetCug");
+    TInt value(KErrNone);
+    TInt error(KErrNone);
+    error = iData->iRepository->Get( KSettingsCUG, value );
+    __SSSLOGSTRING1("[SSS]--> RSSSettings::SetCug: value: %d", value);
+    if ( error == KErrNone )
+        {
+        TInt previousCug(value);
+
+        // CUG default must be saved as shared data default, to support
+        // different platform versions. Do not write default Cug again to 
+        // Central Repository, if already exists.
+        if ( ( aValue != aCugDefault ) ||
+             ( ( aValue == aCugDefault ) && ( previousCug != aCugDefault ) ) )
+            {
+            // Write the current cug value to Central Repository.
+            error = iData->iRepository->Set( KSettingsCUG, aValue );
+            __SSSLOGSTRING1("[SSS]--> RSSSettings::SetCug: aValue: %d", aValue);
+            if ( error == KErrNone )
+                {
+                if ( ( previousCug != ESSSettingsCugSuppress ) &&
+                     ( previousCug != aCugDefault ) )
+                    {
+                    // Write previous cug value to Central Repository.
+                    // Default or Suppress value can not be previousCug.
+                    error = iData->iRepository->Set( 
+                        KSettingsPreviousCUGIndex,
+                        previousCug );
+                    __SSSLOGSTRING1("[SSS]--> RSSSettings::SetCug: previousCug: %d", previousCug);
+                    }
+                }
+            }
+        }
+    __SSSLOGSTRING("[SSS] <--RSSSettings::SetCug");
+    return error;
+    }
+
+// ---------------------------------------------------------
+// RSSSettings::PreviousCugValue
+// ---------------------------------------------------------
+//
+EXPORT_C TInt RSSSettings::PreviousCugValue( TInt& aPreviousValue )
+    {
+    __SSSLOGSTRING("[SSS]--> RSSSettings::PreviousCugValue");
+    __ASSERT_DEBUG( iData, Panic( SSSettingsPanicOpenNotDone ) );
+    if ( !iData )
+        {
+        return KErrBadHandle;
+        }
+    TInt value(KErrNone);
+    TInt error = iData->iRepository->Get( 
+        KSettingsPreviousCUGIndex,
+        value );
+
+    if ( error == KErrNone )
+        {
+        aPreviousValue = value;
+        }
+
+    __SSSLOGSTRING1("[SSS]--> RSSSettings::PreviousCugValue: value: %d", value);
+    __SSSLOGSTRING("[SSS] <--RSSSettings::PreviousCugValue");
+    return error;
+    }
+
+// ---------------------------------------------------------
+// RSSSettings::ResetPreviousCugValue
+// Reset PreviousCugValue
+// ---------------------------------------------------------
+//
+EXPORT_C TInt RSSSettings::ResetPreviousCugValue()
+    {
+    __SSSLOGSTRING("[SSS]--> RSSSettings::ResetPreviousCugValue");
+    __ASSERT_DEBUG( iData, Panic( SSSettingsPanicOpenNotDone ) );
+    if ( !iData )
+        {
+        return KErrBadHandle;
+        }
+
+    TInt value(KErrNone);
+    TInt error(KErrNone);
+    error = iData->iRepository->Get(
+        KSettingsPreviousCUGIndex,
+        value );
+    __SSSLOGSTRING1("[SSS]--> RSSSettings::PreviousCugValue; before setting: value: %d", value);
+    if ( error == KErrNone )
+        {
+        // Set cug to default one.
+        value = iData->iCUGDefault;
+        error = iData->iRepository->Set(
+            KSettingsPreviousCUGIndex,
+            value );
+        __SSSLOGSTRING1("[SSS]--> RSSSettings::PreviousCugValue; after setting: value: %d", value);
+        }
+    __SSSLOGSTRING("[SSS] <--RSSSettings::ResetPreviousCugValue");
+    return error;
+    }
+
+// ---------------------------------------------------------
+// RSSSettings::HandleRefresh
+// ---------------------------------------------------------
+//
+EXPORT_C TInt RSSSettings::HandleRefresh()
+    {
+    __ASSERT_DEBUG( iData, Panic( SSSettingsPanicOpenNotDone ) );
+    if ( !iData )
+        {
+        return KErrBadHandle;
+        }
+
+    return iData->iNotifier->HandleRefresh();
+    }
+
+// ---------------------------------------------------------
+// RSSSettings::IsValueValidCugIndex
+// ---------------------------------------------------------
+//
+EXPORT_C TBool RSSSettings::IsValueValidCugIndex( const TInt& aValue ) const
+    {
+    __ASSERT_DEBUG( iData, Panic( SSSettingsPanicOpenNotDone ) );
+    if ( !iData )
+        {
+        return KErrBadHandle;
+        }
+
+    TBool validCugIndex = !(( aValue > ESSSettingsCugMax ) ||
+                            ( aValue < ESSSettingsCugMin ));
+
+    if ( iData->iCUGDefault != ESSSettingsCugDefault )
+        {
+        validCugIndex = validCugIndex || 
+                        aValue == ESSSettingsAltCugMin;
+        }
+    return validCugIndex;
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS ==============
+// Panic
+GLREF_C void Panic( TSSSettingsPanic aPanic )
+    {
+    User::Panic( KPanicCat, aPanic );
+    }
+    
+//  End of File 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/tsrc/public/basic/EunitTest/BWINS/MT_SSSettingsu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -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/cellular/sssettings/tsrc/public/basic/EunitTest/EABI/MT_SSSettingsu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z16CreateTestSuiteLv @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/tsrc/public/basic/EunitTest/Group/MT_SSSettings.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* 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:  MT_SSSettings
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET          MT_SSSettings.dll
+TARGETTYPE      dll
+TARGETPATH      /DigiaEUnit/Tests
+UID             0x1000af5a 0x01700000
+
+CAPABILITY              ALL -TCB
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../MT_SSSettings
+SOURCE                  MT_SSSettingsDllMain.cpp
+SOURCE                  MT_SSSettings.cpp
+
+USERINCLUDE             ../MT_SSSettings
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           ../../../../../inc
+SYSTEMINCLUDE           /epoc32/include/Digia/EUnit
+
+LIBRARY                 CenRepNotifHandler.lib
+LIBRARY                 centralrepository.lib
+LIBRARY                 CommonEngine.lib
+LIBRARY                 CUSTOMAPI.lib
+LIBRARY                 etel.lib
+LIBRARY                 etelmm.lib
+LIBRARY                 EUnit.lib
+LIBRARY                 euser.lib
+LIBRARY                 FeatMgr.lib
+LIBRARY                 flogger.lib
+LIBRARY                 SatClient.lib
+LIBRARY                 SSSettings.lib
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/tsrc/public/basic/EunitTest/Group/MT_SSSettings.pkg	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,33 @@
+;
+; 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: For packing sssettings test compoment.
+;
+; Supported languages
+&en
+
+; Package header (one name for each supported language)
+#{"MT_SSSettings"},(0xA00001F2),1,0,0
+
+;Localised Vendor name
+%{"Nokia Test EN"}
+
+;Unique Vendor name
+:"Vendor"
+
+;Key and certificate
+*"rd-key.pem","rd.cer"
+
+; Language independent files that are always installed
+"\epoc32\release\armv5\urel\MT_SSSettings.dll"-"C:\DigiaEUnit\Tests\MT_SSSettings.dll"
+"\epoc32\release\armv5\urel\MT_SSSettings.dll"-"C:\sys\bin\MT_SSSettings.dll"
Binary file cellular/sssettings/tsrc/public/basic/EunitTest/Group/MT_SSSettings.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/tsrc/public/basic/EunitTest/Group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,34 @@
+/*
+* 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:  MT_SSSettings
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+    DEFAULT
+
+PRJ_EXPORTS
+
+// IBY file
+//../rom/mt_sssettings.iby         CORE_APP_LAYER_IBY_EXPORT_PATH(mt_sssettings.iby)
+
+PRJ_MMPFILES
+
+PRJ_TESTMMPFILES
+../group/MT_SSSettings.mmp
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/tsrc/public/basic/EunitTest/MT_SSSettings/MT_SSSettings.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,710 @@
+/*
+* 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:  MT_SSSettings
+*
+*/
+
+
+//  CLASS HEADER
+#include "MT_SSSettings.h"
+
+//  EXTERNAL INCLUDES
+#include <EUnitMacros.h>
+#include <CSSSettingsRefreshContainer.h>
+#include <rcustomerserviceprofilecache.h>
+#include <rsssettings.h>
+#include <mmtsy_names.h>
+
+//  INTERNAL INCLUDES
+#define KSSSettingsTSYName KMmTsyModuleName
+// CONSTANTS
+const TInt KCPETestWaitTime = 2000000; // Two second 
+const TInt KSSSettingsMaxETelRetryCount(7);
+const TInt KSSSettingsETelRetryCountTimeout(100000); 
+    
+//////////////////////////////////////////////////////////////////////////////////
+////	MT_SSSettings CLASS
+///////////////////////////////////////////////////////////////////////////////////
+//  METHODS
+// CONSTRUCTION
+MT_SSSettings* MT_SSSettings::NewL()
+    {
+    MT_SSSettings* self = MT_SSSettings::NewLC();
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+MT_SSSettings* MT_SSSettings::NewLC()
+    {
+    MT_SSSettings* self = new( ELeave ) MT_SSSettings();
+    CleanupStack::PushL( self );
+
+    self->ConstructL();
+
+    return self;
+    }
+
+// Destructor (virtual by CBase)
+MT_SSSettings::~MT_SSSettings()
+    {
+    }
+
+// Default constructor
+MT_SSSettings::MT_SSSettings()
+    {
+    }
+
+// Second phase construct
+void MT_SSSettings::ConstructL()
+    {
+    // The ConstructL from the base class CEUnitTestSuiteClass must be called.
+    // It generates the test case table.
+    CEUnitTestSuiteClass::ConstructL();
+    
+    iSettings = new(ELeave) RSSSettings;
+    }
+///////////////////////////////////////////////////////////////////////////////////
+////	MSSSettingsObserver - PhoneSettingChanged
+///////////////////////////////////////////////////////////////////////////////////
+void MT_SSSettings::PhoneSettingChanged( TSSSettingsSetting /*aSetting*/, 
+            TInt /*aNewValue*/ )
+    {
+    // Do nothing.
+    }
+
+///////////////////////////////////////////////////////////////////////////////////
+////	EmptySetupL
+///////////////////////////////////////////////////////////////////////////////////
+void MT_SSSettings::EmptySetupL(  )
+    {
+    iCugValue = NULL;
+    iClirValue = NULL;
+    iAlsValue = NULL;
+    iAlsBlockValue = NULL;
+    iCugDefValue = NULL;
+    iSettings = new(ELeave) RSSSettings;
+    }
+    
+///////////////////////////////////////////////////////////////////////////////////
+////	EmptyTeardown
+///////////////////////////////////////////////////////////////////////////////////    
+void MT_SSSettings::EmptyTeardown(  )
+    {
+    delete iSettings;
+    iSettings = NULL;
+    }
+    
+///////////////////////////////////////////////////////////////////////////////////
+////	SetupL
+///////////////////////////////////////////////////////////////////////////////////
+void MT_SSSettings::SetupL(  )
+    {
+    iCugValue = NULL;
+    iClirValue = NULL;
+    if ( iAlsValue < NULL )
+        {
+        iAlsValue = NULL;
+        }
+    iAlsValue = NULL;
+    iAlsBlockValue = NULL;
+    iCugDefValue = NULL;
+    iSettings = new(ELeave) RSSSettings;
+    User::LeaveIfError(iSettings->Open());
+    }
+    
+///////////////////////////////////////////////////////////////////////////////////
+////	Teardown
+///////////////////////////////////////////////////////////////////////////////////
+void MT_SSSettings::Teardown(  )
+    {
+    iSettings->Close();
+    delete iSettings;
+    iSettings = NULL;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////
+////	CSP SetupL
+///////////////////////////////////////////////////////////////////////////////////
+void MT_SSSettings::CSPSetupL(  )
+    {
+    iCugValue = NULL;
+    iClirValue = NULL;
+    iAlsValue = NULL;
+    iAlsBlockValue = NULL;
+    iCugDefValue = NULL;   
+    
+    iCSP = new (ELeave) RCustomerServiceProfileCache;
+    User::LeaveIfError(iCSP->Open());
+    }
+    
+///////////////////////////////////////////////////////////////////////////////////
+////	CSP Teardown
+///////////////////////////////////////////////////////////////////////////////////
+void MT_SSSettings::CSPTeardown(  )
+    {
+    delete iCSP;
+    iCSP = NULL;
+    }
+    
+///////////////////////////////////////////////////////////////////////////////////
+////	MT_RSSSettings_OpenCloseL
+///////////////////////////////////////////////////////////////////////////////////
+void MT_SSSettings::MT_RSSSettings_OpenCloseL(  )
+    {
+    // Open RSSSettings connection.
+    iSettings->Open();
+    // Close RSSSettings connection.
+    iSettings->Close();
+    }
+    
+///////////////////////////////////////////////////////////////////////////////////
+////	MT_RSSSettings_Open_1L
+///////////////////////////////////////////////////////////////////////////////////
+void MT_SSSettings::MT_RSSSettings_Open_1L(  )
+    {
+    RTelServer*  telServer = new ( ELeave ) RTelServer();
+    // Retry ETel connection:
+    TInt err(KErrNone);
+    for ( TInt i = 0 ; i < KSSSettingsMaxETelRetryCount ; i++ )
+        {
+        err = telServer->Connect();
+        if ( err == KErrNone )
+            {
+            break;
+            }
+        User::After( KSSSettingsETelRetryCountTimeout );
+        }
+   User::LeaveIfError( err );
+
+    // Open phones
+    TInt error = telServer->LoadPhoneModule( KSSSettingsTSYName );
+    if (( error != KErrNone ) && ( error != KErrAlreadyExists ))
+        {
+        User::Leave( error );
+        }
+    // Open RSSSettings connection.
+    User::LeaveIfError(iSettings->Open(telServer));
+    // Close RSSSettings connection.
+    iSettings->Close();
+    
+    // close ETel session
+    if ( telServer )
+        {
+        if ( telServer->Handle() )
+            {
+            telServer->Close();
+            }
+        delete telServer;
+        telServer = NULL;
+        }
+    }
+    
+///////////////////////////////////////////////////////////////////////////////////
+////	MT_RSSSettings_RegisterL
+///////////////////////////////////////////////////////////////////////////////////    
+void MT_SSSettings::MT_RSSSettings_RegisterL(  )
+    {
+    User::LeaveIfError(iSettings->Register( ESSSettingsCug, *this ));
+    iSettings->Cancel( ESSSettingsCug, *this );
+    
+    User::LeaveIfError(iSettings->Register( ESSSettingsClir, *this ));
+    iSettings->Cancel( ESSSettingsClir, *this );
+    
+    User::LeaveIfError(iSettings->Register( ESSSettingsAls, *this ));
+    iSettings->Cancel( ESSSettingsAls, *this );
+    
+    User::LeaveIfError(iSettings->Register( ESSSettingsAlsBlocking, *this ));
+    iSettings->Cancel( ESSSettingsAlsBlocking, *this );
+    
+    User::LeaveIfError(iSettings->Register( ESSSettingsDefaultCug, *this ));
+    iSettings->Cancel( ESSSettingsDefaultCug, *this );
+    }
+
+///////////////////////////////////////////////////////////////////////////////////
+////	MT_RSSSettings_RegisterAllL
+/////////////////////////////////////////////////////////////////////////////////// 
+void MT_SSSettings::MT_RSSSettings_RegisterAllL(  )
+    {
+    User::LeaveIfError(iSettings->RegisterAll( *this ));
+    iSettings->CancelAll( *this );
+    }
+
+///////////////////////////////////////////////////////////////////////////////////
+////	MT_RSSSettings_CancelAllL
+/////////////////////////////////////////////////////////////////////////////////// 
+void MT_SSSettings::MT_RSSSettings_CancelAllL(  )
+    {
+    iSettings->CancelAll( *this );
+    }
+
+///////////////////////////////////////////////////////////////////////////////////
+////	MT_RSSSettings_CancelL
+/////////////////////////////////////////////////////////////////////////////////// 
+void MT_SSSettings::MT_RSSSettings_CancelL( )
+    {
+    User::LeaveIfError(iSettings->Register( ESSSettingsCug, *this ));
+    iSettings->Cancel( ESSSettingsCug, *this );
+    }
+
+///////////////////////////////////////////////////////////////////////////////////
+////	MT_RSSSettings_GetL
+/////////////////////////////////////////////////////////////////////////////////// 
+void MT_SSSettings::MT_RSSSettings_GetL(  )
+    {
+    User::LeaveIfError(iSettings->Get( ESSSettingsCug, iCugValue ));
+    User::LeaveIfError(iSettings->Get( ESSSettingsClir, iClirValue ));
+    User::LeaveIfError(iSettings->Get( ESSSettingsAls, iAlsValue ));
+    User::LeaveIfError(iSettings->Get( ESSSettingsAlsBlocking, iAlsBlockValue ));
+    User::LeaveIfError(iSettings->Get( ESSSettingsDefaultCug, iCugDefValue ));
+    }
+
+///////////////////////////////////////////////////////////////////////////////////
+////	MT_RSSSettings_SetL
+/////////////////////////////////////////////////////////////////////////////////// 
+void MT_SSSettings::MT_RSSSettings_SetL(  )
+    {
+    TInt cug(32767);
+    TInt defCug(0);
+    
+    // Set cug value.
+    User::LeaveIfError(iSettings->Set( ESSSettingsCug, cug ));
+    
+    // Set clir value.
+    if ( iClirValue == ESSSettingsClirExplicitInvoke )
+        {
+        User::LeaveIfError(iSettings->Set( ESSSettingsClir, ESSSettingsClirExplicitSuppress ));
+        }
+    else
+        {
+        User::LeaveIfError(iSettings->Set( ESSSettingsClir, ESSSettingsClirExplicitInvoke ));
+        }
+    // Set als value.
+    // If timer is not used set als param will cause request count warning or fail 
+    // because SSSettings does several ASync request during als set operation.
+    if ( iAlsValue == ESSSettingsAlsPrimary )
+        {
+        User::LeaveIfError(iSettings->Set( ESSSettingsAls, ESSSettingsAlsAlternate ));
+        WaitTimer( KCPETestWaitTime );
+        }
+    else
+        {
+        iSettings->Set( ESSSettingsAls, ESSSettingsAlsPrimary );
+        WaitTimer( KCPETestWaitTime );
+        }
+    // Set als blcking value.
+    if ( iAlsBlockValue == ESSSettingsAlsBlockingOff )
+        {
+        User::LeaveIfError(iSettings->Set( ESSSettingsAlsBlocking, ESSSettingsAlsBlockingOn ));    
+        }
+    else
+        {
+        User::LeaveIfError(iSettings->Set( ESSSettingsAlsBlocking, ESSSettingsAlsBlockingOff )); 
+        }
+    
+    // Set default cug value.
+    iSettings->Set( ESSSettingsDefaultCug, defCug ); // returns kerrnotsupported
+    }
+    
+///////////////////////////////////////////////////////////////////////////////////
+////	MT_RSSSettings_WaitTimer
+////    Start CActiveSchedulerWait, this wait last until Stop is called. This allows 
+////    other parts of software to run. Expires after given delay.
+/////////////////////////////////////////////////////////////////////////////////// 
+void MT_SSSettings::WaitTimer( TInt aWaitTime )
+    {
+    CPeriodic* iTimer = CPeriodic::NewL( CActive::EPriorityStandard );
+    iTimer->Start( aWaitTime, aWaitTime, TCallBack( DoCallBackL, this ) );
+    iWaitTimer.Start();
+
+    delete iTimer;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////
+////	MT_RSSSettings_DoCallBackL
+/////////////////////////////////////////////////////////////////////////////////// 
+TInt MT_SSSettings::DoCallBackL( TAny* aAny )
+    {
+    // can't call iWaitAny.AsyncStop() in static function
+    REINTERPRET_CAST( MT_SSSettings*, aAny )->Stop();
+    return KErrNone;
+    }
+    
+///////////////////////////////////////////////////////////////////////////////////
+////	MT_RSSSettings_Stop
+/////////////////////////////////////////////////////////////////////////////////// 
+void MT_SSSettings::Stop()
+    {
+    iWaitTimer.AsyncStop();  
+    }
+
+///////////////////////////////////////////////////////////////////////////////////
+////	MT_RSSSettings_HandleSIMChangedL
+/////////////////////////////////////////////////////////////////////////////////// 
+void MT_SSSettings::MT_RSSSettings_HandleSIMChangedL(  )
+    {
+    User::LeaveIfError(iSettings->HandleSIMChanged());
+    }
+    
+///////////////////////////////////////////////////////////////////////////////////
+////	MT_RSSSettings_PreviousCugValueL
+/////////////////////////////////////////////////////////////////////////////////// 
+void MT_SSSettings::MT_RSSSettings_PreviousCugValueL(  )
+    {
+    TInt previousValue(0);
+    User::LeaveIfError(iSettings->PreviousCugValue(previousValue));
+    }
+
+///////////////////////////////////////////////////////////////////////////////////
+////	MT_RSSSettings_ResetPreviousCugValueL
+/////////////////////////////////////////////////////////////////////////////////// 
+void MT_SSSettings::MT_RSSSettings_ResetPreviousCugValueL(  )
+    {
+    User::LeaveIfError(iSettings->ResetPreviousCugValue());    
+    }
+
+///////////////////////////////////////////////////////////////////////////////////
+////	MT_RSSSettings_HandleRefreshL
+/////////////////////////////////////////////////////////////////////////////////// 
+void MT_SSSettings::MT_RSSSettings_HandleRefreshL(  )
+    {
+    // Emulator returns -6/KErrArgument.
+    TInt error = iSettings->HandleRefresh();
+    if ( error != KErrNone && error != KErrArgument )
+        {
+        User::Leave(KErrGeneral);
+        }
+    }
+
+///////////////////////////////////////////////////////////////////////////////////
+////	MT_RSSSettings_IsValueValidCugIndexL
+/////////////////////////////////////////////////////////////////////////////////// 
+void MT_SSSettings::MT_RSSSettings_IsValueValidCugIndexL(  )
+    {
+    TBool cugValue(0);
+    TInt notCugValue(32768);
+    TInt corCugValue(32767);
+    cugValue = iSettings->IsValueValidCugIndex( notCugValue );
+    if ( cugValue )
+        {
+        User::Leave(KErrGeneral);
+        }
+        
+    cugValue = iSettings->IsValueValidCugIndex( corCugValue );
+    if ( !cugValue )
+        {
+        User::Leave(KErrGeneral);
+        }
+    }
+
+// From MSSSettingsRefreshHandler.
+void MT_SSSettings::NotifyFileChangeL( 
+            MSSSettingsRefreshObserver& /*aObserver*/,
+            TSatElementaryFiles /*aObservedFile*/,
+            TSatRefreshType /*aObservedRefreshType*/)
+    {
+    }
+            
+// From MSSSettingsRefreshHandler.
+void  MT_SSSettings::CancelNotify()
+    {
+    // Do nothing
+    }
+    
+// From MSSSettingsRefreshHandler.
+TInt  MT_SSSettings::ChangedCspTable( TDes8& /*aChangedCsps*/,
+            TDes8& /*aNewValues*/ )
+    {
+    return KErrNone;
+    // Do nothing
+    }
+    
+// From   MSSSettingsRefreshObserver.
+TBool MT_SSSettings::AllowRefresh( const TSatRefreshType /*aType*/,
+            const TSatElementaryFiles /*aFiles*/ )
+    {
+    return KErrNone;
+    // Do nothing
+    }
+            
+// From   MSSSettingsRefreshObserver.
+void  MT_SSSettings::Refresh( const TSatRefreshType /*aType*/,
+            const TSatElementaryFiles /*aFiles*/ )
+    {
+    // Do nothing
+    }
+///////////////////////////////////////////////////////////////////////////////////
+////	MT_CSSSettingsRefreshContainer_NewLL
+/////////////////////////////////////////////////////////////////////////////////// 
+void MT_SSSettings::MT_CSSSettingsRefreshContainer_NewLL()
+    {
+    CSSSettingsRefreshContainer* refreshContainer = CSSSettingsRefreshContainer::NewL();
+    MSSSettingsRefreshHandler* refreshHandler = &refreshContainer->RefreshHandler();
+    
+    //NotifyFileChangeL( *this, KCspEf, EFileChangeNotification );
+    refreshHandler->NotifyFileChangeL( *this, KCspEf, EFileChangeNotification );
+    
+    refreshHandler = NULL;
+    delete refreshContainer;
+    refreshContainer = NULL;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////
+////	MT_RCustomerServiceProfileCache_CspCallCompletionL
+/////////////////////////////////////////////////////////////////////////////////// 
+void MT_SSSettings::MT_RCustomerServiceProfileCache_CspCallCompletionL()
+    {
+    RMobilePhone::TCspCallCompletion params;    
+    TInt retVal = iCSP->CspCallCompletion(params);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////
+////	MT_RCustomerServiceProfileCache_CspCallOfferingL
+/////////////////////////////////////////////////////////////////////////////////// 
+void MT_SSSettings::MT_RCustomerServiceProfileCache_CspCallOfferingL()
+    {
+    RMobilePhone::TCspCallOffering params;    
+    TInt retVal = iCSP->CspCallOffering(params);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////
+////	MT_RCustomerServiceProfileCache_CspCallRestrictionL
+/////////////////////////////////////////////////////////////////////////////////// 
+void MT_SSSettings::MT_RCustomerServiceProfileCache_CspCallRestrictionL()
+    {
+    RMobilePhone::TCspCallRestriction params;    
+    TInt retVal = iCSP->CspCallRestriction(params);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////
+////	MT_RCustomerServiceProfileCache_CspCPHSTeleservicesL
+/////////////////////////////////////////////////////////////////////////////////// 
+void MT_SSSettings::MT_RCustomerServiceProfileCache_CspCPHSTeleservicesL()
+    {
+    RMobilePhone::TCspCPHSTeleservices params;    
+    TInt retVal = iCSP->CspCPHSTeleservices(params);
+    }
+    
+///////////////////////////////////////////////////////////////////////////////////
+////	MT_RCustomerServiceProfileCache_CspCPHSValueAddedServicesL
+/////////////////////////////////////////////////////////////////////////////////// 
+void MT_SSSettings::MT_RCustomerServiceProfileCache_CspCPHSValueAddedServicesL()
+    {
+    RMobilePhone::TCspValueAdded params;    
+    TInt retVal = iCSP->CspCPHSValueAddedServices(params);
+    }   
+     
+///////////////////////////////////////////////////////////////////////////////////
+////	MT_RCustomerServiceProfileCache_CspTeleServicesL
+/////////////////////////////////////////////////////////////////////////////////// 
+void MT_SSSettings::MT_RCustomerServiceProfileCache_CspTeleServicesL()
+    {
+    RMobilePhone::TCspTeleservices params;    
+    TInt retVal = iCSP->CspTeleServices(params);
+    }
+    
+///////////////////////////////////////////////////////////////////////////////////
+////	MT_RCustomerServiceProfileCache_HandleRefreshL
+///////////////////////////////////////////////////////////////////////////////////     
+void MT_SSSettings::MT_RCustomerServiceProfileCache_HandleRefreshL()
+    {       
+    TInt retVal = iCSP->HandleRefresh();
+    }
+
+///////////////////////////////////////////////////////////////////////////////////
+////	MT_RCustomerServiceProfileCache_ChangedCspTableL
+/////////////////////////////////////////////////////////////////////////////////// 
+void MT_SSSettings::MT_RCustomerServiceProfileCache_ChangedCspTableL()
+    {
+    RMobilePhone::TMobilePhoneCspFileV1 cspSettings;
+    RMobilePhone::TMobilePhoneCspFileV1Pckg cspSettingsPckg ( cspSettings );
+    RMobilePhone::TMobilePhoneCspFileV1 cspValues;
+    RMobilePhone::TMobilePhoneCspFileV1Pckg cspValuePckg ( cspValues );
+
+    iCSP->ChangedCspTable( cspSettingsPckg, cspValuePckg );
+    }
+
+///////////////////////////////////////////////////////////////////////////////////
+////  TEST TABLE
+///////////////////////////////////////////////////////////////////////////////////
+EUNIT_BEGIN_TEST_TABLE(
+    MT_SSSettings,
+    "Add test suite description here.",
+    "MODULE" )
+
+// RCustomerServiceProfileCache Class test.
+    
+EUNIT_TEST(
+    "RCSP:CallCompletion",
+    "RCustomerServiceProfileCache",
+    "CspCallCompletion",
+    "FUNCTIONALITY",
+    CSPSetupL, MT_RCustomerServiceProfileCache_CspCallCompletionL, CSPTeardown)
+    
+EUNIT_TEST(
+    "RCSP:CspCallOffering",
+    "RCustomerServiceProfileCache",
+    "CspCallOffering",
+    "FUNCTIONALITY",
+    CSPSetupL, MT_RCustomerServiceProfileCache_CspCallOfferingL, CSPTeardown)
+    
+
+EUNIT_TEST(
+    "RCSP:CspCallRestriction",
+    "RCustomerServiceProfileCache",
+    "CspCallRestriction",
+    "FUNCTIONALITY",
+    CSPSetupL, MT_RCustomerServiceProfileCache_CspCallRestrictionL, CSPTeardown)
+    
+EUNIT_TEST(
+    "RCSP:CspCPHSTeleservices",
+    "RCustomerServiceProfileCache",
+    "CspCPHSTeleservices",
+    "FUNCTIONALITY",
+    CSPSetupL, MT_RCustomerServiceProfileCache_CspCPHSTeleservicesL, CSPTeardown)
+
+EUNIT_TEST(
+    "RCSP:CspCPHSValueAddedServices",
+    "RCustomerServiceProfileCache",
+    "CspCPHSValueAddedServices",
+    "FUNCTIONALITY",
+    CSPSetupL, MT_RCustomerServiceProfileCache_CspCPHSValueAddedServicesL, CSPTeardown)
+
+EUNIT_TEST(
+    "RCSP:CspTeleServices",
+    "RCustomerServiceProfileCache",
+    "CspTeleServices",
+    "FUNCTIONALITY",
+    CSPSetupL, MT_RCustomerServiceProfileCache_CspTeleServicesL, CSPTeardown)
+
+EUNIT_TEST(
+    "RCSP:HandleRefresh",
+    "RCustomerServiceProfileCache",
+    "HandleRefresh",
+    "FUNCTIONALITY",
+    CSPSetupL, MT_RCustomerServiceProfileCache_HandleRefreshL, CSPTeardown)
+    
+EUNIT_TEST(
+    "RCSP:ChangedCspTable",
+    "RCustomerServiceProfileCache",
+    "ChangedCspTable",
+    "FUNCTIONALITY",
+    CSPSetupL, MT_RCustomerServiceProfileCache_ChangedCspTableL, CSPTeardown)
+        
+// CSSSettingsRefreshContainer Class test.
+
+EUNIT_TEST(
+    "Ref:NewL",
+    "CSSSettingsRefreshContainer",
+    "NewL",
+    "FUNCTIONALITY",
+    EmptySetupL, MT_CSSSettingsRefreshContainer_NewLL, EmptyTeardown)
+
+// RSSSettings Class test.
+
+EUNIT_TEST(
+    "RSS:Open Close",
+    "RSSSettings",
+    "Close",
+    "FUNCTIONALITY",
+    EmptySetupL, MT_RSSSettings_OpenCloseL, EmptyTeardown)
+
+EUNIT_TEST(
+    "RSS:Open with EtelParam",
+    "RSSSettings",
+    "Open",
+    "FUNCTIONALITY",
+    EmptySetupL, MT_RSSSettings_Open_1L, EmptyTeardown)
+
+EUNIT_TEST(
+    "RSS:RegisterAll",
+    "RSSSettings",
+    "RegisterAll",
+    "FUNCTIONALITY",
+    SetupL, MT_RSSSettings_RegisterAllL, Teardown)
+
+EUNIT_TEST(
+    "RSS:Register",
+    "RSSSettings",
+    "Register",
+    "FUNCTIONALITY",
+    SetupL, MT_RSSSettings_RegisterL, Teardown)
+
+EUNIT_TEST(
+    "RSS:CancelAll",
+    "RSSSettings",
+    "CancelAll",
+    "FUNCTIONALITY",
+    SetupL, MT_RSSSettings_CancelAllL, Teardown)
+
+EUNIT_TEST(
+    "RSS:Cancel",
+    "RSSSettings",
+    "Cancel",
+    "FUNCTIONALITY",
+    SetupL, MT_RSSSettings_CancelL, Teardown)
+
+EUNIT_TEST(
+    "RSS:Get",
+    "RSSSettings",
+    "Get",
+    "FUNCTIONALITY",
+    SetupL, MT_RSSSettings_GetL, Teardown)
+
+EUNIT_TEST(
+    "RSS:Set",
+    "RSSSettings",
+    "Set",
+    "FUNCTIONALITY",
+    SetupL, MT_RSSSettings_SetL, Teardown)
+
+EUNIT_TEST(
+    "RSS:HandleSIMChanged",
+    "RSSSettings",
+    "HandleSIMChanged",
+    "FUNCTIONALITY",
+    SetupL, MT_RSSSettings_HandleSIMChangedL, Teardown)
+
+EUNIT_TEST(
+    "RSS:PreviousCugValue",
+    "RSSSettings",
+    "PreviousCugValue",
+    "FUNCTIONALITY",
+    SetupL, MT_RSSSettings_PreviousCugValueL, Teardown)
+
+EUNIT_TEST(
+    "RSS:ResetPreviousCugValue",
+    "RSSSettings",
+    "ResetPreviousCugValue",
+    "FUNCTIONALITY",
+    SetupL, MT_RSSSettings_ResetPreviousCugValueL, Teardown)
+
+EUNIT_TEST(
+    "RSS:HandleRefresh",
+    "RSSSettings",
+    "HandleRefresh",
+    "FUNCTIONALITY",
+    SetupL, MT_RSSSettings_HandleRefreshL, Teardown)
+
+EUNIT_TEST(
+    "RSS:IsValueValidCugIndex",
+    "RSSSettings",
+    "IsValueValidCugIndex",
+    "FUNCTIONALITY",
+    SetupL, MT_RSSSettings_IsValueValidCugIndexL, Teardown)
+
+
+EUNIT_END_TEST_TABLE
+
+//  END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/tsrc/public/basic/EunitTest/MT_SSSettings/MT_SSSettings.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,215 @@
+/*
+* 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:  MT_SSSettings
+*
+*/
+
+
+#ifndef __MT_SSSETTINGS_H__
+#define __MT_SSSETTINGS_H__
+
+//  EXTERNAL INCLUDES
+#include <CEUnitTestSuiteClass.h>
+#include <etelmm.h>
+#include <MSSSettingsObserver.h>
+#include <msssettingsrefreshobserver.h>
+#include <MSSSettingsRefreshHandler.h>
+#include <MSatRefreshObserver.h>
+#include <etelsat.h>
+
+//  INTERNAL INCLUDES
+
+
+//  FORWARD DECLARATIONS
+class RCustomerServiceProfileCache;
+class RSSSettings;
+class CSSSettingsRefreshContainer;
+
+#include <e32def.h>
+#ifndef NONSHARABLE_CLASS
+    #define NONSHARABLE_CLASS(x) class x
+#endif
+
+//  CLASS DEFINITION
+/**
+ *
+ * EUnitWizard generated test class. 
+ *
+ */
+NONSHARABLE_CLASS( MT_SSSettings )
+     : public CEUnitTestSuiteClass,
+       public MSSSettingsObserver,
+       public MSSSettingsRefreshObserver,
+       public MSSSettingsRefreshHandler
+    {
+    public:     // Constructors and destructors
+
+        /**
+         * Two phase construction
+         */
+        static MT_SSSettings* NewL();
+        static MT_SSSettings* NewLC();
+        /**
+         * Destructor
+         */
+        ~MT_SSSettings();
+
+    private:    // Constructors and destructors
+
+        MT_SSSettings();
+        void ConstructL();
+
+    public:     // From observer interface
+    
+          // From MSSSettingsObserver.
+          void PhoneSettingChanged( TSSSettingsSetting /*aSetting*/, 
+            TInt /*aNewValue*/ );
+            
+          // From MSSSettingsRefreshHandler.
+          void NotifyFileChangeL( 
+            MSSSettingsRefreshObserver& /*aObserver*/,
+            TSatElementaryFiles /*aObservedFile*/,
+            TSatRefreshType /*aObservedRefreshType*/);
+            
+          // From MSSSettingsRefreshHandler.
+          void CancelNotify();
+          
+          // From MSSSettingsRefreshHandler.
+          TInt ChangedCspTable( TDes8& /*aChangedCsps*/,
+            TDes8& /*aNewValues*/ );
+            
+          // From   MSSSettingsRefreshObserver.
+          TBool AllowRefresh(
+            const TSatRefreshType /*aType*/,
+            const TSatElementaryFiles /*aFiles*/ );
+            
+          // From   MSSSettingsRefreshObserver.
+          void Refresh(
+            const TSatRefreshType /*aType*/,
+            const TSatElementaryFiles /*aFiles*/ );
+        
+
+    private:    // New methods
+    
+         void EmptySetupL();
+        
+         void EmptyTeardown();
+
+         void SetupL();
+        
+         void Teardown();
+         
+         void CSPSetupL();
+         
+         void CSPTeardown();
+        
+         void MT_CSSSettingsRefreshContainer_NewLL();
+        
+        
+         void MT_RCustomerServiceProfileCache_CspCallCompletionL();
+        
+        
+         void MT_RCustomerServiceProfileCache_CspCallOfferingL();
+        
+        
+         void MT_RCustomerServiceProfileCache_CspCallRestrictionL();
+        
+        
+         void MT_RCustomerServiceProfileCache_CspCPHSTeleservicesL();
+        
+        
+         void MT_RCustomerServiceProfileCache_HandleRefreshL();
+        
+        
+         void MT_RCustomerServiceProfileCache_CspCPHSValueAddedServicesL();
+        
+        
+         void MT_RCustomerServiceProfileCache_CspTeleServicesL();
+        
+        
+         void MT_RCustomerServiceProfileCache_ChangedCspTableL();
+        
+        
+         void MT_RSSSettings_RSSSettingsL();
+        
+        
+         void MT_RSSSettings_OpenCloseL();
+         
+        
+         void MT_RSSSettings_Open_1L();
+        
+        
+         void MT_RSSSettings_RegisterAllL();
+        
+        
+         void MT_RSSSettings_RegisterL();
+        
+        
+         void MT_RSSSettings_CancelAllL();
+        
+        
+         void MT_RSSSettings_CancelL();
+        
+        
+         void MT_RSSSettings_GetL();
+        
+        
+         void MT_RSSSettings_SetL();
+        
+        
+         void MT_RSSSettings_HandleSIMChangedL();
+        
+        
+         void MT_RSSSettings_PreviousCugValueL();
+        
+        
+         void MT_RSSSettings_ResetPreviousCugValueL();
+        
+        
+         void MT_RSSSettings_HandleRefreshL();
+        
+        
+         void MT_RSSSettings_IsValueValidCugIndexL();
+         
+         static TInt DoCallBackL( TAny* aAny );
+         
+         void WaitTimer( TInt aWaitTime );
+        
+         void Stop();
+
+    private:    // Data
+            
+        //MSSSettingsRefreshHandler* iRefreshHandler;
+        
+        CActiveSchedulerWait iWaitTimer;
+
+        RSSSettings* iSettings;
+        
+        TInt iCugValue;
+        TInt iClirValue;
+        TInt iAlsValue;
+        TInt iAlsBlockValue;
+        TInt iCugDefValue;
+        
+        RCustomerServiceProfileCache* iCSP;
+        
+        
+        
+        EUNIT_DECLARE_TEST_TABLE; 
+
+    };
+
+#endif      //  __MT_SSSETTINGS_H__
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/tsrc/public/basic/EunitTest/MT_SSSettings/MT_SSSettingsDllMain.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,41 @@
+/*
+* 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:  MT_SSSettings
+*
+*/
+
+
+//  CLASS HEADER
+#include "MT_SSSettings.h"
+
+//  EXTERNAL INCLUDES
+#include <CEUnitTestSuite.h>
+
+/**
+ * Test suite factory function.
+ */
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return MT_SSSettings::NewL();
+    }
+
+
+
+//  END OF FILE
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/tsrc/public/basic/EunitTest/rom/mt_sssettings.iby	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,24 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  IBY file
+ *
+*/
+
+
+#ifndef __MTSSSETTINGS_IBY__
+#define __MTSSSETTINGS_IBY__
+
+file= ABI_DIR\BUILD_DIR\MT_SSSettings.dll   SHARED_LIB_DIR\MT_SSSettings.dll
+
+#endif // __MTSSSETTINGS_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/tsrc/public/basic/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,21 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Build file for sssettings testing.
+*
+*/
+
+#include "../EunitTest/group/bld.inf"
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/xqbindings/sssettingswrapper/rom/sssettingswrapper.iby	Wed Jul 21 18:26:52 2010 +0300
@@ -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:
+*
+*/
+
+#ifndef __SSSETTINGSWRAPPER_IBY__
+#define __SSSETTINGSWRAPPER_IBY__
+
+#include <bldvariant.hrh>
+
+file=ABI_DIR\BUILD_DIR\sssettingswrapper.dll                 SHARED_LIB_DIR\sssettingswrapper.dll
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/xqbindings/sssettingswrapper/src/logging.h	Wed Jul 21 18:26:52 2010 +0300
@@ -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:  
+ *
+ */
+
+#ifndef LOGGING_H
+#define LOGGING_H
+
+#include <QDebug>
+
+#define DPRINT qDebug() << __PRETTY_FUNCTION__
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/xqbindings/sssettingswrapper/src/sssettingswrapper.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,90 @@
+/*
+ * 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:  
+ *
+ */
+
+
+#include <sssettingswrapper.h>
+#include <rsssettings.h>
+#include "sssettingswrapper_p.h"
+#include "logging.h"
+
+/*!
+  SsSettingsWrapper::SsSettingsWrapper
+ */
+SsSettingsWrapper::SsSettingsWrapper(QObject *parent): 
+    QObject(parent), m_Priv(new SsSettingsWrapperPrivate(*this))
+{
+    DPRINT << ": IN";
+    
+    // Initialize RSSSettings 
+    m_ssSettings = new RSSSettings;
+    int err = m_ssSettings->Open();
+    DPRINT << "err: " << err;
+    // Register for notifications
+    m_ssSettings->RegisterAll( *m_Priv );  
+    
+    DPRINT << ": OUT";
+}
+
+/*!
+  SsSettingsWrapper::~SsSettingsWrapper
+ */
+SsSettingsWrapper::~SsSettingsWrapper()
+{
+    DPRINT << ": IN";
+    
+    if(m_ssSettings){
+        m_ssSettings->Close();
+    }
+    delete m_ssSettings;
+    delete m_Priv;
+    
+    DPRINT << ": OUT";
+}
+    
+/*!
+  SsSettingsWrapper::get
+ */
+int SsSettingsWrapper::get(SsSettingsWrapperSettings setting, int &value)
+{
+    DPRINT << ": IN";
+    
+    int err = m_ssSettings->Get(static_cast<TSSSettingsSetting>(setting), value);
+    
+    DPRINT << ": err: " << err;
+    DPRINT << ": setting: " << setting;
+    DPRINT << ": value: " << value;
+    DPRINT << ": OUT" ;
+    return err;
+}   
+
+/*!
+  SsSettingsWrapper::set
+ */
+int SsSettingsWrapper::set(SsSettingsWrapperSettings setting, int value)
+{
+    DPRINT << ": IN";
+    
+    int err = m_ssSettings->Set( static_cast<TSSSettingsSetting>(setting), value );
+    
+    DPRINT << ": err: " << err;
+    DPRINT << ": setting: " << setting;
+    DPRINT << ": value: " << value;
+    DPRINT << ": OUT" ;
+    return err;   
+}     
+    
+// End of File.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/xqbindings/sssettingswrapper/src/sssettingswrapper_p.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  
+ *
+ */
+
+#include "sssettingswrapper_p.h"
+#include "sssettingswrapper.h"
+#include "logging.h"
+#include <rsssettings.h>
+
+/*!
+  SsSettingsWrapperPrivate::SsSettingsWrapperPrivate
+ */
+SsSettingsWrapperPrivate::SsSettingsWrapperPrivate( SsSettingsWrapper &owner ) : m_Owner(owner)
+{
+    DPRINT;
+}
+
+/*!
+  SsSettingsWrapperPrivate::~SsSettingsWrapperPrivate
+ */
+SsSettingsWrapperPrivate::~SsSettingsWrapperPrivate()
+{
+    DPRINT;
+}
+
+/*!
+  SsSettingsWrapperPrivate::PhoneSettingChanged
+ */
+void SsSettingsWrapperPrivate::PhoneSettingChanged( 
+    TSSSettingsSetting aSetting, 
+    TInt aNewValue )
+{
+    DPRINT << ": IN";
+    DPRINT << ": aSetting: " << static_cast<SsSettingsWrapperSettings>(aSetting);
+    DPRINT << ": aNewValue: " << aNewValue;
+        
+    emit m_Owner.phoneSettingChanged( 
+        static_cast<SsSettingsWrapperSettings>(aSetting),
+        static_cast<int>(aNewValue));
+        
+    DPRINT << ": OUT";
+}
+    
+// End of File. 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/xqbindings/sssettingswrapper/src/sssettingswrapper_p.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  
+ *
+ */
+
+#ifndef SSSETTINGSWRAPPER_P_H
+#define SSSETTINGSWRAPPER_P_H
+
+#include <rsssettings.h>
+#include <msssettingsobserver.h>
+
+
+class SsSettingsWrapper;
+
+class SsSettingsWrapperPrivate: public MSSSettingsObserver
+{
+public:
+    SsSettingsWrapperPrivate( SsSettingsWrapper &owner );
+    
+    ~SsSettingsWrapperPrivate();
+    
+public: // From MSSSettingsObserver:
+    void PhoneSettingChanged( 
+        TSSSettingsSetting aSetting, 
+        TInt aNewValue ); 
+
+private: // Data: 
+    
+    SsSettingsWrapper &m_Owner;
+    
+};
+
+#endif // SSSETTINGSWRAPPER_P
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/xqbindings/sssettingswrapper/src/sssettingswrapper_s.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -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:  
+ *
+ */
+
+
+#include "sssettingswrapper.h"
+#include "logging.h"
+
+
+SsSettingsWrapper::SsSettingsWrapper(QObject *parent): 
+    QObject(parent)
+{
+    DPRINT << "DUMMY WRAPPER";
+}
+
+SsSettingsWrapper::~SsSettingsWrapper()
+{
+    DPRINT << "DUMMY WRAPPER";
+}
+    
+    
+int SsSettingsWrapper::get(SsSettingsWrapperSettings setting, int &value)
+{
+    DPRINT << "DUMMY WRAPPER";
+    return 0;
+}   
+
+int SsSettingsWrapper::set(SsSettingsWrapperSettings setting, int value)
+{
+    DPRINT << "DUMMY WRAPPER";
+    return 0;
+}     
+    
+// End of File. 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/xqbindings/sssettingswrapper/sssettingswrapper.pri	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,27 @@
+#
+# 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: 
+#
+
+HEADERS += ../../../../phonesrv_plat/ss_settings_api/inc/sssettingswrapper.h \
+           ../../../../phonesrv_plat/ss_settings_api/inc/sssettingswrappertypes.h \
+   
+symbian: {
+    SOURCES += ./src/sssettingswrapper.cpp \
+              ./src/sssettingswrapper_p.cpp
+} 
+else: {
+    SOURCES = ./src/sssettingswrapper_s.cpp
+}
+       
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/xqbindings/sssettingswrapper/sssettingswrapper.pro	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,57 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+#
+
+TEMPLATE = lib
+TARGET = 
+MOC_DIR = moc
+
+INCLUDEPATH += ../../../../phonesrv_plat/ss_settings_api/inc
+SOURCEPATH += src
+
+# Input
+include(sssettingswrapper.pri)
+
+DEFINES += BUILD_SSSETTINGSWRAPPER
+
+symbian: {
+    LIBS += -lsssettings
+    load(data_caging_paths)
+    INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
+
+    TARGET.EPOCALLOWDLLDATA = 1 
+    TARGET.CAPABILITY = CAP_GENERAL_DLL
+    TARGET.UID3 = 0X20029F22
+
+    defFiles = \
+    "$${LITERAL_HASH}ifdef WINS" \
+        "DEFFILE bwins/sssettingswrapper.def" \
+    "$${LITERAL_HASH}else" \
+        "DEFFILE eabi/sssettingswrapper.def" \
+    "$${LITERAL_HASH}endif"
+    MMP_RULES += defFiles
+    
+    # For sis file
+    dllfile.sources = $${TARGET}.dll
+    dllfile.path = $$SHARED_LIB_DIR
+    DEPLOYMENT += dllfile
+
+    BLD_INF_RULES.prj_exports +=  \
+     "$${LITERAL_HASH}include <platform_paths.hrh>" \
+     "./rom/sssettingswrapper.iby    CORE_MW_LAYER_IBY_EXPORT_PATH(sssettingswrapper.iby)"
+} else: {
+    DESTDIR = c:\hb\lib
+    DLLDESTDIR = c:\hb\bin
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/xqbindings/sssettingswrapper/tsrc/mocks/mock_rsssettings.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,189 @@
+/*
+ * 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:  
+ *
+ */
+ 
+#include <smcmockclassincludes.h>
+#include <rsssettings.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// RSSSettings::RSSSettings
+// -----------------------------------------------------------------------------
+//
+RSSSettings::RSSSettings(  )
+    {
+    
+    }
+
+
+// -----------------------------------------------------------------------------
+// RSSSettings::Close
+// -----------------------------------------------------------------------------
+//
+void RSSSettings::Close(  )
+    {
+    SMC_MOCK_METHOD0( void )
+    }
+
+
+// -----------------------------------------------------------------------------
+// RSSSettings::Open
+// -----------------------------------------------------------------------------
+//
+TInt RSSSettings::Open(  )
+    {
+    SMC_MOCK_METHOD0( TInt )
+    }
+
+
+// -----------------------------------------------------------------------------
+// RSSSettings::Open
+// -----------------------------------------------------------------------------
+//
+TInt RSSSettings::Open( 
+        RTelServer * aTelServer )
+    {
+    SMC_MOCK_METHOD1( TInt, RTelServer *, aTelServer )
+    }
+
+
+// -----------------------------------------------------------------------------
+// RSSSettings::RegisterAll
+// -----------------------------------------------------------------------------
+//
+TInt RSSSettings::RegisterAll( 
+        MSSSettingsObserver & aObserver )
+    {
+    //SMC_MOCK_METHOD1( TInt, MSSSettingsObserver &, aObserver )
+    }
+
+
+// -----------------------------------------------------------------------------
+// RSSSettings::Register
+// -----------------------------------------------------------------------------
+//
+TInt RSSSettings::Register( 
+        TSSSettingsSetting aSetting,
+        MSSSettingsObserver & aObserver )
+    {
+    //SMC_MOCK_METHOD2( TInt, TSSSettingsSetting, aSetting, 
+    //    MSSSettingsObserver &, aObserver )
+    }
+
+
+// -----------------------------------------------------------------------------
+// RSSSettings::CancelAll
+// -----------------------------------------------------------------------------
+//
+void RSSSettings::CancelAll( 
+        MSSSettingsObserver & aObserver )
+    {
+    //SMC_MOCK_METHOD1( void, MSSSettingsObserver &, aObserver )
+    }
+
+
+// -----------------------------------------------------------------------------
+// RSSSettings::Cancel
+// -----------------------------------------------------------------------------
+//
+void RSSSettings::Cancel( 
+        TSSSettingsSetting aSetting,
+        MSSSettingsObserver & aObserver )
+    {
+    //SMC_MOCK_METHOD2( void, TSSSettingsSetting, aSetting, 
+    //    MSSSettingsObserver &, aObserver )
+    }
+
+
+// -----------------------------------------------------------------------------
+// RSSSettings::Get
+// -----------------------------------------------------------------------------
+//
+TInt RSSSettings::Get( 
+        TSSSettingsSetting aSetting,
+        TInt & aValue )
+    {
+    SMC_MOCK_METHOD2( TInt, TSSSettingsSetting, aSetting, 
+        TInt &, aValue )
+    }
+
+
+// -----------------------------------------------------------------------------
+// RSSSettings::Set
+// -----------------------------------------------------------------------------
+//
+TInt RSSSettings::Set( 
+        TSSSettingsSetting aSetting,
+        TInt aValue )
+    {
+    SMC_MOCK_METHOD2( TInt, TSSSettingsSetting, aSetting, 
+        TInt, aValue )
+    }
+
+
+// -----------------------------------------------------------------------------
+// RSSSettings::HandleSIMChanged
+// -----------------------------------------------------------------------------
+//
+TInt RSSSettings::HandleSIMChanged(  )
+    {
+    SMC_MOCK_METHOD0( TInt )
+    }
+
+
+// -----------------------------------------------------------------------------
+// RSSSettings::PreviousCugValue
+// -----------------------------------------------------------------------------
+//
+TInt RSSSettings::PreviousCugValue( 
+        TInt & aPreviousValue )
+    {
+    SMC_MOCK_METHOD1( TInt, TInt &, aPreviousValue )
+    }
+
+
+// -----------------------------------------------------------------------------
+// RSSSettings::ResetPreviousCugValue
+// -----------------------------------------------------------------------------
+//
+TInt RSSSettings::ResetPreviousCugValue(  )
+    {
+    SMC_MOCK_METHOD0( TInt )
+    }
+
+
+// -----------------------------------------------------------------------------
+// RSSSettings::HandleRefresh
+// -----------------------------------------------------------------------------
+//
+TInt RSSSettings::HandleRefresh(  )
+    {
+    SMC_MOCK_METHOD0( TInt )
+    }
+
+
+// -----------------------------------------------------------------------------
+// RSSSettings::IsValueValidCugIndex
+// -----------------------------------------------------------------------------
+//
+TBool RSSSettings::IsValueValidCugIndex( 
+        const TInt & aValue ) const
+    {
+    SMC_MOCK_METHOD1( TBool, const TInt &, aValue )
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/xqbindings/sssettingswrapper/tsrc/run_auto_tests_qt.bat	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,194 @@
+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
+
+@echo off
+setlocal
+goto :startup 
+
+::::::::::::::::::::::::::::::::::::::::::::::::::::::
+:: function DEFAULT
+::
+:: Modify this function
+::  - TESTED_SRC can be changed to match tested code.
+::    Specifies path from testcode group directory to
+::    tested code
+::  - Add test directories to be runned
+::    ie. "call :build ut_projectdirectory" or use
+::    "for /f %%a in ('dir /b ut_*') do call :build %%a"
+::    which compiles, instruments and runs all test directories
+::    starting with "ut_".
+::::::::::::::::::::::::::::::::::::::::::::::::::::::
+:DEFAULT
+set TESTED_SRC=..\..\src\*
+
+for /f %%a in ('dir /b ut_*') do call :build %%a
+if [%DOMODULESTESTS%] EQU [TRUE] (
+for /f %%a in ('dir /b mt_*') do call :build %%a
+)
+
+call :finish
+goto :END
+
+::::::::::::::::::::::::::::::::::::::::::::::::::::::
+:: function STARTUP
+::
+:: Initializing script
+::::::::::::::::::::::::::::::::::::::::::::::::::::::
+:STARTUP
+
+set BUILDTESTS=TRUE
+set RUNTESTS=TRUE
+set INSTRUMENT=TRUE
+set REMOVEINSTRUMENT=TRUE
+set DOMODULESTESTS=TRUE
+set SBS_CALL=sbs --config winscw_udeb --keepgoing BUILD
+set PATH_TO_DLL=\epoc32\release\winscw\udeb
+set PATH_TO_COVERAGE_DATA=\coverage_data
+set PATH_TO_RESULT=\test_result
+
+if not exist %PATH_TO_COVERAGE_DATA% (
+mkdir %PATH_TO_COVERAGE_DATA%
+)
+
+if not exist %PATH_TO_RESULT% (
+mkdir %PATH_TO_RESULT%
+)
+
+if [%1] EQU [] ( goto default )
+
+call :%1
+call :%2
+call :%3
+call :%4
+call :%5
+echo Running tests = %RUNTESTS%
+echo Instrumenting tests = %INSTRUMENT%
+goto default
+
+:/NOCLEANUP
+set REMOVEINSTRUMENT=FALSE
+goto end
+
+:/NORUN
+set RUNTESTS=FALSE
+set REMOVEINSTRUMENT=FALSE
+goto end
+
+:/NOINSTRUMENT
+set INSTRUMENT=FALSE
+goto end
+
+:/NOBUILD
+set BUILDTESTS=FALSE
+goto end
+
+:/ONLYUNITTESTS
+set DOMODULESTESTS=FALSE
+goto end
+
+::::::::::::::::::::::::::::::::::::::::::::::::::::::
+:: function FINISH
+::
+:: Finishes run_auto_tests.bat
+::::::::::::::::::::::::::::::::::::::::::::::::::::::
+:FINISH
+
+if [%RUNTESTS%] EQU [TRUE] (
+call :runtests
+)
+
+if [%INSTRUMENT%] EQU [TRUE] (
+call :calculatecoverage
+)
+
+if [%REMOVEINSTRUMENT%] EQU [TRUE] (
+call :removecoverage
+)
+goto end
+
+::::::::::::::::::::::::::::::::::::::::::::::::::::::
+:: function BUILD
+::    param directory
+::
+:: builds test from given directory
+::::::::::::::::::::::::::::::::::::::::::::::::::::::
+:BUILD
+setlocal
+if [%BUILDTESTS%] EQU [FALSE] ( goto end )
+echo Building %1
+if not exist %1 ( 
+echo %1 Not found! 
+goto end
+)
+
+pushd .
+call cd %1
+call qmake
+call sbs --config winscw_udeb --keepgoing CLEAN
+if [%INSTRUMENT%] EQU [TRUE] (
+call ctcwrap -2comp -n %PATH_TO_COVERAGE_DATA%\%1 -i d -C "EXCLUDE=*" -C "NO_EXCLUDE=%TESTED_SRC%" "%SBS_CALL%"
+) else (
+call %SBS_CALL%
+)
+
+popd
+endlocal
+goto end
+
+
+::::::::::::::::::::::::::::::::::::::::::::::::::::::
+:: function RUNTESTS
+::
+:: NOTE! Function assumes that test binary is named according to test directory.
+::::::::::::::::::::::::::::::::::::::::::::::::::::::
+:RUNTESTS
+echo Running tests
+for /f %%a in ('dir /b ut_*') do (
+    call %PATH_TO_DLL%\%%a.exe -dtextshell --
+    move \epoc32\winscw\c\data\%%a.log %PATH_TO_RESULT%\%%a.log
+)
+goto end
+
+::::::::::::::::::::::::::::::::::::::::::::::::::::::
+:: function CALCULATECOVERAGE
+::
+:: Calculates test coverage. Generates html
+::::::::::::::::::::::::::::::::::::::::::::::::::::::
+:CALCULATECOVERAGE
+echo Calculating coverage
+ctcpost %PATH_TO_COVERAGE_DATA%\*.sym | ctcmerge -i - -o profile.txt
+call ctc2html -t 70 -i profile.txt -o \coverage_result -nsb
+goto end
+
+::::::::::::::::::::::::::::::::::::::::::::::::::::::
+:: function REMOVECOVERAGE
+::
+:: Removes data from coverage directory
+::::::::::::::::::::::::::::::::::::::::::::::::::::::
+:REMOVECOVERAGE
+echo Removing deleting coverage data
+call del %PATH_TO_COVERAGE_DATA%\*.sym
+call del %PATH_TO_COVERAGE_DATA%\*.dat
+call del profile.txt
+goto end
+
+::::::::::::::::::::::::::::::::::::::::::::::::::::::
+:: function END
+::
+:: Prints done
+::::::::::::::::::::::::::::::::::::::::::::::::::::::
+:END
+echo Done!
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/xqbindings/sssettingswrapper/tsrc/ut_sssettingswrapper/qtestmains60.h	Wed Jul 21 18:26:52 2010 +0300
@@ -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:
+*
+*/
+
+#ifndef QTESTMAINS60
+#define QTESTMAINS60
+
+#define QTEST_MAIN_S60(TestObject) \
+int main(int argc, char *argv[]) \
+{ \
+char *new_argv[3]; \
+QCoreApplication app(argc, argv); \
+\
+QString str = "C:\\data\\" + QFileInfo(QCoreApplication::applicationFilePath()).baseName() + ".log"; \
+QByteArray   bytes  = str.toAscii(); \
+\
+char arg1[] = "-o"; \
+\
+new_argv[0] = argv[0]; \
+new_argv[1] = arg1; \
+new_argv[2] = bytes.data(); \
+\
+TestObject tc; \
+return QTest::qExec(&tc, 3, new_argv); \
+}
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/xqbindings/sssettingswrapper/tsrc/ut_sssettingswrapper/ut_sssettingswrapper.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,125 @@
+/*
+* 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:
+*
+*/
+
+#include "ut_sssettingswrapper.h"
+#include "qtestmains60.h"
+#define private public
+#include "sssettingswrapper.h"
+#include "sssettingswrapper_p.h"
+
+/*!
+  UT_SsSettingsWrapper::UT_SsSettingsWrapper
+ */
+UT_SsSettingsWrapper::UT_SsSettingsWrapper() 
+    : mWrapper(NULL)
+{
+}
+
+/*!
+  UT_SsSettingsWrapper::~UT_SsSettingsWrapper
+ */
+UT_SsSettingsWrapper::~UT_SsSettingsWrapper()
+{
+    delete mWrapper;
+}
+
+/*!
+  UT_SsSettingsWrapper::init
+ */
+void UT_SsSettingsWrapper::init()
+{
+    initialize();
+
+    mWrapper = new SsSettingsWrapper();
+}
+
+/*!
+  UT_SsSettingsWrapper::cleanup
+ */
+void UT_SsSettingsWrapper::cleanup()
+{
+    reset();
+    
+    delete mWrapper;
+    mWrapper = NULL;
+}
+
+/*!
+  UT_SsSettingsWrapper::t_memleak
+ */
+void UT_SsSettingsWrapper::t_memleak()
+{
+    
+}
+
+/*!
+  UT_SsSettingsWrapper::t_get
+ */
+void UT_SsSettingsWrapper::t_get()
+{
+    int value = 0;
+    expect("RSSSettings::Get").with(ESSSettingsCug, 0);
+    QVERIFY( !mWrapper->get(Cug, value) );
+    expect("RSSSettings::Get").with(ESSSettingsClir, 0);
+    QVERIFY( !mWrapper->get(Clir, value) );
+    expect("RSSSettings::Get").with(ESSSettingsAls, 0);
+    QVERIFY( !mWrapper->get(Als, value) );
+    expect("RSSSettings::Get").with(ESSSettingsAlsBlocking, 0);
+    QVERIFY( !mWrapper->get(AlsBlocking, value) );
+    expect("RSSSettings::Get").with(ESSSettingsDefaultCug, 0);
+    QVERIFY( !mWrapper->get(DefaultCug, value) );
+    QVERIFY(true == verify());
+}
+
+/*!
+  UT_SsSettingsWrapper::t_set
+ */
+void UT_SsSettingsWrapper::t_set()
+{
+    int value = 0;
+    expect("RSSSettings::Set").with(ESSSettingsCug, 0);
+    QVERIFY( !mWrapper->set(Cug, value) );
+    expect("RSSSettings::Set").with(ESSSettingsClir, 0);
+    QVERIFY( !mWrapper->set(Clir, value) );
+    expect("RSSSettings::Set").with(ESSSettingsAls, 0);
+    QVERIFY( !mWrapper->set(Als, value) );
+    expect("RSSSettings::Set").with(ESSSettingsAlsBlocking, 0);
+    QVERIFY( !mWrapper->set(AlsBlocking, value) );
+    expect("RSSSettings::Set").with(ESSSettingsDefaultCug, 0);
+    QVERIFY( !mWrapper->set(DefaultCug, value) );
+    QVERIFY(true == verify());
+}
+
+/*!
+  UT_SsSettingsWrapper::t_PhoneSettingChanged
+ */
+Q_DECLARE_METATYPE(SsSettingsWrapperSettings)
+void UT_SsSettingsWrapper::t_PhoneSettingChanged()
+{
+    qRegisterMetaType<SsSettingsWrapperSettings> ("SsSettingsWrapperSettings");
+    QSignalSpy spy(mWrapper, 
+            SIGNAL(phoneSettingChanged(SsSettingsWrapperSettings, int )));
+    
+    mWrapper->m_Priv->PhoneSettingChanged(ESSSettingsCug, 0);
+    
+    QCOMPARE(spy.count(), 1);
+    const QList<QVariant> &arguments = spy.at(0);
+    QVERIFY(Cug == arguments.at(0).value<SsSettingsWrapperSettings>());
+    QVERIFY(0 == arguments.at(1).value<int>());
+}
+
+QTEST_MAIN_S60(UT_SsSettingsWrapper)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/xqbindings/sssettingswrapper/tsrc/ut_sssettingswrapper/ut_sssettingswrapper.h	Wed Jul 21 18:26:52 2010 +0300
@@ -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:
+*
+*/
+
+#ifndef UT_SSSETTINGWRAPPER_H
+#define UT_SSSETTINGWRAPPER_H
+
+#include <QtTest/QtTest>
+#include <mockservice.h>
+
+class SsSettingsWrapper;
+
+class UT_SsSettingsWrapper : public QObject, MockService
+{
+    Q_OBJECT
+
+public:    
+    UT_SsSettingsWrapper();
+    ~UT_SsSettingsWrapper();
+    
+private slots:
+
+    void init();
+    void cleanup();
+    
+    void t_memleak();
+    void t_get();
+    void t_set();
+    
+    void t_PhoneSettingChanged();
+
+private:
+    SsSettingsWrapper *mWrapper;
+
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/sssettings/xqbindings/sssettingswrapper/tsrc/ut_sssettingswrapper/ut_sssettingswrapper.pro	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,46 @@
+#
+# 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 file for building unit test component
+#
+#
+
+CONFIG += qtestlib
+TEMPLATE = app
+TARGET = 
+DEPENDPATH += . ../../src/
+INCLUDEPATH += .
+DEFINES += BUILD_SSSETTINGSWRAPPER
+
+QT -= gui
+QT += testlib
+
+symbian: {
+  CONFIG += no_icon
+  INCLUDEPATH += /epoc32/include/mw/QtTest    \
+                 /epoc32/include/platform/mw  \
+                 /epoc32/include/mw/qt
+  LIBS += -lmocklib -lsymbianmock
+}
+
+# test code
+HEADERS += ut_sssettingswrapper.h
+SOURCES += ut_sssettingswrapper.cpp
+
+# code to be tested
+HEADERS += ../../../../../../phonesrv_plat/ss_settings_api/inc/sssettingswrapper.h
+SOURCES += ../../src/sssettingswrapper.cpp    \
+           ../../src/sssettingswrapper_p.cpp
+
+# mocks needed for testing
+SOURCES += ../mocks/mock_rsssettings.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/telephonysettings/bwins/phonesettingsu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,80 @@
+EXPORTS
+	??1CPsetCallBarring@@UAE@XZ @ 1 NONAME ; CPsetCallBarring::~CPsetCallBarring(void)
+	??1CPsetCallDiverting@@UAE@XZ @ 2 NONAME ; CPsetCallDiverting::~CPsetCallDiverting(void)
+	??1CPsetCallWaiting@@UAE@XZ @ 3 NONAME ; CPsetCallWaiting::~CPsetCallWaiting(void)
+	??1CPsetCli@@UAE@XZ @ 4 NONAME ; CPsetCli::~CPsetCli(void)
+	??1CPsetContainer@@UAE@XZ @ 5 NONAME ; CPsetContainer::~CPsetContainer(void)
+	??1CPsetCustomerServiceProfile@@UAE@XZ @ 6 NONAME ; CPsetCustomerServiceProfile::~CPsetCustomerServiceProfile(void)
+	??1CPsetNetwork@@UAE@XZ @ 7 NONAME ; CPsetNetwork::~CPsetNetwork(void)
+	??1CPsetSAObserver@@UAE@XZ @ 8 NONAME ; CPsetSAObserver::~CPsetSAObserver(void)
+	?CancelAll@CPsetCli@@UAEXXZ @ 9 NONAME ; void CPsetCli::CancelAll(void)
+	?CancelCurrentRequest@CPsetCallBarring@@UAEHXZ @ 10 NONAME ; int CPsetCallBarring::CancelCurrentRequest(void)
+	?CancelCurrentRequest@CPsetCallDiverting@@UAEHXZ @ 11 NONAME ; int CPsetCallDiverting::CancelCurrentRequest(void)
+	?CancelProcess@CPsetCallWaiting@@UAEHXZ @ 12 NONAME ; int CPsetCallWaiting::CancelProcess(void)
+	?CancelProcess@CPsetNetwork@@UAEXXZ @ 13 NONAME ; void CPsetNetwork::CancelProcess(void)
+	?ChangePasswordL@CPsetCallBarring@@QAEXAAVTMobilePhonePasswordChangeV2@RMobilePhone@@@Z @ 14 NONAME ; void CPsetCallBarring::ChangePasswordL(class RMobilePhone::TMobilePhonePasswordChangeV2 &)
+	?ChangePasswordL@CPsetCallBarring@@QAEXAAVTMobilePhonePasswordChangeV2@RMobilePhone@@H@Z @ 15 NONAME ; void CPsetCallBarring::ChangePasswordL(class RMobilePhone::TMobilePhonePasswordChangeV2 &, int)
+	?CreateCBObjectL@CPsetContainer@@QAEPAVCPsetCallBarring@@AAVMPsetBarringObserver@@@Z @ 16 NONAME ; class CPsetCallBarring * CPsetContainer::CreateCBObjectL(class MPsetBarringObserver &)
+	?CreateCFObjectL@CPsetContainer@@QAEPAVCPsetCallDiverting@@AAVMPsetDivertObserver@@@Z @ 17 NONAME ; class CPsetCallDiverting * CPsetContainer::CreateCFObjectL(class MPsetDivertObserver &)
+	?CreateCWObjectL@CPsetContainer@@QAEPAVCPsetCallWaiting@@AAVMPsetCallWaitingObserver@@@Z @ 18 NONAME ; class CPsetCallWaiting * CPsetContainer::CreateCWObjectL(class MPsetCallWaitingObserver &)
+	?CreateCliObjectL@CPsetContainer@@QAEPAVCPsetCli@@AAVMPsetCliObserver@@@Z @ 19 NONAME ; class CPsetCli * CPsetContainer::CreateCliObjectL(class MPsetCliObserver &)
+	?CreateNetworkModeObjectL@CPsetContainer@@QAEPAVCPsetNetwork@@AAVMPsetNetworkModeObserver@@@Z @ 20 NONAME ; class CPsetNetwork * CPsetContainer::CreateNetworkModeObjectL(class MPsetNetworkModeObserver &)
+	?CreateNetworkObjectL@CPsetContainer@@QAEPAVCPsetNetwork@@AAVMPsetNetworkInfoObserver@@@Z @ 21 NONAME ; class CPsetNetwork * CPsetContainer::CreateNetworkObjectL(class MPsetNetworkInfoObserver &)
+	?CreateRefreshHandlerL@CPsetContainer@@QAEPAVCPSetRefreshHandler@@XZ @ 22 NONAME ; class CPSetRefreshHandler * CPsetContainer::CreateRefreshHandlerL(void)
+	?GetAvailableNetworksL@CPsetNetwork@@UAEXXZ @ 23 NONAME ; void CPsetNetwork::GetAvailableNetworksL(void)
+	?GetBarringStatusL@CPsetCallBarring@@UAEXW4TServiceGroup@@W4TBarringProgram@@@Z @ 24 NONAME ; void CPsetCallBarring::GetBarringStatusL(enum TServiceGroup, enum TBarringProgram)
+	?GetCallWaitingStatusL@CPsetCallWaiting@@UAEXXZ @ 25 NONAME ; void CPsetCallWaiting::GetCallWaitingStatusL(void)
+	?GetClipModeL@CPsetCli@@UAEXXZ @ 26 NONAME ; void CPsetCli::GetClipModeL(void)
+	?GetClirModeL@CPsetCli@@UAEXXZ @ 27 NONAME ; void CPsetCli::GetClirModeL(void)
+	?GetCnapL@CPsetCli@@UAEXXZ @ 28 NONAME ; void CPsetCli::GetCnapL(void)
+	?GetColpModeL@CPsetCli@@UAEXXZ @ 29 NONAME ; void CPsetCli::GetColpModeL(void)
+	?GetColrModeL@CPsetCli@@UAEXXZ @ 30 NONAME ; void CPsetCli::GetColrModeL(void)
+	?GetCurrentDivertStatus@CPsetSAObserver@@QAEHAAW4TUnconditionalCFStatus@@@Z @ 31 NONAME ; int CPsetSAObserver::GetCurrentDivertStatus(enum TUnconditionalCFStatus &)
+	?GetCurrentNetworkInfo@CPsetNetwork@@UAEHAAUTCurrentNetworkInfo@MPsetNetworkSelect@@@Z @ 32 NONAME ; int CPsetNetwork::GetCurrentNetworkInfo(struct MPsetNetworkSelect::TCurrentNetworkInfo &)
+	?GetCurrentNetworkModeSelectionL@CPsetNetwork@@UAEXXZ @ 33 NONAME ; void CPsetNetwork::GetCurrentNetworkModeSelectionL(void)
+	?GetDefaultNumbersL@CPsetCallDiverting@@QAEHAAVCDesC16ArrayFlat@@@Z @ 34 NONAME ; int CPsetCallDiverting::GetDefaultNumbersL(class CDesC16ArrayFlat &)
+	?GetDivertingStatusL@CPsetCallDiverting@@UAEXW4TServiceGroup@@W4TCallDivertingCondition@@W4TBasicServiceGroups@@@Z @ 35 NONAME ; void CPsetCallDiverting::GetDivertingStatusL(enum TServiceGroup, enum TCallDivertingCondition, enum TBasicServiceGroups)
+	?GetNetworkSelectMode@CPsetNetwork@@UAEHAAW4TSelectMode@MPsetNetworkSelect@@@Z @ 36 NONAME ; int CPsetNetwork::GetNetworkSelectMode(enum MPsetNetworkSelect::TSelectMode &)
+	?GetTimerValueL@CPsetCallDiverting@@QAEHXZ @ 37 NONAME ; int CPsetCallDiverting::GetTimerValueL(void)
+	?GetUsedDataNumberLC@CPsetCallDiverting@@QAEPAVHBufC16@@XZ @ 38 NONAME ; class HBufC16 * CPsetCallDiverting::GetUsedDataNumberLC(void)
+	?GetUsedFaxNumberLC@CPsetCallDiverting@@QAEPAVHBufC16@@XZ @ 39 NONAME ; class HBufC16 * CPsetCallDiverting::GetUsedFaxNumberLC(void)
+	?IsALSSupported@CPsetCustomerServiceProfile@@QAEHAAH@Z @ 40 NONAME ; int CPsetCustomerServiceProfile::IsALSSupported(int &)
+	?IsCBSupported@CPsetCustomerServiceProfile@@QAEHAAH@Z @ 41 NONAME ; int CPsetCustomerServiceProfile::IsCBSupported(int &)
+	?IsCFSupported@CPsetCustomerServiceProfile@@QAEHAAH@Z @ 42 NONAME ; int CPsetCustomerServiceProfile::IsCFSupported(int &)
+	?IsCWSupported@CPsetCustomerServiceProfile@@QAEHAAH@Z @ 43 NONAME ; int CPsetCustomerServiceProfile::IsCWSupported(int &)
+	?IsCallActive@CPsetNetwork@@QAEHXZ @ 44 NONAME ; int CPsetNetwork::IsCallActive(void)
+	?IsCallActive@CPsetSAObserver@@QAEHXZ @ 45 NONAME ; int CPsetSAObserver::IsCallActive(void)
+	?IsGPRSConnected@CPsetNetwork@@QAEHXZ @ 46 NONAME ; int CPsetNetwork::IsGPRSConnected(void)
+	?IsGPRSConnected@CPsetSAObserver@@QAEHXZ @ 47 NONAME ; int CPsetSAObserver::IsGPRSConnected(void)
+	?IsNetworkSelectionSupported@CPsetCustomerServiceProfile@@QAEHAAH@Z @ 48 NONAME ; int CPsetCustomerServiceProfile::IsNetworkSelectionSupported(int &)
+	?NewL@CPsetCallDiverting@@SAPAV1@AAVMPsetDivertObserver@@AAVRMobilePhone@@@Z @ 49 NONAME ; class CPsetCallDiverting * CPsetCallDiverting::NewL(class MPsetDivertObserver &, class RMobilePhone &)
+	?NewL@CPsetCallWaiting@@SAPAV1@AAVRMobilePhone@@AAVMPsetCallWaitingObserver@@@Z @ 50 NONAME ; class CPsetCallWaiting * CPsetCallWaiting::NewL(class RMobilePhone &, class MPsetCallWaitingObserver &)
+	?NewL@CPsetCli@@SAPAV1@AAVRMobilePhone@@AAVMPsetCliObserver@@@Z @ 51 NONAME ; class CPsetCli * CPsetCli::NewL(class RMobilePhone &, class MPsetCliObserver &)
+	?NewL@CPsetContainer@@SAPAV1@XZ @ 52 NONAME ; class CPsetContainer * CPsetContainer::NewL(void)
+	?NewL@CPsetCustomerServiceProfile@@SAPAV1@XZ @ 53 NONAME ; class CPsetCustomerServiceProfile * CPsetCustomerServiceProfile::NewL(void)
+	?NewL@CPsetNetwork@@SAPAV1@AAVRMobilePhone@@AAVMPsetNetworkInfoObserver@@@Z @ 54 NONAME ; class CPsetNetwork * CPsetNetwork::NewL(class RMobilePhone &, class MPsetNetworkInfoObserver &)
+	?NewL@CPsetNetwork@@SAPAV1@AAVRMobilePhone@@AAVMPsetNetworkModeObserver@@@Z @ 55 NONAME ; class CPsetNetwork * CPsetNetwork::NewL(class RMobilePhone &, class MPsetNetworkModeObserver &)
+	?NewL@CPsetSAObserver@@SAPAV1@XZ @ 56 NONAME ; class CPsetSAObserver * CPsetSAObserver::NewL(void)
+	?NotifyDivertChange@CPsetSAObserver@@QAEXW4TSelectedLine@@AAVTCallDivertNotifySetting@@ABH@Z @ 57 NONAME ; void CPsetSAObserver::NotifyDivertChange(enum TSelectedLine, class TCallDivertNotifySetting &, int const &)
+	?OpenCSProfileL@CPsetCustomerServiceProfile@@QAEHXZ @ 58 NONAME ; int CPsetCustomerServiceProfile::OpenCSProfileL(void)
+	?ResetNetworkSearch@CPsetNetwork@@QAEHXZ @ 59 NONAME ; int CPsetNetwork::ResetNetworkSearch(void)
+	?SelectNetworkL@CPsetNetwork@@UAEXABUTNetworkInfo@MPsetNetworkSelect@@@Z @ 60 NONAME ; void CPsetNetwork::SelectNetworkL(struct MPsetNetworkSelect::TNetworkInfo const &)
+	?SetBarringL@CPsetCallBarring@@UAEXABVTCallBarringSetting@@W4TBasicServiceGroups@@@Z @ 61 NONAME ; void CPsetCallBarring::SetBarringL(class TCallBarringSetting const &, enum TBasicServiceGroups)
+	?SetCallWaitingL@CPsetCallWaiting@@UAEXW4TSetCallWaiting@MPsetCallWaiting@@W4TBasicServiceGroups@@@Z @ 62 NONAME ; void CPsetCallWaiting::SetCallWaitingL(enum MPsetCallWaiting::TSetCallWaiting, enum TBasicServiceGroups)
+	?SetDivertingL@CPsetCallDiverting@@UAEXABVTCallDivertSetting@@W4TBasicServiceGroups@@H@Z @ 63 NONAME ; void CPsetCallDiverting::SetDivertingL(class TCallDivertSetting const &, enum TBasicServiceGroups, int)
+	?SetNetObserver@CPsetSAObserver@@QAEXAAVMPsetNetworkInfoObserver@@@Z @ 64 NONAME ; void CPsetSAObserver::SetNetObserver(class MPsetNetworkInfoObserver &)
+	?SetNetSAObserver@CPsetNetwork@@QAEXAAVMPsetNetworkInfoObserver@@@Z @ 65 NONAME ; void CPsetNetwork::SetNetSAObserver(class MPsetNetworkInfoObserver &)
+	?SetNetworkModeObserver@CPsetNetwork@@QAEXAAVMPsetNetworkModeObserver@@@Z @ 66 NONAME ; void CPsetNetwork::SetNetworkModeObserver(class MPsetNetworkModeObserver &)
+	?SetNetworkModeSelectionL@CPsetNetwork@@UAEXAAK@Z @ 67 NONAME ; void CPsetNetwork::SetNetworkModeSelectionL(unsigned long &)
+	?SetNewDefaultNumberL@CPsetCallDiverting@@QAEHAAVTDes16@@@Z @ 68 NONAME ; int CPsetCallDiverting::SetNewDefaultNumberL(class TDes16 &)
+	?SetRequestObserver@CPsetCallBarring@@QAEXPAVMPsetRequestObserver@@@Z @ 69 NONAME ; void CPsetCallBarring::SetRequestObserver(class MPsetRequestObserver *)
+	?SetRequestObserver@CPsetCallDiverting@@QAEXPAVMPsetRequestObserver@@@Z @ 70 NONAME ; void CPsetCallDiverting::SetRequestObserver(class MPsetRequestObserver *)
+	?SetRequestObserver@CPsetCallWaiting@@QAEXPAVMPsetRequestObserver@@@Z @ 71 NONAME ; void CPsetCallWaiting::SetRequestObserver(class MPsetRequestObserver *)
+	?SetRequestObserver@CPsetCli@@QAEXPAVMPsetRequestObserver@@@Z @ 72 NONAME ; void CPsetCli::SetRequestObserver(class MPsetRequestObserver *)
+	?SetTimerValueL@CPsetCallDiverting@@QAEHABH@Z @ 73 NONAME ; int CPsetCallDiverting::SetTimerValueL(int const &)
+	?SetUsedDataNumberL@CPsetCallDiverting@@QAEHAAV?$TBuf@$0GE@@@@Z @ 74 NONAME ; int CPsetCallDiverting::SetUsedDataNumberL(class TBuf<100> &)
+	?SetUsedFaxNumberL@CPsetCallDiverting@@QAEHAAV?$TBuf@$0GE@@@@Z @ 75 NONAME ; int CPsetCallDiverting::SetUsedFaxNumberL(class TBuf<100> &)
+	?SwapDefaultNumberL@CPsetCallDiverting@@QAEXABH@Z @ 76 NONAME ; void CPsetCallDiverting::SwapDefaultNumberL(int const &)
+	?VideoMailQueryL@CPsetCallDiverting@@QAEXAAVTDes16@@@Z @ 77 NONAME ; void CPsetCallDiverting::VideoMailQueryL(class TDes16 &)
+	?VoiceMailQueryL@CPsetCallDiverting@@QAEXAAVTDes16@@@Z @ 78 NONAME ; void CPsetCallDiverting::VoiceMailQueryL(class TDes16 &)
+
Binary file cellular/telephonysettings/group/phonesettings_stub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/telephonysettings/inc/mcalldiverting.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Declaration of MCallDiverting interface class.
+*
+*/
+
+
+#ifndef     MCALLDIVERTING_H
+#define     MCALLDIVERTING_H
+
+/**
+ *  MCallDiverting class is virtual interface class for divert 
+ *  functionality.
+ *
+ *  @lib phonesettings
+ *  @since S60 v5.1
+ */
+class MCallDiverting
+    {
+    public:
+        /**
+         * Sets observer which informs when request is completed
+         */
+        virtual void SetRequestObserver( MPsetRequestObserver* aObs ) = 0;
+    
+        /**
+        * Sets diverting to the network.
+        * 
+        * @param aDivert New divert settings.
+        * @param aBsc List of basic service groups .
+        */
+        virtual void SetDivertingL( const TCallDivertSetting& aDivert,  
+                                    TBasicServiceGroups aBsc ) = 0;
+        /**
+        * Checks the diverting status from network.
+        * 
+        * @param aServiceGroup Service group indication.
+        * @param aCondition Diverting conditions.
+        * @param aBsc List of basic service groups.
+        */
+        virtual void GetDivertingStatusL( 
+                                    const TServiceGroup aServiceGroup, 
+                                    const TCallDivertingCondition aCondition, 
+                                    TBasicServiceGroups aBsc ) = 0;
+        /**
+        * Cancels current request.
+        * 
+        * @return Returns error code.
+        */
+        virtual TInt CancelCurrentRequest() = 0;
+        
+        /**
+        *  Reads used divert numbers (0-3) from central repository
+        *  and fills array with them.
+        *
+        *  @param aType used line.
+        *  @param aArray array of divert number.
+        *  @return amount of numbers.
+        */
+        virtual TInt GetNumbersFromSharedDataL( 
+                                    TInt aType, 
+                                    CDesC16ArrayFlat& aArray ) = 0;
+        /**
+        * Sets new default number the the default numbers list, 
+        * erases the oldest one.
+        * 
+        * @param aNumber phone number. 
+        * @return Returns error code.
+        */
+        virtual TInt SetNewDefaultNumberL( TDes& aNumber ) = 0;
+        
+        /**
+        *  Gets the default time for CF No Reply.
+        *  No error checking for return values which should be
+        *  5-30, in steps of 5.
+        *
+        * @return Returns the current timer value.
+        */
+        virtual TInt GetTimerValueL() = 0;
+        
+        /*
+        *  Sets the default time for CF No Reply.
+        *  No error checking to parameters, which should be on range 5-30,
+        *  using steps of 5.
+        *
+        *  @param aIndex New value for timer.
+        *  @return Returns error code.
+        */
+        virtual TInt SetTimerValueL( const TInt& aValue ) = 0;
+        
+        /**
+        * Swaps the most recently used number to first in shared data file.
+        *
+        * @param  aLocation Used number's location (1-3) in shared data.
+        */
+        virtual void SwapDefaultNumberL( const TInt& aLocation ) = 0;
+        
+        /**
+        * Saves a single value to central repository. Make sure that repository
+        * is open before calling this function.
+        */
+        virtual TInt SaveKey( TUint32 aKeyId, const TDesC& aKeyValue ) = 0;
+        
+        /*
+        * Virtual destructor. 
+        */ 
+        virtual ~MCallDiverting() {};
+    };
+
+#endif // MPCALLDIVERTING_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/telephonysettings/inc/mnetworkinfoobs.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 completions of network info and change requests.
+*
+*
+*/
+
+
+#ifndef     __MNETWORKINFOOBS_H
+#define     __MNETWORKINFOOBS_H
+
+//  INCLUDES
+#ifndef     __E32DEF_H__
+#include    <e32def.h>
+#endif
+
+#ifndef     __MNETWORKSELECT_H
+#include    "mnetworkselect.h" 
+#endif
+
+//  DATA TYPES  
+typedef CArrayFixFlat<MNetworkSelect::TNetworkInfo> CNetworkInfoArray;
+
+//  CLASS DEFINITIONS 
+
+class   MNetworkInfoObserver
+    {
+    public:            
+        virtual void HandleNetworkInfoReceivedL( const CNetworkInfoArray* aInfoArray, const TInt aResult)=0;
+        virtual void HandleCurrentNetworkInfoL( const MNetworkSelect::TCurrentNetworkInfo& aCurrentInfo, const TInt aResult)=0;
+        virtual void HandleNetworkChangedL( const MNetworkSelect::TNetworkInfo& aCurrentInfo, const MNetworkSelect::TCurrentNetworkStatus aStatus, const TInt aResult)=0;    
+    };
+
+#endif // __MNETWORKINFOOBS_H
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/telephonysettings/inc/psetcalldivertingbase.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,324 @@
+/*
+* 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:  Divert base class.
+*
+*/
+
+
+#ifndef CPSETCALLDIVERTINGBASE_H
+#define CPSETCALLDIVERTINGBASE_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <badesca.h>
+#include <mmretrieve.h>
+#include <ctsydomaincrkeys.h>
+#include "mcalldiverting.h" 
+#include "msssettingsobserver.h" 
+#include "nwdefs.h"             
+#include "psetconstants.h" 
+
+// CLASS DECLARATION
+class MPsetDivertObserver;
+
+/**
+ * CPSetCallDivertingBase is base class for different type of
+ * call divert implementations
+ *
+ *  @lib phonesettings
+ *  @since S60 v5.1
+ */
+NONSHARABLE_CLASS( CPSetCallDivertingBase ) : public CActive,
+                                              public MSSSettingsObserver,
+                                              public MCallDiverting
+    {
+    public: // Constructors and destructors.
+
+        /**
+        * Two-phased constructor.
+        *
+        * @return new instance of the class.
+        * @param aObserver Call divert observer.
+        * @param aPhone Provides client access to 
+        *               mobile phone functionality provided by TSY.
+        * @param aDivert provides access to CPsetCallDiverting.
+        * @return Created CPSetCallDivertingBase object.
+        */
+        static CPSetCallDivertingBase* NewL(
+                MPsetDivertObserver& aObserver, 
+                RMobilePhone& aPhone,
+                CPsetCallDiverting* aDivert );
+
+        /**
+        * Destructor.
+        */
+        ~CPSetCallDivertingBase();
+   
+    public: // From base class.
+        /**
+         * @see MCallDiverting.
+         */
+        void SetRequestObserver( MPsetRequestObserver* aObs );
+
+        /**
+        * @see MCallDiverting.
+        */ 
+        void SetDivertingL( const TCallDivertSetting& aDivert,  
+                            TBasicServiceGroups aBsc );        
+        
+        /**
+        * @see MCallDiverting.
+        */ 
+        void GetDivertingStatusL( const TServiceGroup aServiceGroup, 
+                                  const TCallDivertingCondition aCondition, 
+                                  TBasicServiceGroups aBsc );
+        /**
+        * @see MCallDiverting.
+        */ 
+        TInt CancelCurrentRequest();
+        
+        /**
+        * @see MCallDiverting.
+        */ 
+        TInt SetNewDefaultNumberL( TDes& aNumber );
+        
+        /**
+        * @see MCallDiverting.
+        */ 
+        TInt GetTimerValueL();
+        
+        /**
+        * @see MCallDiverting.
+        */ 
+        TInt SetTimerValueL( const TInt& aValue );
+        
+        /**
+        * @see MCallDiverting.
+        */ 
+        void SwapDefaultNumberL( const TInt& aLocation );
+        
+        /**
+        * @see MCallDiverting.
+        */ 
+        TInt SaveKey( TUint32 aKeyId, const TDesC& aKeyValue );
+        
+        /**
+        * @see MCallDiverting.
+        */
+        TInt GetNumbersFromSharedDataL( TInt aType, 
+                                CDesC16ArrayFlat& aArray );        
+    protected:
+        
+        /**
+        * Gets Als status.
+        * 
+        * @return used ALS line.
+        */
+        TSelectedLine GetSAAls();
+        
+        /** 
+        * Creates param list for NotifySADivertChange method.
+        */ 
+        TCallDivertNotifySetting CreateDivertNotifySetting( 
+                    TUnconditionalCFStatus aCurrentDivert, 
+                    TBool aDivertChanged,
+                    TBool aVoiceMbxDivert, 
+                    TInt aBasic );
+        
+        /**
+        * If unconditional voice divert is activated/cancelled, notifies observer, 
+        * so that it can set on/off indicators.
+        * 
+        * @param aVmbxDivert vmbx number.
+        * @param TDivertingStatus call forwarding status.
+        */
+        void HandleSANotificationL( TBool aVmbxDivert, TDivertingStatus& aCfStatus );
+        
+        /**
+        * Verifies whether the divert-to number is to voice mail box.
+        *
+        * @param aTelNumber divert number.
+        * @return ETrue if used number is vmbx number
+        *       otherwise EFalse.
+        */
+        TBool IsVMBXDivertL( TDesC& aTelNumber );       
+        
+        /**
+        * If divert activation/cancellation/etc. affects more than one bsc, 
+        * inform PSUI about it.
+        * 
+        * @param aDivert contains forwarding information.
+        * @param aBsc used basic service.
+        * @return ETrue if divert is multiaffecting
+        *       otherwise EFalse.
+        */
+        TBool IsMultiAffectingDivert( 
+                        const TCallDivertSetting& aDivert, 
+                        TBasicServiceGroups aBsc );
+        
+        /**
+        * Validates used bsc, if EUnknown, updates to real value.
+        * 
+        * @param aBsc used basic service.
+        */ 
+        void ValidateBsc( TBasicServiceGroups& aBsc );
+        
+        /**
+        * Currently active request that is handled by this class.
+        */ 
+        enum TPSetDivertRequest
+            {
+            EPSetNone, 
+            EPSetChangeDivert,
+            EPSetGetDivertStatus
+            };
+        
+        /**
+        * Starts new request.
+        * 
+        * @param aRequest defines request type.
+        */ 
+        void StartRequestingL( const TInt& aRequest );
+        
+        /**
+        * Inform request observer that request status has changed.
+        * 
+        * @param aStatus request type.
+        */
+        void SetRequestStatus( TPSetDivertRequest aStatus );
+        
+        /**
+        * Inform the request observer that request has been completed.
+        *
+        * @param aError request status.
+        */
+        void RequestCompleted( const TInt& aError );
+        
+    private:
+        
+        /**
+        * Push object into cleanupstack to catch leaving.
+        */
+        void CleanupLeavePushL();
+        
+        /**
+        * Object has caused a leave.
+        */
+        static void DoHandleLeave( TAny* aAny );
+        
+        /**
+        * Handles leave.
+        */
+        void HandleLeave();
+        
+        /**
+        * Verifies that delay time is divisible by five.
+        */ 
+        TBool VerifyDelayTime( const TInt& aDelayTime );
+        
+    protected:
+
+        /**
+        * C++ constructor.
+        */
+        CPSetCallDivertingBase( RMobilePhone& aPhone, CPsetCallDiverting* aDivert  );
+        /**
+        * Symbian OS constructor.
+        */
+        void ConstructL( MPsetDivertObserver& aObserver );
+       
+    private: //from base clases.
+
+        /**
+        * @see CActive::RunL().
+        */
+        void RunL();
+           
+        /**
+        * @see CActive::DoCancel().
+        */
+        void DoCancel();
+           
+        /**
+        * @see MSSSettingsObserver::PhoneSettingChanged().
+        */
+        void PhoneSettingChanged( TSSSettingsSetting aSetting, TInt aNewValue );
+        
+    protected:
+        
+        // Provides client access to mobile phone functionality provided by TSY.
+        RMobilePhone& iPhone;
+        
+        // Provides client access to mobile line functionality provided by TSY.
+        RMobileLine* iLine;
+        
+        // Observer for Call divert requests
+        MPsetDivertObserver* iObserver;
+       
+        // Call divert instance.
+        CPsetCallDiverting* iDivert;
+       
+        // Current, active request
+        TPSetDivertRequest iCurrentReq;
+       
+        // Value of Alternative Line Selection setting
+        TSSSettingsAlsValue iAls;
+       
+        // SsSettings pointer, accesses supplementary services on SIM
+        RSSSettings* iSsSettings;
+       
+        // Plural notes are shown when operations affect several groups.
+        TBool iPluralNotes;
+       
+        // Request observer
+        MPsetRequestObserver* iReqObserver;
+       
+        // Call forwarding reason.
+        RMobilePhone::TMobilePhoneCFCondition iReason;
+       
+        // Divert condition
+        RMobilePhone::TMobilePhoneCFInfoEntryV1 iDivertInfo;
+       
+        // Call divert settings
+        RMobilePhone::TMobilePhoneCFChangeV1 iChangeInfo;
+       
+        // Retrieves the Call Forwarding status list from the phone.
+        CRetrieveMobilePhoneCFList* iCfInterrogator;
+    
+        // Central repository.
+        CRepository* iRepository;
+    
+        // Status check.
+        TBool iCFStatusCheck;
+       
+        // Basic service code.
+        TInt iBsc;
+       
+        // Call forwarding settings.
+        TCallDivertSetting iDivertStatus;
+       
+        // Is request connected to video diverts.
+        TBool iVideoDivert;
+       
+        // Is request connected to voice diverts.
+        TBool iVoiceDivert;
+       
+        // Is feature manager intialized. 
+        TBool iFeatureManagerInitialized;
+    };
+
+
+#endif      // CPSETCALLDIVERTINGBASE_H 
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/telephonysettings/inc/psetcalldivertingbasicimpl.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,112 @@
+/*
+* 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:  Divert basic implementation.
+*
+*/
+
+
+#ifndef CPSETCALLDIVERTINGBASICIMPL_H
+#define CPSETCALLDIVERTINGBASICIMPL_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <psetcalldiverting.h> 
+#include <mmretrieve.h>
+#include <ctsydomaincrkeys.h>
+#include "msssettingsobserver.h" 
+#include "nwdefs.h"             
+#include "psetconstants.h" 
+#include "psetcalldivertingbase.h" 
+
+// CLASS DECLARATION
+class CPsetSAObserver;
+class CDesC16ArrayFlat;
+class RSSSettings;
+class MPsetDivertObserver;
+class MPsetRequestObserver;
+class RVmbxNumber;
+class CRepository;
+class TCallDivertNotifySetting;
+
+/**
+ * CPSetCallDivertingBasicImpl implements basic divert funcationality.
+ *
+ *  @lib phonesettings
+ *  @since S60 v5.1
+ */
+NONSHARABLE_CLASS(CPSetCallDivertingBasicImpl) : public CPSetCallDivertingBase
+    {
+    public: // Constructors and destructors.
+
+        /**
+        * Two-phased constructor.
+        *
+        * @return new instance of the class.
+        */
+        static CPSetCallDivertingBasicImpl* NewL(
+                MPsetDivertObserver& aObserver, 
+                RMobilePhone& aPhone,
+                CPsetCallDiverting* aDivert );
+
+        /**
+        * Destructor.
+        */
+        ~CPSetCallDivertingBasicImpl();
+
+    public: // From base class.
+        
+        /**
+        * @see MCallDiverting.
+        */ 
+        void SetDivertingL( const TCallDivertSetting& aDivert,  
+                            TBasicServiceGroups aBsc );        
+
+    public: //from base class CActive
+
+        void RunL();
+        
+        void DoCancel();
+        
+        TInt RunError( TInt aError );
+            
+    protected:
+        
+        /**
+        * C++ constructor.
+        */
+        CPSetCallDivertingBasicImpl( RMobilePhone& aPhone, CPsetCallDiverting* aDivert );
+
+        /**
+        * Symbian OS constructor.
+        */
+        void ConstructL( MPsetDivertObserver& aObserver );
+    
+    private:
+        
+        void HandleSANotificationL( 
+            TBool aVmbxDivert, TDivertingStatus& aCfStatus );
+        
+        TBool SetVoiceDivert( const TCallDivertSetting& aDivert,
+            const TBasicServiceGroups aBsc );
+        
+        TSelectedLine GetSAAls();
+        
+    private:
+        // Memorize requested service group
+        TServiceGroup iRequestedServiceGroup;
+    };
+
+#endif      // CPSETCALLDIVERTINGBASICIMPL_H 
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/telephonysettings/inc/psetcalldivertingcreator.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* 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:  Factory for creating divert specific components.
+*
+*/
+
+
+#ifndef CSETCALLDIVERTINGCREATOR_H
+#define CSETCALLDIVERTINGCREATOR_H
+
+//  INCLUDES
+#include    <e32base.h>
+#include    <badesca.h>
+#include    <etelmm.h>
+#include    <nwdefs.h>
+#include    "mpsetdivertobs.h" 
+#include    "mcalldiverting.h" 
+
+/**
+*  Factory class for creating divert related classes.
+*
+*  @lib PhoneSettings
+*  @since 5.1
+*/
+NONSHARABLE_CLASS( CPSetCallDivertingCreator ): public CBase
+    {
+    public:
+        static MCallDiverting* CreateCallDivertingL( 
+                                            MPsetDivertObserver& aObserver, 
+                                            RMobilePhone& aPhone,
+                                            CPsetCallDiverting* aDivert );
+    private:
+        
+        /**
+        * Check if KTelephonyLVFlagDualActivation is active.
+        */
+        static TBool IsDivertDualAffectFeatureEnabledL();
+    };
+
+#endif      // CSETCALLDIVERTINGCREATOR_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/telephonysettings/inc/psetcalldivertingdualaffectimpl.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,122 @@
+/*
+* 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:  Divert dual activation.
+*
+*/
+
+
+#ifndef CPSETCALLDIVERTINGDUALAFFECTIMPL_H
+#define CPSETCALLDIVERTINGDUALAFFECTIMPL_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <psetcalldiverting.h> 
+#include <mmretrieve.h>
+#include <ctsydomaincrkeys.h>
+#include "msssettingsobserver.h" 
+#include "nwdefs.h"             
+#include "psetconstants.h" 
+#include "psetcalldivertingbase.h" 
+
+// CLASS DECLARATION
+class CPsetSAObserver;
+class CDesC16ArrayFlat;
+class RSSSettings;
+class MPsetDivertObserver;
+class MPsetRequestObserver;
+class RVmbxNumber;
+class CRepository;
+class TCallDivertNotifySetting;
+class MCallDiverting;
+class CPSetSubscriberIdCheck;
+
+/**
+ * CPSetCallDivertingDualAffectImpl implements divert functionality which assumes
+ * that network makes always dual activation if device gives param EAllTeleAndBearer
+ * and used SIM supports feature.
+ *
+ *  @lib phonesettings
+ *  @since S60 v5.1
+ */
+NONSHARABLE_CLASS(CPSetCallDivertingDualAffectImpl) : public CPSetCallDivertingBase
+    {
+    public: // Constructors and destructors.
+
+        /**
+        * Two-phased constructor.
+        *
+        * @return new instance of the class.
+        */
+        static CPSetCallDivertingDualAffectImpl* NewL(
+                MPsetDivertObserver& aObserver, 
+                RMobilePhone& aPhone,
+                CPsetCallDiverting* aDivert );
+
+        /**
+        * Destructor.
+        */
+        ~CPSetCallDivertingDualAffectImpl();
+
+    public: // From base class.
+
+        /**
+        * @see MCallDiverting.
+        */ 
+        void SetDivertingL( const TCallDivertSetting& aDivert,  
+                            TBasicServiceGroups aBsc );
+        
+    public: //from base class CActive
+
+        void RunL();
+        
+        void DoCancel();
+        
+        TInt RunError( TInt aError );
+            
+    protected:
+        
+        /**
+        * C++ constructor.
+        */
+        CPSetCallDivertingDualAffectImpl( RMobilePhone& aPhone, CPsetCallDiverting* aDivert );
+
+        /**
+        * Symbian OS constructor.
+        */
+        void ConstructL( MPsetDivertObserver& aObserver );
+        
+    private:
+        
+        void HandleSANotificationL( 
+                TBool aVmbxDivert, 
+                TDivertingStatus& aCfStatus );
+        
+        void SetCurrentDivertInformation( 
+                TUnconditionalCFStatus& aStatus, 
+                const TBool aDivertChanged );
+        
+        TBool SetVoiceDivert( 
+                const TCallDivertSetting& aDivert,
+                const TBasicServiceGroups /*aBsc*/ );
+        
+        TSelectedLine GetSAAls();
+        
+    private:
+        
+        CPSetSubscriberIdCheck* iIdCheck;
+    };
+
+#endif      // CPSETCALLDIVERTINGDUALAFFECTIMPL_H 
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/telephonysettings/inc/psetpanic.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 function for Phone Settings
+*
+*
+*/
+
+
+//Different panic causes.
+enum TPSetPanic {
+    ECBPanicNoBscSet, 
+    ECBBasicServiceNotReturned,
+    ECBUnknownRequest,
+    ECBUnknownBarringSetting,
+    ECBNoObserver,
+
+    ECDNewDefaultNumberNull, 
+    ECDPanicNoBscSet, 
+    ECDRequestPanicNoObserver, 
+    ECDRequestPanicIncorrectRequest,
+
+    ECWPanicNoObserver,
+    ECWPanicNoPhone,
+    ECWBasicServiceNotReturned,
+    ECWPanicInvalidRequestMode,
+    ECWPanicNoBscSet,
+
+    ECliParameter,
+    ECliGeneral,
+    ECliNoObserver,
+    ECliOperationFailed,
+
+    ENetSelectPanicNullPointer,
+    ENetNoObserver,
+    ENetUnknownRequest,
+    ENetError,
+    ENetMemberVariableAlreadyCreated,
+    ENetNoNetworkObserver
+    };
+
+//  Local Function Prototypes  
+static void Panic( const TDesC& aClassName, TPSetPanic aPanic );
+
+//  LOCAL FUNCTIONS
+static void Panic( const TDesC& aClassName, TPSetPanic aPanic )
+    {
+    User::Panic( aClassName, aPanic );
+    }
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/telephonysettings/inc/psetrefreshhandlerimpl.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,131 @@
+/*
+* 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:  The Refresh handler to inform refresses.
+*
+*/
+
+
+
+#ifndef CPSETREFRESHHANDLERIMPL_H
+#define CPSETREFRESHHANDLERIMPL_H
+
+
+//  INCLUDES
+#include <psetrefreshhandler.h> 
+#include <msatrefreshobserver.h>
+
+
+// FORWARD DECLARATIONS
+class CPsetCustomerServiceProfile;
+class CSSSettingsRefreshContainer;
+class MSSSettingsRefreshHandler;
+
+
+// CLASS DECLARATION
+
+/**
+*  The Refresh handler to inform refresses.
+*
+*  @lib PhoneSettings.lib
+*  @since 2.8
+*/
+class CPSetRefreshHandlerImpl :
+    public CPSetRefreshHandler,
+    public MSSSettingsRefreshObserver
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CPSetRefreshHandlerImpl* NewL();
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CPSetRefreshHandlerImpl();
+
+
+    public: // Functions from base classes
+
+        /**
+        * @see CPSetRefreshHandler::NotifyFileChangeL.
+        */
+        void NotifyFileChangeL(
+            MSSSettingsRefreshObserver& aObserver,
+            TSatElementaryFiles aObservedFiles,
+            TSatRefreshType aObservedRefreshType );
+
+        /**
+        * @see CPSetRefreshHandler::CancelNotify.
+        */
+        void CancelNotify();
+
+        /**
+        * @see CPSetRefreshHandler::ChangedCspSettings.
+        */
+        TInt ChangedCspSettings( 
+            TPSetChangedCspSetting& aChangedCspSettings,
+            TPSetChangedCspSetting& aNewValues );
+
+
+    public: // Functions from base classes
+
+        /**
+        * @see MSSSettingsRefreshObserver::AllowRefresh
+        */
+        TBool AllowRefresh(
+            const TSatRefreshType aType,
+            const TSatElementaryFiles aFiles );
+
+        /**
+        * @see MSSSettingsRefreshObserver::Refresh
+        */
+        void Refresh(
+            const TSatRefreshType aType,
+            const TSatElementaryFiles aFiles );
+
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CPSetRefreshHandlerImpl();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+
+    private:    // Data
+         
+        // The Csp handler.
+        CPsetCustomerServiceProfile*    iCsp;
+
+        // The SSSettings refresh handler container.
+        CSSSettingsRefreshContainer*    iSSSetRefContainer;
+
+        // The SSSettings refresh handler.
+        MSSSettingsRefreshHandler*      iSSSetRefHandler;
+
+        // The observer for refresses
+        MSSSettingsRefreshObserver*     iObserver;
+
+    };
+
+#endif      // CPSETREFRESHHANDLERIMPL_H 
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/telephonysettings/inc/psetsubscriberidcheck.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Declaration of CPSetSubscriberIdCheck class.
+*
+*/
+
+
+#ifndef CPSETSIMCHECK_H
+#define CPSETSIMCHECK_H
+
+//  INCLUDES
+#include    <e32base.h>
+#include    <etelmm.h>
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+ * Class is used for checking SIM imsi.
+ *
+ *  @lib phonesettings
+ *  @since S60 v5.1
+ */
+NONSHARABLE_CLASS( CPSetSubscriberIdCheck ): public CBase
+    {
+    public:
+        
+        /**
+        * Symbian OS 2-phase Constructor.
+        * @return Created CPSetSIMCheck object.
+        */
+        static CPSetSubscriberIdCheck* NewL();
+               
+        /* 
+        * Destructor.
+        */
+        ~CPSetSubscriberIdCheck();
+        
+    public:
+    
+       TBool DoesSIMSupportDualActivation();
+    
+    private: // constructors
+       
+        /**
+        * Default constructor
+        */
+        CPSetSubscriberIdCheck();
+        
+    private:
+        
+        RMobilePhone::TMobilePhoneSubscriberId iImsi;
+    };
+
+#endif      // CPSETSIMCHECK_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/telephonysettings/inc/psettelephony.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,126 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 to ETEL.
+*
+*
+*/
+
+
+#ifndef     PSETTELEPHONY_H
+#define     PSETTELEPHONY_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "nwdefs.h"
+
+//  CONSTANTS  
+const TInt KPsetMaxNameLength = 50;
+
+//  FORWARD DECLARATIONS
+class RTelServer;
+class RMobilePhone;
+class RMobileLine;
+
+//  CLASS DEFINITIONS 
+/**
+*  CPsetTelephony class is used to connect phone settings to ETEL.
+*  @lib phonesettings.lib
+*  @since 1.0
+*/
+class   CPsetTelephony : public CBase
+    {
+
+    public:        
+
+        /**
+        * Symbian OS 2-phase constructor.
+        *
+        * @param aPhone Phone object.
+        * @param aTsyName TSY module name.
+        * @return Created CPsetTelephony object.
+        */
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        static CPsetTelephony* NewL( RMobilePhone& aPhone, 
+            const TDesC* aTsyName = NULL );
+        
+        /* Destructor */
+        ~CPsetTelephony();
+
+    public: // new functions
+         
+        /**
+        * Checks that correct line for diverting is open. If not, lines
+        * are gone through and when one with correct capabilities is found,
+        * it is opened.
+        *
+        * @param aServiceGroup Service group for which line is checked.
+        * @param aPhone Phone object.
+        * @param aLine Line to check.
+        */
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        static void CheckLineModeL( const TServiceGroup aServiceGroup, 
+            RMobilePhone* aPhone, RMobileLine* aLine );
+
+    private:    // constructors
+
+        //2nd phase constructor.
+        void ConstructL( const TDesC* aTsyName );
+
+        //C++ constructor.
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        CPsetTelephony ( RMobilePhone& aPhone );
+
+    private: // new
+
+        //Makes a ETEL connection.
+        TInt ConnectToEtelL( const TDesC* aTsyName );
+
+        //Sets caps.
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        static TUint32 SetCapFlagsL( const TServiceGroup aServiceGroup, TBool& aMode,
+            RLine::TCaps& aCaps );
+
+    private: //member data
+
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        // ETEL server
+        RTelServer*              iTelServer;
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        // TSY Phone
+        RMobilePhone*            iPhone;
+        // Connection to ETEL has been made by this module.
+        TBool                    iOwnConnection;
+        // Name of the TSY module
+        TBuf<KPsetMaxNameLength> iTsyName;
+    };
+#endif //PSETTELEPHONY_H
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/telephonysettings/inc/psetutility.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,99 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 tool class to change between ETEL and GSM codes.
+*
+*/
+
+
+#ifndef PSETUTILITY_H
+#define PSETUTILITY_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <nwdefs.h>
+#include <etelmm.h>
+
+// CLASS DECLARATION
+/**
+*  Class is used to translate between ETEL internal basic service codes and
+*  basic service codes defined in the GSM standard. Class is also used to 
+*  convert multimode Etel parameters to existing parameter types.
+*
+*  @lib phonesettings.dll
+*  @since 2.0
+*/
+class PSetUtility
+    {
+    public: // New functions
+        
+        /**
+        * ChangeToEtelInternal maps GSM bsc codes to ETEL equivalents.
+        * @param aBsc Basic service code as in GSM standard.
+        * @return Basic service code as defined inside Etel.
+        */
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        static RMobilePhone::TMobileService ChangeToEtelInternal( 
+            const TBasicServiceGroups& aBsc );
+
+        /**
+        * ChangeToGSM maps ETEL bsc codes to GSM equivalents.
+        * @param aBsc Basic service code as defined inside Etel.
+        * @return Basic service code as in GSM standard.
+        */
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        static TBasicServiceGroups ChangeToGSM( 
+            const RMobilePhone::TMobileService& aBsc );
+        /**
+        * GetChangeInfoStatus maps multimode ETel parameter to
+        * PhoneSettings internal parameter type. This is to ensure
+        * binary compatibility of dependent modules.
+        * @param aAction divert action type.
+        * @return TDivertingStatus divert action type
+        */
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/        
+        static TDivertingStatus GetChangeInfoStatus( 
+            RMobilePhone::TMobilePhoneServiceAction& aAction );
+
+        /**
+        * GetDivertReason maps multimode ETel parameter to
+        * PhoneSettings internal parameter type. This is to ensure
+        * binary compatibility of dependent modules.
+        * @param aCondition divert condition.
+        * @return TCallDivertingCondition divert condition
+        */
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        static RMobilePhone::TMobilePhoneCFCondition 
+            GetDivertReason( TCallDivertingCondition aCondition );
+
+        static TCallDivertingCondition
+            GetDivertReason( RMobilePhone::TMobilePhoneCFCondition aCondition );
+
+        static RMobilePhone::TMobileService VerifyAltLineUseL();
+    };
+    
+#endif      // PSETUTILITY_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/telephonysettings/inc/psetvariationproxy.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,89 @@
+/*
+* 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:  
+*       CPsetVariationProxy class is proxy class for 
+*       central repository variation
+*       (Call waiting/distinguish between not provisioned and not activated).
+*  
+*
+*/
+
+
+#ifndef PSETVARIATIONPROXY_H
+#define PSETVARIATIONPROXY_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CRepository;
+
+// CONSTANTS
+const TUint KCallWaitingDistiquishNotProvisioned = 0x00000001;
+
+// CLASS DECLARATION
+/**
+*  CPsetVariationProxy class is proxy class for central repository variation
+*  @lib phonesettings.lib
+*  @since 1.0
+*/
+NONSHARABLE_CLASS (CPSetVariationProxy): public CBase 
+    {
+    public: //constructor & destructor
+    
+        /* 
+        * Symbian OS 2-phase Constructor. 
+        * 
+        * @param aUid identifing the central repository UID.
+        * @param aId central repository ID.
+        * @return the created instance.
+        */
+        static CPSetVariationProxy* NewL( const TUid& aUid, 
+                                          const TUint aId );
+        
+        /* Destructor */
+        ~CPSetVariationProxy();
+        
+    public:
+        
+        /**
+        * Check from member variable 'iFeature' is the requested feature active.
+        *
+        * @param aFeature is uid for used central repository variable.
+        * @return returns TBool type ETrue/EFalse is current feature enabled or not
+        */
+        TBool IsFeatureEnabled( TUint aFeature ) const;
+        
+    private:
+        
+        /**
+        * Constructor
+        *
+        * Open CenRep, read data into 'iFeatures' and close CenRep 
+        */
+        void ConstructL( const TUid& aUid, const TUint aId );   
+        
+    private:
+        
+        /* Default constructor */
+        CPSetVariationProxy();
+        
+    private:
+        
+        // Saves cen rep data readed in ConstructL()
+        TInt iFeature;
+    };
+
+#endif      // PSETVARIATIONPROXY_H
+ 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/telephonysettings/logger/phonesettingslogger.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,73 @@
+/*
+* 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: 
+*       Macro definition file for logging.
+*
+*
+*/
+
+
+
+#ifndef PHONESETTINGSLOGGER_H
+#define PHONESETTINGSLOGGER_H
+
+#include "phonesettingsloggingconf.h" 
+#include <e32std.h>
+#include <flogger.h>
+#include <e32svr.h>
+
+_LIT( KLogsDir,                  "PHS");
+_LIT( KLogFileName,              "PHS.log");
+
+/*
+ We have 3 possible logging methods:
+
+ set PHS_LOGGING_METHOD to 0 to get no logging at all
+ set PHS_LOGGING_METHOD to 1 to get logging via RDebug::Print
+ set PHS_LOGGING_METHOD to 2 to get logging to log file
+
+ Switching on/off is done in the Configuration file (PhoneSettingsLoggingConf.h)
+ */
+
+#if ( defined (_PHSLOGGING) )
+    #if ( defined (_PHS_LOGGING_TO_FILE))
+        #define PHS_LOGGING_METHOD 2 
+    #else
+        #define PHS_LOGGING_METHOD 1
+    #endif
+#else
+    #define PHS_LOGGING_METHOD 0
+#endif
+
+
+#if (PHS_LOGGING_METHOD==0)
+    #define __PHSLOGSTRING(C)
+    #define __PHSLOGSTRING1(C, X)
+    #define __PHSLOGSTRING2(C, X, Y)
+    #define __PHSLOGSTRING3(C, X, Y, Z)
+#endif
+#if (PHS_LOGGING_METHOD==1)
+    #define __PHSLOGSTRING(C)            RDebug::Print(_L(C));
+    #define __PHSLOGSTRING1(C, X)        RDebug::Print(_L(C),X);
+    #define __PHSLOGSTRING2(C, X, Y)     RDebug::Print(_L(C),X, Y);
+    #define __PHSLOGSTRING3(C, X, Y, Z)  RDebug::Print(_L(C),X, Y, Z);
+#endif
+#if (PHS_LOGGING_METHOD==2)
+    #define __PHSLOGSTRING(C)            {_LIT(tempLogDes,C);RFileLogger::WriteFormat(KLogsDir(),KLogFileName(), EFileLoggingModeAppend, tempLogDes());}
+    #define __PHSLOGSTRING1(C, X)        {_LIT(tempLogDes,C);RFileLogger::WriteFormat(KLogsDir(),KLogFileName(), EFileLoggingModeAppend, TRefByValue<const TDesC>(tempLogDes()),X);}
+    #define __PHSLOGSTRING2(C, X, Y)     {_LIT(tempLogDes,C);RFileLogger::WriteFormat(KLogsDir(),KLogFileName(), EFileLoggingModeAppend, TRefByValue<const TDesC>(tempLogDes()),X,Y);}
+    #define __PHSLOGSTRING3(C, X, Y, Z)  {_LIT(tempLogDes,C);RFileLogger::WriteFormat(KLogsDir(),KLogFileName(), EFileLoggingModeAppend, TRefByValue<const TDesC>(tempLogDes()),X,Y,Z);}
+#endif
+
+#endif // PHONESETTINGSLOGGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/telephonysettings/logger/phonesettingsloggingconf.h	Wed Jul 21 18:26:52 2010 +0300
@@ -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: 
+*        Macro definition file for logging configuration.
+*       (Note:This file has to be separate from the logging header file 
+*             to be able to include it in mmp file. If not we will get warning about not used 
+*             flogger.lib in other logging cases where flogger.lib is not used.)
+*
+*/
+
+
+
+#ifndef PHONESCONFIGURATION_H
+#define PHONESCONFIGURATION_H
+
+
+#ifdef _DEBUG // logging to file in debug only
+
+/**
+* - Have this line active if you want to have logging for this component
+* - Comment this line out if you don't want any logging for this component
+*/
+#define _PHSLOGGING
+
+/**
+* - Have this line active if you want to have logging to file
+* - Comment this line out if you want to have logging via RDebug::Print 
+*/
+#define _PHS_LOGGING_TO_FILE
+
+#endif // _DEBUG
+
+#endif // PHONESCONFIGURATION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/telephonysettings/rom/phonesettings.iby	Wed Jul 21 18:26:52 2010 +0300
@@ -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:  IBY file
+ *
+*/
+
+#ifndef __PHONESETTINGS_IBY__
+#define __PHONESETTINGS_IBY__
+
+// Network Settings Engine Library
+file=ABI_DIR\BUILD_DIR\phonesettings.dll        SHARED_LIB_DIR\phonesettings.dll
+
+data=ZSYSTEM\install\phonesettings_stub.sis     System\Install\phonesettings_stub.sis
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/telephonysettings/src/psetcallbarring.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,702 @@
+/*
+* 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:  Call barring class. Sets and gets call barring setting.
+*
+*
+*/
+
+
+//  Include Files
+#include <etelmm.h>
+#include <rsssettings.h> 
+#include "mpsetrequestobs.h" 
+#include "psetcallbarring.h" 
+#include "psettelephony.h" 
+#include "psetpanic.h" 
+#include "psetconstants.h" 
+#include "psetutility.h" 
+#include "phonesettingslogger.h" 
+
+// CONSTANTS    
+_LIT( KPSNameOfClass, "CPsetCallBarring" );
+
+//  MEMBER FUNCTIONS
+//=============================================================================
+// ---------------------------------------------------------------------------
+// 
+// 1st phase constructor.
+// 
+// ---------------------------------------------------------------------------
+//
+CPsetCallBarring* CPsetCallBarring::NewL( MPsetBarringObserver& aObserver, 
+                  RMobilePhone& aPhone ) 
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetCallBarring::NewL");
+    CPsetCallBarring* self = new( ELeave ) CPsetCallBarring( aPhone );
+
+    CleanupStack::PushL( self );
+    self->ConstructL( aObserver );
+    CleanupStack::Pop();
+
+    __PHSLOGSTRING("[PHS] <--CPsetCallBarring::NewL");
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// 2nd phase constructor.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetCallBarring::ConstructL( MPsetBarringObserver& aObserver )
+    {
+    /*****************************************************
+    *    Series 60 Customer / ETel
+    *    Series 60  ETel API
+    *****************************************************/
+    __PHSLOGSTRING("[PHS]--> CPsetCallBarring::ConstructL");
+    iLine = new ( ELeave ) RMobileLine;
+    this->SetObserver( aObserver );
+    CActiveScheduler::Add( this );
+    
+    //Check which line is used, or if ALS is not active.
+    TInt usedLine = ESSSettingsAlsNotSupported;
+
+    iSsSettings = new (ELeave) RSSSettings;
+    User::LeaveIfError( iSsSettings->Open() );
+    TRAPD( err, iSsSettings->Register( ESSSettingsAls, *this ) );
+    if ( err == KErrNone )
+        {
+        iSsSettings->Get( ESSSettingsAls, usedLine );
+        }
+
+    iAls = static_cast <TSSSettingsAlsValue> ( usedLine );
+    
+    __PHSLOGSTRING("[PHS] <--CPsetCallBarring::ConstructL");
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor.
+// Closes line subsession.
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPsetCallBarring::~CPsetCallBarring()
+    {
+    Cancel();
+    if ( iLine )
+        {
+        iLine->Close();    
+        }
+    delete iLine;
+    
+    if ( iSsSettings )
+        {
+        iSsSettings->Cancel( ESSSettingsAls, *this ); 
+        iSsSettings->Close();
+        }
+    delete iSsSettings;
+    
+    iReqObserver = NULL;
+        
+    delete iCbStatusInterrogator;
+    iCbStatusInterrogator = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// If SsSettings notifies of settings change, copy new value to member variable.
+// 
+// ---------------------------------------------------------------------------
+void CPsetCallBarring::PhoneSettingChanged( 
+    TSSSettingsSetting aSetting, TInt aNewValue )
+    {
+    if ( aSetting == ESSSettingsAls )
+        {
+        iAls = static_cast <TSSSettingsAlsValue> (aNewValue);
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Validates used bsc, if EUnknown, updates to real value
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetCallBarring::ValidateBsc( TBasicServiceGroups& aBsc )
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetCallBarring::ValidateBsc" );
+    if ( aBsc == EUnknown )
+    // if bsc is unknown, update it
+        {
+        if ( iAls == ESSSettingsAlsAlternate )
+            {
+            aBsc = EAltTele;
+            }
+        else
+            {
+            aBsc = ETelephony;
+            }
+        }    
+    else
+    // If no specific line is indicated
+        {
+        if ( aBsc == EAllTeleAndBearer || aBsc == EAllTele )
+            {
+            // if ALS is used, use 89 bsc
+            if ( iAls == ESSSettingsAlsAlternate )
+                {
+                aBsc = EAltTele;
+                }
+            }
+        }
+    __PHSLOGSTRING("[PHS] <--CPsetCallBarring::ValidateBsc" );
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Sets barring setting on network.
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPsetCallBarring::SetBarringL( 
+    const TCallBarringSetting& aBarring, TBasicServiceGroups aBsc )
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetCallBarring::SetBarringL");
+    if ( IsActive() )
+        {
+        User::Leave( KErrInUse );
+        }
+
+    __PHSLOGSTRING1("[PHS]    SetBarringL: Barring Group: %d", aBarring.iServiceGroup);
+    //Opens the correct basic service group->contradicting custom tsy.
+    CPsetTelephony::CheckLineModeL( aBarring.iServiceGroup, &iPhone, iLine );
+
+    // Copy received information to member and local variables.
+    // Note if alternate line selected then iServiceGroup changes in iBarringParameters 
+    // and iChangeSetting iSericeGroup has old information.
+    iChangeSetting = aBarring;
+
+    __PHSLOGSTRING1("[PHS]    SetBarringL: Password: %S", &aBarring.iPassword);
+    __PHSLOGSTRING1("[PHS]    SetBarringL: Settings: %d", aBarring.iSetting);
+
+    ValidateBsc( aBsc );
+    
+    if ( aBsc == EAltTele )
+        {
+        iBarringParameters.iServiceGroup = PSetUtility::VerifyAltLineUseL();
+        }
+                
+    iBarringParameters.iPassword = aBarring.iPassword;
+    iBarringParameters.iAction = SetBarringAction( aBarring.iSetting );
+    iBarringParameters.iServiceGroup = PSetUtility::ChangeToEtelInternal( aBsc );
+        
+    __PHSLOGSTRING1("[PHS]    SetBarringL: Program: %d", aBarring.iType);
+
+    // Start to request barring change.
+    iPhone.SetCallBarringStatus( 
+        iStatus, 
+        SetBarringProgram( aBarring.iType ), 
+        iBarringParameters );
+
+    StartRequestingL( EPSetRequestChangeBarring );
+    __PHSLOGSTRING("[PHS] <--CPsetCallBarring::SetBarringL");
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Gets barring status from network. 
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPsetCallBarring::GetBarringStatusL( const TServiceGroup aGroup, 
+    const TBarringProgram aMode )
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetCallBarring::GetBarringStatusL");
+    if ( IsActive() )
+        {
+        User::Leave( KErrInUse );
+        }
+
+    __PHSLOGSTRING1("[PHS]    GetBarringStatusL: Barring Group: %d", aGroup);
+    __PHSLOGSTRING1("[PHS]    GetBarringStatusL: Program: %d", aMode);
+
+    CPsetTelephony::CheckLineModeL( aGroup, &iPhone, iLine );
+
+    // Start to request for barring status.
+    iCbStatusInterrogator = CRetrieveMobilePhoneCBList::NewL( iPhone );
+    iCbStatusInterrogator->Start( iStatus, SetBarringProgram( aMode ) );
+
+    StartRequestingL( EPSetRequestGetStatus );
+    __PHSLOGSTRING("[PHS] <--CPsetCallBarring::GetBarringStatusL");
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Cancels current request pending on requester. Return Values: TInt error code 
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CPsetCallBarring::CancelCurrentRequest()
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetCallBarring::CancelCurrentRequest");
+    // Set PSUI so that correct observer is used and hide requesting note.
+    // When interrupting a note, does *not leave*.
+    // This needs to be done first, since notes must be cleared from screen
+    // even though request is not active.
+    iObserver->SetEngineContact( this );
+    // Does not leave
+    TRAPD( err, iObserver->HandleCBRequestingL( EFalse, ETrue ) );
+        
+    if ( !IsActive() || err != KErrNone )
+        {
+        return KErrGeneral;
+        }
+    
+    // Request has been already sent to network before this cancel method 
+    // will be called. Calling DoCancel in this phase causes that e.g. "Barring 
+    // activated" note is not shown to user even barring has been set active. 
+    // Cancel can be done only to EPSetRequestGetStatus. It does not cause
+    // any harm if status is not shown to user when quit is pressed. 
+    if ( iCurrentReq == EPSetRequestGetStatus )
+        {
+        Cancel();
+        }
+    __PHSLOGSTRING("[PHS] <--CPsetCallBarring::CancelCurrentRequest");
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// C++ constructor.
+// 
+// ---------------------------------------------------------------------------
+//
+CPsetCallBarring::CPsetCallBarring
+                ( RMobilePhone& aPhone ) : CActive( EPriorityStandard ),
+                                           iPhone ( aPhone )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Returns correct type of barring program.
+// 
+// ---------------------------------------------------------------------------
+//
+RMobilePhone::TMobilePhoneCBCondition CPsetCallBarring::SetBarringProgram( 
+    TBarringProgram aMode )
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetCallBarring::SetBarringProgram");
+    __PHSLOGSTRING1("[PHS]    SetBarringProgram: Program: %d", aMode);
+    /*****************************************************
+    *    Series 60 Customer / ETel
+    *    Series 60  ETel API
+    *****************************************************/
+    RMobilePhone::TMobilePhoneCBCondition barringType = 
+        RMobilePhone::EBarUnspecified;
+    switch ( aMode )
+        {
+        case EBarringTypeAllOutgoingServices:
+            barringType = RMobilePhone::EBarAllOutgoingServices;
+            break;
+        case EBarringTypeAllIncomingServices:
+            barringType = RMobilePhone::EBarAllIncomingServices;
+            break;           
+        case EBarringTypeAllServices:
+        case EBarringTypeAllBarrings:
+            barringType = RMobilePhone::EBarAllCases;
+            break;
+        case EBarringTypeAllOutgoing:
+            barringType = RMobilePhone::EBarAllOutgoing;
+            break;
+        case EBarringTypeOutgoingInternational:
+            barringType = RMobilePhone::EBarOutgoingInternational;
+            break;
+        case EBarringTypeOutgoingInternationalExceptToHomeCountry:
+            barringType = RMobilePhone::EBarOutgoingInternationalExHC;
+            break;
+        case EBarringTypeAllIncoming:
+            barringType = RMobilePhone::EBarAllIncoming;
+            break;
+        case EBarringTypeIncomingWhenRoaming:
+            barringType = RMobilePhone::EBarIncomingRoaming;
+            break;
+        default:
+            Panic( KPSNameOfClass, ECBUnknownBarringSetting );
+            break;
+        }
+
+    __PHSLOGSTRING("[PHS] <--CPsetCallBarring::SetBarringProgram");
+    return barringType;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Changes both barring and common passwords.
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPsetCallBarring::ChangePasswordL( 
+    RMobilePhone::TMobilePhonePasswordChangeV2& aPwds, TBool aIsBarringPw )
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetCallBarring::ChangePasswordL");
+    if ( IsActive() )
+        {
+        User::Leave( KErrInUse );
+        }
+    
+    RMobilePhone::TMobilePhonePasswordChangeV2Pckg pwdPckg ( aPwds );
+
+    if ( aIsBarringPw )
+        {
+        iPhone.SetSSPassword( iStatus, pwdPckg, KPsetBarringService );
+        SetRequestStatus( EPSetRequestChangeBarringPwd );
+        }
+    else
+        {
+        iPhone.SetSSPassword( iStatus, pwdPckg, KPsetAllSSServices );
+        SetRequestStatus( EPSetRequestChangeCommonPwd );
+        }
+
+    StartRequestingL( KPsetRequestAlreadySet );
+    __PHSLOGSTRING("[PHS] <--CPsetCallBarring::ChangePasswordL");
+    }
+// ---------------------------------------------------------------------------
+// 
+// Verify and change barring password.
+// DEPRECATED - calls the correct API
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPsetCallBarring::ChangePasswordL( 
+    RMobilePhone::TMobilePhonePasswordChangeV2& aPwds )
+    {
+    ChangePasswordL( aPwds, ETrue );
+    }
+
+// ---------------------------------------------------------------------------
+// Sets request observer.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPsetCallBarring::SetRequestObserver( MPsetRequestObserver* aObs )
+    {
+    iReqObserver = aObs;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Sets observer member variable.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetCallBarring::SetObserver( MPsetBarringObserver& aObserver )
+    {
+    iObserver = &aObserver;    
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Starts requesting
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetCallBarring::StartRequestingL( const TInt& aRequest )
+    {
+    if ( aRequest != KPsetRequestAlreadySet )
+        {
+        SetRequestStatus( static_cast <TPSetBarringRequest> ( aRequest ) );
+        }
+
+    SetActive();
+
+    iObserver->SetEngineContact( this );
+
+    CleanupLeavePushL();    
+    iObserver->HandleCBRequestingL( ETrue, EFalse );
+    CleanupStack::Pop(); // CleanupCancelPushL
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Returns ETrue, if plural notes hould be shown.
+// 
+// ---------------------------------------------------------------------------
+//
+TBool CPsetCallBarring::GetPlurality()
+    {
+    if ( iChangeSetting.iSetting == ECancelBarring && 
+        ( iChangeSetting.iType == EBarringTypeAllBarrings || 
+          iChangeSetting.iType == EBarringTypeAllIncomingServices || 
+          iChangeSetting.iType == EBarringTypeAllOutgoingServices ||
+          iChangeSetting.iType == EBarringTypeAllServices ) )
+        {
+        return ETrue;
+        }
+
+    else
+        {
+        return EFalse;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Push object into cleanupstack to catch leaving.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetCallBarring::CleanupLeavePushL()
+      {
+      CleanupStack::PushL( TCleanupItem( DoHandleLeave, this ) );
+      }
+
+// ---------------------------------------------------------------------------
+// 
+// Object has caused a leave.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetCallBarring::DoHandleLeave( TAny* aAny )
+      {
+      REINTERPRET_CAST( CPsetCallBarring*, aAny )->HandleLeave();
+      }
+
+// ---------------------------------------------------------------------------
+// 
+// Things to do when leave occurs.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetCallBarring::HandleLeave()
+    {
+    CancelCurrentRequest();
+    }
+
+// ---------------------------------------------------------------------------
+// Inform the request observer that request has been completed.
+// ---------------------------------------------------------------------------
+//
+void CPsetCallBarring::RequestCompleted( const TInt& aError )
+    {
+    if ( aError != KErrNone )
+        {
+        SetRequestStatus( static_cast <TPSetBarringRequest> (aError) );
+        }    
+    ClearParams();
+
+    if ( iReqObserver )
+        {
+        iReqObserver->RequestComplete(); 
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Empties member variables.
+// ---------------------------------------------------------------------------
+//
+void CPsetCallBarring::ClearParams()
+    {
+    SetRequestStatus( EPSetRequestNone );
+    iBarringParameters.iServiceGroup = RMobilePhone::EServiceUnspecified;
+    iBarringParameters.iAction = RMobilePhone::EServiceActionUnspecified;
+    iBarringParameters.iPassword = KNullDesC;
+    }
+
+// ---------------------------------------------------------------------------
+// Return barring action.
+// ---------------------------------------------------------------------------
+//
+RMobilePhone::TMobilePhoneServiceAction CPsetCallBarring::SetBarringAction( 
+    const TBarringSetting& aSetting )
+    {
+    if ( aSetting == ECancelBarring )
+        {
+    /*****************************************************
+    *    Series 60 Customer / ETel
+    *    Series 60  ETel API
+    *****************************************************/
+        return RMobilePhone::EServiceActionDeactivate;
+        }
+    else
+        {
+        return RMobilePhone::EServiceActionActivate;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handles inquiry results.
+// ---------------------------------------------------------------------------
+//
+void CPsetCallBarring::HandleInquiryResultL()
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetCallBarring::HandleInquiryResultL");
+    TUint8 arrayOfBsc[KPSetNumberOfBsc];
+    arrayOfBsc[0] = KPSetUnusedValue;
+
+    CMobilePhoneCBList* cbStatusList = iCbStatusInterrogator->RetrieveListL();
+    CleanupStack::PushL( cbStatusList );
+    TBarringStatus status = EBarringStatusInactive;
+    /*****************************************************
+    *    Series 60 Customer / ETel
+    *    Series 60  ETel API
+    *****************************************************/
+    RMobilePhone::TMobilePhoneCBInfoEntryV1 cbInfo;
+    TInt entries = cbStatusList->Enumerate();
+    __PHSLOGSTRING1("[PHS]    HandleInquiryResultL: Entry count: %d", entries);
+    TInt i(0); 
+    TInt cbArray(0);
+    // If alternate line in use then only als line service information is shown.
+    if ( iAls == ESSSettingsAlsAlternate )
+        {
+        while ( entries > i )
+            {
+            cbInfo = cbStatusList->GetEntryL( i );
+
+            if ( cbInfo.iStatus == RMobilePhone::ECallBarringStatusActive && cbInfo.iServiceGroup == RMobilePhone::EAuxVoiceService )
+                {
+                 __PHSLOGSTRING1("[PHS]    ALS: iServiceGroup: %d", cbInfo.iServiceGroup);
+                status = EBarringStatusActive;
+                arrayOfBsc[cbArray] = static_cast <TUint8> 
+                    ( PSetUtility::ChangeToGSM( cbInfo.iServiceGroup ) );
+                cbArray++;
+                }
+            i++;                                                                
+            }   
+        }
+    else    // All other services than alternate line service is allowed to show when primary line is active.
+        {
+        while ( entries > i )
+            {
+            cbInfo = cbStatusList->GetEntryL( i );
+
+            if ( cbInfo.iStatus == RMobilePhone::ECallBarringStatusActive && cbInfo.iServiceGroup != RMobilePhone::EAuxVoiceService )
+                {
+                __PHSLOGSTRING1("[PHS]  iServiceGroup: %d", cbInfo.iServiceGroup);
+                status = EBarringStatusActive;             
+                arrayOfBsc[cbArray] = static_cast <TUint8> 
+                    ( PSetUtility::ChangeToGSM( cbInfo.iServiceGroup ) );
+                cbArray++; 
+                }
+            i++;                       
+            }
+        }
+        
+    arrayOfBsc[cbArray] = KPSetUnusedValue;
+    CleanupStack::PopAndDestroy( cbStatusList );
+    iObserver->HandleBarringModeStatusL( arrayOfBsc, status );    
+    __PHSLOGSTRING("[PHS] <--CPsetCallBarring::HandleInquiryResultL");
+    }
+
+// ---------------------------------------------------------------------------
+// Update the request status - both internally and to observers.
+// ---------------------------------------------------------------------------
+//
+void CPsetCallBarring::SetRequestStatus( TPSetBarringRequest aStatus )
+    {
+    iCurrentReq = aStatus;
+    if ( iReqObserver )
+        {
+        iReqObserver->RequestStatusChanged( aStatus );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Cancels pending request.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetCallBarring::DoCancel()
+    {    
+    switch ( iCurrentReq )
+        {
+        case EPSetRequestChangeBarring:
+            iPhone.CancelAsyncRequest( 
+                EMobilePhoneSetCallBarringStatus );
+            break;
+        case EPSetRequestGetStatus:
+            iCbStatusInterrogator->Cancel();
+            delete iCbStatusInterrogator;
+            iCbStatusInterrogator = NULL;
+            break;
+        case EPSetRequestChangeBarringPwd:
+        case EPSetRequestChangeCommonPwd:
+            iPhone.CancelAsyncRequest( EMobilePhoneSetSSPassword );
+            break;
+        default:
+            break;
+        }
+    ClearParams();    
+    }
+
+
+// ---------------------------------------------------------------------------
+// 
+// Handles completed request. If error occured, calls error handling
+//    function of the observer, otherwise does nothing.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetCallBarring::RunL()
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetCallBarring::RunL");
+    __ASSERT_ALWAYS( iObserver != NULL, 
+        Panic( KPSNameOfClass, ECBNoObserver ) );
+
+    //Hide requesting note - does not leave when deleting a note.
+    iObserver->SetEngineContact( this );
+    iObserver->HandleCBRequestingL( EFalse, EFalse );
+
+    //Error situations
+    if ( iStatus != KErrNone )
+        {
+        iObserver->HandleBarringErrorL( iStatus.Int() );
+        RequestCompleted( iStatus.Int() );      
+        return;
+        }
+  
+    switch ( iCurrentReq )
+        {
+        case EPSetRequestChangeBarring:
+            {
+            __PHSLOGSTRING("[PHS]     EPSetRequestChangeBarring");
+            TBarringStatus status = ( TBarringStatus ) iChangeSetting.iSetting;
+            TBool plural = GetPlurality();
+            __PHSLOGSTRING1("[PHS]    Barring status: %d", status );
+            __PHSLOGSTRING1("[PHS]    Plurality: %d", plural );
+            iObserver->HandleBarringModeChangedL( iChangeSetting.iType, 
+                                                  status, plural );
+            break;
+            }            
+        case EPSetRequestGetStatus:
+            {
+            __PHSLOGSTRING("[PHS]     EPSetRequestGetStatus");
+            HandleInquiryResultL();
+            break;
+            }
+        case EPSetRequestChangeBarringPwd:
+        case EPSetRequestChangeCommonPwd:
+            __PHSLOGSTRING("[PHS]     EPSetRequestChange");
+            iObserver->CbPasswordChangedL( ETrue );
+            break;
+        default:
+            Panic ( KPSNameOfClass, ECBUnknownRequest );
+            break;
+        }
+    RequestCompleted( KErrNone );
+    __PHSLOGSTRING("[PHS] <--CPsetCallBarring::RunL");
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/telephonysettings/src/psetcalldiverting.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,296 @@
+/*
+* 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:  Call diverting class. Sets and gets call diverting status. 
+*
+*
+*/
+
+
+//  Include Files
+#include <etelmm.h>           
+#include <e32math.h>
+#include <e32svr.h>
+#include <badesca.h>
+#include <centralrepository.h>
+#include <settingsinternalcrkeys.h> 
+
+#include "psetcalldiverting.h" 
+#include "psetcontainer.h" 
+#include "mpsetdivertobs.h" 
+#include "psettelephony.h" 
+#include "psetpanic.h" 
+#include "phonesettingslogger.h" 
+
+#include "psetcalldivertingcreator.h" 
+#include "mcalldiverting.h" 
+
+//  MEMBER FUNCTIONS
+// ---------------------------------------------------------------------------
+// First phase constructor
+// ---------------------------------------------------------------------------       
+EXPORT_C CPsetCallDiverting* CPsetCallDiverting::NewL( MPsetDivertObserver& aObserver,
+                  RMobilePhone& aPhone )
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetCallDiverting::NewL");
+    CPsetCallDiverting* self = new ( ELeave ) CPsetCallDiverting( aPhone );
+    CleanupStack::PushL( self );
+    self->ConstructL( aObserver );
+    CleanupStack::Pop( self );
+    __PHSLOGSTRING("[PHS] <--CPsetCallDiverting::NewL");
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor.
+// ---------------------------------------------------------------------------
+EXPORT_C CPsetCallDiverting::~CPsetCallDiverting()
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetCallDiverting::~CPsetCallDiverting");
+    iReqObserver = NULL;
+
+    delete iRepository;
+    
+    delete iDivert;
+    iDivert = NULL;
+    __PHSLOGSTRING("[PHS]<-- CPsetCallDiverting::~CPsetCallDiverting");
+    } 
+
+// ---------------------------------------------------------------------------
+// Symbian OS constructor
+// ---------------------------------------------------------------------------
+void CPsetCallDiverting::ConstructL( MPsetDivertObserver& aObserver )
+    {
+    __PHSLOGSTRING("[PHS] -->CPsetCallDiverting::ConstructL" );
+    iDivert= CPSetCallDivertingCreator::CreateCallDivertingL( aObserver, iPhone, this );
+    iRepository = CRepository::NewL( KCRUidCallForwarding );
+    __PHSLOGSTRING("[PHS] <--CPsetCallDiverting::ConstructL" );
+    }
+
+// ---------------------------------------------------------------------------
+// C++ constructor
+// ---------------------------------------------------------------------------
+//
+CPsetCallDiverting::CPsetCallDiverting( RMobilePhone& aPhone ) :
+                    iPhone ( aPhone )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Sets diverting. 
+// ---------------------------------------------------------------------------
+EXPORT_C void CPsetCallDiverting::SetDivertingL( 
+    const TCallDivertSetting& aDivert, 
+    TBasicServiceGroups aBsc, TBool /*aVmbx*/ )
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetCallDiverting::SetDivertingL");    
+    __PHSLOGSTRING1("[PHS]    CPsetCallDiverting::SetDivertingL: aDivert.iCondition: %d", aDivert.iCondition );
+    __PHSLOGSTRING1("[PHS]    CPsetCallDiverting::SetDivertingL: aDivert.iStatus: %d", aDivert.iStatus );
+    __PHSLOGSTRING1("[PHS]    CPsetCallDiverting::SetDivertingL: aDivert.iServiceGroup: %d", aDivert.iServiceGroup );
+    iDivert->SetDivertingL( aDivert, aBsc );
+    __PHSLOGSTRING("[PHS] <--CPsetCallDiverting::SetDivertingL" );
+    }
+
+// --------------------------------------------------------------------------- 
+// Request diverting status from network asynhronously.
+// ---------------------------------------------------------------------------
+EXPORT_C void CPsetCallDiverting::GetDivertingStatusL( 
+    const TServiceGroup aServiceGroup,
+    const TCallDivertingCondition aCondition, 
+    TBasicServiceGroups aBsc ) 
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetCallDiverting::GetDivertingStatusL" );
+    __PHSLOGSTRING1("[PHS]    CPsetCallDiverting::GetDivertingStatusL: aServiceGroup: %d", aServiceGroup );
+    __PHSLOGSTRING1("[PHS]    CPsetCallDiverting::GetDivertingStatusL: aCondition: %d", aCondition );
+    __PHSLOGSTRING1("[PHS]    CPsetCallDiverting::GetDivertingStatusL: aBsc: %d", aBsc );
+    iDivert->GetDivertingStatusL( aServiceGroup, aCondition, aBsc );
+    __PHSLOGSTRING("[PHS] <--CPsetCallDiverting::GetDivertingStatusL" );
+    }
+
+// ---------------------------------------------------------------------------
+// Cancels pending request.
+// ---------------------------------------------------------------------------
+EXPORT_C TInt CPsetCallDiverting::CancelCurrentRequest()
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetCallDiverting::CancelCurrentRequest" );
+    TInt err(KErrNone);
+    err = iDivert->CancelCurrentRequest();
+    __PHSLOGSTRING("[PHS] <--CPsetCallDiverting::CancelCurrentRequest" );
+    return err; 
+    }
+
+// ---------------------------------------------------------------------------
+// The default (last forwarded-to) numbers can be retrieved through this method.
+// The amount of available numbers is returned.
+// Relies on default numbers having right order in shared data.
+// ---------------------------------------------------------------------------
+EXPORT_C TInt CPsetCallDiverting::GetDefaultNumbersL( 
+    CDesC16ArrayFlat& aDefNumbers )
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetCallDiverting::GetDefaultNumbersL" );
+    return iDivert->GetNumbersFromSharedDataL( NULL, aDefNumbers );
+    }
+
+// ---------------------------------------------------------------------------
+// Sets new default number the the default numbers list, erases the oldest one.
+// ---------------------------------------------------------------------------
+EXPORT_C TInt CPsetCallDiverting::SetNewDefaultNumberL( TDes& aNumber )
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetCallDiverting::SetNewDefaultNumberL" );
+    TInt retValue(KErrNone);
+    retValue = iDivert->SetNewDefaultNumberL( aNumber );
+    __PHSLOGSTRING("[PHS] <--CPsetCallDiverting::SetNewDefaultNumberL" );
+    return retValue; //return value is not used
+    }
+
+// ---------------------------------------------------------------------------
+// Gets the timer value index related to "cfnry" from shared data
+// In error cases, return default value (30).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CPsetCallDiverting::GetTimerValueL()
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetCallDiverting::GetTimerValueL" );
+    TInt timerValue(0);
+    timerValue = iDivert->GetTimerValueL();
+    __PHSLOGSTRING("[PHS] <--CPsetCallDiverting::GetTimerValueL" );
+    return timerValue;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets the default time for "divert when not answered" to .ini file
+// ---------------------------------------------------------------------------
+EXPORT_C TInt CPsetCallDiverting::SetTimerValueL( const TInt& aValue )
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetCallDiverting::SetTimerValueL" );
+    TInt retValue(KErrNone);
+    retValue = iDivert->SetTimerValueL( aValue );
+    __PHSLOGSTRING1("[PHS] <--CPsetCallDiverting::SetTimerValueL: retValue: %d", retValue );
+    return retValue; 
+    }
+
+// ---------------------------------------------------------------------------
+// Swaps the most recently used number to first in the shared data file.
+// ---------------------------------------------------------------------------
+EXPORT_C void CPsetCallDiverting::SwapDefaultNumberL( const TInt& aLocation )
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetCallDiverting::SwapDefaultNumberL" );
+    iDivert->SwapDefaultNumberL( aLocation );
+    __PHSLOGSTRING("[PHS] <--CPsetCallDiverting::SwapDefaultNumberL" );
+    }
+
+// ---------------------------------------------------------------------------
+// Saves fax call diverting number to shareddata.
+// ---------------------------------------------------------------------------
+EXPORT_C TInt CPsetCallDiverting::SetUsedDataNumberL(  TTelNumber& aNumber ) 
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetCallDiverting::SetUsedDataNumberL" );
+    TInt retValue = KErrNone;
+    retValue = iDivert->SaveKey( KSettingsCFUsedDataNumber, aNumber );
+    __PHSLOGSTRING1("[PHS]    CPsetCallDiverting::SetUsedDataNumberL: aNumber: %S", &aNumber );
+    __PHSLOGSTRING1("[PHS]    CPsetCallDiverting::SetUsedDataNumberL: retValue: %d", retValue );
+    __PHSLOGSTRING("[PHS] <--CPsetCallDiverting::SetUsedDataNumberL" );
+    return retValue;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns used number for data call forwardings.
+// ---------------------------------------------------------------------------
+EXPORT_C HBufC* CPsetCallDiverting::GetUsedDataNumberLC( ) 
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetCallDiverting::GetUsedDataNumberLC" );
+    TTelNumber readNumber;
+
+    iRepository->Get( KSettingsCFUsedDataNumber, readNumber );
+
+    __PHSLOGSTRING1("[PHS]    CPsetCallDiverting::GetUsedDataNumberLC: readNumber: %S", &readNumber );
+    __PHSLOGSTRING("[PHS] <--CPsetCallDiverting::GetUsedDataNumberLC" );
+    
+    return readNumber.AllocLC();
+    }
+
+// ---------------------------------------------------------------------------
+// Saves fax call diverting number to shareddata.
+// ---------------------------------------------------------------------------
+EXPORT_C TInt CPsetCallDiverting::SetUsedFaxNumberL(  TTelNumber& aNumber ) 
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetCallDiverting::SetUsedFaxNumberL" );
+    TInt retValue = KErrNone;
+
+    retValue =  iDivert->SaveKey( KSettingsCFUsedFaxNumber, aNumber );
+
+    __PHSLOGSTRING1("[PHS]    CPsetCallDiverting::SetUsedFaxNumberL: aNumber: %S", &aNumber );
+    __PHSLOGSTRING1("[PHS]    CPsetCallDiverting::SetUsedFaxNumberL: retValue: %d", retValue );
+    __PHSLOGSTRING("[PHS] <--CPsetCallDiverting::SetUsedFaxNumberL" );
+
+    return retValue;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns used number for fax call forwardings.
+// ---------------------------------------------------------------------------
+EXPORT_C HBufC* CPsetCallDiverting::GetUsedFaxNumberLC() 
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetCallDiverting::GetUsedFaxNumberLC" );
+    TTelNumber readNumber;
+
+    iRepository->Get( KSettingsCFUsedFaxNumber, readNumber );
+
+    __PHSLOGSTRING1("[PHS]    CPsetCallDiverting::GetUsedFaxNumberLC: readNumber: %S", &readNumber );
+    __PHSLOGSTRING("[PHS] <--CPsetCallDiverting::GetUsedFaxNumberLC" );
+
+    return readNumber.AllocLC();
+    }
+
+// ---------------------------------------------------------------------------
+// Sets request observer.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPsetCallDiverting::SetRequestObserver( MPsetRequestObserver* aObs )
+    {
+    iReqObserver = aObs;
+    iDivert->SetRequestObserver(aObs);
+    }
+
+// ---------------------------------------------------------------------------
+// Queries for voice mail box number
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPsetCallDiverting::VoiceMailQueryL( TDes& /*aTelNumber*/ )
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetCallDiverting::VoiceMailQueryL" );
+
+    __PHSLOGSTRING("[PHS] <--CPsetCallDiverting::VoiceMailQueryL" );
+    }
+
+// ---------------------------------------------------------------------------
+// Queries for voice mail box number
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPsetCallDiverting::VideoMailQueryL( TDes& /*aTelNumber*/ )
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetCallDiverting::VideoMailQueryL" );
+
+    __PHSLOGSTRING("[PHS] <--CPsetCallDiverting::VideoMailQueryL" );
+    }    
+    
+// ---------------------------------------------------------------------------
+// Opens Vmbx. Leaves vmbx to the stack. 
+// ---------------------------------------------------------------------------
+//
+TInt CPsetCallDiverting::OpenVideoMailboxLC( TDes& /*aTelNumber*/, RVmbxNumber& /*aVmbx*/ )
+    {
+    return 0;
+    }
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/telephonysettings/src/psetcalldivertingbase.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,843 @@
+/*
+* 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 CPSetCallDivertingBase class.
+*
+*/
+
+
+// INCLUDE FILES
+#include "psetcalldivertingbasicimpl.h" 
+
+#include <badesca.h>
+#include <etelmm.h>           
+#include <e32math.h>
+#include <e32svr.h>
+#include <featmgr.h>
+#include <centralrepository.h>
+#include <settingsinternalcrkeys.h> 
+
+#include "psetcalldiverting.h" 
+#include "psetcontainer.h" 
+#include "mpsetdivertobs.h" 
+#include "psettelephony.h" 
+#include "psetpanic.h" 
+#include "mpsetrequestobs.h" 
+#include "psetutility.h" 
+#include "phonesettingslogger.h" 
+#include "psetsaobserver.h" 
+#include "psetcalldivertingbase.h" 
+
+//  LOCAL CONSTANTS AND MACROS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPSetCallDivertingBase::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPSetCallDivertingBase* CPSetCallDivertingBase::NewL( 
+        MPsetDivertObserver& aObserver, 
+        RMobilePhone& aPhone,
+        CPsetCallDiverting* aDivert )
+    {
+    CPSetCallDivertingBase* self = new ( ELeave ) CPSetCallDivertingBase( aPhone, aDivert );
+    CleanupStack::PushL( self );
+    self->ConstructL( aObserver );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPSetCallDivertingBase::~CPSetCallDivertingBase
+// ---------------------------------------------------------------------------
+//
+CPSetCallDivertingBase::~CPSetCallDivertingBase()
+    {
+    __PHSLOGSTRING("[PHS]--> CPSetCallDivertingBase::~CPSetCallDivertingBase");
+    Cancel();
+
+    if ( iLine )
+        {
+        iLine->Close();
+        }
+    delete iLine;   
+
+    if ( iSsSettings )
+        {
+        iSsSettings->Cancel( ESSSettingsAls, *this ); 
+        iSsSettings->Close();
+        }
+    delete iSsSettings;
+    delete iCfInterrogator;
+
+    iReqObserver = NULL;
+
+    delete iRepository;
+    
+    if ( iFeatureManagerInitialized )
+        {
+        FeatureManager::UnInitializeLib();
+        }
+
+    __PHSLOGSTRING("[PHS]<-- CPSetCallDivertingBase::~CPSetCallDivertingBase");
+    }
+
+// -----------------------------------------------------------------------------
+// CPSetCallDivertingBase::CPSetCallDivertingBase
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPSetCallDivertingBase::CPSetCallDivertingBase( RMobilePhone& aPhone,  CPsetCallDiverting* aDivert  ) : 
+                    CActive ( EPriorityStandard ),
+                    iPhone ( aPhone ),
+                    iDivert( aDivert )
+    {
+    __PHSLOGSTRING("[PHS]--> CPSetCallDivertingBase::CPSetCallDivertingBase");
+    iFeatureManagerInitialized = EFalse;
+    __PHSLOGSTRING("[PHS]<-- CPSetCallDivertingBase::CPSetCallDivertingBase");
+    }
+
+// -----------------------------------------------------------------------------
+// CPSetCallDivertingBase::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CPSetCallDivertingBase::ConstructL( MPsetDivertObserver& aObserver )
+    {
+    __PHSLOGSTRING("[PHS]--> CPSetCallDivertingBase::ConstructL" );
+    iLine = new ( ELeave ) RMobileLine;
+
+    //Copy received information to member variable.
+    iObserver = &aObserver;
+    
+    CActiveScheduler::Add( this );
+
+    //Check which line is used, or if ALS is not active.
+    TInt usedLine = ESSSettingsAlsNotSupported;
+
+    iSsSettings = new (ELeave) RSSSettings;
+    User::LeaveIfError( iSsSettings->Open() );
+    TRAPD( err, iSsSettings->Register( ESSSettingsAls, *this ) );
+    if ( err == KErrNone )
+        {
+        iSsSettings->Get( ESSSettingsAls, usedLine );
+        }
+
+    iAls = static_cast <TSSSettingsAlsValue> ( usedLine );
+    __PHSLOGSTRING1("[PHS]    CPSetCallDivertingBase::ConstructL: usedLine: %d", usedLine );
+
+    iRepository = CRepository::NewL( KCRUidCallForwarding );
+
+    // Sets up TLS, must be done before FeatureManager is used.
+    FeatureManager::InitializeLibL();
+    iFeatureManagerInitialized = ETrue;
+    
+    __PHSLOGSTRING("[PHS] <--CPSetCallDivertingBase::ConstructL" );
+    }
+
+// ---------------------------------------------------------------------------
+// RunL
+// ---------------------------------------------------------------------------
+//
+void CPSetCallDivertingBase::RunL()
+    {
+    // Empty implementation.
+    }
+       
+// ---------------------------------------------------------------------------
+// DoCancel
+// ---------------------------------------------------------------------------
+//
+void CPSetCallDivertingBase::DoCancel()
+    {
+    // Empty implementation.
+    }
+
+// ---------------------------------------------------------------------------
+// SetRequestObserver
+// ---------------------------------------------------------------------------
+//
+void CPSetCallDivertingBase::SetRequestObserver( MPsetRequestObserver* aObs )
+    {
+    iReqObserver = aObs;
+    }
+
+// ---------------------------------------------------------------------------
+// SetDivertingL
+// ---------------------------------------------------------------------------
+//
+void CPSetCallDivertingBase::SetDivertingL( const TCallDivertSetting& /*aDivert*/,  
+                            TBasicServiceGroups /*aBsc*/ )
+    {
+    //Empty implementation.
+    }
+
+// ---------------------------------------------------------------------------
+// CancelCurrentRequest
+// ---------------------------------------------------------------------------
+//
+TInt CPSetCallDivertingBase::CancelCurrentRequest()
+    {
+    __PHSLOGSTRING("[PHS]--> CPSetCallDivertingBase::CancelCurrentRequest" );
+    // Set PSUI so that correct observer is used and hide requesting note.
+    // When interrupting a note, does not leave.
+    // This needs to be done first, since notes must be cleared from screen
+    // even though request is not active.
+    iObserver->SetEngineContact( iDivert );
+    // Does not leave
+    TRAPD( err, iObserver->HandleCFRequestingL( EFalse, ETrue ) );
+
+    if ( !IsActive() || err != KErrNone )
+        {
+        __PHSLOGSTRING("[PHS] <--CPSetCallDivertingBase::CancelCurrentRequest: KErrGeneral" );
+        return KErrGeneral;
+        }
+    
+    if ( iCFStatusCheck )
+        {
+        iCFStatusCheck = EFalse;
+        Cancel();
+        }
+
+    __PHSLOGSTRING("[PHS] <--CPSetCallDivertingBase::CancelCurrentRequest: KErrNone" );
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets new default number the the default numbers list, erases the oldest one.
+// ---------------------------------------------------------------------------
+//
+TInt CPSetCallDivertingBase::SetNewDefaultNumberL( TDes& aNumber )
+    {
+    __PHSLOGSTRING("[PHS]--> CPSetCallDivertingBase::SetNewDefaultNumberL" );    
+    TTelNumber oldFirst;
+    TTelNumber oldSecond; 
+
+    CDesC16ArrayFlat* defNumberArray = 
+        new ( ELeave ) CDesC16ArrayFlat( KPSetDefaultNumberMax );
+    CleanupStack::PushL( defNumberArray );
+
+    TInt defNumbers = GetNumbersFromSharedDataL( iAls, *defNumberArray );
+    __PHSLOGSTRING1("[PHS]    CPSetCallDivertingBase::SetNewDefaultNumberL: defNumbers: %d", defNumbers);
+
+    if ( defNumbers > 0 ) //at least one number was fetched
+        {
+        //save latest divert no.
+       oldFirst = defNumberArray->MdcaPoint( 0 );
+        }
+    if ( defNumbers > 1 ) //at least two numbers were fetched
+        {
+        //save second latest divert no.
+        oldSecond = defNumberArray->MdcaPoint( 1 );
+        }
+    CleanupStack::PopAndDestroy( defNumberArray );
+
+    if ( iAls != ESSSettingsAlsAlternate )
+        {
+        __PHSLOGSTRING("[PHS]    CPSetCallDivertingBase::SetNewDefaultNumberL: !ESSSettingsAlsAlternate" );
+        switch ( defNumbers ) // cases flow through
+            {
+            case 3:
+            case 2://two default numbers
+                User::LeaveIfError( 
+                    SaveKey( KSettingsCFDefaultNumber3, oldSecond ) );
+            case 1://one default number
+                User::LeaveIfError( 
+                    SaveKey( KSettingsCFDefaultNumber2, oldFirst ) );
+            case 0://no default numbers
+                User::LeaveIfError( 
+                    SaveKey( KSettingsCFDefaultNumber1, aNumber ) );
+                break;
+            }
+        }
+    else//aux line
+        {
+        __PHSLOGSTRING("[PHS]    CPSetCallDivertingBase::SetNewDefaultNumberL: Aux line" );
+        switch ( defNumbers ) // cases flow through
+            {
+            case 3:
+            case 2://two default numbers
+                User::LeaveIfError( 
+                    SaveKey( KSettingsCFDefaultNumberAls3, oldSecond ) );
+            case 1://one default number
+                User::LeaveIfError( 
+                    SaveKey( KSettingsCFDefaultNumberAls2, oldFirst ) );
+            case 0://no default numbers
+                User::LeaveIfError( 
+                    SaveKey( KSettingsCFDefaultNumberAls1, aNumber ) );
+                break;
+            default:
+                User::Leave( KErrArgument );
+                break;
+            }
+        } 
+
+    __PHSLOGSTRING("[PHS] <--CPSetCallDivertingBase::SetNewDefaultNumberL" );
+    return KErrNone; //return value is not used
+    }
+
+// --------------------------------------------------------------------------- 
+// Saves a single value to central repository. Make sure that repository
+// is open before calling this function.
+// ---------------------------------------------------------------------------
+//
+TInt CPSetCallDivertingBase::SaveKey(
+    TUint32 aKeyId,
+    const TDesC& aKeyValue )
+    {
+    TInt error = KErrUnknown;
+
+    error = iRepository->Set( aKeyId, aKeyValue );
+
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// Reads used divert numbers (0-3) from shared data and fills array with them.
+// ---------------------------------------------------------------------------
+//
+TInt CPSetCallDivertingBase::GetNumbersFromSharedDataL( TInt aType, 
+                CDesC16ArrayFlat& aArray )
+    {
+    __PHSLOGSTRING("[PHS]--> CPSetCallDivertingBase::GetNumbersFromSharedDataL" );
+
+    TInt amount = 0;
+    TTelNumber readValue;
+    aType = iAls;
+    
+    RArray<TUint32> keyArray( KPSetDefaultNumberMax ); 
+    CleanupClosePushL( keyArray );
+    //to simplify reading, append needed values to an array    
+    if ( aType != ESSSettingsAlsAlternate )
+        {
+        keyArray.AppendL( KSettingsCFDefaultNumber1 );
+        keyArray.AppendL( KSettingsCFDefaultNumber2 );
+        keyArray.AppendL( KSettingsCFDefaultNumber3 );
+        }
+    else //auxiliary line
+        {
+        keyArray.AppendL( KSettingsCFDefaultNumberAls1 );
+        keyArray.AppendL( KSettingsCFDefaultNumberAls2 );
+        keyArray.AppendL( KSettingsCFDefaultNumberAls3 );
+        }    
+
+    TInt i = KErrNone;
+    TInt loc = KErrNone;
+    while ( i == KErrNone && loc < KPSetDefaultNumberMax )
+        {
+        i = iRepository->Get( keyArray.operator[]( loc ), readValue );
+        if ( i == KErrNone )
+            {
+            HBufC16* string = static_cast <HBufC16*> ( readValue.AllocLC() );
+            if ( string->Length() > 0 )
+                {
+                aArray.AppendL( *string );
+                amount++;
+                }
+            CleanupStack::PopAndDestroy( string );
+            }
+        loc++;
+        }
+    CleanupStack::PopAndDestroy(); // keyArray.
+
+    __PHSLOGSTRING1("[PHS] <--CPSetCallDivertingBase::GetNumbersFromSharedDataL: amount: %d", amount );
+    return amount;
+    }
+
+// ---------------------------------------------------------------------------
+// Gets the timer value index related to "cfnry" from shared data
+// In error cases, return default value (30).
+// ---------------------------------------------------------------------------
+//
+TInt CPSetCallDivertingBase::GetTimerValueL()
+    {
+    __PHSLOGSTRING("[PHS]--> CPSetCallDivertingBase::GetTimerValueL" );
+    
+    TInt timerValue = 0;
+    TInt error = KErrNone;
+
+    if ( iAls == ESSSettingsAlsAlternate )
+        {
+        error = iRepository->Get( KSettingsCFTimerValueAls, timerValue );
+        __PHSLOGSTRING1("[PHS]    CPSetCallDivertingBase::GetTimerValueL: KSettingsCFTimerValueAls: %d", timerValue );
+        __PHSLOGSTRING1("[PHS]    CPSetCallDivertingBase::GetTimerValueL: error: %d", error );
+        }
+    else
+        {
+        error = iRepository->Get( KSettingsCFTimerValue, timerValue );
+
+        __PHSLOGSTRING1("[PHS]    CPSetCallDivertingBase::GetTimerValueL: KPsetCFTimerValue: %d", timerValue );
+        __PHSLOGSTRING1("[PHS]    CPSetCallDivertingBase::GetTimerValueL: error: %d", error );
+        }
+    
+    if ( error != KErrNone || !VerifyDelayTime( timerValue ) )
+        {
+        __PHSLOGSTRING("[PHS] <--CPSetCallDivertingBase::GetTimerValueL: KPsetDefaultTimerValue" );
+        return KPsetDefaultTimerValue;
+        }
+    else
+        {
+        __PHSLOGSTRING("[PHS] <--CPSetCallDivertingBase::GetTimerValueL: timerValue" );
+        return timerValue;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Sets the default time for "divert when not answered" to .ini file 
+// ---------------------------------------------------------------------------
+TInt CPSetCallDivertingBase::SetTimerValueL( const TInt& aValue )
+    {
+    __PHSLOGSTRING("[PHS]--> CPSetCallDivertingBase::SetTimerValueL" );
+
+    TInt retValue = KErrNone;
+
+    // If delay time is not divisable by five, return.
+    if ( !VerifyDelayTime( aValue ) )
+        {
+        return KErrArgument;
+        }
+
+    if ( iAls != ESSSettingsAlsAlternate )
+        {
+        retValue = iRepository->Set( KSettingsCFTimerValue, aValue );
+        __PHSLOGSTRING1("[PHS]    CPSetCallDivertingBase::SetTimerValueL: KPsetCFTimerValue: %d", aValue );
+        }
+    else
+        {
+        retValue = iRepository->Set( KSettingsCFTimerValueAls, aValue );
+        __PHSLOGSTRING1("[PHS]    CPSetCallDivertingBase::SetTimerValueL: KPsetCFTimerValueAls: %d", aValue );
+        }
+
+    __PHSLOGSTRING1("[PHS] <--CPSetCallDivertingBase::SetTimerValueL: retValue: %d", retValue );
+    return retValue;
+    }
+
+// ---------------------------------------------------------------------------
+// Verifies that delay time is divisible by five.
+// ---------------------------------------------------------------------------
+//
+TBool CPSetCallDivertingBase::VerifyDelayTime( const TInt& aDelayTime )
+    {
+    TReal res = 0;
+    Math::Mod( res, aDelayTime, KPsetDelayTimeDivider ); 
+    return res == 0;
+    }
+
+// ---------------------------------------------------------------------------
+// Swaps the most recently used number to first in the shared data file.
+// ---------------------------------------------------------------------------
+//
+void CPSetCallDivertingBase::SwapDefaultNumberL( const TInt& aLocation )
+    {
+    __PHSLOGSTRING("[PHS]--> CPSetCallDivertingBase::SwapDefaultNumberL" );
+
+    if ( aLocation == KPSetFirstDefNumber )
+        {
+        return; //no need to reorganize, number is already first
+        }
+    else if ( 
+        !( aLocation == KPSetSecondDefNumber || 
+           aLocation == KPSetThirdDefNumber ) )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    CDesC16ArrayFlat* defNumbers = 
+        new ( ELeave ) CDesC16ArrayFlat( KPSetDefaultNumberMax );
+    CleanupStack::PushL( defNumbers );
+
+    GetNumbersFromSharedDataL( iAls, *defNumbers );
+
+    if ( iAls != ESSSettingsAlsAlternate ) 
+    //EGetAlsLinePrimary or Not supported or Unknown
+        {
+        __PHSLOGSTRING("[PHS]    CPSetCallDivertingBase::SwapDefaultNumberL: !ESSSettingsAlsAlternate" );
+        switch( aLocation )
+            {
+            case KPSetSecondDefNumber:
+                User::LeaveIfError( 
+                    SaveKey( 
+                        KSettingsCFDefaultNumber2, 
+                        defNumbers->MdcaPoint(0) ) );
+                User::LeaveIfError( 
+                    SaveKey( 
+                        KSettingsCFDefaultNumber1, 
+                        defNumbers->MdcaPoint(1) ) );
+                break;
+            case KPSetThirdDefNumber:
+                User::LeaveIfError( 
+                    SaveKey( 
+                        KSettingsCFDefaultNumber2, 
+                        defNumbers->MdcaPoint(0) ) );
+                User::LeaveIfError( 
+                    SaveKey( 
+                        KSettingsCFDefaultNumber3, 
+                        defNumbers->MdcaPoint(1) ) );
+                User::LeaveIfError( 
+                    SaveKey( 
+                        KSettingsCFDefaultNumber1, 
+                        defNumbers->MdcaPoint(2) ) );
+                break;
+            default:
+                break;
+            }
+        }            
+    else //alternate line
+        {
+        __PHSLOGSTRING("[PHS]    CPSetCallDivertingBase::SwapDefaultNumberL: ESSSettingsAlsAlternate" );
+        switch( aLocation )
+            {
+            case KPSetSecondDefNumber:
+                User::LeaveIfError( 
+                    SaveKey( 
+                        KSettingsCFDefaultNumberAls1, 
+                        defNumbers->MdcaPoint(0) ) );
+                User::LeaveIfError( 
+                    SaveKey( 
+                        KSettingsCFDefaultNumberAls2, 
+                        defNumbers->MdcaPoint(1) ) );
+                break;
+            case KPSetThirdDefNumber:
+                User::LeaveIfError( 
+                    SaveKey( 
+                        KSettingsCFDefaultNumberAls2, 
+                        defNumbers->MdcaPoint(0) ) );
+                User::LeaveIfError( 
+                    SaveKey( 
+                        KSettingsCFDefaultNumberAls3, 
+                        defNumbers->MdcaPoint(1) ) );
+                User::LeaveIfError( 
+                    SaveKey( 
+                        KSettingsCFDefaultNumberAls1, 
+                        defNumbers->MdcaPoint(2) ) );
+                break;
+            default:
+                break;
+            }
+        }
+    CleanupStack::PopAndDestroy( defNumbers );
+    __PHSLOGSTRING("[PHS] <--CPSetCallDivertingBase::SwapDefaultNumberL" );
+    }
+
+// ---------------------------------------------------------------------------
+// Request diverting status from network asynhronously.
+// ---------------------------------------------------------------------------
+void CPSetCallDivertingBase::GetDivertingStatusL( 
+    const TServiceGroup aServiceGroup,
+    const TCallDivertingCondition aCondition, 
+    TBasicServiceGroups aBsc ) 
+    {
+    __PHSLOGSTRING("[PHS]--> CPSetCallDivertingBase::GetDivertingStatusL" );
+
+    if ( IsActive() )
+        {
+        User::Leave( KErrInUse );
+        }
+    
+    __PHSLOGSTRING1("[PHS]    CPSetCallDivertingBase::GetDivertingStatusL: aServiceGroup: %d", aServiceGroup );
+    __PHSLOGSTRING1("[PHS]    CPSetCallDivertingBase::GetDivertingStatusL: aCondition: %d", aCondition );
+    __PHSLOGSTRING1("[PHS]    CPSetCallDivertingBase::GetDivertingStatusL: aBsc: %d", aBsc );
+
+    iCFStatusCheck = ETrue;
+
+    CPsetTelephony::CheckLineModeL( aServiceGroup, &iPhone, iLine );    
+    if ( !iLine->SubSessionHandle() )
+        {
+        User::Leave( KErrBadHandle );
+        }
+
+    // in these cases basic service group will not be set
+    if ( !( aCondition == EDivertConditionAllCalls || 
+            aCondition == EDivertConditionAllConditionalCases ) )
+        {
+        __PHSLOGSTRING("[PHS]    CPSetCallDivertingBase::GetDivertingStatusL: CancelAll should not come here" );
+        ValidateBsc( aBsc );
+        }
+
+    iReason = PSetUtility::GetDivertReason( aCondition );    
+
+    // Start to request for status.
+    if (iCfInterrogator)
+        {
+        delete iCfInterrogator;
+        iCfInterrogator = NULL;
+        }
+    iCfInterrogator = CRetrieveMobilePhoneCFList::NewL( iPhone );
+    iCfInterrogator->Start( 
+        iStatus, 
+        iReason, 
+        PSetUtility::ChangeToEtelInternal( aBsc ) );
+
+    StartRequestingL( EPSetGetDivertStatus );
+
+    __PHSLOGSTRING("[PHS] <--CPSetCallDivertingBase::GetDivertingStatusL" );
+    }
+
+// ---------------------------------------------------------------------------
+// Creates param list for NotifyDivertChange method.
+// ---------------------------------------------------------------------------
+//
+TCallDivertNotifySetting CPSetCallDivertingBase::CreateDivertNotifySetting( 
+    TUnconditionalCFStatus aCurrentDivert, TBool aDivertChanged, 
+    TBool aVoiceMbxDivert, TInt aBasic )
+    {
+    __PHSLOGSTRING1("[PHS]    CPSetCallDivertingBase iVideoDivert    = %d", iVideoDivert );
+    __PHSLOGSTRING1("[PHS]    CPSetCallDivertingBase iVoiceDivert    = %d", iVoiceDivert );
+    __PHSLOGSTRING1("[PHS]    CPSetCallDivertingBase aVoiceMbxDivert = %d", aVoiceMbxDivert );
+    
+    TCallDivertNotifySetting divertNotify;
+    divertNotify.Initialize();
+
+    divertNotify.iPreviousCfStatus = aCurrentDivert;
+    divertNotify.iCfActivated = aDivertChanged;
+    
+    divertNotify.iBasicServiceCode = aBasic;
+
+    if ( aVoiceMbxDivert )
+        {
+        divertNotify.iVmbxDivert = ETrue;
+        }
+               
+    return divertNotify;
+    }
+
+// ---------------------------------------------------------------------------
+// Gets Als information
+// ---------------------------------------------------------------------------
+//
+TSelectedLine CPSetCallDivertingBase::GetSAAls()
+    {
+    __PHSLOGSTRING("[PHS]--> CPSetCallDivertingBase::GetSAAls" );
+    __PHSLOGSTRING2("[PHS] iAls: %d iBsc: %d", iAls, iBsc  );
+    TSelectedLine alsValue = ENotSupportedLine;
+    switch ( iAls )
+        {
+        case ESSSettingsAlsNotSupported:
+            alsValue = ENotSupportedLine;
+            break;
+        case ESSSettingsAlsPrimary:
+            iChangeInfo.iServiceGroup == RMobilePhone::EAuxVoiceService 
+                ? ( alsValue = EAuxiliaryLine )  
+                : ( alsValue = EPrimaryLine );
+            break;
+        case ESSSettingsAlsAlternate:
+            alsValue = EAuxiliaryLine;
+            break;
+        default:
+            alsValue = ENotSupportedLine;
+            break;
+        }
+    
+    // If user checks/activates divert to line which is not selected currently than we have
+    // to change returned alsvalue accordinly, if this is not done divert icon status is updated to wrong status.
+    // Example case: Line 2 active user activates divert to line 1: **21*phonenumber*11#.
+    if ( iBsc == EAltTele && iAls == ESSSettingsAlsPrimary )
+        {
+        __PHSLOGSTRING("[PHS]    CPSetCallDivertingBase::GetSAAls - Line 2 divert activation/check from Line 1" );
+        alsValue = EAuxiliaryLine;
+        }
+    else if ( iBsc == ETelephony && iAls == ESSSettingsAlsAlternate )
+        {
+        __PHSLOGSTRING("[PHS]    CPSetCallDivertingBase::GetSAAls - Line 1 divert activation/check from Line 2" );
+        alsValue = EPrimaryLine;
+        }
+    
+    __PHSLOGSTRING1("[PHS]    CPSetCallDivertingBase::GetSAAls: alsValue: %d", alsValue );
+    __PHSLOGSTRING("[PHS] <--CPSetCallDivertingBase::GetSAAls" );
+    return alsValue;
+    }
+
+// ---------------------------------------------------------------------------
+// Validates used bsc, if EUnknown, updates to real value
+// ---------------------------------------------------------------------------
+//
+void CPSetCallDivertingBase::ValidateBsc( TBasicServiceGroups& aBsc )
+    {
+    __PHSLOGSTRING("[PHS]--> CPSetCallDivertingBase::ValidateBsc" );
+    if ( aBsc == EUnknown )
+    // if bsc is unknown, update it
+        {
+        if ( iAls == ESSSettingsAlsAlternate )
+            {
+            aBsc = EAltTele;
+            }
+        else
+            {
+            aBsc = ETelephony;
+            }
+        }    
+    else
+    // If no specific line is indicated
+        {
+        if ( aBsc == EAllTeleAndBearer ||
+             aBsc == EAllTele )
+            {
+            // if ALS is used, use 89 bsc
+            if ( iAls == ESSSettingsAlsAlternate )
+                {
+                aBsc = EAltTele;
+                }
+            }
+        }
+    __PHSLOGSTRING("[PHS] <--CPSetCallDivertingBase::ValidateBsc" );
+    }
+
+// ---------------------------------------------------------------------------
+// Starts requesting
+// ---------------------------------------------------------------------------
+//
+void CPSetCallDivertingBase::StartRequestingL( const TInt& aRequest )
+    {
+    __PHSLOGSTRING("[PHS]--> CPSetCallDivertingBase::StartRequestingL" );
+    if ( aRequest != KPsetRequestAlreadySet )
+        {
+        SetRequestStatus( static_cast <TPSetDivertRequest> ( aRequest ) );
+        }
+    
+    SetActive();
+
+    iObserver->SetEngineContact( iDivert );
+
+    CleanupLeavePushL();    
+    iObserver->HandleCFRequestingL( ETrue, EFalse );
+    CleanupStack::Pop(); // CleanupCancelPushL
+    __PHSLOGSTRING("[PHS] <--CPSetCallDivertingBase::StartRequestingL" );
+    }
+
+// ---------------------------------------------------------------------------
+// Inform request observer that request status has changed.
+// ---------------------------------------------------------------------------
+//
+void CPSetCallDivertingBase::SetRequestStatus( TPSetDivertRequest aStatus )
+    {
+    iCurrentReq = aStatus;
+    if ( iReqObserver )
+        {
+        iReqObserver->RequestStatusChanged( aStatus );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// If divert activation/cancellation/etc. affects more than one bsc, 
+//  inform PSUI about it.
+// ---------------------------------------------------------------------------
+TBool CPSetCallDivertingBase::IsMultiAffectingDivert( 
+    const TCallDivertSetting& aDivert, TBasicServiceGroups aBsc )
+    {
+    __PHSLOGSTRING("[PHS]--> CPSetCallDivertingBase::IsMultiAffectingDivert" );
+    __PHSLOGSTRING1("[PHS]    CPSetCallDivertingBase::IsMultiAffectingDivert: aBsc = %d", aBsc );
+    __PHSLOGSTRING1("[PHS]    CPSetCallDivertingBase::IsMultiAffectingDivert: aDivert.iCondition = %d", aDivert.iCondition );
+    __PHSLOGSTRING1("[PHS]    CPSetCallDivertingBase::IsMultiAffectingDivert: aDivert.iStatus = %d", aDivert.iStatus );
+    __PHSLOGSTRING1("[PHS]    CPSetCallDivertingBase::IsMultiAffectingDivert: aDivert.iServiceGroup = %d", aDivert.iServiceGroup );
+
+    if ( iReason == RMobilePhone::ECallForwardingAllCases ||
+         iReason == RMobilePhone::ECallForwardingAllConditionalCases ||
+         iReason == RMobilePhone::ECallForwardingNotReachable )
+        {
+        __PHSLOGSTRING("[PHS] <--CPSetCallDivertingBase::IsMultiAffectingDivert1" );
+         return ETrue;
+        }
+    if ( iReason == RMobilePhone::ECallForwardingUnconditional )
+        {
+        //it is a MMI string
+        if ( ( aBsc != EUnknown && aBsc != ETelephony ) && aDivert.iServiceGroup == EServiceGroupVoice ) 
+            {
+            __PHSLOGSTRING("[PHS] <--CPSetCallDivertingBase::IsMultiAffectingDivert2" );
+            return ETrue;
+            }
+        }
+    
+    __PHSLOGSTRING("[PHS] <--CPSetCallDivertingBase::IsMultiAffectingDivert3" );
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// Push object into cleanupstack to catch leaving.
+// ---------------------------------------------------------------------------
+//
+void CPSetCallDivertingBase::CleanupLeavePushL()
+      {
+      CleanupStack::PushL( TCleanupItem( DoHandleLeave, this ) );
+      }
+
+// ---------------------------------------------------------------------------
+// Object has caused a leave.
+// ---------------------------------------------------------------------------
+//
+void CPSetCallDivertingBase::DoHandleLeave( TAny* aAny )
+      {
+      REINTERPRET_CAST( CPSetCallDivertingBasicImpl*, aAny )->HandleLeave();
+      }
+
+// ---------------------------------------------------------------------------
+// Things to do when leave occurs.
+// ---------------------------------------------------------------------------
+//
+void CPSetCallDivertingBase::HandleLeave()
+    {
+    CancelCurrentRequest();
+    }
+
+// ---------------------------------------------------------------------------
+// Inform the request observer that request has been completed.
+// ---------------------------------------------------------------------------
+//
+void CPSetCallDivertingBase::RequestCompleted( const TInt& aError )
+    {
+    __PHSLOGSTRING("[PHS]--> CPSetCallDivertingBase::RequestCompleted" );
+    if ( aError != KErrNone )
+        {
+        SetRequestStatus( static_cast <TPSetDivertRequest> (aError) );
+        }
+    SetRequestStatus( EPSetNone );    
+    iVoiceDivert = EFalse;
+
+    if ( iReqObserver )
+        {
+        iReqObserver->RequestComplete(); 
+        }
+    __PHSLOGSTRING("[PHS] <--CPSetCallDivertingBase::RequestCompleted" );
+    }
+
+// ---------------------------------------------------------------------------
+// Verifies whether the divert-to number is to voice mail box.
+// ---------------------------------------------------------------------------
+//
+TBool CPSetCallDivertingBase::IsVMBXDivertL( TDesC& /*aTelNumber*/ )
+    {
+
+    __PHSLOGSTRING("[PHS]--> CPSetCallDivertingBase::IsVMBXDivertL" );
+    
+    TBool result = EFalse;
+    __PHSLOGSTRING("[PHS] <--CPSetCallDivertingBase::IsVMBXDivertL" );
+    return result;
+    }
+
+// ---------------------------------------------------------------------------
+// If SsSettings notifies of settings change, copy new value to member variable. 
+// ---------------------------------------------------------------------------
+void CPSetCallDivertingBase::PhoneSettingChanged( 
+    TSSSettingsSetting aSetting, TInt aNewValue )
+    {
+    __PHSLOGSTRING2("[PHS]--> CPSetCallDivertingBase::PhoneSettingChanged ESSSettingsAls: %d, aNewValue: %d", aSetting, aNewValue );
+    if ( aSetting == ESSSettingsAls )
+        {
+        iAls = static_cast <TSSSettingsAlsValue> (aNewValue);
+        }
+    __PHSLOGSTRING("[PHS]<-- CPSetCallDivertingBase::PhoneSettingChanged" );
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/telephonysettings/src/psetcalldivertingbasicimpl.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,488 @@
+/*
+* 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 CPSetCallDivertingBasicImpl class.
+*
+*/
+
+
+// INCLUDE FILES
+#include "psetcalldivertingbasicimpl.h" 
+
+#include <badesca.h>
+#include <etelmm.h>           
+#include <e32math.h>
+#include <e32svr.h>
+#include <featmgr.h>
+#include <centralrepository.h>
+#include <settingsinternalcrkeys.h> 
+
+#include "psetcalldiverting.h" 
+#include "psetcontainer.h" 
+#include "mpsetdivertobs.h" 
+#include "psettelephony.h" 
+#include "psetpanic.h" 
+#include "mpsetrequestobs.h" 
+#include "psetutility.h" 
+#include "phonesettingslogger.h" 
+#include "psetsaobserver.h" 
+
+//  LOCAL CONSTANTS AND MACROS
+_LIT( KPSetIntNbr, "+" );
+_LIT( KPSNameOfClass, "CPSetCallDivertingBasicImpl" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPSetCallDivertingBasicImpl::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPSetCallDivertingBasicImpl* CPSetCallDivertingBasicImpl::NewL( 
+        MPsetDivertObserver& aObserver, 
+        RMobilePhone& aPhone,
+        CPsetCallDiverting* aDivert )
+    {
+    CPSetCallDivertingBasicImpl* self = new ( ELeave ) CPSetCallDivertingBasicImpl( aPhone, aDivert );
+    CleanupStack::PushL( self );
+    self->ConstructL( aObserver );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPSetCallDivertingBasicImpl::~CPSetCallDivertingBasicImpl
+// ---------------------------------------------------------------------------
+//
+CPSetCallDivertingBasicImpl::~CPSetCallDivertingBasicImpl()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPSetCallDivertingBasicImpl::CPSetCallDivertingBasicImpl
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPSetCallDivertingBasicImpl::CPSetCallDivertingBasicImpl( 
+                    RMobilePhone& aPhone, CPsetCallDiverting* aDivert ) : 
+                    CPSetCallDivertingBase( aPhone, aDivert )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPSetCallDivertingBasicImpl::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CPSetCallDivertingBasicImpl::ConstructL( MPsetDivertObserver& aObserver )
+    {
+    CPSetCallDivertingBase::ConstructL( aObserver );
+    }
+
+// -----------------------------------------------------------------------------
+// CPSetCallDivertingBasicImpl::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CPSetCallDivertingBasicImpl::SetDivertingL( const TCallDivertSetting& aDivert,  TBasicServiceGroups aBsc )
+    {
+    __PHSLOGSTRING("[PHS]--> CPSetCallDivertingBasicImpl::SetDivertingL");
+    __PHSLOGSTRING1("[PHS]    CPSetCallDivertingBasicImpl::SetDivertingL: aBsc: %d", aBsc );
+   if ( IsActive() )
+       {
+       User::Leave( KErrInUse );
+       }
+   iBsc = aBsc;
+   iRequestedServiceGroup = aDivert.iServiceGroup;
+   
+   CPsetTelephony::CheckLineModeL( aDivert.iServiceGroup, &iPhone, iLine );
+   if ( !iLine->SubSessionHandle() )
+       {
+       User::Leave( KErrBadHandle );
+       }
+       
+   SetRequestStatus( EPSetChangeDivert );
+   iReason = PSetUtility::GetDivertReason ( aDivert.iCondition );
+   iVoiceDivert = SetVoiceDivert( aDivert, aBsc );
+
+   ValidateBsc( aBsc );
+   iPluralNotes = IsMultiAffectingDivert( aDivert, aBsc );
+
+   //Copy data to member variable
+   iChangeInfo.iNumber.iTelNumber.Copy( aDivert.iNumber );
+   iChangeInfo.iTimeout = KPSetDefaultDelayTimeValue;
+   if ( aBsc == EAltTele )
+       {
+       iChangeInfo.iServiceGroup = PSetUtility::VerifyAltLineUseL();
+       }
+   iChangeInfo.iServiceGroup = PSetUtility::ChangeToEtelInternal( aBsc ); 
+   iChangeInfo.iNumber.iNumberPlan = RMobilePhone::EIsdnNumberPlan;
+   iChangeInfo.iNumber.iTypeOfNumber = RMobilePhone::EUnknownNumber;
+   if ( iChangeInfo.iNumber.iTelNumber.Length() > 0 )
+       {
+       if ( iChangeInfo.iNumber.iTelNumber.Left(1) == KPSetIntNbr )
+           {
+           iChangeInfo.iNumber.iTypeOfNumber = 
+               RMobilePhone::EInternationalNumber;
+           }
+       }
+
+   switch ( aDivert.iSetting )
+       {
+       case ERegisterDiverting:
+          /*****************************************************
+          *    Series 60 Customer / ETel
+          *    Series 60  ETel API
+          *****************************************************/
+          iChangeInfo.iAction = RMobilePhone::EServiceActionRegister;
+          iChangeInfo.iTimeout = aDivert.iNoReplyTimer;
+          __PHSLOGSTRING("[PHS]    CPSetCallDivertingBasicImpl::SetDivertingL: ERegisterDiverting" );
+          break;
+       case EEraseDiverting:
+           iChangeInfo.iAction = RMobilePhone::EServiceActionErase;
+           __PHSLOGSTRING("[PHS]    CPSetCallDivertingBasicImpl::SetDivertingL: EEraseDiverting" );
+           break;
+       case EActivateDiverting:
+           iChangeInfo.iAction = RMobilePhone::EServiceActionActivate;
+           iChangeInfo.iTimeout = aDivert.iNoReplyTimer;
+           __PHSLOGSTRING("[PHS]    CPSetCallDivertingBasicImpl::SetDivertingL: EActivateDiverting" );
+           break;
+       case ECancelDiverting:
+           iChangeInfo.iAction = RMobilePhone::EServiceActionDeactivate;
+           __PHSLOGSTRING("[PHS]    CPSetCallDivertingBasicImpl::SetDivertingL: ECancelDiverting" );
+           break;
+       default:
+           User::Leave( KErrArgument );
+           break;
+       }
+
+   //Start requesting for setting Divert.
+   iPhone.SetCallForwardingStatus( iStatus, iReason, iChangeInfo );
+   StartRequestingL( KPsetRequestAlreadySet );    
+   __PHSLOGSTRING("[PHS] <--CPSetCallDivertingBasicImpl::SetDivertingL" );
+   }
+
+// ---------------------------------------------------------------------------
+// RunL
+// ---------------------------------------------------------------------------
+//
+void CPSetCallDivertingBasicImpl::RunL()
+    {
+    __PHSLOGSTRING("[PHS]--> CPSetCallDivertingBasicImpl::RunL" );           
+   __ASSERT_ALWAYS( 
+       iObserver != NULL, Panic( KPSNameOfClass, ECDRequestPanicNoObserver ) );
+
+   //Hide requesting note - does not leave when deleting a note.
+   iObserver->SetEngineContact( iDivert );
+   iObserver->HandleCFRequestingL( EFalse, EFalse );
+
+   //Handle error case.
+   if ( iStatus != KErrNone )
+       {
+       iObserver->HandleDivertingErrorL( iStatus.Int() );
+       RequestCompleted( iStatus.Int() );
+       return;
+       }
+       
+   iDivertStatus.Initialize();
+   switch ( iCurrentReq )
+       {
+       case EPSetChangeDivert:
+           {
+           __PHSLOGSTRING("[PHS]--> CPSetCallDivertingBasicImpl::RunL: EPSetChangeDivert" );
+           //Notify Observer            
+           iDivertStatus.iStatus = PSetUtility::GetChangeInfoStatus( iChangeInfo.iAction );
+           iDivertStatus.iNumber = iChangeInfo.iNumber.iTelNumber;
+           iDivertStatus.iCondition = PSetUtility::GetDivertReason(iReason);
+           iDivertStatus.iNoReplyTimer = iChangeInfo.iTimeout;
+           iDivertStatus.iServiceGroup = iRequestedServiceGroup;
+           
+            // Check is done because of VOIP notification functionality(PSetNotesUI).
+           if ( iVoiceDivert && !iVideoDivert )
+               {
+               iDivertStatus.iServiceGroup = EServiceGroupVoice;
+               }
+           
+           iObserver->HandleDivertingChangedL( iDivertStatus, iPluralNotes );
+           
+           //Notify observer.
+           HandleSANotificationL( 
+               IsVMBXDivertL( iChangeInfo.iNumber.iTelNumber ), 
+               iDivertStatus.iStatus );
+           break;
+           }
+       case EPSetGetDivertStatus:
+           {
+           __PHSLOGSTRING("[PHS]--> CPSetCallDivertingBasicImpl::RunL: EPSetGetDivertStatus" );
+
+           CMobilePhoneCFList* cfList = iCfInterrogator->RetrieveListL();
+           CleanupStack::PushL( cfList );
+           CMobilePhoneCFList* cleanedList = CMobilePhoneCFList::NewL();            
+           CleanupStack::PushL( cleanedList );
+           
+           TInt numOfItems = cfList->Enumerate();
+           TInt index = 0;
+           RMobilePhone::TMobilePhoneCFInfoEntryV1 cfEntry;
+           RMobilePhone::TMobilePhoneCFInfoEntryV1 copy;
+           iDivertStatus.iStatus = EDivertingStatusNotRegistered;
+           while( index < numOfItems )
+               {
+               cfEntry = cfList->GetEntryL( index );
+               iBsc = PSetUtility::ChangeToGSM( cfEntry.iServiceGroup );
+
+               if ( cfEntry.iStatus == RMobilePhone::ECallForwardingStatusActive )
+                   {
+                   copy.iServiceGroup = cfEntry.iServiceGroup;
+                   copy.iCondition = cfEntry.iCondition;
+                   copy.iStatus = cfEntry.iStatus;
+                   copy.iNumber = cfEntry.iNumber;
+                   copy.iTimeout = cfEntry.iTimeout;
+                   cleanedList->AddEntryL( copy );
+                   }
+                   
+                __PHSLOGSTRING1("[PHS] CPSetCallDivertingBasicImpl::RunL: EPSetGetDivertStatus     iBsc: %d", iBsc );
+                __PHSLOGSTRING1("[PHS] CPSetCallDivertingBasicImpl::RunL: EPSetGetDivertStatus iStatus: %d", cfEntry.iStatus );
+               if ( iBsc == EAllTeleAndBearer || iBsc == EAllTele || iBsc == ETelephony || iBsc == EAltTele ||
+                   iBsc == EAllBearer || iBsc == EAllSync || iBsc == ESyncData )
+                   {
+                   // iVoiceDivert is set to true to ensure that the icons are updated in every case.
+                   iVoiceDivert = ETrue;
+                   if ( ( cfEntry.iStatus != RMobilePhone::ECallForwardingStatusNotRegistered )
+                       && ( cfEntry.iStatus != RMobilePhone::ECallForwardingStatusNotActive )
+                       && ( cfEntry.iStatus != RMobilePhone::ECallForwardingStatusNotProvisioned ) )
+                       {
+                       iDivertStatus.iStatus = EDivertingStatusActive;
+                       }
+                   else
+                       {
+                       iDivertStatus.iStatus = EDivertingStatusNotRegistered;
+                       }
+                   
+                   HandleSANotificationL( 
+                           IsVMBXDivertL( cfEntry.iNumber.iTelNumber ), 
+                           iDivertStatus.iStatus );
+                   }
+               index++;
+               }
+           if ( cleanedList->Enumerate() == 0 )
+               {
+               iObserver->HandleDivertingStatusL( *cfList, iPluralNotes );
+               }
+           else
+               {
+               iObserver->HandleDivertingStatusL( *cleanedList, iPluralNotes );
+               }
+           CleanupStack::PopAndDestroy( 2 ); //cleanedList, cfList
+           cfList = NULL;
+           cleanedList = NULL;
+           iCFStatusCheck = EFalse; 
+           break;
+           }
+       default:
+           Panic( KPSNameOfClass, ECDRequestPanicIncorrectRequest );
+           break;
+       } 
+    RequestCompleted( KErrNone );
+    __PHSLOGSTRING("[PHS] <--CPSetCallDivertingBasicImpl::RunL" );
+    }    
+
+// ---------------------------------------------------------------------------
+// DoCancel
+// ---------------------------------------------------------------------------
+//
+void CPSetCallDivertingBasicImpl::DoCancel()
+    {
+    __PHSLOGSTRING("[PHS]--> CPSetCallDivertingBasicImpl::DoCancel" );
+    //Decide which request to cancel.
+    switch( iCurrentReq )
+        {
+        case EPSetChangeDivert:
+            __PHSLOGSTRING("[PHS]   DoCancel - EPSetChangeDivert" );
+            iPhone.CancelAsyncRequest( EMobilePhoneSetCallForwardingStatus );
+            break;
+        case EPSetGetDivertStatus:
+            __PHSLOGSTRING("[PHS]   DoCancel - EPSetGetDivertStatus" );
+            iCfInterrogator->Cancel();
+            delete iCfInterrogator;
+            iCfInterrogator = NULL;
+            break;
+        default:
+            break;
+        }
+    
+    //Set current request to none.
+    iCurrentReq = EPSetNone;
+    iVoiceDivert = EFalse;
+    iVideoDivert = EFalse;
+    __PHSLOGSTRING("[PHS]<-- CPSetCallDivertingBasicImpl::DoCancel" );
+    }
+
+// ---------------------------------------------------------------------------
+// RunError
+// ---------------------------------------------------------------------------
+//
+TInt CPSetCallDivertingBasicImpl::RunError( TInt aError ) 
+    {
+    __PHSLOGSTRING1("[PHS]--> CPSetCallDivertingBasicImpl::RunError aError: %d", aError );
+    if ( ( iCurrentReq == EPSetGetDivertStatus || iCurrentReq == EPSetChangeDivert)
+         && iVoiceDivert )
+        {
+        __PHSLOGSTRING("[PHS]   RunError - HandleSANotificationL" );
+        TRAP_IGNORE( HandleSANotificationL( EFalse, iDivertStatus.iStatus ) );
+        }
+        
+    if ( iCurrentReq == EPSetGetDivertStatus )
+        {
+        iCFStatusCheck = EFalse;
+        }   
+    aError = KErrNone;
+        
+    //Set current request to none.
+    iCurrentReq = EPSetNone;    
+    iVoiceDivert = EFalse;
+    iVideoDivert = EFalse;
+    __PHSLOGSTRING("[PHS]<-- CPSetCallDivertingBasicImpl::RunError" );
+    return aError;  
+    }
+
+// ---------------------------------------------------------------------------
+//  If unconditional voice divert is activated/cancelled, notifies observer, 
+//  so that it can set on/off indicators.
+// ---------------------------------------------------------------------------
+//
+void CPSetCallDivertingBasicImpl::HandleSANotificationL( 
+    TBool aVmbxDivert, TDivertingStatus& aCfStatus )
+    {
+    __PHSLOGSTRING2("[PHS]--> CPSetCallDivertingBasicImpl::HandleSANotificationL aVmbxDivert: %d, aCfStatus: %d", aVmbxDivert, aCfStatus );
+    TBool divertChanged = EFalse;
+
+    //If divert is not with voice, do not touch indicators.
+    if ( !iVoiceDivert )
+        {
+        return;
+        }
+
+    //Unconditional divert and all diverts
+    if ( iReason == RMobilePhone::ECallForwardingUnconditional ||
+        iReason == RMobilePhone::ECallForwardingAllCases )
+        {
+        if ( iCurrentReq == EPSetChangeDivert )
+            {
+            //show indicator if, activation/registration, else hide it
+            //these are probably incorrect....
+            divertChanged = 
+                ( iChangeInfo.iAction == RMobilePhone::EServiceActionRegister ||
+                  iChangeInfo.iAction == RMobilePhone::EServiceActionActivate);
+            }
+        else
+            {
+            //show indicator if status is activated, hide for cancelled.
+            divertChanged = ( aCfStatus == EDivertingStatusActive );
+            }
+        }
+    else
+        {
+        //if not unconditional, do not touch indicators.
+        return;
+        }
+
+    CPsetSAObserver* systemObserver = CPsetSAObserver::NewL();
+    CleanupStack::PushL( systemObserver );
+    
+    TUnconditionalCFStatus status(KCFIndicatorUnknown);
+    
+    User::LeaveIfError( systemObserver->GetCurrentDivertStatus( status ) );
+    
+    TCallDivertNotifySetting setting = CreateDivertNotifySetting(
+        status, divertChanged, aVmbxDivert, iBsc );
+    
+    // Notify observer that Diverts have changed.
+    systemObserver->NotifyDivertChange( GetSAAls(), 
+        setting,
+        -1 );
+    
+    CleanupStack::PopAndDestroy( systemObserver );
+
+    __PHSLOGSTRING("[PHS] <--CPSetCallDivertingBasicImpl::HandleSANotificationL" );
+    }
+
+// ---------------------------------------------------------------------------
+// Returns ETrue if divert operation is to voice or to all operations.
+// ---------------------------------------------------------------------------
+//
+TBool CPSetCallDivertingBasicImpl::SetVoiceDivert( const TCallDivertSetting& aDivert,
+    const TBasicServiceGroups aBsc )
+    {
+    iVideoDivert = EFalse;
+    if ( aDivert.iServiceGroup == EServiceGroupVoice ||
+         aDivert.iServiceGroup == EServiceGroupAllTeleservices)
+        {
+        return ETrue;
+        }
+    else if ( ( aDivert.iServiceGroup == EServiceGroupData && ( aBsc == EAllBearer ||
+             aBsc == EAllSync || aBsc == ESyncData ) ) )
+        {
+        iVideoDivert = ETrue;
+        return ETrue;
+        }
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// Gets Als information.
+// ---------------------------------------------------------------------------
+//
+TSelectedLine CPSetCallDivertingBasicImpl::GetSAAls()
+    {
+    __PHSLOGSTRING("[PHS]--> CPSetCallDivertingBasicImpl::GetSAAls" );
+    __PHSLOGSTRING2("[PHS] iAls: %d iBsc: %d", iAls, iBsc  );
+    TSelectedLine alsValue = ENotSupportedLine;
+    switch ( iAls )
+        {
+        case ESSSettingsAlsNotSupported:
+            alsValue = ENotSupportedLine;
+            break;
+        case ESSSettingsAlsPrimary:
+            iChangeInfo.iServiceGroup == RMobilePhone::EAuxVoiceService 
+                ? ( alsValue = EAuxiliaryLine )  
+                : ( alsValue = EPrimaryLine );
+            break;
+        case ESSSettingsAlsAlternate:
+            alsValue = EAuxiliaryLine;
+            break;
+        default:
+            alsValue = ENotSupportedLine;
+            break;
+        }
+    
+    // If user checks/activates divert to line which is not selected currently than we have
+    // to change returned alsvalue accordinly, if this is not done divert icon status is updated to wrong status.
+    // Example case: Line 2 active user activates divert to line 1: **21*phonenumber*11#.
+    if ( iBsc == EAltTele && iAls == ESSSettingsAlsPrimary )
+        {
+        __PHSLOGSTRING("[PHS]    CPSetCallDivertingBasicImpl::GetSAAls - Line 2 divert activation/check from Line 1" );
+        alsValue = EAuxiliaryLine;
+        }
+    else if ( iBsc == ETelephony && iAls == ESSSettingsAlsAlternate )
+        {
+        __PHSLOGSTRING("[PHS]    CPSetCallDivertingBasicImpl::GetSAAls - Line 1 divert activation/check from Line 2" );
+        alsValue = EPrimaryLine;
+        }
+    
+    __PHSLOGSTRING1("[PHS]    CPSetCallDivertingBasicImpl::GetSAAls: alsValue: %d", alsValue );
+    __PHSLOGSTRING("[PHS] <--CPSetCallDivertingBasicImpl::GetSAAls" );
+    return alsValue;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/telephonysettings/src/psetcalldivertingcreator.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,68 @@
+/*
+* 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 CPSetCallDivertingCreator class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "psetcalldivertingbasicimpl.h" 
+#include    "psetcalldivertingdualaffectimpl.h" 
+#include    "psetcalldivertingcreator.h" 
+#include    "psetvariationproxy.h" 
+
+#include    <psetcalldiverting.h> 
+#include    <centralrepository.h>
+#include    <telservicesinternalcrkeys.h> // telephony service local variation keys. 
+#include    <telservicesvariant.hrh>
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ---------------------------------------------------------------------------
+// CreateCallDivertingL
+// ---------------------------------------------------------------------------
+//
+MCallDiverting* CPSetCallDivertingCreator::CreateCallDivertingL(
+        MPsetDivertObserver& aObserver, 
+        RMobilePhone& aPhone,
+        CPsetCallDiverting* aDivert  )
+    {
+    if( IsDivertDualAffectFeatureEnabledL() )
+        {
+        return CPSetCallDivertingDualAffectImpl::NewL( aObserver, aPhone, aDivert );
+        }
+    else
+        {
+        return CPSetCallDivertingBasicImpl::NewL( aObserver, aPhone, aDivert );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// IsDivertDualAffectFeatureEnabledL
+// ---------------------------------------------------------------------------
+//
+TBool CPSetCallDivertingCreator::IsDivertDualAffectFeatureEnabledL()
+    {
+    TBool retValue(EFalse);
+    CPSetVariationProxy* variationProxy = 
+        CPSetVariationProxy::NewL( KCRUidTelSrvVariation, KTelSrvVariationFlags );
+    CleanupStack::PushL( variationProxy );
+    retValue = variationProxy->IsFeatureEnabled( KTelephonyLVFlagDivertDualAffect );
+    CleanupStack::PopAndDestroy( variationProxy );
+    return retValue; 
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/telephonysettings/src/psetcalldivertingdualaffectimpl.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,574 @@
+/*
+* 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 CPSetCallDivertingDualAffectImpl class.
+*
+*/
+
+
+// INCLUDE FILES
+#include "psetcalldivertingdualaffectimpl.h" 
+#include "psetsubscriberidcheck.h" 
+
+#include <badesca.h>
+#include <etelmm.h>
+#include <e32math.h>
+#include <e32svr.h>
+#include <featmgr.h>
+#include <centralrepository.h>
+#include <settingsinternalcrkeys.h> 
+
+#include "psetcalldiverting.h" 
+#include "psetcontainer.h" 
+#include "mpsetdivertobs.h" 
+#include "psettelephony.h" 
+#include "psetpanic.h" 
+#include "mpsetrequestobs.h" 
+#include "psetutility.h" 
+#include "phonesettingslogger.h" 
+#include "psetsaobserver.h" 
+
+//  LOCAL CONSTANTS AND MACROS
+_LIT( KPSetIntNbr, "+" );
+_LIT( KPSNameOfClass, "CPsetCallDiverting" );
+_LIT( KPhone, "Telephone" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPSetCallDivertingDualAffectImpl::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPSetCallDivertingDualAffectImpl* CPSetCallDivertingDualAffectImpl::NewL( 
+        MPsetDivertObserver& aObserver, 
+        RMobilePhone& aPhone,
+        CPsetCallDiverting* aDivert )
+    {
+    CPSetCallDivertingDualAffectImpl* self = new ( ELeave ) CPSetCallDivertingDualAffectImpl( aPhone, aDivert );
+    CleanupStack::PushL( self );
+    self->ConstructL( aObserver );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CPSetCallDivertingDualAffectImpl::~CPSetCallDivertingDualAffectImpl
+// ---------------------------------------------------------------------------
+//
+CPSetCallDivertingDualAffectImpl::~CPSetCallDivertingDualAffectImpl()
+    {
+    delete iIdCheck;
+    }
+
+// -----------------------------------------------------------------------------
+// CPSetCallDivertingDualAffectImpl::CPSetCallDivertingDualAffectImpl
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPSetCallDivertingDualAffectImpl::CPSetCallDivertingDualAffectImpl( 
+                    RMobilePhone& aPhone, CPsetCallDiverting* aDivert ) : 
+                    CPSetCallDivertingBase( aPhone, aDivert )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPSetCallDivertingDualAffectImpl::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CPSetCallDivertingDualAffectImpl::ConstructL( MPsetDivertObserver& aObserver )
+    {
+    CPSetCallDivertingBase::ConstructL( aObserver );
+    
+    iIdCheck = CPSetSubscriberIdCheck::NewL();
+    }
+
+// -----------------------------------------------------------------------------
+// CPSetCallDivertingDualAffectImpl::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CPSetCallDivertingDualAffectImpl::SetDivertingL( const TCallDivertSetting& aDivert,  TBasicServiceGroups aBsc )
+    { __PHSLOGSTRING("[PHS]--> CPSetCallDivertingDualAffectImpl::SetDivertingL");
+    __PHSLOGSTRING1("[PHS]    CPSetCallDivertingDualAffectImpl::SetDivertingL: aBsc: %d", aBsc );
+    if ( IsActive() )
+        {
+        User::Leave( KErrInUse );
+        } 
+    CPsetTelephony::CheckLineModeL( aDivert.iServiceGroup, &iPhone, iLine );
+    if ( !iLine->SubSessionHandle() )
+        {
+        User::Leave( KErrBadHandle );
+        }
+        
+    SetRequestStatus( EPSetChangeDivert );
+    iReason = PSetUtility::GetDivertReason ( aDivert.iCondition );
+    iVoiceDivert = SetVoiceDivert( aDivert, aBsc );
+
+    /* In case of SIM support dual activation and * -command has been issued from ALS 
+    * line 2 we need to change the SS service 
+    * code from SS_GSM_AUX_TELEPHONY to the SS_ALL_TELE_AND_BEARER 
+    * at SS_SERVICE_REQ -message.
+    */
+    if ( ( aBsc == EAllTeleAndBearer ) &&                // Command affects to both lines
+       ( iAls == ESSSettingsAlsAlternate ) &&            // Command given at ALS line 2
+       ( (RThread().Name()).Compare( KPhone ) == 0 ) &&  // *# -commands are given only from Phone thread
+       ( aDivert.iSetting != ECheckStatus ) &&           // Not interrogating
+       ( iIdCheck->DoesSIMSupportDualActivation() ) )    // Check SIM/IMSI
+        {
+        // Set iBsc to same value as aBsc so that correct alsValue 
+        // can be determined in GetSAAls() method.
+        iBsc = aBsc;
+        }
+    else
+        {
+        // Set iBsc to same value as aBsc so that correct alsValue 
+        // can be determined in GetSAAls() method.
+        iBsc = aBsc;
+        ValidateBsc( aBsc );
+        }
+
+    iPluralNotes = IsMultiAffectingDivert( aDivert, aBsc );
+
+    //Copy data to member variable
+    iChangeInfo.iNumber.iTelNumber.Copy( aDivert.iNumber );
+    iChangeInfo.iTimeout = KPSetDefaultDelayTimeValue;
+    if ( aBsc == EAltTele )
+        {
+        iChangeInfo.iServiceGroup = PSetUtility::VerifyAltLineUseL();
+        }
+    iChangeInfo.iServiceGroup = PSetUtility::ChangeToEtelInternal( aBsc ); 
+    iChangeInfo.iNumber.iNumberPlan = RMobilePhone::EIsdnNumberPlan;
+    iChangeInfo.iNumber.iTypeOfNumber = RMobilePhone::EUnknownNumber;
+    if ( iChangeInfo.iNumber.iTelNumber.Length() > 0 )
+        {
+        if ( iChangeInfo.iNumber.iTelNumber.Left(1) == KPSetIntNbr )
+            {
+            iChangeInfo.iNumber.iTypeOfNumber = 
+                RMobilePhone::EInternationalNumber;
+            }
+        }
+
+    switch ( aDivert.iSetting )
+        {
+        case ERegisterDiverting:
+            iChangeInfo.iAction = RMobilePhone::EServiceActionRegister;
+            iChangeInfo.iTimeout = aDivert.iNoReplyTimer;
+            __PHSLOGSTRING("[PHS]    CPSetCallDivertingDualAffectImpl::SetDivertingL: ERegisterDiverting" );
+            break;
+        case EEraseDiverting:
+            iChangeInfo.iAction = RMobilePhone::EServiceActionErase;
+            __PHSLOGSTRING("[PHS]    CPSetCallDivertingDualAffectImpl::SetDivertingL: EEraseDiverting" );
+            break;
+        case EActivateDiverting:
+            iChangeInfo.iAction = RMobilePhone::EServiceActionActivate;
+            iChangeInfo.iTimeout = aDivert.iNoReplyTimer;
+            __PHSLOGSTRING("[PHS]    CPSetCallDivertingDualAffectImpl::SetDivertingL: EActivateDiverting" );
+            break;
+        case ECancelDiverting:
+            iChangeInfo.iAction = RMobilePhone::EServiceActionDeactivate;
+            __PHSLOGSTRING("[PHS]    CPSetCallDivertingDualAffectImpl::SetDivertingL: ECancelDiverting" );
+            break;
+        default:
+            User::Leave( KErrArgument );
+            break;
+        }
+
+    //Start requesting for setting Divert.
+    iPhone.SetCallForwardingStatus( iStatus, iReason, iChangeInfo );
+    StartRequestingL( KPsetRequestAlreadySet );    
+    __PHSLOGSTRING("[PHS] <--CPSetCallDivertingDualAffectImpl::SetDivertingL" );
+   }
+
+// ---------------------------------------------------------------------------
+// RunL
+// ---------------------------------------------------------------------------
+//
+void CPSetCallDivertingDualAffectImpl::RunL()
+    {
+    __PHSLOGSTRING("[PHS]--> CPSetCallDivertingDualAffectImpl::RunL" );
+    
+    __ASSERT_ALWAYS( 
+        iObserver != NULL, Panic( KPSNameOfClass, ECDRequestPanicNoObserver ) );
+
+    //Hide requesting note - does not leave when deleting a note.
+    iObserver->SetEngineContact( iDivert );
+    iObserver->HandleCFRequestingL( EFalse, EFalse );
+
+    //Handle error case.
+    if ( iStatus != KErrNone )
+        {
+        iObserver->HandleDivertingErrorL( iStatus.Int() );
+        RequestCompleted( iStatus.Int() );
+        return;
+        }
+        
+    iDivertStatus.Initialize();
+    switch ( iCurrentReq )
+        {
+        case EPSetChangeDivert:
+            {
+            __PHSLOGSTRING("[PHS]--> CPSetCallDivertingDualAffectImpl::RunL: EPSetChangeDivert" );
+            //Notify Observer            
+            iDivertStatus.iStatus = PSetUtility::GetChangeInfoStatus( iChangeInfo.iAction );
+            
+             // Check is done because of VOIP notification functionality(PSetNotesUI).
+            if ( iVoiceDivert )
+                {
+                iDivertStatus.iServiceGroup = EServiceGroupVoice;
+                }
+            
+            iObserver->HandleDivertingChangedL( iDivertStatus, iPluralNotes );
+            
+            //Notify observer.
+            HandleSANotificationL( 
+                IsVMBXDivertL( iChangeInfo.iNumber.iTelNumber ), 
+                iDivertStatus.iStatus );
+            break;
+            }
+        case EPSetGetDivertStatus:
+            {
+            __PHSLOGSTRING("[PHS]--> CPSetCallDivertingDualAffectImpl::RunL: EPSetGetDivertStatus" );
+
+            CMobilePhoneCFList* cfList = iCfInterrogator->RetrieveListL();
+            CleanupStack::PushL( cfList );
+            CMobilePhoneCFList* cleanedList = CMobilePhoneCFList::NewL();            
+            CleanupStack::PushL( cleanedList );
+            
+            TInt numOfItems = cfList->Enumerate();
+            TInt index = 0;
+            RMobilePhone::TMobilePhoneCFInfoEntryV1 cfEntry;
+            RMobilePhone::TMobilePhoneCFInfoEntryV1 copy;
+            iDivertStatus.iStatus = EDivertingStatusNotRegistered;
+            while( index < numOfItems )
+                {
+                cfEntry = cfList->GetEntryL( index );
+                iBsc = PSetUtility::ChangeToGSM( cfEntry.iServiceGroup );
+
+                if ( cfEntry.iStatus == RMobilePhone::ECallForwardingStatusActive )
+                    {
+                    copy.iServiceGroup = cfEntry.iServiceGroup;
+                    copy.iCondition = cfEntry.iCondition;
+                    copy.iStatus = cfEntry.iStatus;
+                    copy.iNumber = cfEntry.iNumber;
+                    copy.iTimeout = cfEntry.iTimeout;
+                    cleanedList->AddEntryL( copy );
+                    }
+                 __PHSLOGSTRING1("[PHS] CPSetCallDivertingDualAffectImpl::RunL: EPSetGetDivertStatus     iBsc: %d", iBsc );
+                 __PHSLOGSTRING1("[PHS] CPSetCallDivertingDualAffectImpl::RunL: EPSetGetDivertStatus iStatus: %d", cfEntry.iStatus );
+                 
+                /* Basic Service Codes above were removed from "if" statement below because they would 
+                * cause divert indicator to appear with Data services. Dual activation SIM doesnt want to show 
+                * Divert indication for video service.*/                
+                if ( iBsc == EAllTeleAndBearer || iBsc == EAllTele || iBsc == ETelephony || iBsc == EAltTele )
+                    {
+                    // iVoiceDivert is set to true to ensure that the icons are updated in every case.
+                    iVoiceDivert = ETrue;
+                    if ( ( cfEntry.iStatus != RMobilePhone::ECallForwardingStatusNotRegistered )
+                        && ( cfEntry.iStatus != RMobilePhone::ECallForwardingStatusNotActive )
+                        && ( cfEntry.iStatus != RMobilePhone::ECallForwardingStatusNotProvisioned ) )
+                        {
+                        iDivertStatus.iStatus = EDivertingStatusActive;
+                        }
+                    else
+                        {
+                        iDivertStatus.iStatus = EDivertingStatusNotRegistered;
+                        }
+                    
+                    HandleSANotificationL( 
+                            IsVMBXDivertL( cfEntry.iNumber.iTelNumber ), 
+                            iDivertStatus.iStatus );
+                    }
+                index++;
+                }
+            if ( cleanedList->Enumerate() == 0 )
+                {
+                iObserver->HandleDivertingStatusL( *cfList, iPluralNotes );
+                }
+            else
+                {
+                iObserver->HandleDivertingStatusL( *cleanedList, iPluralNotes );
+                }
+            CleanupStack::PopAndDestroy( 2 ); //cleanedList, cfList
+            cfList = NULL;
+            cleanedList = NULL;
+            iCFStatusCheck = EFalse; 
+            break;
+            }
+        default:
+            Panic( KPSNameOfClass, ECDRequestPanicIncorrectRequest );
+            break;
+        } 
+    RequestCompleted( KErrNone );
+    __PHSLOGSTRING("[PHS] <--CPSetCallDivertingDualAffectImpl::RunL" );
+    }    
+
+// ---------------------------------------------------------------------------
+// DoCancel
+// ---------------------------------------------------------------------------
+//
+void CPSetCallDivertingDualAffectImpl::DoCancel()
+    {
+    __PHSLOGSTRING("[PHS]--> CPSetCallDivertingDualAffectImpl::DoCancel" );
+    //Decide which request to cancel.
+    switch( iCurrentReq )
+        {
+        case EPSetChangeDivert:
+            __PHSLOGSTRING("[PHS]   DoCancel - EPSetChangeDivert" );
+            iPhone.CancelAsyncRequest( EMobilePhoneSetCallForwardingStatus );
+            break;
+        case EPSetGetDivertStatus:
+            __PHSLOGSTRING("[PHS]   DoCancel - EPSetGetDivertStatus" );
+            iCfInterrogator->Cancel();
+            delete iCfInterrogator;
+            iCfInterrogator = NULL;
+            break;
+        default:
+            break;
+        }
+    
+    //Set current request to none.
+    iCurrentReq = EPSetNone;
+    iVoiceDivert = EFalse;
+    __PHSLOGSTRING("[PHS]<-- CPSetCallDivertingDualAffectImpl::DoCancel" );
+    }
+
+// -----------------------------------------------------------------------------
+// Called if RunL Leaves
+// -----------------------------------------------------------------------------
+//
+TInt CPSetCallDivertingDualAffectImpl::RunError( TInt aError )
+    {
+    __PHSLOGSTRING1("[PHS]--> CPSetCallDivertingDualAffectImpl::RunError aError: %d", aError );
+    if ( ( iCurrentReq == EPSetGetDivertStatus || iCurrentReq == EPSetChangeDivert)
+         && iVoiceDivert )
+        {
+        __PHSLOGSTRING("[PHS]   RunError - HandleSANotificationL" );
+        TRAP_IGNORE( HandleSANotificationL( EFalse, iDivertStatus.iStatus ) );
+        }
+        
+    if ( iCurrentReq == EPSetGetDivertStatus )
+        {
+        iCFStatusCheck = EFalse;
+        }   
+    aError = KErrNone;
+        
+    //Set current request to none.
+    iCurrentReq = EPSetNone;    
+    iVoiceDivert = EFalse;
+    __PHSLOGSTRING("[PHS]<-- CPSetCallDivertingDualAffectImpl::RunError" );
+    return aError;  
+    }
+
+// ---------------------------------------------------------------------------
+//  If unconditional voice divert is activated/cancelled, notifies observer, 
+//  so that it can set on/off indicators.
+// ---------------------------------------------------------------------------
+//
+void CPSetCallDivertingDualAffectImpl::HandleSANotificationL( 
+    TBool aVmbxDivert, TDivertingStatus& aCfStatus )
+    {
+    __PHSLOGSTRING2("[PHS]--> CPSetCallDivertingDualAffectImpl::HandleSANotificationL aVmbxDivert: %d, aCfStatus: %d", aVmbxDivert, aCfStatus );
+    TBool divertChanged = EFalse;
+    //If divert is not with voice, do not touch indicators.
+    if ( !iVoiceDivert )
+        {
+        return;
+        }
+
+    //Unconditional divert and all diverts
+    if ( iReason == RMobilePhone::ECallForwardingUnconditional ||
+        iReason == RMobilePhone::ECallForwardingAllCases )
+        {
+        if ( iCurrentReq == EPSetChangeDivert )
+            {
+            //show indicator if, activation/registration, else hide it
+            //these are probably incorrect....
+            divertChanged = 
+                ( iChangeInfo.iAction == RMobilePhone::EServiceActionRegister ||
+                  iChangeInfo.iAction == RMobilePhone::EServiceActionActivate);
+            }
+        else
+            {
+            //show indicator if status is activated, hide for cancelled.
+            divertChanged = ( aCfStatus == EDivertingStatusActive );
+            }
+        }
+    else
+        {
+        //if not unconditional, do not touch indicators.
+        return;
+        }
+        
+    CPsetSAObserver* systemObserver = CPsetSAObserver::NewL();
+    CleanupStack::PushL( systemObserver );
+    
+    TUnconditionalCFStatus status(KCFIndicatorUnknown);
+    
+    User::LeaveIfError( systemObserver->GetCurrentDivertStatus( status ) );
+    
+    // If used SIM support dual activation and ALS is supported then do the check for
+    // current divert information. 
+    if ( ( iIdCheck->DoesSIMSupportDualActivation()  ) && 
+         ( iAls != ( ENotSupportedLine ) ) ) 
+        {
+        SetCurrentDivertInformation( status, divertChanged );
+        }
+    
+    TCallDivertNotifySetting setting = CreateDivertNotifySetting(
+        status, divertChanged, aVmbxDivert, iBsc );
+    
+    // Notify observer that Diverts have changed.
+    systemObserver->NotifyDivertChange( GetSAAls(), 
+        setting,
+        -1 );
+        
+    CleanupStack::PopAndDestroy( systemObserver );
+    
+    __PHSLOGSTRING("[PHS] <--CPSetCallDivertingDualAffectImpl::HandleSANotificationL" );
+    }
+
+// ---------------------------------------------------------------------------
+// Sets current divert information if used used SIM supports dual activation.
+// ---------------------------------------------------------------------------
+//
+void CPSetCallDivertingDualAffectImpl::SetCurrentDivertInformation( 
+    TUnconditionalCFStatus& aStatus, 
+    const TBool aDivertChanged )
+    {
+    TUnconditionalCFStatus previousDivertStatus = aStatus;
+    TSelectedLine alsLine = GetSAAls();
+    
+    if (( iChangeInfo.iServiceGroup == RMobilePhone::EAllServices) &&    // - Service Code is All tele and bearer.
+        ( iCurrentReq == EPSetChangeDivert) && (                         // - Change divert command issued.
+        ( iReason == RMobilePhone::ECallForwardingUnconditional ) ||     // - CallForwardingCondition is: CFU or 
+        ( iReason == RMobilePhone::ECallForwardingAllCases ) )  )        // CFA.                                           
+        {
+        switch ( alsLine )
+            {
+            case EPrimaryLine:
+                {
+                if( aDivertChanged )     // ON
+                    {
+                    if(( previousDivertStatus == KCFNoCallsForwarded ) ||      // None/Line1 -> Line2 -> Both
+                       ( previousDivertStatus == ( KCFVoiceForwarded | KCFForwardedOnLine1 ) ))
+                        {
+                        aStatus = KCFForwardedOnLine2;
+                        }
+                    }
+                else                    // OFF
+                    {
+                    if(( previousDivertStatus == ( KCFVoiceForwarded | KCFForwardedOnLine1 | KCFForwardedOnLine2 ) ) ||  // Both/Line2 -> Line1 -> None
+                       ( previousDivertStatus == KCFForwardedOnLine2 ))
+                        {
+                        aStatus = static_cast<TUnconditionalCFStatus>( KCFVoiceForwarded | KCFForwardedOnLine1 );
+                        }
+                    }
+                break;
+                }
+
+            case EAuxiliaryLine:
+                {
+                if( aDivertChanged )     // ON
+                    {
+                    if(( previousDivertStatus == KCFNoCallsForwarded ) ||      // None/Line2 -> Line 1 -> Both
+                       ( previousDivertStatus == KCFForwardedOnLine2 ))
+                        {
+                        aStatus = static_cast<TUnconditionalCFStatus>( KCFVoiceForwarded | KCFForwardedOnLine1 );
+                        }
+                    }
+                else                    // OFF
+                    {
+                    if(( previousDivertStatus == ( KCFVoiceForwarded | KCFForwardedOnLine1 | KCFForwardedOnLine2 ) ) ||  // Both/Line1 -> Line 2 -> None
+                       ( previousDivertStatus == ( KCFVoiceForwarded | KCFForwardedOnLine1 ) ))
+                        {
+                        aStatus = KCFForwardedOnLine2;
+                        }
+                    }
+                break;
+                }
+
+            default:
+                break;
+            }
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// Returns ETrue if divert operation is to voice or to all operations.
+// ---------------------------------------------------------------------------
+//
+TBool CPSetCallDivertingDualAffectImpl::SetVoiceDivert( 
+        const TCallDivertSetting& aDivert,
+        const TBasicServiceGroups /*aBsc*/ )
+    {
+    TBool retValue(EFalse);
+    if ( aDivert.iServiceGroup == EServiceGroupVoice ||
+         aDivert.iServiceGroup == EServiceGroupAllTeleservices)
+        {
+        retValue = ETrue;
+        }
+    return retValue;
+    }
+
+// ---------------------------------------------------------------------------
+// Gets Als information.
+// ---------------------------------------------------------------------------
+//
+TSelectedLine CPSetCallDivertingDualAffectImpl::GetSAAls()
+    {
+    __PHSLOGSTRING("[PHS]--> CPSetCallDivertingDualAffectImpl::GetSAAls" );
+    __PHSLOGSTRING2("[PHS] iAls: %d iBsc: %d", iAls, iBsc  );
+    TSelectedLine alsValue = ENotSupportedLine;
+    switch ( iAls )
+        {
+        case ESSSettingsAlsNotSupported:
+            alsValue = ENotSupportedLine;
+            break;
+        case ESSSettingsAlsPrimary:
+            iChangeInfo.iServiceGroup == RMobilePhone::EAuxVoiceService 
+                ? ( alsValue = EAuxiliaryLine )  
+                : ( alsValue = EPrimaryLine );
+            break;
+        case ESSSettingsAlsAlternate:
+            iChangeInfo.iServiceGroup == RMobilePhone::EAuxVoiceService 
+                ? ( alsValue = EAuxiliaryLine )  
+                : ( alsValue = EPrimaryLine );
+            break;
+        default:
+            alsValue = ENotSupportedLine;
+            break;
+        }
+    
+    // If user checks/activates divert to line which is not selected currently than we have
+    // to change returned alsvalue accordinly, if this is not done divert icon status is updated to wrong status.
+    // Example case: Line 2 active user activates divert to line 1: **21*phonenumber*11#.
+    if ( iBsc == EAltTele && iAls == ESSSettingsAlsPrimary )
+        {
+        __PHSLOGSTRING("[PHS]    CPSetCallDivertingDualAffectImpl::GetSAAls - Line 2 divert activation/check from Line 1" );
+        alsValue = EAuxiliaryLine;
+        }
+    else if ( iBsc == ETelephony && iAls == ESSSettingsAlsAlternate )
+        {
+        __PHSLOGSTRING("[PHS]    CPSetCallDivertingDualAffectImpl::GetSAAls - Line 1 divert activation/check from Line 2" );
+        alsValue = EPrimaryLine;
+        }
+    
+    __PHSLOGSTRING1("[PHS]    CPSetCallDivertingDualAffectImpl::GetSAAls: alsValue: %d", alsValue );
+    __PHSLOGSTRING("[PHS] <--CPSetCallDivertingDualAffectImpl::GetSAAls" );
+    return alsValue;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/telephonysettings/src/psetcallwaiting.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,495 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CPsetCallWaiting is call waiting SS setting abstraction.
+*
+*
+*/
+
+
+//  Include Files
+#include "psetcallwaiting.h" 
+#include "mpsetcallwaitingobs.h" 
+#include "nwdefs.h"             
+#include "psetpanic.h" 
+#include "psetconstants.h" 
+#include "mpsetrequestobs.h" 
+#include "psetutility.h" 
+#include "phonesettingslogger.h" 
+
+#include "psetvariationproxy.h" 
+#include <settingsinternalcrkeys.h> 
+
+// CONSTANTS    
+_LIT( KPSNameOfClass, "CPsetCallWaiting" );
+
+//  MEMBER FUNCTIONS
+// ---------------------------------------------------------------------------
+// 
+// Symbian OS 1st phase constructor.
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPsetCallWaiting* CPsetCallWaiting::NewL( 
+    RMobilePhone& aPhone, MPsetCallWaitingObserver& aObserver )
+    {
+    CPsetCallWaiting* self = new ( ELeave ) CPsetCallWaiting( aPhone );  
+    CleanupStack::PushL( self );
+    self->ConstructL(aObserver);
+    CleanupStack::Pop( self );         
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// 2nd phase constructor.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetCallWaiting::ConstructL(MPsetCallWaitingObserver& aObserver)
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetCallWaiting::ConstructL" );
+    this->SetPsuiObserver( aObserver );
+    
+    //Check which line is used, or if ALS is not active.
+    TInt usedLine = ESSSettingsAlsNotSupported;
+
+    iSsSettings = new (ELeave) RSSSettings;
+    User::LeaveIfError( iSsSettings->Open() );
+    TRAPD( err, iSsSettings->Register( ESSSettingsAls, *this ) );
+    if ( err == KErrNone )
+        {
+        iSsSettings->Get( ESSSettingsAls, usedLine );
+        }
+        
+    CPSetVariationProxy* variationProxy = 
+        CPSetVariationProxy::NewL( KCRUidPhoneSettings, KPSetCallWaiting );
+    CleanupStack::PushL( variationProxy );
+    iCallWaitingDistinquishEnabled = variationProxy->IsFeatureEnabled( KCallWaitingDistiquishNotProvisioned );
+    CleanupStack::PopAndDestroy( variationProxy );
+
+    iAls = static_cast <TSSSettingsAlsValue> ( usedLine );
+    __PHSLOGSTRING1("[PHS]    CPsetCallWaiting::ConstructL: usedLine: %d", usedLine );
+    __PHSLOGSTRING("[PHS] <--CPsetCallWaiting::ConstructL" );
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// C++ constructor.
+// 
+// ---------------------------------------------------------------------------
+//
+CPsetCallWaiting::CPsetCallWaiting( RMobilePhone& aPhone) 
+                : CActive( EPriorityStandard ),
+                  iPhone ( aPhone )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Destructor
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPsetCallWaiting::~CPsetCallWaiting()
+    {
+    Cancel();
+    iReqObserver = NULL;
+
+    if ( iSsSettings )
+        {
+        iSsSettings->Cancel( ESSSettingsAls, *this ); 
+        iSsSettings->Close();
+        }
+    delete iSsSettings;
+    iSsSettings = NULL;
+    
+    delete iCwInterrogator;
+    iCwInterrogator = NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// If SsSettings notifies of settings change, copy new value to member variable.
+// 
+// ---------------------------------------------------------------------------
+void CPsetCallWaiting::PhoneSettingChanged( TSSSettingsSetting aSetting, TInt aNewValue )
+    {
+    __PHSLOGSTRING("[PHS]--> PhoneSettingChanged::ValidateBsc" );
+    if ( aSetting == ESSSettingsAls )
+        {
+        iAls = static_cast <TSSSettingsAlsValue> (aNewValue);
+        }
+    __PHSLOGSTRING("[PHS] <--PhoneSettingChanged::ValidateBsc" );
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Validates used bsc, if EUnknown, updates to real value
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetCallWaiting::ValidateBsc( TBasicServiceGroups& aBsc )
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetCallWaiting::ValidateBsc" );
+    if ( aBsc == EUnknown )
+    // if bsc is unknown, update it
+        {
+        if ( iAls == ESSSettingsAlsAlternate )
+            {
+            aBsc = EAltTele;
+            }
+        else
+            {
+            aBsc = ETelephony;
+            }
+        }    
+    else
+    // If no specific line is indicated
+        {
+        if ( aBsc == EAllTeleAndBearer || aBsc == EAllTele )
+            {
+            // if ALS is used, use 89 bsc
+            if ( iAls == ESSSettingsAlsAlternate )
+                {
+                aBsc = EAltTele;
+                }
+            }
+        }
+    __PHSLOGSTRING("[PHS] <--CPsetCallWaiting::ValidateBsc" );
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Sets call waiting.
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPsetCallWaiting::SetCallWaitingL
+    ( TSetCallWaiting aSetting, TBasicServiceGroups aBsc )
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetCallWaiting::SetCallWaitingL");
+    if ( IsActive() )
+        {
+        User::Leave( KErrInUse );
+        }
+    /*****************************************************
+    *    Series 60 Customer / ETel
+    *    Series 60  ETel API
+    *****************************************************/
+    RMobilePhone::TMobilePhoneServiceAction cwAction = 
+        RMobilePhone::EServiceActionUnspecified;
+    
+    RMobilePhone::TMobileService cwBasicServiceGroup;
+
+    ValidateBsc( aBsc );
+
+    if ( aBsc == EAltTele )
+        {
+        cwBasicServiceGroup = PSetUtility::VerifyAltLineUseL();
+        }
+
+    cwBasicServiceGroup = PSetUtility::ChangeToEtelInternal( aBsc );
+
+    if ( aSetting == EActivateCallWaiting )
+        {
+        cwAction = RMobilePhone::EServiceActionActivate;
+        }
+    else 
+        {
+        cwAction = RMobilePhone::EServiceActionDeactivate;
+        }
+
+    //Copy data to member variables.
+    iSetValue = aSetting;
+
+    //Start requesting for setting CW.
+    iPhone.SetCallWaitingStatus( iStatus, cwBasicServiceGroup, cwAction);
+
+    SetActive();
+    SetRequestStatus( EPSetServiceRequestSetCallWaiting );
+
+    //Set PSUI so that correct observer is used and show requesting note.
+    CleanupLeavePushL();
+    iObserver->SetEngineContact( *this );
+    iObserver->HandleCWRequestingL( ETrue, EFalse );
+    CleanupStack::Pop();
+    __PHSLOGSTRING("[PHS] <--CPsetCallWaiting::SetCallWaitingL");
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Requests call waiting status.
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPsetCallWaiting::GetCallWaitingStatusL()
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetCallWaiting::GetCallWaitingStatusL");
+    if ( IsActive() )
+        {
+        User::Leave( KErrInUse );
+        }    
+
+    SetRequestStatus( EPSetServiceRequestGetCallWaitingStatus );
+
+    //Start requesting for CW status.
+    iCwInterrogator = CRetrieveMobilePhoneCWList::NewL( iPhone );
+    iCwInterrogator->Start( iStatus );
+    
+    SetActive();
+
+    //Set PSUI so that correct observer is used and show requesting note.
+    CleanupLeavePushL();
+    iObserver->SetEngineContact( *this );
+    iObserver->HandleCWRequestingL( ETrue, EFalse );
+    CleanupStack::Pop(); //CleanupLeavePushL
+    __PHSLOGSTRING("[PHS] <--CPsetCallWaiting::GetCallWaitingStatusL");
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Cancel process.
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CPsetCallWaiting::CancelProcess()
+    {
+    // Set PSUI so that correct observer is used and hide requesting note.
+    // When interrupting a note, does not leave.
+    // This needs to be done first, since notes must be cleared from screen
+    // even though request is not active.
+    iObserver->SetEngineContact( *this );
+    // Does not leave
+    TRAPD( err, iObserver->HandleCWRequestingL( EFalse, ETrue ) );
+    
+    if ( !IsActive() || err != KErrNone )
+        {
+        return KErrGeneral;
+        }            
+    Cancel();
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets request observer.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPsetCallWaiting::SetRequestObserver( MPsetRequestObserver* aObs )
+    {
+    iReqObserver = aObs;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Run active object.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetCallWaiting::RunL()
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetCallWaiting::RunL");
+
+    __ASSERT_ALWAYS( iObserver, Panic( KPSNameOfClass, ECWPanicNoObserver ) );
+
+    // Set PSUI so that correct observer is used and hide requesting note.
+    // does not leave when deleting a note.
+    iObserver->SetEngineContact( *this );
+    iObserver->HandleCWRequestingL( EFalse, EFalse );
+
+    if ( iStatus != KErrNone )
+        {
+        iObserver->HandleCWErrorL( iStatus.Int() );
+        RequestCompleted( iStatus.Int() );
+        return;
+        } 
+
+    TUint8 arrayOfBsc[KPSetNumberOfBsc];
+    switch ( iServiceRequest )
+        {
+        case EPSetServiceRequestGetCallWaitingStatus:
+            {
+            __PHSLOGSTRING("[PHS]    CPsetCallWaiting::RunL: EPSetServiceRequestGetCallWaitingStatus");
+            CMobilePhoneCWList* cwStatusList = iCwInterrogator->RetrieveListL();
+            CleanupStack::PushL( cwStatusList );
+            TGetCallWaitingStatus status = EStatusUnknown;
+
+            /*****************************************************
+            *    Series 60 Customer / ETel
+            *    Series 60  ETel API
+            *****************************************************/
+            RMobilePhone::TMobilePhoneCWInfoEntryV1 cwInfo;
+            TInt entries = cwStatusList->Enumerate();
+            TInt i = 0;
+            while ( entries > i)
+                {
+                cwInfo = cwStatusList->GetEntryL( i );
+                if ( cwInfo.iStatus == RMobilePhone::ECallWaitingStatusActive )
+                    {
+                    status = TGetCallWaitingStatus( cwInfo.iStatus );
+                    }
+                    
+                if ( iCallWaitingDistinquishEnabled && status == EStatusUnknown 
+                    && cwInfo.iStatus != RMobilePhone::ECallWaitingStatusUnknown )
+                    {
+                    // pass on the status if the current status is still 
+                    // unknown and the received status is not unknown
+                    switch ( cwInfo.iStatus )
+                        {
+                        case RMobilePhone::ECallWaitingStatusNotProvisioned:
+                            {
+                            status = EStatusNotProvisioned;
+                            break;
+                            }   
+                            
+                            case RMobilePhone::ECallWaitingStatusNotAvailable:
+                            {       
+                            status = EStatusNotAvailable;
+                            break;
+                            }
+                            
+                            default:
+                            {   
+                            status = TGetCallWaitingStatus( cwInfo.iStatus );
+                            break;      
+                            }
+                        }
+                    }
+                    
+                arrayOfBsc[i] = static_cast <TUint8> 
+                    ( PSetUtility::ChangeToGSM( cwInfo.iServiceGroup ) );
+                i++;                                                                
+                }
+            arrayOfBsc[i++] = KPSetUnusedValue;
+            CleanupStack::PopAndDestroy( cwStatusList );
+            iObserver->SetEngineContact( *this );
+            iObserver->HandleCallWaitingGetStatusL( status, arrayOfBsc );
+            }
+            break;
+        case EPSetServiceRequestSetCallWaiting:
+            __PHSLOGSTRING("[PHS]    CPsetCallWaiting::RunL: EPSetServiceRequestSetCallWaiting");
+            // Set PSUI so that correct observer is used and show note.
+            iObserver->SetEngineContact( *this );
+            iObserver->HandleCallWaitingChangedL( iSetValue, iStatus.Int() );
+            break;
+        default:
+            Panic( KPSNameOfClass, ECWPanicInvalidRequestMode );
+        }
+    RequestCompleted( KErrNone );
+    
+    __PHSLOGSTRING("[PHS] <--CPsetCallWaiting::RunL");
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Cancels active object.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetCallWaiting::DoCancel()
+    {    
+    switch ( iServiceRequest )
+        {
+        case EPSetServiceRequestGetCallWaitingStatus:
+            iCwInterrogator->Cancel();
+            delete iCwInterrogator;
+            iCwInterrogator = NULL;
+            break;
+        case EPSetServiceRequestSetCallWaiting:
+            iPhone.CancelAsyncRequest( EMobilePhoneSetCallWaitingStatus );
+            break;
+        default:
+            break;
+        } 
+    SetRequestStatus( EPSetServiceRequestNone );
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Sets observer (member variable)
+//  
+// ---------------------------------------------------------------------------
+//
+void CPsetCallWaiting::SetPsuiObserver( MPsetCallWaitingObserver& aObserver )
+    {
+    iObserver = &aObserver;
+    iObserver->SetEngineContact( *this );
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Push object into cleanupstack to catch leaving.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetCallWaiting::CleanupLeavePushL()
+      {
+      CleanupStack::PushL( TCleanupItem( DoHandleLeave, this ) );
+      }
+
+// ---------------------------------------------------------------------------
+// 
+// Object has caused a leave.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetCallWaiting::DoHandleLeave( TAny* aAny )
+      {
+      REINTERPRET_CAST( CPsetCallWaiting*, aAny )->HandleLeave();
+      }
+
+// ---------------------------------------------------------------------------
+// 
+// Things to do when leave occurs.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetCallWaiting::HandleLeave()
+    {
+    CancelProcess();
+    }
+
+// ---------------------------------------------------------------------------
+// Inform the request observer that request has been completed.
+// ---------------------------------------------------------------------------
+//
+void CPsetCallWaiting::RequestCompleted( const TInt& aError )
+    {
+    if ( aError != KErrNone )
+        {
+        SetRequestStatus( static_cast <TPSetServiceRequest> (aError) );
+        }
+    SetRequestStatus( EPSetServiceRequestNone );
+
+    if ( iReqObserver )
+        {
+        iReqObserver->RequestComplete(); 
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Update the request status - both internally and to observers.
+// ---------------------------------------------------------------------------
+//
+void CPsetCallWaiting::SetRequestStatus( TPSetServiceRequest aStatus )
+    {
+    iServiceRequest = aStatus;
+    if ( iReqObserver )
+        {
+        iReqObserver->RequestStatusChanged( aStatus );
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/telephonysettings/src/psetcli.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,412 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CPsetCli is provides calling line identification SS.
+*
+*
+*/
+
+
+//INCLUDE FILES
+#include "psetcli.h" 
+#include "psetpanic.h" 
+#include "psetconstants.h" 
+#include "mpsetrequestobs.h" 
+#include <bldvariant.hrh>
+#include <featmgr.h>
+
+// CONSTANTS    
+_LIT( KPSNameOfClass, "CPsetCli" );
+
+//  MEMBER FUNCTIONS
+// ---------------------------------------------------------------------------
+// Symbian OS 1st phase Constructor.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPsetCli* CPsetCli::NewL( RMobilePhone& aPhone, MPsetCliObserver& aObserver )
+    {
+    CPsetCli* self = new ( ELeave ) CPsetCli( aPhone );
+    CleanupStack::PushL( self );
+    // Sets up TLS, must be done before FeatureManager is used.
+    FeatureManager::InitializeLibL();
+    CleanupStack::Pop( self );
+    self->SetObserver( aObserver );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPsetCli::~CPsetCli()
+    {
+    // Remove FeatureManager
+    FeatureManager::UnInitializeLib();
+    Cancel();
+    iReqObserver = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// C++ Constructor.
+// ---------------------------------------------------------------------------
+//
+CPsetCli::CPsetCli( RMobilePhone& aPhone ) : CActive( EPriorityStandard ),
+iPhone( aPhone )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// Cancels all requests.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPsetCli::CancelAll()
+    {
+    // Set PSUI so that correct observer is used and hide requesting note.
+    // When interrupting a note, does not leave.
+    // This needs to be done first, since notes must be cleared from screen
+    // even though request is not active.
+    iObserver->SetEngineContact( this );
+    TRAPD( ignore, iObserver->HandleCliRequestingL( EFalse, ETrue ) );
+    // Line below fixes armv5 warning.
+    ignore = ignore;
+    
+    if ( !IsActive() )
+        {
+        return;
+        }    
+    
+    Cancel();
+    }
+
+// ---------------------------------------------------------------------------
+// Requests for COLP mode.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPsetCli::GetColpModeL()
+    {
+    /*****************************************************
+    *    Series 60 Customer / ETel
+    *    Series 60  ETel API
+    *****************************************************/
+    IssueRequestL( RMobilePhone::EIdServiceConnectedPresentation );
+    }
+
+// ---------------------------------------------------------------------------
+// Requests for CLIP mode.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPsetCli::GetClipModeL()
+    {
+    /*****************************************************
+    *    Series 60 Customer / ETel
+    *    Series 60  ETel API
+    *****************************************************/
+    IssueRequestL( RMobilePhone::EIdServiceCallerPresentation );
+    }
+
+// ---------------------------------------------------------------------------
+// Requests for COLP mode.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPsetCli::GetClirModeL()
+    {
+    /*****************************************************
+    *    Series 60 Customer / ETel
+    *    Series 60  ETel API
+    *****************************************************/
+    IssueRequestL( RMobilePhone::EIdServiceCallerRestriction );
+    }
+
+// ---------------------------------------------------------------------------
+// Requests for COLR mode.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPsetCli::GetColrModeL()
+    {
+    /*****************************************************
+    *    Series 60 Customer / ETel
+    *    Series 60  ETel API
+    *****************************************************/
+    IssueRequestL( RMobilePhone::EIdServiceConnectedRestriction );
+    }
+
+// ---------------------------------------------------------------------------
+// Sets request observer.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPsetCli::SetRequestObserver( MPsetRequestObserver* aObs )
+    {
+    iReqObserver = aObs;
+    }
+
+// ---------------------------------------------------------------------------
+// Make request to get CNAP status
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPsetCli::GetCnapL()
+    {
+    if ( FeatureManager::FeatureSupported( KFeatureIdPhoneCnap ) )
+        {
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        IssueRequestL( RMobilePhone::EIdServiceCallerName );
+        }
+    }
+
+//---------------------------------------------------------------------------
+// Handles completed request. 
+// 
+//---------------------------------------------------------------------------
+//
+void CPsetCli::RunL()
+    {
+    __ASSERT_ALWAYS( iObserver, Panic( KPSNameOfClass, ECliNoObserver ) );
+    TBool commonNotes = ETrue;
+    
+    //Hide requesting note - does not leave when deleting a note.
+    iObserver->SetEngineContact( this );
+    iObserver->HandleCliRequestingL( EFalse, EFalse );
+    if ( iStatus != KErrNone )
+        {
+        iObserver->HandleCliErrorL( iStatus.Int() );
+        RequestCompleted( iStatus.Int() );        
+        return;
+        }
+    
+    TPsuiCli type = EPsuiCliUnknown; 
+    
+    switch ( iRequestedService )
+        {
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        case RMobilePhone::EIdServiceConnectedRestriction:
+            switch ( iServiceStatus )
+                {
+                case RMobilePhone::EIdServiceActivePermanent:
+                    type = EPsuiColrOn;
+                    break;
+                case RMobilePhone::EIdServiceNotProvisioned:
+                    type = EPsuiColrOff;
+                    break;
+                case RMobilePhone::EIdServiceUnknown:
+                    type = EPsuiCliUnknown;
+                    break;
+                default:
+                    break;
+                }
+            break;
+        case RMobilePhone::EIdServiceConnectedPresentation:
+            switch ( iServiceStatus )
+                
+                {
+                case RMobilePhone::EIdServiceActivePermanent:
+                    type = EPsuiColpOn;
+                    break;
+                case RMobilePhone::EIdServiceNotProvisioned:
+                    type = EPsuiColpOff;
+                    break;
+                case RMobilePhone::EIdServiceUnknown:
+                    type = EPsuiCliUnknown;
+                    break;
+                default:
+                    break;
+                }
+            break;
+        case RMobilePhone::EIdServiceCallerRestriction:
+            switch ( iServiceStatus )
+            
+                {
+                case RMobilePhone::EIdServiceActivePermanent:                
+                case RMobilePhone::EIdServiceActiveDefaultRestricted:
+                    type = EPsuiClirOn;
+                    break;
+                case RMobilePhone::EIdServiceActiveDefaultAllowed:
+                case RMobilePhone::EIdServiceNotProvisioned:
+                    type = EPsuiClirOff;
+                    break;
+                case RMobilePhone::EIdServiceUnknown:
+                    type = EPsuiCliUnknown;
+                    break;
+                default:
+                    break;
+                }
+            break;
+        case RMobilePhone::EIdServiceCallerPresentation:
+            switch ( iServiceStatus )
+                {
+                case RMobilePhone::EIdServiceActivePermanent:
+                    type = EPsuiClipOn;
+                    break;
+                case RMobilePhone::EIdServiceNotProvisioned:
+                    type = EPsuiClipOff;
+                    break;
+                case RMobilePhone::EIdServiceUnknown:
+                    type = EPsuiCliUnknown;
+                    break;
+                default:
+                    break;
+                }
+            break;
+        case RMobilePhone::EIdServiceCallerName:
+            commonNotes = EFalse;
+            iObserver->HandleCnapStatusL( iServiceStatus );
+            break;
+        default:
+            Panic( KPSNameOfClass, ECliParameter );
+            break;
+        } 
+
+    if ( commonNotes )
+        {
+        iObserver->CliInformationL( type );
+        }    
+    RequestCompleted( KErrNone );
+    }
+
+// ---------------------------------------------------------------------------
+// Cancels pending request.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetCli::DoCancel()
+    {
+    if ( !IsActive() )
+        {
+        return;
+        }
+    switch ( iRequestedService )
+        {
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        case RMobilePhone::EIdServiceConnectedRestriction:
+        case RMobilePhone::EIdServiceConnectedPresentation:
+        case RMobilePhone::EIdServiceCallerRestriction:
+        case RMobilePhone::EIdServiceCallerPresentation:
+        case RMobilePhone::EIdServiceCallerName:
+            iPhone.CancelAsyncRequest( EMobilePhoneGetIdentityServiceStatus );
+            break;
+        default:
+            break;            
+        }
+    SetRequestStatus( RMobilePhone::EIdServiceUnspecified );
+    }
+
+// ---------------------------------------------------------------------------
+// Sets observer.
+// ---------------------------------------------------------------------------
+//
+void CPsetCli::SetObserver( MPsetCliObserver& aObserver )
+    {
+    iObserver = &aObserver;
+    iObserver->SetEngineContact( this );
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Push object into cleanupstack to catch leaving.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetCli::CleanupLeavePushL()
+    {
+    CleanupStack::PushL( TCleanupItem( DoHandleLeave, this ) );
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Things to do when leave occurs.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetCli::HandleLeave()
+    {
+    CancelAll();
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Object has caused a leave.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetCli::DoHandleLeave( TAny* aAny )
+    {
+    REINTERPRET_CAST( CPsetCli*, aAny )->HandleLeave();
+    }
+
+// ---------------------------------------------------------------------------
+// Inform the request observer that request has been completed.
+// ---------------------------------------------------------------------------
+//
+void CPsetCli::RequestCompleted( const TInt& aError )
+    {
+    if ( aError != KErrNone )
+        {
+        SetRequestStatus( 
+            static_cast <RMobilePhone::TMobilePhoneIdService> (aError) );
+        }
+    SetRequestStatus( RMobilePhone::EIdServiceUnspecified );
+    
+    if ( iReqObserver )
+        {
+        iReqObserver->RequestComplete(); 
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Issues pre-defined request.
+// ---------------------------------------------------------------------------
+//
+void CPsetCli::IssueRequestL( RMobilePhone::TMobilePhoneIdService aService ) 
+    {    
+    if ( IsActive() )
+        {
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        User::Leave( KErrGeneral );
+        }    
+    SetRequestStatus( aService );
+       
+    iPhone.GetIdentityServiceStatus( iStatus, aService, iServiceStatus );    
+    SetActive();
+    
+    // Set PSUI so that correct observer is used and show note.
+    iObserver->SetEngineContact( this );
+    CleanupLeavePushL();    
+    iObserver->HandleCliRequestingL( ETrue, EFalse );
+    CleanupStack::Pop(); // CleanupCancelPushL
+    }
+
+// ---------------------------------------------------------------------------
+// Update the request status - both internally and to observers.
+// ---------------------------------------------------------------------------
+//
+void CPsetCli::SetRequestStatus( RMobilePhone::TMobilePhoneIdService aStatus )
+    {
+    iRequestedService = aStatus;
+    if ( iReqObserver )
+        {
+        iReqObserver->RequestStatusChanged( aStatus );
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/telephonysettings/src/psetcontainer.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,234 @@
+/*
+* 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: 
+*      CPsetContainer is the general access class for phonesettings.
+*      Container must exists as long as PS objects are used.          
+*
+*
+*/
+
+
+// INCLUDES
+#include    "psetcontainer.h" 
+#include    "psetconstants.h" 
+#include    "psetrefreshhandlerimpl.h" 
+#include    <mmtsy_names.h>
+
+// ---------------------------------------------------------------------------
+// 
+// Creates Call Waiting object
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPsetCallWaiting* CPsetContainer::CreateCWObjectL(
+    MPsetCallWaitingObserver& aObserver )
+    {
+    return CPsetCallWaiting::NewL( iPhone, aObserver );
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Creates Diverting object
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPsetCallDiverting* CPsetContainer::CreateCFObjectL( 
+    MPsetDivertObserver& aObserver )
+    {
+    return CPsetCallDiverting::NewL( aObserver, iPhone );
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Creates CLI object
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPsetCli* CPsetContainer::CreateCliObjectL( 
+    MPsetCliObserver& aObserver )
+    {
+    return CPsetCli::NewL( iPhone, aObserver );
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Creates Call Barring object
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPsetCallBarring* CPsetContainer::CreateCBObjectL( 
+    MPsetBarringObserver& aObserver )
+    {
+    return CPsetCallBarring::NewL( aObserver, iPhone );
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Creates Network object
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPsetNetwork* CPsetContainer::CreateNetworkObjectL( 
+    MPsetNetworkInfoObserver& aObserver )
+    {
+    return CPsetNetwork::NewL( iPhone, aObserver );
+    }
+
+
+// -----------------------------------------------------------------------------
+// 
+// Creates Refresh Handler object
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CPSetRefreshHandler* CPsetContainer::CreateRefreshHandlerL()
+    {
+    return CPSetRefreshHandlerImpl::NewL(); 
+    }
+
+
+// ---------------------------------------------------------------------------
+// 
+// Connects to ETEL telephony server and initialises phone, 
+// line and event monitors.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetContainer::ConstructL()
+    {
+    /*****************************************************
+    *    Series 60 Customer / ETel
+    *    Series 60  ETel API
+    *****************************************************/
+    User::LeaveIfError( ConnectServer() );
+    
+    User::LeaveIfError( 
+        iServer.SetExtendedErrorGranularity( RTelServer::EErrorExtended ) );
+    
+    TInt numPhones;
+    
+    User::LeaveIfError( iServer.EnumeratePhones( numPhones ) );
+    if ( !numPhones )
+        {
+        User::Leave( KErrGeneral );
+        }
+    
+    //match phone name to correct one
+    RTelServer::TPhoneInfo phoneInfo;
+    TName matchTsyName;
+    TInt i = 0;
+    for ( ; i < numPhones; i++ )
+        {
+        User::LeaveIfError( iServer.GetTsyName( i, matchTsyName ) );
+        if    ( matchTsyName.CompareF( KMmTsyModuleName ) == 0 )
+            {            
+            User::LeaveIfError( iServer.GetPhoneInfo( i, phoneInfo ) );
+            break;
+            }
+        }
+    if ( i == numPhones )
+        {
+        User::Leave( KErrGeneral );
+        }
+    
+    //open phone subsession
+    User::LeaveIfError( iPhone.Open( iServer, phoneInfo.iName ) ); 
+    
+    // Open line - line is opened using phone and name is specified,
+    User::LeaveIfError( iLine.Open( iPhone, KMmTsyVoice1LineName ) );
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Connects to Etel and loads Tsy module
+// 
+// ---------------------------------------------------------------------------
+//
+TInt CPsetContainer::ConnectServer()
+    {   
+    TInt err = KErrNone;
+    for ( TInt a = 0 ; a < KPSetRetryCount ; a++ )
+        {
+        err = iServer.Connect();
+        
+        if ( err == KErrNone )
+            {
+            break;
+            }
+        
+        User::After( KPSetRetryTimeout );
+        }
+    
+    if ( err != KErrNone )
+        {
+        return err;
+        }
+    else
+        {    
+        // Access the phone
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        /*****************************************************
+        *    Series 60 Customer / TSY
+        *    Needs customer TSY implementation
+        *****************************************************/
+        return iServer.LoadPhoneModule( KMmTsyModuleName );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// destructor
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPsetContainer::~CPsetContainer()
+    {
+    // Close line.
+    iLine.Close();
+    iPhone.Close();    
+    iServer.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Symbian OS 2-phase constructor
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPsetContainer* CPsetContainer::NewL()                
+    {
+    CPsetContainer* self = new( ELeave ) CPsetContainer;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// 
+// Creates Network object for Network Mode observer
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPsetNetwork* CPsetContainer::CreateNetworkModeObjectL(
+            MPsetNetworkModeObserver& aModeObserver )
+    {
+    return CPsetNetwork::NewL( iPhone, aModeObserver );
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/telephonysettings/src/psetcsp.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,315 @@
+/*
+* 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: 
+*      Customer Service Profile wrapper layer for SsSettings. 
+*      PsetCustomerServiceProfile is a class that access CSP through
+*      SSsettings. It is in Phone Settings to provide easier access 
+*      to CSP values. Whole class should only be used if CSP is supported.                                                         
+*
+*
+*/
+
+
+//INCLUDE FILES
+#include "psetcsp.h" 
+#include <etelmm.h>
+#include "phonesettingslogger.h" 
+
+//  MEMBER FUNCTIONS
+// ---------------------------------------------------------------------------
+// 
+// Symbian OS 1st phase constructor.
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPsetCustomerServiceProfile* CPsetCustomerServiceProfile::NewL()
+    {
+    CPsetCustomerServiceProfile* self = new ( ELeave ) CPsetCustomerServiceProfile();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Destructor
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPsetCustomerServiceProfile::~CPsetCustomerServiceProfile()
+    {
+    //If GS has failed to create CSP due to low memory, check it.
+    if ( iCsp )
+        {
+        iCsp->Close();
+        }
+    delete iCsp;
+    iCsp = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Checks if Call Waiting is to be supported.
+// 
+// ---------------------------------------------------------------------------
+// 
+EXPORT_C TInt CPsetCustomerServiceProfile::IsCWSupported( TBool& aSupport )
+    {
+    /*****************************************************
+    *    Series 60 Customer / ETel
+    *    Series 60  ETel API
+    *****************************************************/
+    __PHSLOGSTRING("[PHS]--> CPsetCustomerServiceProfile::IsCWSupported");
+    RMobilePhone::TCspCallCompletion params;    
+    TInt retVal = iCsp->CspCallCompletion( params );
+    aSupport = EFalse;
+
+    //if bit7 is 1, call waiting is not available through CSP
+    if ( retVal == KErrNone )
+        {
+        aSupport = CheckIfCWSupported( params );
+        }
+
+    __PHSLOGSTRING1("[PHS]   CPsetCustomerServiceProfile::IsCWSupported: aSupport: %d", aSupport);
+    __PHSLOGSTRING("[PHS] <--CPsetCustomerServiceProfile::IsCWSupported");
+    return retVal;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Checks if Call Barring is to be supported.
+// 
+// ---------------------------------------------------------------------------
+// 
+EXPORT_C TInt CPsetCustomerServiceProfile::IsCBSupported( TBool& aSupport )
+    {
+    /*****************************************************
+    *    Series 60 Customer / ETel
+    *    Series 60  ETel API
+    *****************************************************/
+    __PHSLOGSTRING("[PHS]--> CPsetCustomerServiceProfile::IsCBSupported");
+    RMobilePhone::TCspCallRestriction params;
+    TInt retVal = iCsp->CspCallRestriction( params );    
+    aSupport = EFalse;
+
+    //if params more than 1, barring is available through CSP
+    if ( retVal == KErrNone )
+        {
+        aSupport = CheckIfCBSupported( params );
+        }
+
+    __PHSLOGSTRING1("[PHS]   CPsetCustomerServiceProfile::IsCBSupported: aSupport: %d", aSupport);
+    __PHSLOGSTRING("[PHS] <--CPsetCustomerServiceProfile::IsCBSupported");
+    return retVal;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Checks if Call Forwarding is to be supported.
+// 
+// ---------------------------------------------------------------------------
+// 
+EXPORT_C TInt CPsetCustomerServiceProfile::IsCFSupported( TBool& aSupport )
+    {
+    /*****************************************************
+    *    Series 60 Customer / ETel
+    *    Series 60  ETel API
+    *****************************************************/
+    __PHSLOGSTRING("[PHS]--> CPsetCustomerServiceProfile::IsCFSupported");
+    RMobilePhone::TCspCallOffering params;
+    TInt retVal = iCsp->CspCallOffering( params );
+    aSupport = EFalse;
+
+    //if all of first five bits are 1, divert is available through CSP
+    if ( retVal == KErrNone )
+        {
+        aSupport = CheckIfCFSupported( params );
+        }
+
+    __PHSLOGSTRING1("[PHS]   CPsetCustomerServiceProfile::IsCFSupported: aSupport: %d", aSupport);
+    __PHSLOGSTRING("[PHS] <--CPsetCustomerServiceProfile::IsCFSupported");
+    return retVal;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Checks if Alternate Line is to be supported.
+// 
+// ---------------------------------------------------------------------------
+// 
+EXPORT_C TInt CPsetCustomerServiceProfile::IsALSSupported( TBool& aSupport )
+    {
+    /*****************************************************
+    *    Series 60 Customer / ETel
+    *    Series 60  ETel API
+    *****************************************************/
+    __PHSLOGSTRING("[PHS]--> CPsetCustomerServiceProfile::IsALSSupported");
+    RMobilePhone::TCspCPHSTeleservices params;
+    TInt retVal = iCsp->CspCPHSTeleservices( params );
+    aSupport = EFalse;
+
+    if ( retVal == KErrNone )
+        {
+        aSupport = CheckIfAlsSupported( params );
+        }
+
+    __PHSLOGSTRING1("[PHS]   CPsetCustomerServiceProfile::IsALSSupported: aSupport: %d", aSupport);
+    __PHSLOGSTRING("[PHS] <--CPsetCustomerServiceProfile::IsALSSupported");
+    return retVal;
+    }
+
+
+// ---------------------------------------------------------------------------
+// 
+// Open CSP from SIM.
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CPsetCustomerServiceProfile::OpenCSProfileL()
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetCustomerServiceProfile::OpenCSProfileL");
+    if ( !iCsp )
+        {
+        iCsp = new (ELeave) RCustomerServiceProfileCache;    
+        }
+    TInt error = iCsp->Open();
+
+    __PHSLOGSTRING1("[PHS]   CPsetCustomerServiceProfile::OpenCSProfileL: error: %d", error);
+    __PHSLOGSTRING("[PHS] <--CPsetCustomerServiceProfile::OpenCSProfileL");
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Checks if Manual Network Selection is to be supported.
+// 
+// ---------------------------------------------------------------------------
+// 
+EXPORT_C TInt CPsetCustomerServiceProfile::IsNetworkSelectionSupported( 
+    TBool& aSupport )
+    {
+    /*****************************************************
+    *    Series 60 Customer / ETel
+    *    Series 60  ETel API
+    *****************************************************/
+    __PHSLOGSTRING("[PHS]--> CPsetCustomerServiceProfile::IsNetworkSelectionSupported");
+    RMobilePhone::TCspValueAdded params;
+    TInt retVal = iCsp->CspCPHSValueAddedServices( params );
+    aSupport = EFalse;
+
+    if ( retVal == KErrNone )
+        {
+        aSupport = CheckIfNetworkSelectionSupported( params );
+        }
+
+    __PHSLOGSTRING1("[PHS]   CPsetCustomerServiceProfile::IsNetworkSelectionSupported: aSupport: %d", aSupport);
+    __PHSLOGSTRING("[PHS] <--CPsetCustomerServiceProfile::IsNetworkSelectionSupported");
+    return  retVal;
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CPsetCustomerServiceProfile::CheckIfCWSupported
+// 
+// 
+// ---------------------------------------------------------------------------
+// 
+TBool CPsetCustomerServiceProfile::CheckIfCWSupported(
+    const RMobilePhone::TCspCallCompletion aContainer ) const
+    {
+    return IsSupported( aContainer, RMobilePhone::KCspCW );
+    }
+
+// ---------------------------------------------------------------------------
+// CPsetCustomerServiceProfile::CheckIfCBSupported
+// 
+// 
+// ---------------------------------------------------------------------------
+// 
+TBool CPsetCustomerServiceProfile::CheckIfCBSupported(
+    const RMobilePhone::TCspCallRestriction aContainer ) const
+    {
+    return ( 
+        IsSupported( aContainer, RMobilePhone::KCspBICRoam )||
+        IsSupported( aContainer, RMobilePhone::KCspBAIC ) ||
+        IsSupported( aContainer, RMobilePhone::KCspBOICexHC ) ||
+        IsSupported( aContainer, RMobilePhone::KCspBOIC ) ||
+        IsSupported( aContainer, RMobilePhone::KCspBOAC ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CPsetCustomerServiceProfile::CheckIfCFSupported
+// 
+// 
+// ---------------------------------------------------------------------------
+// 
+TBool CPsetCustomerServiceProfile::CheckIfCFSupported(
+    const RMobilePhone::TCspCallOffering aContainer ) const
+    {
+    return ( 
+        IsSupported( aContainer, RMobilePhone::KCspCFU )   ||
+        IsSupported( aContainer, RMobilePhone::KCspCFB )   ||
+        IsSupported( aContainer, RMobilePhone::KCspCFNRc ) ||
+        IsSupported( aContainer, RMobilePhone::KCspCFNRy ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CPsetCustomerServiceProfile::CheckIfAlsSupported
+// 
+// 
+// ---------------------------------------------------------------------------
+// 
+TBool CPsetCustomerServiceProfile::CheckIfAlsSupported(
+    const RMobilePhone::TCspCPHSTeleservices aContainer ) const
+    {
+    return IsSupported( aContainer, RMobilePhone::KCspALS );
+    }
+
+// ---------------------------------------------------------------------------
+// CPsetCustomerServiceProfile::CheckIfNetworkSelectionSupported
+// 
+// 
+// ---------------------------------------------------------------------------
+// 
+TBool CPsetCustomerServiceProfile::CheckIfNetworkSelectionSupported(
+    const RMobilePhone::TCspValueAdded aContainer ) const
+    {
+    return IsSupported( aContainer, RMobilePhone::KCspPLMNMode );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPsetCustomerServiceProfile::IsSupported
+// 
+// 
+// ---------------------------------------------------------------------------
+// 
+TBool CPsetCustomerServiceProfile::IsSupported(
+    const TInt aContainer,
+    const TInt aFeature ) const
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetCustomerServiceProfile::IsSupported");
+    TBool supported = EFalse;
+
+    if ( ( aContainer & aFeature ) != 0 )
+        {
+        supported = ETrue;
+        }
+
+    __PHSLOGSTRING1("[PHS]   CPsetCustomerServiceProfile::IsSupported: supported: %d", supported);
+    __PHSLOGSTRING("[PHS] <--CPsetCustomerServiceProfile::IsSupported");
+    return supported;
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/telephonysettings/src/psetnetwork.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,717 @@
+/*
+* 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:  CPsetNetwork selects network and gets network information.
+*
+*
+*/
+
+
+//  INCLUDE FILES
+#include "mpsetnetworkinfoobs.h" 
+#include "psetnetwork.h" 
+#include "psetsaobserver.h" 
+#include "psetpanic.h" 
+#include "psetconstants.h" 
+#include "mpsetnetworkselect.h" 
+#include <etelmm.h>
+#include <mmretrieve.h>
+#include <rmmcustomapi.h>
+
+#include <e32svr.h>
+#include "phonesettingslogger.h" 
+
+//  LOCAL CONSTANTS AND MACROS  
+_LIT( KPSNameOfClass, "CPsetNetwork" );
+
+enum TActiveObserver
+    {
+    ENetSelectObserver,
+    ENetModeObserver
+    };
+
+//  MEMBER FUNCTIONS
+//=============================================================================
+// ---------------------------------------------------------------------------
+// 
+// 1st phase constructor.
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPsetNetwork* CPsetNetwork::NewL( RMobilePhone& aPhone, 
+    MPsetNetworkInfoObserver& aObserver )
+    {
+    CPsetNetwork* self = new ( ELeave ) CPsetNetwork( aPhone );
+    CleanupStack::PushL( self );
+    self->ConstructL( aObserver );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// 
+// 1st phase constructor for net mode observer.
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPsetNetwork* CPsetNetwork::NewL( RMobilePhone& aPhone, 
+                       MPsetNetworkModeObserver& aModeObserver )
+    {
+    CPsetNetwork* self = new ( ELeave ) CPsetNetwork( aPhone );
+    CleanupStack::PushL( self );
+    self->ConstructL( aModeObserver );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// 
+// Destructor.
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPsetNetwork::~CPsetNetwork()
+    {
+    Cancel();
+    iCustomPhone.Close();
+    delete iNetworkRetrieve;
+    iNetworkRetrieve = NULL;
+    delete iSAObserver;
+    iSAObserver = NULL;    
+    } 
+
+// ---------------------------------------------------------------------------
+// 
+// Returns available networks
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPsetNetwork::GetAvailableNetworksL()
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetNetwork::GetAvailableNetworksL");
+    if ( IsActive() )
+        {
+        User::Leave( KErrInUse );
+        }
+
+    if ( iNetworkRetrieve )
+        {
+        delete iNetworkRetrieve;
+        iNetworkRetrieve = NULL;
+        }
+    
+    // Start to request for network information.
+    iNetworkRetrieve = CRetrieveMobilePhoneDetectedNetworks::NewL( iPhone );
+    iNetworkRetrieve->StartV2( iStatus );    
+    iServiceRequest = MPsetNetworkInfoObserver::EServiceRequestGetNetworkInfo;
+    SetActive();
+    
+    // Show searching note.
+    CleanupLeavePushL();
+    iObserver->HandleSearchingNetworksL( iServiceRequest );
+    CleanupStack::Pop(); // CleanupCancelPushL
+    __PHSLOGSTRING("[PHS] <--CPsetNetwork::GetAvailableNetworksL");
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Returns information of the currently selected network.
+// DEPRECATED.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CPsetNetwork::GetCurrentNetworkInfo
+                ( MPsetNetworkSelect::TCurrentNetworkInfo& /*aInfo*/ )
+    {
+    return KErrNotSupported;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Retrieve current search mode (automatic or manual)
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CPsetNetwork::GetNetworkSelectMode( TSelectMode& aMode )
+    {
+    /*****************************************************
+    *    Series 60 Customer / ETel
+    *    Series 60  ETel API
+    *****************************************************/
+    RMobilePhone::TMobilePhoneNetworkSelectionV1 setMode;
+    RMobilePhone::TMobilePhoneNetworkSelectionV1Pckg setModePckg( setMode );
+    
+    __PHSLOGSTRING("[PHS]--> CPsetNetwork::GetNetworkSelectMode");
+
+    TInt res( iPhone.GetNetworkSelectionSetting( setModePckg ) );
+    
+    if ( res == KErrNone )
+        {
+        if ( setMode.iMethod == RMobilePhone::ENetworkSelectionAutomatic )
+            {
+            aMode = ENetSelectModeAutomatic;
+            }
+        else
+            {
+            aMode = ENetSelectModeManual;
+            }
+        iTempNetInfo.iMode = aMode;
+        }
+    __PHSLOGSTRING("[PHS] <--CPsetNetwork::GetNetworkSelectMode");
+    return res;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Starts using the indicated network.
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPsetNetwork::SelectNetworkL( const TNetworkInfo& aInfo )
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetNetwork::SelectNetworkL");
+    if ( IsActive() )
+        {
+        User::Leave( KErrInUse );
+        }    
+
+    //Save previous network mode.
+    TBool previousModeAutomatic = EFalse;
+    if ( iTempNetInfo.iMode == ENetSelectModeAutomatic )
+        {
+        previousModeAutomatic = ETrue;
+        }
+    iTempNetInfo = aInfo;
+
+    /*****************************************************
+    *    Series 60 Customer / ETel
+    *    Series 60  ETel API
+    *****************************************************/
+    if ( aInfo.iMode == ENetSelectModeManual )
+        {        
+        //Copy data to member variables and make a request.
+        iNwInfo.iCountry.Append( aInfo.iId.iCountryCode );
+        __PHSLOGSTRING1("[PHS]   CPsetNetwork::SelectNetworkL: Manual - CountryCode: %S", &aInfo.iId.iCountryCode);
+
+        iNwInfo.iNetwork.Append( aInfo.iId.iNetworkCode );        
+        __PHSLOGSTRING1("[PHS]   CPsetNetwork::SelectNetworkL: Manual - NetworkCode: %S", &aInfo.iId.iNetworkCode);
+
+        iServiceRequest = MPsetNetworkInfoObserver::EServiceRequestSetNetwork;
+        iPhone.SelectNetwork( iStatus, ETrue, iNwInfo );
+        }
+    else
+        {
+        iServiceRequest = 
+            MPsetNetworkInfoObserver::EServiceRequestSetNetworkAutomatic;
+        //If previously automatic, and now automatic, issue request
+        // to search networks.
+        if ( previousModeAutomatic )
+            {
+            iNwInfo.iCountry.Append( aInfo.iId.iCountryCode );            
+            __PHSLOGSTRING1("[PHS]   CPsetNetwork::SelectNetworkL: Auto - CountryCode: %S", &aInfo.iId.iCountryCode);
+
+            iNwInfo.iNetwork.Append( aInfo.iId.iNetworkCode );
+            __PHSLOGSTRING1("[PHS]   CPsetNetwork::SelectNetworkL: Auto - NetworkCode: %S", &aInfo.iId.iNetworkCode);
+
+            iPhone.SelectNetwork( iStatus, EFalse, iNwInfo );
+            }
+        // make new selection without Network/Country code this way device 
+        // connects automatically home network.
+        else
+            {    
+            iNwInfo.iCountry = KNullDesC;
+            iNwInfo.iNetwork = KNullDesC;
+            __PHSLOGSTRING("[PHS]   CPsetNetwork::SelectNetworkL: Manual>Auto - CountryCode = KNullDesC");
+            __PHSLOGSTRING("[PHS]   CPsetNetwork::SelectNetworkL: Manual>Auto - NetworkCode = KNullDesC");
+            iPhone.SelectNetwork( iStatus, EFalse, iNwInfo );
+            }
+        }    
+    SetActive();
+    
+    //Show requesting note.
+    CleanupLeavePushL();    
+    if ( aInfo.iMode == ENetSelectModeManual )
+        {
+        __PHSLOGSTRING("[PHS]--> CPsetNetwork::SelectNetworkL: Requesting Selected N/W");
+        iObserver->HandleRequestingSelectedNetworkL( ETrue );
+        }
+    else
+        {
+        __PHSLOGSTRING("[PHS]--> CPsetNetwork::SelectNetworkL: Searching N/Ws");
+        iObserver->HandleSearchingNetworksL( iServiceRequest );
+        }    
+    CleanupStack::Pop(); // CleanupCancelPushL
+    __PHSLOGSTRING("[PHS] <--CPsetNetwork::SelectNetworkL");
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Running the active object
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetNetwork::RunL()
+    {
+    __PHSLOGSTRING1("[PHS]--> CPsetNetwork::RunL() - iStatus = %d", iStatus.Int());
+
+    MPsetNetworkInfoObserver::TServiceRequest serviceRequest = iServiceRequest;
+    MPsetNetworkModeObserver::TServiceRequest modeRequest = iModeRequest;
+
+    // Params have to be cleared here since the observer may initiate another asynchronous operation immediately
+    // after they are notified, effectively messing up the state machine which controls the logic in DoCancel()
+    // resulting in a possible dead lock when CActive::Cancel()'s User::WaitForRequest( iStatus ) never gets signaled.
+    ClearParams();
+    
+    if ( iActiveObserver == ENetSelectObserver && iObserver )
+        {
+        __ASSERT_ALWAYS( iObserver, Panic( KPSNameOfClass, ENetNoObserver ) );
+        HideRequestNoteL();
+        }
+    else if ( iActiveObserver == ENetModeObserver && iNetworkModeObserver )
+        {        
+        __ASSERT_ALWAYS( iNetworkModeObserver, 
+                     Panic( KPSNameOfClass, ENetNoNetworkObserver  ) );
+        }
+        
+    if ( iStatus != KErrNone )
+        {
+        if ( modeRequest == 
+              MPsetNetworkModeObserver::EServiceRequestSetSelectedNetworkMode || 
+             modeRequest == 
+              MPsetNetworkModeObserver::EServiceRequestGetCurrentNetworkMode )
+            {
+            __PHSLOGSTRING("[PHS]--> CPsetNetwork::RunL: Request is modeRequest");
+            //PSetNetworkModeObs
+            iNetworkModeObserver->HandleNetworkErrorL( modeRequest, iStatus.Int() );
+            }
+        else
+            {
+            __PHSLOGSTRING("[PHS]--> CPsetNetwork::RunL: Request is serviceRequest");
+            //PSetNetworkInfoObs
+            GetRegistrationStatusL();
+            iObserver->HandleNetworkErrorL( serviceRequest, iStatus.Int() );
+            }
+        } 
+    else // Request completed successfully.
+        {
+        switch ( serviceRequest )
+            {
+            case MPsetNetworkInfoObserver::EServiceRequestGetNetworkInfo:
+                {
+                CNetworkInfoArray* array = new ( ELeave ) 
+                    CNetworkInfoArray( KPSetNetworkInfoArrayGranularity );
+                CleanupStack::PushL( array );
+
+                CMobilePhoneNetworkListV2* results = 
+                    iNetworkRetrieve->RetrieveListV2L();
+                CleanupStack::PushL( results );
+                TInt amount = results->Enumerate();
+                __PHSLOGSTRING1("[PHS]   CPsetNetwork::RunL: amount: %d", amount);
+                TInt i = 0;
+                /*****************************************************
+                *    Series 60 Customer / ETel
+                *    Series 60  ETel API
+                *****************************************************/
+                RMobilePhone::TMobilePhoneNetworkInfoV2 nwNames;
+                while ( amount > i ) 
+                    {
+                    nwNames = results->GetEntryL( i );
+                    iTempNetInfo.iId.iCountryCode.Copy( nwNames.iCountryCode );
+                    __PHSLOGSTRING1("[PHS]   CPsetNetwork::RunL: CountryCode: %S", &iTempNetInfo.iId.iCountryCode);
+
+                    iTempNetInfo.iId.iNetworkCode.Copy( nwNames.iNetworkId );
+                    __PHSLOGSTRING1("[PHS]   CPsetNetwork::RunL: NetworkCode: %S", &iTempNetInfo.iId.iNetworkCode);
+                    
+                    iTempNetInfo.iStatus = (MPsetNetworkSelect::TNetworkStatus)nwNames.iStatus;
+                    __PHSLOGSTRING1("[PHS]   CPsetNetwork::RunL: Status: %d", &iTempNetInfo.iStatus);
+
+                    iTempNetInfo.iLongName.Copy( nwNames.iLongName );
+                    __PHSLOGSTRING1("[PHS]   CPsetNetwork::RunL: LongName: %S", &iTempNetInfo.iLongName);
+
+                    iTempNetInfo.iShortName.Copy( nwNames.iShortName );
+                    __PHSLOGSTRING1("[PHS]   CPsetNetwork::RunL: ShortName: %S", &iTempNetInfo.iShortName);
+
+                    if ( nwNames.iAccess == RMobilePhone::ENetworkAccessUtran )
+                        {
+                        iTempNetInfo.iAccess = ENetNetworkWCDMA;
+                        }
+                    else if ( nwNames.iAccess == RMobilePhone::ENetworkAccessGsmAndUtran )
+                        {
+                        iTempNetInfo.iAccess = ENetNetworkGSMandWCDMA;
+                        }
+                    else
+                        {
+                        iTempNetInfo.iAccess = ENetNetworkGSM;
+                        }
+                    array->AppendL( iTempNetInfo );
+                    i++;       
+                    }
+                CleanupStack::PopAndDestroy( results );
+                results = NULL;
+                __PHSLOGSTRING1("[PHS]   CPsetNetwork::RunL: Count: %d", array->Count());
+                iObserver->HandleNetworkInfoReceivedL( array, KErrNone );
+                CleanupStack::PopAndDestroy( array );
+                array = NULL;
+                break;        
+                }
+            case MPsetNetworkInfoObserver::EServiceRequestSetNetwork:
+                {
+                __PHSLOGSTRING("[PHS]   CPsetNetwork::RunL: EServiceRequestSetNetwork");
+                GetRegistrationStatusL();
+                iObserver->HandleNetworkChangedL( iTempNetInfo,
+                    iRegStatus, KErrNone );
+                break;
+                }
+            default:
+                break;
+            }
+
+        //check if this is correct
+        switch ( modeRequest )
+            {
+            case MPsetNetworkModeObserver::EServiceRequestSetSelectedNetworkMode:
+                __PHSLOGSTRING("[PHS]   CPsetNetwork::RunL: EServiceRequestSetSelectedNetworkMode");
+                iNetworkModeObserver->HandleNetworkSystemModeEventsL( 
+                                                       modeRequest,
+                                                       iNetworkModeCaps );
+                break;
+            case MPsetNetworkModeObserver::EServiceRequestGetCurrentNetworkMode:
+                __PHSLOGSTRING("[PHS]   CPsetNetwork::RunL: EServiceRequestGetCurrentNetworkMode");
+                iNetworkModeObserver->HandleNetworkSystemModeEventsL( 
+                                                       modeRequest,
+                                                       iNetworkModeCaps );
+                break;            
+            default:
+                break;
+            }
+        }
+    __PHSLOGSTRING("[PHS] <--CPsetNetwork::RunL");
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Cancels pending request
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetNetwork::DoCancel()
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetNetwork::DoCancel");
+    switch ( iServiceRequest )
+        {
+        case MPsetNetworkInfoObserver::EServiceRequestGetNetworkInfo:
+            iNetworkRetrieve->Cancel();
+            delete iNetworkRetrieve;
+            iNetworkRetrieve = NULL;
+            break;
+        case MPsetNetworkInfoObserver::EServiceRequestSetNetwork:
+        case MPsetNetworkInfoObserver::EServiceRequestSetNetworkAutomatic:
+            iPhone.CancelAsyncRequest( EMobilePhoneSelectNetwork );
+            break;
+        default:            
+            break;
+        }
+
+    switch ( iModeRequest )
+        {
+        case MPsetNetworkModeObserver::EServiceRequestSetSelectedNetworkMode:
+            iCustomPhone.CancelAsyncRequest( ECustomSetSystemNetworkModeIPC );
+            break;
+        case MPsetNetworkModeObserver::EServiceRequestGetCurrentNetworkMode:
+            __PHSLOGSTRING("[PHS]--> CPsetNetwork::EServiceRequestGetCurrentNetworkMode");
+            iCustomPhone.CancelAsyncRequest( 
+                ECustomGetCurrentSystemNetworkModesIPC );
+            __PHSLOGSTRING("[PHS]--> CPsetNetwork::EServiceRequestGetCurrentNetworkMode 2");
+            break;
+        default:
+            break;
+        }
+
+    ClearParams();
+    __PHSLOGSTRING("[PHS] <--CPsetNetwork::DoCancel");
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Cancels current request
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPsetNetwork::CancelProcess()
+    {
+    if ( !IsActive() )
+        {
+        //if not active, might mean that network list is shown, 
+        // but call is incoming do not leave or raise error.
+        }
+    
+    Cancel();
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Sets observer (Observer starts to listen again if reset).
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPsetNetwork::SetNetSAObserver( MPsetNetworkInfoObserver& aObserver )
+    {
+    __ASSERT_ALWAYS( iSAObserver, Panic( KPSNameOfClass, ENetNoObserver ) );
+    iSAObserver->SetNetObserver( aObserver );
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Adds this to scheduler
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetNetwork::ConstructL( MPsetNetworkInfoObserver& aObserver )
+    {
+    iObserver = &aObserver;
+    iActiveObserver = ENetSelectObserver;
+    /*****************************************************
+    *    Series 60 Customer / ETel
+    *    Series 60  ETel API
+    *****************************************************/
+    iRegStatus = RMobilePhone::ERegistrationUnknown;
+    User::LeaveIfError( iCustomPhone.Open( iPhone ) );
+    
+    iSAObserver = CPsetSAObserver::NewL();
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Adds this to scheduler
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetNetwork::ConstructL( MPsetNetworkModeObserver& aModeObserver )
+    {
+    iNetworkModeObserver = &aModeObserver;
+    iActiveObserver = ENetModeObserver;
+    /*****************************************************
+    *    Series 60 Customer / ETel
+    *    Series 60  ETel API
+    *****************************************************/
+    User::LeaveIfError( iCustomPhone.Open( iPhone ) );
+    
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// C++ constructor.
+// 
+// ---------------------------------------------------------------------------
+//
+CPsetNetwork::CPsetNetwork
+                ( RMobilePhone& aPhone ) : CActive( EPriorityStandard ),
+                                           iPhone ( aPhone )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Gets registration status.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetNetwork::GetRegistrationStatusL()
+    {
+    TRequestStatus status;
+    iPhone.GetNetworkRegistrationStatus( status, iRegStatus );
+    __PHSLOGSTRING1("[PHS]   CPsetNetwork::GetRegistrationStatusL: iRegStatus: %d", iRegStatus);
+    User::WaitForRequest( status );
+    User::LeaveIfError(status.Int());
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Requests SAObserver to check if call is active.
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CPsetNetwork::IsCallActive()
+    {
+    return iSAObserver->IsCallActive();
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Requests SAObserver to check if gprs connection is active.
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CPsetNetwork::IsGPRSConnected()
+    {
+    return iSAObserver->IsGPRSConnected();
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Requests ETEL to Reset back to the previously used network.
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CPsetNetwork::ResetNetworkSearch()
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetNetwork::ResetNetworkSearch");
+    RMmCustomAPI customApi;
+    TInt error = customApi.Open( iPhone );
+    if  (error == KErrNone)
+        {
+        customApi.ResetNetServer();
+        }
+    customApi.Close();
+
+    __PHSLOGSTRING("[PHS] <--CPsetNetwork::ResetNetworkSearch");
+    //for compatibility reasons returns a value
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Hides requesting note (either type). Cannot leave, since only deletes notes.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetNetwork::HideRequestNoteL()
+    {
+    // Hide requesting note, when interrupting a note, does not leave.
+    if ( iServiceRequest == 
+        MPsetNetworkInfoObserver::EServiceRequestGetNetworkInfo )
+        {
+        iObserver->HandleSearchingNetworksL( // Does not leave
+            MPsetNetworkInfoObserver::EServiceRequestNone ); 
+        }
+    else //may cause unnecessary call to hide non-existing note
+        {
+        iObserver->HandleRequestingSelectedNetworkL( EFalse ); // Does not leave
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Push object into cleanupstack to catch leaving.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetNetwork::CleanupLeavePushL()
+    {
+    CleanupStack::PushL( TCleanupItem( DoHandleLeave, this ) );
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Object has caused a leave.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetNetwork::DoHandleLeave( TAny* aAny )
+    {
+    REINTERPRET_CAST( CPsetNetwork*, aAny )->HandleLeave();
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Things to do when leave occurs.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetNetwork::HandleLeave()
+    {
+    CancelProcess();
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Clears member variables
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetNetwork::ClearParams()
+    {
+    iNwInfo.iCountry = KNullDesC;
+    iNwInfo.iNetwork = KNullDesC;
+    iServiceRequest = MPsetNetworkInfoObserver::EServiceRequestNone;
+    iModeRequest = MPsetNetworkModeObserver::EServiceRequestNone;
+    }
+
+
+// ---------------------------------------------------------------------------
+// 
+// Sets the network mode observer for communication.
+// This method is called from CGSSettListNetView class.
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPsetNetwork::SetNetworkModeObserver( MPsetNetworkModeObserver& 
+                                                    aObserver )
+    {
+    iNetworkModeObserver = &aObserver;
+    }
+
+
+// ---------------------------------------------------------------------------
+// 
+// Sets the currently selected network access mode (GSM/UMTS/DualMode).
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPsetNetwork::SetNetworkModeSelectionL( TUint32& aNetworkMode )
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetNetwork::SetNetworkModeSelectionL");
+
+    if ( IsActive() )
+        {
+        User::Leave( KErrInUse );
+        }
+
+    iModeRequest = 
+        MPsetNetworkModeObserver::EServiceRequestSetSelectedNetworkMode;
+    iCustomPhone.SetSystemNetworkMode( iStatus, 
+                 static_cast<RMmCustomAPI::TNetworkModeCaps>( aNetworkMode ) );
+    SetActive();
+
+    __PHSLOGSTRING("[PHS] <--CPsetNetwork::SetNetworkModeSelectionL");
+    }
+
+
+// ---------------------------------------------------------------------------
+// 
+// Gets the currently selected network access mode (GSM/UMTS/DualMode).
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPsetNetwork::GetCurrentNetworkModeSelectionL()
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetNetwork::GetCurrentNetworkModeSelectionL");
+
+    if ( IsActive() )
+        {
+        User::Leave( KErrInUse );
+        }
+
+    iModeRequest = 
+        MPsetNetworkModeObserver::EServiceRequestGetCurrentNetworkMode;
+    iCustomPhone.GetCurrentSystemNetworkModes( iStatus, iNetworkModeCaps );
+    SetActive();
+
+    __PHSLOGSTRING("[PHS] <--CPsetNetwork::GetCurrentNetworkModeSelectionL");
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/telephonysettings/src/psetrefreshhandlerimpl.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,284 @@
+/*
+* Copyright (c) 2004-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:  The Refresh handler to inform refresses.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "psetrefreshhandlerimpl.h" 
+#include    <etelmm.h>
+#include    <msssettingsrefreshhandler.h>
+#include    <csssettingsrefreshcontainer.h>
+#include    <psetcsp.h> 
+#include    "phonesettingslogger.h" 
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPSetRefreshHandlerImpl::CPSetRefreshHandlerImpl
+// 
+// C++ constructor can NOT contain any code, that might leave.
+// -----------------------------------------------------------------------------
+//
+CPSetRefreshHandlerImpl::CPSetRefreshHandlerImpl()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPSetRefreshHandlerImpl::ConstructL
+// 
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CPSetRefreshHandlerImpl::ConstructL()
+    {
+    __PHSLOGSTRING("[PHS]--> CPSetRefreshHandlerImpl::ConstructL");
+    iCsp = CPsetCustomerServiceProfile::NewL();
+
+    iSSSetRefContainer = CSSSettingsRefreshContainer::NewL();
+    iSSSetRefHandler = &iSSSetRefContainer->RefreshHandler();
+    __PHSLOGSTRING("[PHS] <--CPSetRefreshHandlerImpl::ConstructL");
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPSetRefreshHandlerImpl::NewL
+// 
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPSetRefreshHandlerImpl* CPSetRefreshHandlerImpl::NewL()
+    {
+    CPSetRefreshHandlerImpl* self = new( ELeave ) CPSetRefreshHandlerImpl;
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPSetRefreshHandlerImpl::~CPSetRefreshHandlerImpl
+// 
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CPSetRefreshHandlerImpl::~CPSetRefreshHandlerImpl()
+    {
+    iObserver = NULL;
+
+    iSSSetRefHandler = NULL;
+    delete iSSSetRefContainer;
+    iSSSetRefContainer = NULL;
+
+    delete iCsp;
+    iCsp = NULL;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPSetRefreshHandlerImpl::NotifyFileChangeL
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+void CPSetRefreshHandlerImpl::NotifyFileChangeL(
+    MSSSettingsRefreshObserver& aObserver,
+    TSatElementaryFiles aObservedFiles,
+    TSatRefreshType aObservedRefreshType )
+    {
+    __PHSLOGSTRING("[PHS]--> CPSetRefreshHandlerImpl::NotifyFileChangeL");
+    iObserver = &aObserver;
+
+    iSSSetRefHandler->NotifyFileChangeL(
+        *this,
+        aObservedFiles,
+        aObservedRefreshType );
+    __PHSLOGSTRING("[PHS] <--CPSetRefreshHandlerImpl::NotifyFileChangeL");
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPSetRefreshHandlerImpl::CancelNotify
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+void CPSetRefreshHandlerImpl::CancelNotify()
+    {
+    iObserver = NULL;
+
+    iSSSetRefHandler->CancelNotify();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPSetRefreshHandlerImpl::ChangedCspSettings
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+TInt CPSetRefreshHandlerImpl::ChangedCspSettings( 
+    TPSetChangedCspSetting& aChangedCspSettings,
+    TPSetChangedCspSetting& aNewValues )
+    {
+    __PHSLOGSTRING("[PHS]--> CPSetRefreshHandlerImpl::ChangedCspSettings");
+    RMobilePhone::TMobilePhoneCspFileV1 cspSettings;
+    RMobilePhone::TMobilePhoneCspFileV1Pckg cspSettingsPckg ( cspSettings );
+    RMobilePhone::TMobilePhoneCspFileV1 cspValues;
+    RMobilePhone::TMobilePhoneCspFileV1Pckg cspValuePckg ( cspValues );
+
+    TInt err = iSSSetRefHandler->ChangedCspTable( 
+        cspSettingsPckg,
+        cspValuePckg );
+
+    if ( err == KErrNone )
+        {
+        // First reset the parameters to contain nothing.
+        TInt changedSettings = EPSetNoChangedSetting;
+        TInt newValues = EPSetNoChangedSetting;
+
+
+        // Call waiting support.
+        if ( iCsp->CheckIfCWSupported( ( RMobilePhone::TCspCallCompletion ) 
+            cspSettings.iCallCompletionServices ) )
+            {
+            // Call waiting settings have changed.
+            changedSettings += EPSetCW;
+            // Find the new value.
+            if ( iCsp-> CheckIfCWSupported( ( RMobilePhone::TCspCallCompletion ) 
+                cspValues.iCallCompletionServices ) )
+                {
+                newValues += EPSetCW;
+                }
+            }
+
+        // Call barring support.
+        if ( iCsp->CheckIfCBSupported( ( RMobilePhone::TCspCallRestriction ) 
+            cspSettings.iCallRestrictionServices ) )
+            {
+            // Call barring settings have changed.
+            changedSettings += EPSetCB;
+
+            // Find the new value.
+            if ( iCsp->CheckIfCBSupported( ( RMobilePhone::TCspCallRestriction ) 
+                cspValues.iCallRestrictionServices ) )
+                {
+                newValues += EPSetCB;
+                }
+            }
+
+        // Call forwarding support.
+        if ( iCsp->CheckIfCFSupported( ( RMobilePhone::TCspCallOffering ) 
+            cspSettings.iCallOfferingServices )  )
+            {
+            // Call forwarding settings have changed.
+            changedSettings += EPSetCF;
+
+            // Find the new value.
+            if ( iCsp->CheckIfCFSupported( ( RMobilePhone::TCspCallOffering ) 
+                cspValues.iCallOfferingServices )  )
+                {
+                newValues += EPSetCF;
+                }
+            }
+
+        // ALS support.
+        if ( iCsp->CheckIfAlsSupported( ( RMobilePhone::TCspCPHSTeleservices ) 
+            cspSettings.iCphsTeleservices )  )
+            {
+            // ALS settings have changed.
+            changedSettings += EPSetALS;
+
+            // Find the new value.
+            if ( iCsp->CheckIfAlsSupported( ( RMobilePhone::TCspCPHSTeleservices ) 
+                cspValues.iCphsTeleservices )  )
+                {
+                newValues += EPSetALS;
+                }
+            }
+
+        // Network selection support.
+        if (  iCsp->CheckIfNetworkSelectionSupported( ( 
+            RMobilePhone::TCspValueAdded ) cspSettings.iValueAddedServices ) )
+            {
+            // Network selection support settings have changed.
+            changedSettings += EPSetNetSelSup;
+
+            // Find the new value.
+            if (  iCsp->CheckIfNetworkSelectionSupported( ( 
+                RMobilePhone::TCspValueAdded ) cspValues.iValueAddedServices ) )
+                {
+                newValues += EPSetNetSelSup;
+                }
+            }
+
+        // Set the changed values to user parameter.
+        aChangedCspSettings = ( TPSetChangedCspSetting ) changedSettings;
+        aNewValues = ( TPSetChangedCspSetting ) newValues;
+        }
+
+    __PHSLOGSTRING1("[PHS]   CPSetRefreshHandlerImpl::ChangedCspSettings: err: %d", err);
+    __PHSLOGSTRING("[PHS] <--CPSetRefreshHandlerImpl::ChangedCspSettings");
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CPSetRefreshHandlerImpl::AllowRefresh
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+TBool CPSetRefreshHandlerImpl::AllowRefresh(
+    const TSatRefreshType aType,
+    const TSatElementaryFiles aFiles )
+    {
+    TBool allow = ETrue;
+
+    if ( iObserver )
+        {
+        allow = iObserver->AllowRefresh(
+            aType,
+            aFiles );
+        }
+
+    return allow;
+    }
+
+// -----------------------------------------------------------------------------
+// CPSetRefreshHandlerImpl::Refresh
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+void CPSetRefreshHandlerImpl::Refresh(
+    const TSatRefreshType aType,
+    const TSatElementaryFiles aFiles )
+    {
+    if ( iObserver )
+        {
+        iObserver->Refresh(
+            aType,
+            aFiles );
+        }
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/telephonysettings/src/psetsaobserver.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,1548 @@
+/*
+* 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:  CPsetSAObserver handles all the queries to observer.
+*
+*
+*/
+
+
+// INCLUDE FILES
+#include <centralrepository.h>
+#include <ctsydomainpskeys.h>
+#include <telservicesinternalcrkeys.h> // telephony service local variation keys. 
+#include <telservicesvariant.hrh>
+
+#include "psetsaobserver.h" 
+#include "mpsetnetworkinfoobs.h" 
+#include "mpsetdivertobs.h" 
+#include "phonesettingslogger.h" 
+#include "psetutility.h" 
+#include "psetvariationproxy.h" 
+
+//CONSTANTS
+const TInt KPsetRequesterUncertain = 0;
+
+// ================= MEMBER FUNCTIONS =======================
+// ---------------------------------------------------------
+// 
+// 1st Phase constructor.
+// 
+// ---------------------------------------------------------
+//
+EXPORT_C CPsetSAObserver* CPsetSAObserver::NewL()
+    {
+    CPsetSAObserver* self = new ( ELeave ) CPsetSAObserver;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(); //self
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// C++ constructor.
+// 
+// ---------------------------------------------------------------------------
+//
+CPsetSAObserver::CPsetSAObserver() 
+                : CActive( EPriorityStandard )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// DualActvationFeature
+// ---------------------------------------------------------------------------
+//
+TBool CPsetSAObserver::IsDivertDualAffectFeatureEnabledL()
+    {
+    TBool retValue(EFalse);
+    CPSetVariationProxy* variationProxy = 
+        CPSetVariationProxy::NewL( KCRUidTelSrvVariation, KTelSrvVariationFlags );
+    CleanupStack::PushL( variationProxy );
+    retValue = variationProxy->IsFeatureEnabled( KTelephonyLVFlagDivertDualAffect );
+    CleanupStack::PopAndDestroy( variationProxy );
+    return retValue; 
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Run active object -- should only be used when trying to catch if call
+// has been started. 
+//
+// ---------------------------------------------------------------------------
+void CPsetSAObserver::RunL()
+    {
+    if ( iNetObserver )
+        {
+        if ( iStatus.Int() != KErrCancel )
+            {
+            TInt value = KErrGeneral;
+            // This to ensure that events are not lost.
+            iNotifyProperty.Subscribe( iStatus );
+            iNotifyProperty.Get( value );
+            SetActive();
+            if ( value != EPSCTsyCallStateNone )
+                {
+                // This is what was wanted, so cancel subscribe and inform
+                // observer.
+                iNotifyProperty.Cancel();
+
+                iNetObserver->HandleCallActivatedL();
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Returns current gprs connection state.
+// NOTE that this is not actual GPRS connection, even attached is considered
+// connected in this method. 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CPsetSAObserver::IsGPRSConnected()
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetSAObserver::IsGPRSConnected" );
+    TInt connectionStatus = KErrGeneral;
+    
+    TInt error = RProperty::Get( KUidSystemCategory,
+                                 KPSUidGprsStatusValue,
+                                 connectionStatus );
+                                 
+    if ( connectionStatus == EPSGprsUnattached )
+        {
+        connectionStatus = CPsetSAObserver::EPSetGPRSNotConnected;
+        }
+    else if ( connectionStatus == EPSGprsAttach ||
+              connectionStatus == EPSGprsContextActive ||
+              connectionStatus == EPSGprsSuspend )
+        {
+        connectionStatus = CPsetSAObserver::EPSetGPRSConnectionActive;
+        }
+    __PHSLOGSTRING2("[PHS]<-- CPsetSAObserver::IsGPRSConnected P&S error: %d, connectionStatus: %d", error, connectionStatus );
+    //Else: error situation, return error code (already in connectionStatus).
+    return connectionStatus;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Returns current call state
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CPsetSAObserver::IsCallActive()
+    {
+    TInt callStatus = KErrGeneral;
+
+    TInt error = RProperty::Get( KPSUidCtsyCallInformation,
+                                 KCTsyCallState,
+                                 callStatus );
+    if ( error == KErrNone )
+        {
+        switch ( callStatus )
+            {
+            case EPSCTsyCallStateUninitialized:
+            case EPSCTsyCallStateNone:
+                callStatus = CPsetSAObserver::EPSetNoCallsActive;
+                break;
+            default:
+                callStatus = CPsetSAObserver::EPSetCallActive;
+                break;
+            }
+        }
+    // Else - error situation, return error code (already in callStatus).
+    return callStatus;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Returns current Divert status
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CPsetSAObserver::GetCurrentDivertStatus( 
+    TUnconditionalCFStatus& aStatus )
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetSAObserver::GetCurrentDivertStatus" );
+    TInt error(KErrNone);
+    TInt indicator(KCFIndicatorUnknown);
+    TInt forwadingIndicator( indicator );
+    TPckg<TInt> indicatorPckg( forwadingIndicator );
+       
+    error =  iRepository->Get( KCtsyUnconditionalCFStatus, indicatorPckg );
+    if ( error == KErrNone )
+        {
+        aStatus = static_cast <TUnconditionalCFStatus> ( forwadingIndicator );
+        }
+        
+    __PHSLOGSTRING2("[PHS]--> Error: %d, aStatus: %d ", error, aStatus );
+    __PHSLOGSTRING("[PHS]<-- CPsetSAObserver::GetCurrentDivertStatus" );
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Sets Network observer to member variable
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPsetSAObserver::SetNetObserver( 
+    MPsetNetworkInfoObserver& aObserver )
+    {
+    if ( !iNetObserver )
+        {
+        iNetObserver = &aObserver;
+        }
+    TRAPD( ignore, NotifyCallStartedL() );
+    // Line below fixes armv5 warning.
+    ignore = ignore;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Cancels active object.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetSAObserver::DoCancel()
+    {
+    iNotifyProperty.Cancel();
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Destructor
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPsetSAObserver::~CPsetSAObserver()
+    {
+    Cancel();
+    
+    if ( iNotifyProperty.Handle() )
+        {
+        iNotifyProperty.Close();
+        }
+
+    iNetObserver = NULL;
+    
+    delete iRepository;
+    iRepository = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Symbian OS 2-phase constructor.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetSAObserver::ConstructL()
+    {
+    iRepository = CRepository::NewL( KCRUidCtsyCallForwardingIndicator );
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Starts to listen to call alerting or call ringing events.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetSAObserver::NotifyCallStartedL()
+    {
+    if ( !IsActive() )
+        {
+        //Ignore any errors here. It is handled in RunL
+        iNotifyProperty.Attach( KPSUidCtsyCallInformation, KCTsyCallState );
+        iNotifyProperty.Subscribe( iStatus );        
+        SetActive();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Notifies cenrep that diverts have been changed => sets indicator. 
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPsetSAObserver::NotifyDivertChange( 
+    TSelectedLine aAlsStatus,
+    TCallDivertNotifySetting& aDivertNotify,
+    const TInt& aActivatorUncertain )
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetSAObserver::NotifyDivertChange" );
+    // we have only one ALS line available
+    if( aAlsStatus == ENotSupportedLine || 
+        aAlsStatus == KErrUnknown )  
+        {
+        __PHSLOGSTRING("[PHS]--> we have only one ALS line available" );
+        HandleNoAlsIndicators( aDivertNotify, 
+                               aActivatorUncertain );
+        }
+    else if( aAlsStatus == EPrimaryLine )
+        {
+        __PHSLOGSTRING("[PHS]--> HandlePrimaryLineIndicators" );
+        HandlePrimaryLineIndicators( aDivertNotify );        
+        }
+    else if( aAlsStatus == EAuxiliaryLine )
+        {
+        __PHSLOGSTRING("[PHS]--> HandleSecondaryLineIndicators" );
+        HandleSecondaryLineIndicators( aDivertNotify );
+        }
+    
+     __PHSLOGSTRING1("[PHS]    NEW DIVERT STATUS:: %d", aDivertNotify.iPreviousCfStatus );
+    TInt package = aDivertNotify.iPreviousCfStatus;
+    TPckg<TInt> indicatorPckg( package );
+    TInt error = iRepository->Set( KCtsyUnconditionalCFStatus, indicatorPckg );
+    __PHSLOGSTRING("[PHS]<-- CPsetSAObserver::NotifyDivertChange" ); 
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// Handles indicators when no ALS.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetSAObserver::HandleNoAlsIndicators( 
+    TCallDivertNotifySetting& aDivertNotify,
+    const TInt& aActivatorUncertain )
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetSAObserver::HandleNoAlsIndicators" );
+    TUnconditionalCFStatus previousStatus = aDivertNotify.iPreviousCfStatus;
+    TUnconditionalCFStatus currentStatus = aDivertNotify.iPreviousCfStatus;
+    TBool voiceMailBox = aDivertNotify.iVmbxDivert;
+    TInt bsc = aDivertNotify.iBasicServiceCode;
+
+    __PHSLOGSTRING1("[PHS]--> Previous CF status: %d ", previousStatus );
+    __PHSLOGSTRING1("[PHS]-->      Voice MailBox: %d ", voiceMailBox );
+    __PHSLOGSTRING1("[PHS]--> Basic Service Code: %d ", bsc );
+    __PHSLOGSTRING1("[PHS]--> ActivatorUncertain: %d ", aActivatorUncertain );
+    if ( aDivertNotify.iCfActivated )  
+        {
+        if( voiceMailBox )
+            {
+            HandleVoiceMailBoxDivertActivation( currentStatus, bsc );
+            }
+        else
+            {
+            HandleDivertActivation( currentStatus, bsc );
+            }
+        }
+    else
+        {
+        __PHSLOGSTRING("[PHS]-->  Deactivition" );
+        HandleDivertDeactivation( currentStatus, bsc );
+        }
+        
+    __PHSLOGSTRING1("[PHS]--> Current CF status: %d ", currentStatus );
+    // If aActivatorUncertain is zero and previously divert was acitve to 
+    // Voice mailbox then status is leaved as it was before.
+    if ( aActivatorUncertain == KPsetRequesterUncertain )
+        {
+        if ( previousStatus != currentStatus )
+            {
+            if ( ( previousStatus == KCFVoiceForwardedToVoiceMailbox ) || 
+                 ( previousStatus == KCFVideoForwardedToVoiceMailbox ) ||
+                 ( previousStatus == ( KCFVoiceForwarded | KCFVideoForwarded 
+                    | KCFForwardedToVoiceMailbox ) ) )
+                {
+                __PHSLOGSTRING("[PHS] KCtsyUnconditionalCFStatus is NOT changed" );
+                aDivertNotify.iPreviousCfStatus = previousStatus;
+                }
+            else
+                {
+                __PHSLOGSTRING("[PHS]RequesterUn-KCtsyUnconditionalCFStatus is going to be changed" );
+                aDivertNotify.iPreviousCfStatus = currentStatus;
+                }
+            }
+        }
+    else
+        {
+        __PHSLOGSTRING("[PHS] KCtsyUnconditionalCFStatus is going to be changed" );
+        aDivertNotify.iPreviousCfStatus = currentStatus; 
+        }
+        
+    __PHSLOGSTRING("[PHS]<-- CPsetSAObserver::HandleNoAlsIndicators" );
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Handles line1 indicators.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetSAObserver::HandlePrimaryLineIndicators( 
+    TCallDivertNotifySetting& aDivertNotify )
+    {
+    __PHSLOGSTRING2("[PHS]--> HandlePrimaryLineIndicators - aPreviousCfStatus: %d, aCfActivated: %d", aDivertNotify.iPreviousCfStatus, aDivertNotify.iCfActivated );
+
+    TUnconditionalCFStatus status = aDivertNotify.iPreviousCfStatus;
+    TInt bsc = aDivertNotify.iBasicServiceCode;
+
+    __PHSLOGSTRING1("[PHS]--> status: %d ", status );
+    __PHSLOGSTRING1("[PHS]--> bsc:    %d ", bsc );
+    
+    if ( !IsDivertDualAffectFeatureEnabledL() )
+        {
+        if( aDivertNotify.iCfActivated )
+            {
+            __PHSLOGSTRING("[PHS]--> NOT DUAL Activation - Primary" );
+            HandlePrimaryLineDivertActivation( status, bsc );
+            }
+        else
+            {
+            __PHSLOGSTRING("[PHS]--> NOT DUAL - Primary" );
+            HandlePrimaryLineDivertDeactivation( status, bsc );
+            }
+        }
+    else // if dualactivation is active.
+        {
+        if( aDivertNotify.iCfActivated )
+            {
+            __PHSLOGSTRING("[PHS]--> Activation - Primary" );
+            HandlePrimaryLineDualDivertActivation( status, bsc );
+            }
+        else
+            {
+            __PHSLOGSTRING("[PHS]--> Deactivation - Primary" );
+            HandlePrimaryLineDualDivertDeactivation( status, bsc );
+            }
+        }
+    
+    aDivertNotify.iPreviousCfStatus = status;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Handles line2 indicators.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetSAObserver::HandleSecondaryLineIndicators( 
+    TCallDivertNotifySetting& aDivertNotify )
+    {
+    __PHSLOGSTRING2("[PHS]--> HandleSecondaryLineIndicators - HandleSecondaryLineIndicators: %d, aCfActivated: %d", aDivertNotify.iPreviousCfStatus, aDivertNotify.iCfActivated );
+
+    TUnconditionalCFStatus status = aDivertNotify.iPreviousCfStatus;
+
+    TInt bsc = aDivertNotify.iBasicServiceCode;
+    
+    __PHSLOGSTRING1("[PHS]--> status: %d ", status );
+    __PHSLOGSTRING1("[PHS]--> bsc:    %d ", bsc );
+    
+    if ( !IsDivertDualAffectFeatureEnabledL() )
+        {
+        if( aDivertNotify.iCfActivated )
+            {
+            __PHSLOGSTRING("[PHS]--> NOT DUAL Activation - Secondary" );
+            HandleSecondaryLineDivertActivation( status, bsc );
+            }
+        else
+            {
+            __PHSLOGSTRING("[PHS]--> NOT DUAL  Deactivation - Secondary" );
+            HandleSecondaryLineDivertDeactivation( status, bsc );
+            }
+        }
+    else // if dualactivation is active.
+        {
+        if( aDivertNotify.iCfActivated )
+            {
+            __PHSLOGSTRING("[PHS]--> Activation - Secondary" );
+            HandleSecondaryLineDualDivertActivation( status, bsc );
+            }
+        else
+            {
+            __PHSLOGSTRING("[PHS]--> Deactivation - Secondary" );
+            HandleSecondaryLineDualDivertDeactivation( status, bsc );
+            }
+        }
+    
+    aDivertNotify.iPreviousCfStatus = status;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Set correct indicator value when divert done to voicemail (no ALS).
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetSAObserver::HandleVoiceMailBoxDivertActivation( 
+    TUnconditionalCFStatus& aStatus,
+    const TInt aBsc  )
+    {
+    switch ( aStatus )
+        {
+        case KCFIndicatorUnknown:
+        case KCFNoCallsForwarded:
+            {
+            if ( aBsc == EAllTele || aBsc == ETelephony )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Mailbox - 1" );
+                aStatus =  KCFVoiceForwardedToVoiceMailbox;
+                }
+            else if ( aBsc == EAllTeleAndBearer )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Mailbox - 2" );
+                aStatus =  static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFVideoForwarded | KCFForwardedToVoiceMailbox );
+                }
+            else if (  aBsc == EAllBearer || aBsc == EAllSync ||
+                aBsc == ESyncData )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Mailbox - 3" );
+                aStatus =  KCFVideoForwardedToVoiceMailbox;
+                }
+            break;  
+            }
+        case KCFVoiceForwarded:
+            {       
+            if ( aBsc == EAllTele || aBsc == ETelephony )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Mailbox - 4" );
+                aStatus =  KCFVoiceForwardedToVoiceMailbox;
+                }
+            else if ( aBsc == EAllTeleAndBearer )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Mailbox - 5" );
+                aStatus =  static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFVideoForwarded | KCFForwardedToVoiceMailbox );
+                }
+            else if ( aBsc == EAllBearer || aBsc == EAllSync || 
+                aBsc == ESyncData )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Mailbox - 6" );
+                aStatus =  static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFVideoForwardedToVoiceMailbox );
+                }
+            break;  
+            }
+        case KCFVideoForwarded:
+            {
+            if ( aBsc == EAllTele || aBsc == ETelephony )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Mailbox - 7" );
+                aStatus =  static_cast<TUnconditionalCFStatus>( 
+                KCFVideoForwarded | KCFVoiceForwardedToVoiceMailbox );
+                }
+            else if ( aBsc == EAllTeleAndBearer )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Mailbox - 8" );
+                aStatus =  static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFVideoForwarded | KCFForwardedToVoiceMailbox );
+                }
+            else if ( aBsc == EAllBearer || aBsc == EAllSync || 
+                aBsc == ESyncData )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Mailbox - 9" );
+                aStatus = KCFVideoForwardedToVoiceMailbox;
+                }
+            break;  
+            }
+        case KCFVoiceForwarded | KCFVideoForwarded:
+            {       
+            if ( aBsc == EAllTele || aBsc == ETelephony )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Mailbox - 10" );
+                aStatus =  static_cast<TUnconditionalCFStatus>( 
+                KCFVideoForwarded | KCFVoiceForwardedToVoiceMailbox );
+                }
+            else if ( aBsc == EAllTeleAndBearer )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Mailbox - 11" );
+                aStatus =  static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFVideoForwarded | KCFForwardedToVoiceMailbox );
+                }
+            else if ( aBsc == EAllBearer || aBsc == EAllSync || 
+                aBsc == ESyncData )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Mailbox - 12" );
+                aStatus =  static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFVideoForwardedToVoiceMailbox );
+                }
+            break;  
+            }
+        case KCFVoiceForwardedToVoiceMailbox:
+            {
+            if ( aBsc == EAllTeleAndBearer || aBsc == EAllBearer ||
+                aBsc == EAllSync || aBsc == ESyncData )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Mailbox - 13" );
+                aStatus =  static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFVideoForwarded | KCFForwardedToVoiceMailbox );
+                }
+            break;  
+            }
+        case KCFVideoForwarded | KCFVoiceForwardedToVoiceMailbox:
+            {
+            if ( aBsc == EAllTeleAndBearer || aBsc == EAllBearer ||
+                aBsc == EAllSync || aBsc == ESyncData )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Mailbox - 14" );
+                aStatus =  static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFVideoForwarded | KCFForwardedToVoiceMailbox );
+                }  
+            break;  
+            }
+        case KCFVideoForwardedToVoiceMailbox:
+            {
+            if ( aBsc == EAllTeleAndBearer || aBsc == EAllTele ||
+                aBsc == ETelephony )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Mailbox - 15" );
+                aStatus =  static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFVideoForwarded | KCFForwardedToVoiceMailbox );
+                }
+            break;  
+            }
+        case KCFVoiceForwarded | KCFVideoForwardedToVoiceMailbox:
+            {
+            if ( aBsc == EAllTeleAndBearer || aBsc == EAllTele ||
+                aBsc == ETelephony )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Mailbox - 16" );
+                aStatus =  static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFVideoForwarded | KCFForwardedToVoiceMailbox );
+                }
+            break;  
+            }
+        default:
+            break;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Set correct indicator value when divert done to some other number than 
+// voicemail (no ALS).
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetSAObserver::HandleDivertActivation( 
+    TUnconditionalCFStatus& aStatus,
+    const TInt aBsc  )
+    {
+    switch ( aStatus )
+        {
+        case KCFIndicatorUnknown:
+        case KCFNoCallsForwarded:
+            {
+            if ( aBsc == EAllTele || aBsc == ETelephony )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - 1" );
+                aStatus = KCFVoiceForwarded;
+                }
+            else if ( aBsc == EAllTeleAndBearer )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - 2" );
+                aStatus =  static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFVideoForwarded );
+                }
+            else if ( aBsc == EAllBearer || aBsc == EAllSync || 
+                aBsc == ESyncData )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - 3" );
+                aStatus = KCFVideoForwarded;
+                }
+            break;
+            }
+        case KCFVoiceForwarded:
+            {
+            if ( aBsc == EAllTeleAndBearer || aBsc == EAllBearer ||
+                aBsc == EAllSync || aBsc == ESyncData )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - 4" );
+                aStatus =  static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFVideoForwarded );
+                }
+            break;
+            }
+        case KCFVideoForwarded:
+            {
+            if ( aBsc == EAllTele || aBsc == ETelephony ||
+                aBsc == EAllTeleAndBearer )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - 5" );
+                aStatus =  static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFVideoForwarded );
+                }
+            break;
+            }
+        case KCFVoiceForwardedToVoiceMailbox:
+            {
+            if ( aBsc == EAllTele || aBsc == ETelephony )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - 6" );
+                aStatus = KCFVoiceForwarded;
+                }
+            else if ( aBsc == EAllTeleAndBearer )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - 7" );
+                aStatus =  static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFVideoForwarded );
+                }
+            else if ( aBsc == EAllBearer || aBsc == EAllSync || 
+                aBsc == ESyncData )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - 8" );
+                aStatus =  static_cast<TUnconditionalCFStatus>( 
+                KCFVideoForwarded | KCFVoiceForwardedToVoiceMailbox );
+                }
+            break;
+            }
+        case KCFVideoForwardedToVoiceMailbox:
+            {
+            if ( aBsc == EAllTele || aBsc == ETelephony )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - 9" );
+                aStatus =  static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFVideoForwardedToVoiceMailbox );
+                }
+            else if ( aBsc == EAllTeleAndBearer )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - 10" );
+                aStatus =  static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFVideoForwarded );
+                }
+            else if ( aBsc == EAllBearer || aBsc == EAllSync || 
+                aBsc == ESyncData )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - 11" );
+                aStatus = KCFVideoForwarded;
+                }
+            break;
+            }
+        case KCFVoiceForwarded | KCFVideoForwarded | KCFForwardedToVoiceMailbox:
+            {
+            if ( aBsc == EAllTele || aBsc == ETelephony )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - 12" );
+                aStatus =  static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFVideoForwardedToVoiceMailbox );
+                }
+            else if ( aBsc == EAllTeleAndBearer )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - 13" );
+                aStatus =  static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFVideoForwarded );
+                }
+            else if ( aBsc == EAllBearer || aBsc == EAllSync || 
+                aBsc == ESyncData )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - 14" );
+                aStatus =  static_cast<TUnconditionalCFStatus>( 
+                KCFVideoForwarded | KCFVoiceForwardedToVoiceMailbox );
+                }
+            break;
+            }
+        case KCFVoiceForwarded | KCFVideoForwardedToVoiceMailbox:
+            {
+            if ( aBsc == EAllTeleAndBearer || aBsc == EAllBearer ||
+                aBsc == EAllSync || aBsc == ESyncData )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - 15" );
+                aStatus =  static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFVideoForwarded );
+                //aStatus = EPSAllForwarded;  
+                }
+            break;
+            }
+        case KCFVideoForwarded | KCFVoiceForwardedToVoiceMailbox:
+            {
+            if ( aBsc == EAllTele || aBsc == ETelephony ||
+                aBsc == EAllTeleAndBearer )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - 16" );
+                aStatus =  static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFVideoForwarded );
+                }
+            break;
+            }
+        default:
+            break;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Set correct indicator value when deactivation done(no ALS).
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetSAObserver::HandleDivertDeactivation( 
+    TUnconditionalCFStatus& aStatus,
+    const TInt aBsc  )
+    {
+    switch ( aStatus )
+        {
+        case KCFVoiceForwarded | KCFVideoForwarded:
+            {
+            if ( aBsc == EAllTele || aBsc == ETelephony )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivition - 1" );
+                aStatus = KCFVideoForwarded;
+                }
+            else if ( aBsc == EAllTeleAndBearer )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivition - 2" );
+                aStatus = KCFNoCallsForwarded;
+                }
+            else if ( aBsc == EAllBearer || aBsc == EAllSync || 
+                aBsc == ESyncData )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivition - 3" );
+                aStatus = KCFVoiceForwarded;
+                }
+            break;  
+            }
+        case KCFVoiceForwarded:
+            {
+            if ( aBsc == EAllTeleAndBearer || aBsc == EAllTele || 
+                aBsc == ETelephony )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivition - 4" );
+                aStatus = KCFNoCallsForwarded;
+                }
+            break;
+            }
+        case KCFVideoForwarded:
+            {
+            if ( aBsc == EAllTele || aBsc == ETelephony )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivition - 5" );
+                aStatus = KCFVideoForwarded;
+                }
+            else if ( aBsc == EAllTeleAndBearer || aBsc == EAllBearer || 
+                aBsc == EAllSync || aBsc == ESyncData   )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivition - 6" );
+                aStatus = KCFNoCallsForwarded;
+                }
+            break;
+            }
+        case KCFVoiceForwardedToVoiceMailbox:
+            {
+            if ( aBsc == EAllTeleAndBearer || aBsc == EAllTele || 
+                aBsc == ETelephony )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivition - 7" );
+                aStatus = KCFNoCallsForwarded;
+                }
+            break;
+            }
+        case KCFVideoForwarded | KCFVoiceForwardedToVoiceMailbox:
+            {
+            if ( aBsc == EAllTeleAndBearer )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivition - 9" );
+                aStatus = KCFNoCallsForwarded;
+                }
+            else if ( aBsc == EAllTele || aBsc == ETelephony )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivition - 10" );
+                aStatus = KCFVideoForwarded;
+                }
+            else if ( aBsc == EAllBearer || aBsc == EAllSync || 
+                aBsc == ESyncData )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivition - 11" );
+                aStatus = KCFVoiceForwardedToVoiceMailbox;
+                }    
+            break;
+            }
+        case KCFVideoForwardedToVoiceMailbox:
+            {
+            if ( aBsc == EAllTeleAndBearer || aBsc == EAllBearer || 
+                aBsc == EAllSync || aBsc == ESyncData )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivition - 12" );
+                aStatus = KCFNoCallsForwarded;
+                }
+            break;
+            }
+        case KCFVoiceForwarded | KCFVideoForwarded | KCFForwardedToVoiceMailbox:
+            {
+            if ( aBsc == EAllBearer || aBsc == EAllSync || 
+                aBsc == ESyncData )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivition - 13" );
+                aStatus = KCFVoiceForwardedToVoiceMailbox;
+                }
+            else if ( aBsc == EAllTele || aBsc == ETelephony )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivition - 14" );
+                aStatus = KCFVideoForwardedToVoiceMailbox;
+                }
+            else if ( aBsc == EAllTeleAndBearer  )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivition - 15" );
+                aStatus = KCFNoCallsForwarded;
+                }
+            break;
+            }
+        case KCFVoiceForwarded | KCFVideoForwardedToVoiceMailbox:
+            {
+            if ( aBsc == EAllTeleAndBearer  )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivition - 16" );
+                aStatus = KCFNoCallsForwarded;
+                }
+            else if ( aBsc == EAllTele || aBsc == ETelephony )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivition - 17" );
+                aStatus = KCFVideoForwardedToVoiceMailbox;
+                }
+            else if ( aBsc == EAllBearer || aBsc == EAllSync || 
+                aBsc== ESyncData )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivition - 18" );
+                aStatus = KCFVoiceForwarded;
+                }
+            break;
+            }
+        default:
+            break;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Set correct indicator value when Primary line used.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetSAObserver::HandlePrimaryLineDivertActivation( 
+    TUnconditionalCFStatus& aStatus,
+    const TInt aBsc  )
+    {
+    switch ( aStatus )
+        {
+        case KCFIndicatorUnknown:
+        case KCFNoCallsForwarded:
+        case KErrUnknown:
+            {
+            if ( aBsc == EAllTeleAndBearer )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Primary - 1" );
+                aStatus = static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFVideoForwarded | KCFForwardedOnLine1 );
+                }
+            else if ( aBsc == EAllTele || aBsc == ETelephony )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Primary - 2" );
+                aStatus = static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFForwardedOnLine1 );
+                }
+            else if ( aBsc == EAllBearer || aBsc == EAllSync ||
+                aBsc == ESyncData  )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Primary - 3" );
+                aStatus = static_cast<TUnconditionalCFStatus>( 
+                KCFVideoForwarded | KCFForwardedOnLine1 );
+                }
+            break;
+            }
+        case KCFVoiceForwarded | KCFForwardedOnLine1:
+            {
+            if ( aBsc == EAllTeleAndBearer || aBsc == EAllBearer ||
+                aBsc == EAllSync || aBsc == ESyncData )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Primary - 4" );
+                aStatus = static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFVideoForwarded | KCFForwardedOnLine1 );
+                }
+            break;
+            }
+        case KCFVideoForwarded | KCFForwardedOnLine1:
+            {
+            if ( aBsc == EAllTeleAndBearer || aBsc == EAllTele || 
+                aBsc == ETelephony )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Primary - 5" );
+                aStatus = static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFVideoForwarded | KCFForwardedOnLine1 );
+                }
+            break;
+            }
+        case KCFVideoForwarded | KCFForwardedOnLine1 | KCFForwardedOnLine2:
+            {
+            if ( aBsc == EAllTeleAndBearer || aBsc == EAllTele || 
+                aBsc == ETelephony )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Primary - 6" );
+                aStatus = static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFVideoForwarded | KCFForwardedOnLine1 | 
+                KCFForwardedOnLine2 );
+                }
+            break;
+            }
+        case KCFForwardedOnLine2:
+            {
+            if ( aBsc == EAllBearer || aBsc == EAllSync || 
+                aBsc == ESyncData )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Primary - 7" );
+                aStatus = static_cast<TUnconditionalCFStatus>( 
+                KCFVideoForwarded | KCFForwardedOnLine1 | KCFForwardedOnLine2 );
+                }
+            else if( aBsc == EAllTeleAndBearer )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Primary - 8" );
+                aStatus = static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFVideoForwarded | KCFForwardedOnLine1 | 
+                KCFForwardedOnLine2 );
+                }
+            else if ( aBsc == EAllTele || 
+                aBsc == ETelephony )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Primary - 9" );
+                aStatus = static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFForwardedOnLine1 | KCFForwardedOnLine2 );
+                }
+            break;
+            }
+          
+        default:
+            break;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Set correct indicator value when Primary line used.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetSAObserver::HandlePrimaryLineDualDivertActivation(
+        TUnconditionalCFStatus& aStatus,
+        const TInt aBsc  )
+    {
+    switch ( aStatus )
+        {
+        case KCFIndicatorUnknown:
+        case KCFNoCallsForwarded:
+        case KErrUnknown:
+            {
+            if ( aBsc == EAllTeleAndBearer )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Primary - 1" );
+                aStatus = static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFForwardedOnLine1 );
+                }
+            else if ( aBsc == EAllTele || aBsc == ETelephony )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Primary - 2" );
+                aStatus = static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFForwardedOnLine1 );
+                }
+            break;
+            }
+        case KCFVoiceForwarded | KCFForwardedOnLine1:
+            {
+            if ( aBsc == EAllTeleAndBearer )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Primary - 3" );
+                aStatus = static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFForwardedOnLine1 | KCFForwardedOnLine2 );
+                }
+            break;
+            }
+        case KCFForwardedOnLine2:
+            {
+            if( aBsc == EAllTeleAndBearer || aBsc == EAllTele || 
+                aBsc == ETelephony )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Primary - 4" );
+                aStatus = static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFForwardedOnLine1 | KCFForwardedOnLine2 );
+                }
+            break;
+            }
+            
+        default:
+            break;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Set correct indicator value when Primary line used.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetSAObserver::HandlePrimaryLineDualDivertDeactivation(
+        TUnconditionalCFStatus& aStatus,
+        const TInt aBsc  )
+    {
+    switch ( aStatus )
+        {
+        case KCFVoiceForwarded | KCFForwardedOnLine1 | KCFForwardedOnLine2:
+            {
+            if ( aBsc == EAllTeleAndBearer || aBsc == EAllTele 
+                || aBsc == ETelephony )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivation - Primary - 1" );
+                aStatus = KCFForwardedOnLine2;
+                }
+            break;
+            }
+        case KCFVoiceForwarded | KCFForwardedOnLine1:
+            {
+            if ( aBsc == EAllTeleAndBearer || aBsc == EAllTele 
+                || aBsc == ETelephony )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivation - Primary - 2" );
+                aStatus = KCFNoCallsForwarded;
+                }
+            break;
+            }
+        case KCFForwardedOnLine2:
+            { 
+            if ( aBsc == EAllTeleAndBearer || aBsc == EAllTele 
+                || aBsc == ETelephony )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivation - Primary - 3" );
+                aStatus = KCFForwardedOnLine2;
+                }
+            break;
+            }
+            
+        default:
+            break;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Set correct indicator value when Primary line used.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetSAObserver::HandlePrimaryLineDivertDeactivation( 
+    TUnconditionalCFStatus& aStatus,
+    const TInt aBsc )
+    {
+    switch ( aStatus )
+        {
+        case KCFVoiceForwarded | KCFForwardedOnLine1 | KCFForwardedOnLine2:
+            {
+            __PHSLOGSTRING("[PHS]--> Deactivation - Primary - 1" );
+            aStatus = KCFForwardedOnLine2;
+            break;
+            }
+        case KCFVoiceForwarded | KCFForwardedOnLine1:
+            {
+            if ( aBsc == EAllTeleAndBearer )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivation - Primary - 2" );
+                aStatus = KCFNoCallsForwarded;
+                }
+            else if ( aBsc == EAllTele || aBsc == ETelephony )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivation - Primary - 3");
+                aStatus = KCFNoCallsForwarded;
+                }
+            break;
+            }
+        case KCFVideoForwarded | KCFForwardedOnLine1:
+            {
+            if ( aBsc == EAllTeleAndBearer )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivation - Primary - 4" );
+                aStatus = KCFNoCallsForwarded;
+                } 
+            else if ( aBsc == EAllBearer || aBsc == EAllSync || 
+                aBsc == ESyncData )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivation - Primary - 5" );
+                aStatus = KCFNoCallsForwarded;
+                }
+            break;
+            }
+        case KCFVideoForwarded | KCFVoiceForwarded | KCFForwardedOnLine1:
+            {
+            if ( aBsc == EAllTeleAndBearer )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivation - Primary - 6" );
+                aStatus = KCFNoCallsForwarded;
+                }
+            else if ( aBsc == EAllTele || aBsc == ETelephony )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivation - Primary - 7" );
+                aStatus = aStatus = static_cast<TUnconditionalCFStatus>( 
+                KCFVideoForwarded | KCFForwardedOnLine1 );
+                }
+            else if ( aBsc == EAllBearer || aBsc == EAllSync || 
+                aBsc == ESyncData )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivation - Primary - 8" );
+                aStatus = aStatus = static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFForwardedOnLine1 );
+                }
+            break;
+            }
+        case KCFVideoForwarded | KCFForwardedOnLine1 | KCFForwardedOnLine2:
+            { 
+            if ( aBsc == EAllBearer || aBsc == EAllSync || 
+                aBsc == ESyncData || aBsc == EAllTeleAndBearer )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivation - Primary - 9" );
+                aStatus = KCFForwardedOnLine2;
+                }
+            else if ( aBsc == EAllTele || aBsc == ETelephony )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivation - Primary - 10" );
+                aStatus = static_cast<TUnconditionalCFStatus>( 
+                KCFVideoForwarded | KCFForwardedOnLine1 | KCFForwardedOnLine2 );
+                }
+            break;
+            }
+        case KCFVoiceForwarded | KCFVideoForwarded | KCFForwardedOnLine1 | KCFForwardedOnLine2:
+            {
+            if ( aBsc == EAllTeleAndBearer )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivation - Primary - 11" );
+                aStatus =  KCFForwardedOnLine2;
+                }
+            else if ( aBsc == EAllTele || aBsc == ETelephony )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivation - Primary - 12" );
+                aStatus = static_cast<TUnconditionalCFStatus>( 
+                KCFVideoForwarded | KCFForwardedOnLine1 | KCFForwardedOnLine2 );
+                } 
+            else if ( aBsc == EAllBearer || aBsc == EAllSync || 
+                aBsc == ESyncData  )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivation - Primary - 13" );
+                aStatus = static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFForwardedOnLine1 | KCFForwardedOnLine2 );
+                }
+            break;
+            }
+        
+        default:
+            break;
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// Set correct indicator value when secondary line used.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetSAObserver::HandleSecondaryLineDivertActivation( 
+    TUnconditionalCFStatus& aStatus,
+    const TInt aBsc  )
+    {
+    switch ( aStatus )
+        {
+        case KCFIndicatorUnknown:
+        case KCFNoCallsForwarded:
+        case KErrUnknown:
+            {
+            if ( aBsc == EAllBearer || aBsc == EAllSync || 
+                aBsc == ESyncData )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Secondary - 1" );   
+                aStatus = static_cast<TUnconditionalCFStatus>( 
+                KCFVideoForwarded | KCFForwardedOnLine1 );
+                }
+            else if ( aBsc == EAllTeleAndBearer || aBsc == EAltTele ||
+                aBsc == EAllTele )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Secondary - 2" );   
+                aStatus = KCFForwardedOnLine2;
+                }    
+            break;
+            }
+        case KCFVoiceForwarded | KCFForwardedOnLine1:
+            {
+            if ( aBsc == EAllBearer || aBsc == EAllSync || 
+                aBsc == ESyncData )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Secondary - 3" );
+                aStatus = static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFVideoForwarded | KCFForwardedOnLine1 );
+                }
+            else if ( aBsc == EAllTeleAndBearer || aBsc == EAltTele ||
+                aBsc == EAllTele )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Secondary - 4");
+                aStatus = static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFForwardedOnLine1 | KCFForwardedOnLine2 );
+                }
+            break;
+            }
+        case KCFVoiceForwarded | KCFVideoForwarded | KCFForwardedOnLine1:
+            {
+            if ( aBsc == EAllTeleAndBearer || aBsc == EAltTele ||
+                aBsc == EAllTele )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Secondary - 5");
+                aStatus = static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFVideoForwarded | KCFForwardedOnLine1 |
+                KCFForwardedOnLine2 );
+                }
+            break;
+            }
+        case KCFForwardedOnLine2:
+            {
+            if ( aBsc == EAllBearer || aBsc == EAllSync || 
+                aBsc == ESyncData )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Secondary - 6");
+                aStatus = static_cast<TUnconditionalCFStatus>( 
+                KCFVideoForwarded | KCFForwardedOnLine1 | KCFForwardedOnLine2 );
+                }
+            break;
+            }
+        case KCFVoiceForwarded | KCFForwardedOnLine1 | KCFForwardedOnLine2:
+            {
+            if ( aBsc == EAllBearer || aBsc == EAllSync || 
+                aBsc == ESyncData )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Secondary - 7");
+                aStatus = static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFVideoForwarded | KCFForwardedOnLine1 | KCFForwardedOnLine2 );
+                }
+            break;
+            }
+        case KCFVideoForwarded | KCFForwardedOnLine1:
+            {
+            if ( aBsc == EAllTeleAndBearer || aBsc == EAltTele ||
+                aBsc == EAllTele )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Secondary - 8");
+                aStatus = static_cast<TUnconditionalCFStatus>( 
+                KCFVideoForwarded | KCFForwardedOnLine1 | KCFForwardedOnLine2 );
+                }
+            break;
+            }
+        
+        default:
+            break;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Set correct indicator value when secondary line used.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetSAObserver::HandleSecondaryLineDualDivertActivation( 
+    TUnconditionalCFStatus& aStatus,
+    const TInt aBsc  )
+    {
+    switch ( aStatus )
+        {
+        case KCFIndicatorUnknown:
+        case KCFNoCallsForwarded:
+        case KErrUnknown:
+            {
+            if ( aBsc == EAllTeleAndBearer || aBsc == EAltTele ||
+                aBsc == EAllTele )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Secondary - 1" );   
+                aStatus = KCFForwardedOnLine2;
+                }    
+            break;
+            }
+        case KCFVoiceForwarded | KCFForwardedOnLine1:
+            {
+            if ( aBsc == EAllTeleAndBearer || aBsc == EAltTele ||
+                aBsc == EAllTele )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Secondary - 2");
+                aStatus = static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFForwardedOnLine1 | KCFForwardedOnLine2 );
+                }
+            break;
+            }
+        case KCFForwardedOnLine2:
+            {
+            if ( aBsc == EAllTeleAndBearer ||  aBsc == EAllTele )
+                {
+                __PHSLOGSTRING("[PHS]--> Activation - Secondary - 3");
+                aStatus = static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFForwardedOnLine1 | KCFForwardedOnLine2 );
+                }
+            break;
+            }
+        default:
+            break;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Set correct indicator value when secondary line used.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetSAObserver::HandleSecondaryLineDivertDeactivation( 
+    TUnconditionalCFStatus& aStatus,
+    const TInt aBsc  )
+    {
+    switch ( aStatus )
+        {
+        case KCFVoiceForwarded | KCFForwardedOnLine1 | KCFForwardedOnLine2:
+            {
+            if ( aBsc == EAllTeleAndBearer || aBsc == EAllTele ||
+                aBsc == EAltTele )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivation - Secondary - 1" );
+                aStatus = static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFForwardedOnLine1 );
+                }
+            break;
+            }
+        case KCFVideoForwarded |KCFVoiceForwarded | KCFForwardedOnLine1:
+            {
+            if ( aBsc == EAllBearer || aBsc == EAllSync || 
+                aBsc == ESyncData )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivation - Secondary - 2" );
+                aStatus = static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFForwardedOnLine1 );
+                }
+            break;
+            }
+        case KCFVoiceForwarded | KCFForwardedOnLine1:
+            {
+            if ( aBsc == EAllTeleAndBearer || aBsc == EAllTele )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivation - Secondary - 3" );
+                aStatus = KCFNoCallsForwarded;
+                }
+            break;
+            }
+        case KCFVideoForwarded | KCFForwardedOnLine1:
+            {
+            if ( aBsc == EAllBearer || aBsc == EAllSync || 
+                aBsc == ESyncData )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivation - Secondary - 4" );
+                aStatus = KCFNoCallsForwarded;
+                }
+            break;  
+            } 
+        case KCFForwardedOnLine2:
+            {
+            if ( aBsc == EAllTeleAndBearer || aBsc == EAltTele ||
+                aBsc == EAllTele )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivation - Secondary - 5" );
+                aStatus = KCFNoCallsForwarded;
+                }
+            break;
+            }
+        case KCFVideoForwarded | KCFVoiceForwarded | KCFForwardedOnLine1 | KCFForwardedOnLine2:
+            {
+            if ( aBsc == EAllBearer || aBsc == EAllSync || 
+                aBsc == ESyncData )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivation - Secondary - 6" );
+                aStatus = static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFForwardedOnLine1 | KCFForwardedOnLine2 );
+                }
+            else if ( aBsc == EAllTeleAndBearer || aBsc == EAltTele ||
+                aBsc == EAllTele )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivation - Secondary - 7" );
+                aStatus = static_cast<TUnconditionalCFStatus>( 
+                KCFVideoForwarded | KCFVoiceForwarded | KCFForwardedOnLine1 );
+                }
+            break;
+            }
+        case KCFVideoForwarded |KCFVoiceForwarded:
+            {
+            if ( aBsc == EAllBearer || aBsc == EAllSync || 
+                aBsc == ESyncData )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivation - Secondary - 8" );
+                aStatus = KCFNoCallsForwarded;
+                }
+            break;
+            }
+        case KCFVideoForwarded | KCFForwardedOnLine1 | KCFForwardedOnLine2:
+            {
+            if ( aBsc == EAllBearer || aBsc == EAllSync || 
+                aBsc == ESyncData )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivation - Secondary - 9" );
+                aStatus = KCFForwardedOnLine2;
+                }
+            else if ( aBsc == EAllTeleAndBearer || aBsc == EAltTele ||
+                aBsc == EAllTele )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivation - Secondary - 10" );
+                aStatus = static_cast<TUnconditionalCFStatus>( 
+                KCFVideoForwarded | KCFForwardedOnLine1 );
+                }
+            break;
+            }
+        default:
+            break;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Set correct indicator value when secondary line used.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetSAObserver::HandleSecondaryLineDualDivertDeactivation( 
+    TUnconditionalCFStatus& aStatus,
+    const TInt aBsc  )
+    {
+    switch ( aStatus )
+        {
+        case KCFVoiceForwarded | KCFForwardedOnLine1 | KCFForwardedOnLine2:
+            {
+            if ( aBsc == EAllTeleAndBearer || aBsc == EAllTele ||
+                aBsc == EAltTele )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivation - Secondary - 1" );
+                aStatus = static_cast<TUnconditionalCFStatus>( 
+                KCFVoiceForwarded | KCFForwardedOnLine1 );
+                }
+            break;
+            }
+        case KCFVoiceForwarded | KCFForwardedOnLine1:
+            {
+            if ( aBsc == EAllTeleAndBearer || aBsc == EAllTele )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivation - Secondary - 2" );
+                aStatus = KCFNoCallsForwarded;
+                }
+            break;
+            }
+        case KCFForwardedOnLine2:
+            {
+            if ( aBsc == EAllTeleAndBearer || aBsc == EAltTele ||
+                aBsc == EAllTele )
+                {
+                __PHSLOGSTRING("[PHS]--> Deactivation - Secondary - 3" );
+                aStatus = KCFNoCallsForwarded;
+                }
+            break;
+            }
+        default:
+            break;
+        }
+    }
+    
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/telephonysettings/src/psetsubscriberidcheck.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,100 @@
+/*
+* 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: Implementation of CPSetSubscriberIdCheck class.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "psetsubscriberidcheck.h" 
+
+_LIT( KRogersImsi, "30272" );
+const TInt KMinImsiLength = 5;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ---------------------------------------------------------------------------
+// First phase constructor
+// ---------------------------------------------------------------------------
+//
+CPSetSubscriberIdCheck* CPSetSubscriberIdCheck::NewL( )
+    {
+    CPSetSubscriberIdCheck* self = new ( ELeave ) CPSetSubscriberIdCheck( );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPSetSubscriberIdCheck::CPSetSubscriberIdCheck()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor.
+// ---------------------------------------------------------------------------
+//
+CPSetSubscriberIdCheck::~CPSetSubscriberIdCheck()
+    {
+    } 
+
+// ---------------------------------------------------------------------------
+// Check if used SIM support dual activation.
+// ---------------------------------------------------------------------------
+//
+TBool CPSetSubscriberIdCheck::DoesSIMSupportDualActivation()
+    {
+    TBool result = EFalse;
+    TInt error = KErrNone;
+
+    if( iImsi.Length() == 0 )
+        {
+        RTelServer rTelServer;
+        RTelServer::TPhoneInfo info;
+        RMobilePhone rMobilePhone;
+        TRequestStatus tRequestStatus;
+
+        error = rTelServer.Connect();
+        if( error == KErrNone ) 
+            {
+            error = rTelServer.GetPhoneInfo( 0, info );
+            if( error == KErrNone )
+                {
+                error = rMobilePhone.Open( rTelServer, info.iName );
+                if( error == KErrNone )
+                    {
+                    rMobilePhone.GetSubscriberId( tRequestStatus, iImsi );
+                    User::WaitForRequest( tRequestStatus );
+                    error = tRequestStatus.Int();
+                    rMobilePhone.Close();
+                    }
+                }
+            rTelServer.Close();
+            }
+        }
+
+    if(( iImsi.Length() >= KMinImsiLength ) && ( error == KErrNone ))
+        {
+        if( iImsi.Left( KMinImsiLength ).Compare( KRogersImsi ) == 0 )
+            {
+            result = ETrue;
+            }
+        }
+
+    return result;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/telephonysettings/src/psettelephony.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,275 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ETEL connection and line opening class.
+*
+*
+*/
+
+
+// INCLUDE FILES
+#include <etelmm.h>
+#include <e32svr.h>
+#include <mmtsy_names.h>
+#include "psetconstants.h" 
+#include "psettelephony.h" 
+#include "phonesettingslogger.h" 
+
+//  MEMBER FUNCTIONS
+// ---------------------------------------------------------------------------
+// 
+//  First phase constructor
+// 
+// ---------------------------------------------------------------------------
+//
+CPsetTelephony* CPsetTelephony::NewL( 
+    RMobilePhone& aPhone, const TDesC* aTsyName )
+    {
+    CPsetTelephony* self = new ( ELeave ) CPsetTelephony( aPhone );
+    CleanupStack::PushL( self );
+    self->ConstructL( aTsyName );
+    CleanupStack::Pop();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+//  Destructor
+// 
+// ---------------------------------------------------------------------------
+//
+CPsetTelephony::~CPsetTelephony()
+    {
+    if ( iOwnConnection )
+        {
+        if ( iPhone )
+            {
+            iPhone->Close();
+            }
+        
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        /*****************************************************
+        *    Series 60 Customer / TSY
+        *    Needs customer TSY implementation
+        *****************************************************/
+        if ( iTelServer )
+            {
+            iTelServer->UnloadPhoneModule( iTsyName );
+            iTelServer->Close();
+            }
+        delete iTelServer;
+        iTelServer = NULL;
+        delete iPhone;
+        iPhone = NULL;
+        }
+    } 
+
+// ---------------------------------------------------------------------------
+// 
+//  Constructor.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetTelephony::ConstructL( const TDesC* aTsyName )                   
+    {
+    User::LeaveIfError( ConnectToEtelL( aTsyName ) );
+    iOwnConnection = ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Connects to ETel server and loads TSY module, then opens phone object
+// if phone(s) found.
+// 
+// ---------------------------------------------------------------------------
+TInt CPsetTelephony::ConnectToEtelL( const TDesC* aTsyName )
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetTelephony::ConnectToEtelL");
+    if ( aTsyName )
+        {
+        iTsyName= *aTsyName; // use specific tsy name
+        }
+    else
+        {
+        iTsyName = KMmTsyModuleName; // use default tsy name
+        }
+    
+    iTelServer = new ( ELeave ) RTelServer;    
+    iPhone = new ( ELeave ) RMobilePhone;
+    TInt err = KErrNone;
+    
+    for ( TInt a = 0 ; a < KPSetRetryCount ; a++ )
+        {
+        err = iTelServer->Connect();
+        
+        if ( err == KErrNone )
+            {
+            break;
+            }
+        
+        User::After( KPSetRetryTimeout );
+        }
+    
+    User::LeaveIfError( err );
+    
+    /*****************************************************
+    *    Series 60 Customer / ETel
+    *    Series 60  ETel API
+    *****************************************************/
+    /*****************************************************
+    *    Series 60 Customer / TSY
+    *    Needs customer TSY implementation
+    *****************************************************/
+    err = iTelServer->LoadPhoneModule( iTsyName );
+    
+    if ( err == KErrNone )
+        {
+        iTelServer->SetExtendedErrorGranularity( RTelServer::EErrorExtended );
+        
+        RTelServer::TPhoneInfo phoneInfo;
+        err = iTelServer->GetPhoneInfo( 0, phoneInfo );  
+        if ( err == KErrNone )
+            {
+            // open phone subsession
+            err = iPhone->Open( *iTelServer, phoneInfo.iName ); 
+            }
+        }
+
+    __PHSLOGSTRING("[PHS] <--CPsetTelephony::ConnectToEtelL");
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Checks that correct line for diverting is open. If not, lines
+// are gone through and when one with correct capabilities is found,
+// it is opened.
+// 
+// ---------------------------------------------------------------------------
+//
+void CPsetTelephony::CheckLineModeL( const TServiceGroup aServiceGroup,
+                                    RMobilePhone* aPhone, RMobileLine* aLine)
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetTelephony::CheckLineModeL");
+    if (!aPhone || !aLine)
+        {
+        User::Leave(KErrArgument);
+        }
+    
+    RLine::TCaps lineCaps;    
+    lineCaps.iFlags = 0;
+    TBool oldMode( EFalse ); // if true, another line must be opened    
+    
+    if ( aLine->SubSessionHandle() == 0 )
+        {
+        oldMode = ETrue;
+        }
+    else
+        {
+        User::LeaveIfError( aLine->GetCaps( lineCaps ) );
+        }
+
+    TUint32 capsFlags( 0 );
+    capsFlags = SetCapFlagsL( aServiceGroup, oldMode, lineCaps );
+    
+    if ( oldMode )
+        { // open line in right mode according to service group        
+        if ( aLine->SubSessionHandle() )
+            {
+            aLine->Close();        
+            }
+        
+        TInt lines = 0;
+        User::LeaveIfError( aPhone->EnumerateLines( lines ) );
+        //lines is no of lines, to check each line, we need to 
+        // check all lines from 0 to lines-1
+        for (lines--; KPSetNoLinesAvailable < lines; lines-- )
+            {
+            RPhone::TLineInfo lineInfo;
+            User::LeaveIfError( aPhone->GetLineInfo( lines, lineInfo ) );            
+            
+            if ( lineInfo.iLineCapsFlags & capsFlags )
+                {
+                User::LeaveIfError( aLine->Open( *aPhone, lineInfo.iName ) );
+                return;
+                }
+            }        
+        }
+    __PHSLOGSTRING("[PHS] <--CPsetTelephony::CheckLineModeL");
+    }
+// ---------------------------------------------------------------------------
+// 
+// Sets cap flags.
+// 
+// ---------------------------------------------------------------------------
+//
+TUint32 CPsetTelephony::SetCapFlagsL( 
+    const TServiceGroup aServiceGroup, TBool& aMode, RLine::TCaps& aCaps )
+    {
+    __PHSLOGSTRING("[PHS]--> CPsetTelephony::SetCapFlagsL");
+    TUint32 flags(0);
+
+    switch ( aServiceGroup )
+        {
+        case EServiceGroupVoice:
+            __PHSLOGSTRING("[PHS]    CPsetTelephony::SetCapFlagsL: EServiceGroupVoice");
+            // always open voice line even because it could have been another 
+            // ALS line which was open
+            aMode = ETrue;
+            flags |= RLine::KCapsVoice;
+            break;
+        case EServiceGroupData:
+            __PHSLOGSTRING("[PHS]    CPsetTelephony::SetCapFlagsL: EServiceGroupData");
+            if ( !( aCaps.iFlags & RLine::KCapsData ) )
+                {
+                aMode = ETrue;
+                }
+            flags |= RLine::KCapsData;
+            break;
+        case EServiceGroupFax:
+            __PHSLOGSTRING("[PHS]    CPsetTelephony::SetCapFlagsL: EServiceGroupFax");
+            if ( !( aCaps.iFlags & RLine::KCapsFax ) )
+                {
+                aMode = ETrue;
+                }
+            flags |= RLine::KCapsFax;
+            break;
+        case EServiceGroupAllTeleservices:
+            __PHSLOGSTRING("[PHS]    CPsetTelephony::SetCapFlagsL: EServiceGroupAllTeleservices");
+            aMode = ETrue;
+            flags |= RLine::KCapsData;
+            flags |= RLine::KCapsFax;
+            flags |= RLine::KCapsVoice;
+            break;
+        default:
+            User::Leave( KErrNotSupported );
+        }
+
+    __PHSLOGSTRING("[PHS] <--CPsetTelephony::SetCapFlagsL");
+    return flags;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// C++ constructor.
+// 
+// ---------------------------------------------------------------------------
+//
+CPsetTelephony::CPsetTelephony
+                ( RMobilePhone& aPhone ) : iPhone ( &aPhone )
+    {
+    }
+//End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/telephonysettings/src/psetutility.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,374 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 switch between ETEL internal enumerations and
+*                codes defined in the GSM standard.
+*
+*/
+
+
+// INCLUDE FILES
+#include "psetutility.h" 
+#include <rsssettings.h> 
+#include "phonesettingslogger.h" 
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ---------------------------------------------------------------------------
+// 
+// Translates given basic service code from code used in GSM standards to 
+// ETEL internal code.
+// ---------------------------------------------------------------------------
+//
+RMobilePhone::TMobileService PSetUtility::ChangeToEtelInternal( const TBasicServiceGroups& aBsc )
+    {
+    switch ( aBsc )
+        {        
+        case EAllTeleAndBearer:
+            return RMobilePhone::EAllServices;
+        case EAllTele:
+            return RMobilePhone::EAllTele;
+        case ETelephony:
+            return RMobilePhone::ETelephony;
+        case EAllDataTele:
+            return RMobilePhone::EAllDataTele;
+        case EFax:
+            return RMobilePhone::EFaxService;
+        case ESms:
+            return RMobilePhone::EShortMessageService;
+        case EAllDataExSms:
+            return RMobilePhone::EAllDataExSms;
+        case EAllTeleExcSms:
+            return RMobilePhone::EAllTeleExcSms;
+        case EAllPlmnTele:
+            return RMobilePhone::EAllPlmnTele;
+        case EPlmnTele1:
+            return RMobilePhone::EPlmnTele1;
+        case EPlmnTele2:
+            return RMobilePhone::EPlmnTele2;
+        case EPlmnTele3:
+            return RMobilePhone::EPlmnTele3;
+        case EPlmnTele4:
+            return RMobilePhone::EPlmnTele4;
+        case EPlmnTele5:
+            return RMobilePhone::EPlmnTele5;
+        case EPlmnTele6:
+            return RMobilePhone::EPlmnTele6;
+        case EPlmnTele7:
+            return RMobilePhone::EPlmnTele7;
+        case EPlmnTele8:
+            return RMobilePhone::EPlmnTele8;
+        case EPlmnTele9:
+            return RMobilePhone::EPlmnTele9;
+        case EPlmnTeleA:
+            return RMobilePhone::EPlmnTeleA;
+        case EPlmnTeleB:
+            return RMobilePhone::EPlmnTeleB;
+        case EPlmnTeleC:
+            return RMobilePhone::EPlmnTeleC;
+        case EPlmnTeleD:
+            return RMobilePhone::EPlmnTeleD;
+        case EPlmnTeleE:
+            return RMobilePhone::EPlmnTeleE;
+        case EPlmnTeleF:
+            return RMobilePhone::EPlmnTeleF;
+        case EAllBearer:
+            return RMobilePhone::EAllBearer;
+        case EAllAsync:
+            return RMobilePhone::EAllAsync;
+        case EAllSync:
+            return RMobilePhone::EAllSync;
+        case ESyncData:
+            return RMobilePhone::ESyncData;
+        case EAsyncData:
+            return RMobilePhone::EAsyncData;
+        case EPacketData:
+            return RMobilePhone::EPacketDataService;
+        case EPadAccess:
+            return RMobilePhone::EPadAccess;
+        case EAllPlmnBearer:
+            return RMobilePhone::EAllPlmnBearer;
+        case EPlmnBearerServ1:
+            return RMobilePhone::EPlmnBearerServ1;
+        case EPlmnBearerServ2:
+            return RMobilePhone::EPlmnBearerServ2;
+        case EPlmnBearerServ3:
+            return RMobilePhone::EPlmnBearerServ3;
+        case EPlmnBearerServ4:
+            return RMobilePhone::EPlmnBearerServ4;
+        case EPlmnBearerServ5:
+            return RMobilePhone::EPlmnBearerServ5;
+        case EPlmnBearerServ6:
+            return RMobilePhone::EPlmnBearerServ6;
+        case EPlmnBearerServ7:
+            return RMobilePhone::EPlmnBearerServ7;
+        case EPlmnBearerServ8:
+            return RMobilePhone::EPlmnBearerServ8;
+        case EPlmnBearerServ9:
+            return RMobilePhone::EPlmnBearerServ9;
+        case EPlmnBearerServA:
+            return RMobilePhone::EPlmnBearerServA;
+        case EPlmnBearerServB:
+            return RMobilePhone::EPlmnBearerServB;
+        case EPlmnBearerServC:
+            return RMobilePhone::EPlmnBearerServC;
+        case EPlmnBearerServD:
+            return RMobilePhone::EPlmnBearerServD;
+        case EPlmnBearerServE:
+            return RMobilePhone::EPlmnBearerServE;
+        case EPlmnBearerServF:
+            return RMobilePhone::EPlmnBearerServF;
+        case EAltTele:
+            return RMobilePhone::EAuxVoiceService;
+        case EUnknown:
+        default:
+            return RMobilePhone::EServiceUnspecified;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Translates given basic service code from ETEL internal code to 
+// the ones used in GSM standards.
+// ---------------------------------------------------------------------------
+//
+TBasicServiceGroups PSetUtility::ChangeToGSM( const RMobilePhone::TMobileService& aBsc )
+    {
+    switch ( aBsc )
+        {               
+        case RMobilePhone::EAllServices:
+            return EAllTeleAndBearer;
+        case RMobilePhone::EAllTele:
+            return EAllTele;
+        case RMobilePhone::EVoiceService:
+        case RMobilePhone::ETelephony:
+            return ETelephony;
+        case RMobilePhone::EAllDataTele:
+            return EAllDataTele;
+        case RMobilePhone::EFaxService:
+            return EFax;
+        case RMobilePhone::EShortMessageService:
+            return ESms;
+        case RMobilePhone::EAllDataExSms:
+            return EAllDataExSms;
+        case RMobilePhone::EAllTeleExcSms:
+            return EAllTeleExcSms;
+        case RMobilePhone::EAllPlmnTele:
+            return EAllPlmnTele;
+        case RMobilePhone::EPlmnTele1:
+            return EPlmnTele1;
+        case RMobilePhone::EPlmnTele2:
+            return EPlmnTele2;
+        case RMobilePhone::EPlmnTele3:
+            return EPlmnTele3;
+        case RMobilePhone::EPlmnTele4:
+            return EPlmnTele4;
+        case RMobilePhone::EPlmnTele5:
+            return EPlmnTele5;
+        case RMobilePhone::EPlmnTele6:
+            return EPlmnTele6;
+        case RMobilePhone::EPlmnTele7:
+            return EPlmnTele7;
+        case RMobilePhone::EPlmnTele8:
+            return EPlmnTele8;
+        case RMobilePhone::EPlmnTele9:
+            return EPlmnTele9;
+        case RMobilePhone::EPlmnTeleA:
+            return EPlmnTeleA;
+        case RMobilePhone::EPlmnTeleB:
+            return EPlmnTeleB;
+        case RMobilePhone::EPlmnTeleC:
+            return EPlmnTeleC;
+        case RMobilePhone::EPlmnTeleD:
+            return EPlmnTeleD;
+        case RMobilePhone::EPlmnTeleE:
+            return EPlmnTeleE;
+        case RMobilePhone::EPlmnTeleF:
+            return EPlmnTeleF;
+        case RMobilePhone::EAllBearer:
+            return EAllBearer;
+        case RMobilePhone::ECircuitDataService:
+        case RMobilePhone::EAllAsync:
+            return EAllAsync;
+        case RMobilePhone::EAllSync:
+            return EAllSync;
+        case RMobilePhone::ESyncData:
+            return ESyncData;        
+        case RMobilePhone::EAsyncData:
+            return EAsyncData;
+        case RMobilePhone::EPacketDataService:
+        case RMobilePhone::EPacketData:
+            return EPacketData;
+        case RMobilePhone::EPadAccess:
+            return EPadAccess;
+        case RMobilePhone::EAllPlmnBearer:
+            return EAllPlmnBearer;
+        case RMobilePhone::EPlmnBearerServ1:
+            return EPlmnBearerServ1;
+        case RMobilePhone::EPlmnBearerServ2:
+            return EPlmnBearerServ2;
+        case RMobilePhone::EPlmnBearerServ3:
+            return EPlmnBearerServ3;
+        case RMobilePhone::EPlmnBearerServ4:
+            return EPlmnBearerServ4;
+        case RMobilePhone::EPlmnBearerServ5:
+            return EPlmnBearerServ5;
+        case RMobilePhone::EPlmnBearerServ6:
+            return EPlmnBearerServ6;
+        case RMobilePhone::EPlmnBearerServ7:
+            return EPlmnBearerServ7;
+        case RMobilePhone::EPlmnBearerServ8:
+            return EPlmnBearerServ8;
+        case RMobilePhone::EPlmnBearerServ9:
+            return EPlmnBearerServ9;
+        case RMobilePhone::EPlmnBearerServA:
+            return EPlmnBearerServA;
+        case RMobilePhone::EPlmnBearerServB:
+            return EPlmnBearerServB;
+        case RMobilePhone::EPlmnBearerServC:
+            return EPlmnBearerServC;
+        case RMobilePhone::EPlmnBearerServD:
+            return EPlmnBearerServD;
+        case RMobilePhone::EPlmnBearerServE:
+            return EPlmnBearerServE;
+        case RMobilePhone::EPlmnBearerServF:
+            return EPlmnBearerServF;
+        case RMobilePhone::EAuxVoiceService:
+        case RMobilePhone::EAltTele:
+            return EAltTele;
+        case RMobilePhone::EServiceUnspecified:
+        default:
+            return EUnknown;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Returns change information status, status is provided as TDivertingStatus,
+// not as TSY's MAdvGsmLineForwarding enumeration.
+// 
+// ---------------------------------------------------------------------------
+//
+TDivertingStatus PSetUtility::GetChangeInfoStatus( 
+    RMobilePhone::TMobilePhoneServiceAction& aAction )
+    {
+    switch ( aAction )
+        {
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        case RMobilePhone::EServiceActionActivate:
+        case RMobilePhone::EServiceActionRegister:
+            return EDivertingStatusActive;
+        case RMobilePhone::EServiceActionDeactivate:
+            return EDivertingStatusInactive;
+        case RMobilePhone::EServiceActionErase:
+            return EDivertingStatusNotRegistered;
+        default:
+            return EDivertingStatusUnknown;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Returns divert reason, reason is provided as TSY's TCallForwardingReasonGet.
+// 
+// ---------------------------------------------------------------------------
+//
+RMobilePhone::TMobilePhoneCFCondition PSetUtility::GetDivertReason(
+  TCallDivertingCondition aCondition )
+    {
+    switch ( aCondition )
+        {
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        case EDivertConditionAllConditionalCases:
+            return RMobilePhone::ECallForwardingAllConditionalCases;
+        case EDivertConditionAllCalls:
+            return RMobilePhone::ECallForwardingAllCases;
+        case EDivertConditionUnconditional:
+            return RMobilePhone::ECallForwardingUnconditional;
+        case EDivertConditionBusy:
+           return RMobilePhone::ECallForwardingBusy;
+        case EDivertConditionNoReply:
+            return RMobilePhone::ECallForwardingNoReply;
+        case EDivertConditionNotReachable:
+           return RMobilePhone::ECallForwardingNotReachable;
+        default:
+            return RMobilePhone::ECallForwardingUnspecified;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Returns divert reason
+// 
+// ---------------------------------------------------------------------------
+//
+TCallDivertingCondition PSetUtility::GetDivertReason(
+    RMobilePhone::TMobilePhoneCFCondition aCondition )
+    {
+    switch ( aCondition )
+        {
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        case RMobilePhone::ECallForwardingAllConditionalCases:
+            return EDivertConditionAllConditionalCases;
+        case RMobilePhone::ECallForwardingAllCases:
+            return EDivertConditionAllCalls;
+        case RMobilePhone::ECallForwardingUnconditional:
+            return EDivertConditionUnconditional;
+        case RMobilePhone::ECallForwardingBusy:
+           return EDivertConditionBusy;
+        case RMobilePhone::ECallForwardingNoReply:
+            return EDivertConditionNoReply;
+        case RMobilePhone::ECallForwardingNotReachable:
+        default:
+           return EDivertConditionNotReachable;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Verify that ALS is really used.
+// ---------------------------------------------------------------------------
+//
+RMobilePhone::TMobileService PSetUtility::VerifyAltLineUseL()
+    {
+    __PHSLOGSTRING("[PHS]--> PSetUtility::VerifyAltLineUseL");
+    RSSSettings* ssSettings = new (ELeave) RSSSettings;
+    CleanupStack::PushL( ssSettings );
+    TInt usedLine;
+    User::LeaveIfError( ssSettings->Open() );
+    User::LeaveIfError( ssSettings->Get( ESSSettingsAls, usedLine ) );
+    __PHSLOGSTRING1("[PHS]    PSetUtility::VerifyAltLineUseL: usedLine: %d", usedLine );
+
+    if ( usedLine == ESSSettingsAlsNotSupported )
+        {
+        User::Leave( KErrNotSupported );
+        }
+    ssSettings->Close();
+    CleanupStack::PopAndDestroy();
+    /*****************************************************
+    *    Series 60 Customer / ETel
+    *    Series 60  ETel API
+    *****************************************************/
+    __PHSLOGSTRING("[PHS] <--PSetUtility::VerifyAltLineUseL");
+
+    return RMobilePhone::EAuxVoiceService;
+    }
+    
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellular/telephonysettings/src/psetvariationproxy.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,88 @@
+/*
+* 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 CPSetVariationProxy class.
+*
+*
+*/
+
+
+#include "psetvariationproxy.h" 
+#include <centralrepository.h>
+#include <settingsinternalcrkeys.h> 
+#include <telservicesinternalcrkeys.h>
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CPSetVariationProxy::CPSetVariationProxy()
+    {   
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CPSetVariationProxy::~CPSetVariationProxy()
+    {       
+    }
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+CPSetVariationProxy* CPSetVariationProxy::NewL( 
+        const TUid& aUid, 
+        const TUint aId )
+    {
+    CPSetVariationProxy* self = new ( ELeave ) CPSetVariationProxy();  
+    CleanupStack::PushL( self );
+    self->ConstructL( aUid, aId );
+    CleanupStack::Pop( self );         
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//
+void CPSetVariationProxy::ConstructL( 
+        const TUid& aUid, 
+        const TUint aId  )
+    {
+    TInt keySetting = 0;
+    CRepository* centralRepository = CRepository::NewLC( aUid );
+    User::LeaveIfError( centralRepository->Get( aId, keySetting ) );
+    
+    if( ( aUid == KCRUidPhoneSettings ) && 
+        ( keySetting ) )
+        {
+        iFeature |= KCallWaitingDistiquishNotProvisioned;   
+        }
+    else if ( aUid == KCRUidTelSrvVariation )
+        {
+        iFeature |= keySetting;
+        }
+    
+    CleanupStack::PopAndDestroy( centralRepository );
+    }
+
+// ---------------------------------------------------------------------------
+// IsFeatureEnabled
+// ---------------------------------------------------------------------------
+//
+TBool CPSetVariationProxy::IsFeatureEnabled( TUint aFeature ) const
+    {
+    return aFeature&iFeature;
+    }
--- a/cellular/telephonysettings/xqbindings/psetwrapper/tsrc/run_auto_tests_qt.bat	Tue Jul 06 14:53:02 2010 +0300
+++ b/cellular/telephonysettings/xqbindings/psetwrapper/tsrc/run_auto_tests_qt.bat	Wed Jul 21 18:26:52 2010 +0300
@@ -32,7 +32,7 @@
 ::    starting with "ut_".
 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
 :DEFAULT
-set TESTED_SRC=..\..\src\*
+set TESTED_SRC=..\..\src\*.cpp
 
 for /f %%a in ('dir /b ut_*') do call :build %%a
 if [%DOMODULESTESTS%] EQU [TRUE] (
@@ -169,7 +169,7 @@
 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
 :CALCULATECOVERAGE
 echo Calculating coverage
-ctcpost %PATH_TO_COVERAGE_DATA%\*.sym | ctcmerge -i - -o profile.txt
+ctcpost %PATH_TO_COVERAGE_DATA%\*.sym -p - | ctcmerge -i - -o profile.txt
 call ctc2html -t 70 -i profile.txt -o \coverage_result -nsb
 goto end
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/cce/bwins/cceu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,20 @@
+EXPORTS
+	?ConferenceCallL@CCCE@@QAEAAVMCCEConferenceCall@@ABVMCCEConferenceCallObserver@@@Z @ 1 NONAME ; class MCCEConferenceCall & CCCE::ConferenceCallL(class MCCEConferenceCallObserver const &)
+	?DtmfInterfaceL@CCCE@@QAEAAVMCCEDtmfInterface@@ABVMCCEDtmfObserver@@@Z @ 2 NONAME ; class MCCEDtmfInterface & CCCE::DtmfInterfaceL(class MCCEDtmfObserver const &)
+	?ExtensionInterfaceL@CCCE@@QAEAAVMCCEExtensionInterface@@ABVMCCEExtensionObserver@@@Z @ 3 NONAME ; class MCCEExtensionInterface & CCCE::ExtensionInterfaceL(class MCCEExtensionObserver const &)
+	?GetAirTimeDuration@CCCE@@QAEXAAVTTimeIntervalSeconds@@0@Z @ 4 NONAME ; void CCCE::GetAirTimeDuration(class TTimeIntervalSeconds &, class TTimeIntervalSeconds &)
+	?GetCSInfo@CCCE@@QAEHAAVCSInfo@@@Z @ 5 NONAME ; int CCCE::GetCSInfo(class CSInfo &)
+	?GetLifeTime@CCCE@@QAEHAAVTDes8@@@Z @ 6 NONAME ; int CCCE::GetLifeTime(class TDes8 &)
+	?InitializeEmergencyCall@CCCE@@QAEAAVMCCECall@@ABVMCCECallObserver@@@Z @ 7 NONAME ; class MCCECall & CCCE::InitializeEmergencyCall(class MCCECallObserver const &)
+	?NewL@CCCE@@SAPAV1@AAVMCCEObserver@@@Z @ 8 NONAME ; class CCCE * CCCE::NewL(class MCCEObserver &)
+	?NewL@CCCE@@SAPAV1@XZ @ 9 NONAME ; class CCCE * CCCE::NewL(void)
+	?NewLC@CCCE@@SAPAV1@AAVMCCEObserver@@@Z @ 10 NONAME ; class CCCE * CCCE::NewLC(class MCCEObserver &)
+	?NewLC@CCCE@@SAPAV1@XZ @ 11 NONAME ; class CCCE * CCCE::NewLC(void)
+	?OpenNewCallL@CCCE@@QAEAAVMCCECall@@ABVTDesC16@@ABVCCCECallParameters@@ABVMCCECallObserver@@@Z @ 12 NONAME ; class MCCECall & CCCE::OpenNewCallL(class TDesC16 const &, class CCCECallParameters const &, class MCCECallObserver const &)
+	?SetObserver@CCCE@@QAEXAAVMCCEObserver@@AAVMCCESsObserver@@@Z @ 13 NONAME ; void CCCE::SetObserver(class MCCEObserver &, class MCCESsObserver &)
+	?TerminateAllButRingingAndQueuedCalls@CCCE@@QAEXXZ @ 14 NONAME ; void CCCE::TerminateAllButRingingAndQueuedCalls(void)
+	?TerminateAllCalls@CCCE@@QAEXXZ @ 15 NONAME ; void CCCE::TerminateAllCalls(void)
+	?TerminateCall@CCCE@@QAEHAAV?$TBuf@$0IA@@@@Z @ 16 NONAME ; int CCCE::TerminateCall(class TBuf<128> &)
+	?TerminateCall@CCCE@@QAEXAAHAAV?$TBuf@$0IA@@@@Z @ 17 NONAME ; void CCCE::TerminateCall(int &, class TBuf<128> &)
+	?NewL@CCCECallParameters@@SAPAV1@XZ @ 18 NONAME ; class CCCECallParameters * CCCECallParameters::NewL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/cce/eabi/cceu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,24 @@
+EXPORTS
+	_ZN4CCCE11GetLifeTimeER5TDes8 @ 1 NONAME
+	_ZN4CCCE11SetObserverER12MCCEObserverR14MCCESsObserver @ 2 NONAME
+	_ZN4CCCE12OpenNewCallLERK7TDesC16RK18CCCECallParametersRK16MCCECallObserver @ 3 NONAME
+	_ZN4CCCE13TerminateCallER4TBufILi128EE @ 4 NONAME
+	_ZN4CCCE13TerminateCallERiR4TBufILi128EE @ 5 NONAME
+	_ZN4CCCE14DtmfInterfaceLERK16MCCEDtmfObserver @ 6 NONAME
+	_ZN4CCCE15ConferenceCallLERK26MCCEConferenceCallObserver @ 7 NONAME
+	_ZN4CCCE17TerminateAllCallsEv @ 8 NONAME
+	_ZN4CCCE18GetAirTimeDurationER20TTimeIntervalSecondsS1_ @ 9 NONAME
+	_ZN4CCCE19ExtensionInterfaceLERK21MCCEExtensionObserver @ 10 NONAME
+	_ZN4CCCE23InitializeEmergencyCallERK16MCCECallObserver @ 11 NONAME
+	_ZN4CCCE36TerminateAllButRingingAndQueuedCallsEv @ 12 NONAME
+	_ZN4CCCE4NewLER12MCCEObserver @ 13 NONAME
+	_ZN4CCCE4NewLEv @ 14 NONAME
+	_ZN4CCCE5NewLCER12MCCEObserver @ 15 NONAME
+	_ZN4CCCE5NewLCEv @ 16 NONAME
+	_ZN4CCCE9GetCSInfoER6CSInfo @ 17 NONAME
+	_ZTI18CCCECallParameters @ 18 NONAME ; #<TI>#
+	_ZTI4CCCE @ 19 NONAME ; #<TI>#
+	_ZTV18CCCECallParameters @ 20 NONAME ; #<VT>#
+	_ZTV4CCCE @ 21 NONAME ; #<VT>#
+	_ZN18CCCECallParameters4NewLEv @ 22 NONAME
+
Binary file convergedcallengine/spsettings/conf/spsettings_10282E7F.crml has changed
Binary file convergedcallengine/spsettings/conf/spsettings_10282e7f.crml has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/bwins/t_csppropertyu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,20 @@
+EXPORTS
+	?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void)
+	?SetValue@CSPProperty@@QAEHABVTDesC16@@@Z @ 2 NONAME ; int CSPProperty::SetValue(class TDesC16 const &)
+	?GetValue@CSPProperty@@QBEHAAW4TOnOff@@@Z @ 3 NONAME ; int CSPProperty::GetValue(enum TOnOff &) const
+	?SetName@CSPProperty@@QAEHW4TServicePropertyName@@@Z @ 4 NONAME ; int CSPProperty::SetName(enum TServicePropertyName)
+	?NewLC@CSPProperty@@SAPAV1@XZ @ 5 NONAME ; class CSPProperty * CSPProperty::NewLC(void)
+	?NewL@CSPProperty@@SAPAV1@XZ @ 6 NONAME ; class CSPProperty * CSPProperty::NewL(void)
+	?DataType@CSPProperty@@SA?AW4TPropertyDataType@@W4TServicePropertyName@@@Z @ 7 NONAME ; enum TPropertyDataType CSPProperty::DataType(enum TServicePropertyName)
+	?PropertyType@CSPProperty@@SA?AW4TSPItemType@@W4TServicePropertyName@@@Z @ 8 NONAME ; enum TSPItemType CSPProperty::PropertyType(enum TServicePropertyName)
+	?GetDataType@CSPProperty@@QBE?AW4TPropertyDataType@@XZ @ 9 NONAME ; enum TPropertyDataType CSPProperty::GetDataType(void) const
+	??8CSPProperty@@QBEHABV0@@Z @ 10 NONAME ; int CSPProperty::operator==(class CSPProperty const &) const
+	?GetPropertyType@CSPProperty@@QBE?AW4TSPItemType@@XZ @ 11 NONAME ; enum TSPItemType CSPProperty::GetPropertyType(void) const
+	?SetValue@CSPProperty@@QAEHW4TOnOff@@@Z @ 12 NONAME ; int CSPProperty::SetValue(enum TOnOff)
+	?SetValue@CSPProperty@@QAEHH@Z @ 13 NONAME ; int CSPProperty::SetValue(int)
+	?GetValue@CSPProperty@@QBEHAAH@Z @ 14 NONAME ; int CSPProperty::GetValue(int &) const
+	?GetName@CSPProperty@@QBE?AW4TServicePropertyName@@XZ @ 15 NONAME ; enum TServicePropertyName CSPProperty::GetName(void) const
+	?CopyL@CSPProperty@@QAEXABV1@@Z @ 16 NONAME ; void CSPProperty::CopyL(class CSPProperty const &)
+	??1CSPProperty@@UAE@XZ @ 17 NONAME ; CSPProperty::~CSPProperty(void)
+	?GetValue@CSPProperty@@QBEHAAVTDes16@@@Z @ 18 NONAME ; int CSPProperty::GetValue(class TDes16 &) const
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/bwins/t_cspsettingsengineu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,53 @@
+EXPORTS
+	?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void)
+	?BeginTransactionL@CCenRepDatabaseUtil@@QAEXXZ @ 2 NONAME ; void CCenRepDatabaseUtil::BeginTransactionL(void)
+	?FindEntryIdsFromPropertiesL@CCenRepDatabaseUtil@@QAEHABV?$RPointerArray@VCCenRepDatabaseProperty@@@@AAV?$RArray@H@@@Z @ 3 NONAME ; int CCenRepDatabaseUtil::FindEntryIdsFromPropertiesL(class RPointerArray<class CCenRepDatabaseProperty> const &, class RArray<int> &)
+	?GetValue@CSPProperty@@QBEHAAW4TOnOff@@@Z @ 4 NONAME ; int CSPProperty::GetValue(enum TOnOff &) const
+	?UpdateProperty@CSPEntry@@QAEHW4TServicePropertyName@@ABVTDesC16@@@Z @ 5 NONAME ; int CSPEntry::UpdateProperty(enum TServicePropertyName, class TDesC16 const &)
+	?NewLC@CSPProperty@@SAPAV1@XZ @ 6 NONAME ; class CSPProperty * CSPProperty::NewLC(void)
+	?NewL@CCenRepDatabaseUtil@@SAPAV1@VTUid@@KKKKH@Z @ 7 NONAME ; class CCenRepDatabaseUtil * CCenRepDatabaseUtil::NewL(class TUid, unsigned long, unsigned long, unsigned long, unsigned long, int)
+	?PropertyType@CSPProperty@@SA?AW4TSPItemType@@W4TServicePropertyName@@@Z @ 8 NONAME ; enum TSPItemType CSPProperty::PropertyType(enum TServicePropertyName)
+	?GetAllProperties@CSPEntry@@QBEABV?$RPointerArray@VCSPProperty@@@@XZ @ 9 NONAME ; class RPointerArray<class CSPProperty> const & CSPEntry::GetAllProperties(void) const
+	?SetServiceName@CSPEntry@@QAEHABVTDesC16@@@Z @ 10 NONAME ; int CSPEntry::SetServiceName(class TDesC16 const &)
+	?GetPropertyType@CSPProperty@@QBE?AW4TSPItemType@@XZ @ 11 NONAME ; enum TSPItemType CSPProperty::GetPropertyType(void) const
+	?GetServiceName@CSPEntry@@QBEABVTDesC16@@XZ @ 12 NONAME ; class TDesC16 const & CSPEntry::GetServiceName(void) const
+	?DeletePropertiesL@CCenRepDatabaseUtil@@QAEHHABV?$RArray@K@@@Z @ 13 NONAME ; int CCenRepDatabaseUtil::DeletePropertiesL(int, class RArray<unsigned long> const &)
+	?CommitTransaction@CCenRepDatabaseUtil@@QAEHXZ @ 14 NONAME ; int CCenRepDatabaseUtil::CommitTransaction(void)
+	?UpdateProperty@CSPEntry@@QAEHW4TServicePropertyName@@W4TOnOff@@@Z @ 15 NONAME ; int CSPEntry::UpdateProperty(enum TServicePropertyName, enum TOnOff)
+	?SetValue@CSPProperty@@QAEHH@Z @ 16 NONAME ; int CSPProperty::SetValue(int)
+	?GetProperty@CSPEntry@@QBEHAAPBVCSPProperty@@H@Z @ 17 NONAME ; int CSPEntry::GetProperty(class CSPProperty const * &, int) const
+	?AddEntryL@CCenRepDatabaseUtil@@QAEXAAHABV?$RPointerArray@VCCenRepDatabaseProperty@@@@@Z @ 18 NONAME ; void CCenRepDatabaseUtil::AddEntryL(int &, class RPointerArray<class CCenRepDatabaseProperty> const &)
+	?AddPropertyL@CSPEntry@@QAEHABVCSPProperty@@@Z @ 19 NONAME ; int CSPEntry::AddPropertyL(class CSPProperty const &)
+	?PropertyCount@CSPEntry@@QBEHXZ @ 20 NONAME ; int CSPEntry::PropertyCount(void) const
+	?DeleteProperty@CSPEntry@@QAEHH@Z @ 21 NONAME ; int CSPEntry::DeleteProperty(int)
+	?GetValue@CSPProperty@@QBEHAAH@Z @ 22 NONAME ; int CSPProperty::GetValue(int &) const
+	??1CSPProperty@@UAE@XZ @ 23 NONAME ; CSPProperty::~CSPProperty(void)
+	?SetValue@CSPProperty@@QAEHABVTDesC16@@@Z @ 24 NONAME ; int CSPProperty::SetValue(class TDesC16 const &)
+	?FindPropertyL@CCenRepDatabaseUtil@@QAEHHKAAVCCenRepDatabaseProperty@@@Z @ 25 NONAME ; int CCenRepDatabaseUtil::FindPropertyL(int, unsigned long, class CCenRepDatabaseProperty &)
+	?NewLC@CCenRepDatabaseUtil@@SAPAV1@VTUid@@KKKKH@Z @ 26 NONAME ; class CCenRepDatabaseUtil * CCenRepDatabaseUtil::NewLC(class TUid, unsigned long, unsigned long, unsigned long, unsigned long, int)
+	?UpdateEntryL@CCenRepDatabaseUtil@@QAEHHABV?$RPointerArray@VCCenRepDatabaseProperty@@@@@Z @ 27 NONAME ; int CCenRepDatabaseUtil::UpdateEntryL(int, class RPointerArray<class CCenRepDatabaseProperty> const &)
+	?SetName@CSPProperty@@QAEHW4TServicePropertyName@@@Z @ 28 NONAME ; int CSPProperty::SetName(enum TServicePropertyName)
+	?DeleteEntryL@CCenRepDatabaseUtil@@QAEHH@Z @ 29 NONAME ; int CCenRepDatabaseUtil::DeleteEntryL(int)
+	?UpdateProperty@CSPEntry@@QAEHW4TServicePropertyName@@H@Z @ 30 NONAME ; int CSPEntry::UpdateProperty(enum TServicePropertyName, int)
+	?NewL@CSPProperty@@SAPAV1@XZ @ 31 NONAME ; class CSPProperty * CSPProperty::NewL(void)
+	?DataType@CSPProperty@@SA?AW4TPropertyDataType@@W4TServicePropertyName@@@Z @ 32 NONAME ; enum TPropertyDataType CSPProperty::DataType(enum TServicePropertyName)
+	?GetServiceId@CSPEntry@@QBEIXZ @ 33 NONAME ; unsigned int CSPEntry::GetServiceId(void) const
+	?NewLC@CSPEntry@@SAPAV1@XZ @ 34 NONAME ; class CSPEntry * CSPEntry::NewLC(void)
+	?FindEntryIdsL@CCenRepDatabaseUtil@@QAEHAAV?$RArray@H@@@Z @ 35 NONAME ; int CCenRepDatabaseUtil::FindEntryIdsL(class RArray<int> &)
+	?RollbackTransaction@CCenRepDatabaseUtil@@QAEXXZ @ 36 NONAME ; void CCenRepDatabaseUtil::RollbackTransaction(void)
+	?GetDataType@CSPProperty@@QBE?AW4TPropertyDataType@@XZ @ 37 NONAME ; enum TPropertyDataType CSPProperty::GetDataType(void) const
+	??8CSPProperty@@QBEHABV0@@Z @ 38 NONAME ; int CSPProperty::operator==(class CSPProperty const &) const
+	??1CCenRepDatabaseUtil@@UAE@XZ @ 39 NONAME ; CCenRepDatabaseUtil::~CCenRepDatabaseUtil(void)
+	?EntryCountL@CCenRepDatabaseUtil@@QAEHAAH@Z @ 40 NONAME ; int CCenRepDatabaseUtil::EntryCountL(int &)
+	?SetValue@CSPProperty@@QAEHW4TOnOff@@@Z @ 41 NONAME ; int CSPProperty::SetValue(enum TOnOff)
+	?FindEntryL@CCenRepDatabaseUtil@@QAEHHAAV?$RPointerArray@VCCenRepDatabaseProperty@@@@@Z @ 42 NONAME ; int CCenRepDatabaseUtil::FindEntryL(int, class RPointerArray<class CCenRepDatabaseProperty> &)
+	??1CSPEntry@@UAE@XZ @ 43 NONAME ; CSPEntry::~CSPEntry(void)
+	?NewL@CSPEntry@@SAPAV1@XZ @ 44 NONAME ; class CSPEntry * CSPEntry::NewL(void)
+	?Reset@CSPEntry@@QAEXXZ @ 45 NONAME ; void CSPEntry::Reset(void)
+	?DeleteProperty@CSPEntry@@QAEHW4TServicePropertyName@@@Z @ 46 NONAME ; int CSPEntry::DeleteProperty(enum TServicePropertyName)
+	?GetProperty@CSPEntry@@QBEHAAPBVCSPProperty@@W4TServicePropertyName@@@Z @ 47 NONAME ; int CSPEntry::GetProperty(class CSPProperty const * &, enum TServicePropertyName) const
+	?CopyL@CSPProperty@@QAEXABV1@@Z @ 48 NONAME ; void CSPProperty::CopyL(class CSPProperty const &)
+	?AddOrUpdatePropertiesL@CCenRepDatabaseUtil@@QAEHHABV?$RPointerArray@VCCenRepDatabaseProperty@@@@@Z @ 49 NONAME ; int CCenRepDatabaseUtil::AddOrUpdatePropertiesL(int, class RPointerArray<class CCenRepDatabaseProperty> const &)
+	?GetName@CSPProperty@@QBE?AW4TServicePropertyName@@XZ @ 50 NONAME ; enum TServicePropertyName CSPProperty::GetName(void) const
+	?GetValue@CSPProperty@@QBEHAAVTDes16@@@Z @ 51 NONAME ; int CSPProperty::GetValue(class TDes16 &) const
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/bwins/t_cspsettingsu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,55 @@
+EXPORTS
+	?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void)
+	?FindSubServicePropertiesL@CSPSettings@@QAEHIW4TSPItemType@@AAV?$RPointerArray@VCSPProperty@@@@@Z @ 2 NONAME ; int CSPSettings::FindSubServicePropertiesL(unsigned int, enum TSPItemType, class RPointerArray<class CSPProperty> &)
+	?SettingsCountL@CSPSettings@@QAEHXZ @ 3 NONAME ; int CSPSettings::SettingsCountL(void)
+	?GetValue@CSPProperty@@QBEHAAW4TOnOff@@@Z @ 4 NONAME ; int CSPProperty::GetValue(enum TOnOff &) const
+	?FindServiceIdsL@CSPSettings@@QAEHAAV?$RArray@I@@@Z @ 5 NONAME ; int CSPSettings::FindServiceIdsL(class RArray<unsigned int> &)
+	?AddOrUpdatePropertiesL@CSPSettings@@QAEHIABV?$RPointerArray@VCSPProperty@@@@@Z @ 6 NONAME ; int CSPSettings::AddOrUpdatePropertiesL(unsigned int, class RPointerArray<class CSPProperty> const &)
+	?UpdateProperty@CSPEntry@@QAEHW4TServicePropertyName@@ABVTDesC16@@@Z @ 7 NONAME ; int CSPEntry::UpdateProperty(enum TServicePropertyName, class TDesC16 const &)
+	?NewLC@CSPProperty@@SAPAV1@XZ @ 8 NONAME ; class CSPProperty * CSPProperty::NewLC(void)
+	?PropertyType@CSPProperty@@SA?AW4TSPItemType@@W4TServicePropertyName@@@Z @ 9 NONAME ; enum TSPItemType CSPProperty::PropertyType(enum TServicePropertyName)
+	?GetAllProperties@CSPEntry@@QBEABV?$RPointerArray@VCSPProperty@@@@XZ @ 10 NONAME ; class RPointerArray<class CSPProperty> const & CSPEntry::GetAllProperties(void) const
+	?SetServiceName@CSPEntry@@QAEHABVTDesC16@@@Z @ 11 NONAME ; int CSPEntry::SetServiceName(class TDesC16 const &)
+	?FindEntryL@CSPSettings@@QAEHIAAVCSPEntry@@@Z @ 12 NONAME ; int CSPSettings::FindEntryL(unsigned int, class CSPEntry &)
+	?GetPropertyType@CSPProperty@@QBE?AW4TSPItemType@@XZ @ 13 NONAME ; enum TSPItemType CSPProperty::GetPropertyType(void) const
+	?GetServiceName@CSPEntry@@QBEABVTDesC16@@XZ @ 14 NONAME ; class TDesC16 const & CSPEntry::GetServiceName(void) const
+	?IsFeatureSupported@CSPSettings@@QAEHW4TSPServiceFeature@@@Z @ 15 NONAME ; int CSPSettings::IsFeatureSupported(enum TSPServiceFeature)
+	?FindServiceNamesL@CSPSettings@@QAEHAAV?$RArray@I@@AAVCDesC16Array@@@Z @ 16 NONAME ; int CSPSettings::FindServiceNamesL(class RArray<unsigned int> &, class CDesC16Array &)
+	?UpdateProperty@CSPEntry@@QAEHW4TServicePropertyName@@W4TOnOff@@@Z @ 17 NONAME ; int CSPEntry::UpdateProperty(enum TServicePropertyName, enum TOnOff)
+	?SetValue@CSPProperty@@QAEHH@Z @ 18 NONAME ; int CSPProperty::SetValue(int)
+	?DeleteServicePropertiesL@CSPSettings@@QAEHIABV?$RArray@W4TServicePropertyName@@@@@Z @ 19 NONAME ; int CSPSettings::DeleteServicePropertiesL(unsigned int, class RArray<enum TServicePropertyName> const &)
+	?GetProperty@CSPEntry@@QBEHAAPBVCSPProperty@@H@Z @ 20 NONAME ; int CSPEntry::GetProperty(class CSPProperty const * &, int) const
+	?AddPropertyL@CSPEntry@@QAEHABVCSPProperty@@@Z @ 21 NONAME ; int CSPEntry::AddPropertyL(class CSPProperty const &)
+	?PropertyCount@CSPEntry@@QBEHXZ @ 22 NONAME ; int CSPEntry::PropertyCount(void) const
+	?FindServiceIdsFromPropertiesL@CSPSettings@@QAEHABV?$RPointerArray@VCSPProperty@@@@AAV?$RArray@I@@@Z @ 23 NONAME ; int CSPSettings::FindServiceIdsFromPropertiesL(class RPointerArray<class CSPProperty> const &, class RArray<unsigned int> &)
+	?DeleteProperty@CSPEntry@@QAEHH@Z @ 24 NONAME ; int CSPEntry::DeleteProperty(int)
+	?GetValue@CSPProperty@@QBEHAAH@Z @ 25 NONAME ; int CSPProperty::GetValue(int &) const
+	?FindPropertyL@CSPSettings@@QAEHIW4TServicePropertyName@@AAVCSPProperty@@@Z @ 26 NONAME ; int CSPSettings::FindPropertyL(unsigned int, enum TServicePropertyName, class CSPProperty &)
+	??1CSPProperty@@UAE@XZ @ 27 NONAME ; CSPProperty::~CSPProperty(void)
+	?SetValue@CSPProperty@@QAEHABVTDesC16@@@Z @ 28 NONAME ; int CSPProperty::SetValue(class TDesC16 const &)
+	?NewL@CSPSettings@@SAPAV1@XZ @ 29 NONAME ; class CSPSettings * CSPSettings::NewL(void)
+	?GetSIPVoIPSWVersion@CSPSettings@@SAABVTDesC16@@XZ @ 30 NONAME ; class TDesC16 const & CSPSettings::GetSIPVoIPSWVersion(void)
+	?UpdateEntryL@CSPSettings@@QAEHABVCSPEntry@@@Z @ 31 NONAME ; int CSPSettings::UpdateEntryL(class CSPEntry const &)
+	?SetName@CSPProperty@@QAEHW4TServicePropertyName@@@Z @ 32 NONAME ; int CSPProperty::SetName(enum TServicePropertyName)
+	?DeleteEntryL@CSPSettings@@QAEHI@Z @ 33 NONAME ; int CSPSettings::DeleteEntryL(unsigned int)
+	?UpdateProperty@CSPEntry@@QAEHW4TServicePropertyName@@H@Z @ 34 NONAME ; int CSPEntry::UpdateProperty(enum TServicePropertyName, int)
+	?NewL@CSPProperty@@SAPAV1@XZ @ 35 NONAME ; class CSPProperty * CSPProperty::NewL(void)
+	?DataType@CSPProperty@@SA?AW4TPropertyDataType@@W4TServicePropertyName@@@Z @ 36 NONAME ; enum TPropertyDataType CSPProperty::DataType(enum TServicePropertyName)
+	?GetServiceId@CSPEntry@@QBEIXZ @ 37 NONAME ; unsigned int CSPEntry::GetServiceId(void) const
+	?NewLC@CSPEntry@@SAPAV1@XZ @ 38 NONAME ; class CSPEntry * CSPEntry::NewLC(void)
+	?GetDataType@CSPProperty@@QBE?AW4TPropertyDataType@@XZ @ 39 NONAME ; enum TPropertyDataType CSPProperty::GetDataType(void) const
+	??8CSPProperty@@QBEHABV0@@Z @ 40 NONAME ; int CSPProperty::operator==(class CSPProperty const &) const
+	??1CSPSettings@@UAE@XZ @ 41 NONAME ; CSPSettings::~CSPSettings(void)
+	?SetValue@CSPProperty@@QAEHW4TOnOff@@@Z @ 42 NONAME ; int CSPProperty::SetValue(enum TOnOff)
+	??1CSPEntry@@UAE@XZ @ 43 NONAME ; CSPEntry::~CSPEntry(void)
+	?NewL@CSPEntry@@SAPAV1@XZ @ 44 NONAME ; class CSPEntry * CSPEntry::NewL(void)
+	?AddOrUpdatePropertyL@CSPSettings@@QAEHIABVCSPProperty@@@Z @ 45 NONAME ; int CSPSettings::AddOrUpdatePropertyL(unsigned int, class CSPProperty const &)
+	?Reset@CSPEntry@@QAEXXZ @ 46 NONAME ; void CSPEntry::Reset(void)
+	?DeleteProperty@CSPEntry@@QAEHW4TServicePropertyName@@@Z @ 47 NONAME ; int CSPEntry::DeleteProperty(enum TServicePropertyName)
+	?AddEntryL@CSPSettings@@QAEHAAVCSPEntry@@@Z @ 48 NONAME ; int CSPSettings::AddEntryL(class CSPEntry &)
+	?GetProperty@CSPEntry@@QBEHAAPBVCSPProperty@@W4TServicePropertyName@@@Z @ 49 NONAME ; int CSPEntry::GetProperty(class CSPProperty const * &, enum TServicePropertyName) const
+	?CopyL@CSPProperty@@QAEXABV1@@Z @ 50 NONAME ; void CSPProperty::CopyL(class CSPProperty const &)
+	?GetName@CSPProperty@@QBE?AW4TServicePropertyName@@XZ @ 51 NONAME ; enum TServicePropertyName CSPProperty::GetName(void) const
+	?GetValue@CSPProperty@@QBEHAAVTDes16@@@Z @ 52 NONAME ; int CSPProperty::GetValue(class TDes16 &) const
+	?NewLC@CSPSettings@@SAPAV1@XZ @ 53 NONAME ; class CSPSettings * CSPSettings::NewLC(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/bwins/t_cspsettingsvoiputilsu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,27 @@
+EXPORTS
+	?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void)
+	?SetValue@CSPProperty@@QAEHABVTDesC16@@@Z @ 2 NONAME ; int CSPProperty::SetValue(class TDesC16 const &)
+	?NewLC@CSPSettingsVoIPUtils@@SAPAV1@XZ @ 3 NONAME ; class CSPSettingsVoIPUtils * CSPSettingsVoIPUtils::NewLC(void)
+	?VoIPProfilesExistL@CSPSettingsVoIPUtils@@QBEHXZ @ 4 NONAME ; int CSPSettingsVoIPUtils::VoIPProfilesExistL(void) const
+	?GetValue@CSPProperty@@QBEHAAW4TOnOff@@@Z @ 5 NONAME ; int CSPProperty::GetValue(enum TOnOff &) const
+	?SetName@CSPProperty@@QAEHW4TServicePropertyName@@@Z @ 6 NONAME ; int CSPProperty::SetName(enum TServicePropertyName)
+	?NewL@CSPSettingsVoIPUtils@@SAPAV1@XZ @ 7 NONAME ; class CSPSettingsVoIPUtils * CSPSettingsVoIPUtils::NewL(void)
+	?NewLC@CSPProperty@@SAPAV1@XZ @ 8 NONAME ; class CSPProperty * CSPProperty::NewLC(void)
+	?NewL@CSPProperty@@SAPAV1@XZ @ 9 NONAME ; class CSPProperty * CSPProperty::NewL(void)
+	?DataType@CSPProperty@@SA?AW4TPropertyDataType@@W4TServicePropertyName@@@Z @ 10 NONAME ; enum TPropertyDataType CSPProperty::DataType(enum TServicePropertyName)
+	?PropertyType@CSPProperty@@SA?AW4TSPItemType@@W4TServicePropertyName@@@Z @ 11 NONAME ; enum TSPItemType CSPProperty::PropertyType(enum TServicePropertyName)
+	?GetDataType@CSPProperty@@QBE?AW4TPropertyDataType@@XZ @ 12 NONAME ; enum TPropertyDataType CSPProperty::GetDataType(void) const
+	??8CSPProperty@@QBEHABV0@@Z @ 13 NONAME ; int CSPProperty::operator==(class CSPProperty const &) const
+	?GetPreferredService@CSPSettingsVoIPUtils@@QBEHAAI@Z @ 14 NONAME ; int CSPSettingsVoIPUtils::GetPreferredService(unsigned int &) const
+	?IsVoIPSupported@CSPSettingsVoIPUtils@@QBEHXZ @ 15 NONAME ; int CSPSettingsVoIPUtils::IsVoIPSupported(void) const
+	?GetPropertyType@CSPProperty@@QBE?AW4TSPItemType@@XZ @ 16 NONAME ; enum TSPItemType CSPProperty::GetPropertyType(void) const
+	?SetValue@CSPProperty@@QAEHW4TOnOff@@@Z @ 17 NONAME ; int CSPProperty::SetValue(enum TOnOff)
+	??1CSPSettingsVoIPUtils@@UAE@XZ @ 18 NONAME ; CSPSettingsVoIPUtils::~CSPSettingsVoIPUtils(void)
+	?SetValue@CSPProperty@@QAEHH@Z @ 19 NONAME ; int CSPProperty::SetValue(int)
+	?GetValue@CSPProperty@@QBEHAAH@Z @ 20 NONAME ; int CSPProperty::GetValue(int &) const
+	?GetName@CSPProperty@@QBE?AW4TServicePropertyName@@XZ @ 21 NONAME ; enum TServicePropertyName CSPProperty::GetName(void) const
+	?CopyL@CSPProperty@@QAEXABV1@@Z @ 22 NONAME ; void CSPProperty::CopyL(class CSPProperty const &)
+	??1CSPProperty@@UAE@XZ @ 23 NONAME ; CSPProperty::~CSPProperty(void)
+	?GetValue@CSPProperty@@QBEHAAVTDes16@@@Z @ 24 NONAME ; int CSPProperty::GetValue(class TDes16 &) const
+	?IsPreferredTelephonyVoIP@CSPSettingsVoIPUtils@@QBEHXZ @ 25 NONAME ; int CSPSettingsVoIPUtils::IsPreferredTelephonyVoIP(void) const
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/bwins/ut_spsbackuphelpermonitoru.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,2 @@
+EXPORTS
+	?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/bwins/ut_spsbackuphelperperformeru.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,2 @@
+EXPORTS
+	?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/bwins/ut_spsbufferedpublisheru.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,2 @@
+EXPORTS
+	?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/group/T_CSPPropertyUT.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* 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: MMP file for T_CSPProperty.
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include <digia/eunit/eunitcaps.h>
+
+TARGET            T_CSPProperty.dll
+TARGETTYPE        dll
+UID               0x1000af5a 0x01700000
+CAPABILITY      EUNIT_CAPS
+VENDORID          VID_DEFAULT
+
+SOURCEPATH        ../src
+SOURCE            T_CSPProperty.cpp
+SOURCE            T_CSPProperty_DllMain.cpp
+
+
+// Sources required by the test suite
+SOURCEPATH        ../../../../../src
+SOURCE            spproperty.cpp
+
+USERINCLUDE       ../src
+USERINCLUDE       ../../../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE     /epoc32/include/Digia/EUnit
+
+LIBRARY           EUnit.lib
+LIBRARY           EUnitUtil.lib
+LIBRARY           euser.lib
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/group/T_CSPSettingsEngineUT.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* 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: MMP file for T_CSPSettingsEngine.
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include <digia/eunit/eunitcaps.h>
+
+TARGET            T_CSPSettingsEngine.dll
+TARGETTYPE        dll
+UID               0x1000af5a 0x01700000
+CAPABILITY      EUNIT_CAPS
+VENDORID          VID_DEFAULT
+
+SOURCEPATH        ../src
+SOURCE            T_CSPSettingsEngine.cpp
+SOURCE            T_CSPSettingsEngine_DllMain.cpp
+
+
+// Sources required by the test suite
+SOURCEPATH        ../../../../../src
+SOURCE            spsettingsengine.cpp
+
+SOURCE            spentry.cpp
+SOURCE            spproperty.cpp
+
+SOURCEPATH        ../stubs
+SOURCE            T_cenrepdatabaseutilStub.cpp
+
+
+USERINCLUDE       ../src
+USERINCLUDE       ../../../../../../cenrepdatabase
+USERINCLUDE       ../../../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE     /epoc32/include/Digia/EUnit
+
+LIBRARY           EUnit.lib
+LIBRARY           EUnitUtil.lib
+LIBRARY           euser.lib
+
+LIBRARY           bafl.lib // CDesCArray
+LIBRARY           FeatMgr.lib
+LIBRARY           cenrepdatabase.lib
+LIBRARY           centralrepository.lib
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/group/T_CSPSettingsUT.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* 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: MMP file for T_CSPSettings.
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include <digia/eunit/eunitcaps.h>
+
+TARGET            T_CSPSettings.dll
+TARGETTYPE        dll
+UID               0x1000af5a 0x01700000
+CAPABILITY      EUNIT_CAPS
+VENDORID          VID_DEFAULT
+
+SOURCEPATH        ../src
+SOURCE            T_CSPSettings.cpp
+SOURCE            T_CSPSettings_DllMain.cpp
+
+SOURCEPATH        ../stubs
+SOURCE            FeatMgrStub.cpp
+SOURCE            TestData.cpp
+SOURCE            spsbufferedpublisher_stub.cpp
+
+// Sources required by the test suite
+SOURCEPATH        ../../../../../src
+SOURCE            spsettings.cpp
+
+SOURCE            spsettingsengine.cpp
+SOURCE            spentry.cpp
+SOURCE            spproperty.cpp
+
+USERINCLUDE       ../src
+USERINCLUDE       ../stubs
+USERINCLUDE       ../../../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE     /epoc32/include/Digia/EUnit
+
+LIBRARY           EUnit.lib
+LIBRARY           EUnitUtil.lib
+LIBRARY           euser.lib
+
+LIBRARY           bafl.lib // CDesCArray
+LIBRARY           centralrepository.lib
+LIBRARY           cenrepdatabase.lib
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/group/T_CSPSettingsVoIPUtilsUT.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,59 @@
+/*
+* 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: MMP file for T_CSPSettingsVoIPUtils.
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include <digia/eunit/eunitcaps.h>
+
+TARGET            T_CSPSettingsVoIPUtils.dll
+TARGETTYPE        dll
+UID               0x1000af5a 0x01700000
+CAPABILITY      EUNIT_CAPS
+VENDORID          VID_DEFAULT
+
+SOURCEPATH        ../src
+SOURCE            T_CSPSettingsVoIPUtils.cpp
+SOURCE            T_CSPSettingsVoIPUtils_DllMain.cpp
+
+
+// Sources required by the test suite
+SOURCEPATH        ../../../../../src
+SOURCE            spsettingsvoiputils.cpp
+
+//SOURCE            spsettingsengine.cpp
+SOURCE            spproperty.cpp
+
+SOURCEPATH        ../stubs
+SOURCE            T_spsettingsengineStub.cpp
+SOURCE            FeatMgrStub.cpp
+SOURCE            TestData.cpp
+
+USERINCLUDE       ../src
+USERINCLUDE       ../stubs
+USERINCLUDE       ../../../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE     /epoc32/include/Digia/EUnit
+
+LIBRARY           EUnit.lib
+LIBRARY           EUnitUtil.lib
+LIBRARY           euser.lib
+
+LIBRARY           centralrepository.lib
+LIBRARY           cenrepdatabase.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,36 @@
+/*
+* 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: Build file for spsettings testing components.
+*
+*/
+
+
+PRJ_PLATFORMS
+    DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+
+PRJ_TESTMMPFILES
+T_CSPPropertyUT.mmp
+T_CSPSettingsUT.mmp
+T_CSPSettingsVoIPUtilsUT.mmp
+T_CSPSettingsEngineUT.mmp
+ut_spsbackuphelpermonitor.mmp
+ut_spsbackuphelperperformer.mmp
+ut_spsbufferredpublisher.mmp
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/group/ut_spsbackuphelpermonitor.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* 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: 
+*
+*/
+
+#include <platform_paths.hrh>
+#include <Digia/Eunit/EUnitCaps.h>
+
+TARGETTYPE DLL
+TARGET ut_spsbackuphelpermonitor.dll
+CAPABILITY      EUNIT_CAPS
+UID 0x1000af5a 0x01700000
+VENDORID          VID_DEFAULT
+
+SOURCEPATH        ../src
+SOURCE            ut_spsbackuphelpermonitor.cpp
+SOURCE            ut_spsbackuphelpermonitor_dllmain.cpp
+
+SOURCEPATH        ../stubs
+SOURCE            spsbackuphelperperformer_stub.cpp
+SOURCE            abclient_stub.cpp
+
+// Sources required by the test suite
+SOURCEPATH        ../../../../../backuphelper/src
+SOURCE            spsbackuphelpermonitor.cpp
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE     /epoc32/include/connect
+SYSTEMINCLUDE     /epoc32/include/Digia/EUnit
+USERINCLUDE        ../../../../../backuphelper/inc
+USERINCLUDE        ../../../../../inc
+
+LIBRARY           EUnit.lib
+LIBRARY           EUnitUtil.lib
+LIBRARY           euser.lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/group/ut_spsbackuphelperperformer.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* 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: 
+*
+*/
+
+#include <platform_paths.hrh>
+#include <Digia/Eunit/EUnitCaps.h>
+
+TARGETTYPE DLL
+TARGET ut_spsbackuphelperperformer.dll
+CAPABILITY      EUNIT_CAPS
+UID 0x1000af5a 0x01700000
+VENDORID          VID_DEFAULT
+
+SOURCEPATH        ../src
+SOURCE            ut_spsbackuphelperperformer.cpp
+SOURCE            ut_spsbackuphelperperformer_dllmain.cpp
+
+SOURCEPATH        ../stubs
+SOURCE            serviceprovidersettings_stub.cpp
+SOURCE            centralrepository_stub.cpp
+
+// Sources required by the test suite
+SOURCEPATH        ../../../../../backuphelper/src
+SOURCE            spsbackuphelperperformer.cpp
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE     /epoc32/include/connect
+SYSTEMINCLUDE     /epoc32/include/Digia/EUnit
+USERINCLUDE        ../../../../../backuphelper/inc
+USERINCLUDE        ../../../../../inc
+
+LIBRARY           EUnit.lib
+LIBRARY           EUnitUtil.lib
+LIBRARY           euser.lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/group/ut_spsbufferredpublisher.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -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: 
+*
+*/
+
+#include <platform_paths.hrh>
+#include <Digia/Eunit/EUnitCaps.h>
+
+TARGETTYPE DLL
+TARGET ut_spsbufferedpublisher.dll
+CAPABILITY      EUNIT_CAPS
+UID 0x1000af5a 0x01700000
+VENDORID          VID_DEFAULT
+
+SOURCEPATH        ../src
+SOURCE            ut_spsbufferedpublisher.cpp
+SOURCE            ut_spsbufferedpublisher_dllmain.cpp
+
+SOURCEPATH        ../stubs
+
+// Sources required by the test suite
+SOURCEPATH        ../../../../../src
+SOURCE            spsbufferedpublisher.cpp
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE     /epoc32/include/connect
+SYSTEMINCLUDE     /epoc32/include/Digia/EUnit
+USERINCLUDE        ../../../../../inc
+
+LIBRARY           EUnit.lib
+LIBRARY           EUnitUtil.lib
+LIBRARY           euser.lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/T_CSPProperty.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,284 @@
+/*
+* 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 T_CSPProperty class.
+*
+*/
+
+#include "T_CSPProperty.h"
+#include <EUnitMacros.h>
+#include <EUnitDecorators.h>
+
+
+
+// - Construction -----------------------------------------------------------
+
+T_CSPProperty* T_CSPProperty::NewL()
+    {
+    T_CSPProperty* self = T_CSPProperty::NewLC();
+    CleanupStack::Pop();
+    return self;
+    }
+
+T_CSPProperty* T_CSPProperty::NewLC()
+    {
+    T_CSPProperty* self = new( ELeave ) T_CSPProperty();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+T_CSPProperty::~T_CSPProperty()
+    {
+    }
+
+T_CSPProperty::T_CSPProperty()
+    {
+    }
+
+void T_CSPProperty::ConstructL()
+    {
+    CEUnitTestSuiteClass::ConstructL();
+    }
+
+// - Test methods -----------------------------------------------------------
+
+
+
+void T_CSPProperty::SetupL(  )
+    {
+    iCSPProperty = CSPProperty::NewL();
+    }
+    
+
+void T_CSPProperty::Teardown(  )
+    {
+    delete iCSPProperty;
+    iCSPProperty = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// T_CSPProperty::PropertyDatatypeTIntSetGetTestL
+// ---------------------------------------------------------------------------
+//
+void T_CSPProperty::PropertyDatatypeTIntSetGetTestL(  )
+    {
+    TInt profIdSet( 15 );
+    EUNIT_ASSERT( KErrArgument == iCSPProperty->SetValue( profIdSet ) );
+    
+    iCSPProperty->SetName( EPropertyVoIPSubServicePluginId );
+    EUNIT_ASSERT( EPropertyVoIPSubServicePluginId == iCSPProperty->GetName() );
+    User::LeaveIfError( iCSPProperty->SetValue( profIdSet ));
+    EUNIT_ASSERT( EDataTypeInt == iCSPProperty->GetDataType() );
+    
+    TInt profIdGet( 0 );
+    TInt error = iCSPProperty->GetValue( profIdGet );
+    EUNIT_ASSERT( error == KErrNone );
+    EUNIT_ASSERT( profIdSet == profIdGet );
+    }
+
+// ---------------------------------------------------------------------------
+// T_CSPProperty::PropertyDatatypeOnOffSetGetTestL
+// ---------------------------------------------------------------------------
+//
+void T_CSPProperty::PropertyDatatypeOnOffSetGetTestL(  )
+    {
+    TOnOff onOffSet( EOn );
+    EUNIT_ASSERT( KErrArgument == iCSPProperty->SetValue( onOffSet ) );
+    
+    iCSPProperty->SetName( ESubPropertyPresenceEnabled );
+    EUNIT_ASSERT( ESubPropertyPresenceEnabled == iCSPProperty->GetName() );
+    User::LeaveIfError( iCSPProperty->SetValue( onOffSet ) );
+    EUNIT_ASSERT( EDataTypeOnOff == iCSPProperty->GetDataType() );
+    
+    TOnOff onOffGet( EOONotSet );
+    TInt error = iCSPProperty->GetValue( onOffGet );
+    EUNIT_ASSERT( error == KErrNone );
+    EUNIT_ASSERT( onOffSet == onOffGet );
+    }
+
+// ---------------------------------------------------------------------------
+// T_CSPProperty::PropertyDatatypeTDesCSetGetTestL
+// ---------------------------------------------------------------------------
+//
+void T_CSPProperty::PropertyDatatypeTDesCSetGetTestL(  )
+    {
+    iCSPProperty->SetName( EPropertyBrandId );
+    EUNIT_ASSERT( EPropertyBrandId == iCSPProperty->GetName() );
+    
+    TBuf<514> overflower;
+    overflower.FillZ( 514 );
+    EUNIT_ASSERT( KErrOverflow == iCSPProperty->SetValue( overflower ) );
+    
+    RBuf brandIdSet;
+    brandIdSet.CreateL( _L( "SomeBrandId" ) );
+    CleanupClosePushL( brandIdSet);
+    User::LeaveIfError( iCSPProperty->SetValue( brandIdSet ) );
+    EUNIT_ASSERT( iCSPProperty->GetDataType() == EDataTypeDes );
+    
+    RBuf brandIdGet;    
+    brandIdGet.CreateL( 9 );
+    CleanupClosePushL( brandIdGet );
+    brandIdGet.FillZ( 9 );
+    EUNIT_ASSERT( KErrOverflow == iCSPProperty->GetValue( brandIdGet ) );
+    CleanupStack::PopAndDestroy( &brandIdGet);
+    
+    brandIdGet.CreateL( KSPMaxDesLength );
+    CleanupClosePushL( brandIdGet);
+    TInt error = iCSPProperty->GetValue( brandIdGet );
+    EUNIT_ASSERT( error == KErrNone );
+    EUNIT_ASSERT( brandIdSet.Compare( brandIdGet ) == 0 );
+
+    CleanupStack::PopAndDestroy( &brandIdGet);
+    CleanupStack::PopAndDestroy( &brandIdSet);
+    }
+
+// ---------------------------------------------------------------------------
+// CopyLL
+// ---------------------------------------------------------------------------
+//
+void T_CSPProperty::CopyLL(  )
+    {
+    iCSPProperty->CopyL( *iCSPProperty );
+    
+    CSPProperty* property = CSPProperty::NewLC();
+    RBuf brandIdSet;
+    brandIdSet.CreateL( _L( "SomeBrandId" ) );
+    CleanupClosePushL( brandIdSet);
+    User::LeaveIfError( property->SetValue( brandIdSet ) );
+    
+    iCSPProperty->CopyL( *property );
+    
+    RBuf brandIdGet;
+    brandIdGet.CreateL( KSPMaxDesLength );
+    CleanupClosePushL( brandIdGet);
+    TInt error = iCSPProperty->GetValue( brandIdGet );
+    EUNIT_ASSERT( error == KErrNone );
+    EUNIT_ASSERT( brandIdSet.Compare( brandIdGet ) == 0 );
+    
+    CleanupStack::PopAndDestroy( &brandIdGet );
+    CleanupStack::PopAndDestroy( &brandIdSet );
+    CleanupStack::PopAndDestroy( property );
+    }
+
+// ---------------------------------------------------------------------------
+// CopyLL
+// ---------------------------------------------------------------------------
+//
+void T_CSPProperty::SetValueNoDataTypeCheckL(  )
+    {
+    RBuf bufToSet;
+    bufToSet.CreateL( KSPMaxDesLength + 1 );
+    CleanupClosePushL( bufToSet );
+    bufToSet.FillZ( KSPMaxDesLength + 1 );
+    EUNIT_ASSERT( KErrOverflow == iCSPProperty->SetValueNoDataTypeCheck( bufToSet ) );    
+    CleanupStack::PopAndDestroy( &bufToSet );
+    
+    bufToSet.CreateL( _L( "SomeBrandId" ) );
+    CleanupClosePushL( bufToSet );
+    TInt error = iCSPProperty->SetValueNoDataTypeCheck( bufToSet );
+    EUNIT_ASSERT( KErrNone == error );
+    
+    CleanupStack::PopAndDestroy( &bufToSet );
+    }
+
+
+// ---------------------------------------------------------------------------
+// PropertyTypeL
+// ---------------------------------------------------------------------------
+//
+void T_CSPProperty::PropertyTypeL(  )
+    {
+    EUNIT_ASSERT( EItemTypeNotDefined == iCSPProperty->PropertyType( EPropertyUnknown ) );
+    EUNIT_ASSERT( EItemTypeVoIPSubProperty == iCSPProperty->PropertyType( ESubPropertyVoIPPreferredSNAPId ) );
+    EUNIT_ASSERT( EItemTypePresenceSubProperty == iCSPProperty->PropertyType( ESubPropertyPresencePreferredSNAPId  ) );
+    EUNIT_ASSERT( EItemTypeIMSubProperty == iCSPProperty->PropertyType( ESubPropertyIMPreferredSNAPId ) );
+    EUNIT_ASSERT( EItemTypeVMBXSubProperty  == iCSPProperty->PropertyType( ESubPropertyVMBXPreferredSNAPId ) );
+    EUNIT_ASSERT( EItemTypeProperty  == iCSPProperty->PropertyType( EPropertyCTIPluginId ) );
+    }
+
+// ---------------------------------------------------------------------------
+// PropertyTypeL
+// ---------------------------------------------------------------------------
+//
+void T_CSPProperty::EqualToOperatorOverloadL(  )
+    {
+    CSPProperty* property = CSPProperty::NewLC();
+    TBool objectsEqual = *iCSPProperty == *iCSPProperty;
+    EUNIT_ASSERT( objectsEqual );
+    
+    property->SetName( EPropertyBrandId );
+    objectsEqual = *iCSPProperty == *property;
+    EUNIT_ASSERT( !objectsEqual );
+    
+    CleanupStack::PopAndDestroy( property );
+    }
+    
+
+// - EUnit test table -------------------------------------------------------
+
+EUNIT_BEGIN_TEST_TABLE(
+    T_CSPProperty,
+    "Add test suite description here.",
+    "UNIT" )
+    
+EUNIT_TEST(
+    "PropertyDatatypeTIntSetGetTest - Test",
+    "CSPProperty",
+    "PropertyDatatypeTIntSetGetTest - Test",
+    "FUNCTIONALITY",
+    SetupL, PropertyDatatypeTIntSetGetTestL, Teardown)
+    
+EUNIT_TEST(
+    "PropertyDatatypeTIntSetGetTest - Test",
+    "CSPProperty",
+    "PropertyDatatypeTIntSetGetTest - Test",
+    "FUNCTIONALITY",
+    SetupL, PropertyDatatypeOnOffSetGetTestL, Teardown)
+    
+EUNIT_TEST(
+    "PropertyDatatypeTIntSetGetTest - Test",
+    "CSPProperty",
+    "PropertyDatatypeTIntSetGetTest - Test",
+    "FUNCTIONALITY",
+    SetupL, PropertyDatatypeTDesCSetGetTestL, Teardown)
+
+EUNIT_TEST(
+    "CopyL - Test",
+    "CSPProperty",
+    "CopyL - Test",
+    "FUNCTIONALITY",
+    SetupL, CopyLL, Teardown)
+
+EUNIT_TEST(
+    "SetValueNoDataTypeCheck - Test",
+    "CSPProperty",
+    "SetValueNoDataTypeCheck - Test",
+    "FUNCTIONALITY",
+    SetupL, SetValueNoDataTypeCheckL, Teardown)
+    
+EUNIT_TEST(
+    "PropertyType - Test",
+    "CSPProperty",
+    "PropertyType - Test",
+    "FUNCTIONALITY",
+    SetupL, PropertyTypeL, Teardown)
+
+EUNIT_TEST(
+    "EqualToOperatorRedefinition - Test",
+    "CSPProperty",
+    "EqualToOperatorRedefinition - Test",
+    "FUNCTIONALITY",
+    SetupL, EqualToOperatorOverloadL, Teardown)
+
+EUNIT_END_TEST_TABLE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/T_CSPProperty.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,77 @@
+/*
+* 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: Declaration of T_CSPProperty class.
+*
+*/
+
+#ifndef __T_CSPPROPERTY_H__
+#define __T_CSPPROPERTY_H__
+
+// INCLUDES
+#include <CEUnitTestSuiteClass.h>
+#include <EUnitDecorators.h>
+
+#include "spproperty.h"
+
+// FORWARD DECLARATIONS
+
+
+// CLASS DEFINITION
+/**
+ * Generated EUnit test suite class.
+ */
+NONSHARABLE_CLASS( T_CSPProperty )
+	: public CEUnitTestSuiteClass
+    {
+    public:  // Constructors and destructor
+
+        static T_CSPProperty* NewL();
+        static T_CSPProperty* NewLC();
+        ~T_CSPProperty();
+
+    private: // Constructors
+
+        T_CSPProperty();
+        void ConstructL();
+
+    private: // New methods
+
+         void SetupL();
+        
+         void Teardown();
+         
+         void PropertyDatatypeTIntSetGetTestL();
+         
+         void PropertyDatatypeOnOffSetGetTestL();
+         
+         void PropertyDatatypeTDesCSetGetTestL();
+         
+         void CopyLL();
+         
+         void SetValueNoDataTypeCheckL();
+         
+         void PropertyTypeL();
+         
+         void EqualToOperatorOverloadL();
+        
+
+    private: // Data
+
+        CSPProperty* iCSPProperty;
+
+        EUNIT_DECLARE_TEST_TABLE;
+
+    };
+
+#endif      //  __T_CSPPROPERTY_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/T_CSPProperty_DllMain.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,24 @@
+/*
+* 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 CreateTestSuiteL class.
+*
+*/
+
+#include "T_CSPProperty.h"
+#include <CEUnitTestSuite.h>
+
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return T_CSPProperty::NewL();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/T_CSPSettings.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,400 @@
+/*
+* 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 T_CSPSettings class.
+*
+*/
+
+#include "T_CSPSettings.h"
+#include <EUnitMacros.h>
+#include <EUnitDecorators.h>
+
+#include <spentry.h>
+#include <spproperty.h>
+#include "spsettings.h"
+#include "TestData.h"
+
+// - Construction -----------------------------------------------------------
+
+T_CSPSettings* T_CSPSettings::NewL()
+    {
+    T_CSPSettings* self = T_CSPSettings::NewLC();
+    CleanupStack::Pop();
+    return self;
+    }
+
+T_CSPSettings* T_CSPSettings::NewLC()
+    {
+    T_CSPSettings* self = new( ELeave ) T_CSPSettings();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+T_CSPSettings::~T_CSPSettings()
+    {
+    }
+
+T_CSPSettings::T_CSPSettings()
+    {
+    }
+
+void T_CSPSettings::ConstructL()
+    {
+    CEUnitTestSuiteClass::ConstructL();
+    }
+
+// - Test methods -----------------------------------------------------------
+
+
+
+void T_CSPSettings::SetupL(  )
+    {
+    iCSPSettings = CSPSettings::NewL();
+    }
+
+void T_CSPSettings::Setup2L(  )
+    {
+    TestData::iCheckSupportedCase = ETrue;
+    iCSPSettings = CSPSettings::NewL();
+    }
+    
+
+void T_CSPSettings::Teardown(  )
+    {
+    delete iCSPSettings;
+    iCSPSettings = NULL;
+    }
+
+void T_CSPSettings::T_CSPSettings_AddEntryLL(  )
+    {
+    CSPEntry* entry = CSPEntry::NewLC();
+    User::LeaveIfError( entry->SetServiceName( _L("Nimi") ) );
+
+    EUNIT_ASSERT( KErrNone == iCSPSettings->AddEntryL( *entry ) );
+    
+    CleanupStack::PopAndDestroy( entry );
+    }
+    
+void T_CSPSettings::T_CSPSettings_FindEntryLL(  )
+    {
+    CSPEntry* entry = CSPEntry::NewLC();
+    User::LeaveIfError( entry->SetServiceName( _L("Nimi") ) );
+    TInt id = entry->GetServiceId();
+    
+    EUNIT_ASSERT( KErrNotFound == iCSPSettings->FindEntryL( id, *entry ) );
+    
+    iCSPSettings->AddEntryL( *entry );
+    id = entry->GetServiceId();
+    EUNIT_ASSERT( KErrNone == iCSPSettings->FindEntryL( id, *entry ) );
+    
+    CleanupStack::PopAndDestroy( entry );
+    }
+    
+void T_CSPSettings::T_CSPSettings_UpdateEntryLL(  )
+    {
+    CSPEntry* entry = CSPEntry::NewLC();
+    
+    EUNIT_ASSERT_LEAVE( iCSPSettings->UpdateEntryL( *entry ) );
+    
+    User::LeaveIfError( entry->SetServiceName( _L("Nimi") ) );
+    iCSPSettings->AddEntryL( *entry );
+    EUNIT_ASSERT( KErrNone == iCSPSettings->UpdateEntryL( *entry ) );
+    
+    CleanupStack::PopAndDestroy( entry );
+    }
+    
+void T_CSPSettings::T_CSPSettings_DeleteEntryLL(  )
+    {
+    CSPEntry* entry = CSPEntry::NewLC();
+    User::LeaveIfError( entry->SetServiceName( _L("Nimi") ) );
+    TInt id = entry->GetServiceId();
+    
+    EUNIT_ASSERT( KErrNotFound == iCSPSettings->DeleteEntryL( id ) );
+    
+    iCSPSettings->AddEntryL( *entry );
+    id = entry->GetServiceId();
+    EUNIT_ASSERT( KErrNone == iCSPSettings->DeleteEntryL( id ) );
+    CleanupStack::PopAndDestroy( entry );
+    }
+
+void T_CSPSettings::T_CSPSettings_FindPropertyLL(  )
+    {
+    CSPProperty* property = CSPProperty::NewLC();
+    property->SetName( EPropertyVoIPSubServicePluginId );
+    TInt profId( 15 );
+    User::LeaveIfError( property->SetValue( profId ));
+
+    EUNIT_ASSERT( KErrNotFound == iCSPSettings->FindPropertyL(
+        0, EPropertyVoIPSubServicePluginId, *property ) );
+    
+    EUNIT_ASSERT( KErrNone == iCSPSettings->FindPropertyL(
+        profId, EPropertyVoIPSubServicePluginId, *property ) );
+    
+    CleanupStack::PopAndDestroy( property );
+    }
+    
+void T_CSPSettings::T_CSPSettings_AddOrUpdatePropertiesLL(  )
+    {
+    // iCSPSettings->AddOrUpdatePropertiesL( <add parameters here > );
+     EUNIT_ASSERT_DESC( EFalse, "Generated assert, replace with real");
+    }
+    
+void T_CSPSettings::T_CSPSettings_AddOrUpdatePropertyLL(  )
+    {
+    CSPProperty* property = CSPProperty::NewLC();
+    property->SetName( EPropertyVoIPSubServicePluginId );
+    TInt profId( 15 );
+    User::LeaveIfError( property->SetValue( profId ));
+    
+    EUNIT_ASSERT( KErrNone == iCSPSettings->AddOrUpdatePropertyL( profId, *property ) );
+     
+    CleanupStack::PopAndDestroy( property );
+    }
+    
+void T_CSPSettings::T_CSPSettings_SettingsCountLL(  )
+    {
+    TInt count = iCSPSettings->SettingsCountL( );
+    EUNIT_ASSERT( count );
+    }
+    
+void T_CSPSettings::T_CSPSettings_FindServiceIdsLL(  )
+    {
+    RIdArray ids;
+    CleanupClosePushL( ids );
+    
+    EUNIT_ASSERT( KErrNone == iCSPSettings->FindServiceIdsL( ids ) );
+    TInt count( ids.Count() );
+    EUNIT_ASSERT( count );
+    
+    CleanupStack::PopAndDestroy( &ids );
+    }
+    
+void T_CSPSettings::T_CSPSettings_FindServiceNamesLL(  )
+    {
+    RIdArray ids;
+    CleanupClosePushL( ids );
+    iCSPSettings->FindServiceIdsL( ids );
+    
+    CDesCArrayFlat* names = new ( ELeave ) CDesCArrayFlat( 10 );
+    CleanupStack::PushL( names );
+    EUNIT_ASSERT( KErrNone == iCSPSettings->FindServiceNamesL( ids, *names ) );
+    TInt count = names->MdcaCount();
+    EUNIT_ASSERT( count );
+    
+    CleanupStack::PopAndDestroy( names );
+    CleanupStack::PopAndDestroy( &ids );
+    }
+
+void T_CSPSettings::T_CSPSettings_FindSubServicePropertiesLL(  )
+    {
+    RPropertyArray* propertyArray = new (ELeave) RPropertyArray( 3 );
+    CleanupStack::PushL( propertyArray );
+    
+    iCSPSettings->FindSubServicePropertiesL( 0, EItemTypeVMBXSubProperty, *propertyArray );
+    TInt count = propertyArray->Count();
+    EUNIT_ASSERT( !count );
+
+    CleanupStack::PopAndDestroy( propertyArray );
+    }
+    
+void T_CSPSettings::T_CSPSettings_DeleteServicePropertiesLL(  )
+    {
+    RPropertyNameArray names;
+    CleanupClosePushL( names );
+    
+    EUNIT_ASSERT( KErrNone == iCSPSettings->DeleteServicePropertiesL( 0, names ) );
+    
+    CleanupStack::PopAndDestroy( &names );
+    }
+    
+void T_CSPSettings::T_CSPSettings_FindServiceIdsFromPropertiesLL(  )
+    {
+    RIdArray serviceIds;
+    CleanupClosePushL( serviceIds );
+    RPropertyArray properties;
+    CleanupClosePushL( properties );
+    
+    EUNIT_ASSERT( KErrNone == iCSPSettings->FindServiceIdsFromPropertiesL( properties, serviceIds ) );
+    
+    CleanupStack::PopAndDestroy( &properties );
+    CleanupStack::PopAndDestroy( &serviceIds );
+    }
+    
+void T_CSPSettings::T_CSPSettings_GetSIPVoIPSWVersionL(  )
+    {
+    EUNIT_ASSERT( _L("3.1") == iCSPSettings->GetSIPVoIPSWVersion() );
+    }
+    
+void T_CSPSettings::T_CSPSettings_IsFeatureSupportedL(  )
+    {
+    EUNIT_ASSERT( !iCSPSettings->IsFeatureSupported( ESupportInternetCallFeature ) );
+    }
+
+void T_CSPSettings::T_CSPSettings_CheckSupportedLsL(  )
+    {    
+    // Test CheckSupportedL( TServiceId aServiceId, const RPropertyNameArray& aNameArray )
+    
+    CSPProperty* property = CSPProperty::NewLC();
+    iCSPSettings->FindPropertyL( 0, EPropertyVoIPSubServicePluginId, *property );
+    iCSPSettings->FindPropertyL( 2, EPropertyVoIPSubServicePluginId, *property );
+    CleanupStack::PopAndDestroy( property );
+
+    
+    // Test CheckSupportedL( TServiceId aServiceId )
+    
+    CSPEntry* entry = CSPEntry::NewLC();
+    iCSPSettings->FindEntryL( 0, *entry );
+    entry->SetServiceId( 2 );
+    iCSPSettings->FindEntryL( 2, *entry );
+    CleanupStack::PopAndDestroy( entry );
+    
+    
+    // Test CheckSupportedL( TSPItemType aPropertyType )
+    
+    RPropertyArray* propertyArray = new (ELeave) RPropertyArray( 3 );
+    CleanupStack::PushL( propertyArray );
+    iCSPSettings->FindSubServicePropertiesL( 0, EItemTypeVMBXSubProperty, *propertyArray );
+
+    
+    // Test CheckSupportedL( const RPropertyArray& aPropertyArray )
+    
+    RIdArray serviceIds;
+    CleanupClosePushL( serviceIds );
+    iCSPSettings->FindServiceIdsFromPropertiesL( *propertyArray, serviceIds );
+
+    CleanupStack::PopAndDestroy( &serviceIds );    
+    CleanupStack::PopAndDestroy( propertyArray );
+    }
+    
+
+// - EUnit test table -------------------------------------------------------
+
+EUNIT_BEGIN_TEST_TABLE(
+    T_CSPSettings,
+    "Add test suite description here.",
+    "UNIT" )
+
+EUNIT_TEST(
+    "AddEntryL - test",
+    "CSPSettings",
+    "AddEntryL - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettings_AddEntryLL, Teardown)
+    
+EUNIT_TEST(
+    "FindEntryL - test",
+    "CSPSettings",
+    "FindEntryL - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettings_FindEntryLL, Teardown)
+
+EUNIT_TEST(
+    "UpdateEntryL - test",
+    "CSPSettings",
+    "UpdateEntryL - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettings_UpdateEntryLL, Teardown)
+
+EUNIT_TEST(
+    "DeleteEntryL - test",
+    "CSPSettings",
+    "DeleteEntryL - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettings_DeleteEntryLL, Teardown)
+
+EUNIT_TEST(
+    "FindPropertyL - test",
+    "CSPSettings",
+    "FindPropertyL - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettings_FindPropertyLL, Teardown)
+/*
+EUNIT_TEST(
+    "AddOrUpdatePropertiesL - test",
+    "CSPSettings",
+    "AddOrUpdatePropertiesL - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettings_AddOrUpdatePropertiesLL, Teardown)
+*/ 
+EUNIT_TEST(
+    "AddOrUpdatePropertyL - test",
+    "CSPSettings",
+    "AddOrUpdatePropertyL - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettings_AddOrUpdatePropertyLL, Teardown)
+
+EUNIT_TEST(
+    "SettingsCountL - test",
+    "CSPSettings",
+    "SettingsCountL - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettings_SettingsCountLL, Teardown)
+
+EUNIT_TEST(
+    "FindServiceIdsL - test",
+    "CSPSettings",
+    "FindServiceIdsL - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettings_FindServiceIdsLL, Teardown)
+
+EUNIT_TEST(
+    "FindServiceNamesL - test",
+    "CSPSettings",
+    "FindServiceNamesL - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettings_FindServiceNamesLL, Teardown)
+
+EUNIT_TEST(
+    "FindSubServicePropertiesL - test",
+    "CSPSettings",
+    "FindSubServicePropertiesL - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettings_FindSubServicePropertiesLL, Teardown)
+
+EUNIT_TEST(
+    "DeleteServicePropertiesL - test",
+    "CSPSettings",
+    "DeleteServicePropertiesL - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettings_DeleteServicePropertiesLL, Teardown)
+    
+EUNIT_TEST(
+    "FindServiceIdsFromPropertiesL - test",
+    "CSPSettings",
+    "FindServiceIdsFromPropertiesL - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettings_FindServiceIdsFromPropertiesLL, Teardown)
+
+EUNIT_TEST(
+    "GetSIPVoIPSWVersion - test",
+    "CSPSettings",
+    "GetSIPVoIPSWVersion - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettings_GetSIPVoIPSWVersionL, Teardown)
+
+EUNIT_TEST(
+    "IsFeatureSupported - test",
+    "CSPSettings",
+    "IsFeatureSupported - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettings_IsFeatureSupportedL, Teardown)
+
+EUNIT_TEST(
+    "CheckSupportedLs - test",
+    "CSPSettings",
+    "CheckSupportedLs - test",
+    "FUNCTIONALITY",
+    Setup2L, T_CSPSettings_CheckSupportedLsL, Teardown)
+
+EUNIT_END_TEST_TABLE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/T_CSPSettings.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Declaration of T_CSPSettings class.
+*
+*/
+
+#ifndef __T_CSPSETTINGS_H__
+#define __T_CSPSETTINGS_H__
+
+// INCLUDES
+#include <CEUnitTestSuiteClass.h>
+#include <EUnitDecorators.h>
+
+#include "spsettings.h"
+
+// FORWARD DECLARATIONS
+
+
+// CLASS DEFINITION
+/**
+ * Generated EUnit test suite class.
+ */
+NONSHARABLE_CLASS( T_CSPSettings )
+	: public CEUnitTestSuiteClass
+    {
+    public:  // Constructors and destructor
+
+        static T_CSPSettings* NewL();
+        static T_CSPSettings* NewLC();
+        ~T_CSPSettings();
+
+    private: // Constructors
+
+        T_CSPSettings();
+        void ConstructL();
+
+    private: // New methods
+
+         void SetupL();
+         
+         void Setup2L();
+        
+         void Teardown();
+        
+         void T_CSPSettings_AddEntryLL();
+        
+         void T_CSPSettings_FindEntryLL();
+        
+         void T_CSPSettings_UpdateEntryLL();
+        
+         void T_CSPSettings_DeleteEntryLL();
+        
+         void T_CSPSettings_FindPropertyLL();
+        
+         void T_CSPSettings_AddOrUpdatePropertiesLL();
+        
+         void T_CSPSettings_AddOrUpdatePropertyLL();
+        
+         void T_CSPSettings_SettingsCountLL();
+        
+         void T_CSPSettings_FindServiceIdsLL();
+        
+         void T_CSPSettings_FindServiceNamesLL();
+        
+         void T_CSPSettings_FindSubServicePropertiesLL();
+        
+         void T_CSPSettings_DeleteServicePropertiesLL();
+        
+         void T_CSPSettings_FindServiceIdsFromPropertiesLL();
+        
+         void T_CSPSettings_GetSIPVoIPSWVersionL();
+        
+         void T_CSPSettings_IsFeatureSupportedL();
+         
+         void T_CSPSettings_CheckSupportedLsL();
+        
+
+    private: // Data
+
+        CSPSettings* iCSPSettings;
+
+        EUNIT_DECLARE_TEST_TABLE;
+
+    };
+
+#endif      //  __T_CSPSETTINGS_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/T_CSPSettingsEngine.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,506 @@
+/*
+* 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 T_CSPSettingsEngine class.
+*
+*/
+
+#include "T_CSPSettingsEngine.h"
+#include <EUnitMacros.h>
+#include <EUnitDecorators.h>
+
+#include <spentry.h>
+#include <spproperty.h>
+#include "spsettingsengine.h"
+
+// - Construction -----------------------------------------------------------
+
+T_CSPSettingsEngine* T_CSPSettingsEngine::NewL()
+    {
+    T_CSPSettingsEngine* self = T_CSPSettingsEngine::NewLC();
+    CleanupStack::Pop();
+    return self;
+    }
+
+T_CSPSettingsEngine* T_CSPSettingsEngine::NewLC()
+    {
+    T_CSPSettingsEngine* self = new( ELeave ) T_CSPSettingsEngine();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+T_CSPSettingsEngine::~T_CSPSettingsEngine()
+    {
+    }
+
+T_CSPSettingsEngine::T_CSPSettingsEngine()
+    {
+    }
+
+void T_CSPSettingsEngine::ConstructL()
+    {
+    CEUnitTestSuiteClass::ConstructL();
+    }
+
+// - Test methods -----------------------------------------------------------
+
+
+
+void T_CSPSettingsEngine::SetupL(  )
+    {
+    iCSPSettingsEngine = CSPSettingsEngine::NewL();
+    }
+    
+
+void T_CSPSettingsEngine::Teardown(  )
+    {
+    delete iCSPSettingsEngine;
+    iCSPSettingsEngine = NULL;
+    }
+
+    
+void T_CSPSettingsEngine::T_CSPSettingsEngine_BeginTransactionLCL(  )
+    {
+    EUNIT_ASSERT( KErrNone == iCSPSettingsEngine->BeginTransactionLC( ) );
+    }
+    
+void T_CSPSettingsEngine::T_CSPSettingsEngine_CommitTransactionL(  )
+    {
+    EUNIT_ASSERT( KErrNone == iCSPSettingsEngine->CommitTransaction() );
+    }
+    
+void T_CSPSettingsEngine::T_CSPSettingsEngine_RollbackTransactionL(  )
+    {
+    iCSPSettingsEngine->RollbackTransaction( );
+    }
+    
+void T_CSPSettingsEngine::T_CSPSettingsEngine_AddEntryLL(  )
+    {
+    CSPEntry* entry = CSPEntry::NewLC();
+    TServiceId id = entry->GetServiceId();
+
+    EUNIT_ASSERT_SPECIFIC_LEAVE( iCSPSettingsEngine->AddEntryL( *entry ), KErrArgument ) ;
+    
+    User::LeaveIfError( entry->SetServiceName( _L("Nimi") ) );
+    iCSPSettingsEngine->AddEntryL( *entry );
+    EUNIT_ASSERT( id != entry->GetServiceId() );
+
+    CleanupStack::PopAndDestroy( entry );    
+    }
+    
+void T_CSPSettingsEngine::T_CSPSettingsEngine_FindEntryLL(  )
+    {
+    CSPEntry* entry = CSPEntry::NewLC();
+    User::LeaveIfError( entry->SetServiceName( _L("Nimi") ) );
+    TInt id = entry->GetServiceId();
+    
+    EUNIT_ASSERT( KErrNotFound == iCSPSettingsEngine->FindEntryL( id, *entry ) );
+    
+    iCSPSettingsEngine->AddEntryL( *entry );
+    id = entry->GetServiceId();
+    
+    EUNIT_ASSERT( KErrNone == iCSPSettingsEngine->FindEntryL( id, *entry ) );
+
+    CleanupStack::PopAndDestroy( entry );
+    }
+    
+void T_CSPSettingsEngine::T_CSPSettingsEngine_UpdateEntryLL(  )
+    {
+    CSPEntry* entry = CSPEntry::NewLC();
+    
+    EUNIT_ASSERT_LEAVE( iCSPSettingsEngine->UpdateEntryL( *entry ) );
+    
+    User::LeaveIfError( entry->SetServiceName( _L("Nimi") ) );
+    iCSPSettingsEngine->AddEntryL( *entry );
+    EUNIT_ASSERT( KErrNone == iCSPSettingsEngine->UpdateEntryL( *entry ) );
+    
+    CleanupStack::PopAndDestroy( entry );
+    }
+    
+void T_CSPSettingsEngine::T_CSPSettingsEngine_DeleteEntryLL(  )
+    {
+    CSPEntry* entry = CSPEntry::NewLC();
+    User::LeaveIfError( entry->SetServiceName( _L("Nimi") ) );
+    TInt id = entry->GetServiceId();
+    
+    EUNIT_ASSERT( KErrNotFound == iCSPSettingsEngine->DeleteEntryL( id ) );
+    
+    iCSPSettingsEngine->AddEntryL( *entry );
+    id = entry->GetServiceId();
+    EUNIT_ASSERT( KErrNone == iCSPSettingsEngine->DeleteEntryL( id ) );
+    CleanupStack::PopAndDestroy( entry );
+    }
+    
+void T_CSPSettingsEngine::T_CSPSettingsEngine_FindPropertyLL(  )
+    {
+    CSPProperty* property = CSPProperty::NewLC();
+    property->SetName( EPropertyVoIPSubServicePluginId );
+    TInt profId( 15 );
+    User::LeaveIfError( property->SetValue( profId ));
+
+    EUNIT_ASSERT( KErrNotFound == iCSPSettingsEngine->FindPropertyL(
+        0, EPropertyVoIPSubServicePluginId, *property ) );
+    
+    EUNIT_ASSERT( KErrNone == iCSPSettingsEngine->FindPropertyL(
+        profId, EPropertyVoIPSubServicePluginId, *property ) );
+    
+    CleanupStack::PopAndDestroy( property );
+    }
+    
+void T_CSPSettingsEngine::T_CSPSettingsEngine_AddOrUpdatePropertiesLL(  )
+    {
+    CSPProperty* property = CSPProperty::NewLC();
+    property->SetName( EPropertyVoIPSubServicePluginId );
+    TInt profId( 15 );
+    User::LeaveIfError( property->SetValue( profId ));
+    
+    RPropertyArray propertyArray;
+    propertyArray.Append( property );
+    CleanupClosePushL( propertyArray );
+
+    EUNIT_ASSERT( KErrNone == iCSPSettingsEngine->AddOrUpdatePropertiesL( profId, propertyArray ) );
+    
+    CleanupStack::PopAndDestroy( &propertyArray );
+    CleanupStack::PopAndDestroy( property );
+    }
+    
+void T_CSPSettingsEngine::T_CSPSettingsEngine_SettingsCountLL(  )
+    {
+    EUNIT_ASSERT( !iCSPSettingsEngine->SettingsCountL() );
+    
+    // Note that stub file is set to increase the count for this
+    // test when calling SettingsCountL method again
+    EUNIT_ASSERT( !iCSPSettingsEngine->SettingsCountL() );
+    EUNIT_ASSERT( iCSPSettingsEngine->SettingsCountL() );
+    }
+    
+void T_CSPSettingsEngine::T_CSPSettingsEngine_FindServiceIdsLL(  )
+    {
+    RIdArray serviceIds;
+    CleanupClosePushL( serviceIds );
+    
+    EUNIT_ASSERT( KErrNone == iCSPSettingsEngine->FindServiceIdsL( serviceIds ) );
+    EUNIT_ASSERT( serviceIds.Count() );
+    
+    CleanupStack::PopAndDestroy( &serviceIds );
+    }
+    
+void T_CSPSettingsEngine::T_CSPSettingsEngine_FindServiceNamesLL(  )
+    {
+    RIdArray ids;
+    CleanupClosePushL( ids );
+    iCSPSettingsEngine->FindServiceIdsL( ids );
+    
+    CDesCArrayFlat* names = new ( ELeave ) CDesCArrayFlat( 10 );
+    CleanupStack::PushL( names );
+    iCSPSettingsEngine->FindServiceNamesL( ids, *names );
+    TInt count = names->MdcaCount();
+    EUNIT_ASSERT( count );
+    
+    CleanupStack::PopAndDestroy( names );
+    CleanupStack::PopAndDestroy( &ids );
+    }
+
+void T_CSPSettingsEngine::T_CSPSettingsEngine_PropertyNameArrayFromItemTypeLL(  )
+    {
+    RPropertyArray* propertyArray = new (ELeave) RPropertyArray( 3 );
+    CleanupStack::PushL( propertyArray );
+    
+    EUNIT_ASSERT_SPECIFIC_LEAVE( iCSPSettingsEngine->FindSubServicePropertiesL( 0, EItemTypeNotDefined,
+        *propertyArray ), KErrArgument );
+    iCSPSettingsEngine->FindSubServicePropertiesL( 0, EItemTypeVoIPSubProperty, *propertyArray );
+    iCSPSettingsEngine->FindSubServicePropertiesL( 0, EItemTypePresenceSubProperty, *propertyArray );
+    iCSPSettingsEngine->FindSubServicePropertiesL( 0, EItemTypeIMSubProperty, *propertyArray );
+    iCSPSettingsEngine->FindSubServicePropertiesL( 0, EItemTypeVMBXSubProperty, *propertyArray );
+    
+    CleanupStack::PopAndDestroy( propertyArray );
+    }
+    
+void T_CSPSettingsEngine::T_CSPSettingsEngine_FindSubServicePropertiesLL(  )
+    {
+    RPropertyArray* propertyArray = new (ELeave) RPropertyArray( 3 );
+    CleanupStack::PushL( propertyArray );
+    
+    iCSPSettingsEngine->FindSubServicePropertiesL( 0, EItemTypeVMBXSubProperty, *propertyArray );
+    TInt count = propertyArray->Count();
+    EUNIT_ASSERT( !count );
+
+    CleanupStack::PopAndDestroy( propertyArray );
+    }
+    
+void T_CSPSettingsEngine::T_CSPSettingsEngine_DeleteServicePropertiesLL(  )
+    {
+    RPropertyNameArray names;
+    CleanupClosePushL( names );
+    
+    EUNIT_ASSERT( KErrNone == iCSPSettingsEngine->DeleteServicePropertiesL( 0, names ) );
+    
+    names.AppendL( EPropertyPCSPluginId );
+    names.AppendL( ESubPropertyVoIPSettingsId );
+    EUNIT_ASSERT( KErrNone == iCSPSettingsEngine->DeleteServicePropertiesL( 0, names ) );
+    
+    CleanupStack::PopAndDestroy( &names );
+    }
+    
+void T_CSPSettingsEngine::T_CSPSettingsEngine_FindServiceIdsFromPropertiesLL(  )
+    {
+    RIdArray serviceIds;
+    CleanupClosePushL( serviceIds );
+    RPropertyArray properties;
+    CleanupClosePushL( properties );
+    
+    iCSPSettingsEngine->FindServiceIdsFromPropertiesL( properties, serviceIds );
+    EUNIT_ASSERT( serviceIds.Count() );
+    
+    CleanupStack::PopAndDestroy( &properties );
+    CleanupStack::PopAndDestroy( &serviceIds );
+    }
+    
+void T_CSPSettingsEngine::T_CSPSettingsEngine_IsFeatureSupportedLL(  )
+    {
+    EUNIT_ASSERT( !iCSPSettingsEngine->IsFeatureSupportedL( ESupportInternetCallFeature, EFalse ) );
+    EUNIT_ASSERT_LEAVE( iCSPSettingsEngine->IsFeatureSupportedL( ESupportInternetCallFeature, ETrue ) );
+    
+    EUNIT_ASSERT( !iCSPSettingsEngine->IsFeatureSupportedL( ESupportCallOutFeature, EFalse ) );
+    EUNIT_ASSERT_LEAVE( iCSPSettingsEngine->IsFeatureSupportedL( ESupportCallOutFeature, ETrue ) );
+    
+    EUNIT_ASSERT( !iCSPSettingsEngine->IsFeatureSupportedL( ESupportVoIPSSFeature, EFalse ) );
+    EUNIT_ASSERT_LEAVE( iCSPSettingsEngine->IsFeatureSupportedL( ESupportVoIPSSFeature, ETrue ) );
+    
+    EUNIT_ASSERT( iCSPSettingsEngine->IsFeatureSupportedL( ESupportVoIPFeature, EFalse ) );
+    }
+    
+void T_CSPSettingsEngine::T_CSPSettingsEngine_UpdateSupportFeaturePSKeyLL(  )
+    {
+    EUNIT_ASSERT_LEAVE( iCSPSettingsEngine->UpdateSupportFeaturePSKeyL( ) );
+    }
+    
+void T_CSPSettingsEngine::T_CSPSettingsEngine_IsVoIPServiceLL(  )
+    {
+    EUNIT_ASSERT( !iCSPSettingsEngine->IsVoIPServiceL( 0 ) );
+    EUNIT_ASSERT( iCSPSettingsEngine->IsVoIPServiceL( 2 ) );
+    }
+    
+void T_CSPSettingsEngine::T_CSPSettingsEngine_HasCallPropertyNameL(  )
+    {
+    RPropertyNameArray names;
+    CleanupClosePushL( names );
+    EUNIT_ASSERT( !iCSPSettingsEngine->HasCallPropertyName( names ) );
+    
+    names.AppendL( EPropertyUnknown );
+    names.AppendL( EPropertyCTIPluginId );
+    EUNIT_ASSERT( iCSPSettingsEngine->HasCallPropertyName( names ) );
+    
+    CleanupStack::PopAndDestroy( &names );
+    }
+    
+void T_CSPSettingsEngine::T_CSPSettingsEngine_HasVoIPAndVmbxPropertyNameL(  )
+    {
+    RPropertyNameArray names;
+    CleanupClosePushL( names );
+    EUNIT_ASSERT( !iCSPSettingsEngine->HasVoIPAndVmbxPropertyName( names ) );
+    
+    names.AppendL( EPropertyUnknown );
+    names.AppendL( EPropertyVoIPSubServicePluginId );
+    EUNIT_ASSERT( iCSPSettingsEngine->HasVoIPAndVmbxPropertyName( names ) );
+    
+    CleanupStack::PopAndDestroy( &names );
+    }
+
+void T_CSPSettingsEngine::T_CSPSettingsEngine_NameArrayFromPropertyArrayLL(  )
+    {
+    RPropertyNameArray names;
+    CleanupClosePushL( names );
+    
+    RPropertyArray properties;
+    CleanupClosePushL( properties );
+    
+    iCSPSettingsEngine->NameArrayFromPropertyArrayL( names, properties );
+    EUNIT_ASSERT( !names.Count() );
+    
+    CSPProperty* property = CSPProperty::NewLC();
+    property->SetName( EPropertyVoIPSubServicePluginId );
+    properties.AppendL( property );
+    
+    iCSPSettingsEngine->NameArrayFromPropertyArrayL( names, properties );
+    EUNIT_ASSERT( names.Count() );
+    
+    CleanupStack::PopAndDestroy( property );
+    CleanupStack::PopAndDestroy( &properties );
+    CleanupStack::PopAndDestroy( &names );
+    }
+
+
+// - EUnit test table -------------------------------------------------------
+
+EUNIT_BEGIN_TEST_TABLE(
+    T_CSPSettingsEngine,
+    "Add test suite description here.",
+    "UNIT" )
+    
+EUNIT_TEST(
+    "BeginTransactionLC - test1",
+    "CSPSettingsEngine",
+    "BeginTransactionLC - test1",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettingsEngine_BeginTransactionLCL, Teardown)
+
+EUNIT_TEST(
+    "CommitTransaction - test",
+    "CSPSettingsEngine",
+    "CommitTransaction - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettingsEngine_CommitTransactionL, Teardown)
+
+EUNIT_TEST(
+    "RollbackTransaction - test",
+    "CSPSettingsEngine",
+    "RollbackTransaction - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettingsEngine_RollbackTransactionL, Teardown)
+
+EUNIT_TEST(
+    "AddEntryL - test",
+    "CSPSettingsEngine",
+    "AddEntryL - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettingsEngine_AddEntryLL, Teardown)
+
+EUNIT_TEST(
+    "FindEntryL - test",
+    "CSPSettingsEngine",
+    "FindEntryL - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettingsEngine_FindEntryLL, Teardown)
+
+EUNIT_TEST(
+    "UpdateEntryL - test",
+    "CSPSettingsEngine",
+    "UpdateEntryL - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettingsEngine_UpdateEntryLL, Teardown)
+
+EUNIT_TEST(
+    "DeleteEntryL - test",
+    "CSPSettingsEngine",
+    "DeleteEntryL - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettingsEngine_DeleteEntryLL, Teardown)
+
+EUNIT_TEST(
+    "FindPropertyL - test",
+    "CSPSettingsEngine",
+    "FindPropertyL - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettingsEngine_FindPropertyLL, Teardown)
+
+EUNIT_TEST(
+    "AddOrUpdatePropertiesL - test",
+    "CSPSettingsEngine",
+    "AddOrUpdatePropertiesL - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettingsEngine_AddOrUpdatePropertiesLL, Teardown)
+
+EUNIT_TEST(
+    "SettingsCountL - test",
+    "CSPSettingsEngine",
+    "SettingsCountL - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettingsEngine_SettingsCountLL, Teardown)
+
+EUNIT_TEST(
+    "FindServiceIdsL - test",
+    "CSPSettingsEngine",
+    "FindServiceIdsL - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettingsEngine_FindServiceIdsLL, Teardown)
+
+EUNIT_TEST(
+    "FindServiceNamesL - test",
+    "CSPSettingsEngine",
+    "FindServiceNamesL - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettingsEngine_FindServiceNamesLL, Teardown)
+
+EUNIT_TEST(
+    "PropertyNameArrayFromItemTypeL - test",
+    "CSPSettingsEngine",
+    "PropertyNameArrayFromItemTypeL - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettingsEngine_PropertyNameArrayFromItemTypeLL, Teardown)
+
+EUNIT_TEST(
+    "FindSubServicePropertiesL - test",
+    "CSPSettingsEngine",
+    "FindSubServicePropertiesL - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettingsEngine_FindSubServicePropertiesLL, Teardown)
+
+EUNIT_TEST(
+    "DeleteServicePropertiesL - test",
+    "CSPSettingsEngine",
+    "DeleteServicePropertiesL - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettingsEngine_DeleteServicePropertiesLL, Teardown)
+
+EUNIT_TEST(
+    "FindServiceIdsFromPropertiesL - test",
+    "CSPSettingsEngine",
+    "FindServiceIdsFromPropertiesL - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettingsEngine_FindServiceIdsFromPropertiesLL, Teardown)
+
+EUNIT_TEST(
+    "IsFeatureSupportedL - test",
+    "CSPSettingsEngine",
+    "IsFeatureSupportedL - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettingsEngine_IsFeatureSupportedLL, Teardown)
+
+EUNIT_TEST(
+    "UpdateSupportFeaturePSKeyL - test",
+    "CSPSettingsEngine",
+    "UpdateSupportFeaturePSKeyL - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettingsEngine_UpdateSupportFeaturePSKeyLL, Teardown)
+
+EUNIT_TEST(
+    "IsVoIPServiceL - test",
+    "CSPSettingsEngine",
+    "IsVoIPServiceL - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettingsEngine_IsVoIPServiceLL, Teardown)
+
+EUNIT_TEST(
+    "HasCallPropertyName - test",
+    "CSPSettingsEngine",
+    "HasCallPropertyName - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettingsEngine_HasCallPropertyNameL, Teardown)
+
+EUNIT_TEST(
+    "HasVoIPAndVmbxPropertyName - test",
+    "CSPSettingsEngine",
+    "HasVoIPAndVmbxPropertyName - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettingsEngine_HasVoIPAndVmbxPropertyNameL, Teardown)
+
+EUNIT_TEST(
+    "NameArrayFromPropertyArrayL - test",
+    "CSPSettingsEngine",
+    "NameArrayFromPropertyArrayL - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettingsEngine_NameArrayFromPropertyArrayLL, Teardown)
+
+EUNIT_END_TEST_TABLE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/T_CSPSettingsEngine.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,107 @@
+/*
+* 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: Declaration of T_CSPSettingsEngine class.
+*
+*/
+
+#ifndef __T_CSPSETTINGSENGINE_H__
+#define __T_CSPSETTINGSENGINE_H__
+
+// INCLUDES
+#include <CEUnitTestSuiteClass.h>
+#include <EUnitDecorators.h>
+
+#include "spsettingsengine.h"
+
+// FORWARD DECLARATIONS
+
+
+// CLASS DEFINITION
+/**
+ * Generated EUnit test suite class.
+ */
+NONSHARABLE_CLASS( T_CSPSettingsEngine )
+	: public CEUnitTestSuiteClass
+    {
+    public:  // Constructors and destructor
+
+        static T_CSPSettingsEngine* NewL();
+        static T_CSPSettingsEngine* NewLC();
+        ~T_CSPSettingsEngine();
+
+    private: // Constructors
+
+        T_CSPSettingsEngine();
+        void ConstructL();
+
+    private: // New methods
+
+         void SetupL();
+        
+         void Teardown();
+        
+         void T_CSPSettingsEngine_BeginTransactionLCL();
+        
+         void T_CSPSettingsEngine_CommitTransactionL();
+        
+         void T_CSPSettingsEngine_RollbackTransactionL();
+        
+         void T_CSPSettingsEngine_AddEntryLL();
+        
+         void T_CSPSettingsEngine_FindEntryLL();
+        
+         void T_CSPSettingsEngine_UpdateEntryLL();
+        
+         void T_CSPSettingsEngine_DeleteEntryLL();
+        
+         void T_CSPSettingsEngine_FindPropertyLL();
+        
+         void T_CSPSettingsEngine_AddOrUpdatePropertiesLL();
+        
+         void T_CSPSettingsEngine_SettingsCountLL();
+        
+         void T_CSPSettingsEngine_FindServiceIdsLL();
+        
+         void T_CSPSettingsEngine_FindServiceNamesLL();
+         
+         void T_CSPSettingsEngine_PropertyNameArrayFromItemTypeLL();
+        
+         void T_CSPSettingsEngine_FindSubServicePropertiesLL();
+        
+         void T_CSPSettingsEngine_DeleteServicePropertiesLL();
+        
+         void T_CSPSettingsEngine_FindServiceIdsFromPropertiesLL();
+        
+         void T_CSPSettingsEngine_IsFeatureSupportedLL();
+        
+         void T_CSPSettingsEngine_UpdateSupportFeaturePSKeyLL();
+        
+         void T_CSPSettingsEngine_IsVoIPServiceLL();
+        
+         void T_CSPSettingsEngine_HasCallPropertyNameL();
+        
+         void T_CSPSettingsEngine_HasVoIPAndVmbxPropertyNameL();
+         
+         void T_CSPSettingsEngine_NameArrayFromPropertyArrayLL();
+        
+
+    private: // Data
+
+        CSPSettingsEngine* iCSPSettingsEngine;
+
+        EUNIT_DECLARE_TEST_TABLE;
+
+    };
+
+#endif      //  __T_CSPSETTINGSENGINE_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/T_CSPSettingsEngine_DllMain.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,24 @@
+/*
+* 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 CreateTestsuiteL class.
+*
+*/
+
+#include "T_CSPSettingsEngine.h"
+#include <CEUnitTestSuite.h>
+
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return T_CSPSettingsEngine::NewL();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/T_CSPSettingsVoIPUtils.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,175 @@
+/*
+* 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 T_CSPSettingsVoIPUtils class.
+*
+*/
+
+#include "T_CSPSettingsVoIPUtils.h"
+#include <EUnitMacros.h>
+#include <EUnitDecorators.h>
+#include <centralrepository.h>
+#include <SettingsInternalCRKeys.h>
+
+#include "spsettingsvoiputils.h"
+#include "TestData.h"
+
+// - Construction -----------------------------------------------------------
+
+T_CSPSettingsVoIPUtils* T_CSPSettingsVoIPUtils::NewL()
+    {
+    T_CSPSettingsVoIPUtils* self = T_CSPSettingsVoIPUtils::NewLC();
+    CleanupStack::Pop();
+    return self;
+    }
+
+T_CSPSettingsVoIPUtils* T_CSPSettingsVoIPUtils::NewLC()
+    {
+    T_CSPSettingsVoIPUtils* self = new( ELeave ) T_CSPSettingsVoIPUtils();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+T_CSPSettingsVoIPUtils::~T_CSPSettingsVoIPUtils()
+    {
+    }
+
+T_CSPSettingsVoIPUtils::T_CSPSettingsVoIPUtils()
+    {
+    }
+
+void T_CSPSettingsVoIPUtils::ConstructL()
+    {
+    CEUnitTestSuiteClass::ConstructL();
+    }
+
+// - Test methods -----------------------------------------------------------
+
+
+
+void T_CSPSettingsVoIPUtils::SetupL(  )
+    {
+    iCSPSettingsVoIPUtils = CSPSettingsVoIPUtils::NewL();
+    }
+
+void T_CSPSettingsVoIPUtils::Setup2L(  )
+    {
+    iCSPSettingsVoIPUtils = CSPSettingsVoIPUtils::NewL();
+    
+    CRepository* repository = CRepository::NewLC( KCRUidTelephonySettings );
+    User::LeaveIfError( repository->Set( KDynamicVoIP, EFalse ) );
+    CleanupStack::PopAndDestroy( repository );
+    
+    repository = CRepository::NewLC( KCRUidRichCallSettings );
+    User::LeaveIfError( repository->Set( KRCSPSPreferredService, 0 ) );
+    CleanupStack::PopAndDestroy( repository );
+    }
+
+void T_CSPSettingsVoIPUtils::Setup3L(  )
+    {
+    TestData::iCheckSupportedCase = ETrue;
+    iCSPSettingsVoIPUtils = CSPSettingsVoIPUtils::NewL();
+    }
+
+void T_CSPSettingsVoIPUtils::Teardown(  )
+    {    
+    delete iCSPSettingsVoIPUtils;
+    iCSPSettingsVoIPUtils = NULL;
+    }
+    
+void T_CSPSettingsVoIPUtils::T_CSPSettingsVoIPUtils_VoIPProfilesExistLL(  )
+    {
+    iCSPSettingsVoIPUtils->VoIPProfilesExistL();
+    }
+
+void T_CSPSettingsVoIPUtils::T_CSPSettingsVoIPUtils_IsVoIPSupportedL(  )
+    {
+    EUNIT_ASSERT( !iCSPSettingsVoIPUtils->IsVoIPSupported( ) );
+    TestData::iCheckSupportedCase = EFalse;
+    }
+    
+void T_CSPSettingsVoIPUtils::T_CSPSettingsVoIPUtils_IsPreferredTelephonyVoIPL(  )
+    {
+    EUNIT_ASSERT( !iCSPSettingsVoIPUtils->IsPreferredTelephonyVoIP() );
+    }
+    
+void T_CSPSettingsVoIPUtils::T_CSPSettingsVoIPUtils_GetPreferredServiceL(  )
+    {
+    TUint id( 0 );
+    EUNIT_ASSERT( KErrNotSupported == iCSPSettingsVoIPUtils->GetPreferredService( id ) );
+    
+    CRepository* repository = CRepository::NewLC( KCRUidTelephonySettings );
+    User::LeaveIfError( repository->Set( KDynamicVoIP, ETrue ) );
+    CleanupStack::PopAndDestroy( repository );
+    
+    EUNIT_ASSERT( KErrNotFound == iCSPSettingsVoIPUtils->GetPreferredService( id ) );
+    
+    TInt testValue( 1 );
+    repository = CRepository::NewLC( KCRUidRichCallSettings );
+    User::LeaveIfError( repository->Set( KRCSPSPreferredService, testValue ) );
+    CleanupStack::PopAndDestroy( repository );
+    EUNIT_ASSERT( KErrNone == iCSPSettingsVoIPUtils->GetPreferredService( id ) );
+    EUNIT_ASSERT( testValue == id );
+    }
+
+void T_CSPSettingsVoIPUtils::T_CSPSettingsVoIPUtils_DoGetPreferredServiceLL(  )
+    {
+    
+    }
+
+
+// - EUnit test table -------------------------------------------------------
+
+EUNIT_BEGIN_TEST_TABLE(
+    T_CSPSettingsVoIPUtils,
+    "Add test suite description here.",
+    "UNIT" )
+    
+EUNIT_TEST(
+    "VoIPProfilesExistL - test",
+    "CSPSettingsVoIPUtils",
+    "VoIPProfilesExistL - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettingsVoIPUtils_VoIPProfilesExistLL, Teardown)
+
+EUNIT_TEST(
+    "IsVoIPSupported - test",
+    "CSPSettingsVoIPUtils",
+    "IsVoIPSupported - test",
+    "FUNCTIONALITY",
+    Setup3L, T_CSPSettingsVoIPUtils_IsVoIPSupportedL, Teardown)
+
+EUNIT_TEST(
+    "IsPreferredTelephonyVoIP - test",
+    "CSPSettingsVoIPUtils",
+    "IsPreferredTelephonyVoIP - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettingsVoIPUtils_IsPreferredTelephonyVoIPL, Teardown)
+    
+EUNIT_TEST(
+    "GetPreferredService - test",
+    "CSPSettingsVoIPUtils",
+    "GetPreferredService - test",
+    "FUNCTIONALITY",
+    Setup2L, T_CSPSettingsVoIPUtils_GetPreferredServiceL, Teardown)
+/*
+EUNIT_TEST(
+    "DoGetPreferredServiceL - test",
+    "CSPSettingsVoIPUtils",
+    "DoGetPreferredServiceL - test",
+    "FUNCTIONALITY",
+    SetupL, T_CSPSettingsVoIPUtils_DoGetPreferredServiceLL, Teardown)*/
+
+
+EUNIT_END_TEST_TABLE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/T_CSPSettingsVoIPUtils.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,77 @@
+/*
+* 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: Declaration of T_CSPSettingsVoIPUtils class.
+*
+*/
+
+#ifndef __T_CSPSETTINGSVOIPUTILS_H__
+#define __T_CSPSETTINGSVOIPUTILS_H__
+
+// INCLUDES
+#include <CEUnitTestSuiteClass.h>
+#include <EUnitDecorators.h>
+
+#include "spsettingsvoiputils.h"
+
+// FORWARD DECLARATIONS
+
+
+// CLASS DEFINITION
+/**
+ * Generated EUnit test suite class.
+ */
+NONSHARABLE_CLASS( T_CSPSettingsVoIPUtils )
+	: public CEUnitTestSuiteClass
+    {
+    public:  // Constructors and destructor
+
+        static T_CSPSettingsVoIPUtils* NewL();
+        static T_CSPSettingsVoIPUtils* NewLC();
+        ~T_CSPSettingsVoIPUtils();
+
+    private: // Constructors
+
+        T_CSPSettingsVoIPUtils();
+        void ConstructL();
+
+    private: // New methods
+
+         void SetupL();
+         
+         void Setup2L();
+         
+         void Setup3L();
+        
+         void Teardown();
+        
+         void T_CSPSettingsVoIPUtils_VoIPProfilesExistLL();
+        
+         void T_CSPSettingsVoIPUtils_IsVoIPSupportedL();
+        
+         void T_CSPSettingsVoIPUtils_IsPreferredTelephonyVoIPL();
+        
+         void T_CSPSettingsVoIPUtils_GetPreferredServiceL();
+         
+         void T_CSPSettingsVoIPUtils_DoGetPreferredServiceLL();
+        
+
+    private: // Data
+
+        CSPSettingsVoIPUtils* iCSPSettingsVoIPUtils;
+
+        EUNIT_DECLARE_TEST_TABLE;
+
+    };
+
+#endif      //  __T_CSPSETTINGSVOIPUTILS_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/T_CSPSettingsVoIPUtils_DllMain.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,24 @@
+/*
+* 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 CreateTestSuiteL class.
+*
+*/
+
+#include "T_CSPSettingsVoIPUtils.h"
+#include <CEUnitTestSuite.h>
+
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return T_CSPSettingsVoIPUtils::NewL();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/T_CSPSettings_DllMain.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,24 @@
+/*
+* 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 CreateTestSuiteL class.
+*
+*/
+
+#include "T_CSPSettings.h"
+#include <CEUnitTestSuite.h>
+
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return T_CSPSettings::NewL();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/ut_spsbackuphelpermonitor.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,150 @@
+/*
+* 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: 
+*
+*/
+
+#include "ut_spsbackuphelpermonitor.h"
+#include <EUnitMacros.h>
+#include <EUnitDecorators.h>
+
+#include <spentry.h>
+#include <spproperty.h>
+#include "spsbackuphelpermonitor.h"
+
+// - Construction -----------------------------------------------------------
+
+Ut_CSpsBackupHelperMonitor* Ut_CSpsBackupHelperMonitor::NewL()
+    {
+    Ut_CSpsBackupHelperMonitor* self = new (ELeave) Ut_CSpsBackupHelperMonitor;
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+Ut_CSpsBackupHelperMonitor::~Ut_CSpsBackupHelperMonitor()
+    {
+    }
+
+Ut_CSpsBackupHelperMonitor::Ut_CSpsBackupHelperMonitor()
+    {
+    }
+
+void Ut_CSpsBackupHelperMonitor::ConstructL()
+    {
+    CEUnitTestSuiteClass::ConstructL();
+    }
+
+// - Test methods -----------------------------------------------------------
+
+
+
+void Ut_CSpsBackupHelperMonitor::SetupL(  )
+    {
+    iMonitor = CSpsBackupHelperMonitor::NewL();
+    }
+    
+
+void Ut_CSpsBackupHelperMonitor::Teardown(  )
+    {
+    delete iMonitor;
+    iMonitor = NULL;
+    }
+
+
+void Ut_CSpsBackupHelperMonitor::Ut_ConstructL()
+    {
+    // Do nothing
+    }
+
+void Ut_CSpsBackupHelperMonitor::Ut_FullBackupOngoingSetupL()
+    {
+    RProperty prop;
+    prop.Attach( KUidSystemCategory, conn::KUidBackupRestoreKey );
+    prop.Set( EBURBackupFull );
+    iMonitor = CSpsBackupHelperMonitor::NewL();
+    prop.Close();
+    }
+
+void Ut_CSpsBackupHelperMonitor::Ut_PartialBackupOngoingSetupL()
+    {
+    RProperty prop;
+    prop.Attach( KUidSystemCategory, conn::KUidBackupRestoreKey );
+    prop.Set( EBURBackupPartial );
+    iMonitor = CSpsBackupHelperMonitor::NewL();
+    prop.Close();
+    }
+
+void Ut_CSpsBackupHelperMonitor::Ut_FullRestoreOngoingSetupL()
+    {
+    RProperty prop;
+    prop.Attach( KUidSystemCategory, conn::KUidBackupRestoreKey );
+    prop.Set( EBURRestoreFull );
+    iMonitor = CSpsBackupHelperMonitor::NewL();
+    prop.Close();
+    }
+
+void Ut_CSpsBackupHelperMonitor::Ut_PartialRestoreOngoingSetupL()
+    {
+    RProperty prop;
+    prop.Attach( KUidSystemCategory, conn::KUidBackupRestoreKey );
+    prop.Set( EBURRestorePartial );
+    iMonitor = CSpsBackupHelperMonitor::NewL();
+    prop.Close();
+    }
+
+// - EUnit test table -------------------------------------------------------
+
+EUNIT_BEGIN_TEST_TABLE(
+    Ut_CSpsBackupHelperMonitor,
+    "Add test suite description here.",
+    "UNIT" )
+    
+EUNIT_TEST(
+    "Construct - destruct",
+    "CSPSettingsEngine",
+    "Construct - destruct",
+    "FUNCTIONALITY",
+    SetupL, Ut_ConstructL, Teardown)
+    
+EUNIT_TEST(
+    "FullBackup Construct - destruct",
+    "CSPSettingsEngine",
+    "Construct - destruct",
+    "FUNCTIONALITY",
+    Ut_FullBackupOngoingSetupL, Ut_ConstructL, Teardown)
+    
+EUNIT_TEST(
+    "PartialBackup Construct - destruct",
+    "CSPSettingsEngine",
+    "Construct - destruct",
+    "FUNCTIONALITY",
+    Ut_PartialBackupOngoingSetupL, Ut_ConstructL, Teardown)
+    
+EUNIT_TEST(
+    "FullRestore Construct - destruct",
+    "CSPSettingsEngine",
+    "Construct - destruct",
+    "FUNCTIONALITY",
+    Ut_FullRestoreOngoingSetupL, Ut_ConstructL, Teardown)
+    
+EUNIT_TEST(
+    "PartialRestore Construct - destruct",
+    "CSPSettingsEngine",
+    "Construct - destruct",
+    "FUNCTIONALITY",
+    Ut_PartialRestoreOngoingSetupL, Ut_ConstructL, Teardown)
+
+EUNIT_END_TEST_TABLE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/ut_spsbackuphelpermonitor.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#ifndef __UT_SPSBACKUPHELPERMONITOR_H__
+#define __UT_SPSBACKUPHELPERMONITOR_H__
+
+// INCLUDES
+#include <CEUnitTestSuiteClass.h>
+#include <EUnitDecorators.h>
+
+// FORWARD DECLARATIONS
+class CSpsBackupHelperMonitor;
+
+// CLASS DEFINITION
+/**
+ * Generated EUnit test suite class.
+ */
+NONSHARABLE_CLASS( Ut_CSpsBackupHelperMonitor )
+	: public CEUnitTestSuiteClass
+    {
+    public:  // Constructors and destructor
+
+        static Ut_CSpsBackupHelperMonitor* NewL();
+
+        ~Ut_CSpsBackupHelperMonitor();
+
+    private: // Constructors
+
+        Ut_CSpsBackupHelperMonitor();
+        void ConstructL();
+
+    private: // New methods
+
+         void SetupL();
+        
+         void Teardown();
+
+         void Ut_ConstructL();
+         
+         void Ut_FullBackupOngoingSetupL();
+
+         void Ut_PartialBackupOngoingSetupL();
+
+         void Ut_FullRestoreOngoingSetupL();
+
+         void Ut_PartialRestoreOngoingSetupL();
+    private: // Data
+
+        CSpsBackupHelperMonitor* iMonitor;
+
+        EUNIT_DECLARE_TEST_TABLE;
+
+    };
+
+#endif      //  __UT_SPSBACKUPHELPERMONITOR_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/ut_spsbackuphelpermonitor_dllmain.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,24 @@
+/*
+* 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: 
+*
+*/
+
+#include "ut_spsbackuphelpermonitor.h"
+#include <CEUnitTestSuite.h>
+
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return Ut_CSpsBackupHelperMonitor::NewL();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/ut_spsbackuphelperperformer.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,98 @@
+/*
+* 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: 
+*
+*/
+
+#include "ut_spsbackuphelperperformer.h"
+#include <EUnitMacros.h>
+#include <EUnitDecorators.h>
+
+#include <spentry.h>
+#include <spproperty.h>
+#include "spsbackuphelperperformer.h"
+
+// - Construction -----------------------------------------------------------
+
+Ut_CSpsBackupHelperPerformer* Ut_CSpsBackupHelperPerformer::NewL()
+    {
+    
+    Ut_CSpsBackupHelperPerformer* self = new (ELeave) Ut_CSpsBackupHelperPerformer;
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+Ut_CSpsBackupHelperPerformer::~Ut_CSpsBackupHelperPerformer()
+    {
+    }
+
+Ut_CSpsBackupHelperPerformer::Ut_CSpsBackupHelperPerformer()
+    {
+    }
+
+void Ut_CSpsBackupHelperPerformer::ConstructL()
+    {
+    CEUnitTestSuiteClass::ConstructL();
+    }
+
+// - Test methods -----------------------------------------------------------
+
+
+
+void Ut_CSpsBackupHelperPerformer::SetupL(  )
+    {
+    iPerformer = CSpsBackupHelperPerformer::NewL();
+    }
+    
+
+void Ut_CSpsBackupHelperPerformer::Teardown(  )
+    {
+    delete iPerformer;
+    iPerformer = NULL;
+    }
+
+void Ut_CSpsBackupHelperPerformer::Ut_ConstructL()
+    {
+    // Do nothing
+    }
+
+void Ut_CSpsBackupHelperPerformer::Ut_CSpsBackupHelperPerformer_PerformL()
+    {
+    iPerformer->PerformL();
+    }
+
+// - EUnit test table -------------------------------------------------------
+
+EUNIT_BEGIN_TEST_TABLE(
+    Ut_CSpsBackupHelperPerformer,
+    "Add test suite description here.",
+    "UNIT" )
+    
+EUNIT_TEST(
+    "Construct - destruct",
+    "CSPSettingsEngine",
+    "Construct - destruct",
+    "FUNCTIONALITY",
+    SetupL, Ut_ConstructL, Teardown)
+
+EUNIT_TEST(
+    "Test Perform",
+    "CSPSettingsEngine",
+    "Test Perform",
+    "FUNCTIONALITY",
+    SetupL, Ut_CSpsBackupHelperPerformer_PerformL, Teardown)
+
+EUNIT_END_TEST_TABLE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/ut_spsbackuphelperperformer.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#ifndef __UT_SPSBACKUPHELPERPERFORMER_H__
+#define __UT_SPSBACKUPHELPERPERFORMER_H__
+
+// INCLUDES
+#include <CEUnitTestSuiteClass.h>
+#include <EUnitDecorators.h>
+
+// FORWARD DECLARATIONS
+class CSpsBackupHelperPerformer;
+
+// CLASS DEFINITION
+/**
+ * Generated EUnit test suite class.
+ */
+NONSHARABLE_CLASS( Ut_CSpsBackupHelperPerformer )
+	: public CEUnitTestSuiteClass
+    {
+    public:  // Constructors and destructor
+
+        static Ut_CSpsBackupHelperPerformer* NewL();
+
+        ~Ut_CSpsBackupHelperPerformer();
+
+    private: // Constructors
+
+        Ut_CSpsBackupHelperPerformer();
+        void ConstructL();
+
+    private: // New methods
+
+         void SetupL();
+        
+         void Teardown();
+         
+         void Ut_ConstructL();
+         
+         void Ut_CSpsBackupHelperPerformer_PerformL();
+        
+    private: // Data
+
+        CSpsBackupHelperPerformer* iPerformer;
+
+        EUNIT_DECLARE_TEST_TABLE;
+
+    };
+
+#endif      //  __UT_SPSBACKUPHELPERPERFORMER_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/ut_spsbackuphelperperformer_dllmain.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,24 @@
+/*
+* 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: 
+*
+*/
+
+#include "ut_spsbackuphelperperformer.h"
+#include <CEUnitTestSuite.h>
+
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return Ut_CSpsBackupHelperPerformer::NewL();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/ut_spsbufferedpublisher.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,162 @@
+/*
+* 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: 
+*
+*/
+
+#include "ut_spsbufferedpublisher.h"
+#include <EUnitMacros.h>
+#include <EUnitDecorators.h>
+
+#include <e32property.h>
+
+#include "spsbufferedpublisher.h"
+#include "spdefaultvalues.h"
+
+// - Construction -----------------------------------------------------------
+
+Ut_CSpsBufferedPublisher* Ut_CSpsBufferedPublisher::NewL()
+    {
+    
+    Ut_CSpsBufferedPublisher* self = new (ELeave) Ut_CSpsBufferedPublisher;
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+Ut_CSpsBufferedPublisher::~Ut_CSpsBufferedPublisher()
+    {
+    }
+
+Ut_CSpsBufferedPublisher::Ut_CSpsBufferedPublisher()
+    {
+    }
+
+void Ut_CSpsBufferedPublisher::ConstructL()
+    {
+    CEUnitTestSuiteClass::ConstructL();
+    }
+
+// - Test methods -----------------------------------------------------------
+
+
+
+void Ut_CSpsBufferedPublisher::SetupL(  )
+    {
+    iPublisher = CSpsBufferedPublisher::NewL( KUidSystemCategory, KSPNotifyChangeKey );
+    iPublisher->Start();
+    }
+    
+
+void Ut_CSpsBufferedPublisher::Teardown(  )
+    {
+    delete iPublisher;
+    iPublisher = NULL;
+    }
+
+void Ut_CSpsBufferedPublisher::Ut_ConstructL()
+    {
+    // Do nothing
+    }
+
+void Ut_CSpsBufferedPublisher::Ut_CSpsBufferedPublisher_DataSizeL()
+    {
+    const TUint32 data( 0xFFFFFFFF );
+    CSpsBufferedPublisher::SetL( KUidSystemCategory, KSPNotifyChangeKey, data );
+    RArray<TUint32> array;
+    iPublisher->GetL( array );
+    EUNIT_ASSERT_EQUALS( 1, array.Count() );
+    EUNIT_ASSERT_EQUALS( data, array[0] );
+    array.Close();
+    }
+    
+void Ut_CSpsBufferedPublisher::Ut_CSpsBufferedPublisher_BufferSizeL()
+    {
+    TInt testedBuffer = 100000;
+    
+    for( TInt i(0); i < testedBuffer; i++ )
+        {
+        CSpsBufferedPublisher::SetL( KUidSystemCategory, KSPNotifyChangeKey, i );
+        }
+    
+    RArray<TUint32> array;
+    iPublisher->GetL( array );
+    EUNIT_ASSERT_EQUALS( 127, array.Count() );
+
+    for( TInt i(127); i > 0; i-- )
+        {
+        EUNIT_ASSERT_EQUALS( testedBuffer - i, array[array.Count()-i] );
+        }
+        
+        
+    array.Close();
+    }
+
+void Ut_CSpsBufferedPublisher::Ut_CSpsBufferedPublisher_DataValidyL()
+    {
+    
+    for( TInt i(0); i < 100000; i++ )
+        {
+        CSpsBufferedPublisher::SetL( KUidSystemCategory, KSPNotifyChangeKey, i );
+        
+        RArray<TUint32> array;
+        iPublisher->GetL( array );
+        EUNIT_ASSERT_EQUALS( 1, array.Count() );
+        EUNIT_ASSERT_EQUALS( i, array[0] );
+        array.Close();
+        }
+    
+    RArray<TUint32> array;
+    iPublisher->GetL( array );
+    EUNIT_ASSERT_EQUALS( 0, array.Count() );
+    array.Close();
+    }
+
+// - EUnit test table -------------------------------------------------------
+
+EUNIT_BEGIN_TEST_TABLE(
+    Ut_CSpsBufferedPublisher,
+    "Add test suite description here.",
+    "UNIT" )
+    
+EUNIT_TEST(
+    "Construct - destruct",
+    "CSpsBufferedPublisher",
+    "Construct - destruct",
+    "FUNCTIONALITY",
+    SetupL, Ut_ConstructL, Teardown)
+
+EUNIT_TEST(
+    "Test DataSize",
+    "CSpsBufferedPublisher",
+    "Test DataSize",
+    "FUNCTIONALITY",
+    SetupL, Ut_CSpsBufferedPublisher_DataSizeL, Teardown)
+    
+EUNIT_TEST(
+    "Test BufferSize",
+    "CSpsBufferedPublisher",
+    "Test BufferSize",
+    "FUNCTIONALITY",
+    SetupL, Ut_CSpsBufferedPublisher_BufferSizeL, Teardown)
+    
+EUNIT_TEST(
+    "Test DataValidy",
+    "CSpsBufferedPublisher",
+    "Test DataValidy",
+    "FUNCTIONALITY",
+    SetupL, Ut_CSpsBufferedPublisher_DataValidyL, Teardown)
+
+EUNIT_END_TEST_TABLE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/ut_spsbufferedpublisher.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#ifndef __UT_SPSBUFFEREDPUBLISHER_H__
+#define __UT_SPSBUFFEREDPUBLISHER_H__
+
+// INCLUDES
+#include <CEUnitTestSuiteClass.h>
+#include <EUnitDecorators.h>
+
+// FORWARD DECLARATIONS
+class CSpsBufferedPublisher;
+
+// CLASS DEFINITION
+/**
+ * Generated EUnit test suite class.
+ */
+NONSHARABLE_CLASS( Ut_CSpsBufferedPublisher )
+	: public CEUnitTestSuiteClass
+    {
+    public:  // Constructors and destructor
+
+        static Ut_CSpsBufferedPublisher* NewL();
+
+        ~Ut_CSpsBufferedPublisher();
+
+    private: // Constructors
+
+        Ut_CSpsBufferedPublisher();
+        void ConstructL();
+
+    private: // New methods
+
+         void SetupL();
+        
+         void Teardown();
+         
+         void Ut_ConstructL();
+         
+         void Ut_CSpsBufferedPublisher_DataSizeL();
+         
+         void Ut_CSpsBufferedPublisher_BufferSizeL();
+         
+         void Ut_CSpsBufferedPublisher_DataValidyL();
+        
+    private: // Data
+
+        CSpsBufferedPublisher* iPublisher;
+
+        EUNIT_DECLARE_TEST_TABLE;
+
+    };
+
+#endif      //  __UT_SPSBUFFEREDPUBLISHER_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/src/ut_spsbufferedpublisher_dllmain.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,24 @@
+/*
+* 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: 
+*
+*/
+
+#include "ut_spsbufferedpublisher.h"
+#include <CEUnitTestSuite.h>
+
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    return Ut_CSpsBufferedPublisher::NewL();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/stubs/FeatMgr.h	Wed Jul 21 18:26:52 2010 +0300
@@ -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:  Stub header for CallUiEngine testing.
+*
+*/
+
+
+#ifndef FEATMGR_STUB_H
+#define FEATMGR_STUB_H
+
+
+//  INCLUDES
+#include    <e32base.h>
+
+
+/**
+* FeatureManager
+*/
+class FeatureManager
+    {
+    public:
+
+        static void InitializeLibL();
+        static void UnInitializeLib();
+        static TBool FeatureSupported( TInt aFeature );
+
+
+    public:
+
+        static TBool iFeatureIdCsVideoTelephony;
+        static TBool iBtAudioSupported;
+        static TBool iHelpSupported;
+
+    };
+
+
+#endif // FEATMGR_STUB_H
+            
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/stubs/FeatMgrStub.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Stub implementation for needed libraries.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "FeatMgr.h"
+#include <bldvariant.hrh>
+#include "TestData.h"
+
+TBool FeatureManager::iBtAudioSupported = ETrue;
+TBool FeatureManager::iHelpSupported = ETrue;
+TBool FeatureManager::iFeatureIdCsVideoTelephony = ETrue;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// FeatureManager::InitializeLibL
+// 
+// -----------------------------------------------------------------------------
+void FeatureManager::InitializeLibL()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// FeatureManager::InitializeLibL
+// 
+// -----------------------------------------------------------------------------
+void FeatureManager::UnInitializeLib()
+    {
+    }
+    
+// -----------------------------------------------------------------------------
+// FeatureManager::FeatureSupported
+// 
+// -----------------------------------------------------------------------------
+TBool FeatureManager::FeatureSupported( TInt aFeature )
+    {
+    TBool returnValue = EFalse;
+    
+    if ( aFeature == KFeatureIdCsVideoTelephony )
+        {
+        returnValue = iFeatureIdCsVideoTelephony;
+        }
+    else if ( aFeature == KFeatureIdBtAudio )
+        {
+        returnValue = iBtAudioSupported;
+        }
+    else if ( aFeature == KFeatureIdHelp )
+        {
+        returnValue = iHelpSupported;
+        }
+    else if ( aFeature == KFeatureIdAutoRedialForVideoCall )
+        {
+        returnValue = ETrue;
+        }
+    else if ( aFeature == KFeatureIdCommonVoip )
+        {
+        if ( TestData::iCheckSupportedCase )
+            {
+            returnValue = EFalse;
+            }
+        else
+            {
+            returnValue = ETrue;
+            }
+        }
+    else 
+        {
+        // By default any other feature is not supported.
+        returnValue = EFalse;
+        }
+
+    return returnValue;
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/stubs/T_cenrepdatabaseutilStub.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,831 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 central repository database.
+*
+*/
+
+
+#include <centralrepository.h>
+
+#include "cenrepdatabaseutil.h"
+//#include "//CENREPDATABASELOGger.h"
+
+TUint count( 0 );
+const TInt KNoEntryId = 0; // Not allowed ID for entries. Deleted rows
+                           // are marked with KNoEntryId
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CCenRepDatabaseUtil::CCenRepDatabaseUtil( TUint32 aStartKey,
+                                      TUint32 aColIncrement,
+                                      TUint32 aColMask,
+                                      TUint32 aIdCounterKey,
+                                      TInt aColCount )
+    : iStartKey( aStartKey ),
+      iColIncrement( aColIncrement ),
+      iColMask( aColMask ),
+      iIdCounterKey( aIdCounterKey ),
+      iColCount( aColCount )
+    {
+    }
+    
+// ---------------------------------------------------------------------------
+// 2nd phase constructor
+// ---------------------------------------------------------------------------
+//
+void CCenRepDatabaseUtil::ConstructL( TUid aUid )
+    {
+    if( iColIncrement - 1 + iColMask != KMaxTUint )
+        {
+        User::Leave( KErrArgument );
+        }
+        
+    iRepository = CRepository::NewL( aUid );
+
+    // Create semaphore name from repository uid
+    TUidName uidName = aUid.Name();
+    TInt err = iSemaphore.OpenGlobal( uidName );
+    if ( err != KErrNone )
+        {
+        User::LeaveIfError( iSemaphore.CreateGlobal( uidName, 1 ) );
+        }
+    
+    }
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCenRepDatabaseUtil* CCenRepDatabaseUtil::NewL( TUid aUid, 
+                                                     TUint32 aStartKey, 
+                                                     TUint32 aColIncrement, 
+                                                     TUint32 aColMask,
+                                                     TUint32 aIdCounterKey,
+                                                     TInt aColCount )
+    {
+    ////CENREPDATABASELOG( "CCenRepDatabaseUtil::NewL - IN" );
+    
+    CCenRepDatabaseUtil* self = CCenRepDatabaseUtil::NewLC( 
+                                                        aUid, 
+                                                        aStartKey, 
+                                                        aColIncrement, 
+                                                        aColMask, 
+                                                        aIdCounterKey, 
+                                                        aColCount );
+    CleanupStack::Pop( self );
+    
+    ////CENREPDATABASELOG( "CCenRepDatabaseUtil::NewL - OUT" );
+    
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCenRepDatabaseUtil* CCenRepDatabaseUtil::NewLC( TUid aUid, 
+                                                      TUint32 aStartKey, 
+                                                      TUint32 aColIncrement, 
+                                                      TUint32 aColMask,
+                                                      TUint32 aIdCounterKey,
+                                                      TInt aColCount )
+    {
+    //CENREPDATABASELOG( "CCenRepDatabaseUtil::NewLC - IN" );
+    
+    CCenRepDatabaseUtil* self = new( ELeave ) CCenRepDatabaseUtil( 
+                                                                aStartKey,
+                                                                aColIncrement,
+                                                                aColMask,
+                                                                aIdCounterKey,
+                                                                aColCount );
+    CleanupStack::PushL( self );
+    self->ConstructL( aUid );
+    
+    //CENREPDATABASELOG( "CCenRepDatabaseUtil::NewLC - OUT" );
+    
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCenRepDatabaseUtil::~CCenRepDatabaseUtil()
+    {
+    //CENREPDATABASELOG( "CCenRepDatabaseUtil::~CCenRepDatabaseUtil - IN" );
+    
+    iSemaphore.Close();
+    delete iRepository;
+    
+    //CENREPDATABASELOG( "CCenRepDatabaseUtil::~CCenRepDatabaseUtil - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// Begins transaction in repository.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCenRepDatabaseUtil::BeginTransactionL()
+    {
+    //CENREPDATABASELOG( "CCenRepDatabaseUtil::BeginTransactionL - IN" );
+    
+/*    iSemaphore.Wait();
+	TCleanupItem cleanup( CCenRepDatabaseUtil::ReleaseSemaphore, this );
+	CleanupStack::PushL( cleanup );
+    
+    User::LeaveIfError( 
+        iRepository->StartTransaction( CRepository::EReadWriteTransaction ) );
+    
+	iRepository->CleanupRollbackTransactionPushL(); // if leave happens,
+	                                                // only roll back, no delete
+	*/
+	//CENREPDATABASELOG( "CCenRepDatabaseUtil::BeginTransactionL - OUT" );                                                
+    }
+
+// ---------------------------------------------------------------------------
+// Commits changes in repository.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCenRepDatabaseUtil::CommitTransaction()
+    {
+    //CENREPDATABASELOG( "CCenRepDatabaseUtil::CommitTransaction - IN" );
+    
+/*	TUint32 temp;
+	
+	TInt retval = iRepository->CommitTransaction( temp );
+	
+	iSemaphore.Signal();
+
+	CleanupStack::Pop( 2 ); // semaphore and repository*/
+	
+	//CENREPDATABASELOG( "CCenRepDatabaseUtil::CommitTransaction - OUT" );
+
+    //return retval;
+    return 0;
+    }
+
+// ---------------------------------------------------------------------------
+// Rollback changes in repository.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCenRepDatabaseUtil::RollbackTransaction()
+    {
+    //CENREPDATABASELOG( "CCenRepDatabaseUtil::RollbackTransaction - IN" );
+    
+/*	CleanupStack::Pop( 2 ); // rollback transaction item and semaphore
+
+	iRepository->RollbackTransaction();
+	iSemaphore.Signal();*/
+	
+	//CENREPDATABASELOG( "CCenRepDatabaseUtil::RollbackTransaction - OUT" );
+    }
+    
+// ---------------------------------------------------------------------------
+// Add new entry to cenrep.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCenRepDatabaseUtil::AddEntryL( 
+    TInt& aEntryId,
+    const RIpAppPropArray& aArray )
+    {
+    //CENREPDATABASELOG( "CCenRepDatabaseUtil::AddEntryL - IN" );
+    
+    CreateEntryIdL( aEntryId );
+    TUint32 idKey = GetNewIdKeyL();
+    
+    // Add entry Id
+    SetOrCreateKeyL( idKey, aEntryId );
+    
+    UpdatePropertiesL( idKey, aArray );
+    
+    //CENREPDATABASELOG( "CCenRepDatabaseUtil::AddEntryL - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// Find entry by ID.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCenRepDatabaseUtil::FindEntryL( 
+    TInt aEntryId,
+    RIpAppPropArray& aArray )
+    {
+    //CENREPDATABASELOG( "CCenRepDatabaseUtil::FindEntryL - IN" );
+    
+    RKeyArray keys;
+    CleanupClosePushL( keys );
+
+    // Find all rows where ID is aServiceId (entry row + each property row)
+    TInt err = iRepository->FindEqL( iStartKey, iColMask, aEntryId, keys );
+
+    TInt count = keys.Count();
+
+    if ( KErrNone == err && count > 0 )
+        {
+        TUint32 idKey = keys[ 0 ];
+
+        for ( TInt i = 1; i <= iColCount; i++ )
+            {
+            RBuf value;
+            value.CreateL( KCenRepMaxDesLength );
+            value.CleanupClosePushL();
+            TUint32 propertyKey = idKey + i * iColIncrement;
+            TInt errProperty = iRepository->Get( propertyKey, value );
+            if( errProperty == KErrNone && value.Compare( KNullDesC ) != 0 )
+                {
+                CCenRepDatabaseProperty* property = CCenRepDatabaseProperty::NewLC();
+                property->SetName( propertyKey - idKey + iStartKey );
+                User::LeaveIfError( property->SetValue( value ) );
+                User::LeaveIfError( aArray.Append( property ) );
+                CleanupStack::Pop( property );
+                }
+                
+            CleanupStack::PopAndDestroy( &value );
+            }
+        }
+
+    CleanupStack::PopAndDestroy( &keys );
+    
+    //CENREPDATABASELOG( "CCenRepDatabaseUtil::FindEntryL - OUT" );
+    
+    return err;
+
+    }
+
+// ---------------------------------------------------------------------------
+// Update entry in cenrep.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCenRepDatabaseUtil::UpdateEntryL( 
+    TInt aEntryId, 
+    const RIpAppPropArray& aArray )
+    {
+    //CENREPDATABASELOG( "CCenRepDatabaseUtil::UpdateEntryL - IN" );
+    
+    RKeyArray keys;
+    CleanupClosePushL( keys );
+
+    // Find rows where ID is located
+    TInt err = iRepository->FindEqL( iStartKey, iColMask, aEntryId, keys );
+
+    TInt count = keys.Count();
+
+    if ( KErrNone == err && count > 0 )
+        {
+        TUint32 idKey = keys[ 0 ];
+        UpdatePropertiesL( idKey, aArray );
+        }
+
+    CleanupStack::PopAndDestroy( &keys );
+    
+    //CENREPDATABASELOG( "CCenRepDatabaseUtil::UpdateEntryL - OUT" );
+    
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Delete entry from cenrep.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCenRepDatabaseUtil::DeleteEntryL( TInt aEntryId )
+    {
+    //CENREPDATABASELOG( "CCenRepDatabaseUtil::DeleteEntryL - IN" );
+    
+    RKeyArray keys;
+    CleanupClosePushL( keys );
+
+    // Find all rows where ID is aServiceId (entry row + each property row)
+    TInt err = iRepository->FindEqL( iStartKey, iColMask, aEntryId, keys );
+
+    TInt count = keys.Count();
+
+    if ( KErrNone == err && count > 0 )
+        {
+        TUint32 idKey = keys[ 0 ];
+        SetOrCreateKeyL( idKey, KNoEntryId );
+
+        for ( TInt i = 1; i <= iColCount; i++ )
+            {
+            TUint32 propertyKey = idKey + i * iColIncrement;
+            SetOrCreateKeyL( propertyKey, KNullDesC );
+            }
+        }
+
+    CleanupStack::PopAndDestroy( &keys );
+    
+    //CENREPDATABASELOG( "CCenRepDatabaseUtil::DeleteEntryL - OUT" );
+    
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Find property and its value by ID.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCenRepDatabaseUtil::FindPropertyL( TInt aEntryId, 
+                    TUint32 aPropertyName,
+                    CCenRepDatabaseProperty& aProperty )
+    {
+    //CENREPDATABASELOG( "CCenRepDatabaseUtil::FindPropertyL - IN" );
+    
+    RKeyArray keys;
+    CleanupClosePushL( keys );
+    TBool found = EFalse;
+
+    // Find all rows where ID is aServiceId (entry row + each property row)
+    TInt err = iRepository->FindEqL( iStartKey, iColMask, aEntryId, keys );
+
+    TInt count = keys.Count();
+
+    if ( KErrNone == err && count > 0 )
+        {
+        TUint32 idKey = keys[ 0 ];
+
+        for ( TInt i = 1; i <= iColCount; i++ )
+            {
+            TUint32 propertyKey = idKey + i * iColIncrement;
+            TUint32 propertyName = propertyKey - idKey + iStartKey;
+            if( propertyName == aPropertyName )
+                {
+                RBuf value;
+                value.CreateL( KCenRepMaxDesLength );
+                value.CleanupClosePushL();
+                
+                err = iRepository->Get( propertyKey, value );
+                if( err == KErrNone )
+                    {
+                    if( value.Compare( KNullDesC ) != 0 )
+                        {
+                        aProperty.SetName( propertyName );
+                        User::LeaveIfError( aProperty.SetValue( value ) );
+                        found = ETrue;
+                        }
+                    }
+                
+                CleanupStack::PopAndDestroy( &value );
+                break;
+                }
+            }
+        }
+
+    if( found )
+        {
+        err = KErrNone;
+        }
+    else
+        {
+        if( err == KErrNone )
+            {
+            err = KErrNotFound;
+            }
+        }
+    CleanupStack::PopAndDestroy( &keys );
+    
+    //CENREPDATABASELOG( "CCenRepDatabaseUtil::FindPropertyL - OUT" );
+    
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Adds or updates properties to/in cenrep.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCenRepDatabaseUtil::AddOrUpdatePropertiesL( 
+    TInt aEntryId, 
+    const RIpAppPropArray& aArray )
+    {
+    //CENREPDATABASELOG( "CCenRepDatabaseUtil::AddOrUpdatePropertiesL - IN" );
+    
+    RKeyArray keys;
+    CleanupClosePushL( keys );
+
+    // Find row maching to given ID
+    TInt err = iRepository->FindEqL( iStartKey, iColMask, aEntryId, keys );
+
+    if ( KErrNone == err && keys.Count() > 0 )
+        {
+        TUint32 idKey = keys[ 0 ];
+
+        TInt count = aArray.Count();
+
+        // Add properties one by one
+        for( TInt i = 0; i < count; i++ )
+            {
+            CCenRepDatabaseProperty* property = aArray[i];
+            TUint32 propertyName = property->GetName();
+            TUint32 key = idKey - iStartKey + propertyName;
+            SetOrCreateKeyL( key, property->GetDesValue() );
+            }
+        }
+
+    CleanupStack::PopAndDestroy( &keys );
+    
+    //CENREPDATABASELOG( "CCenRepDatabaseUtil::AddOrUpdatePropertiesL - OUT" );
+    
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Return count of entries in cenrep.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCenRepDatabaseUtil::EntryCountL( TInt& aCount )
+    {
+    //CENREPDATABASELOG( "CCenRepDatabaseUtil::EntryCountL - IN" );
+    
+    TInt err( KErrNone );
+    
+/*    RKeyArray keys;
+    CleanupClosePushL( keys );
+
+    // Find all rows where ID not equals to KNoEntryId
+    TInt err = iRepository->FindNeqL( iStartKey, iColMask, KNoEntryId, keys );
+
+    TInt count = keys.Count();
+
+    if ( KErrNone == err && count > 0 )
+        {
+        aCount = keys.Count();
+        }
+    else
+        {
+        aCount = 0;    
+        }
+
+    CleanupStack::PopAndDestroy( &keys );*/
+    
+    if ( 2 > count )
+        {
+        if ( !count )
+            {
+            err = KErrNotFound;
+            }
+        aCount = count;
+        count++;
+        }
+    else
+        {
+        aCount = count;
+        count = 0;
+        }
+    
+    //CENREPDATABASELOG( "CCenRepDatabaseUtil::EntryCountL - OUT" );
+
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Find all ids of entries in cenrep.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCenRepDatabaseUtil::FindEntryIdsL( RArray<TInt>& aEntryIds )
+    {
+    //CENREPDATABASELOG( "CCenRepDatabaseUtil::FindEntryIdsL - IN" );
+    
+    aEntryIds.Reset();
+    
+    RKeyArray keys;
+    CleanupClosePushL( keys );
+
+    // Find all entry rows from ID column. Deleted rows are not returned.
+    TInt err = iRepository->FindNeqL( iStartKey, iColMask, KNoEntryId, keys );
+
+    TInt count = keys.Count();
+
+    if ( KErrNone == err && count > 0 )
+        {
+        for( TInt i = 0; i < count; i++ )
+            {
+            TUint32 key = keys[i];
+            TInt entryId = 0;
+            User::LeaveIfError( iRepository->Get( key, entryId ) );
+            User::LeaveIfError( aEntryIds.Append( entryId ) );
+            }
+        }
+
+    CleanupStack::PopAndDestroy( &keys );
+    
+    //CENREPDATABASELOG( "CCenRepDatabaseUtil::FindEntryIdsL - OUT" );
+    
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Delete given properties from entry.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCenRepDatabaseUtil::DeletePropertiesL( TInt aEntryId,
+                        const RArray<TUint32>& aNameArray )
+    {
+    //CENREPDATABASELOG( "CCenRepDatabaseUtil::DeletePropertiesL - IN" );
+    
+    RKeyArray keys;
+    CleanupClosePushL( keys );
+
+    // Find row that matches to aEntryID
+    TInt err = iRepository->FindEqL( iStartKey, iColMask, aEntryId, keys );
+
+    if ( KErrNone == err && keys.Count() > 0 )
+        {
+        TUint32 idKey = keys[ 0 ];
+
+        TInt count = aNameArray.Count();
+
+        // delete properties one by one
+        for( TInt i = 0; i < count; i++ )
+            {
+            TUint32 name = aNameArray[i];
+            TUint32 key = idKey - iStartKey + name;
+            SetOrCreateKeyL( key, KNullDesC );
+            }
+        }
+
+    CleanupStack::PopAndDestroy( &keys );
+    
+    //CENREPDATABASELOG( "CCenRepDatabaseUtil::DeletePropertiesL - OUT" );
+    
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Find entry ids of given properties.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCenRepDatabaseUtil::FindEntryIdsFromPropertiesL( 
+    const RIpAppPropArray& aPropertyArray, 
+    RArray<TInt>& aEntryIds )
+    {
+    //CENREPDATABASELOG( "CCenRepDatabaseUtil::FindEntryIdsFromPropertiesL - IN" );
+    
+    TInt err = FindEntryIdsL( aEntryIds );
+    if( err == KErrNone )
+        {
+        TInt count = aEntryIds.Count();
+        TInt removed = 0;
+        
+        for( TInt i = 0; i < count; i++ )
+            {
+            TBool ok = EFalse;
+            TUint32 entryId = aEntryIds[ i - removed ];
+            CheckEntryHasPropertiesL( entryId, aPropertyArray, ok );
+            
+            if( !ok )
+                {
+                aEntryIds.Remove( i - removed );
+                removed++;
+                }
+            }
+        }
+        
+    //CENREPDATABASELOG( "CCenRepDatabaseUtil::FindEntryIdsFromPropertiesL - OUT" );
+        
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Release semaphore, this function is used in custom cleanup
+// ---------------------------------------------------------------------------
+//
+void CCenRepDatabaseUtil::ReleaseSemaphore( TAny* aPtr )
+	{
+	//CENREPDATABASELOG( "CCenRepDatabaseUtil::ReleaseSemaphore - IN" );
+	
+	ASSERT ( aPtr );
+	CCenRepDatabaseUtil* utils = static_cast<CCenRepDatabaseUtil*>( aPtr );
+	utils->DoReleaseSemaphore();
+	
+	//CENREPDATABASELOG( "CCenRepDatabaseUtil::ReleaseSemaphore - OUT" );
+	}
+
+// ---------------------------------------------------------------------------
+// Release semaphore
+// ---------------------------------------------------------------------------
+//
+void CCenRepDatabaseUtil::DoReleaseSemaphore()
+	{
+	//CENREPDATABASELOG( "CCenRepDatabaseUtil::DoReleaseSemaphore - IN" );
+	
+	iSemaphore.Signal();
+	
+	//CENREPDATABASELOG( "CCenRepDatabaseUtil::DoReleaseSemaphore - OUT" );
+	}
+
+// ---------------------------------------------------------------------------
+// Set value of key or create a new one.
+// ---------------------------------------------------------------------------
+//
+template<class T> void CCenRepDatabaseUtil::SetOrCreateKeyL( TUint32 aKey, 
+    const T& aValue )
+    {
+    TInt err = iRepository->Set( aKey, aValue );
+
+    if ( KErrNotFound == err )
+        {
+        err = iRepository->Create( aKey, aValue );
+        }
+
+    User::LeaveIfError( err );
+    }
+
+// ---------------------------------------------------------------------------
+// Create new ID.
+// ---------------------------------------------------------------------------
+//
+void CCenRepDatabaseUtil::CreateEntryIdL( TInt& aNewId )
+    {
+    TInt newId( KNoEntryId );
+
+    TInt err = iRepository->Get( iIdCounterKey, newId );
+
+    if ( KErrNone == err  )
+        {
+        if ( 0 < newId )
+            {
+            // Store next available ID
+            err = iRepository->Set( iIdCounterKey, newId + 1 );
+            }
+        else
+            {
+            // Range of ID exceeded
+            err = KErrOverflow;
+            }
+        }
+    else if ( KErrNotFound == err )
+        {
+        // Create new key (should always be found)
+        SetOrCreateKeyL( iIdCounterKey, KNoEntryId + 1 );
+        }
+
+    aNewId = newId;
+
+    User::LeaveIfError( err );
+    }
+
+// ---------------------------------------------------------------------------
+// Get next available key for ID.
+// ---------------------------------------------------------------------------
+//
+TUint32 CCenRepDatabaseUtil::GetNewIdKeyL()
+    {
+    RKeyArray keys;
+    CleanupClosePushL( keys );
+    TUint32 idKey( 0 );
+
+    // Reuse keys which value is KNoEntryId
+    TInt err = iRepository->FindEqL( iStartKey, iColMask, KNoEntryId, keys );
+
+    if ( KErrNone == err && 0 < keys.Count() )
+        {
+        // return id column key from first deleted row
+        idKey = keys[0];
+        }
+    else if ( KErrNotFound == err )
+        {
+        keys.Close();
+        TInt err1 = iRepository->FindL( iStartKey, iColMask, keys );
+
+        if( KErrNone == err1  )
+            {
+            // return new
+            TInt count( keys.Count() );
+            idKey = keys[count-1] + 1;
+            }
+        else if ( KErrNotFound == err1 )
+            {
+            idKey = iStartKey;
+            }
+        else
+            {
+            User::Leave( err1 );
+            }
+        }
+    else
+    	{
+    	User::Leave( err );
+    	}
+
+    CleanupStack::PopAndDestroy( &keys );
+
+    return idKey;
+    }
+    
+// ---------------------------------------------------------------------------
+// Update given properties to cenrep.
+// ---------------------------------------------------------------------------
+//
+void CCenRepDatabaseUtil::UpdatePropertiesL(
+    TUint32 aIdKey,
+    const RIpAppPropArray& aArray )
+    {
+    TInt count = aArray.Count();
+
+    // Create all keys for this entry
+    RKeyArray propertyKeys;
+    CleanupClosePushL( propertyKeys );
+    for( TInt k = 1; k <= iColCount; k++ )
+        {
+        User::LeaveIfError( propertyKeys.Append( aIdKey + k * iColIncrement ) );
+        }
+    
+    // Add properties one by one
+    for( TInt i = 0; i < count; i++ )
+        {
+        CCenRepDatabaseProperty* property = aArray[i];
+        TUint32 propertyName = property->GetName();
+        TUint32 key = aIdKey - iStartKey + propertyName;
+        SetOrCreateKeyL( key, property->GetDesValue() );
+        
+        // Get only non-set keys
+        TInt index = propertyKeys.Find( key );
+        if( index != KErrNotFound )
+            {
+            propertyKeys.Remove( index );
+            }
+        }
+    
+    // set non-set properties one by one
+    count = propertyKeys.Count();
+    for( TInt j = 0; j < count; j++ )
+        {
+        TUint32 key = propertyKeys[j];
+        SetOrCreateKeyL( key, KNullDesC() );
+        }
+    
+    CleanupStack::PopAndDestroy( &propertyKeys );    
+    }
+
+// ---------------------------------------------------------------------------
+// Check if entry has these properties.
+// ---------------------------------------------------------------------------
+//
+void CCenRepDatabaseUtil::CheckEntryHasPropertiesL( 
+    TInt aEntryId, 
+    const RIpAppPropArray& aPropertyArray, 
+    TBool& aOk )
+    {
+    RIpAppPropArray allArray;
+	TCleanupItem cleanup( CCenRepDatabaseUtil::CleanupPointerArray, &allArray );
+	CleanupStack::PushL( cleanup );
+    
+    TInt err = FindEntryL( aEntryId, allArray );
+    if( err == KErrNone )
+        {
+        aOk = ETrue;
+        TInt count = aPropertyArray.Count();
+        TInt allCount = allArray.Count();
+        
+        for( TInt i = 0; i < count; i++ )
+            {
+            CCenRepDatabaseProperty* property = aPropertyArray[i];
+            TUint32 name = property->GetName();
+            const TDesC& value = property->GetDesValue();
+            TBool found = EFalse;
+            for( TInt j = 0; j < allCount; j++ )
+                {
+                CCenRepDatabaseProperty* allProperty = allArray[j];
+                if( name == allProperty->GetName() &&
+                    value.Compare( allProperty->GetDesValue() ) == 0 )
+                    {
+                    found = ETrue;
+                    break;
+                    }
+                }
+            if( !found )
+                {
+                aOk = EFalse;
+                break;
+                }
+            }
+        }
+    else
+        {
+        aOk = EFalse;
+        }
+
+    CleanupStack::PopAndDestroy( &allArray );
+    }
+
+// ---------------------------------------------------------------------------
+// Cleanup array of properties.
+// ---------------------------------------------------------------------------
+//
+void CCenRepDatabaseUtil::CleanupPointerArray(  TAny* aPointer )
+	{
+	RIpAppPropArray* array = static_cast<RIpAppPropArray*>( aPointer );
+	array->ResetAndDestroy();
+	}
+    
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/stubs/T_spsettingsengineStub.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,994 @@
+/*
+* Copyright (c)  Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Service Provider Settings API's engine.
+*
+*/
+
+// The entire file is taken from 3.2.3 baseline
+
+#include <centralrepository.h>
+#include <e32property.h>
+#include <FeatMgr.h>
+#include <SettingsInternalCRKeys.h>
+#include <cenrepdatabaseutil.h>
+
+#include "spsettingsengine.h"
+#include "spentry.h"
+#include "spproperty.h"
+#include "spcrkeys.h"
+#include "spdefinitions.h"
+#include "spdefaultvalues.h"
+
+
+#include "spsapilogger.h" // For logging
+
+const TInt KSPPredefinedCount = 2;
+TInt counter( 0 );
+
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CSPSettingsEngine::CSPSettingsEngine()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+void CSPSettingsEngine::ConstructL()
+    {
+    XSPSLOGSTRING( "CSPSettingsEngine::ConstructL() - IN" );
+    
+    iCenRepUtils = CCenRepDatabaseUtil::NewL( KCRUidSPSettings, 
+                                            KSPStartKey,
+                                            KSPColIncrement,         
+                                            KSPColMask, 
+                                            KServiceIdCounter,
+                                            KSPColCount );
+
+    XSPSLOGSTRING( "CSPSettingsEngine::ConstructL() - OUT" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CSPSettingsEngine* CSPSettingsEngine::NewL()
+    {
+    CSPSettingsEngine* self = CSPSettingsEngine::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CSPSettingsEngine* CSPSettingsEngine::NewLC()
+    {
+    CSPSettingsEngine* self = new( ELeave ) CSPSettingsEngine;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CSPSettingsEngine::~CSPSettingsEngine()
+    {
+    XSPSLOGSTRING( "CSPSettingsEngine::~CSPSettingsEngine() - IN" );
+    
+    delete iCenRepUtils;
+
+    XSPSLOGSTRING( "CSPSettingsEngine::~CSPSettingsEngine() - OUT" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Begins transaction in repository.
+// ---------------------------------------------------------------------------
+//
+TInt CSPSettingsEngine::BeginTransactionLC()
+    {
+    XSPSLOGSTRING( "CSPSettingsEngine::BeginTransaction() - IN" );
+
+    iCenRepUtils->BeginTransactionL();
+    
+    XSPSLOGSTRING( "CSPSettingsEngine::BeginTransaction() - OUT" );
+    
+    return KErrNone;
+    
+    }
+
+
+// ---------------------------------------------------------------------------
+// Commits changes in repository.
+// ---------------------------------------------------------------------------
+//
+TInt CSPSettingsEngine::CommitTransaction()
+    {
+    XSPSLOGSTRING( 
+        "CSPSettingsEngine::CommitTransaction() - IN" );
+
+    iCenRepUtils->CommitTransaction();
+    
+    XSPSLOGSTRING( "CSPSettingsEngine::CommitTransaction() - OUT" );
+
+    return KErrNone;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Rollback changes in repository.
+// ---------------------------------------------------------------------------
+//
+void CSPSettingsEngine::RollbackTransaction()
+    {
+    XSPSLOGSTRING( 
+        "CSPSettingsEngine::RollbackTransaction() - IN" );
+
+    iCenRepUtils->RollbackTransaction();
+    
+    XSPSLOGSTRING( "CSPSettingsEngine::RollbackTransaction() - OUT" );
+
+    }
+
+void CSPSettingsEngine::ConvertSpEntryToCenRepArrayL( const CSPEntry& aEntry, 
+                                                     RIpAppPropArray& aArray )
+    {
+    CCenRepDatabaseProperty* property = CCenRepDatabaseProperty::NewLC();
+    
+    property->SetName( EServiceName );
+    property->SetValue( aEntry.GetServiceName() );
+    User::LeaveIfError( aArray.Append( property ) );
+    CleanupStack::Pop( property );
+    
+    TInt count = aEntry.PropertyCount();
+    const RPropertyArray& entryArray = aEntry.GetAllProperties();
+    
+    ConvertSpArrayToCenRepArrayL( entryArray, aArray );
+    }
+    
+void CSPSettingsEngine::ConvertSpArrayToCenRepArrayL( const RPropertyArray& aSpArray,
+                                                      RIpAppPropArray& aCenRepArray )
+    {
+    TInt count = aSpArray.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        CSPProperty* spProperty = aSpArray[i];
+        CCenRepDatabaseProperty* property = CCenRepDatabaseProperty::NewLC();
+        property->SetName( spProperty->GetName() );
+        
+        RBuf value;
+        value.CreateL( KSPMaxDesLength );
+        CleanupClosePushL( value);
+        User::LeaveIfError( spProperty->GetValue( value ) );
+        User::LeaveIfError( property->SetValue( value ) );
+        CleanupStack::PopAndDestroy( &value );
+        
+        User::LeaveIfError( aCenRepArray.Append( property ) );
+        CleanupStack::Pop( property );
+        }
+    }
+    
+void CSPSettingsEngine::CleanupPointerArray(  TAny* aPointer )
+	{
+	RIpAppPropArray* array = static_cast<RIpAppPropArray*>( aPointer );
+	array->ResetAndDestroy();
+	}
+
+// ---------------------------------------------------------------------------
+// Stores new service provider settings entry
+// ---------------------------------------------------------------------------
+//
+void CSPSettingsEngine::AddEntryL( CSPEntry& aEntry )
+    {
+    XSPSLOGSTRING( "CSPSettingsEngine::AddEntryL() - IN" );
+    
+    // check the service name is not empty
+    if( aEntry.GetServiceName().Length() == 0 )
+    	{
+    	User::LeaveIfError( KErrArgument );
+    	}
+
+    // construct RIpAppPropArray
+    RIpAppPropArray array;
+	TCleanupItem cleanup( CSPSettingsEngine::CleanupPointerArray, &array );
+	CleanupStack::PushL( cleanup );
+    
+    ConvertSpEntryToCenRepArrayL( aEntry, array );
+
+    // Create new unique service ID
+    TInt newId = 0;
+    iCenRepUtils->AddEntryL( newId, array );
+    aEntry.SetServiceId( newId );
+    
+    CleanupStack::PopAndDestroy( &array );
+    
+    XSPSLOGSTRING( "CSPSettingsEngine::AddEntryL() - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// Find service provider settings entry by service ID
+// ---------------------------------------------------------------------------
+//
+ TInt CSPSettingsEngine::FindEntryL( TServiceId aServiceId, CSPEntry& aEntry )
+    {
+    XSPSLOGSTRING2( "CSPSettingsEngine::FindEntryL( %d ) - IN", aServiceId );
+    
+    RIpAppPropArray array;
+	TCleanupItem cleanup( CSPSettingsEngine::CleanupPointerArray, &array );
+	CleanupStack::PushL( cleanup );
+
+    TInt err = iCenRepUtils->FindEntryL( aServiceId, array );
+    
+    if( err == KErrNone )
+        {
+        TInt count = array.Count();
+
+        for( TInt i = 0; i < count; i++ )
+            {
+            CCenRepDatabaseProperty* property = array[i];
+            
+            if( property->GetName() == EServiceName )
+                {
+                User::LeaveIfError( aEntry.SetServiceName( property->GetDesValue() ) );
+                }
+            else
+                {
+                CSPProperty* spProperty = CSPProperty::NewLC();
+                User::LeaveIfError( spProperty->SetName( (TServicePropertyName)( property->GetName() )));
+                User::LeaveIfError( spProperty->SetValue( property->GetDesValue() ));
+                
+                User::LeaveIfError( aEntry.AddPropertyL( *spProperty ));
+                CleanupStack::PopAndDestroy( spProperty );
+                }
+            }
+        }
+    CleanupStack::PopAndDestroy( &array );
+    
+    aEntry.SetServiceId( aServiceId );
+    
+    XSPSLOGSTRING2( "CSPSettingsEngine::FindEntryL( %d ) - OUT", aServiceId );
+    
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Update existing service provider settings entry
+// ---------------------------------------------------------------------------
+//
+TInt CSPSettingsEngine::UpdateEntryL( const CSPEntry& aEntry )
+    {
+    XSPSLOGSTRING( "CSPSettingsEngine::UpdateEntry() - IN" );
+
+    TServiceId serviceId( aEntry.GetServiceId() );
+
+    // Leave if there is no service ID 
+    if ( KSPNoId == serviceId || aEntry.GetServiceName().Length() == 0 )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    // construct RIpAppPropArray
+    RIpAppPropArray array;
+	TCleanupItem cleanup( CSPSettingsEngine::CleanupPointerArray, &array );
+	CleanupStack::PushL( cleanup );
+    
+    ConvertSpEntryToCenRepArrayL( aEntry, array );
+
+    TInt err = iCenRepUtils->UpdateEntryL( (TInt) serviceId, array );
+    
+    CleanupStack::PopAndDestroy( &array );
+	
+    XSPSLOGSTRING( "CSPSettingsEngine::UpdateEntry() - OUT" );
+    
+    return err;
+    }
+
+	
+// ---------------------------------------------------------------------------
+// Deletes service provider settings entry by service ID
+// ---------------------------------------------------------------------------
+//
+TInt CSPSettingsEngine::DeleteEntryL( TServiceId aServiceId )
+    {
+    XSPSLOGSTRING2( "CSPSettingsEngine::DeleteEntryL(%d) - IN", aServiceId );
+
+    TInt err = iCenRepUtils->DeleteEntryL( aServiceId );
+    
+    XSPSLOGSTRING2( "CSPSettingsEngine::DeleteEntryL(%d) - OUT", aServiceId );
+    
+    return err;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Search property of service provider settings entry by property name
+// ---------------------------------------------------------------------------
+//
+TInt CSPSettingsEngine::FindPropertyL( TServiceId aServiceId, 
+    								   TServicePropertyName aPropertyName, 
+    								   CSPProperty& aProperty )
+    {
+    XSPSLOGSTRING2( "CSPSettingsEngine::FindPropertyL(%d) - IN", aServiceId );
+
+    CCenRepDatabaseProperty* cenrepProperty = CCenRepDatabaseProperty::NewLC();
+    TInt err = iCenRepUtils->FindPropertyL( aServiceId, aPropertyName, *cenrepProperty );
+    
+    if( err == KErrNone )
+        {
+        User::LeaveIfError( aProperty.SetName( aPropertyName ) );
+        User::LeaveIfError( aProperty.SetValue( cenrepProperty->GetDesValue()));
+        }
+        
+    CleanupStack::PopAndDestroy( cenrepProperty );
+    
+    XSPSLOGSTRING2( "CSPSettingsEngine::FindPropertyL(%d) - OUT", aServiceId );
+    
+/*    if ( !counter )
+        {
+        counter++;
+        }
+    else
+        {
+        err = KErrNone;
+        }*/
+//    err = KErrNone;
+    return err;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Add or update properties of service provider settings entry
+// ---------------------------------------------------------------------------
+//
+TInt CSPSettingsEngine::AddOrUpdatePropertiesL( TServiceId aServiceId,
+												const RPropertyArray& aPropertyArray )
+    {
+    XSPSLOGSTRING2( "CSPSettingsEngine::AddOrUpdatePropertiesL(%d) - IN", aServiceId );
+
+    // construct RIpAppPropArray
+    RIpAppPropArray array;
+	TCleanupItem cleanup( CSPSettingsEngine::CleanupPointerArray, &array );
+	CleanupStack::PushL( cleanup );
+    
+    ConvertSpArrayToCenRepArrayL( aPropertyArray, array );
+    
+    TInt err = iCenRepUtils->AddOrUpdatePropertiesL( aServiceId, array );    
+
+    CleanupStack::PopAndDestroy( &array );
+    
+    XSPSLOGSTRING2( 
+        "CSPSettingsEngine::AddOrUpdatePropertiesL(%d) - OUT", aServiceId );
+        
+    return err;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Returns count of stored service provider settings entries
+// ---------------------------------------------------------------------------
+//
+TInt CSPSettingsEngine::SettingsCountL()
+    {
+    XSPSLOGSTRING( "CSPSettingsEngine::SettingsCount() - IN" );
+
+    TInt result( 0 );
+
+    TInt err = iCenRepUtils->EntryCountL( result );
+    
+    if( err == KErrNone )
+        {
+      
+        if( result >= KSPPredefinedCount )
+            {
+            result--;
+            }
+         
+        err = result;
+        }
+    else
+        {
+        err = 0;
+        }
+    
+    XSPSLOGSTRING2( "CSPSettingsEngine::SettingsCount(%d) - OUT", result );
+
+    return err;
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// Search stored service IDs of service provider settings entries
+// ---------------------------------------------------------------------------
+//
+TInt CSPSettingsEngine::FindServiceIdsL( RIdArray& aServiceIds )
+    {
+    XSPSLOGSTRING( "CSPSettingsEngine::FindServiceIdsL() - IN" );
+
+    RArray<TInt> cenrepArray;
+    CleanupClosePushL( cenrepArray );
+    
+    TInt err = iCenRepUtils->FindEntryIdsL( cenrepArray );
+    
+    for( TInt i = 0; i < cenrepArray.Count(); i++ )
+        {
+        TServiceId id = (TServiceId)cenrepArray[i];
+        if( id != KSPDefaultVoIPServiceId )
+            {
+            User::LeaveIfError( aServiceIds.Append( id ));
+            
+            if ( i > 2 )
+                {
+                aServiceIds.Append( 2 );
+                break;
+                }
+            }
+        }
+
+    CleanupStack::PopAndDestroy( &cenrepArray );
+    
+    XSPSLOGSTRING( "CSPSettingsEngine::FindServiceIdsL() - OUT" );
+    
+    return err;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Search service names by given service IDs
+// ---------------------------------------------------------------------------
+//
+void CSPSettingsEngine::FindServiceNamesL( RIdArray& aServiceIds,
+    CDesCArray& aServiceNames )
+    {
+    XSPSLOGSTRING( "CSPSettingsEngine::FindServiceNamesL() - IN" );
+    
+    CCenRepDatabaseProperty* property = CCenRepDatabaseProperty::NewLC();
+    TInt count = aServiceIds.Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        TInt id = ( TInt )aServiceIds[i];
+        
+        TInt err = iCenRepUtils->FindPropertyL( id, EServiceName, *property );
+        if( err == KErrNone )
+            {
+            aServiceNames.AppendL( property->GetDesValue() );
+            }
+        else
+            {
+            aServiceIds.Remove( i ); // Remove non-existent ID
+            count--;
+            i--; // Do not increment index
+            }
+        }
+
+    CleanupStack::PopAndDestroy( property );
+    
+    XSPSLOGSTRING( "CSPSettingsEngine::FindServiceNamesL() - OUT" );
+    }
+
+void CSPSettingsEngine::PropertyNameArrayFromItemTypeL( TSPItemType aPropertyType, 
+                                                        RPropertyNameArray& aNameArray )
+    {
+    switch ( aPropertyType )
+        {
+        case EItemTypeVoIPSubProperty:
+            {
+            User::LeaveIfError( aNameArray.Append( ESubPropertyVoIPSettingsId ) );
+            User::LeaveIfError( aNameArray.Append( ESubPropertyVoIPPreferredSNAPId ) );
+            User::LeaveIfError( aNameArray.Append( ESubPropertyVoIPPreferredIAPId ) );
+            User::LeaveIfError( aNameArray.Append( ESubPropertyVoIPTemporaryIAPId ) );
+            User::LeaveIfError( aNameArray.Append( ESubPropertyVoIPRelNumber ) );
+            User::LeaveIfError( aNameArray.Append( ESubPropertyVoIPBrandDataUri ) );
+            User::LeaveIfError( aNameArray.Append( ESubPropertyVoIPBrandIconUri ) );
+            User::LeaveIfError( aNameArray.Append( ESubPropertyVoIPAddrScheme ) );
+            User::LeaveIfError( aNameArray.Append( ESubPropertyVoIPEnabled ) );
+            break;
+            }
+        case EItemTypePresenceSubProperty:
+            {
+            User::LeaveIfError( aNameArray.Append( ESubPropertyPresenceSettingsId ) );
+            User::LeaveIfError( aNameArray.Append( ESubPropertyPresencePreferredSNAPId ) );
+            User::LeaveIfError( aNameArray.Append( ESubPropertyPresencePreferredIAPId ) );
+            User::LeaveIfError( aNameArray.Append( ESubPropertyPresencePresentityIDFieldType ) );
+            User::LeaveIfError( aNameArray.Append( ESubPropertyPresenceLaunchMethod ) );
+            User::LeaveIfError( aNameArray.Append( ESubPropertyPresenceLaunchUid ) );
+            User::LeaveIfError( aNameArray.Append( ESubPropertyPresenceAddrScheme ) );
+            User::LeaveIfError( aNameArray.Append( ESubPropertyPresenceEnabled ) );
+            User::LeaveIfError( aNameArray.Append( ESubPropertyPresenceRequestPreference ) );
+            break;
+            }
+        case EItemTypeIMSubProperty:
+            {
+            User::LeaveIfError( aNameArray.Append( ESubPropertyIMSettingsId ) );
+            User::LeaveIfError( aNameArray.Append( ESubPropertyIMPreferredSNAPId ) );
+            User::LeaveIfError( aNameArray.Append( ESubPropertyIMPreferredIAPId ) );
+            User::LeaveIfError( aNameArray.Append( ESubPropertyIMLaunchMethod ) );
+            User::LeaveIfError( aNameArray.Append( ESubPropertyIMLaunchUid ) );
+            User::LeaveIfError( aNameArray.Append( ESubPropertyIMAddrScheme ) );
+            User::LeaveIfError( aNameArray.Append( ESubPropertyIMEnabled ) );
+            break;
+            }
+        case EItemTypeVMBXSubProperty:
+            {
+            User::LeaveIfError( aNameArray.Append( ESubPropertyVMBXSettingsId ) );
+            User::LeaveIfError( aNameArray.Append( ESubPropertyVMBXPreferredSNAPId ) );
+            User::LeaveIfError( aNameArray.Append( ESubPropertyVMBXPreferredIAPId ) );
+            User::LeaveIfError( aNameArray.Append( ESubPropertyVMBXMWISubscribeInterval ) );
+            User::LeaveIfError( aNameArray.Append( ESubPropertyVMBXLaunchMethod ) );
+            User::LeaveIfError( aNameArray.Append( ESubPropertyVMBXLaunchUid ) );
+            User::LeaveIfError( aNameArray.Append( ESubPropertyVMBXListenAddress ) );
+            User::LeaveIfError( aNameArray.Append( ESubPropertyVMBXMWIAddress ) );
+            User::LeaveIfError( aNameArray.Append( ESubPropertyVMBXBrandIconUri ) );
+            User::LeaveIfError( aNameArray.Append( ESubPropertyVMBXAddrScheme ) );
+            User::LeaveIfError( aNameArray.Append( ESubPropertyVMBXListenRegister ) );
+            User::LeaveIfError( aNameArray.Append( ESubPropertyVMBXEnabled ) );
+            break;
+            }
+        default:
+            {
+            User::Leave( KErrArgument );
+            break;
+            }
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+TInt CSPSettingsEngine::FindSubServicePropertiesL( TServiceId aServiceId, 
+	TSPItemType aPropertyType,
+    RPropertyArray& aPropertyArray )
+    {
+    XSPSLOGSTRING2( 
+        "CSPSettingsEngine::FindSubServicePropertiesL( %d ) - IN", aServiceId );
+
+    RPropertyNameArray nameArray;
+    CleanupClosePushL( nameArray );
+    
+    PropertyNameArrayFromItemTypeL( aPropertyType, nameArray );
+    TInt count = nameArray.Count();
+    TInt id = (TInt) aServiceId;
+    
+    CCenRepDatabaseProperty* property = CCenRepDatabaseProperty::NewLC();
+    
+    for( TInt i = 0; i < count; i++ )
+        {
+        TUint32 name = nameArray[i];
+        TInt err = iCenRepUtils->FindPropertyL( id, name, *property );
+        if( err == KErrNone )
+            {
+            CSPProperty* spProperty = CSPProperty::NewLC();
+            User::LeaveIfError( spProperty->SetName( (TServicePropertyName)(property->GetName())) );
+            User::LeaveIfError( spProperty->SetValue( property->GetDesValue() ));
+            
+            User::LeaveIfError( aPropertyArray.Append( spProperty ));
+            CleanupStack::Pop( spProperty );
+            }
+        }
+        
+    CleanupStack::PopAndDestroy( property );
+    CleanupStack::PopAndDestroy( &nameArray );
+    
+    XSPSLOGSTRING( "CSPSettingsEngine::FindSubServicePropertiesL() - OUT" );
+    
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// Deletes service properties
+// ---------------------------------------------------------------------------
+//
+TInt CSPSettingsEngine::DeleteServicePropertiesL( TServiceId aServiceId,
+    											  const RPropertyNameArray& aNameArray  )
+    {
+    XSPSLOGSTRING2( 
+        "CSPSettingsEngine::FindSubServicePropertyL( %d ) - IN", aServiceId );
+
+    RArray<TUint32> nameArray;
+    CleanupClosePushL( nameArray );
+    TInt count = aNameArray.Count();
+    
+    for( TInt i = 0; i < count; i++ )
+        {
+        TUint32 name = (TUint32)( aNameArray[i] );
+        User::LeaveIfError( nameArray.Append( name ) );
+        }
+        
+    TInt id = (TInt)aServiceId;
+    TInt err = iCenRepUtils->DeletePropertiesL( id, nameArray );
+    
+    CleanupStack::PopAndDestroy( &nameArray );
+    
+    XSPSLOGSTRING( "CSPSettingsEngine::FindSubServicePropertyL() - OUT" );
+    
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Find service IDs with same properties
+// ---------------------------------------------------------------------------
+//
+void CSPSettingsEngine::FindServiceIdsFromPropertiesL( const RPropertyArray& aPropertyArray, 
+													   RIdArray& aServiceIds )
+	{
+	XSPSLOGSTRING( "CSPSettingsEngine::FindServiceIdsFromPropertiesL() - IN" );
+	
+    RArray<TInt> entryIds;
+    CleanupClosePushL( entryIds );
+    
+    RIpAppPropArray array;
+	TCleanupItem cleanup( CSPSettingsEngine::CleanupPointerArray, &array );
+	CleanupStack::PushL( cleanup );
+    
+    // todo custom cleanup stack
+    ConvertSpArrayToCenRepArrayL( aPropertyArray, array );  
+    
+    TInt err = iCenRepUtils->FindEntryIdsFromPropertiesL( array, entryIds );
+    if( err == KErrNone )
+        {
+        TInt count = entryIds.Count();
+        for( TInt i = 0; i < count; i++ )
+            {
+            TServiceId id = (TServiceId)entryIds[i];
+            if( id != KSPDefaultVoIPServiceId )
+                {
+                User::LeaveIfError( aServiceIds.Append( id ) );
+                }
+            }
+        }
+        
+    CleanupStack::PopAndDestroy( &array );
+    CleanupStack::PopAndDestroy( &entryIds );
+    
+	XSPSLOGSTRING( "CSPSettingsEngine::FindServiceIdsFromPropertiesL() - OUT" );
+	}
+
+
+
+// ---------------------------------------------------------------------------
+// Check feature is supported or not
+// ---------------------------------------------------------------------------
+//
+TBool CSPSettingsEngine::IsFeatureSupportedL( TSPServiceFeature aFeature,
+                                              TBool aWriteAllowed )
+	{
+    XSPSLOGSTRING( "CSPSettingsEngine::IsFeatureSupportedL() - IN" );
+
+    TBool ret = EFalse;
+    
+	// First check P&S key, if P&S key is defined, use the value from P&S key.
+	// if not defined, then walk through all the sevices and check there is any service match
+	TInt mask = 0;
+	TInt value = 0;
+	TInt psFlag = 0;
+	TInt retProperty = 0;
+	
+    switch( aFeature )
+    	{
+    	case ESupportInternetCallFeature:
+    		{
+    		retProperty = RProperty::Get( KUidSystemCategory, KSPSupportInternetCallKey, psFlag );
+    		if( retProperty == KErrNone && psFlag != KSPInitFeatureValue )
+    			{
+    			ret = psFlag;
+    			}
+    		else
+    			{
+				mask = ESupportsInternetCall | ESupportsAlphanumericAddressing | EIsVisibleInCallMenu;
+				value = mask;
+				ret = CheckFeatureL( mask, value );
+				if ( aWriteAllowed )
+				    {				    
+				    User::LeaveIfError( RProperty::Set( KUidSystemCategory, 
+				        KSPSupportInternetCallKey, ret ) );
+				    }
+    			}
+    		
+    		break;
+    		}
+    	case ESupportCallOutFeature:
+    		{
+    		retProperty = RProperty::Get( KUidSystemCategory, KSPSupportCallOutKey, psFlag );
+    		if( retProperty == KErrNone && psFlag != KSPInitFeatureValue )
+    			{
+    			ret = psFlag;
+    			}
+    		else
+    			{
+				mask = ESupportsInternetCall | ESupportsMSISDNAddressing | EIsVisibleInCallMenu;
+				value = mask;
+				ret = CheckFeatureL( mask, value );
+				if ( aWriteAllowed )
+				    {				    
+    				User::LeaveIfError( RProperty::Set( 
+    				    KUidSystemCategory, 
+    				    KSPSupportCallOutKey, ret ) );
+				    }
+    			}
+    		break;
+    		}
+    	
+    	case ESupportVoIPSSFeature:
+    		{
+    		retProperty = RProperty::Get( KUidSystemCategory, KSPSupportVoIPSSKey, psFlag );
+    		if( retProperty == KErrNone && psFlag != KSPInitFeatureValue )
+    			{
+    			ret = psFlag;
+    			}
+    		else
+    			{
+				mask = ESupportVoIPSS;
+				value = mask;
+				ret = CheckFeatureL( mask, value );
+				if ( aWriteAllowed )
+				    {				    
+    				User::LeaveIfError( RProperty::Set( 
+    				    KUidSystemCategory, 
+    				    KSPSupportVoIPSSKey, ret ) );
+				    }
+    			}
+    		break;
+    		}
+    	
+    	case ESupportVoIPFeature:
+    		{
+    		TBool bFeatureMgr = EFalse;
+    		TBool bDynVoIP = EFalse;
+    		TBool bSubVoIP = EFalse;
+    		
+    		//check FeatureManager
+    		FeatureManager::InitializeLibL();
+    		bFeatureMgr = FeatureManager::FeatureSupported( KFeatureIdCommonVoip );
+    		FeatureManager::UnInitializeLib();
+    		
+    		//check dynamic voip flag
+			CRepository* repository = CRepository::NewLC( KCRUidTelephonySettings );
+			TInt value = 0;
+			TInt err = repository->Get( KDynamicVoIP, value );
+			if( value != 0 )
+				{
+				bDynVoIP = ETrue;
+				}
+			
+			CleanupStack::PopAndDestroy( repository );
+    		
+    		//check subservice voip
+			RIdArray serviceIds;
+			CleanupClosePushL( serviceIds );
+			FindServiceIdsL( serviceIds );
+			CSPProperty* property = CSPProperty::NewLC();
+			
+			for( TInt i = 0; i < serviceIds.Count(); i++ )
+				{
+				TServiceId serviceId = serviceIds[i];
+				TInt retProperty = FindPropertyL( serviceId, EPropertyVoIPSubServicePluginId, *property );
+				if( retProperty == KErrNone )
+					{
+					bSubVoIP = ETrue;
+					break;
+					}
+				}
+			CleanupStack::PopAndDestroy( property );
+			CleanupStack::PopAndDestroy( &serviceIds );
+			
+			ret = bFeatureMgr && bDynVoIP && bSubVoIP;
+			
+    		break;
+    		}
+		default:
+			{
+			User::Leave( KErrNotSupported );    	
+			}
+    	}
+    
+    XSPSLOGSTRING( "CSPSettingsEngine::IsFeatureSupportedL() - OUT" );
+
+    return ret;
+	}
+
+// ---------------------------------------------------------------------------
+// When service table is changed, update the P&S key
+// ---------------------------------------------------------------------------
+//
+void CSPSettingsEngine::UpdateSupportFeaturePSKeyL()
+	{
+	TInt mask = 0;
+	TInt value = 0;
+	TBool ret = EFalse;
+	
+	//ESupportInternetCallFeature
+	//ESupportsInternetCall + ESupportsAlphanumericAddressing + EIsVisibleInCallMenu
+	mask = ESupportsInternetCall | ESupportsAlphanumericAddressing | EIsVisibleInCallMenu;
+	value = mask;
+	ret = CheckFeatureL( mask, value );
+	User::LeaveIfError( RProperty::Set( KUidSystemCategory, KSPSupportInternetCallKey, ret ) );
+	
+	//ESupportCallOutFeature
+	//ESupportsInternetCall + ESupportsMSISDNAddressing + EIsVisibleInCallMenu
+	mask = ESupportsInternetCall | ESupportsMSISDNAddressing | EIsVisibleInCallMenu;
+	value = mask;
+	ret = CheckFeatureL( mask, value );
+	User::LeaveIfError( RProperty::Set( KUidSystemCategory, KSPSupportCallOutKey, ret ) );
+	
+	//ESupportVoIPSSFeature
+	//ESupportVoIPSS
+	mask = ESupportVoIPSS;
+	value = mask;
+	ret = CheckFeatureL( mask, value );
+	User::LeaveIfError( RProperty::Set( KUidSystemCategory, KSPSupportVoIPSSKey, ret ) );
+	}
+
+// ---------------------------------------------------------------------------
+// Walk through all the sevices and check there is any service match 
+// ---------------------------------------------------------------------------
+//
+TBool CSPSettingsEngine::CheckFeatureL( TInt aMask, TInt aValue )
+	{
+	RArray<TInt> entryIds;
+	CleanupClosePushL( entryIds );
+	iCenRepUtils->FindEntryIdsL( entryIds );
+	CCenRepDatabaseProperty* property = CCenRepDatabaseProperty::NewLC();
+	TBool ret = EFalse;
+	
+	for( TInt i = 0; i < entryIds.Count(); i++ )
+		{
+		TInt entryId = entryIds[i];
+		if( entryId == KSPDefaultVoIPServiceId )
+		    {
+		    continue;
+		    }
+		    
+		TInt retProperty = iCenRepUtils->FindPropertyL( entryId, EPropertyServiceAttributeMask, *property );
+		if( retProperty == KErrNone )
+			{
+			TInt maskValue = 0;
+			TInt err = property->GetValue( maskValue );
+			if( err == KErrNone )
+				{
+				if( ( maskValue & aMask ) == (aValue & aMask) )
+					{
+					// Find matched servcie
+					ret = ETrue;
+					break;
+					}
+				}
+			}
+		}
+	
+	CleanupStack::PopAndDestroy( property );
+	CleanupStack::PopAndDestroy( &entryIds );
+	return ret;
+	}
+
+// ---------------------------------------------------------------------------
+// Check if it is VoIP Service ID
+// ---------------------------------------------------------------------------
+//
+TBool CSPSettingsEngine::IsVoIPServiceL( TServiceId aServiceId )
+    {
+    TBool bIsVoIP = EFalse;
+    
+    CSPProperty* property = CSPProperty::NewLC();
+    TInt err = FindPropertyL( aServiceId, EPropertyVoIPSubServicePluginId, *property );
+    if( err == KErrNone )
+        {
+        bIsVoIP = ETrue;
+        }
+    CleanupStack::PopAndDestroy( property );
+    
+    return bIsVoIP;
+    }
+
+// ---------------------------------------------------------------------------
+// Check if an array has call related property name in it
+// ---------------------------------------------------------------------------
+//
+TBool CSPSettingsEngine::HasCallPropertyName( const RPropertyNameArray& aNameArray )
+    {
+    TBool bHasCall = EFalse;
+    
+    for( TInt i = 0; i < aNameArray.Count(); i++ )
+        {
+        TServicePropertyName name = aNameArray[i];
+        if( name == EPropertyCTIPluginId ||
+            name == EPropertyCLIPluginId ||
+            name == EPropertyCallLoggingPluginId ||
+            name == EPropertyCallStateIndicatorPluginId ||
+            name == EPropertyCallMenuHandlerPluginId ||
+            name == EPropertyCallProviderPluginId )
+            {
+            bHasCall = ETrue;
+            break;
+            }
+        }
+    
+    return bHasCall;
+    }
+    
+// ---------------------------------------------------------------------------
+// Check if an array has VoIP or Vmbx related property name in it
+// ---------------------------------------------------------------------------
+//
+TBool CSPSettingsEngine::HasVoIPAndVmbxPropertyName(  const RPropertyNameArray& aNameArray )
+    {
+    TBool bHasVoIPAndVmbx = EFalse;
+    
+    for( TInt i = 0; i < aNameArray.Count(); i++ )
+        {
+        TServicePropertyName name = aNameArray[i];
+        if( name == EPropertyVoIPSubServicePluginId ||
+            name == EPropertyVMBXSubServicePluginId ||
+            name == ESubPropertyVoIPSettingsId ||
+            name == ESubPropertyVoIPPreferredSNAPId ||
+            name == ESubPropertyVoIPPreferredIAPId ||
+            name == ESubPropertyVoIPTemporaryIAPId ||
+            name == ESubPropertyVMBXSettingsId ||
+            name == ESubPropertyVMBXPreferredSNAPId ||
+            name == ESubPropertyVMBXPreferredIAPId ||
+            name == ESubPropertyVMBXMWISubscribeInterval ||
+            name == ESubPropertyVMBXLaunchMethod ||
+            name == ESubPropertyVMBXLaunchUid ||
+            name == ESubPropertyVoIPRelNumber ||
+            name == ESubPropertyVoIPBrandDataUri ||
+            name == ESubPropertyVoIPBrandIconUri ||
+            name == ESubPropertyVoIPAddrScheme ||
+            name == ESubPropertyVMBXListenAddress ||
+            name == ESubPropertyVMBXMWIAddress ||
+            name == ESubPropertyVMBXBrandIconUri ||
+            name == ESubPropertyVMBXAddrScheme ||
+            name == ESubPropertyVoIPEnabled ||
+            name == ESubPropertyVMBXListenRegister ||
+            name == ESubPropertyVMBXEnabled )
+            {
+            bHasVoIPAndVmbx = ETrue;
+            break;
+            }
+        }
+    
+    return bHasVoIPAndVmbx;
+    }
+
+// ---------------------------------------------------------------------------
+// Get Name array from Property array 
+// ---------------------------------------------------------------------------
+//
+void CSPSettingsEngine::NameArrayFromPropertyArrayL( RPropertyNameArray& aNameArray, 
+												const RPropertyArray& aPropertyArray )
+    {
+    aNameArray.Reset();
+    
+    for( TInt i = 0; i < aPropertyArray.Count(); i++ )
+        {
+        CSPProperty* property = aPropertyArray[i];
+        TServicePropertyName name = property->GetName();
+        User::LeaveIfError( aNameArray.Append( name ) );
+        }
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/stubs/TestData.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -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: Definitions for spseettings testing.
+*
+*/
+
+
+// INCLUDES
+#include "TestData.h"
+
+
+TBool TestData::iFeatureIdCsVideoTelephonySupported = ETrue;
+TInt TestData::iCallingServiceByCallType = 1;
+TBool TestData::iCheckSupportedCase = EFalse;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/stubs/TestData.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Declaration of TestData class.
+*
+*/
+
+
+#ifndef TESTDATA_H
+#define TESTDATA_H
+
+// INCLUDES
+#include <e32std.h>
+
+// FORWARD DECLARATIONS
+
+
+// CLASS DECLARATIONS
+
+/**
+ * Virtual Phonebook contact link array.
+ * This interface can be used to handle a read-only array of contact links.
+ */
+class TestData
+    {
+public:
+
+    /**
+     * Constructor.
+     */
+    TestData(){};
+    
+    /**
+     * Destructor.
+     */
+    virtual ~TestData(){};
+
+public: // data
+    
+    static TBool iFeatureIdCsVideoTelephonySupported;
+    static TInt iCallingServiceByCallType;
+    static TBool iCheckSupportedCase;
+    
+    };
+
+#endif // TESTDATA_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/stubs/abclient_stub.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -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:  active backup stub
+*
+*/
+
+#include <abclient.h>
+
+using namespace conn;
+
+CActiveBackupClient* CActiveBackupClient::NewL( MActiveBackupDataClient* )
+    {
+    return new (ELeave) CActiveBackupClient;
+    }
+
+CActiveBackupClient::CActiveBackupClient()
+    {
+    
+    }
+
+CActiveBackupClient::~CActiveBackupClient()
+    {
+    
+    }
+
+TBool CActiveBackupClient::DoesPartialBURAffectMeL()
+    {
+    
+    }
+
+void CActiveBackupClient::ConfirmReadyForBURL( TInt )
+    {
+    
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/stubs/centralrepository_stub.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Cenrep stub
+*
+*/
+
+#include <centralrepository.h>
+
+
+CRepository* CRepository::NewLC( TUid )
+    {
+    CRepository* ret = new (ELeave) CRepository;
+    CleanupStack::PushL( ret );
+    return ret;
+    }
+
+CRepository::~CRepository()
+    {
+    
+    }
+
+TInt CRepository::Reset()
+    {
+    return KErrNone;
+    }
+
+TInt CRepository::Get( TUint32 , TInt& )
+    {
+    return KErrNone;
+    }
+
+TInt CRepository::Set( TUint32 , TInt )
+    {
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/stubs/serviceprovidersettings_stub.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,76 @@
+/*
+* 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:  Service provider settings stub
+*
+*/
+
+#include <spsettings.h>
+#include <spentry.h>
+
+CSPSettings* CSPSettings::NewL()
+    {
+    return new (ELeave) CSPSettings;
+    }
+
+CSPSettings::CSPSettings()
+    {
+    
+    }
+
+CSPSettings::~CSPSettings()
+    {
+    
+    }
+
+TInt CSPSettings::FindServiceIdsL( RArray<TUint>& )
+    {
+    return KErrNone;
+    }
+
+TInt CSPSettings::FindEntryL( TUint, CSPEntry& )
+    {
+    return KErrNone;
+    }
+
+TInt CSPSettings::AddEntryL( CSPEntry& )
+    {
+    return KErrNone;
+    }
+
+CSPEntry* CSPEntry::NewLC()
+    {
+    CSPEntry* ret = new (ELeave) CSPEntry;
+    CleanupStack::PushL( ret );
+    return ret;
+    }
+
+TServiceId CSPEntry::GetServiceId() const
+    {
+    return 0;
+    }
+
+const RPropertyArray& CSPEntry::GetAllProperties() const
+    {
+    return iPropertyArray;
+    }
+
+CSPEntry::CSPEntry()
+    {
+    
+    }
+
+CSPEntry::~CSPEntry()
+    {
+    
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/stubs/spsbackuphelperperformer_stub.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -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:  stub
+*
+*/
+
+#include <e32base.h>
+#include "spsbackuphelperperformer.h"
+
+
+CSpsBackupHelperPerformer* CSpsBackupHelperPerformer::NewL()
+    {
+    return new (ELeave) CSpsBackupHelperPerformer;
+    }
+
+CSpsBackupHelperPerformer::~CSpsBackupHelperPerformer()
+    {
+    
+    }
+
+
+void CSpsBackupHelperPerformer::PerformL()
+    {
+    
+    }
+
+
+CSpsBackupHelperPerformer::CSpsBackupHelperPerformer()
+    {
+    
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedcallengine/spsettings/tsrc/public/basic/spsettingsut/stubs/spsbufferedpublisher_stub.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -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:  stub
+*
+*/
+
+#include <e32base.h>
+#include "spsbufferedpublisher.h"
+
+
+CSpsBufferedPublisher* CSpsBufferedPublisher::NewL( TUid aCat, TUint aKey )
+    {
+    return new (ELeave) CSpsBufferedPublisher( aCat, aKey );
+    }
+
+CSpsBufferedPublisher::~CSpsBufferedPublisher()
+    {
+    
+    }
+
+
+void CSpsBufferedPublisher::SetL( TUid , TUint , TUint32 )
+    {
+    
+    }
+
+
+CSpsBufferedPublisher::CSpsBufferedPublisher( TUid , TUint )
+    {
+    
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/aiwdialdata/bwins/aiwdialdata_2_2u.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,65 @@
+EXPORTS
+	?AllowMatch@CAiwInternalDialData@@QBEHXZ @ 1 NONAME ; int CAiwInternalDialData::AllowMatch(void) const
+	?Bearer@CAiwInternalDialData@@QBEABVTDesC8@@XZ @ 2 NONAME ; class TDesC8 const & CAiwInternalDialData::Bearer(void) const
+	?CallType@CAiwDialData@@QBE?AW4TCallType@1@XZ @ 3 NONAME ; enum CAiwDialData::TCallType CAiwDialData::CallType(void) const
+	?CallType@CAiwDialDataExt@@QBE?AW4TCallType@CAiwDialData@@XZ @ 4 NONAME ; enum CAiwDialData::TCallType CAiwDialDataExt::CallType(void) const
+	?CallType@CAiwInternalDialData@@QBE?AW4TCallType@CAiwDialData@@XZ @ 5 NONAME ; enum CAiwDialData::TCallType CAiwInternalDialData::CallType(void) const
+	?ContactLink@CAiwDialDataExt@@QBEABVTDesC8@@XZ @ 6 NONAME ; class TDesC8 const & CAiwDialDataExt::ContactLink(void) const
+	?ContactLink@CAiwInternalDialData@@QBEABVTDesC8@@XZ @ 7 NONAME ; class TDesC8 const & CAiwInternalDialData::ContactLink(void) const
+	?EndOtherCalls@CAiwInternalDialData@@QBEHXZ @ 8 NONAME ; int CAiwInternalDialData::EndOtherCalls(void) const
+	?FillInParamListL@CAiwDialData@@QAEXAAVCAiwGenericParamList@@@Z @ 9 NONAME ; void CAiwDialData::FillInParamListL(class CAiwGenericParamList &)
+	?FillInParamListL@CAiwDialDataExt@@QAEXAAVCAiwGenericParamList@@@Z @ 10 NONAME ; void CAiwDialDataExt::FillInParamListL(class CAiwGenericParamList &)
+	?FillInParamListL@CAiwInternalDialData@@QAEXAAVCAiwGenericParamList@@@Z @ 11 NONAME ; void CAiwInternalDialData::FillInParamListL(class CAiwGenericParamList &)
+	?InitiateCall@CAiwDialDataExt@@QBEHXZ @ 12 NONAME ; int CAiwDialDataExt::InitiateCall(void) const
+	?InitiateCall@CAiwInternalDialData@@QBEHXZ @ 13 NONAME ; int CAiwInternalDialData::InitiateCall(void) const
+	?Name@CAiwDialDataExt@@QBEABVTDesC16@@XZ @ 14 NONAME ; class TDesC16 const & CAiwDialDataExt::Name(void) const
+	?Name@CAiwInternalDialData@@QBEABVTDesC16@@XZ @ 15 NONAME ; class TDesC16 const & CAiwInternalDialData::Name(void) const
+	?NewL@CAiwDialData@@SAPAV1@XZ @ 16 NONAME ; class CAiwDialData * CAiwDialData::NewL(void)
+	?NewL@CAiwDialDataExt@@SAPAV1@XZ @ 17 NONAME ; class CAiwDialDataExt * CAiwDialDataExt::NewL(void)
+	?NewL@CAiwInternalDialData@@SAPAV1@ABVTDesC8@@@Z @ 18 NONAME ; class CAiwInternalDialData * CAiwInternalDialData::NewL(class TDesC8 const &)
+	?NewL@CAiwInternalDialData@@SAPAV1@XZ @ 19 NONAME ; class CAiwInternalDialData * CAiwInternalDialData::NewL(void)
+	?NewLC@CAiwDialData@@SAPAV1@XZ @ 20 NONAME ; class CAiwDialData * CAiwDialData::NewLC(void)
+	?NewLC@CAiwDialDataExt@@SAPAV1@XZ @ 21 NONAME ; class CAiwDialDataExt * CAiwDialDataExt::NewLC(void)
+	?NewLC@CAiwInternalDialData@@SAPAV1@ABVTDesC8@@@Z @ 22 NONAME ; class CAiwInternalDialData * CAiwInternalDialData::NewLC(class TDesC8 const &)
+	?NewLC@CAiwInternalDialData@@SAPAV1@XZ @ 23 NONAME ; class CAiwInternalDialData * CAiwInternalDialData::NewLC(void)
+	?PhoneNumber@CAiwDialData@@QBEABVTDesC16@@XZ @ 24 NONAME ; class TDesC16 const & CAiwDialData::PhoneNumber(void) const
+	?PhoneNumber@CAiwDialDataExt@@QBEABVTDesC16@@XZ @ 25 NONAME ; class TDesC16 const & CAiwDialDataExt::PhoneNumber(void) const
+	?PhoneNumber@CAiwInternalDialData@@QBEABVTDesC16@@XZ @ 26 NONAME ; class TDesC16 const & CAiwInternalDialData::PhoneNumber(void) const
+	?Redial@CAiwDialDataExt@@QBEHXZ @ 27 NONAME ; int CAiwDialDataExt::Redial(void) const
+	?Redial@CAiwInternalDialData@@QBEHXZ @ 28 NONAME ; int CAiwInternalDialData::Redial(void) const
+	?RedialMaximumDuration@CAiwInternalDialData@@QBE?BVTTimeIntervalSeconds@@XZ @ 29 NONAME ; class TTimeIntervalSeconds const CAiwInternalDialData::RedialMaximumDuration(void) const
+	?SATCall@CAiwInternalDialData@@QBEHXZ @ 30 NONAME ; int CAiwInternalDialData::SATCall(void) const
+	?SetAllowMatch@CAiwInternalDialData@@QAEXH@Z @ 31 NONAME ; void CAiwInternalDialData::SetAllowMatch(int)
+	?SetBearerL@CAiwInternalDialData@@QAEXABVTDesC8@@@Z @ 32 NONAME ; void CAiwInternalDialData::SetBearerL(class TDesC8 const &)
+	?SetCallType@CAiwDialData@@QAEXW4TCallType@1@@Z @ 33 NONAME ; void CAiwDialData::SetCallType(enum CAiwDialData::TCallType)
+	?SetCallType@CAiwDialDataExt@@QAEXW4TCallType@CAiwDialData@@@Z @ 34 NONAME ; void CAiwDialDataExt::SetCallType(enum CAiwDialData::TCallType)
+	?SetCallType@CAiwInternalDialData@@QAEXW4TCallType@CAiwDialData@@@Z @ 35 NONAME ; void CAiwInternalDialData::SetCallType(enum CAiwDialData::TCallType)
+	?SetContactLinkL@CAiwDialDataExt@@QAEXABVTDesC8@@@Z @ 36 NONAME ; void CAiwDialDataExt::SetContactLinkL(class TDesC8 const &)
+	?SetContactLinkL@CAiwInternalDialData@@QAEXABVTDesC8@@@Z @ 37 NONAME ; void CAiwInternalDialData::SetContactLinkL(class TDesC8 const &)
+	?SetEndOtherCalls@CAiwInternalDialData@@QAEXH@Z @ 38 NONAME ; void CAiwInternalDialData::SetEndOtherCalls(int)
+	?SetInitiateCall@CAiwDialDataExt@@QAEXH@Z @ 39 NONAME ; void CAiwDialDataExt::SetInitiateCall(int)
+	?SetInitiateCall@CAiwInternalDialData@@QAEXH@Z @ 40 NONAME ; void CAiwInternalDialData::SetInitiateCall(int)
+	?SetNameL@CAiwDialDataExt@@QAEXABVTDesC16@@@Z @ 41 NONAME ; void CAiwDialDataExt::SetNameL(class TDesC16 const &)
+	?SetNameL@CAiwInternalDialData@@QAEXABVTDesC16@@@Z @ 42 NONAME ; void CAiwInternalDialData::SetNameL(class TDesC16 const &)
+	?SetPhoneNumberL@CAiwDialData@@QAEXABVTDesC16@@@Z @ 43 NONAME ; void CAiwDialData::SetPhoneNumberL(class TDesC16 const &)
+	?SetPhoneNumberL@CAiwDialDataExt@@QAEXABVTDesC16@@@Z @ 44 NONAME ; void CAiwDialDataExt::SetPhoneNumberL(class TDesC16 const &)
+	?SetPhoneNumberL@CAiwInternalDialData@@QAEXABVTDesC16@@@Z @ 45 NONAME ; void CAiwInternalDialData::SetPhoneNumberL(class TDesC16 const &)
+	?SetRedial@CAiwDialDataExt@@QAEXH@Z @ 46 NONAME ; void CAiwDialDataExt::SetRedial(int)
+	?SetRedial@CAiwInternalDialData@@QAEXH@Z @ 47 NONAME ; void CAiwInternalDialData::SetRedial(int)
+	?SetRedialMaximumDuration@CAiwInternalDialData@@QAEXVTTimeIntervalSeconds@@@Z @ 48 NONAME ; void CAiwInternalDialData::SetRedialMaximumDuration(class TTimeIntervalSeconds)
+	?SetSATCall@CAiwInternalDialData@@QAEXH@Z @ 49 NONAME ; void CAiwInternalDialData::SetSATCall(int)
+	?SetShowNumber@CAiwDialDataExt@@QAEXH@Z @ 50 NONAME ; void CAiwDialDataExt::SetShowNumber(int)
+	?SetShowNumber@CAiwInternalDialData@@QAEXH@Z @ 51 NONAME ; void CAiwInternalDialData::SetShowNumber(int)
+	?SetSubAddressL@CAiwInternalDialData@@QAEXABVTDesC16@@@Z @ 52 NONAME ; void CAiwInternalDialData::SetSubAddressL(class TDesC16 const &)
+	?SetWindowGroup@CAiwDialData@@QAEXH@Z @ 53 NONAME ; void CAiwDialData::SetWindowGroup(int)
+	?SetWindowGroup@CAiwDialDataExt@@QAEXH@Z @ 54 NONAME ; void CAiwDialDataExt::SetWindowGroup(int)
+	?SetWindowGroup@CAiwInternalDialData@@QAEXH@Z @ 55 NONAME ; void CAiwInternalDialData::SetWindowGroup(int)
+	?ShowNumber@CAiwDialDataExt@@QBEHXZ @ 56 NONAME ; int CAiwDialDataExt::ShowNumber(void) const
+	?ShowNumber@CAiwInternalDialData@@QBEHXZ @ 57 NONAME ; int CAiwInternalDialData::ShowNumber(void) const
+	?SubAddress@CAiwInternalDialData@@QBEABVTDesC16@@XZ @ 58 NONAME ; class TDesC16 const & CAiwInternalDialData::SubAddress(void) const
+	?WindowGroup@CAiwDialData@@QBEHXZ @ 59 NONAME ; int CAiwDialData::WindowGroup(void) const
+	?WindowGroup@CAiwDialDataExt@@QBEHXZ @ 60 NONAME ; int CAiwDialDataExt::WindowGroup(void) const
+	?WindowGroup@CAiwInternalDialData@@QBEHXZ @ 61 NONAME ; int CAiwInternalDialData::WindowGroup(void) const
+	?ServiceId@CAiwInternalDialData@@QBEKXZ @ 62 NONAME ; unsigned long CAiwInternalDialData::ServiceId(void) const
+	?SetServiceId@CAiwInternalDialData@@QAEXK@Z @ 63 NONAME ; void CAiwInternalDialData::SetServiceId(unsigned long)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/aiwdialdata/bwins/aiwdialdatau.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,69 @@
+EXPORTS
+	?AllowMatch@CAiwInternalDialData@@QBEHXZ @ 1 NONAME ; int CAiwInternalDialData::AllowMatch(void) const
+	?Bearer@CAiwInternalDialData@@QBEABVTDesC8@@XZ @ 2 NONAME ; class TDesC8 const & CAiwInternalDialData::Bearer(void) const
+	?CallType@CAiwDialData@@QBE?AW4TCallType@1@XZ @ 3 NONAME ; enum CAiwDialData::TCallType CAiwDialData::CallType(void) const
+	?CallType@CAiwDialDataExt@@QBE?AW4TCallType@CAiwDialData@@XZ @ 4 NONAME ; enum CAiwDialData::TCallType CAiwDialDataExt::CallType(void) const
+	?CallType@CAiwInternalDialData@@QBE?AW4TCallType@CAiwDialData@@XZ @ 5 NONAME ; enum CAiwDialData::TCallType CAiwInternalDialData::CallType(void) const
+	?ContactLink@CAiwDialDataExt@@QBEABVTDesC8@@XZ @ 6 NONAME ; class TDesC8 const & CAiwDialDataExt::ContactLink(void) const
+	?ContactLink@CAiwInternalDialData@@QBEABVTDesC8@@XZ @ 7 NONAME ; class TDesC8 const & CAiwInternalDialData::ContactLink(void) const
+	?EndOtherCalls@CAiwInternalDialData@@QBEHXZ @ 8 NONAME ; int CAiwInternalDialData::EndOtherCalls(void) const
+	?FillInParamListL@CAiwDialData@@QAEXAAVCAiwGenericParamList@@@Z @ 9 NONAME ; void CAiwDialData::FillInParamListL(class CAiwGenericParamList &)
+	?FillInParamListL@CAiwDialDataExt@@QAEXAAVCAiwGenericParamList@@@Z @ 10 NONAME ; void CAiwDialDataExt::FillInParamListL(class CAiwGenericParamList &)
+	?FillInParamListL@CAiwInternalDialData@@QAEXAAVCAiwGenericParamList@@@Z @ 11 NONAME ; void CAiwInternalDialData::FillInParamListL(class CAiwGenericParamList &)
+	?InitiateCall@CAiwDialDataExt@@QBEHXZ @ 12 NONAME ; int CAiwDialDataExt::InitiateCall(void) const
+	?InitiateCall@CAiwInternalDialData@@QBEHXZ @ 13 NONAME ; int CAiwInternalDialData::InitiateCall(void) const
+	?Name@CAiwDialDataExt@@QBEABVTDesC16@@XZ @ 14 NONAME ; class TDesC16 const & CAiwDialDataExt::Name(void) const
+	?Name@CAiwInternalDialData@@QBEABVTDesC16@@XZ @ 15 NONAME ; class TDesC16 const & CAiwInternalDialData::Name(void) const
+	?NewL@CAiwDialData@@SAPAV1@XZ @ 16 NONAME ; class CAiwDialData * CAiwDialData::NewL(void)
+	?NewL@CAiwDialDataExt@@SAPAV1@XZ @ 17 NONAME ; class CAiwDialDataExt * CAiwDialDataExt::NewL(void)
+	?NewL@CAiwInternalDialData@@SAPAV1@ABVTDesC8@@@Z @ 18 NONAME ; class CAiwInternalDialData * CAiwInternalDialData::NewL(class TDesC8 const &)
+	?NewL@CAiwInternalDialData@@SAPAV1@XZ @ 19 NONAME ; class CAiwInternalDialData * CAiwInternalDialData::NewL(void)
+	?NewLC@CAiwDialData@@SAPAV1@XZ @ 20 NONAME ; class CAiwDialData * CAiwDialData::NewLC(void)
+	?NewLC@CAiwDialDataExt@@SAPAV1@XZ @ 21 NONAME ; class CAiwDialDataExt * CAiwDialDataExt::NewLC(void)
+	?NewLC@CAiwInternalDialData@@SAPAV1@ABVTDesC8@@@Z @ 22 NONAME ; class CAiwInternalDialData * CAiwInternalDialData::NewLC(class TDesC8 const &)
+	?NewLC@CAiwInternalDialData@@SAPAV1@XZ @ 23 NONAME ; class CAiwInternalDialData * CAiwInternalDialData::NewLC(void)
+	?PhoneNumber@CAiwDialData@@QBEABVTDesC16@@XZ @ 24 NONAME ; class TDesC16 const & CAiwDialData::PhoneNumber(void) const
+	?PhoneNumber@CAiwDialDataExt@@QBEABVTDesC16@@XZ @ 25 NONAME ; class TDesC16 const & CAiwDialDataExt::PhoneNumber(void) const
+	?PhoneNumber@CAiwInternalDialData@@QBEABVTDesC16@@XZ @ 26 NONAME ; class TDesC16 const & CAiwInternalDialData::PhoneNumber(void) const
+	?Redial@CAiwDialDataExt@@QBEHXZ @ 27 NONAME ; int CAiwDialDataExt::Redial(void) const
+	?Redial@CAiwInternalDialData@@QBEHXZ @ 28 NONAME ; int CAiwInternalDialData::Redial(void) const
+	?RedialMaximumDuration@CAiwInternalDialData@@QBE?BVTTimeIntervalSeconds@@XZ @ 29 NONAME ; class TTimeIntervalSeconds const CAiwInternalDialData::RedialMaximumDuration(void) const
+	?SATCall@CAiwInternalDialData@@QBEHXZ @ 30 NONAME ; int CAiwInternalDialData::SATCall(void) const
+	?SetAllowMatch@CAiwInternalDialData@@QAEXH@Z @ 31 NONAME ; void CAiwInternalDialData::SetAllowMatch(int)
+	?SetBearerL@CAiwInternalDialData@@QAEXABVTDesC8@@@Z @ 32 NONAME ; void CAiwInternalDialData::SetBearerL(class TDesC8 const &)
+	?SetCallType@CAiwDialData@@QAEXW4TCallType@1@@Z @ 33 NONAME ; void CAiwDialData::SetCallType(enum CAiwDialData::TCallType)
+	?SetCallType@CAiwDialDataExt@@QAEXW4TCallType@CAiwDialData@@@Z @ 34 NONAME ; void CAiwDialDataExt::SetCallType(enum CAiwDialData::TCallType)
+	?SetCallType@CAiwInternalDialData@@QAEXW4TCallType@CAiwDialData@@@Z @ 35 NONAME ; void CAiwInternalDialData::SetCallType(enum CAiwDialData::TCallType)
+	?SetContactLinkL@CAiwDialDataExt@@QAEXABVTDesC8@@@Z @ 36 NONAME ; void CAiwDialDataExt::SetContactLinkL(class TDesC8 const &)
+	?SetContactLinkL@CAiwInternalDialData@@QAEXABVTDesC8@@@Z @ 37 NONAME ; void CAiwInternalDialData::SetContactLinkL(class TDesC8 const &)
+	?SetEndOtherCalls@CAiwInternalDialData@@QAEXH@Z @ 38 NONAME ; void CAiwInternalDialData::SetEndOtherCalls(int)
+	?SetInitiateCall@CAiwDialDataExt@@QAEXH@Z @ 39 NONAME ; void CAiwDialDataExt::SetInitiateCall(int)
+	?SetInitiateCall@CAiwInternalDialData@@QAEXH@Z @ 40 NONAME ; void CAiwInternalDialData::SetInitiateCall(int)
+	?SetNameL@CAiwDialDataExt@@QAEXABVTDesC16@@@Z @ 41 NONAME ; void CAiwDialDataExt::SetNameL(class TDesC16 const &)
+	?SetNameL@CAiwInternalDialData@@QAEXABVTDesC16@@@Z @ 42 NONAME ; void CAiwInternalDialData::SetNameL(class TDesC16 const &)
+	?SetPhoneNumberL@CAiwDialData@@QAEXABVTDesC16@@@Z @ 43 NONAME ; void CAiwDialData::SetPhoneNumberL(class TDesC16 const &)
+	?SetPhoneNumberL@CAiwDialDataExt@@QAEXABVTDesC16@@@Z @ 44 NONAME ; void CAiwDialDataExt::SetPhoneNumberL(class TDesC16 const &)
+	?SetPhoneNumberL@CAiwInternalDialData@@QAEXABVTDesC16@@@Z @ 45 NONAME ; void CAiwInternalDialData::SetPhoneNumberL(class TDesC16 const &)
+	?SetRedial@CAiwDialDataExt@@QAEXH@Z @ 46 NONAME ; void CAiwDialDataExt::SetRedial(int)
+	?SetRedial@CAiwInternalDialData@@QAEXH@Z @ 47 NONAME ; void CAiwInternalDialData::SetRedial(int)
+	?SetRedialMaximumDuration@CAiwInternalDialData@@QAEXVTTimeIntervalSeconds@@@Z @ 48 NONAME ; void CAiwInternalDialData::SetRedialMaximumDuration(class TTimeIntervalSeconds)
+	?SetSATCall@CAiwInternalDialData@@QAEXH@Z @ 49 NONAME ; void CAiwInternalDialData::SetSATCall(int)
+	?SetShowNumber@CAiwDialDataExt@@QAEXH@Z @ 50 NONAME ; void CAiwDialDataExt::SetShowNumber(int)
+	?SetShowNumber@CAiwInternalDialData@@QAEXH@Z @ 51 NONAME ; void CAiwInternalDialData::SetShowNumber(int)
+	?SetSubAddressL@CAiwInternalDialData@@QAEXABVTDesC16@@@Z @ 52 NONAME ; void CAiwInternalDialData::SetSubAddressL(class TDesC16 const &)
+	?SetWindowGroup@CAiwDialData@@QAEXH@Z @ 53 NONAME ; void CAiwDialData::SetWindowGroup(int)
+	?SetWindowGroup@CAiwDialDataExt@@QAEXH@Z @ 54 NONAME ; void CAiwDialDataExt::SetWindowGroup(int)
+	?SetWindowGroup@CAiwInternalDialData@@QAEXH@Z @ 55 NONAME ; void CAiwInternalDialData::SetWindowGroup(int)
+	?ShowNumber@CAiwDialDataExt@@QBEHXZ @ 56 NONAME ; int CAiwDialDataExt::ShowNumber(void) const
+	?ShowNumber@CAiwInternalDialData@@QBEHXZ @ 57 NONAME ; int CAiwInternalDialData::ShowNumber(void) const
+	?SubAddress@CAiwInternalDialData@@QBEABVTDesC16@@XZ @ 58 NONAME ; class TDesC16 const & CAiwInternalDialData::SubAddress(void) const
+	?WindowGroup@CAiwDialData@@QBEHXZ @ 59 NONAME ; int CAiwDialData::WindowGroup(void) const
+	?WindowGroup@CAiwDialDataExt@@QBEHXZ @ 60 NONAME ; int CAiwDialDataExt::WindowGroup(void) const
+	?WindowGroup@CAiwInternalDialData@@QBEHXZ @ 61 NONAME ; int CAiwInternalDialData::WindowGroup(void) const
+	?SetUUIL@CAiwInternalDialData@@QAEXABVTDesC16@@@Z @ 62 NONAME ; void CAiwInternalDialData::SetUUIL(class TDesC16 const &)
+	?UUI@CAiwInternalDialData@@QBEABVTDesC16@@XZ @ 63 NONAME ; class TDesC16 const & CAiwInternalDialData::UUI(void) const
+	?ServiceId@CAiwInternalDialData@@QBEKXZ @ 64 NONAME ; unsigned long CAiwInternalDialData::ServiceId(void) const
+	?SetServiceId@CAiwInternalDialData@@QAEXK@Z @ 65 NONAME ; void CAiwInternalDialData::SetServiceId(unsigned long)
+	?ServiceId@CAiwDialDataExt@@QBEKXZ @ 66 NONAME ; unsigned long CAiwDialDataExt::ServiceId(void) const
+	?SetServiceId@CAiwDialDataExt@@QAEXK@Z @ 67 NONAME ; void CAiwDialDataExt::SetServiceId(unsigned long)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/aiwdialdata/eabi/aiwdialdata_2_2u.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,65 @@
+EXPORTS
+	_ZN12CAiwDialData11SetCallTypeENS_9TCallTypeE @ 1 NONAME
+	_ZN12CAiwDialData14SetWindowGroupEi @ 2 NONAME
+	_ZN12CAiwDialData15SetPhoneNumberLERK7TDesC16 @ 3 NONAME
+	_ZN12CAiwDialData16FillInParamListLER20CAiwGenericParamList @ 4 NONAME
+	_ZN12CAiwDialData4NewLEv @ 5 NONAME
+	_ZN12CAiwDialData5NewLCEv @ 6 NONAME
+	_ZN15CAiwDialDataExt11SetCallTypeEN12CAiwDialData9TCallTypeE @ 7 NONAME
+	_ZN15CAiwDialDataExt14SetWindowGroupEi @ 8 NONAME
+	_ZN15CAiwDialDataExt15SetPhoneNumberLERK7TDesC16 @ 9 NONAME
+	_ZN15CAiwDialDataExt16FillInParamListLER20CAiwGenericParamList @ 10 NONAME
+	_ZN15CAiwDialDataExt4NewLEv @ 11 NONAME
+	_ZN15CAiwDialDataExt5NewLCEv @ 12 NONAME
+	_ZN20CAiwInternalDialData10SetBearerLERK6TDesC8 @ 13 NONAME
+	_ZN20CAiwInternalDialData10SetSATCallEi @ 14 NONAME
+	_ZN20CAiwInternalDialData11SetCallTypeEN12CAiwDialData9TCallTypeE @ 15 NONAME
+	_ZN20CAiwInternalDialData13SetAllowMatchEi @ 16 NONAME
+	_ZN20CAiwInternalDialData13SetShowNumberEi @ 17 NONAME
+	_ZN20CAiwInternalDialData14SetSubAddressLERK7TDesC16 @ 18 NONAME
+	_ZN20CAiwInternalDialData14SetWindowGroupEi @ 19 NONAME
+	_ZN20CAiwInternalDialData15SetContactLinkLERK6TDesC8 @ 20 NONAME
+	_ZN20CAiwInternalDialData15SetInitiateCallEi @ 21 NONAME
+	_ZN20CAiwInternalDialData15SetPhoneNumberLERK7TDesC16 @ 22 NONAME
+	_ZN20CAiwInternalDialData16FillInParamListLER20CAiwGenericParamList @ 23 NONAME
+	_ZN20CAiwInternalDialData16SetEndOtherCallsEi @ 24 NONAME
+	_ZN20CAiwInternalDialData24SetRedialMaximumDurationE20TTimeIntervalSeconds @ 25 NONAME
+	_ZN20CAiwInternalDialData4NewLERK6TDesC8 @ 26 NONAME
+	_ZN20CAiwInternalDialData4NewLEv @ 27 NONAME
+	_ZN20CAiwInternalDialData5NewLCERK6TDesC8 @ 28 NONAME
+	_ZN20CAiwInternalDialData5NewLCEv @ 29 NONAME
+	_ZN20CAiwInternalDialData8SetNameLERK7TDesC16 @ 30 NONAME
+	_ZN20CAiwInternalDialData9SetRedialEi @ 31 NONAME
+	_ZNK12CAiwDialData11PhoneNumberEv @ 32 NONAME
+	_ZNK12CAiwDialData11WindowGroupEv @ 33 NONAME
+	_ZNK12CAiwDialData8CallTypeEv @ 34 NONAME
+	_ZNK15CAiwDialDataExt11PhoneNumberEv @ 35 NONAME
+	_ZNK15CAiwDialDataExt11WindowGroupEv @ 36 NONAME
+	_ZNK15CAiwDialDataExt8CallTypeEv @ 37 NONAME
+	_ZNK20CAiwInternalDialData10AllowMatchEv @ 38 NONAME
+	_ZNK20CAiwInternalDialData10ShowNumberEv @ 39 NONAME
+	_ZNK20CAiwInternalDialData10SubAddressEv @ 40 NONAME
+	_ZNK20CAiwInternalDialData11ContactLinkEv @ 41 NONAME
+	_ZNK20CAiwInternalDialData11PhoneNumberEv @ 42 NONAME
+	_ZNK20CAiwInternalDialData11WindowGroupEv @ 43 NONAME
+	_ZNK20CAiwInternalDialData12InitiateCallEv @ 44 NONAME
+	_ZNK20CAiwInternalDialData13EndOtherCallsEv @ 45 NONAME
+	_ZNK20CAiwInternalDialData21RedialMaximumDurationEv @ 46 NONAME
+	_ZNK20CAiwInternalDialData4NameEv @ 47 NONAME
+	_ZNK20CAiwInternalDialData6BearerEv @ 48 NONAME
+	_ZNK20CAiwInternalDialData6RedialEv @ 49 NONAME
+	_ZNK20CAiwInternalDialData7SATCallEv @ 50 NONAME
+	_ZNK20CAiwInternalDialData8CallTypeEv @ 51 NONAME
+	_ZN15CAiwDialDataExt13SetShowNumberEi @ 52 NONAME
+	_ZN15CAiwDialDataExt15SetContactLinkLERK6TDesC8 @ 53 NONAME
+	_ZN15CAiwDialDataExt15SetInitiateCallEi @ 54 NONAME
+	_ZN15CAiwDialDataExt8SetNameLERK7TDesC16 @ 55 NONAME
+	_ZN15CAiwDialDataExt9SetRedialEi @ 56 NONAME
+	_ZNK15CAiwDialDataExt10ShowNumberEv @ 57 NONAME
+	_ZNK15CAiwDialDataExt11ContactLinkEv @ 58 NONAME
+	_ZNK15CAiwDialDataExt12InitiateCallEv @ 59 NONAME
+	_ZNK15CAiwDialDataExt4NameEv @ 60 NONAME
+	_ZNK15CAiwDialDataExt6RedialEv @ 61 NONAME
+	_ZN20CAiwInternalDialData12SetServiceIdEm @ 62 NONAME
+	_ZNK20CAiwInternalDialData9ServiceIdEv @ 63 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/aiwdialdata/eabi/aiwdialdatau.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,69 @@
+EXPORTS
+	_ZN12CAiwDialData11SetCallTypeENS_9TCallTypeE @ 1 NONAME
+	_ZN12CAiwDialData14SetWindowGroupEi @ 2 NONAME
+	_ZN12CAiwDialData15SetPhoneNumberLERK7TDesC16 @ 3 NONAME
+	_ZN12CAiwDialData16FillInParamListLER20CAiwGenericParamList @ 4 NONAME
+	_ZN12CAiwDialData4NewLEv @ 5 NONAME
+	_ZN12CAiwDialData5NewLCEv @ 6 NONAME
+	_ZN15CAiwDialDataExt11SetCallTypeEN12CAiwDialData9TCallTypeE @ 7 NONAME
+	_ZN15CAiwDialDataExt14SetWindowGroupEi @ 8 NONAME
+	_ZN15CAiwDialDataExt15SetPhoneNumberLERK7TDesC16 @ 9 NONAME
+	_ZN15CAiwDialDataExt16FillInParamListLER20CAiwGenericParamList @ 10 NONAME
+	_ZN15CAiwDialDataExt4NewLEv @ 11 NONAME
+	_ZN15CAiwDialDataExt5NewLCEv @ 12 NONAME
+	_ZN20CAiwInternalDialData10SetBearerLERK6TDesC8 @ 13 NONAME
+	_ZN20CAiwInternalDialData10SetSATCallEi @ 14 NONAME
+	_ZN20CAiwInternalDialData11SetCallTypeEN12CAiwDialData9TCallTypeE @ 15 NONAME
+	_ZN20CAiwInternalDialData13SetAllowMatchEi @ 16 NONAME
+	_ZN20CAiwInternalDialData13SetShowNumberEi @ 17 NONAME
+	_ZN20CAiwInternalDialData14SetSubAddressLERK7TDesC16 @ 18 NONAME
+	_ZN20CAiwInternalDialData14SetWindowGroupEi @ 19 NONAME
+	_ZN20CAiwInternalDialData15SetContactLinkLERK6TDesC8 @ 20 NONAME
+	_ZN20CAiwInternalDialData15SetInitiateCallEi @ 21 NONAME
+	_ZN20CAiwInternalDialData15SetPhoneNumberLERK7TDesC16 @ 22 NONAME
+	_ZN20CAiwInternalDialData16FillInParamListLER20CAiwGenericParamList @ 23 NONAME
+	_ZN20CAiwInternalDialData16SetEndOtherCallsEi @ 24 NONAME
+	_ZN20CAiwInternalDialData24SetRedialMaximumDurationE20TTimeIntervalSeconds @ 25 NONAME
+	_ZN20CAiwInternalDialData4NewLERK6TDesC8 @ 26 NONAME
+	_ZN20CAiwInternalDialData4NewLEv @ 27 NONAME
+	_ZN20CAiwInternalDialData5NewLCERK6TDesC8 @ 28 NONAME
+	_ZN20CAiwInternalDialData5NewLCEv @ 29 NONAME
+	_ZN20CAiwInternalDialData8SetNameLERK7TDesC16 @ 30 NONAME
+	_ZN20CAiwInternalDialData9SetRedialEi @ 31 NONAME
+	_ZNK12CAiwDialData11PhoneNumberEv @ 32 NONAME
+	_ZNK12CAiwDialData11WindowGroupEv @ 33 NONAME
+	_ZNK12CAiwDialData8CallTypeEv @ 34 NONAME
+	_ZNK15CAiwDialDataExt11PhoneNumberEv @ 35 NONAME
+	_ZNK15CAiwDialDataExt11WindowGroupEv @ 36 NONAME
+	_ZNK15CAiwDialDataExt8CallTypeEv @ 37 NONAME
+	_ZNK20CAiwInternalDialData10AllowMatchEv @ 38 NONAME
+	_ZNK20CAiwInternalDialData10ShowNumberEv @ 39 NONAME
+	_ZNK20CAiwInternalDialData10SubAddressEv @ 40 NONAME
+	_ZNK20CAiwInternalDialData11ContactLinkEv @ 41 NONAME
+	_ZNK20CAiwInternalDialData11PhoneNumberEv @ 42 NONAME
+	_ZNK20CAiwInternalDialData11WindowGroupEv @ 43 NONAME
+	_ZNK20CAiwInternalDialData12InitiateCallEv @ 44 NONAME
+	_ZNK20CAiwInternalDialData13EndOtherCallsEv @ 45 NONAME
+	_ZNK20CAiwInternalDialData21RedialMaximumDurationEv @ 46 NONAME
+	_ZNK20CAiwInternalDialData4NameEv @ 47 NONAME
+	_ZNK20CAiwInternalDialData6BearerEv @ 48 NONAME
+	_ZNK20CAiwInternalDialData6RedialEv @ 49 NONAME
+	_ZNK20CAiwInternalDialData7SATCallEv @ 50 NONAME
+	_ZNK20CAiwInternalDialData8CallTypeEv @ 51 NONAME
+	_ZN15CAiwDialDataExt13SetShowNumberEi @ 52 NONAME
+	_ZN15CAiwDialDataExt15SetContactLinkLERK6TDesC8 @ 53 NONAME
+	_ZN15CAiwDialDataExt15SetInitiateCallEi @ 54 NONAME
+	_ZN15CAiwDialDataExt8SetNameLERK7TDesC16 @ 55 NONAME
+	_ZN15CAiwDialDataExt9SetRedialEi @ 56 NONAME
+	_ZNK15CAiwDialDataExt10ShowNumberEv @ 57 NONAME
+	_ZNK15CAiwDialDataExt11ContactLinkEv @ 58 NONAME
+	_ZNK15CAiwDialDataExt12InitiateCallEv @ 59 NONAME
+	_ZNK15CAiwDialDataExt4NameEv @ 60 NONAME
+	_ZNK15CAiwDialDataExt6RedialEv @ 61 NONAME
+	_ZN20CAiwInternalDialData7SetUUILERK7TDesC16 @ 62 NONAME
+	_ZNK20CAiwInternalDialData3UUIEv @ 63 NONAME
+	_ZN20CAiwInternalDialData12SetServiceIdEm @ 64 NONAME
+	_ZNK20CAiwInternalDialData9ServiceIdEv @ 65 NONAME
+	_ZN15CAiwDialDataExt12SetServiceIdEm @ 66 NONAME
+	_ZNK15CAiwDialDataExt9ServiceIdEv @ 67 NONAME
+
Binary file phoneclientserver/aiwdialdata/group/aiwdialdata_stub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/aiwdialdata/tsrc/public/adv/aiwdialtest/bmarm/aiwdialtestu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,4 @@
+EXPORTS
+	LibEntryL__Fv @ 1 NONAME R3UNUSED ; LibEntryL(void)
+	SetRequirements__FRP16CTestModuleParamRUl @ 2 NONAME R3UNUSED ; SetRequirements(CTestModuleParam *&, unsigned long &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/aiwdialdata/tsrc/public/adv/aiwdialtest/bwins/aiwdialtestu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,4 @@
+EXPORTS
+	?LibEntryL@@YAPAVCTestModuleBase@@XZ @ 1 NONAME ; class CTestModuleBase * __cdecl LibEntryL(void)
+	?SetRequirements@@YAHAAPAVCTestModuleParam@@AAK@Z @ 2 NONAME ; int __cdecl SetRequirements(class CTestModuleParam * &,unsigned long &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/aiwdialdata/tsrc/public/adv/aiwdialtest/eabi/aiwdialtestu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,4 @@
+EXPORTS
+	_Z9LibEntryLv @ 1 NONAME
+	_Z15SetRequirementsRP16CTestModuleParamRm @ 2 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/aiwdialdata/tsrc/public/adv/aiwdialtest/group/aiwdialtest_doxyfile.txt	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,222 @@
+# Doxyfile 1.4.1
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME           = aiwdialtest
+PROJECT_NUMBER         = 
+OUTPUT_DIRECTORY       = \aiwdialtest\
+CREATE_SUBDIRS         = NO
+OUTPUT_LANGUAGE        = English
+USE_WINDOWS_ENCODING   = YES
+BRIEF_MEMBER_DESC      = YES
+REPEAT_BRIEF           = YES
+ABBREVIATE_BRIEF       = 
+ALWAYS_DETAILED_SEC    = NO
+INLINE_INHERITED_MEMB  = NO
+FULL_PATH_NAMES        = NO
+STRIP_FROM_PATH        = 
+STRIP_FROM_INC_PATH    = 
+SHORT_NAMES            = NO
+JAVADOC_AUTOBRIEF      = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP         = NO
+INHERIT_DOCS           = YES
+DISTRIBUTE_GROUP_DOC   = NO
+TAB_SIZE               = 8
+ALIASES                = 
+OPTIMIZE_OUTPUT_FOR_C  = YES
+OPTIMIZE_OUTPUT_JAVA   = NO
+SUBGROUPING            = YES
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL            = YES
+EXTRACT_PRIVATE        = NO
+EXTRACT_STATIC         = NO
+EXTRACT_LOCAL_CLASSES  = NO
+EXTRACT_LOCAL_METHODS  = NO
+HIDE_UNDOC_MEMBERS     = NO
+HIDE_UNDOC_CLASSES     = NO
+HIDE_FRIEND_COMPOUNDS  = NO
+HIDE_IN_BODY_DOCS      = NO
+INTERNAL_DOCS          = YES
+CASE_SENSE_NAMES       = YES
+HIDE_SCOPE_NAMES       = NO
+SHOW_INCLUDE_FILES     = YES
+INLINE_INFO            = YES
+SORT_MEMBER_DOCS       = YES
+SORT_BRIEF_DOCS        = NO
+SORT_BY_SCOPE_NAME     = NO
+GENERATE_TODOLIST      = NO
+GENERATE_TESTLIST      = NO
+GENERATE_BUGLIST       = NO
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS       = 
+MAX_INITIALIZER_LINES  = 30
+SHOW_USED_FILES        = YES
+SHOW_DIRECTORIES       = YES
+FILE_VERSION_FILTER    = 
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET                  = NO
+WARNINGS               = YES
+WARN_IF_UNDOCUMENTED   = YES
+WARN_IF_DOC_ERROR      = YES
+WARN_NO_PARAMDOC       = NO
+WARN_FORMAT            = "$file:$line: $text"
+WARN_LOGFILE           = 
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT                  = \aiwdialtest\
+FILE_PATTERNS          = *.h \
+                         *.rh \
+                         *.hrh
+RECURSIVE              = YES
+EXCLUDE                = 
+EXCLUDE_SYMLINKS       = NO
+EXCLUDE_PATTERNS       = 
+EXAMPLE_PATH           = 
+EXAMPLE_PATTERNS       = 
+EXAMPLE_RECURSIVE      = NO
+IMAGE_PATH             = 
+INPUT_FILTER           = 
+FILTER_PATTERNS        = 
+FILTER_SOURCE_FILES    = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER         = NO
+INLINE_SOURCES         = NO
+STRIP_CODE_COMMENTS    = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION    = YES
+VERBATIM_HEADERS       = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX     = NO
+COLS_IN_ALPHA_INDEX    = 5
+IGNORE_PREFIX          = 
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML          = NO
+HTML_OUTPUT            = html
+HTML_FILE_EXTENSION    = .html
+HTML_HEADER            = 
+HTML_FOOTER            = 
+HTML_STYLESHEET        = 
+HTML_ALIGN_MEMBERS     = YES
+GENERATE_HTMLHELP      = YES
+CHM_FILE               = 
+HHC_LOCATION           = 
+GENERATE_CHI           = NO
+BINARY_TOC             = YES
+TOC_EXPAND             = YES
+DISABLE_INDEX          = YES
+ENUM_VALUES_PER_LINE   = 4
+GENERATE_TREEVIEW      = YES
+TREEVIEW_WIDTH         = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX         = NO
+LATEX_OUTPUT           = latex
+LATEX_CMD_NAME         = latex
+MAKEINDEX_CMD_NAME     = makeindex
+COMPACT_LATEX          = NO
+PAPER_TYPE             = a4wide
+EXTRA_PACKAGES         = 
+LATEX_HEADER           = 
+PDF_HYPERLINKS         = NO
+USE_PDFLATEX           = NO
+LATEX_BATCHMODE        = NO
+LATEX_HIDE_INDICES     = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF           = YES
+RTF_OUTPUT             = Doc
+COMPACT_RTF            = YES
+RTF_HYPERLINKS         = YES
+RTF_STYLESHEET_FILE    = 
+RTF_EXTENSIONS_FILE    = 
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN           = NO
+MAN_OUTPUT             = man
+MAN_EXTENSION          = .3
+MAN_LINKS              = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML           = NO
+XML_OUTPUT             = xml
+XML_SCHEMA             = 
+XML_DTD                = 
+XML_PROGRAMLISTING     = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF   = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD       = NO
+PERLMOD_LATEX          = NO
+PERLMOD_PRETTY         = YES
+PERLMOD_MAKEVAR_PREFIX = 
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING   = YES
+MACRO_EXPANSION        = YES
+EXPAND_ONLY_PREDEF     = NO
+SEARCH_INCLUDES        = YES
+INCLUDE_PATH           = 
+INCLUDE_FILE_PATTERNS  = 
+PREDEFINED             = NONSHARABLE_CLASS
+EXPAND_AS_DEFINED      = 
+SKIP_FUNCTION_MACROS   = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+TAGFILES               = 
+GENERATE_TAGFILE       = 
+ALLEXTERNALS           = NO
+EXTERNAL_GROUPS        = YES
+PERL_PATH              = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS         = YES
+HIDE_UNDOC_RELATIONS   = YES
+HAVE_DOT               = NO
+CLASS_GRAPH            = YES
+COLLABORATION_GRAPH    = YES
+GROUP_GRAPHS           = YES
+UML_LOOK               = NO
+TEMPLATE_RELATIONS     = YES
+INCLUDE_GRAPH          = YES
+INCLUDED_BY_GRAPH      = YES
+CALL_GRAPH             = NO
+GRAPHICAL_HIERARCHY    = YES
+DIRECTORY_GRAPH        = YES
+DOT_IMAGE_FORMAT       = png
+DOT_PATH               = 
+DOTFILE_DIRS           = 
+MAX_DOT_GRAPH_WIDTH    = 1024
+MAX_DOT_GRAPH_HEIGHT   = 1024
+MAX_DOT_GRAPH_DEPTH    = 0
+DOT_TRANSPARENT        = NO
+DOT_MULTI_TARGETS      = NO
+GENERATE_LEGEND        = YES
+DOT_CLEANUP            = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine   
+#---------------------------------------------------------------------------
+SEARCHENGINE           = NO
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/aiwdialdata/tsrc/public/adv/aiwdialtest/src/aiwdialtestcases.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,157 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 Caiwdialtest class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32math.h>
+#include <aiwdialdata.h>
+#include <AiwCommon.h>
+#include <AiwServiceHandler.h>
+
+#include "aiwdialtest.h"
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// Caiwdialtest::Case
+// Returns a test case by number.
+//
+// This function contains an array of all available test cases 
+// i.e pair of case name and test function. If case specified by parameter
+// aCaseNumber is found from array, then that item is returned.
+// 
+// The reason for this rather complicated function is to specify all the
+// test cases only in one place. It is not necessary to understand how
+// function pointers to class member functions works when adding new test
+// cases. See function body for instructions how to add new test case.
+// -----------------------------------------------------------------------------
+//
+const TCaseInfo Caiwdialtest::Case ( 
+    const TInt aCaseNumber ) const 
+     {
+
+    /**
+    * To add new test cases, implement new test case function and add new 
+    * line to KCases array specify the name of the case and the function 
+    * doing the test case
+    * In practice, do following
+    * 1) Make copy of existing test case function and change its name
+    *    and functionality. Note that the function must be added to 
+    *    aiwdialtest.cpp file and to aiwdialtest.h 
+    *    header file.
+    *
+    * 2) Add entry to following KCases array either by using:
+    *
+    * 2.1: FUNCENTRY or ENTRY macro
+    * ENTRY macro takes two parameters: test case name and test case 
+    * function name.
+    *
+    * FUNCENTRY macro takes only test case function name as a parameter and
+    * uses that as a test case name and test case function name.
+    *
+    * Or
+    *
+    * 2.2: OOM_FUNCENTRY or OOM_ENTRY macro. Note that these macros are used
+    * only with OOM (Out-Of-Memory) testing!
+    *
+    * OOM_ENTRY macro takes five parameters: test case name, test case 
+    * function name, TBool which specifies is method supposed to be run using
+    * OOM conditions, TInt value for first heap memory allocation failure and 
+    * TInt value for last heap memory allocation failure.
+    * 
+    * OOM_FUNCENTRY macro takes test case function name as a parameter and uses
+    * that as a test case name, TBool which specifies is method supposed to be
+    * run using OOM conditions, TInt value for first heap memory allocation 
+    * failure and TInt value for last heap memory allocation failure. 
+    */ 
+
+    static TCaseInfoInternal const KCases[] =
+        {
+        // To add new test cases, add new items to this array
+        
+        // NOTE: When compiled to GCCE, there must be Classname::
+        // declaration in front of the method name, e.g. 
+        // Caiwdialtest::PrintTest. Otherwise the compiler
+        // gives errors.
+        
+        FUNCENTRY( Caiwdialtest::DialTestL ),
+        // Example how to use OOM functionality
+        //OOM_ENTRY( "Loop test with OOM", Caiwdialtest::LoopTest, ETrue, 2, 3),
+        //OOM_FUNCENTRY( Caiwdialtest::PrintTest, ETrue, 1, 3 ),
+        };
+
+    // Verify that case number is valid
+    if( (TUint) aCaseNumber >= sizeof( KCases ) / 
+                               sizeof( TCaseInfoInternal ) )
+        {
+        // Invalid case, construct empty object
+        TCaseInfo null( (const TText*) L"" );
+        null.iMethod = NULL;
+        null.iIsOOMTest = EFalse;
+        null.iFirstMemoryAllocation = 0;
+        null.iLastMemoryAllocation = 0;
+        return null;
+        } 
+
+    // Construct TCaseInfo object and return it
+    TCaseInfo tmp ( KCases[ aCaseNumber ].iCaseName );
+    tmp.iMethod = KCases[ aCaseNumber ].iMethod;
+    tmp.iIsOOMTest = KCases[ aCaseNumber ].iIsOOMTest;
+    tmp.iFirstMemoryAllocation = KCases[ aCaseNumber ].iFirstMemoryAllocation;
+    tmp.iLastMemoryAllocation = KCases[ aCaseNumber ].iLastMemoryAllocation;
+    return tmp;
+
+    }
+
+// -----------------------------------------------------------------------------
+//  Test dialing a call.
+// -----------------------------------------------------------------------------
+//
+TInt Caiwdialtest::DialTestL( TTestResult& /*aResult*/ ) 
+    {
+    CAiwDialData* dialData = CAiwDialData::NewLC();
+    dialData->SetPhoneNumberL( *iPhoneNumber );
+    
+    CAiwGenericParamList* list = CAiwGenericParamList::NewLC();
+    dialData->FillInParamListL( *list );
+    
+    CActiveScheduler* scheduler = new( ELeave )CActiveScheduler();
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+   
+    
+    RCriteriaArray criterias;
+    _LIT8( KContentType, "*" );
+    CAiwCriteriaItem* criteria = CAiwCriteriaItem::NewLC( KAiwCmdCall, KAiwCmdCall, KContentType );
+    TUid uid;
+	uid.iUid = KAiwClassBase;
+	criteria->SetServiceClass( uid );
+    criterias.AppendL( criteria );
+    CleanupClose<RCriteriaArray>::PushL( criterias );
+    
+    CAiwServiceHandler* service = CAiwServiceHandler::NewLC();
+    service->AttachL( criterias );
+    service->ExecuteServiceCmdL( KAiwCmdCall, *list, service->OutParamListL() );
+    
+    CleanupStack::PopAndDestroy( 6, dialData );
+    return KErrNone;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/aiwdialdata/tsrc/public/adv/group/readme.txt	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,2 @@
+aiwdialtest folder contains test for making a call using AIW Dial API.
+init\aiwdialtest.ini can be used to configure the phonenumber where the aiwdialtest makes the call.
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/aiwdialdata/tsrc/public/basic/aiwdialdatatests/bmarm/aiwdialdatatestsu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,4 @@
+EXPORTS
+	LibEntryL__Fv @ 1 NONAME R3UNUSED ; LibEntryL(void)
+	SetRequirements__FRP16CTestModuleParamRUl @ 2 NONAME R3UNUSED ; SetRequirements(CTestModuleParam *&, unsigned long &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/aiwdialdata/tsrc/public/basic/aiwdialdatatests/bwins/aiwdialdatatestsu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,4 @@
+EXPORTS
+	?LibEntryL@@YAPAVCTestModuleBase@@XZ @ 1 NONAME ; class CTestModuleBase * __cdecl LibEntryL(void)
+	?SetRequirements@@YAHAAPAVCTestModuleParam@@AAK@Z @ 2 NONAME ; int __cdecl SetRequirements(class CTestModuleParam * &,unsigned long &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/aiwdialdata/tsrc/public/basic/aiwdialdatatests/eabi/aiwdialdatatestsu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,4 @@
+EXPORTS
+	_Z9LibEntryLv @ 1 NONAME
+	_Z15SetRequirementsRP16CTestModuleParamRm @ 2 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/aiwdialdata/tsrc/public/basic/aiwdialdatatests/group/aiwdialdatatests.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 AiwDialDataTests component.
+*
+*/
+
+
+#if defined(__S60_)
+        // To get the OS_LAYER_SYSTEMINCLUDE-definition
+        #include <platform_paths.hrh>      
+#endif
+
+TARGET          AiwDialDataTests.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E7
+
+CAPABILITY      ALL -TCB
+
+
+DEFFILE         AiwDialDataTests.def
+
+SOURCEPATH      ../src
+SOURCE          AiwDialDataTests.cpp
+SOURCE          AiwDialDataTestsCases.cpp
+
+USERINCLUDE     ../inc 
+
+OS_LAYER_SYSTEMINCLUDE
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         ServiceHandler.lib
+LIBRARY         aiwdialdata.lib
+
+LANG            SC
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/aiwdialdata/tsrc/public/basic/aiwdialdatatests/group/aiwdialdatatests.pkg	Wed Jul 21 18:26:52 2010 +0300
@@ -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: 
+;
+;File: SendUIAPITest.pkg;
+;
+;Auto-generated PKG file by Nokia PKG Wizard for CodeWarrior IDE
+
+;*Languages
+&EN
+;
+;*Standard SIS file header. This section specifies the package name,
+;application UID, and version/build numbers. Add the package TYPE here if needed.
+#{"aiwdialdatatests"},(0x101FB3E7),1,0,1;
+;
+
+;*Unique (Non-Localized) Vendor name
+;This is used in combination with signing to prevent the unauthroized
+;upgrade of a a package by someone other than the rightful vendor.
+:"Nokia"
+
+;*Localized Vendor Name
+;This specifies the localized vendor name(s) corresponding to language(s).
+%{"Nokia Test EN"}
+
+;*Files To Copy...<src> <destination>
+"\epoc32\release\armv5\urel\AiwDialDataTests.dll"-"C:\sys\bin\AiwDialDataTests.dll"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/aiwdialdata/tsrc/public/basic/aiwdialdatatests/group/aiwdialdatatests_doxyfile.txt	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,222 @@
+# Doxyfile 1.4.1
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME           = AiwDialDataTests
+PROJECT_NUMBER         = 
+OUTPUT_DIRECTORY       = \AiwDialDataTests\
+CREATE_SUBDIRS         = NO
+OUTPUT_LANGUAGE        = English
+USE_WINDOWS_ENCODING   = YES
+BRIEF_MEMBER_DESC      = YES
+REPEAT_BRIEF           = YES
+ABBREVIATE_BRIEF       = 
+ALWAYS_DETAILED_SEC    = NO
+INLINE_INHERITED_MEMB  = NO
+FULL_PATH_NAMES        = NO
+STRIP_FROM_PATH        = 
+STRIP_FROM_INC_PATH    = 
+SHORT_NAMES            = NO
+JAVADOC_AUTOBRIEF      = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP         = NO
+INHERIT_DOCS           = YES
+DISTRIBUTE_GROUP_DOC   = NO
+TAB_SIZE               = 8
+ALIASES                = 
+OPTIMIZE_OUTPUT_FOR_C  = YES
+OPTIMIZE_OUTPUT_JAVA   = NO
+SUBGROUPING            = YES
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL            = YES
+EXTRACT_PRIVATE        = NO
+EXTRACT_STATIC         = NO
+EXTRACT_LOCAL_CLASSES  = NO
+EXTRACT_LOCAL_METHODS  = NO
+HIDE_UNDOC_MEMBERS     = NO
+HIDE_UNDOC_CLASSES     = NO
+HIDE_FRIEND_COMPOUNDS  = NO
+HIDE_IN_BODY_DOCS      = NO
+INTERNAL_DOCS          = YES
+CASE_SENSE_NAMES       = YES
+HIDE_SCOPE_NAMES       = NO
+SHOW_INCLUDE_FILES     = YES
+INLINE_INFO            = YES
+SORT_MEMBER_DOCS       = YES
+SORT_BRIEF_DOCS        = NO
+SORT_BY_SCOPE_NAME     = NO
+GENERATE_TODOLIST      = NO
+GENERATE_TESTLIST      = NO
+GENERATE_BUGLIST       = NO
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS       = 
+MAX_INITIALIZER_LINES  = 30
+SHOW_USED_FILES        = YES
+SHOW_DIRECTORIES       = YES
+FILE_VERSION_FILTER    = 
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET                  = NO
+WARNINGS               = YES
+WARN_IF_UNDOCUMENTED   = YES
+WARN_IF_DOC_ERROR      = YES
+WARN_NO_PARAMDOC       = NO
+WARN_FORMAT            = "$file:$line: $text"
+WARN_LOGFILE           = 
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT                  = \AiwDialDataTests\
+FILE_PATTERNS          = *.h \
+                         *.rh \
+                         *.hrh
+RECURSIVE              = YES
+EXCLUDE                = 
+EXCLUDE_SYMLINKS       = NO
+EXCLUDE_PATTERNS       = 
+EXAMPLE_PATH           = 
+EXAMPLE_PATTERNS       = 
+EXAMPLE_RECURSIVE      = NO
+IMAGE_PATH             = 
+INPUT_FILTER           = 
+FILTER_PATTERNS        = 
+FILTER_SOURCE_FILES    = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER         = NO
+INLINE_SOURCES         = NO
+STRIP_CODE_COMMENTS    = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION    = YES
+VERBATIM_HEADERS       = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX     = NO
+COLS_IN_ALPHA_INDEX    = 5
+IGNORE_PREFIX          = 
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML          = NO
+HTML_OUTPUT            = html
+HTML_FILE_EXTENSION    = .html
+HTML_HEADER            = 
+HTML_FOOTER            = 
+HTML_STYLESHEET        = 
+HTML_ALIGN_MEMBERS     = YES
+GENERATE_HTMLHELP      = YES
+CHM_FILE               = 
+HHC_LOCATION           = 
+GENERATE_CHI           = NO
+BINARY_TOC             = YES
+TOC_EXPAND             = YES
+DISABLE_INDEX          = YES
+ENUM_VALUES_PER_LINE   = 4
+GENERATE_TREEVIEW      = YES
+TREEVIEW_WIDTH         = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX         = NO
+LATEX_OUTPUT           = latex
+LATEX_CMD_NAME         = latex
+MAKEINDEX_CMD_NAME     = makeindex
+COMPACT_LATEX          = NO
+PAPER_TYPE             = a4wide
+EXTRA_PACKAGES         = 
+LATEX_HEADER           = 
+PDF_HYPERLINKS         = NO
+USE_PDFLATEX           = NO
+LATEX_BATCHMODE        = NO
+LATEX_HIDE_INDICES     = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF           = YES
+RTF_OUTPUT             = Doc
+COMPACT_RTF            = YES
+RTF_HYPERLINKS         = YES
+RTF_STYLESHEET_FILE    = 
+RTF_EXTENSIONS_FILE    = 
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN           = NO
+MAN_OUTPUT             = man
+MAN_EXTENSION          = .3
+MAN_LINKS              = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML           = NO
+XML_OUTPUT             = xml
+XML_SCHEMA             = 
+XML_DTD                = 
+XML_PROGRAMLISTING     = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF   = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD       = NO
+PERLMOD_LATEX          = NO
+PERLMOD_PRETTY         = YES
+PERLMOD_MAKEVAR_PREFIX = 
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING   = YES
+MACRO_EXPANSION        = YES
+EXPAND_ONLY_PREDEF     = NO
+SEARCH_INCLUDES        = YES
+INCLUDE_PATH           = 
+INCLUDE_FILE_PATTERNS  = 
+PREDEFINED             = NONSHARABLE_CLASS
+EXPAND_AS_DEFINED      = 
+SKIP_FUNCTION_MACROS   = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+TAGFILES               = 
+GENERATE_TAGFILE       = 
+ALLEXTERNALS           = NO
+EXTERNAL_GROUPS        = YES
+PERL_PATH              = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS         = YES
+HIDE_UNDOC_RELATIONS   = YES
+HAVE_DOT               = NO
+CLASS_GRAPH            = YES
+COLLABORATION_GRAPH    = YES
+GROUP_GRAPHS           = YES
+UML_LOOK               = NO
+TEMPLATE_RELATIONS     = YES
+INCLUDE_GRAPH          = YES
+INCLUDED_BY_GRAPH      = YES
+CALL_GRAPH             = NO
+GRAPHICAL_HIERARCHY    = YES
+DIRECTORY_GRAPH        = YES
+DOT_IMAGE_FORMAT       = png
+DOT_PATH               = 
+DOTFILE_DIRS           = 
+MAX_DOT_GRAPH_WIDTH    = 1024
+MAX_DOT_GRAPH_HEIGHT   = 1024
+MAX_DOT_GRAPH_DEPTH    = 0
+DOT_TRANSPARENT        = NO
+DOT_MULTI_TARGETS      = NO
+GENERATE_LEGEND        = YES
+DOT_CLEANUP            = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine   
+#---------------------------------------------------------------------------
+SEARCHENGINE           = NO
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/aiwdialdata/tsrc/public/basic/aiwdialdatatests/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 file for AiwDialDataTests component.
+*
+*/
+
+
+
+PRJ_PLATFORMS
+// specify the platforms your component needs to be built for here
+// defaults to WINS MARM so you can ignore this if you just build these
+DEFAULT
+
+PRJ_TESTEXPORTS
+// NOTE: If using ARS requirements all export operations should be done under this.
+// 'abld test export'
+
+PRJ_EXPORTS
+// Specify the source file followed by its destination here
+// copy will be used to copy the source file to its destination
+// If there's no destination then the source file will be copied
+// to the same name in /epoc32/include
+// Example: 
+/*
+/agnmodel/inc/AGMCOMON.H
+*/
+
+PRJ_TESTMMPFILES
+// NOTE: If using ARS requirements .mmp file operation should be done under this.
+// 'abld test build'
+AiwDialDataTests.mmp
+
+PRJ_MMPFILES
+// Specify the .mmp files required for building the important component
+// releasables.
+//
+// Specify "tidy" if the component you need to build doesn't need to be
+// released. Specify "ignore" if the MMP file exists but should be
+// ignored.
+// Example:
+/*
+/agnmodel/group/agnmodel.mmp
+#if defined(MARM)
+/agnmodel/group/agsvexe.mmp
+#endif
+*/
+
+
+//  End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/aiwdialdata/tsrc/public/basic/aiwdialdatatests/inc/aiwdialdatatests.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,273 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  AiwDialDataTests test module.
+*
+*/
+
+
+
+#ifndef AIWDIALDATATESTS_H
+#define AIWDIALDATATESTS_H
+
+// INCLUDES
+#include "StifTestModule.h"
+#include <StifLogger.h>
+
+
+// Logging path
+_LIT( KAiwDialDataTestsLogPath, "\\logs\\testframework\\AiwDialDataTests\\" ); 
+// Log file
+_LIT( KAiwDialDataTestsLogFile, "AiwDialDataTests.txt" ); 
+
+
+#define GETPTR &
+#define ENTRY(str,func) {_S(str), GETPTR func,0,0,0}
+#define FUNCENTRY(func) {_S(#func), GETPTR func,0,0,0}
+#define OOM_ENTRY(str,func,a,b,c) {_S(str), GETPTR func,a,b,c}
+#define OOM_FUNCENTRY(func,a,b,c) {_S(#func), GETPTR func,a,b,c}
+
+// FORWARD DECLARATIONS
+class CAiwDialDataTests;
+
+// DATA TYPES
+
+typedef TInt (CAiwDialDataTests::* TestFunction)(TTestResult&);
+
+// CLASS DECLARATION
+
+/**
+*  An internal structure containing a test case name and
+*  the pointer to function doing the test
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+class TCaseInfoInternal
+    {
+    public:
+        const TText*    iCaseName;
+        TestFunction    iMethod;
+        TBool           iIsOOMTest;
+        TInt            iFirstMemoryAllocation;
+        TInt            iLastMemoryAllocation;
+    };
+
+// CLASS DECLARATION
+
+/**
+*  A structure containing a test case name and
+*  the pointer to function doing the test
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+class TCaseInfo
+    {
+    public:
+        TPtrC iCaseName;
+        TestFunction iMethod;
+        TBool           iIsOOMTest;
+        TInt            iFirstMemoryAllocation;
+        TInt            iLastMemoryAllocation;
+
+    TCaseInfo( const TText* a ) : iCaseName( (TText*) a )
+        {
+        };
+
+    };
+
+
+// CLASS DECLARATION
+
+/**
+*  This a AiwDialDataTests class.
+*  ?other_description_lines
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+NONSHARABLE_CLASS(CAiwDialDataTests) : public CTestModuleBase
+    {
+    public:  // Constructors and destructor
+
+
+        /**
+        * Two-phased constructor.
+        */
+        static CAiwDialDataTests* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CAiwDialDataTests();
+
+    public: // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    public: // Functions from base classes
+
+        /**
+        * From CTestModuleBase InitL is used to initialize the 
+        *       AiwDialDataTests. It is called once for every instance of 
+        *       TestModuleAiwDialDataTests after its creation.
+        * @since ?Series60_version
+        * @param aIniFile Initialization file for the test module (optional)
+        * @param aFirstTime Flag is true when InitL is executed for first 
+        *               created instance of AiwDialDataTests.
+        * @return Symbian OS error code
+        */
+        TInt InitL( TFileName& aIniFile, TBool aFirstTime );
+
+        /**
+        * From CTestModuleBase GetTestCasesL is used to inquiry test cases 
+        *   from AiwDialDataTests. 
+        * @since ?Series60_version
+        * @param aTestCaseFile Test case file (optional)
+        * @param aTestCases  Array of TestCases returned to test framework
+        * @return Symbian OS error code
+        */
+        TInt GetTestCasesL( const TFileName& aTestCaseFile, 
+                            RPointerArray<TTestCaseInfo>& aTestCases );
+
+        /**
+        * From CTestModuleBase RunTestCaseL is used to run an individual 
+        *   test case. 
+        * @since ?Series60_version
+        * @param aCaseNumber Test case number
+        * @param aTestCaseFile Test case file (optional)
+        * @param aResult Test case result returned to test framework (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error, which is 
+        *           not reported in aResult parameter as test case failure).
+        */   
+        TInt RunTestCaseL( const TInt aCaseNumber, 
+                           const TFileName& aTestCaseFile,
+                           TTestResult& aResult );
+
+        /**
+        * From CTestModuleBase; OOMTestQueryL is used to specify is particular
+        * test case going to be executed using OOM conditions
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @param aFailureType OOM failure type (optional)
+        * @param aFirstMemFailure The first heap memory allocation failure value (optional)
+        * @param aLastMemFailure The last heap memory allocation failure value (optional)
+        * @return TBool
+        */
+        virtual TBool OOMTestQueryL( const TFileName& /* aTestCaseFile */, 
+                                     const TInt /* aCaseNumber */, 
+                                     TOOMFailureType& aFailureType, 
+                                     TInt& /* aFirstMemFailure */, 
+                                     TInt& /* aLastMemFailure */ );
+
+        /**
+        * From CTestModuleBase; OOMTestInitializeL may be used to initialize OOM
+        * test environment
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @return None
+        */
+        virtual void OOMTestInitializeL( const TFileName& /* aTestCaseFile */, 
+                                    const TInt /* aCaseNumber */ ); 
+
+        /**
+        * From CTestModuleBase; OOMHandleWarningL
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @param aFailNextValue FailNextValue for OOM test execution (optional)
+        * @return None
+        *
+        * User may add implementation for OOM test warning handling. Usually no
+        * implementation is required.           
+        */
+        virtual void OOMHandleWarningL( const TFileName& /* aTestCaseFile */,
+                                        const TInt /* aCaseNumber */, 
+                                        TInt& /* aFailNextValue */); 
+
+        /**
+        * From CTestModuleBase; OOMTestFinalizeL may be used to finalize OOM
+        * test environment
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @return None
+        *
+        */
+        virtual void OOMTestFinalizeL( const TFileName& /* aTestCaseFile */, 
+                                       const TInt /* aCaseNumber */ );
+
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CAiwDialDataTests();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Function returning test case name and pointer to test case function.
+        * @since ?Series60_version
+        * @param aCaseNumber test case number
+        * @return TCaseInfo 
+        */
+        const TCaseInfo Case ( const TInt aCaseNumber ) const;
+
+        /**
+        * Actual Hardcoded test case functions are listed below.
+        */
+
+        /**
+         * Tests CAiwDialData construction.
+         **/
+        TInt ConstructionTestL( TTestResult& aResult );
+        
+        /**
+         * Tests CAiwDialData setting and getting values.
+         */
+        TInt SetAndGetTestL( TTestResult& aResult );
+        
+        /**
+         * Tests CAiwDialDataExt construction.
+         */
+        TInt ExtConstructionTestL( TTestResult& aResult );
+        
+        /**
+         * Tests CAiwDialDataExt setting and getting values.
+         */
+        TInt ExtSetAndGetTestL( TTestResult& aResult );
+
+
+    private:    // Data
+        // Pointer to test (function) to be executed
+        TestFunction iMethod;
+
+        // Pointer to logger
+        CStifLogger * iLog; 
+
+
+    };
+
+#endif      // AIWDIALDATATESTS_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/aiwdialdata/tsrc/public/basic/aiwdialdatatests/src/aiwdialdatatests.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,314 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  AiwDialDataTests class member functions
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <Stiftestinterface.h>
+#include "AiwDialDataTests.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAiwDialDataTests::CAiwDialDataTests
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CAiwDialDataTests::CAiwDialDataTests()
+    {
+
+    }
+
+// -----------------------------------------------------------------------------
+// CAiwDialDataTests::ConstructL
+// Symbian 2nd phase constructor can leave.
+//
+// Note: If OOM test case uses STIF Logger, then STIF Logger must be created
+// with static buffer size parameter (aStaticBufferSize). Otherwise Logger 
+// allocates memory from heap and therefore causes error situations with OOM 
+// testing. For more information about STIF Logger construction, see STIF Users 
+// Guide.
+// -----------------------------------------------------------------------------
+//
+void CAiwDialDataTests::ConstructL()
+    {
+    iLog = CStifLogger::NewL( KAiwDialDataTestsLogPath, 
+                          KAiwDialDataTestsLogFile);
+
+    // Sample how to use logging
+    _LIT( KLogStart, "AiwDialDataTests logging starts!" );
+    iLog->Log( KLogStart );
+
+    }
+
+// -----------------------------------------------------------------------------
+// CAiwDialDataTests::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CAiwDialDataTests* CAiwDialDataTests::NewL()
+    {
+    CAiwDialDataTests* self = new (ELeave) CAiwDialDataTests;
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+
+    }
+
+// Destructor
+CAiwDialDataTests::~CAiwDialDataTests()
+    {
+    delete iLog;
+    }
+
+// -----------------------------------------------------------------------------
+// CAiwDialDataTests::InitL
+// InitL is used to initialize the Test Module.
+// -----------------------------------------------------------------------------
+//
+TInt CAiwDialDataTests::InitL( 
+    TFileName& /*aIniFile*/, 
+    TBool /*aFirstTime*/ )
+    {
+    return KErrNone;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CAiwDialDataTests::GetTestCasesL
+// GetTestCases is used to inquire test cases from the Test Module. Test
+// cases are stored to array of test cases. The Test Framework will be 
+// the owner of the data in the RPointerArray after GetTestCases return
+// and it does the memory deallocation. 
+// -----------------------------------------------------------------------------
+//
+TInt CAiwDialDataTests::GetTestCasesL( 
+    const TFileName& /*aConfig*/, 
+    RPointerArray<TTestCaseInfo>& aTestCases )
+    {
+
+    // Loop through all test cases and create new
+    // TTestCaseInfo items and append items to aTestCase array    
+    for( TInt i = 0; Case(i).iMethod != NULL; i++ )
+        {
+
+        // Allocate new TTestCaseInfo from heap for a testcase definition.
+        TTestCaseInfo* newCase = new( ELeave ) TTestCaseInfo();
+
+        // PushL TTestCaseInfo to CleanupStack.    
+        CleanupStack::PushL( newCase );
+
+        // Set number for the testcase.
+        // When the testcase is run, this comes as a parameter to RunTestCaseL.
+        newCase->iCaseNumber = i;
+
+        // Set title for the test case. This is shown in UI to user.
+        newCase->iTitle.Copy( Case(i).iCaseName );
+
+        // Append TTestCaseInfo to the testcase array. After appended 
+        // successfully the TTestCaseInfo object is owned (and freed) 
+        // by the TestServer. 
+        User::LeaveIfError(aTestCases.Append ( newCase ) );
+
+        // Pop TTestCaseInfo from the CleanupStack.
+        CleanupStack::Pop( newCase );
+
+        }
+
+    return KErrNone;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CAiwDialDataTests::RunTestCaseL
+// RunTestCaseL is used to run an individual test case specified 
+// by aTestCase. Test cases that can be run may be requested from 
+// Test Module by GetTestCases method before calling RunTestCase.
+// -----------------------------------------------------------------------------
+//
+TInt CAiwDialDataTests::RunTestCaseL( 
+    const TInt aCaseNumber,   
+    const TFileName& /*aConfig*/,
+    TTestResult& aResult )
+    {
+
+    // Return value
+    TInt execStatus = KErrNone;
+
+    // Get the pointer to test case function
+    TCaseInfo tmp = Case ( aCaseNumber );
+
+    _LIT( KLogStartTC, "Starting testcase [%S]" );
+    iLog->Log( KLogStartTC, &tmp.iCaseName);
+
+    // Check that case number was valid
+    if ( tmp.iMethod != NULL )
+        {
+        // Valid case was found, call it via function pointer
+        iMethod = tmp.iMethod;        
+        execStatus  = ( this->*iMethod )( aResult );
+        }
+    else
+        {
+        // Valid case was not found, return error.
+        execStatus = KErrNotFound;
+        }
+
+    // Return case execution status (not the result of the case execution)
+    return execStatus;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CAiwDialDataTests::OOMTestQueryL
+// Used to check if a particular test case should be run in OOM conditions and 
+// which memory allocations should fail.    
+// -----------------------------------------------------------------------------
+//
+TBool CAiwDialDataTests::OOMTestQueryL( 
+                                const TFileName& /* aTestCaseFile */, 
+                                const TInt aCaseNumber, 
+                                TOOMFailureType& /* aFailureType */, 
+                                TInt& aFirstMemFailure, 
+                                TInt& aLastMemFailure ) 
+    {
+    _LIT( KLogOOMTestQueryL, "CAiwDialDataTests::OOMTestQueryL" );
+    iLog->Log( KLogOOMTestQueryL );     
+
+    aFirstMemFailure = Case( aCaseNumber ).iFirstMemoryAllocation;
+    aLastMemFailure = Case( aCaseNumber ).iLastMemoryAllocation;
+
+    return Case( aCaseNumber ).iIsOOMTest;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CAiwDialDataTests::OOMTestInitializeL
+// Used to perform the test environment setup for a particular OOM test case. 
+// Test Modules may use the initialization file to read parameters for Test 
+// Module initialization but they can also have their own configure file or 
+// some other routine to initialize themselves.  
+//
+// NOTE: User may add implementation for OOM test environment initialization.
+// Usually no implementation is required.
+// -----------------------------------------------------------------------------
+//
+void CAiwDialDataTests::OOMTestInitializeL( 
+                                const TFileName& /* aTestCaseFile */, 
+                                const TInt /* aCaseNumber */ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CAiwDialDataTests::OOMHandleWarningL
+// In some cases the heap memory allocation should be skipped, either due to
+// problems in the OS code or components used by the code being tested, or even 
+// inside the tested components which are implemented this way on purpose (by 
+// design), so it is important to give the tester a way to bypass allocation 
+// failures.
+//
+// NOTE: User may add implementation for OOM test warning handling. Usually no
+// implementation is required.
+// -----------------------------------------------------------------------------
+//
+void CAiwDialDataTests::OOMHandleWarningL( 
+                                const TFileName& /* aTestCaseFile */,
+                                const TInt /* aCaseNumber */, 
+                                TInt& /* aFailNextValue */ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CAiwDialDataTests::OOMTestFinalizeL
+// Used to perform the test environment cleanup for a particular OOM test case.
+//
+// NOTE: User may add implementation for OOM test environment finalization.
+// Usually no implementation is required.
+// -----------------------------------------------------------------------------
+//
+void CAiwDialDataTests::OOMTestFinalizeL( 
+                                const TFileName& /* aTestCaseFile */, 
+                                const TInt /* aCaseNumber */ )
+    {
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// LibEntryL is a polymorphic Dll entry point
+// Returns: CTestModuleBase*: Pointer to Test Module object
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CTestModuleBase* LibEntryL()
+    {
+    return CAiwDialDataTests::NewL();
+
+    }
+
+// -----------------------------------------------------------------------------
+// SetRequirements handles test module parameters(implements evolution
+// version 1 for test module's heap and stack sizes configuring).
+// Returns: TInt: Symbian error code.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt SetRequirements( CTestModuleParam*& /*aTestModuleParam*/, 
+                                TUint32& /*aParameterValid*/ )
+    {
+
+    /* --------------------------------- NOTE ---------------------------------
+    USER PANICS occurs in test thread creation when:
+    1) "The panic occurs when the value of the stack size is negative."
+    2) "The panic occurs if the minimum heap size specified is less
+       than KMinHeapSize".
+       KMinHeapSize: "Functions that require a new heap to be allocated will
+       either panic, or will reset the required heap size to this value if
+       a smaller heap size is specified".
+    3) "The panic occurs if the minimum heap size specified is greater than
+       the maximum size to which the heap can grow".
+    Other:
+    1) Make sure that your hardware or Symbian OS is supporting given sizes.
+       e.g. Hardware might support only sizes that are divisible by four.
+    ------------------------------- NOTE end ------------------------------- */
+
+    // Normally STIF uses default heap and stack sizes for test thread, see:
+    // KTestThreadMinHeap, KTestThreadMinHeap and KStackSize.
+    // If needed heap and stack sizes can be configured here by user. Remove
+    // comments and define sizes.
+
+/*
+    aParameterValid = KStifTestModuleParameterChanged;
+
+    CTestModuleParamVer01* param = CTestModuleParamVer01::NewL();
+    // Stack size
+    param->iTestThreadStackSize= 16384; // 16K stack
+    // Heap sizes
+    param->iTestThreadMinHeap = 4096;   // 4K heap min
+    param->iTestThreadMaxHeap = 1048576;// 1M heap max
+
+    aTestModuleParam = param;
+*/
+    return KErrNone;
+
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/aiwdialdata/tsrc/public/basic/aiwdialdatatests/src/aiwdialdatatestscases.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,244 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Tests for domain AIWDialData API.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "AiwDialDataTests.h"
+
+#include <e32math.h>
+#include <aiwdialdata.h>
+#include <aiwdialdataext.h>
+#include <aiwgenericparam.h>
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAiwDialDataTests::Case
+// Returns a test case by number.
+//
+// This function contains an array of all available test cases 
+// i.e pair of case name and test function. If case specified by parameter
+// aCaseNumber is found from array, then that item is returned.
+// 
+// The reason for this rather complicated function is to specify all the
+// test cases only in one place. It is not necessary to understand how
+// function pointers to class member functions works when adding new test
+// cases. See function body for instructions how to add new test case.
+// -----------------------------------------------------------------------------
+//
+const TCaseInfo CAiwDialDataTests::Case ( 
+    const TInt aCaseNumber ) const 
+     {
+
+    /**
+    * To add new test cases, implement new test case function and add new 
+    * line to KCases array specify the name of the case and the function 
+    * doing the test case
+    * In practice, do following
+    * 1) Make copy of existing test case function and change its name
+    *    and functionality. Note that the function must be added to 
+    *    AiwDialDataTests.cpp file and to AiwDialDataTests.h 
+    *    header file.
+    *
+    * 2) Add entry to following KCases array either by using:
+    *
+    * 2.1: FUNCENTRY or ENTRY macro
+    * ENTRY macro takes two parameters: test case name and test case 
+    * function name.
+    *
+    * FUNCENTRY macro takes only test case function name as a parameter and
+    * uses that as a test case name and test case function name.
+    *
+    * Or
+    *
+    * 2.2: OOM_FUNCENTRY or OOM_ENTRY macro. Note that these macros are used
+    * only with OOM (Out-Of-Memory) testing!
+    *
+    * OOM_ENTRY macro takes five parameters: test case name, test case 
+    * function name, TBool which specifies is method supposed to be run using
+    * OOM conditions, TInt value for first heap memory allocation failure and 
+    * TInt value for last heap memory allocation failure.
+    * 
+    * OOM_FUNCENTRY macro takes test case function name as a parameter and uses
+    * that as a test case name, TBool which specifies is method supposed to be
+    * run using OOM conditions, TInt value for first heap memory allocation 
+    * failure and TInt value for last heap memory allocation failure. 
+    */ 
+
+    static TCaseInfoInternal const KCases[] =
+        {
+        // To add new test cases, add new items to this array
+        
+        // NOTE: When compiled to GCCE, there must be Classname::
+        // declaration in front of the method name, e.g. 
+        // CAiwDialDataTests::PrintTest. Otherwise the compiler
+        // gives errors.
+        
+        FUNCENTRY( CAiwDialDataTests::ConstructionTestL ),
+        FUNCENTRY( CAiwDialDataTests::SetAndGetTestL ),
+        FUNCENTRY( CAiwDialDataTests::ExtConstructionTestL ),
+        FUNCENTRY( CAiwDialDataTests::ExtSetAndGetTestL ),
+        // Example how to use OOM functionality
+        //OOM_ENTRY( "Loop test with OOM", CAiwDialDataTests::LoopTest, ETrue, 2, 3),
+        //OOM_FUNCENTRY( CAiwDialDataTests::PrintTest, ETrue, 1, 3 ),
+        };
+
+    // Verify that case number is valid
+    if( (TUint) aCaseNumber >= sizeof( KCases ) / 
+                               sizeof( TCaseInfoInternal ) )
+        {
+        // Invalid case, construct empty object
+        TCaseInfo null( (const TText*) L"" );
+        null.iMethod = NULL;
+        null.iIsOOMTest = EFalse;
+        null.iFirstMemoryAllocation = 0;
+        null.iLastMemoryAllocation = 0;
+        return null;
+        } 
+
+    // Construct TCaseInfo object and return it
+    TCaseInfo tmp ( KCases[ aCaseNumber ].iCaseName );
+    tmp.iMethod = KCases[ aCaseNumber ].iMethod;
+    tmp.iIsOOMTest = KCases[ aCaseNumber ].iIsOOMTest;
+    tmp.iFirstMemoryAllocation = KCases[ aCaseNumber ].iFirstMemoryAllocation;
+    tmp.iLastMemoryAllocation = KCases[ aCaseNumber ].iLastMemoryAllocation;
+    return tmp;
+
+    }
+
+// -----------------------------------------------------------------------------
+// Tests CAiwDialData construction
+// -----------------------------------------------------------------------------
+//
+TInt CAiwDialDataTests::ConstructionTestL( TTestResult& /*aResult*/ )
+    {
+    CAiwDialData* dialData = CAiwDialData::NewL();
+    delete dialData;
+    
+    dialData = CAiwDialData::NewLC();
+    
+    TL(  dialData->PhoneNumber() == KNullDesC() );
+    T1L( dialData->CallType(), CAiwDialData::EAIWVoice );
+    T1L( dialData->WindowGroup(), 0 );
+    
+    CAiwGenericParamList* list = CAiwGenericParamList::NewLC();
+    dialData->FillInParamListL( *list );
+    
+    CleanupStack::PopAndDestroy( 2, dialData );
+
+    return KErrNone;
+    }
+    
+// -----------------------------------------------------------------------------
+// Tests CAiwDialData setting and getting values.
+// -----------------------------------------------------------------------------
+//
+TInt CAiwDialDataTests::SetAndGetTestL( TTestResult& /*aResult*/ )
+    {
+    _LIT( KPhoneNumber, "1234567890");
+    
+    CAiwDialData* dialData = CAiwDialData::NewLC();
+    
+    dialData->SetPhoneNumberL( KPhoneNumber );
+    dialData->SetCallType( CAiwDialData::EAIWVideo );
+    dialData->SetWindowGroup( 1 );
+    
+    TL(  dialData->PhoneNumber() == KPhoneNumber() );
+    T1L( dialData->CallType(), CAiwDialData::EAIWVideo );
+    T1L( dialData->WindowGroup(), 1 );
+    
+    CAiwGenericParamList* list = CAiwGenericParamList::NewLC();
+    dialData->FillInParamListL( *list );
+    
+    CleanupStack::PopAndDestroy( 2, dialData );
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// Tests CAiwDialDataExt construction
+// -----------------------------------------------------------------------------
+//    
+TInt CAiwDialDataTests::ExtConstructionTestL( TTestResult& /*aResult*/ )
+    {
+    CAiwDialDataExt* dialData = CAiwDialDataExt::NewL();
+    delete dialData;
+    
+    dialData = CAiwDialDataExt::NewLC();
+    
+    TL(  dialData->PhoneNumber() == KNullDesC() );
+    T1L( dialData->CallType(), CAiwDialData::EAIWVoice );
+    T1L( dialData->WindowGroup(), 0 );
+    TL( !dialData->InitiateCall() );
+    TL( dialData->Name() == KNullDesC() );
+    T1L( dialData->Redial(), AIWDialDataExt::KAIWRedialDefault );
+    TL( dialData->ShowNumber() );        
+    TL( dialData->ContactLink() == KNullDesC8() );
+    
+    CAiwGenericParamList* list = CAiwGenericParamList::NewLC();
+    dialData->FillInParamListL( *list );
+    
+    CleanupStack::PopAndDestroy( 2, dialData );
+
+    return KErrNone;
+
+    }
+    
+// -----------------------------------------------------------------------------
+// Tests CAiwDialDataExt setting and getting values.
+// -----------------------------------------------------------------------------
+//
+TInt CAiwDialDataTests::ExtSetAndGetTestL( TTestResult& /*aResult*/ )
+    {
+    _LIT( KPhoneNumber, "1234567890");
+    _LIT8( KContactLink, "ContactLink");
+    _LIT( KName, "Mr Smith" );
+    
+    CAiwDialDataExt* dialData = CAiwDialDataExt::NewLC();
+    
+    dialData->SetPhoneNumberL( KPhoneNumber );
+    dialData->SetCallType( CAiwDialData::EAIWVideo );
+    dialData->SetWindowGroup( 1 );
+    dialData->SetInitiateCall( ETrue );
+    dialData->SetNameL( KName );
+    
+    dialData->SetRedial( AIWDialDataExt::KAIWRedialOff );
+    dialData->SetShowNumber( EFalse );
+    dialData->SetContactLinkL( KContactLink );
+    
+    TL(  dialData->PhoneNumber() == KPhoneNumber() );
+    T1L( dialData->CallType(), CAiwDialData::EAIWVideo );
+    T1L( dialData->WindowGroup(), 1 );
+    TL( dialData->InitiateCall() );
+    TL( dialData->Name() == KName() );
+    T1L( dialData->Redial(), AIWDialDataExt::KAIWRedialOff );
+    TL( !dialData->ShowNumber() );        
+    TL( dialData->ContactLink() == KContactLink() );
+    
+    
+    CAiwGenericParamList* list = CAiwGenericParamList::NewLC();
+    dialData->FillInParamListL( *list );
+    
+    CleanupStack::PopAndDestroy( 2, dialData );
+
+    return KErrNone;
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/callui/bmarm/cauiengineu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	CreateCaUiEngFactoryL__Fv @ 1 NONAME R3UNUSED ; CreateCaUiEngFactoryL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/callui/bwins/cauiengineu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,4 @@
+EXPORTS
+	?CreateCaUiEngFactoryL@@YAPAVCCaUiEngFactory@@XZ @ 1 NONAME ; class CCaUiEngFactory * __cdecl CreateCaUiEngFactoryL(void)
+	?NewL@CCaUiReconnectQuery@@SAPAV1@AAVMCaUiReconnectQueryObserver@@@Z @ 2 NONAME ; class CCaUiReconnectQuery * CCaUiReconnectQuery::NewL(class MCaUiReconnectQueryObserver &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/callui/data/101f868e.rss	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,79 @@
+/*
+* 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:  ECom resource file for CallUI.
+*
+*/
+
+
+
+//  INCLUDES
+#include    <registryinfov2.rh>
+#include    <aiwcommon.hrh>
+#include    "caui.hrh" 
+
+
+//  RESOURCE DEFINITIONS 
+
+// -----------------------------------------------------------------------------
+//   
+// theInfo
+// ECOM registry information - defined as ROM only.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+    {
+    resource_format_version = RESOURCE_FORMAT_VERSION_2;
+
+    dll_uid = KCallUIImplementationUid;
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KAiwClassMenu;
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KCallUIImplementationUid;
+                    version_no = 1;
+                    display_name = "";
+                    default_data = "*";
+                    opaque_data = KAiwCmdCallStr;
+                    rom_only = 1;
+                    }
+                };
+            },
+        INTERFACE_INFO
+            {
+            interface_uid = KAiwClassBase;
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KCallUIImplementationUid2;
+                    version_no = 1;
+                    display_name = "";
+                    default_data = "*";
+                    opaque_data = KAiwCmdCallStr;
+                    rom_only = 1;
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/callui/data/callui.rss	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,558 @@
+/*
+* Copyright (c) 2004-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 the CallUI.
+*
+*/
+
+
+//  RESOURCE IDENTIFIER
+NAME     CAUI
+
+//  INCLUDES
+#include <eikon.rh>
+#include <avkon.rh>
+#include <avkon.hrh>
+#include <avkon.rsg>
+#include <avkon.loc>
+
+#include "caui.hrh" 
+#include <callui.loc>
+#include <aiwcommon.hrh>
+
+
+
+//  RESOURCE DEFINITIONS 
+
+// -----------------------------------------------------------------------------
+//
+//    RSS_SIGNATURE
+//    
+//    Signature.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE RSS_SIGNATURE { }
+
+
+// -----------------------------------------------------------------------------
+//   
+//    r_callui_call_menu
+//    
+//    Call menu (non-cascaded).
+//    
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_callui_call_menu
+    {
+    items=
+        {
+        MENU_ITEM
+            {
+            command = ECallUIVoice; 
+            txt     = qtn_options_call;
+            extratxt  = qtn_call_sub_voice;
+            },
+        MENU_ITEM 
+            { 
+            command = AIW_SUBMENU_TITLE;
+            txt     = qtn_options_call;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_callui_cascaded_submenu
+//    
+//    Cascaded call submenu.
+//    
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_callui_cascaded_submenu
+    {
+    items=
+        {
+        MENU_ITEM
+            { 
+            command = ECallUIVoice;
+            txt     = qtn_call_sub_voice;
+            },
+        MENU_ITEM
+            { 
+            command = ECallUIVideo;
+            txt     = qtn_call_sub_video; 
+            },
+        MENU_ITEM
+            { 
+            command = ECallUIInternet;
+            txt     = qtn_call_sub_internet; 
+            },
+        MENU_ITEM 
+            { 
+            command = AIW_SUBMENU_TITLE;
+            txt = qtn_options_call;
+            }
+        };
+    }
+
+
+
+// -----------------------------------------------------------------------------
+//
+//    r_callui_create_list_query
+//    
+//    List query dialog for call type query or confirmation.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_callui_create_list_query
+    {
+    flags   = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_CALL_CANCEL__CALL;
+    items   =
+        {
+        DLG_LINE
+            {
+            type    = EAknCtListQueryControl;
+            id      = EListQueryControl;
+            control = AVKON_LIST_QUERY_CONTROL
+                {
+                listtype = EAknCtSinglePopupMenuListBox;
+                listbox  = LISTBOX
+                    {
+                    flags    = EAknListBoxMenuList;
+                    height   = ECaUiCreateListQueryHeight;
+                    width    = ECaUiCreateListQueryWidth;
+                    array_id = r_callui_create_list_items;
+                    };
+                heading  = qtn_popup_title_create;
+                };
+            }
+        };
+    }
+
+
+// -----------------------------------------------------------------------------
+//
+//  r_callui_create_list_items
+//  
+//  List items for call types used in create query.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_callui_create_list_items
+    {
+    items=
+        {
+        LBUF { txt = qtn_popup_create_voice; },
+        LBUF { txt = qtn_popup_create_video; }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_callui_create_list_voice
+//    
+//    The voice call item string in call type query.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_callui_create_list_voice
+    {
+    buf = qtn_popup_create_voice;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_callui_create_list_video
+//    
+//    The video item string in call type query
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_callui_create_list_video
+    {
+    buf = qtn_popup_create_video;
+    }
+    
+// -----------------------------------------------------------------------------
+//
+//    r_callui_create_list_internet
+//    
+//    The internet item string in call type query
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_callui_create_list_internet
+    {
+    buf = qtn_popup_create_internet;
+    }
+
+
+// -----------------------------------------------------------------------------
+//
+//    r_callui_no_video_network
+//    
+//    The text shown in information note when there is no
+//    network support for video call.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_callui_no_video_network
+    {
+    buf = qtn_tel_no_video_network;
+    }
+
+
+// -----------------------------------------------------------------------------
+//
+//    r_callui_reconnect_query_header
+//    
+//    The header string in reconnect confirmation query.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_callui_reconnect_query_header
+    {
+    buf = qtn_tel_retry_voicevideo_call;
+    }
+
+
+// -----------------------------------------------------------------------------
+//
+//    r_callui_reconnect_list_item_voice
+//    
+//    The voice call option item string in create confirmation query.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_callui_reconnect_list_item_voice
+    {
+    buf = qtn_tel_retry_voice_call_item;
+    }
+
+
+// -----------------------------------------------------------------------------
+//
+//    r_callui_reconnect_list_item_video
+//    
+//    The video call option item string in create confirmation query.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_callui_reconnect_list_item_video
+    {
+    buf = qtn_tel_retry_video_call_item;
+    }
+
+
+// -----------------------------------------------------------------------------
+//
+//    r_callui_reconnect_list_item_mms
+//    
+//    The mms option item string in create confirmation query.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_callui_reconnect_list_item_mms
+    {
+    buf = qtn_tel_retry_mms_call_item;
+    }
+
+
+// -----------------------------------------------------------------------------
+//
+//    r_callui_reconnect_list_item_sms
+//    
+//    The sms option item string in create confirmation query.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_callui_reconnect_list_item_sms
+    {
+    buf = qtn_tel_retry_sms_call_item;
+    }
+    
+// -----------------------------------------------------------------------------
+//   
+//    r_callui_call_internet_menu
+//    
+//    Call menu Voice call, Internet call
+//    
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_callui_call_internet_menu
+    {
+    items=
+        {
+        MENU_ITEM
+            {
+            command = ECallUIVoice; 
+            txt     = qtn_call_sub_voice;
+            },
+        MENU_ITEM
+            { 
+            command = ECallUIInternet;
+            txt     = qtn_call_sub_internet; 
+            },
+        MENU_ITEM 
+            { 
+            command = AIW_SUBMENU_TITLE;
+            txt = qtn_options_call;
+            }
+        };
+    }
+    
+// -----------------------------------------------------------------------------
+//   
+//    r_callui_internet_menu
+//    
+//    Call menu Internet call (non-cascaded).
+//    
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_callui_internet_menu
+    {
+    items=
+        {
+        MENU_ITEM
+            { 
+            command = ECallUIInternet;
+            txt     = qtn_options_internet_call; 
+            },
+        MENU_ITEM 
+            { 
+            command = AIW_SUBMENU_TITLE;
+            txt = qtn_options_call;
+            }
+        };
+    }
+    
+// -----------------------------------------------------------------------------
+//   
+//    r_callui_call_menu
+//    
+//    Call menu Voice call, Video call
+//    
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_callui_call_video_menu
+    {
+    items=
+        {
+        MENU_ITEM
+            {
+            command = ECallUIVoice; 
+            txt     = qtn_call_sub_voice;
+            },
+        MENU_ITEM
+            { 
+            command = ECallUIVideo;
+            txt     = qtn_call_sub_video; 
+            },
+        MENU_ITEM 
+            { 
+            command = AIW_SUBMENU_TITLE;
+            txt = qtn_options_call;
+            }
+        };
+    }
+
+
+
+// -----------------------------------------------------------------------------
+//
+//    NEW_MESSAGE_MTM_TYPE
+//    
+//    Message MTM types
+//
+// -----------------------------------------------------------------------------
+//
+STRUCT NEW_MESSAGE_MTM_TYPE
+    {
+    LONG id = 0;
+    LTEXT name = "";
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    NEW_MESSAGE_MTM_ARRAY
+//    
+//    Message MTM items struct
+//
+// -----------------------------------------------------------------------------
+//
+STRUCT NEW_MESSAGE_MTM_ARRAY
+    {
+    STRUCT items[];
+    }
+
+
+// -----------------------------------------------------------------------------
+//
+//    new_message_types_array
+//    
+//    Message type array
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE NEW_MESSAGE_MTM_ARRAY new_message_types_array
+    {
+    items = 
+        {
+#ifndef RD_UNIFIED_EDITOR        
+        NEW_MESSAGE_MTM_TYPE
+            {
+            id = 0x1000102C;
+            name = qtn_mce_pop_up_sms;
+            }
+#ifdef __MMS
+            ,
+        NEW_MESSAGE_MTM_TYPE
+            {
+            id = 0x100058E1;
+            name = qtn_mce_pop_up_mms;
+            }
+#endif //__MMS
+#else  // RD_UNIFIED_EDITOR
+        NEW_MESSAGE_MTM_TYPE
+            {
+            id = 0x102072D6; 
+            name = qtn_tel_retry_message_call_item;
+            }
+#endif // RD_UNIFIED_EDITOR
+#ifdef __EMAIL_UI 
+            ,
+        NEW_MESSAGE_MTM_TYPE
+            {
+            id = 0x10001028;
+            name = qtn_mce_pop_up_email;
+            }
+#endif //__EMAIL_UI
+            ,
+        NEW_MESSAGE_MTM_TYPE
+            {
+            id = 0x10207245; 
+            name = qtn_mce_pop_up_PostCard;
+            }
+        };
+    }
+// -----------------------------------------------------------------------------
+//
+//    r_callui_reconnect_list_item_message
+//    
+//    The mms option item string in create confirmation query.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_callui_reconnect_list_item_message
+    {
+    buf = qtn_tel_retry_message_call_item;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_callui_vt_setting_note
+//    
+//    Text for query dialog
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_callui_vt_setting_note
+    {
+    buf = qtn_incal_set_long_press_call_video;
+    }
+        
+// -----------------------------------------------------------------------------
+//
+//    r_callui_vt_setting_note
+//    
+//    The string in VT setting note
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_callui_popup_vt_title_setting
+    {
+    buf = qtn_popup_vt_title_setting;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_callui_vt_setting_query
+//    
+//    Query dialog for Video Telephony setting
+//
+//    
+// -----------------------------------------------------------------------------
+//
+
+RESOURCE DIALOG r_callui_vt_setting_query
+    {
+    flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow;
+    buttons = R_AVKON_SOFTKEYS_YES_NO;
+    items=
+        {
+        DLG_LINE
+            {
+            type = EAknCtPopupHeadingPane;
+            id = EAknMessageQueryHeaderId;
+            control = AVKON_HEADING
+                {
+                headinglayout = R_AVKON_WML_SIGN_QUERY_HEADING_PANE;
+                };
+            },
+        DLG_LINE
+            {
+            type = EAknCtMessageQuery;
+            id = EAknMessageQueryContentId;
+            control = AVKON_MESSAGE_QUERY
+                {
+                message = qtn_incal_set_long_press_call_video;
+                };
+            }
+        };
+    }        
+
+RESOURCE TBUF r_callui_cs_voice_call
+    {
+    buf = qtn_call_sub_voice;
+    }
+
+RESOURCE TBUF r_callui_cs_video_call
+    {
+    buf = qtn_call_sub_video;
+    }
+
+RESOURCE TBUF r_callui_internet_call
+    {
+    buf = qtn_call_sub_internet;
+    }
+    
+RESOURCE TBUF r_callui_xsp_call_with_service_name
+    {
+    buf = qtn_call_sub_voip_with_name;
+    }
+    
+RESOURCE TBUF r_callui_call_submenu_title
+    {
+    buf = qtn_options_call;
+    }
+    
+RESOURCE TBUF r_callui_xsp_test_temp
+    {
+    buf = qtn_call_sub_test;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/callui/eabi/cauiengineu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,10 @@
+EXPORTS
+	_Z21CreateCaUiEngFactoryLv @ 1 NONAME
+	_ZN19CCaUiReconnectQuery4NewLER27MCaUiReconnectQueryObserver @ 2 NONAME
+	_ZTI16CCaUiEngFactImpl @ 3 NONAME
+	_ZTI18CCaUiMessageSender @ 4 NONAME
+	_ZTI19CCaUiReconnectQuery @ 5 NONAME
+	_ZTV16CCaUiEngFactImpl @ 6 NONAME
+	_ZTV18CCaUiMessageSender @ 7 NONAME
+	_ZTV19CCaUiReconnectQuery @ 8 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/callui/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* 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:  Build information specification for CallUI.
+*
+*/
+
+
+#include <platform_paths.hrh>
+PRJ_PLATFORMS
+DEFAULT
+
+
+PRJ_EXPORTS
+
+// Private
+../inc/cauiengine/cauidialresultobserver.h |../inc/cauidialresultobserver.h
+../inc/cauiengine/cauilogger.h             |../inc/cauilogger.h
+../inc/cauiengine/cauieng.h                |../inc/cauieng.h
+
+// Internal
+../inc/caui.hrh                            |../../../inc/caui.hrh
+
+../group/callui_stub.sis                   /epoc32/data/z/system/install/callui_stub.sis
+
+// LOC files
+../loc/callui.loc                           MW_LAYER_LOC_EXPORT_PATH(callui.loc)
+
+// IBY files
+../rom/callui.iby                           CORE_MW_LAYER_IBY_EXPORT_PATH(callui.iby)
+../rom/callui_variant.iby                   CUSTOMER_MW_LAYER_IBY_EXPORT_PATH(callui_variant.iby)
+../rom/calluiresources.iby                  LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(calluiresources.iby)
+
+
+PRJ_MMPFILES
+../group/cauiengine.mmp
+../group/cauiplugin.mmp
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/callui/group/callui_stub.pkg	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,31 @@
+;
+; 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: For packing CalUi component.
+;
+; Languages
+&EN
+
+; Header
+#{"CallUI"}, (0x101F868F), 1, 0, 0, TYPE=SA
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Files
+""-"z:\sys\bin\CaUiEngine.dll"
+""-"z:\sys\bin\CaUiPlugin.dll"
+""-"z:\resource\CallUI.rsc"
Binary file phoneclientserver/callui/group/callui_stub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/callui/group/cauiengine.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2004-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:  Project specification for CaUiEngine.
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+// Capability assignment.
+CAPABILITY CAP_GENERAL_DLL
+
+TARGET          cauiengine.dll
+TARGETTYPE      dll
+UID             0x1000008d 0x101F868F
+
+SOURCEPATH      ../src/cauiengine
+SOURCE          cauiengfactimpl.cpp
+
+SOURCE          cauiquery.cpp 
+SOURCE          cauiengine.cpp 
+SOURCE          cauiactiveobject.cpp 
+SOURCE          cauimessagesender.cpp 
+SOURCE          cauidialogs.cpp 
+
+SOURCE          cauivoipextension.cpp 
+SOURCE          ccauireconnectquery.cpp
+SOURCE          ccauireconnectqueryimpl.cpp
+
+SOURCEPATH      ../data 
+START RESOURCE  callui.rss 
+HEADER
+TARGETPATH      RESOURCE_FILES_DIR
+END
+
+// TEMPORARY DEFINITION FOR CONTACT FINDER HEADERS
+SYSTEMINCLUDE    ../../../../../app/phone/inc
+
+USERINCLUDE     ../inc 
+USERINCLUDE     ../inc/cauiengine 
+USERINCLUDE     ../data 
+USERINCLUDE     ../loc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   ../../../inc
+SYSTEMINCLUDE   ../../inc // phoneclientserver inc
+
+LIBRARY         cone.lib
+LIBRARY         euser.lib
+LIBRARY         commonengine.lib
+LIBRARY         phoneclient.lib
+LIBRARY         featmgr.lib // FeatureManager
+LIBRARY         pbkeng.lib  // PhoneBook engine
+LIBRARY         pbkview.lib
+LIBRARY         centralrepository.lib
+LIBRARY         cenrepnotifhandler.lib  // Cenrep notifier
+LIBRARY         flogger.lib
+LIBRARY         phonecntfinder.lib
+
+LIBRARY         avkon.lib
+LIBRARY         aknnotify.lib
+LIBRARY         eikcore.lib  // For test printing.
+LIBRARY         sendui.lib 
+LIBRARY         eikcoctl.lib 
+LIBRARY         eikdlg.lib
+LIBRARY         bafl.lib // CDesC16ArrayFlat
+LIBRARY         mmscli.lib
+LIBRARY         msgs.lib
+LIBRARY         muiu.lib
+LIBRARY         serviceselector.lib
+LIBRARY         serviceprovidersettings.lib 
+
+LIBRARY         aiwdialdata.lib
+
+LANGUAGE_IDS
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/callui/group/cauiplugin.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* 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:  Project specification for CallUI plugin.
+*
+*/
+
+
+#include <platform_paths.hrh>
+// Capability assignment.
+CAPABILITY CAP_ECOM_PLUGIN
+
+TARGET          cauiplugin.dll
+
+TARGETTYPE      PLUGIN
+
+UID             0x10009D8D 0x101F868E
+
+SOURCEPATH      ../src/cauiplugin 
+SOURCE          cauiplugin.cpp 
+SOURCE          cauimain.cpp 
+
+
+SOURCEPATH      ../data 
+
+START RESOURCE  101f868e.rss 
+TARGET          cauiplugin.rsc
+END
+
+
+USERINCLUDE     ../inc 
+USERINCLUDE     ../inc/cauiplugin 
+
+MW_LAYER_SYSTEMINCLUDE 
+SYSTEMINCLUDE   /epoc32/include/ecom
+SYSTEMINCLUDE   ../../../inc
+
+LIBRARY         euser.lib
+LIBRARY         servicehandler.lib
+LIBRARY         flogger.lib
+LIBRARY         commonengine.lib
+
+LANGUAGE_IDS
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/callui/inc/caui.hrh	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2004-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:  Defines UIDs used in CallUI.
+*
+*/
+
+
+#ifndef CAUI_HRH
+#define CAUI_HRH
+
+
+// CONSTANTS
+
+// Connection utility implementation uid.
+#define KCallUIImplementationUid 0x101F868E
+#define KCallUIImplementationUid2 0x102029A1 
+
+// Create list query listbox height.
+enum
+    {
+    ECaUiCreateListQueryHeight = 3
+    };
+
+// Create list query listbox width.
+enum
+    {
+    ECaUiCreateListQueryWidth = 3
+    };
+
+
+// Values for different kinds of call commands.
+enum
+    {
+    ECallUIVoice    = 500,  // Normal, i.e. voice call.
+    ECallUIVideo    = 501,  // Video call.
+    ECallUIInternet = 502   // Internet call ( VoIP )
+    };
+
+// Values used in communication between CaUiEngine and CaUiPlugin.
+enum TCaUiCallType
+    {
+    ECaUiCallTypeUnknown  = 0, // Call type is unknown.
+    ECaUiCallTypeVoice    = 1, // Call type is voice call.
+    ECaUiCallTypeVideo    = 2, // Call type is video call.
+    ECaUiCallTypeInternet = 3  // Call type is Internet call
+    };
+
+enum EMenuItemType {
+    ECSVoice,
+    ECSVideo,
+    EInternet,
+    EInternetWithName
+};
+
+#endif // CAUI_HRH
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/callui/inc/cauiengine/cauiactiveobject.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,258 @@
+/*
+* Copyright (c) 2004-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:  Active object to handle global list query results.
+*
+*/
+
+
+#ifndef CAUIACTIVEOBJECT_H
+#define CAUIACTIVEOBJECT_H
+
+
+//  INCLUDES
+#include <e32base.h>
+#include <badesca.h>
+
+
+// DATA TYPES
+typedef CArrayFixFlat<TInt> CCaUiTIntArray;
+
+
+// FORWARD DECLARATIONS
+class MCaUiReconnectQueryObserver;
+class CCoeEnv;
+class CPhCntFactory;
+class CPhCntMatcher;
+class CCaUiMessageSender;
+
+// CLASS DECLARATION
+
+/**
+*  Active object to handle global list query results.
+*
+*  @lib CaUiEngine.lib
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( CCaUiGlnActiveObject )
+:   public CActive
+    {
+    public: // Data types
+
+        /* 
+        * The reconnect query options.
+        */
+        enum TCaUiReconnectType
+            {
+            ECaUiVoiceCall = 0,  // Voice call.
+            ECaUiVideoCall = 1,  // Video call.
+  #ifdef RD_UNIFIED_EDITOR
+            ECaUiMsg       = 2   // Unified editor.
+  #else // RD_UNIFIED_EDITOR
+            ECaUiMms       = 2,  // MMS.
+            ECaUiSms       = 3   // SMS.
+  #endif // // RD_UNIFIED_EDITOR
+            };
+
+
+        /**
+        *   The editor types that can be launched.
+        *   
+        *   ECaUiEditorSMS SMS editor.
+        *   ECaUiEditorMMS MMS editor.
+        */
+        enum TCaUiEditorType
+            {
+  #ifdef RD_UNIFIED_EDITOR
+            ECaUiEditorMSG = 0
+  #else // RD_UNIFIED_EDITOR
+            ECaUiEditorSMS = 0,
+            ECaUiEditorMMS = 1
+  #endif // RD_UNIFIED_EDITOR      
+            };
+
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        * 
+        * @param aObserver The observer to handle query results.
+        * @param aPhCntMatcher The Phone Contact Matcher. 
+        *        Ownership not transferred. If NULL, then matcher is created 
+        *        inside CCaUiGlnActiveObject.
+        * @param aPhoneNumber Pointer to the number where dial was tried.
+        * @param aAlias The alias corresponding the number. Can be NULL.
+        * @return Constructed CCaUiGlnActiveObject instance.
+        */
+        static CCaUiGlnActiveObject* NewL( 
+            MCaUiReconnectQueryObserver& aObserver,
+            CPhCntMatcher* aPhCntMatcher,
+            const TPtrC aPhoneNumber,
+            const TPtrC aAlias );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CCaUiGlnActiveObject();
+
+
+    public: // New functions
+
+
+        /**
+        * Returns reconnect query options array, that must include options
+        * in the same order and in the same locations than they are in 
+        * reconnect query. Insert only TCaUiReconnectType members.
+        * 
+        * @return Reconnect query options array.
+        */
+        CCaUiTIntArray* ReconQueryOptionsArray();
+
+
+    public: // Functions from base classes
+
+        /**
+        * @see CActive::DoCancel.
+        */
+        void DoCancel();
+
+        /**
+        * @see CActive::RunL.
+        */
+        void RunL();
+
+
+        /**
+        * @see CActive::SetActive.
+        */
+        void SetActive();
+        
+
+    private:
+
+        /**
+        * C++ constructor.
+        * 
+        * @param aObserver The observer to handle query results.
+        */
+        CCaUiGlnActiveObject( 
+            MCaUiReconnectQueryObserver& aObserver );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        *
+        * @see CCaUiGlnActiveObject::NewL().
+        */
+        void ConstructL( 
+            CPhCntMatcher* aPhCntMatcher,
+            const TPtrC aPhoneNumber,
+            const TPtrC aAlias );
+
+
+        /**
+        * Launch the desired editor.
+        * 
+        * @param aEditorType The editor type to be launched.
+        */
+        void LaunchEditorL( TCaUiEditorType aEditorType );
+
+        /**
+        * Creates message sender.
+        * 
+        */        
+        void CreateMessageSenderL();
+
+    private:    // Data
+
+
+        // The query observer.
+        MCaUiReconnectQueryObserver*    iObserver;
+
+        // Storage for real addresses.
+        CDesCArrayFlat*                 iRealAddress;
+
+        // Storage for aliases.
+        CDesCArrayFlat*                 iAliases;
+
+        // Storage for reconnect query options.
+        CCaUiTIntArray*                 iReConQueryOptions; 
+
+        // Phone Contact finder factory.
+        CPhCntFactory*                  iPhCntFactory;
+
+        // Phone Contact matcher.
+        CPhCntMatcher*                  iPhCntMatcher;
+
+        // Is CPhCntMatcher owned.
+        TBool                           iOwnMatcher;
+        
+        // Message sender
+        CCaUiMessageSender*             iMessageSender;
+
+    };
+
+/**
+*  Active object to handle note results.
+*
+*  @lib CaUiEngine.lib
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( CCaUiNoteActiveObject )
+:   public CActive
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        * 
+        * @return Constructed CCaUiNoteActiveObject instance.
+        */
+        static CCaUiNoteActiveObject* NewL();
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CCaUiNoteActiveObject();
+
+
+
+    public: // Functions from base classes
+
+        /**
+        * @see CActive::DoCancel.
+        */
+        void DoCancel();
+
+        /**
+        * @see CActive::RunL.
+        */
+        void RunL();
+
+        /**
+        * @see CActive::SetActive.
+        */
+        void SetActive();
+        
+
+    private:
+
+        /**
+        * C++ default constructor.
+        * 
+        */
+        CCaUiNoteActiveObject();
+    };
+
+#endif      // CCAUIACTIVEOBJECT_H 
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/callui/inc/cauiengine/cauidialdatacontainer.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* 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:  Contains PhoneClient Dial Data.
+*
+*/
+
+
+
+#ifndef CAUIDIALDATACONTAINER_H
+#define CAUIDIALDATACONTAINER_H
+
+//  INCLUDES
+#include <e32base.h> 
+#include <tphcltextphonedialdata.h> 
+
+
+/**
+*  Defines the class that contains PhoneClient Dial Data.
+*
+*  @lib CaUiEngine.lib
+*  @since 2.6
+*/
+class CCaUiDialDataContainer 
+:   public CBase
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        * 
+        * @return Created CCaUiDialDataContainer instance.
+        */
+        static CCaUiDialDataContainer* NewL();
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CCaUiDialDataContainer();
+
+
+    public: // New functions
+        
+        /**
+        * Returns reference to owned dial data.
+        * 
+        * @return Owned PhoneClient dial data.
+        */
+        TPhCltExtPhoneDialData& DialData();
+
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CCaUiDialDataContainer();
+
+
+    private:    // Data
+
+        // PhoneClient Dial data.
+        TPhCltExtPhoneDialData  iDialData;
+    };
+
+#endif      // CAUIDIALDATACONTAINER_H  
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/callui/inc/cauiengine/cauidialogs.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,212 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 engine implementation for CallUI.
+*
+*/
+
+
+#ifndef __CAUIDIALOGS_H__
+#define __CAUIDIALOGS_H__
+
+// Includes
+
+#include "phclttypes.h" 
+#include "cauivoipextension.h" 
+
+// Forward declarations
+
+class CCaUiEngine;
+class MCaUiReconnectQueryObserver;
+class CPhCntMatcher;
+class CAknGlobalListQuery;
+class CCaUiGlnActiveObject;
+class CCaUiReConQueryInformation;
+class CAknGlobalNote;
+class CCaUiNoteActiveObject;
+
+
+// Contants
+
+// The first item in list query (CCaUiQuery).
+const TInt KCallUiVoiceCall = 0;
+
+// The second item in list query (CCaUiQuery).
+const TInt KCallUiVideoCall = 1;
+
+// The third item in list query (CCaUiQuery).
+const TInt KCallUiInternetCall = 2;
+
+// Priority of the note
+const TInt KNoVideoSupportNotePriority = 3500;
+
+// Timeout for note launch.
+const TInt KCaUiEngNoteTimeout = 3000000;  // 3s
+
+NONSHARABLE_CLASS( CCaUiDialogs )
+    : public CBase
+    {
+    
+    public:
+    
+        /**
+        * Two-phased constructor.
+        * @return an instance of CCaUiDialogs.
+        */
+        static CCaUiDialogs* NewL( CCaUiEngine& aCaUiEngine );
+    
+        /**
+        * Destructor.
+        */
+        virtual ~CCaUiDialogs();
+    
+        /**
+        * Launch a query whether video call will be created with long 
+        * press of Send key
+        * 
+        * @return The selection user made
+        */
+        TInt QueryVideoCallDefaultActionL();
+        
+        /**
+        * Launch a list query asking what type of call the caller wants
+        * to make.
+        * 
+        * @param aCallType The call type chosen by user in query.
+        * @return ETrue if query was successful, EFalse otherwise.
+        */
+        TBool LaunchCreateListQueryL( TPhCltCallType& aCallType );
+        
+        /**
+        * Launch the qtn.tel.no.video.network information note.
+        * 
+        * @see CCaUiEngApi::LaunchNoNetSupNoteL().
+        */
+        void LaunchNoNetSupNoteL();
+        
+        /**
+        * Launch reconnect confirmation query.
+        * 
+        * @see CCaUiEngApi::LaunchReconConfQueryL().
+        * @param aAlias The alias corresponding the number. Can be empty TPtrC.
+        */
+        void LaunchReconConfQueryL( 
+            MCaUiReconnectQueryObserver& aObserver,
+            CPhCntMatcher* aPhCntMatcher,
+            const TPtrC aPhoneNumber,
+            const TBool aIncludeVideoCallOption,
+            const TPtrC aAlias );
+        
+        /**
+        * Cancel reconnect query.
+        * 
+        * @see CCaUiEngApi::CancelReconConfQuery().
+        */
+        void CancelReconConfQuery();
+        
+        /**
+        * Cancel note and reconnect query.
+        * 
+        * @see CCaUiEngApi::CancelNoteAndReconConfQuery().
+        */
+        void CancelNoteAndReconConfQuery();
+        
+        /**
+        * Launch note and reconnect confirmation query.
+        * 
+        * @see CCaUiEngApi::LaunchNoteAndReconConfQueryL().
+        * @param aAlias The alias corresponding the number. Can be empty TPtrC.
+        */
+        void LaunchNoteAndReconConfQueryL( 
+            MCaUiReconnectQueryObserver& aObserver,
+            CPhCntMatcher* aPhCntMatcher,
+            const TPtrC aPhoneNumber,
+            const TBool aIncludeVideoCallOption,
+            const TPtrC aNoteText,
+            const TPtrC aAlias );
+        
+        /**
+        * Check if reconfigure query is ongoing.
+        * @since 3.2
+        * @return TBool, ETrue if query is ongoing 
+        *                EFalse if not ongoing.
+        */
+        TBool IsReconfQueryOngoing();
+        
+        /**
+        * Set reconfigure query is ongoing.
+        * @since 5.0
+        */
+        void SetReconfQueryOngoing( TBool aOngoing );
+    
+    private:
+        
+        /**
+        * C++ default constructor.
+        */
+        CCaUiDialogs( CCaUiEngine& aCaUiEngine );
+        
+        /**
+        * Symbian 2nd phase constructor
+        */
+        void ConstructL();
+        
+        /**
+        * Fill list query items
+        * 
+        * @since 5.0
+        * @param aTextArray
+        * @param aMappingList
+        */
+        void FillListQueryItemsL( 
+            CDesCArray& aTextArray, 
+            CListMappingArray& aMappingList );
+        
+        /**
+        * Handle note expiration call back.
+        * 
+        * @param aAny This pointer.
+        * @return KErrNone if successful, Symbian error code otherwise.
+        */
+        static TInt DoPerformNoteLaunchCallBackL( TAny* aAny );
+        
+    public: // data
+        
+        // tkuuva, create getter/setter
+        //TBool                           iReconfQueryOngoing;
+        
+    private: //data
+        
+        // The reconnect global list query.
+        CAknGlobalListQuery*            iReconListQuery;
+        
+        // The active object to handle reconnect query results.
+        CCaUiGlnActiveObject*           iReconActObject;
+        
+        CCaUiEngine&                    iCaUiEngine;
+        
+        // Owned timer for note launch time-out.
+        CPeriodic*                      iNoteTimer;
+        
+        // Storage for Reconnect query information.
+        CCaUiReConQueryInformation*     iReConQueryInformation;
+        
+        // The qtn.tel.no.video.network note shown to the user.
+        CAknInformationNote*            iInfoNote;
+                
+        // ReconfQuery ongoing flag
+        TBool                           iReconfQueryOngoing;
+        
+    };
+
+#endif // __CAUIDIALOGS_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/callui/inc/cauiengine/cauidialresultobserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* 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:  It defines the interface for the observers of 
+*                the CCaUiEngApi DialL function results.
+*
+*/
+
+
+#ifndef MCAUIDIALRESULTOBSERVER_H
+#define MCAUIDIALRESULTOBSERVER_H
+
+// CLASS DECLARATION
+
+/**
+*  Defines the interface for the observers of the CCaUiEngApi DialL function.
+*
+*  @lib CaUiEngine.lib
+*  @since 2.6
+*/
+class MCaUiDialResultObserver
+    {          
+    public:  // New functions   
+        
+        /**
+        * It is called whenever dial request is completed.
+        *
+        * @param aStatus It is the status of the operation.
+        *                KErrNone if successful.
+        *                < 0 means Symbian OS error code.
+        */       
+        virtual void HandleDialResultL( const TInt aStatus ) = 0;
+        
+    };
+
+#endif      // MCAUIDIALRESULTOBSERVER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/callui/inc/cauiengine/cauieng.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,230 @@
+/*
+* Copyright (c) 2004-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:  API for CallUiEngine usage.
+*
+*/
+
+
+#ifndef CAUIENG_H
+#define CAUIENG_H
+
+
+//  INCLUDES
+#include <e32base.h>
+#include <spdefinitions.h>  //RIdArray
+#include "caui.hrh" 
+
+
+// FORWARD DECLARATIONS
+class MCaUiReconnectQueryObserver;
+class MDesC16Array;
+class MCaUiDialResultObserver;
+class CPhCntMatcher;
+
+
+// CLASS DECLARATION
+
+/**
+*  The API for CallUIEngine usage.
+*
+*  @lib CaUiEngine.lib
+*  @since 2.6
+*/
+class CCaUiEngApi 
+:   public CBase
+    {
+    public: // Data types
+
+        /**
+        * Enumerate all supported resource types.
+        *
+        * ECaUiResVoice         - Pure voice call resources.
+        * ECaUiResVoiceAndVideo - Voice and video call resources.
+        * ECaUiResVoiceInternetAndVideo - All Internet, voice and video call resources.
+        * ECaUiResOnlyInternet  - Only Internet call resources.
+        */
+        enum TCaUiEngResource 
+            {
+            ECaUiResVoice                   = 0,
+            ECaUiResVoiceAndVideo           = 1,
+            ECaUiResVoiceInternetAndVideo   = 2,
+            ECaUiResOnlyInternet            = 3
+            };
+
+
+        /**
+        * Enumerate all supported localized text.
+        *
+        * ECallMenuItemText      - Menu item text for call.
+        * EVoiceCallMenuItemText - Menu item text for voice call.
+        * EVideoCallMenuItemText - Menu item text for video call.
+        * EInternetCallMenuItemText - Menu item text for internet call.
+        */
+        enum TCaUiEngText 
+            {
+            ECallMenuItemText          = 0,
+            EVoiceCallMenuItemText     = 1,
+            EVideoCallMenuItemText     = 2,
+            EInternetCallMenuItemText  = 3
+            };
+
+    public: // New functions
+
+        /**
+        * Make the dial operation.
+        * 
+        * @param aObserver The observer to handle dial result.
+        * @param aDialData The TCallUIDialDataV1 dial data information in
+        *                  packaged format.
+        * @param aCallType If not equal to ECaUiCallTypeUnknown, then 
+        *                  overwrites the call type in aDialData.
+        */
+        virtual void DialL(
+            MCaUiDialResultObserver& aObserver,
+            const TDesC8& aDialData,
+            const TCaUiCallType aCallType ) = 0;
+
+        /**
+        * Launch the qtn.tel.no.video.network information note.
+        * 
+        */
+        virtual void LaunchNoNetSupNoteL() = 0;
+
+
+        /**
+        * Launch the reconnect confirmation query shown to user.
+        * 
+        * @param aObserver The observer to handle query result.
+        * @param aPhCntMatcher The Phone Contact Matcher. 
+        *        Ownership not transferred. If NULL, then matcher is created 
+        *        inside CaUIEngine.
+        * @param aPhoneNumber Pointer to the number where dial was tried.
+        * @param aIncludeVideoCallOption If set to ETrue, video call option is
+        *        included to query, otherwise it is left out.
+        */
+        virtual void LaunchReconConfQueryL( 
+            MCaUiReconnectQueryObserver& aObserver,
+            CPhCntMatcher* aPhCntMatcher,
+            const TPtrC aPhoneNumber,
+            const TBool aIncludeVideoCallOption ) = 0;
+
+
+        /**
+        * Cancel reconnect query launched with LaunchReconConfQueryL.
+        * 
+        */
+        virtual void CancelReconConfQuery() = 0;
+
+
+        /**
+        * Launch note and reconnect confirmation query in sequence.
+        * 
+        * @param aObserver The observer to handle query result.
+        * @param aPhCntMatcher The Phone Contact Matcher. 
+        *        Ownership not transferred. If NULL, then matcher is created 
+        *        inside CaUIEngine.
+        * @param aPhoneNumber Pointer to the number where dial was tried.
+        * @param aIncludeVideoCallOption If set to ETrue, video call option is
+        *        included to query, otherwise it is left out.
+        * @param aNoteText The text shown in information note. If empty, then 
+        *        qtn.tel.no.video.network text is shown.
+        */
+        virtual void LaunchNoteAndReconConfQueryL( 
+            MCaUiReconnectQueryObserver& aObserver,
+            CPhCntMatcher* aPhCntMatcher,
+            const TPtrC aPhoneNumber,
+            const TBool aIncludeVideoCallOption,
+            const TPtrC aNoteText ) = 0;
+
+        /**
+        * Cancel note and reconnection query launched with 
+        * LaunchNoteAndReconConfQueryL.
+        * 
+        */
+        virtual void CancelNoteAndReconConfQuery() = 0;
+
+        /**
+        * Launch address selection. If contact contains default number or 
+        * only one number, number will be returned directly. 
+        * Otherwise address selection list displayed.
+        * @since 3.0
+        * 
+        * @param aTelNum Contains selected number after execution.
+        * @param aContactId The contact id from PhoneBook.
+        * @param aVoIPAddressSelect If ETrue VoIP address select is used. 
+        * @return TBool, ETrue if number selected, 
+        *     EFalse otherwice (E.g. list canceled).
+        */
+        virtual TBool LaunchAddressSelectL( 
+            TDes& aTelNum, 
+            const TInt aContactId,
+            const TBool aVoIPAddressSelect ) = 0;
+
+        /**
+        * Cancel address selection launched with LaunchAddressSelectL.
+        * 
+        */
+        virtual void CancelAddressSelect() = 0;
+        
+        /**
+        * Get VoIP services
+        * @param aVoipServiceIds On return, contains the list of VoIP services
+        */
+        virtual void GetVoIPServiceIdsL( RIdArray& aVoipServiceIds  ) const = 0;
+        
+        /**
+        * Get the service provider name
+        * @param aServiceId The service, whose name is requested
+        * @param aServiceName On return, contains the service name
+        */
+        virtual void GetVoipServiceNameL( TServiceId aServiceId, TDes& aServiceName ) const = 0;
+    };
+
+
+
+
+/**
+*  Interface for CaUiEngine creation.
+*
+*  @lib 
+*  @since 2.6
+*/
+class CCaUiEngFactory : public CBase
+    {
+    public:
+
+        /**
+        * Creates CallUIEngine.
+        * CCaUiEngFactory instance is deleted even in leave case.
+        * 
+        * @return CCaUiEngApi implementation. NULL if not supported.
+        *         Ownership transferred.
+        */
+        virtual CCaUiEngApi* CCaUiEngApiLD() = 0;
+
+    };
+
+/**
+* Only exported function. This is in index 1 in the lookup table.
+* Call this function to create CCaUiEngFactory instance.
+* 
+* IMPORT_C CCaUiEngFactory* CreateCaUiEngFactoryL();
+*/ 
+
+
+
+
+#endif      // CAUIENG_H 
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/callui/inc/cauiengine/cauiengfactimpl.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* 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:  Implementation of the CaUiEngine factory interface.
+*
+*/
+
+
+
+#ifndef CAUIENGFACTIMPL_H
+#define CAUIENGFACTIMPL_H
+
+
+//  INCLUDES
+#include    "cauieng.h" 
+
+
+/**
+*  Implementation of the PhoneClient Extension factory.
+*
+*  @lib CaUiEngine.lib
+*  @since 2.6
+*/
+class CCaUiEngFactImpl 
+:   public CCaUiEngFactory
+    {
+    public:
+
+        /**
+        * @see CCaUiEngFactory.
+        */
+        CCaUiEngApi* CCaUiEngApiLD();
+
+
+    private:
+
+        /* 
+        * Destructor 
+        */
+        ~CCaUiEngFactImpl();
+    };
+
+
+#endif      // CAUIENGFACTIMPL_H
+
+  
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/callui/inc/cauiengine/cauiengine.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,511 @@
+/*
+* Copyright (c) 2004-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:  Provides engine implementation for CallUI.
+*
+*/
+
+
+#ifndef CAUIENGINE_H
+#define CAUIENGINE_H
+
+//  INCLUDES
+#include    <e32std.h>
+#include    <coneresloader.h> // RconeResourceLoader. 
+#include    <mphcltextphoneobserver.h> // MPhCltExtPhoneObserver. 
+#include    "cauieng.h" 
+#include    "cauidialresultobserver.h" 
+#include    "cauiqueryobserver.h" 
+#include    <phclttypes.h> 
+#include    <mphcltemergencycallobserver.h> 
+#include    <cphcntcontactdataselection.h>  // MPhCntSelectionObserver
+#include    <cphcltemergencycall.h> // CPhCltEmergencyCall 
+#include    <mcauireconnectqueryobserver.h>
+#include    <cconvergedserviceselector.h>
+#include    <mphcntstoreloaderobserver.h>
+#include    <aiwdialdata.h>
+
+// FORWARD DECLARATIONS
+class CPhCltExtPhoneBase;
+class CAknGlobalListQuery;
+class CAknGlobalConfirmationQuery;
+class CAknGlobalNote;
+class CCaUiReConQueryInformation;
+class CAiwInternalDialData;
+class CPhCltExtPhoneDialData;
+class CPhCntSingleItemFetch;
+class CPhCntFactory;
+class CCaUiVoIPExtension;
+class MPhCntStoreLoader;
+class MVPbkContactStore;
+
+class CCaUiDialogs;
+
+// CONSTANTS
+
+// Owned and used resource file.
+_LIT( KCallUIResFile,         "z:\\resource\\CallUI.rsc" );
+
+
+    /**   
+    * Indicates state of long press key
+    * Default value: 0
+    * Default value for iMode variant: 1    
+    */
+enum TCaUiLongPressKey
+    {
+    ECaUiLongPressKeyNotSet      = 0, // Long press key is not set
+    ECaUiLongPressKeyNotInUse    = 1, // Long press key is not in use
+    ECaUiLongPressKeyInUse       = 2, // Long press key is in use
+    };
+   
+// CLASS DECLARATION
+
+/**
+*  CaUIEngine implementation.
+*  
+*  @lib CaUiEngine.lib
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( CCaUiEngine )
+:   public CCaUiEngApi,
+    public MPhCltExtPhoneObserver,
+    public MCaUiReconnectQueryObserver,
+    public MPhCntSelectionObserver,
+    public MPhCltEmergencyCallObserver,
+    public MPhCntStoreLoaderObserver
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @return an instance of CallUI.
+        */
+        static CCaUiEngine* NewL();
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CCaUiEngine();
+
+
+    public:  // New functions
+
+        /**
+        * Make the dial operation.
+        * 
+        * @see CCaUiEngApi::DialL().
+        */
+        void DialL(
+            MCaUiDialResultObserver& aObserver,
+            const TDesC8& aDialData,
+            const TCaUiCallType aCallType );
+
+        /**
+        * Launch the qtn.tel.no.video.network information note.
+        * 
+        * @see CCaUiEngApi::LaunchNoNetSupNoteL().
+        */
+        void LaunchNoNetSupNoteL();
+
+
+        /**
+        * Launch reconnect confirmation query.
+        * 
+        * @see CCaUiEngApi::LaunchReconConfQueryL().
+        */
+        void LaunchReconConfQueryL( 
+            MCaUiReconnectQueryObserver& aObserver,
+            CPhCntMatcher* aPhCntMatcher,
+            const TPtrC aPhoneNumber,
+            const TBool aIncludeVideoCallOption );
+
+        /**
+        * Cancel reconnect query.
+        * 
+        * @see CCaUiEngApi::CancelReconConfQuery().
+        */
+        void CancelReconConfQuery();
+
+
+        /**
+        * Launch note and reconnect confirmation query.
+        * 
+        * @see CCaUiEngApi::LaunchNoteAndReconConfQueryL().
+        */
+        void LaunchNoteAndReconConfQueryL( 
+            MCaUiReconnectQueryObserver& aObserver,
+            CPhCntMatcher* aPhCntMatcher,
+            const TPtrC aPhoneNumber,
+            const TBool aIncludeVideoCallOption,
+            const TPtrC aNoteText );
+
+        /**
+        * Cancel note and reconnect query.
+        * 
+        * @see CCaUiEngApi::CancelNoteAndReconConfQuery().
+        */
+        void CancelNoteAndReconConfQuery();
+
+        /**
+        * Launch address selection.
+        * @since 3.0
+        * 
+        * @see CCaUiEngApi::LaunchAddressSelectL(). 
+        */
+        TBool LaunchAddressSelectL(
+            TDes& aTelNum, 
+            const TInt aContactId,
+            const TBool aVoIPAddressSelect );
+
+        /**
+        * Cancel address select launched with LaunchAddressSelectL.
+        * @since 3.0
+        * 
+        * @see CCaUiEngApi::CancelAddressSelect().
+        */
+        void CancelAddressSelect();
+
+    public: // from MPhCntStoreLoaderObserver
+        
+        /**
+         * From MPhCntStoreLoaderObserver;
+         * @since S60 v9.1
+         * @see MPhCntStoreLoaderObserver.
+         */
+        void ContactStoreLoadingCompleted( 
+            MVPbkContactStore* aStore, TInt aErrorCode );
+    
+    private: // Functions from base classes
+
+        /**
+        * Handle dial request completion.
+        * 
+        * @see MPhCltExtPhoneObserver::HandleDialL().
+        */
+        void HandleDialL( const TInt aStatus );
+
+        /**
+        * Called when CCaUiReconnectQuery has got a key press.
+        * 
+        * @see MCaUiReconnectQueryObserver::OptionSelectedL().
+        */
+        void OptionSelected( MCaUiReconnectQueryObserver::TCaUiReconType aReconType );
+
+    
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CCaUiEngine();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Convert the AIW dialdata to PhoneClient format.
+        * 
+        * @param aAiwDialData AIW DialData format.
+        */
+       void ConvertDialDataL(
+            const CAiwInternalDialData& aAiwDialData );
+   
+
+        /**
+        * Clear the Dial related contents if they exist.
+        */
+        void ClearDialContents();
+
+
+
+    public:
+
+        /**
+        * Check is there VoIP profiles in phone.
+        * 
+        * @since 3.0
+        * @return ETrue if found, EFalse otherwise.
+        */
+        TBool IsVoIPProfiles();
+        
+        /**
+        * @see CCaUiEngApi::GetVoIPServiceIdsL
+        */
+        void GetVoIPServiceIdsL( RIdArray& aVoipServiceIds ) const;
+        
+        /**
+        * @see CCaUiEngApi::GetVoipServiceNameL
+        */
+        void GetVoipServiceNameL( TServiceId aServiceId, TDes& aServiceName ) const;
+
+    private:
+
+        /**
+        * Launch address selection. If contact contains default number or 
+        * only one number, number will be returned directly. 
+        * Otherwise address selection list displayed.
+        * @since 3.0
+        * 
+        * @param aTelNum Contains selected number after execution.
+        * @param aContactId The contact id from PhoneBook.
+        * @param aCallType If calltype is ECaUiCallTypeInternet VoIP address
+        *     select is used. 
+        * @param aRemoveInvalidChars Removes invalid chars from selected number
+        *                            if set ETrue.
+        * @param aFocusedField Focused field from PhoneBook
+        * @return TBool, ETrue if number selected, EFalse otherwice 
+        *     (E.g. list canceled)
+        */
+        void LaunchAddressSelectL( 
+            const TDesC8& aContactLink,
+            const TCaUiCallType aCallType
+            );
+
+
+        /**
+        * Looks for tel URI parameters from a specified phone number.
+        * @param aNumber The phone number that might contain URI parameters
+        * @return HBufC containing URI parameters, if parameters couldn't 
+        * be found the HBufC with zero length is returned
+        * NOTE: The parameters will be ripped off from the given phone 
+        * number (aNumber) if found.
+         */
+        HBufC* FindAndRipURIParametersL( TDes& aNumber ) const;
+        
+        /**
+         * Looks call-type parameter from, URI params and converts the
+         * possible found hint as a return value.
+         * @param aUriParams The descriptor containing URI part of the tel URI.
+         * Parameters can be extracted from URI by using 
+         * FindAndRipURIParametersL method.
+         * @return The hinted call type defined in URI parameters. 
+         * If call-type parameter couldn't be found the EPhCltVoice is returned.
+         */        
+        TPhCltCallType CallTypeFromUriParams( const TDesC& aUriParams ) const;
+        
+        /**
+         * Utility method to search value of named parameter from tel URI.
+         * @param aName The name of parameter what is searched
+         * @param aUri The URI from from which parameter is searched
+         * @return The descriptor containing the valud of named parameter.
+         * If named parameter couldn't be found, KNullDesC is returned
+         */        
+        TPtrC ParamValue( const TDesC& aName, const TDesC& aUri ) const;
+        
+        /**
+         * Utility method to loop through all parameters in Tel URI.
+         * @param aUri Tel URI from which the parameters are searched.
+         * @param aStartIndex Offset from which searching is started.
+         * NOTE: method modifies aStartIndex parameter, always when 
+         * it returns. So 
+         * @return The descriptor containing the next parameter name=value pair.
+         */        
+        TPtrC FindNextParamValuePair( const TDesC& aUri, 
+                                      TInt& aStartIndex ) const;
+     
+        /**
+        * Handle first long press of send key
+        * @since 3.2
+        * Leaves if cenrep data can't be read.
+        * @return User decision about the VT setting
+        */
+        TBool HandleFirstLongPressOfSendKeyL();
+        
+        /**
+        * General handling of long press of send key
+        * @since 3.2
+        * Leaves if cenrep data can't be read.        
+        */
+        void HandleLongPressOfSendKeyL();
+        
+        /**
+        *  from MPhCntSelectionObserver class 
+        * @since 3.2
+        * Leaves if aContactData data can't be read.        
+        */
+        void SelectionDone( CPhCntSelectedData* aContactData, TInt aErrorCode );
+        
+        /**
+        * Makes phoneclient dial request 
+        * @since 3.2
+        * @param fieldLink   link to phonenumber in contacts. If NULL call is 
+        * not created from Phonebook.        
+        */
+        void PhoneClientDialL( const TDesC8* fieldLink );
+        
+        /**
+        * Sets call type to phoneclient dial data struct.
+        * @since 3.2
+        * @param aCallType Call type to set in dialdata struct.        
+        */
+        void SetDialDataCallType( const TCaUiCallType aCallType ); 
+        
+        /**
+        * Checks if number is emergency number using
+        * Emergency call API
+        * @since 3.2
+        * returns ETrue if number is emergency number. Default EFalse.        
+        */
+        TBool IsEmergencyNumber();
+        
+        /**
+        * Handling of emergency dial result. 
+        * @since 3.2
+        * @see MPhCltEmergencyCallObserver::HandleEmergencyDialL().        
+        */
+        void HandleEmergencyDialL( const TInt aStatus ); 
+
+        /**
+        * Checks if Video Call can be made
+        * @since 3.2
+        * Leaves if cenrep data can't be read.
+        * returns ETrue if call can be made.
+        */
+        TBool IsVideoCallAllowedL();
+        
+        /**
+        * Gets Central repository value
+        * @since 3.2
+        * @param aUid Central repository uid.
+        * @param aId, Central repository key Id.
+        * @param aValue  Cen Rep key value. 
+        * Leaves if cenrep data can't be read.
+        */
+        void GetCenRepValueL( const TUid& aUid, 
+                             const TUint aId,
+                             TInt& aValue ) const;
+        
+        /**
+        * Converts given TCaUiCallType to CPhCntContactDataSelection::TCallType 
+        * @since 3.2
+        * @param aCallType CallType to convert
+        * @param aResultCallType converted type
+        * 
+        */
+        void ConvertCaUiCallType( const TCaUiCallType aCallType,
+                    CPhCntContactDataSelection::TCallType& aResultCallType  );
+        
+         /**
+        * Converts CPhCltExtPhoneDialData callType 
+        * to CPhCntContactDataSelection::TCallType 
+        * @since 3.2
+        * @param aResultCallType converted type
+        * 
+        */            
+        void ConvertDialDataCallType( 
+                    CPhCntContactDataSelection::TCallType& aResultCallType );
+
+      /**
+       * Converts TPhCltCallType callType to TCaUiCallType. 
+       * @since S60 v9.1
+       * @param aCallType           Source type
+       * @param aResultCallType     Converted type
+       */
+        void ConvertPhCltCallType( const TPhCltCallType aCallType,
+            TCaUiCallType& aResultCallType ) const;
+        
+        /**
+        * Returns Service Selectors calltype by dial data calltype.
+        * @since 5.0
+        * @param Selector calltype.
+        */            
+        CConvergedServiceSelector::TSsCallType ServiceSelectorCallType() const;
+       
+        /**
+        * Converts CCConvergedServiceSelector results 
+        * to CPhCltExtPhoneDialData (calltype and service id) 
+        * @since 5.0
+        * @param aResults Service selectors results.
+        */            
+        void SetSelectorResults( 
+                  CConvergedServiceSelector::TSsResult& aResults );
+
+        /**
+        * Starts to load specified contact store if not yet loaded. 
+        * If loading is needed, MPhCntStoreLoaderObserver::ContactStoreLoaded
+        * is called when store is ready for use.
+        *  
+        * @since    S60 v9.1
+        * @param    aContactLink   Contact link specifying store to load.
+        * @return   ETrue if store is already loaded.
+        */
+        TBool LaunchContactStoreLoadingL( const TDesC8& aContactLink );
+
+        /**
+        * Resolves with a help of call type values whether call is initiated
+        * with a send command or through the explicit menu option. 
+        * 
+        * @since    S60 v9.1
+        * @param    aCallType       Call UI call type.
+        * @param    aAiwCallType    AIW call type.
+        * @return   ETrue if send key pressed, EFalse otherwise.
+        */
+        TBool IsSendKeyPressed( TCaUiCallType aCallType,
+            CAiwDialData::TCallType aAiwCallType ) const;
+        
+    private:    // Data
+
+        // Owned resource loader.
+        RConeResourceLoader             iResourceLoader;
+
+        // Buffer for returned localized texts.
+        HBufC*                          iBuf;
+
+        // PhoneClient for call creation.
+        CPhCltExtPhoneBase*             iPhCltDialer;
+
+        // Handler class for PhoneClient Dial data.
+        CPhCltExtPhoneDialData*         iDialData;
+        // Emergency call API
+        CPhCltEmergencyCall*            iEmergencyCall;
+        
+        // The observer to handle CallUI dial results.
+        MCaUiDialResultObserver*        iObserver;
+        
+        // VoIP extension.        
+        CCaUiVoIPExtension*             iVoIPProfileHandler;
+
+        // Long press of Send key setting state, NOT SET/ON/OFF
+        TInt iLongPressSet;
+        
+        // The qtn.tel.xxx note shown to the user.
+        CAknGlobalConfirmationQuery*    iVTSettingQuery;
+
+        // Long key press note buffer        
+        HBufC* iVTString;
+        // Contact factory for PhoneCntFinder connection
+        CPhCntFactory* iFactory;
+        
+        // Contact selector for fetching contact information from phonebook
+        CPhCntContactDataSelection* iContactSelector;
+        
+        // Service selector for calling service (service id and type)
+        CConvergedServiceSelector*      iServiceSelector;
+
+        /**
+         * Contact store loader.
+         * Own.
+         */
+        MPhCntStoreLoader* iContactStoreLoader;
+
+        // Dialogs class. Own
+        CCaUiDialogs* iDialogs;
+
+    };
+
+#endif  // CAUIENGINE_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/callui/inc/cauiengine/cauilogger.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,100 @@
+/*
+* 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:  Logger headerfile for CallUi
+*
+*/
+
+
+
+#ifndef CAUILOGGER_H
+#define CAUILOGGER_H
+
+/* 
+-----------------------------------------------------------------------------
+    LOG SELECTION
+-----------------------------------------------------------------------------
+*/
+#ifndef _DEBUG
+    // UREL BUILD:
+    #define CAUI_LOGGING_METHOD  0   // No logging in UREL builds
+#else
+    // UDEB BUILD:
+    #define CAUI_LOGGING_METHOD  1   // 0 = No logging, 
+                                        // 1 = Flogger, 
+                                        // 2 = RDebug
+#endif //_DEBUG
+
+
+#if CAUI_LOGGING_METHOD > 0
+    #define CAUI_LOGGING_ENABLED     // This is for backward compatibility
+#endif //CAUI_LOGGING_METHOD 
+
+/* 
+-----------------------------------------------------------------------------
+    FLOGGER SETTINGS
+-----------------------------------------------------------------------------
+*/
+#if CAUI_LOGGING_METHOD == 1      // Flogger
+
+    #include <flogger.h>
+
+    _LIT(KCAUILogFolder, "TF");
+    _LIT(KCAUILogFile, "TFLOG.TXT");
+
+#elif CAUI_LOGGING_METHOD == 2    // RDebug
+
+    #include <e32svr.h>
+
+#endif //CAUI_LOGGING_METHOD
+
+
+/*
+-----------------------------------------------------------------------------
+    LOGGING MACROs
+
+    USE THESE MACROS IN YOUR CODE !
+-----------------------------------------------------------------------------
+*/
+
+
+#if CAUI_LOGGING_METHOD == 1      // Flogger
+
+#define CAUILOGTEXT(AAA) /*lint -save -e960 */              { RFileLogger::Write(KCAUILogFolder(),KCAUILogFile(),EFileLoggingModeAppend,AAA); } /*lint -restore */
+#define CAUILOGSTRING(AAA) /*lint -save -e960 */           { _LIT(tempLogDes,AAA); RFileLogger::Write(KCAUILogFolder(),KCAUILogFile(),EFileLoggingModeAppend,tempLogDes()); } /*lint -restore */
+#define CAUILOGSTRING2(AAA,BBB) /*lint -save -e960 -e437 */       { _LIT(tempLogDes,AAA); RFileLogger::WriteFormat(KCAUILogFolder(),KCAUILogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(tempLogDes()),BBB); } /*lint -restore */
+#define CAUILOGSTRING3(AAA,BBB,CCC) /*lint -save -e960 */   { _LIT(tempLogDes,AAA); RFileLogger::WriteFormat(KCAUILogFolder(),KCAUILogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(tempLogDes()),BBB,CCC); } /*lint -restore */
+
+#elif CAUI_LOGGING_METHOD == 2    // RDebug
+
+#define CAUILOGTEXT(AAA)              RDebug::Print(AAA);
+#define CAUILOGSTRING(AAA)            RDebug::Print(_L(AAA));
+#define CAUILOGSTRING2(AAA,BBB)       RDebug::Print(_L(AAA),BBB);
+#define CAUILOGSTRING3(AAA,BBB,CCC)   RDebug::Print(_L(AAA),BBB,CCC);
+
+#else    // CAUI_LOGGING_METHOD == 0 or invalid
+
+// Example: CAUILOGTEXT(own_desc);
+#define CAUILOGTEXT(AAA)              
+// Example: CAUILOGSTRING("Test");
+#define CAUILOGSTRING(AAA)            
+// Example: CAUILOGSTRING("Test %i", aValue);
+#define CAUILOGSTRING2(AAA,BBB)       
+// Example: CAUILOGSTRING("Test %i %i", aValue1, aValue2);
+#define CAUILOGSTRING3(AAA,BBB,CCC)   
+
+#endif  // CAUI_LOGGING_METHOD
+
+#endif    // CAUILOGGER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/callui/inc/cauiengine/cauimessagesender.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2004-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:  Launches Send Ui.
+*
+*/
+
+
+#ifndef CAUIMESSAGESENDER_H
+#define CAUIMESSAGESENDER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <msvapi.h>
+#include <msgarrays.h> // CUidNameArray 
+
+// CLASS DECLARATION
+class CMsvSession;
+class CSendUi;
+
+// CLASS DECLARATION
+
+/**
+*  CaUIMessageSender implementation.
+*
+*  @lib CaUiEngine.lib
+*  @since 2.6
+*/
+class CCaUiMessageSender : 
+    public CBase,
+    private MMsvSessionObserver
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Destructor.
+        */
+        ~CCaUiMessageSender();
+
+        /**
+        * Two-phased constructor.
+        * @return an instance of CCaUiMessageSender.
+        */        
+        static CCaUiMessageSender* NewL();
+
+    public: // New functions
+     
+         /**
+        * Create new message by given Id. The message editor will always 
+        * be lauched stand alone.
+        * @param aMessageType mtmUid indicate the message type
+        *        aRealAddress address list to send message
+        */      
+        void CreateNewMessageL( TInt aMessageType,
+            MDesC16Array* aRealAddress,
+            MDesC16Array* aAliases,
+            CRichText* aRichText );
+
+        /**
+        * Get messgae types array
+        */          
+        const CUidNameArray& MessageTypesArrayL();    
+    
+    private:
+
+        /**
+        * C++ constructor.
+        * 
+        * @param aIndex After the query is dismissed, the index will hold
+        *               the value of selected item.
+        */
+        CCaUiMessageSender( );
+
+        /**
+        * Create SendUi
+        */
+        void CreateSendUiL();
+
+        /**
+        * Get message types from mtm registry
+        *
+        * @param aMsgTypes array of UIDs (MTM types)
+        *
+        */
+        void UpdateMessageTypesArrayL( CUidNameArray* aMsgTypes );
+
+        /**
+        * Check if mail box is defined
+        */      
+        TBool IsMailboxDefinedL();
+
+        /**
+        * Create connection to message service
+        */
+        void CreateMessageServiceConnectionL();
+
+    protected:  // Functions from base classes
+
+        /**
+        * From MMsvSessionObserver
+        */
+        virtual void HandleSessionEventL(TMsvSessionEvent aEvent, 
+            TAny* aArg1, TAny* aArg2, TAny* aArg3);
+
+    private:
+    
+        // Message service session
+        CMsvSession* iSession;
+        
+        // Send UI
+        CSendUi*    iSendUi;
+        
+        // Array of MTM types
+        CUidNameArray* iMsgTypes;   
+
+    };
+
+#endif      // CAUIMESSAGESENDER_H 
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/callui/inc/cauiengine/cauimessagesenderstub.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2004-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:  Message sender stub.
+*
+*/
+
+
+#ifndef CAUIMESSAGESENDER_H
+#define CAUIMESSAGESENDER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <msgarrays.h> // cuidnamearray 
+
+// CLASS DECLARATION
+
+/**
+*  CaUIMessageSender implementation.
+*
+*  @lib CaUiEngine.lib
+*  @since 3.1
+*/
+class CCaUiMessageSender : 
+    public CBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Destructor.
+        */
+        ~CCaUiMessageSender();
+
+        /**
+        * Two-phased constructor.
+        * @return an instance of CCaUiMessageSender.
+        */        
+        static CCaUiMessageSender* NewL();
+
+    public: // New functions
+     
+         /**
+        * Create new message by given Id. The message editor will always 
+        * be lauched stand alone.
+        * @param aMessageType mtmUid indicate the message type
+        *        aRealAddress address list to send message
+        */      
+        void CreateNewMessageL( TInt aMessageType,
+             MDesC16Array* aRealAddress,
+             MDesC16Array* aAliases,
+             CRichText* aRichText );
+
+    private:
+
+        /**
+        * C++ constructor.
+        * 
+        * @param aIndex After the query is dismissed, the index will hold
+        *               the value of selected item.
+        */
+        CCaUiMessageSender( );
+
+        /**
+        * Create SendUi
+        */
+        void CreateSendUiL();
+
+        /**
+        * Get message types from mtm registry
+        *
+        * @param aMsgTypes array of UIDs (MTM types)
+        *
+        */
+        void UpdateMessageTypesArrayL( CUidNameArray* aMsgTypes );
+
+        /**
+        * Check if mail box is defined
+        */      
+        TBool IsMailboxDefinedL();
+
+        /**
+        * Create connection to message service
+        */
+        void CreateMessageServiceConnectionL();
+
+    private:
+
+    };
+
+#endif      // CAUIMESSAGESENDER_H 
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/callui/inc/cauiengine/cauiquery.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2004-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:  Defines the query used in CallUI to ask call type from user.
+*
+*/
+
+
+#ifndef CAUIQUERY_H
+#define CAUIQUERY_H
+
+
+//  INCLUDES
+#include <aknlistquerydialog.h> 
+
+
+
+// CLASS DECLARATION
+
+/**
+*  Defines create list query that is used in CaUiEngine to ask 
+*  call type confirmation from user.
+*
+*  @lib CaUiEngine.lib
+*  @since 2.6
+*/
+NONSHARABLE_CLASS( CCaUiCreateListQuery )
+    : public CAknListQueryDialog
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * C++ constructor.
+        * 
+        * @param aIndex After the query is dismissed, the index will hold
+        *               the value of selected item.
+        */
+        CCaUiCreateListQuery( TInt* aIndex );
+        
+        /**
+        * Destructor.
+        */
+        ~CCaUiCreateListQuery();
+
+
+    public: // Functions from base classes
+
+        /**
+        * Loaded version to enable Send key handling.
+        * 
+        * @see CAknListQueryDialog::OfferKeyEventL.
+        */
+        TKeyResponse OfferKeyEventL(
+            const TKeyEvent& aKeyEvent,
+            TEventCode aType );
+            
+    private: //data
+
+        /**
+         * Flag indicating the validity of the received key event.
+         */
+        TBool iValidKeyEvent;
+    };
+
+#endif      // CAUIQUERY_H 
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/callui/inc/cauiengine/cauiqueryobserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,62 @@
+/*
+* 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:  Defines the query observer interfaces used in CallUI 
+*                confirmation query handling.
+*
+*/
+
+
+#ifndef CAUIQUERYOBSERVER_H
+#define CAUIQUERYOBSERVER_H
+
+
+/**
+*  Defines the observer interface for reconnect confirmation query observers.
+*
+*  @lib CaUiEngine.lib
+*  @since 2.6
+*/
+class MCaUiReconConfQueryObserver
+    {
+    public:    // Data types
+
+        enum TCaUiReconType
+            {
+            ECallUiReconTypeCancel = -1, // Query canceled.
+            ECallUiReconTypeVoice = 0,   // Voice call.
+            ECallUiReconTypeVideo = 1,   // Video call.
+#ifndef RD_UNIFIED_EDITOR
+            ECallUiReconTypeMms   = 2,   // MMS.
+            ECallUiReconTypeSms   = 3    // SMS.
+#else // RD_UNIFIED_EDITOR
+            ECallUiReconTypeMsg   = 2
+#endif // RD_UNIFIED_EDITOR
+            };
+
+    public:  // New functions
+        
+        /**
+        * Called when CCaUiReconConfQuery has got a key press.
+        * 
+        * @param aReconType The reconnect choice of the user.
+        */
+        virtual void HandleReconConfQueryResultL( 
+            TCaUiReconType aReconType ) = 0;
+    };
+
+
+
+#endif      // CAUIQUERYOBSERVER_H 
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/callui/inc/cauiengine/cauivoipextension.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,105 @@
+/*
+* 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:  VoIP profile handler
+*
+*/
+
+
+
+#ifndef CAUIVOIPEXTENSION_H
+#define CAUIVOIPEXTENSION_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <badesca.h>
+#include <phclttypes.h> 
+#include <spdefinitions.h>  //RIdArray
+
+/**
+*  Mapping for list items.
+*
+*  @lib CaUiEngine.lib
+*  @since 3.2
+*/
+NONSHARABLE_CLASS( TListMappingItem )
+    {
+    public: //Data
+        // Index of the list item.
+        TInt iIndex;
+        // Call type ot the list item.
+        TPhCltCallType iCallType;
+    };
+    
+// DATATYPES
+typedef CArrayFixFlat <TListMappingItem> CListMappingArray;
+
+// CLASS DECLARATION
+/**
+*  VoIP profile handler.
+*  
+*
+*  @lib CaUiEngine.lib
+*  @since Series60 3.0
+*/
+NONSHARABLE_CLASS( CCaUiVoIPExtension )  : public CBase
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CCaUiVoIPExtension* NewL();
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CCaUiVoIPExtension();
+
+
+    public: // New functions
+                
+        /**
+        * Check has user set VoIP profiles.
+        * @return TBool, ETrue if profiles exists
+        */        
+        TBool IsVoIPProfilesL();
+
+        /**
+        * @see CCaUiEngApi::GetVoIPServiceIdsL
+        */
+        void GetVoIPServiceIdsL( RIdArray& aVoipServiceIds ) const;
+        
+        /**
+        * @see CCaUiEngApi::GetVoipServiceNameL
+        */
+        void GetVoipServiceNameL( TServiceId aServiceId, TDes& aServiceName ) const;
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CCaUiVoIPExtension();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private:  // Data
+    };
+
+#endif      // CAUIVOIPEXTENSION_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/callui/inc/cauiengine/ccauireconnectqueryimpl.h	Wed Jul 21 18:26:52 2010 +0300
@@ -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:  Provides reconnectquery implementation for CallUI.
+*
+*/
+
+
+#ifndef CCAUIRECONNECTQUERYIMPL_H
+#define CCAUIRECONNECTQUERYIMPL_H
+
+//  INCLUDES
+#include <ccauireconnectquery.h>
+
+#include    <e32std.h>
+
+
+// FORWARD DECLARATIONS
+class CCaUiEngine;
+
+// CONSTANTS
+
+
+
+   
+// CLASS DECLARATION
+
+/**
+*  CaUIEngine implementation.
+*  
+*  @lib CaUiReconnectQueryImpl.lib
+*  @since 5.0
+*/
+NONSHARABLE_CLASS( CCaUiReconnectQueryImpl )
+:   public CCaUiReconnectQuery
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @return an instance of CallUI.
+        */
+        static CCaUiReconnectQueryImpl* NewL( 
+            MCaUiReconnectQueryObserver& aObserver );
+        
+
+        /**
+        * Destructor.
+        */
+        virtual ~CCaUiReconnectQueryImpl();
+
+
+
+    private: // Functions from base classes
+    
+        /**
+        * Launch reconnect confirmation query.
+        * 
+        */
+        void ShowL( 
+            const TPtrC aPhoneNumber,
+            const TBool aIncludeVideoCallOption );
+            
+    private: // internal functions
+        
+        /**
+        * Constructor.
+        */
+        CCaUiReconnectQueryImpl(MCaUiReconnectQueryObserver& aObserver);
+
+        /**
+        * Second phase construction.
+        */
+        void ConstructL();
+
+
+    private:    // Data
+        
+        CCaUiEngine* iEng;
+
+    };
+
+#endif  // CCAUIRECONNECTQUERYIMPL_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/callui/inc/cauiplugin/cauiplugin.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,158 @@
+/*
+* 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 ECOM interface implementation for CallUI.
+*
+*/
+
+
+#ifndef CAUIPLUGIN_H
+#define CAUIPLUGIN_H
+
+
+//  INCLUDES
+#include    <aiwserviceifmenu.h>
+#include    <aiwcommon.h>               // AIW dialdata.
+#include    <spdefinitions.h>  //TServiceId
+#include    "cauidialresultobserver.h"
+#include    "caui.hrh"
+
+// FORWARD DECLARATIONS
+class CCaUiEngApi;
+class MAiwNotifyCallback;
+class CAiwMenuPane;
+
+
+
+// CLASS DECLARATION
+
+/**
+*  CaUiPlugin implementation.
+*
+*  @since 2.6
+*/
+class CCaUiPlugin 
+:   public CAiwServiceIfMenu,
+    public MCaUiDialResultObserver 
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * 
+        * @return An instance of CaUiPlugin.
+        */
+        static CCaUiPlugin* NewL();
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CCaUiPlugin();
+
+
+    public: // Functions from base classes
+
+        /**
+        * @see CAiwServiceIfMenu::InitialiseL.
+        */
+        void InitialiseL(
+            MAiwNotifyCallback& aFrameworkCallback,
+            const RCriteriaArray& aInterest );
+
+        /**
+        * @see CAiwServiceIfMenu::HandleServiceCmdL.
+        */
+        void HandleServiceCmdL(
+            const TInt& aCmdId,
+            const CAiwGenericParamList& aInParamList,
+            CAiwGenericParamList& aOutParamList,
+            TUint aCmdOptions = 0,
+            const MAiwNotifyCallback* aCallback = NULL );
+
+        /**
+        * @see CAiwServiceIfMenu::InitializeMenuPaneL.
+        */
+        void InitializeMenuPaneL(
+        CAiwMenuPane& aMenuPane,
+            TInt aIndex,
+            TInt aCascadeId,
+            const CAiwGenericParamList& aInParamList );
+
+        /**
+        * @see CAiwServiceIfMenu::HandleMenuCmdL.
+        */
+        void HandleMenuCmdL(
+            TInt aMenuCmdId,
+            const CAiwGenericParamList& aInParamList,
+            CAiwGenericParamList& aOutParamList,
+            TUint aCmdOptions = 0,
+            const MAiwNotifyCallback* aCallback = NULL );
+
+        /**
+        * @see MCaUiDialResultObserver::HandleDialResultL.
+        */
+        void HandleDialResultL( const TInt aStatus );
+
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CCaUiPlugin();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Adds a new call sub menu items. If the call type is internet call 
+        * and there is only one service, the service's provider ID is used 
+        * in menu item.
+        * @param aMenuPane Menu pane to insert commands
+        * @param aIndex The index of call sub menu
+        * @param aType The type of item being added
+        * @param aServiceId The service ID of VoIP call item, needed when 
+        *        getting the service name
+        */
+        void AddAiwMenuItemL(
+            CAiwMenuPane& aMenuPane,
+            TInt aIndex,
+            EMenuItemType aType,
+            TServiceId aServiceId = 0 );
+
+    private:    // Data
+
+        // The library loader.
+        RLibrary                        iLibrary;
+
+        // CaUiEngine.
+        CCaUiEngApi*                    iCaUiEngine;
+
+        // The AIW callback instance.
+        const MAiwNotifyCallback*       iAiwNotifyCallback;
+
+        // AIW Input parameters.
+        const CAiwGenericParamList*     iInParamList;
+
+        // AIW Output parameters, result of call is returned here.
+        CAiwGenericParamList*           iOutParamList;
+
+        // The menu command given to HandleMenuCmdL.
+        TInt                            iMenuCmdId;
+    };
+
+#endif  // CAUIPLUGIN_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/callui/loc/callui.loc	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,177 @@
+/*
+* Copyright (c) 2004-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 the localised strings for CallUI.
+*
+*/
+
+
+
+//  LOCALISATION STRINGS
+
+// d: It is text for a menu option. If it is selected, 
+// d: normal, i.e. voice call will be made.
+// l: list_single_popup_submenu_pane_t1
+//
+#define qtn_call_sub_voice "Voice call"
+
+
+// d: It is text for a menu option. If it is selected, 
+// d: video call will be made.
+// l: list_single_popup_submenu_pane_t1
+//
+#define qtn_call_sub_video "Video call"
+
+// d: It is text for a menu option. If it is selected, 
+// d: an internet call will be made.
+// d: %U is replaced with the VoIP service name.
+// l: list_single_popup_submenu_pane_t1
+// r: 5.0
+//
+#define qtn_call_sub_voip_with_name "%U call"
+
+
+// d: Defines list query header for call type inquiry.
+// l: heading_pane_t1
+//
+#define qtn_popup_title_create "Create:"
+
+
+// d: In list query selecting this option
+// d: means that normal, i.e. voice call is created.
+// l: list_single_pane_t1_cp2
+//
+#define qtn_popup_create_voice "Voice call"
+
+
+// d: In list query selecting this option
+// d: means that video call is created.
+// l: list_single_pane_t1_cp2
+//
+#define qtn_popup_create_video "Video call"
+
+
+// d: In list query selecting this option
+// d: means that internet call is created.
+// l: list_single_pane_t1_cp2
+// w:
+// r: 3.0
+//
+//
+#define qtn_popup_create_internet "Internet call"
+
+
+// d: Defines the information note text shown to user when there is 
+// d: no network support for video call. 
+// l: popup_note_window
+//
+#define qtn_tel_no_video_network "No network support for video call."
+
+
+// d: Defines list query header for reconnect type inquiry.
+// l: heading_pane_t1
+//
+#define qtn_tel_retry_voicevideo_call "Reconnect via:"
+
+
+// d: In reconnect query selecting this option means that
+// d: voice call is created.
+// l: list_single_pane_t1_cp2
+//
+#define qtn_tel_retry_voice_call_item "Voice call"
+
+
+// d: In reconnect query selecting this option means that
+// d: video call is created.
+// l: list_single_pane_t1_cp2
+//
+#define qtn_tel_retry_video_call_item "Video call"
+
+
+// d: In reconnect query selecting this option means that
+// d: multimedia messaging service editor is opened.
+// l: list_single_pane_t1_cp2
+//
+#define qtn_tel_retry_mms_call_item "Multimedia message"
+
+
+// d: In reconnect query selecting this option means that
+// d: short message service editor is opened.
+// l: list_single_pane_t1_cp2
+//
+#define qtn_tel_retry_sms_call_item "Short message"
+
+// d: It is text for a menu option. If it is selected, 
+// d: internet call will be made.
+// l: list_single_popup_submenu_pane_t1
+// r: 3.0
+//
+#define qtn_call_sub_internet "Internet call"
+
+// d: In reconnect query selecting this option means that
+// d: Send message service editor is opened.
+// l: list_single_pane_t1_cp2
+// r: 3.1
+#define qtn_tel_retry_message_call_item "Message"
+
+
+// d: Text for query dialog 
+// l: popup_info_list_pane_t1 
+// r: 3.2
+#define qtn_incal_set_long_press_call_video "By long pressing the Call creation key, a video call can be created if defined in Call settings as the default action. Activate now?"
+
+// This is only used for Phone NG development. 
+// Will be fixed/removed
+#ifdef RD_PHONE_NG
+
+// LOCALISATION STRINGS
+
+//d: When user personalize the softkey on idle state to be "New message",
+//d: after press softkey, a menu with following text will appear. User chose
+//d: one item to activate corresponding message editor. This is the same text
+//d: appeared on Message Center application.
+//l: list_single_pane_t1_cp2 
+// r: 3.2 
+//
+#define qtn_mce_pop_up_email "Email"
+
+//d: When user personalize the softkey on idle state to be "New message",
+//d: after press softkey, a menu with following text will appear. User chose
+//d: one item to activate corresponding message editor. This is the same text
+//d: appeared on Message Center application.
+//l: list_single_pane_t1_cp2 
+// r: 3.2 
+//
+#define qtn_mce_pop_up_sms "Short message"
+
+//d: When user personalize the softkey on idle state to be "New message",
+//d: after press softkey, a menu with following text will appear. User chose
+//d: one item to activate corresponding message editor. This is the same text
+//d: appeared on Message Center application.
+//l: list_single_pane_t1_cp2 
+// r: 3.2
+//
+#define qtn_mce_pop_up_mms "Multimedia message"
+
+//d: When user personalize the softkey on idle state to be "New message",
+//d: after press softkey, a menu with following text will appear. User chose
+//d: one item to activate corresponding message editor. This is the same text
+//d: appeared on Message Center application.
+//l: list_single_pane_t1_cp2 
+// r: 3.2 
+//
+#define qtn_mce_pop_up_PostCard "Postcard"
+
+#endif
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/dialutils/bwins/dialutilsu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	?CreateDialUtilsFactoryL@@YAPAVCDialUtilsFactory@@XZ @ 1 NONAME ; class CDialUtilsFactory * CreateDialUtilsFactoryL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/dialutils/eabi/dialutilsu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,7 @@
+EXPORTS
+	_Z23CreateDialUtilsFactoryLv @ 1 NONAME
+	_ZTI14CDialUtilsImpl @ 2 NONAME ; #<TI>#
+	_ZTI18CDialUtilsFactImpl @ 3 NONAME ; #<TI>#
+	_ZTV14CDialUtilsImpl @ 4 NONAME ; #<VT>#
+	_ZTV18CDialUtilsFactImpl @ 5 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/dialutils/inc/dialutilsfactimpl.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* 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:  Implementation of the DialUtils factory interface.
+*
+*/
+
+
+
+#ifndef DIALUTILSFACTIMPL_H
+#define DIALUTILSFACTIMPL_H
+
+
+//  INCLUDES
+#include    <dialutils.h> 
+
+
+/**
+*  Implementation of the DialUtils factory.
+*
+*  @lib DialUtils.lib
+*  @since 2.6
+*/
+class CDialUtilsFactImpl 
+:   public CDialUtilsFactory
+    {
+    public:
+
+        /**
+        * @see CDialUtilsFactory::CDialUtilsApiLD.
+        */
+       CDialUtilsApi* CDialUtilsApiLD();
+
+
+    private:
+
+        /* 
+        * Destructor 
+        */
+        ~CDialUtilsFactImpl();
+    };
+
+
+#endif      // DIALUTILSFACTIMPL_H
+
+  
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/dialutils/inc/dialutilsimpl.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,109 @@
+/*
+* Copyright (c) 2004-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:  Provides implementation for DialUtils.
+*
+*/
+
+
+#ifndef DIALUTILSIMPL_H
+#define DIALUTILSIMPL_H
+
+//  INCLUDES
+#include    <e32std.h>
+#include    <dialutils.h> 
+
+
+// FORWARD DECLARATIONS
+class RSharedDataClient;
+class CRepository;
+
+
+// CONSTANTS
+
+// The prefix text.
+typedef TBuf<10> TDiUtPrefixText;
+
+
+// CLASS DECLARATION
+
+/**
+*  DialUtils implementation.
+*  
+*  @lib DialUtils.lib
+*  @since 2.6
+*/
+class CDialUtilsImpl
+:   public CDialUtilsApi
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @return an instance of DialUtilsImpl.
+        */
+        static CDialUtilsImpl* NewL();
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CDialUtilsImpl();
+
+
+    public:  // New functions
+
+        /**
+        * Check and modify the phone number.
+        * 
+        * @see CDialUtilsApi::CheckNumber.
+        */
+        TInt CheckNumber( HBufC& aPhoneNumber );
+
+
+   
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CDialUtilsImpl();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Combine the given texts if needed.
+        * 
+        * @param aPhoneNumber The number to be modified.
+        * @param aPrefixText The prefixText to be added 
+        *                    to aPhoneNumber if needed.
+        */
+        TInt CombineTexts(
+            TPtr aPhoneNumber,
+            const TDiUtPrefixText& aPrefixText ) const;
+
+
+    private:    // Data
+
+        // The shared data client.
+        RSharedDataClient*              iSharedDataClient;
+
+        // The central repository.
+        CRepository*                    iRepository;
+    };
+
+#endif  // DIALUTILSIMPL_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/dialutils/src/dialutilsfactimpl.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -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:  Implementation of the DialUtils factory interface.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <dialutils.h> 
+#include    "dialutilsfactimpl.h" 
+#include    "dialutilsimpl.h" 
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CDialUtilsFactImpl::CDialUtilsApiLD
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+CDialUtilsApi* CDialUtilsFactImpl::CDialUtilsApiLD()
+    {
+    CleanupStack::PushL( this );
+
+    CDialUtilsImpl* dialutils = CDialUtilsImpl::NewL();
+    CleanupStack::PopAndDestroy( this );
+    return dialutils;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CDialUtilsFactImpl::~CDialUtilsFactImpl
+// 
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CDialUtilsFactImpl::~CDialUtilsFactImpl()
+    {
+    }
+
+
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// CreateDialUtilsFactoryL
+// 
+// Creates DialUtilsFactory. This is only exported function.
+// Returns: CDialUtilsFactory*: DialUtils Factory instance.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CDialUtilsFactory* CreateDialUtilsFactoryL()
+    {
+    return new ( ELeave ) CDialUtilsFactImpl;
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/dialutils/src/dialutilsimpl.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,223 @@
+/*
+* Copyright (c) 2004-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:  Implementation of DialUtils.
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include    <featmgr.h>                 // Feature Manager.
+#include    "dialutilsimpl.h" // Interface. 
+
+#include    <centralrepository.h>       // Central repository
+#include    <settingsinternalcrkeys.h> // Settings Central Repository keys. 
+
+// CONSTANTS
+
+// Prefix change Off. See SharedDataKeys.h and SettingsInternalCRKeys.h
+const TInt KDiUtPrefixChangeOff = 0;
+// Prefix change On. See SharedDataKeys.h and SettingsInternalCRKeys.h
+const TInt KDiUtPrefixChangeOn = 1;
+
+// International prefix.
+_LIT( KDiUtIntPrefix, "+" );
+// International prefix.
+_LIT( KDiUtJapanPrefix, "+81" );
+// Zero prefix.
+_LIT( KDiUtZeroPrefix, "0" );
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CDialUtilsImpl::CDialUtilsImpl
+// 
+// C++ default constructor can NOT contain any code, that might leave.
+// -----------------------------------------------------------------------------
+//
+CDialUtilsImpl::CDialUtilsImpl()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CDialUtilsImpl::ConstructL
+// 
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CDialUtilsImpl::ConstructL()
+    {
+    // Sets up TLS, must be done before FeatureManager is used.
+    FeatureManager::InitializeLibL();
+
+    iRepository = CRepository::NewL( KCRUidTelephonySettings );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CDialUtilsImpl::NewL
+// 
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CDialUtilsImpl* CDialUtilsImpl::NewL()
+    {
+    CDialUtilsImpl* self = new( ELeave ) CDialUtilsImpl;
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CDialUtilsImpl::~CDialUtilsImpl
+// 
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CDialUtilsImpl::~CDialUtilsImpl()
+    {
+    delete iRepository;
+
+    // Frees the TLS! Must be done after FeatureManager is used.
+    FeatureManager::UnInitializeLib();
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CDialUtilsImpl::CheckNumber
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+TInt CDialUtilsImpl::CheckNumber( HBufC& aPhoneNumber )
+    {
+    TInt err = KErrNone;
+    TBool checkPrefix = 
+        FeatureManager::FeatureSupported( KFeatureIdJapanPrefixChange );
+
+    if ( checkPrefix )
+        {
+        TInt prefixMode = KDiUtPrefixChangeOff; // Default: Off.
+
+        if ( !err )
+            {
+            err = iRepository->Get(
+                KSettingsDialPrefixChangeMode,
+                prefixMode );
+
+            if ( !err )
+                {
+                // Shared data information is ok, so act according to it.
+                switch ( prefixMode )
+                    {
+                    case KDiUtPrefixChangeOff:
+                        {
+                        // Nothing needs to be done, so let the phone number to
+                        // be unchanged and just break.
+                        break;
+                        }
+
+                    case KDiUtPrefixChangeOn:
+                        {
+                        TDiUtPrefixText prefixText;
+                        
+                        err = iRepository->Get( 
+                            KSettingsDialPrefixText,
+                            prefixText );
+
+                        if ( !err )
+                            {
+                            err = CombineTexts( aPhoneNumber.Des(), prefixText );
+                            }
+                        break;
+                        }
+
+                    default:
+                        // Should never happen, value is corrupted.
+                        err = KErrCorrupt;
+                        break;
+                    }
+                }
+            }
+        }
+    return err;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CDialUtilsImpl::CombineTexts
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+TInt CDialUtilsImpl::CombineTexts(
+    TPtr aPhoneNumber,
+    const TDiUtPrefixText& aPrefixText ) const
+    {
+    TInt err = KErrNone;
+
+    TInt beginning = 0; // The beginning for replacement.
+    TInt replaceLength = 0; // The string length to be replaced.
+    TInt location = KErrNotFound; // The location of searched string.
+
+    // Try to find Japan prefix.
+    location = aPhoneNumber.Find( KDiUtJapanPrefix );
+    if ( location == beginning )
+        {
+        // The string was found, so make replacement. 
+        // Safe because zeroPrefix < KDiUtJapanPrefix.
+        replaceLength = KDiUtJapanPrefix().Length();
+        aPhoneNumber.Replace( beginning, replaceLength, KDiUtZeroPrefix );
+        }
+    else
+        {
+        // Try to find international prefix.
+        location = aPhoneNumber.Find( KDiUtIntPrefix );
+        if ( location == beginning )
+            {
+            replaceLength = KDiUtIntPrefix().Length();
+            // The string was found, so try to make replacement. 
+            const TInt phoneNumLength = aPhoneNumber.Length();
+            const TInt prefixLength = aPrefixText.Length();
+
+            TInt stringLength = 
+                ( phoneNumLength + prefixLength - replaceLength );
+
+            if ( aPhoneNumber.MaxLength() >= stringLength )
+                {
+                // There is enough space to make this replace.
+                aPhoneNumber.Replace( beginning, replaceLength, aPrefixText );
+                }
+            else
+                {
+                // There is no space to combine the strings, so inform it.
+                err = KErrOverflow;
+                }
+            }
+        }
+
+    return err;
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/dialutils/src/dialutilsmain.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,38 @@
+/*
+* 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:  Global functions for DialUtils.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32std.h>
+
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+
+// -----------------------------------------------------------------------------
+// E32Dll
+// 
+// Returns always KErrNone.
+// -----------------------------------------------------------------------------
+//
+GLDEF_C TInt E32Dll( TDllReason )
+    {
+    return KErrNone;
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/enpolicy/bmarm/dosenpolicyu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	NewEnPolicyL__Fv @ 1 NONAME R3UNUSED ; NewEnPolicyL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/enpolicy/bmarm/sosenpolicyu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	NewEnPolicyL__Fv @ 1 NONAME R3UNUSED ; NewEnPolicyL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/enpolicy/bwins/dosenpolicyu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	?NewEnPolicyL@@YAPAVCEmergencyNumberPolicy@@XZ @ 1 NONAME ; class CEmergencyNumberPolicy * NewEnPolicyL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/enpolicy/bwins/sosenpolicyu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	?NewEnPolicyL@@YAPAVCEmergencyNumberPolicy@@XZ @ 1 NONAME ; class CEmergencyNumberPolicy * NewEnPolicyL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/enpolicy/eabi/dosenpolicyu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z12NewEnPolicyLv @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/enpolicy/eabi/sosenpolicyu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,5 @@
+EXPORTS
+	_Z12NewEnPolicyLv @ 1 NONAME
+	_ZTI22CSosEnPolicySatRefresh @ 2 NONAME
+	_ZTV22CSosEnPolicySatRefresh @ 3 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/enpolicy/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* 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: Build file for dos and sos enpolicy components.
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/cemergencynumberpolicy.h         |../../../inc/cemergencynumberpolicy.h
+#ifdef __EN_POLICY_DOS
+dosenpolicy_stub.sis                 /epoc32/data/z/system/install/dosenpolicy_stub.sis
+#else
+sosenpolicy_stub.sis                 /epoc32/data/z/system/install/sosenpolicy_stub.sis
+#endif
+
+// IBY files
+../rom/enpolicy.iby                 CORE_MW_LAYER_IBY_EXPORT_PATH(enpolicy.iby)
+
+PRJ_MMPFILES
+../group/dosenpolicy.mmp
+../group/sosenpolicy.mmp
+
+PRJ_TESTMMPFILES
+// specify the .mmp files required for building any test programs here
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/enpolicy/group/dosenpolicy.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2004-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  DOS emergency number policy
+*
+*/
+
+#include <platform_paths.hrh>
+
+// Capability assignment.
+CAPABILITY CAP_GENERAL_DLL
+
+// Assign Vendor ID.
+VENDORID VID_DEFAULT
+
+TARGET          dosenpolicy.dll
+TARGETTYPE      DLL
+UID             0x101F86D1 0x101F86D2
+
+SOURCEPATH      ../src/dosenpolicy 
+SOURCE          cdosemergencynumberpolicy.cpp 
+
+USERINCLUDE     . ../inc 
+USERINCLUDE     ../inc/dosenpolicy 
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   ../../../inc
+SYSTEMINCLUDE    ../../inc // for RPhCltEmergencyCall.h
+
+LIBRARY         euser.lib
+LIBRARY         etel.lib
+LIBRARY         etelmm.lib 
+LIBRARY         customapi.lib
+LIBRARY         commonengine.lib
+LIBRARY         centralrepository.lib
+LIBRARY         cenrepnotifhandler.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/enpolicy/group/dosenpolicy_stub.pkg	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,31 @@
+;
+; 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: For packing dosenpolicy stub component.
+;
+; Languages
+&EN
+
+; Header
+#{"DosEnPolicy"}, (0x101F86D2), 1, 0, 0, TYPE=SA
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Files
+""-"z:\sys\bin\DosEnPolicy.dll"
+
+
Binary file phoneclientserver/enpolicy/group/dosenpolicy_stub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/enpolicy/group/sosenpolicy.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2004-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 SosEnPolicy component.
+*
+*/
+
+#include <platform_paths.hrh>
+
+// Capability assignment.
+CAPABILITY CAP_GENERAL_DLL
+
+// Assign Vendor ID.
+VENDORID VID_DEFAULT
+
+TARGET          sosenpolicy.dll
+TARGETTYPE      DLL
+UID             0x101F86D1 0x101F86D3
+
+SOURCEPATH      ../src/sosenpolicy 
+SOURCE          csosemergencynumberpolicymanager.cpp 
+SOURCE          csosemergencynumberpolicyhandler.cpp 
+SOURCE          csosenpolicyenlisthandler.cpp 
+SOURCE          csosenpolicysimstatusmonitor.cpp 
+SOURCE          csosenpolicysatrefresh.cpp 
+
+USERINCLUDE     . ../inc 
+USERINCLUDE     ../inc/sosenpolicy 
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   ../../../inc
+SYSTEMINCLUDE   ../../inc // for rphcltemergencycall.h 
+
+LIBRARY         euser.lib
+LIBRARY         etel.lib
+LIBRARY         etelmm.lib 
+LIBRARY         commonengine.lib
+LIBRARY         featmgr.lib
+LIBRARY         satclient.lib   // for sat refresh
+LIBRARY         centralrepository.lib
+LIBRARY         cenrepnotifhandler.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/enpolicy/group/sosenpolicy_stub.pkg	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,31 @@
+;
+; 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: For packing SosEnPolicy stub component.
+;
+; Languages
+&EN
+
+; Header
+#{"SosEnPolicy"}, (0x101F86D3), 1, 0, 0, TYPE=SA
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Files
+""-"z:\sys\bin\SosEnPolicy.dll"
+
+
Binary file phoneclientserver/enpolicy/group/sosenpolicy_stub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/enpolicy/inc/cemergencynumberpolicy.h	Wed Jul 21 18:26:52 2010 +0300
@@ -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:  Provides emergency number policy API to verify an emergency
+*                number.
+*
+*/
+
+
+
+#ifndef CEMERGENCYNUMBERPOLICY_H
+#define CEMERGENCYNUMBERPOLICY_H
+
+// INCLUDES
+#include <e32base.h>  
+#include <rphcltserver.h> 
+#include <rphcltemergencycall.h> 
+
+// CONSTANTS
+const TUid KEnPolicyUid={ 0x101F86D1 };
+// length of list in shared data.
+const TInt KEnPolicySDEmergencyNumberListLength( 100 );
+// separator between emergency numbers.
+const TText KEnPolicySDNumberSeparator =  ' ';
+
+// CLASS DECLARATION
+
+/**
+*  CEmergencyNumberPolicy
+*  Description: Defines emergency number policy.
+*
+*  @since Series60_2.6
+*/
+
+class CEmergencyNumberPolicy : public CBase
+    
+    {    
+    public:  // Abstract
+        /**
+        * Constructor.
+        * @since Series60_2.6
+        * @param aETelServer a reference of RTelServer.        
+        */     
+        virtual void ConstructL( RTelServer& aETelServer ) = 0;
+    
+        /**
+        * Emergency number check.
+        * @since Series60_2.6
+        * @param aTelNumber a telephone number to be checked.
+        * @param aMode a check mode, Normal/Advanced.
+        * @param aIsEmergencyNumber  return True if the number is emergency.                                
+        * @return error code.
+        */
+        virtual TInt IsEmergencyNumber( 
+                                TPhCltTelephoneNumber& aTelNumber, 
+                                TPhCltEmergencyNumberQueryMode aMode,
+                                TBool& aIsEmergencyNumber ) = 0;
+        
+    };
+
+#endif      // CEMERGENCYNUMBERPOLICY_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/enpolicy/inc/dosenpolicy/cdosemergencynumberpolicy.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,160 @@
+/*
+* Copyright (c) 2004-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:  Provides DOS emergency number policy API.
+*
+*/
+
+
+
+#ifndef CDOSEMERGENCYNUMBERPOLICY_H
+#define CDOSEMERGENCYNUMBERPOLICY_H
+
+// INCLUDES
+#include    <cemergencynumberpolicy.h> 
+#include    <rmmcustomapi.h>
+#include    <cenrepnotifyhandler.h>
+
+// FORWARD DECLARATIONS
+//None.
+
+
+// CLASS DECLARATION
+
+/**
+*  CDosEmergencyNumberPolicy
+*  Description: Defines DOS emergency number policy.
+*
+*  @since Series60_2.6
+*/
+
+NONSHARABLE_CLASS( CDosEmergencyNumberPolicy ) : 
+    public CEmergencyNumberPolicy,
+    private MCenRepNotifyHandlerCallback
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Destructor.
+        */
+        ~CDosEmergencyNumberPolicy();
+
+    public: // New
+
+        /**
+        * Symbian 2nd phase constructor.
+        * @param aETelServer a reference of RTelServer.
+        */
+        void ConstructL( RTelServer& aETelServer );
+
+        /**
+        * Emergency number check.
+        * @since Series60_2.6
+        * @param aTelNumber a telephone number to be checked.
+        * @param aMode a check mode, Normal/Advanced.
+        * @param aIsEmergencyNumber  return True if the number is emergency.
+        * @return error code.
+        */
+        TInt IsEmergencyNumber( 
+                                TPhCltTelephoneNumber& aTelNumber, 
+                                TPhCltEmergencyNumberQueryMode aMode,
+                                TBool& aIsEmergencyNumber );
+
+    private: // New
+
+        /** 
+        * Reads product specific numbers.
+        *
+        * @return None.
+        */
+        void ReadProductSpecificNumbers();
+
+        /** 
+        * Is number in current list with normal mode.
+        *
+        * @param aNumber This is number to be checked. 
+        * @return Returns ETrue if in list, otherwice EFalse.
+        */
+        TBool IsInListByNormalMode ( const TDesC& aNumber );
+
+        /** 
+        * Is number in current list with advanced mode.
+        *
+        * @param aNumber This is number to be checked. 
+        * @return Returns ETrue if in list, otherwice EFalse.
+        */
+        TBool IsInListByAdvancedMode ( TDes& aNumber );
+        
+        /** 
+        * Parses number in corrent format to be checked as  
+        * emergency number.
+        *
+        * @since 3.0
+        * @param aTelNumber This is number to be parsed. 
+        * @return Returns None.
+        */
+        void ParseNumber( TPhCltTelephoneNumber& aTelNumber );
+        
+    private: // From MCenRepNotifyHandlerCallback
+
+        void HandleNotifyString( TUint32 aId, const TDesC16& aNewValue );
+        
+    private:// Data
+
+        // The RTelServer instance.
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        RTelServer                                   iETelServer;
+
+        // The RMobilePhone instance.
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        RMobilePhone                                 iMobilePhone;
+
+        // The CustomAPI instance.
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        RMmCustomAPI                                 iCustomPhone;
+
+        // The information if advanced Emergency check is supported.
+        TBool                                        iAdvancedCheck;
+
+
+        // The product specific emergency numbers.
+        TBuf< KEnPolicySDEmergencyNumberListLength > iProductSpecificList;
+
+        /**
+         * CenRep, needed by listener
+         * 
+         * Own
+         */
+        CRepository* iCenRep;
+        
+        /**
+         * CenRep listener
+         * 
+         * Own
+         */
+        CCenRepNotifyHandler* iListener;
+        
+    };
+
+#endif  // CDOSEMERGENCYNUMBERPOLICY_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/enpolicy/inc/sosenpolicy/csosemergencynumberpolicyhandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,218 @@
+/*
+* Copyright (c) 2004-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:  Provides SOS emergency number policy API implementation.
+*
+*/
+
+
+
+#ifndef CSOSEMERGENCYNUMBERPOLICYHANDLER_H
+#define CSOSEMERGENCYNUMBERPOLICYHANDLER_H
+
+// INCLUDES
+#include    "csosemergencynumberpolicymanager.h" 
+#include    "csosenpolicysimstatusmonitor.h" 
+#include    "csosenpolicyenlisthandler.h" 
+#include    <mmretrieve.h>
+#include    <e32property.h>
+
+// DATA TYPES
+/*
+*   EEnPolicyPanicSystemAgentConnectionFailure     System agent failure.
+*/
+    enum TEnPolicyPanic
+        {
+        EEnPolicyPanicCentralRepositoryConnectionFailure = 0
+        };
+
+// FORWARD DECLARATIONS
+class CSosEnPolicySimStatusMonitor;
+class CSosEnPolicyENListHandler;
+class CRepository;
+class RSatSession;
+class RSatRefresh;
+
+// CLASS DECLARATION
+
+/**
+*  Active object to handle the Publish&Subscriber notify
+*  
+*  @since Series 60 Series60_2.8
+*/
+NONSHARABLE_CLASS( CSosEnPolicyActive ) : public CActive
+    {
+    public: // Constructors and destructor
+        /**
+        * Constructor.
+        */
+        CSosEnPolicyActive( 
+            CSosEmergencyNumberPolicyHandler& aEmergNumHandler );
+
+        /**
+        * Destructor.
+        */
+        ~CSosEnPolicyActive();
+
+    private: // Derived from CActive
+
+        /** 
+        * @see CActive::DoCancel()
+        */
+        void DoCancel();
+
+        /**
+        * @see CActive::RunL()
+        */
+        void RunL();
+
+    private: // Data
+        CSosEmergencyNumberPolicyHandler&   iEmergNumHandler;
+
+    };
+
+
+/**
+*  CSosEmergencyNumberPolicyHandler
+*  Description: Defines SOS emergency number policy.
+*
+*  @since Series60_2.6
+*/
+NONSHARABLE_CLASS( CSosEmergencyNumberPolicyHandler ) : 
+    public CActive
+    {
+    public:  // Constructors and destructor
+      
+        /**
+        * Two-phased constructor.
+        * @param aETelServer a reference of RTelServer.
+        * @return a instance of SOS emergency number policy handler.
+        */
+        static CSosEmergencyNumberPolicyHandler* NewL( 
+            RTelServer& aETelServer );
+
+        /**
+        * Destructor.
+        */
+        ~CSosEmergencyNumberPolicyHandler();
+
+    public: // New
+        /**
+        * Emergency number check.
+        * @param aTelNumber a telephone number to be checked.
+        * @param aMode a check mode, Normal/Advanced.
+        * @param aIsEmergencyNumber  return True if the number is emergency.
+        * @return error code.
+        */
+        TInt IsEmergencyNumber( 
+                                TPhCltTelephoneNumber& aTelNumber, 
+                                TPhCltEmergencyNumberQueryMode aMode,
+                                TBool& aIsEmergencyNumber );
+
+        /**
+        * SIM Emergency numbers action status.
+        */
+        enum TSosEnPolicySimEmergencyNumberAction 
+            {
+            // Reads emergency numbers from SIM
+            ESosEnPolicySimEmergencyNumberRead,
+            // Clears emergency numbers in SIM
+            ESosEnPolicySimEmergencyNumberClear
+            };
+
+        /**
+        * Observer for SIM status changes.
+        *
+        * @param aAction Action to be handled.
+        */
+        void CpsssmHandleSimStatusEvent( 
+            TSosEnPolicySimEmergencyNumberAction aAction );
+
+    private:  // Functions from base classes
+
+        /** 
+        * @see CActive::DoCancel()
+        */
+        void DoCancel();
+
+        /**
+        * @see CActive::RunL()
+        */
+        void RunL();
+
+        /**
+        * From CActive
+        */
+        TInt RunError( TInt aError );
+
+    private:
+
+        /** 
+        * Initializes values to Central Repository list.
+        */
+        void InitializeCentralRepositoryList();
+
+    private:
+        /**
+        * C++ default constructor.
+        */
+        CSosEmergencyNumberPolicyHandler();
+
+        /**
+        * Symbian 2nd phase constructor is private.
+        * @param aETelServer a reference of RTelServer.
+        */
+        void ConstructL( RTelServer& aETelServer );
+
+    private:// Data
+
+        // The RMobilePhone instance.
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        RMobilePhone                    iMobilePhone;
+
+        // SIM status monitor
+        CSosEnPolicySimStatusMonitor*   iSimMonitor;
+
+        // Emergency Number list handler
+        CSosEnPolicyENListHandler*  iENListHandler;
+
+        // Reads Emergency Number list from the phone or SIM store.
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        CRetrieveMobilePhoneENList*     iSimEnRetriver;
+
+        // Storage for emergency number read.
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        RMobileENStore                  iENStore;
+
+        // Central repository instance.
+        CRepository*                    iCenRepSession;
+
+        // Sat refresh listener
+        CSosEnPolicySatRefresh* iSatRefresh;
+        
+        //Sim state
+        TInt iSimState;
+        
+    };
+
+#endif  // CSOSEMERGENCYNUMBERPOLICYHANDLER_H
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/enpolicy/inc/sosenpolicy/csosemergencynumberpolicymanager.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2004-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:  Provides SOS emergency number policy API.
+*
+*/
+
+
+
+#ifndef CSOSEMERGENCYNUMBERPOLICYMANAGER_H
+#define CSOSEMERGENCYNUMBERPOLICYMANAGER_H
+
+// INCLUDES
+#include <cemergencynumberpolicy.h> 
+
+// FORWARD DECLARATIONS
+class CSosEmergencyNumberPolicyHandler;
+class CSosEnPolicySatRefresh;
+
+// CLASS DECLARATION
+
+/**
+*  CSosEmergencyNumberPolicyManager
+*  Description: Defines SOS emergency number policy.
+*
+*  @since Series60_2.6
+*/
+
+NONSHARABLE_CLASS( CSosEmergencyNumberPolicyManager ) : 
+    public CEmergencyNumberPolicy
+    {
+    public:  // Constructors and destructor
+      
+        /**
+        * Symbian 2nd phase constructor is private.
+        * @param aETelServer a reference of RTelServer.
+        */
+        void ConstructL(  RTelServer& aETelServer );
+
+        /**
+        * Destructor.
+        */
+        ~CSosEmergencyNumberPolicyManager();
+        
+    public: // New
+        /**
+        * Emergency number check.
+        * @param aTelNumber a telephone number to be checked.
+        * @param aMode a check mode, Normal/Advanced.
+        * @param aIsEmergencyNumber  return True if the number is emergency.                                
+        * @return error code.
+        */
+        TInt IsEmergencyNumber( 
+                                TPhCltTelephoneNumber& aTelNumber, 
+                                TPhCltEmergencyNumberQueryMode aMode,
+                                TBool& aIsEmergencyNumber );  
+           
+    private:// Data
+
+        // Pointer to the instance of SOS emergency number handler.
+        CSosEmergencyNumberPolicyHandler* iSosEnPolicyHandler;
+
+    };
+
+#endif  // CSOSEMERGENCYNUMBERPOLICYMANAGER_H
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/enpolicy/inc/sosenpolicy/csosenpolicyenlisthandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,154 @@
+/*
+* Copyright (c) 2004-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:  Monitoring startup and reading/writing to shared data.
+*
+*/
+
+
+
+#ifndef CSOSENPOLICYENLISTHANDLER_H
+#define CSOSENPOLICYENLISTHANDLER_H
+
+
+// INCLUDES
+#include    "csosemergencynumberpolicyhandler.h" 
+#include    <rphcltserver.h> 
+#include    <cenrepnotifyhandler.h>
+
+// FORWARD DECLARATIONS
+
+
+// CLASS DECLARATION
+
+/**
+*  It is the monitor for startup status, and provides services for
+*  reading and writing to/from shared data.
+*
+*  @since Series60_2.6
+*/
+NONSHARABLE_CLASS( CSosEnPolicyENListHandler ) : public CBase,
+    public MCenRepNotifyHandlerCallback
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Creates a new monitor and starts it.
+        *
+        * @return Pointer to created CSosEnPolicyENListHandler instance.
+        */
+
+        static CSosEnPolicyENListHandler* NewL(); 
+            
+        /**
+        * Destructor.
+        */
+        ~CSosEnPolicyENListHandler();
+
+    public: // New functions
+
+        /** 
+        * Reads product specific numbers.
+        *
+        * @return Returns space separated list of emergency numbers, in case
+        *         of error, empty list is returned.
+        */
+        const TDesC& ReadProductSpecificNumbers();
+
+        /** 
+        * Adds Emergency number to list to be written to Central Repository
+        *
+        * @param aNumber This is emergency number to be added.
+        * @param aPermanent If this is set to ETrue, number will not be
+        *                   cleared with ClearCurrentList function.
+        *                   For numbers which are read in the startup.
+        *   Permanent numbers should be written first. Also adding new permanent
+        *   number removes all non permanent numbers.
+        */
+        void AddToList( const TDesC& aNumber, TBool aPermanent = EFalse );
+
+        /** 
+        * Clears Current list.
+        * Does not touch to permanent numbers.
+        */
+        void ClearCurrentList();
+
+        /** 
+        * Writes current list to Central Repository.
+        */
+        void WriteListToCentralRepository();
+
+        /** 
+        * Is number in current list with normal mode.
+        *
+        * @param aNumber This is number to be checked. 
+        * @return Returns ETrue if in list, otherwice EFalse.
+        */
+        TBool IsInListByNormalMode ( const TDesC& aNumber );
+
+        /** 
+        * Is number in current list with advanced mode.
+        *
+        * @param aNumber This is number to be checked. 
+        * @return Returns ETrue if in list, otherwice EFalse.
+        */
+        TBool IsInListByAdvancedMode ( TDes& aNumber );
+
+    private: // From MCenRepNotifyHandlerCallback
+
+        void HandleNotifyString( TUint32 aId, const TDesC16& aNewValue );
+
+    private:
+
+        /** 
+        * C++ constructor.
+        *
+        */
+
+        CSosEnPolicyENListHandler();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private:  // Data
+
+        // Central repository instance.
+        CRepository*    iRepository;
+
+        // The product specific emergency numbers.
+        TBuf< KEnPolicySDEmergencyNumberListLength >   iProductSpecificList;
+
+        // The current emergency number list.
+        TBuf< KEnPolicySDEmergencyNumberListLength >   iCurrentList;
+
+        // The current place in the emergency number list.
+        TInt    iCurrentListPlace;
+
+        // The start point of current emergency number list.
+        TInt    iCurrentListStart;
+
+        /**
+         * CenRep listener
+         * 
+         * Own
+         */
+        CCenRepNotifyHandler* iListener;
+
+    };
+
+#endif  // CSOSENPOLICYENLISTHANDLER_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/enpolicy/inc/sosenpolicy/csosenpolicysatrefresh.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,123 @@
+/*
+* 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:  Monitors sat refresh for cbsserver
+*
+*/
+
+
+
+#ifndef CSOSENPOLICYSATREFRESH_H
+#define CSOSENPOLICYSATREFRESH_H
+
+//  INCLUDES
+#include <etelmm.h>
+#include <msatrefreshobserver.h>
+
+// FORWARD DECLARATIONS
+class RSatSession;
+class RSatRefresh;
+
+// CLASS DECLARATION
+
+/**
+*  Monitors sat refresh for cbsserver
+*
+*/
+class CSosEnPolicySatRefresh : public CActive, public MSatRefreshObserver
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CSosEnPolicySatRefresh* NewL( CSosEmergencyNumberPolicyHandler& aCSosEmergencyNumberPolicyHandler );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CSosEnPolicySatRefresh();
+        
+                      
+    private:
+        
+        /**
+        * C++ default constructor.
+        */
+        CSosEnPolicySatRefresh( CSosEmergencyNumberPolicyHandler& aCSosEmergencyNumberPolicyHandler );
+                                  
+                                  
+        /**
+        * Refresh query. Client should determine whether it allow the
+        * refresh to happen. In this method the client should not close or
+        * cancel the RSatRefresh subsession.
+        * @since 2.6
+        * @param aType Refresh type.
+        * @param aFiles Elementary files which are to be changed. 
+        * May be zero length. 
+        * @return ETrue to allow refresh, EFalse to decline refresh.
+        */
+        TBool AllowRefresh( TSatRefreshType aType, const TSatRefreshFiles& aFiles );
+
+        /**
+        * Notification of refresh. In this method the client should not close 
+        * or cancel the RSatRefresh subsession.
+        * @since 2.6
+        * @param aType Type of refresh which has happened.
+        * @param aFiles List of elementary files which has been changed. 
+        * May be zero length.
+        */
+        void Refresh( TSatRefreshType aType, const TSatRefreshFiles& aFiles );
+        
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        /** 
+        * @Activates property listening
+        * @param None.
+        */
+        void IssueRequest();
+        
+        private: // Functions from base classes
+
+        /** 
+        * @see CActive::RunL() 
+        */
+        void DoCancel();
+
+        /** 
+        * @see CActive::RunL() 
+        */
+        void RunL();
+        
+        private:    // Data
+        
+            // Reference to cbsserver
+              CSosEmergencyNumberPolicyHandler& iCSosEmergencyNumberPolicyHandler;
+              // Sat session connection.
+              RSatSession* iSatSession;
+              // Sat refresh connection
+            RSatRefresh* iSatRefresh;
+            // Is refresh allowed to do.
+            TBool iAllowRefresh;    
+            // The RProperty to listen system global state..
+            RProperty iProperty;
+    };
+
+#endif      // CSOSENPOLICYSATREFRESH_H   
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/enpolicy/inc/sosenpolicy/csosenpolicysimstatusmonitor.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2004-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:  Monitoring status of sim for emergency numbers.
+*
+*/
+
+
+
+#ifndef CSOSENPOLICYSIMSTATUSMONITOR_H
+#define CSOSENPOLICYSIMSTATUSMONITOR_H
+
+
+// INCLUDES
+#include "csosemergencynumberpolicyhandler.h" 
+
+#include <e32base.h>            // CActive
+#include <e32property.h>        // RProperty
+
+
+// FORWARD DECLARATIONS
+class CSosEmergencyNumberPolicyHandler;
+class RSystemAgent;
+class TSysAgentEvent;
+
+
+// CLASS DECLARATION
+
+/**
+*  It is the SIM monitor class for Emergency number manager.
+*
+*  @since Series60_2.6 
+*/
+NONSHARABLE_CLASS( CSosEnPolicySimStatusMonitor ) : public CActive
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Creates a new monitor and starts it.
+        *
+        * @param aObserver The observer class of the SIM status changes.
+        * @return Pointer to created CSosEnPolicySimStatusMonitor instance.
+        */
+        static CSosEnPolicySimStatusMonitor* NewL( 
+            CSosEmergencyNumberPolicyHandler& aObserver );
+       
+        /**
+        * Destructor.
+        */
+        ~CSosEnPolicySimStatusMonitor();
+
+    public: // New functions
+        /** 
+        * Is SIM reading allowed?
+        *
+        * @return Returns ETrue, if SIM reading is allowed.
+        */
+        TBool IsReadingAllowed();
+
+
+    private: // Functions from base classes
+
+        /** 
+        * @see CActive::RunL() 
+        */
+        void DoCancel();
+
+        /** 
+        * @see CActive::RunL() 
+        */
+        void RunL();
+        
+
+    private: // New functions
+
+        /** 
+        * Requests notifications from system agent.
+        */
+        void IssueRequest();
+        
+        /** 
+        * Translates system agent's state information.
+        * 
+        * @param aState This is the state from SA.
+        */
+        TBool TranslateState( TInt aState );
+
+    private:
+        /**
+        * C++ constructor.
+        * @param aObserver The observer class of the SIM status changes.
+        */
+        CSosEnPolicySimStatusMonitor( CSosEmergencyNumberPolicyHandler& aObserver );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+
+    private:  // Data
+
+        // The Observer for events.
+        CSosEmergencyNumberPolicyHandler& iObserver;
+
+        // The RProperty to replace System agent.
+        RProperty                         iProperty;
+
+    };
+
+#endif  // CSOSENPOLICYSIMSTATUSMONITOR_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/enpolicy/rom/enpolicy.iby	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,32 @@
+/*
+* 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:  Emergency number policy
+*
+*/
+
+
+#ifndef __ENPOLICY_IBY__
+#define __ENPOLICY_IBY__
+
+#ifdef __EN_POLICY_DOS
+file = ABI_DIR\BUILD_DIR\dosenpolicy.dll                SHARED_LIB_DIR\dosenpolicy.dll
+data=ZSYSTEM\install\dosenpolicy_stub.sis               system\install\dosenpolicy_stub.sis
+#else
+file = ABI_DIR\BUILD_DIR\sosenpolicy.dll                SHARED_LIB_DIR\sosenpolicy.dll
+data=ZSYSTEM\install\sosenpolicy_stub.sis               system\install\sosenpolicy_stub.sis
+#endif
+
+#endif // __ENPOLICY_IBY__
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/enpolicy/src/dosenpolicy/cdosemergencynumberpolicy.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,399 @@
+/*
+* Copyright (c) 2004-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:  Provides DOS emergency number policy API implementation.
+*
+*/
+
+
+// INCLUDE FILES
+#include "cdosemergencynumberpolicy.h" 
+#include <mmtsy_names.h>
+#include <telservicesvariant.hrh>
+
+#include <centralrepository.h>
+#include <telservicesinternalcrkeys.h>
+#include <defaultemergencynumberscrkeys.h>
+
+// CONSTANT
+const TInt KDosEmergencyNumberMaxLength = 6;
+//Prefix for Sip.
+_LIT( KSipPrefix, "sip:" );
+//Prefix for Tel.
+_LIT( KTelPrefix, "tel:" );
+//Prefix for Sos.
+_LIT( KSosPrefix, "sos:" );
+// @ char
+_LIT( KAt, "@" );
+// Prefix length
+const TInt KPrefixLength = 4;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CDosEmergencyNumberPolicy::~CDosEmergencyNumberPolicy()
+// -----------------------------------------------------------------------------
+//
+CDosEmergencyNumberPolicy::~CDosEmergencyNumberPolicy()
+    {
+    if ( iListener )
+        {
+        iListener->StopListening();
+        delete iListener;
+        }
+    delete iCenRep;
+
+    iProductSpecificList.Zero();
+
+    iCustomPhone.Close();
+    iMobilePhone.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CDosEmergencyNumberPolicy::ConstructL()
+// -----------------------------------------------------------------------------
+//
+void CDosEmergencyNumberPolicy::ConstructL( RTelServer& aETelServer )
+    {
+    iETelServer = aETelServer;
+
+    User::LeaveIfError( iMobilePhone.Open( iETelServer , KMmTsyPhoneName ) );
+    User::LeaveIfError( iCustomPhone.Open( iMobilePhone) );
+
+    TInt variantReadOnlyValues = 0;
+    TInt err = KErrNone;
+
+    CRepository* variationFlags = CRepository::NewL( KCRUidTelSrvVariation );
+    err = variationFlags->Get( KTelSrvVariationFlags , variantReadOnlyValues );
+
+    if ( err != KErrNotFound )
+        {
+        User::LeaveIfError( err );
+        }  
+
+    if ( KTelSrvLVFlagAdvancedENCheck & variantReadOnlyValues )
+        {
+        iAdvancedCheck = ETrue;
+        }
+    else
+        {
+        iAdvancedCheck = EFalse;
+        }
+    
+    delete variationFlags;
+
+    iCenRep = CRepository::NewL( KCRUidDefaultEmergencyNumbers );    
+    iListener = CCenRepNotifyHandler::NewL( 
+        *this, 
+        *iCenRep, 
+        CCenRepNotifyHandler::EStringKey, 
+        KDefaultEmergencyNumbersList );
+    
+    iListener->StartListeningL();
+    
+    ReadProductSpecificNumbers();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CDosEmergencyNumberPolicy::IsEmergencyNumberL 
+// 
+// -----------------------------------------------------------------------------
+//
+TInt CDosEmergencyNumberPolicy::IsEmergencyNumber ( 
+                                    TPhCltTelephoneNumber& aTelNumber, 
+                                    TPhCltEmergencyNumberQueryMode aMode,
+                                    TBool& aIsEmergencyNumber )
+    {   
+    TPhCltTelephoneNumber checkedTelNumber(aTelNumber);
+    ParseNumber( checkedTelNumber );
+    aIsEmergencyNumber = EFalse;
+    RMmCustomAPI::TEmerNumberCheckMode  checkedNumberMode;
+    if ( checkedNumberMode.iNumber.MaxLength() >= checkedTelNumber.Length() ) // aTelNumber -> checkedTelNumber
+        {
+        checkedNumberMode.iNumber = checkedTelNumber; // aTelNumber -> checkedTelNumber
+        }
+    else
+        {
+        // too long, cannot be checked
+        return KErrArgument;
+        }
+
+    // set check type
+    switch ( aMode )
+        {
+        case EPhCltEmergencyNumberQueryModeAdvanced:
+            {
+            // check if it is a product specific number.
+            if ( IsInListByAdvancedMode( checkedTelNumber ) ) // aTelNumber -> checkedTelNumber
+                {
+                aTelNumber = checkedTelNumber; // aTelNumber -> checkedTelNumber
+                aIsEmergencyNumber = ETrue;
+                return KErrNone;
+                }
+            
+            // if TSY doesn't support advanced mode, then check by S60 advanced mode
+            // based on TSY normal mode check.
+            if ( ! iAdvancedCheck )
+                {
+                TInt length = 
+                    Min( checkedTelNumber.Length(), KDosEmergencyNumberMaxLength ); // aTelNumber -> checkedTelNumber
+                checkedNumberMode.iCheckMode = RMmCustomAPI::EEmerNumberCheckNormal;
+
+                TInt result = KErrArgument;
+                while ( ( length > 0 ) && ! aIsEmergencyNumber )
+                    {
+                    checkedNumberMode.iNumber = checkedTelNumber.Right( length ); // aTelNumber -> checkedTelNumber
+                    result = iCustomPhone.CheckEmergencyNumber( 
+                            checkedNumberMode, aIsEmergencyNumber );
+
+                    if ( result == KErrNone && aIsEmergencyNumber )
+                        {
+                        aTelNumber = checkedNumberMode.iNumber;
+                        }
+
+                    length--;
+                    }
+
+                return result;
+                }
+            else
+                {
+                checkedNumberMode.iCheckMode = 
+                    RMmCustomAPI::EEmerNumberCheckAdvanced;
+                }
+            }
+            break;
+        case EPhCltEmergencyNumberQueryModeNormal:
+        case EPhCltEmergencyNumberQueryModeNormalWriteback:
+            // check if it is a product specific number.
+            if ( IsInListByNormalMode( checkedTelNumber ) ) // aTelNumber -> checkedTelNumber
+                {
+                aTelNumber = checkedTelNumber; // aTelNumber -> checkedTelNumber
+                aIsEmergencyNumber = ETrue;
+                return KErrNone;
+                }
+
+            // flow thru
+        default:
+            checkedNumberMode.iCheckMode = 
+                RMmCustomAPI::EEmerNumberCheckNormal;
+            break;
+        }
+
+    // do checking   
+    TInt err = iCustomPhone.CheckEmergencyNumber ( 
+      checkedNumberMode, aIsEmergencyNumber );
+
+    aTelNumber = checkedNumberMode.iNumber;
+   
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CDosEmergencyNumberPolicy::ReadProductSpecificNumbers
+// 
+// Reads product specific values from central repository
+// -----------------------------------------------------------------------------
+//
+void CDosEmergencyNumberPolicy::ReadProductSpecificNumbers()
+    {
+    // This is done only once in bootup phase.
+    iProductSpecificList.Zero();
+
+    TInt err = KErrNone;
+
+
+        err = iCenRep->Get( KDefaultEmergencyNumbersList, 
+                                iProductSpecificList );
+
+    if ( err != KErrNone )
+        {
+        // just to make sure, if central repository has modified it,
+        // even when there was an error.
+        iProductSpecificList.Zero();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CDosEmergencyNumberPolicy::IsInListByAdvancedMode
+// 
+// Checks if the number is in list by advanced mode check.
+//
+// -----------------------------------------------------------------------------
+//
+TBool CDosEmergencyNumberPolicy::IsInListByAdvancedMode ( TDes& aNumber )
+    {    
+    TLex list( iProductSpecificList );
+    TLexMark mark;
+    TPtrC token_candidate( KNullDesC() ) ; 
+    
+    for ( TInt i = 0; i < KEnPolicySDEmergencyNumberListLength; i++ )
+        {
+        list.Mark( mark );
+        list.SkipCharacters();
+        TPtrC token;
+        token.Set( list.MarkedToken( mark ) );
+        if ( token.Length() && ( token == aNumber.Right( token.Length() ) ) )
+            {
+            // _DDPRINT( 4, "ENPolicy.SDM.IsInListAdvanced.ok.", place );
+            if( token_candidate == KNullDesC )
+                { 
+                token_candidate.Set( token ); 
+                } 
+            else 
+                { 
+                if( token.Length() > token_candidate.Length() ) 
+                    { 
+                    token_candidate.Set( token );                          
+                    } 
+                } 
+            } 
+        list.Inc(); 
+        } 
+        
+    if( token_candidate != KNullDesC ) 
+        { 
+        aNumber = token_candidate; 
+        return ETrue; 
+        }    
+
+    return EFalse;   
+    }
+
+// -----------------------------------------------------------------------------
+// CDosEmergencyNumberPolicy::IsInListByNormalMode
+// 
+// Checks if the number is in list by normal mode check.
+//
+// -----------------------------------------------------------------------------
+//
+TBool CDosEmergencyNumberPolicy::IsInListByNormalMode( const TDesC& aNumber )
+    {
+    TInt length = aNumber.Length();
+    TInt place = iProductSpecificList.Find( aNumber ); // first number of aNumber
+
+    // _DDPRINT( 4, "ENPolicy.SDM.IsInListNormal.ok.", place );    // debug print
+
+    if ( place < 0 )
+        {
+        // negative value is an error, not found!
+        // return immediately
+        return EFalse;
+        }
+
+    TInt endOfMatch = place + length; // end of number + 1
+
+    // we check the begining
+    if ( place > 0 )
+        {
+        // we are not in the begining of buffer, so we have to check
+        // char before that
+        if ( iProductSpecificList[ place -1 ] != KEnPolicySDNumberSeparator )
+            {
+            // this was just a substring numbers before that
+            return EFalse;
+            }
+        }
+
+    // beginning was ok, so we can continue
+    
+    // now checking the end
+    // there must be atleast one empty space in the end that
+    // we do the checking of number end.
+    if ( endOfMatch < ( iProductSpecificList.Length() - 2 ) )
+        {
+        if ( iProductSpecificList[ endOfMatch ] != KEnPolicySDNumberSeparator )
+            {
+            return EFalse;
+            }
+        }
+        
+    //match is wrong, only part of ememergency number is matched
+    int newmatchlen = 0;
+    for (int i = place; i < iProductSpecificList.Length(); i++)
+        {
+        if(iProductSpecificList [i] != KEnPolicySDNumberSeparator )
+            newmatchlen++;
+        else
+            break;  
+        }
+        
+        if (length != newmatchlen)
+            {
+            return EFalse;
+            }
+        
+
+    // if we get so far, its ok.
+    return ETrue;
+    }
+    
+// -----------------------------------------------------------------------------
+// CDosEmergencyNumberPolicy::ParserNumber
+// 
+// Removes sip prefixis beging of the number and end of the number after @ char.
+// @ character is also removed.
+//
+// -----------------------------------------------------------------------------
+//
+void CDosEmergencyNumberPolicy::ParseNumber( TPhCltTelephoneNumber& aTelNumber )
+    {
+    // Does number contains prefix. If yes then remove it
+    
+    if ( 0 == aTelNumber.FindC( KSipPrefix ) ||
+         0 == aTelNumber.FindC( KTelPrefix ) ||
+           0 == aTelNumber.FindC( KSosPrefix ) )
+        {
+        aTelNumber.Delete( 0, KPrefixLength );
+          }
+        // Does Number contains domain part. If yes remove it at beging of @ character.
+      TInt atIndex = aTelNumber.Find( KAt );
+      TInt telNumberLength = aTelNumber.Length();
+        if ( 0 < atIndex && 
+             atIndex < telNumberLength )
+        {
+            aTelNumber.Delete( atIndex, telNumberLength - atIndex );
+            }
+    }
+
+// -----------------------------------------------------------------------------
+// CDosEmergencyNumberPolicy::HandleNotifyString
+// 
+// Inherited from MCenRepNotifyHandlerCallback.
+// -----------------------------------------------------------------------------
+//
+void CDosEmergencyNumberPolicy::HandleNotifyString( 
+    TUint32 aId, const TDesC16& aNewValue )
+    {
+    if( aId == KDefaultEmergencyNumbersList )
+        {
+        iProductSpecificList.Zero();
+        iProductSpecificList.Copy( aNewValue );
+        }
+
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// NewEnPolicy()
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CEmergencyNumberPolicy* NewEnPolicyL()
+    {
+    return new (ELeave) CDosEmergencyNumberPolicy;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/enpolicy/src/sosenpolicy/csosemergencynumberpolicyhandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,350 @@
+/*
+* Copyright (c) 2004-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:  Provides SOS emergency number policy API implementation.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "csosemergencynumberpolicyhandler.h" 
+#include    <mmtsy_names.h>
+#include    <featmgr.h>
+#include    <bldvariant.hrh>
+#include    <telservicesvariant.hrh>
+#include    <telservicesinternalcrkeys.h>
+#include    <centralrepository.h>
+#include "csosenpolicysatrefresh.h" 
+
+// CONSTANTS
+// The default emergency numbers.
+_LIT( KEnPolicyUnivEmergencyNumber, "112" );
+_LIT( KEnPolicyUSEmergencyNumber, "911" );      // U.S.A
+_LIT( KEnPolicyUKEmergencyNumber, "999" );      // U.K
+_LIT( KEnPolicyAUEmergencyNumber, "000" );      // Australian
+_LIT( KEnPolicyMXEmergencyNumber, "08" );       // Mexico
+_LIT( KEnPolicyAPACEmergencyNumber, "110" );    // APAC countries, Germany
+_LIT( KEnPolicyJapanEmergencyNumber, "118" );   // Japan
+_LIT( KEnPolicyJapanEmergencyNumber2, "119" );  // Japan
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSosEnPolicyActive::CSosEnPolicyActive()
+// 
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+CSosEnPolicyActive::CSosEnPolicyActive( 
+    CSosEmergencyNumberPolicyHandler& aEmergNumHandler )
+    : CActive( CActive::EPriorityStandard ), iEmergNumHandler ( aEmergNumHandler )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CSosEnPolicyActive::~CSosEnPolicyActive()
+// -----------------------------------------------------------------------------
+//
+CSosEnPolicyActive::~CSosEnPolicyActive()
+    {    
+    Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CSosEnPolicyActive::RunL()
+// 
+// -----------------------------------------------------------------------------
+//
+void CSosEnPolicyActive::RunL()
+    {
+    iEmergNumHandler.CpsssmHandleSimStatusEvent( 
+        CSosEmergencyNumberPolicyHandler::ESosEnPolicySimEmergencyNumberRead );
+    }
+
+// -----------------------------------------------------------------------------
+// CSosEnPolicyActive::DoCancel()
+// 
+// -----------------------------------------------------------------------------
+//
+void CSosEnPolicyActive::DoCancel()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CSosEmergencyNumberPolicyHandler::CSosEmergencyNumberPolicyHandler()
+// 
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+CSosEmergencyNumberPolicyHandler::CSosEmergencyNumberPolicyHandler() 
+    : CActive( CActive::EPriorityStandard )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CSosEmergencyNumberPolicyImp::NewL()
+// 
+// -----------------------------------------------------------------------------
+//
+CSosEmergencyNumberPolicyHandler* CSosEmergencyNumberPolicyHandler::NewL( 
+    RTelServer& aETelServer )
+    {
+    CSosEmergencyNumberPolicyHandler* self = 
+        new(ELeave) CSosEmergencyNumberPolicyHandler();
+    CleanupStack::PushL( self );
+    self->ConstructL( aETelServer );
+    CleanupStack::Pop();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CSosEmergencyNumberPolicyHandler::~CSosEmergencyNumberPolicyHandler()
+// -----------------------------------------------------------------------------
+//
+CSosEmergencyNumberPolicyHandler::~CSosEmergencyNumberPolicyHandler()
+    {    
+    Cancel(); // also deletes requester if there is one
+    
+    delete iSatRefresh;
+    // both cancel operations in destructors.
+    delete iSimMonitor;
+    delete iENListHandler;
+
+    iENStore.Close();
+
+    FeatureManager::UnInitializeLib();
+    iMobilePhone.Close();
+    
+    delete iCenRepSession;
+    }
+
+// -----------------------------------------------------------------------------
+// CSosEmergencyNumberPolicyHandler::ConstructL()
+// -----------------------------------------------------------------------------
+//
+void CSosEmergencyNumberPolicyHandler::ConstructL( RTelServer& aETelServer )
+    {
+    FeatureManager::InitializeLibL();
+
+    User::LeaveIfError( iMobilePhone.Open( aETelServer , KMmTsyPhoneName ) );
+
+    // Create sat refresh listener
+    iSatRefresh = CSosEnPolicySatRefresh::NewL( *this );
+    
+    iSimMonitor = CSosEnPolicySimStatusMonitor::NewL( *this );
+
+    iENListHandler =  CSosEnPolicyENListHandler::NewL() ;
+
+    User::LeaveIfError( iENStore.Open( iMobilePhone ) );
+
+    InitializeCentralRepositoryList();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CSosEmergencyNumberPolicyHandler::IsEmergencyNumberL 
+// 
+// -----------------------------------------------------------------------------
+//
+TInt CSosEmergencyNumberPolicyHandler::IsEmergencyNumber ( 
+                                    TPhCltTelephoneNumber& aTelNumber, 
+                                    TPhCltEmergencyNumberQueryMode aMode,
+                                    TBool& aIsEmergencyNumber )
+                                  
+    {
+    if ( aMode == EPhCltEmergencyNumberQueryModeAdvanced )
+        {
+        aIsEmergencyNumber = iENListHandler->IsInListByAdvancedMode( aTelNumber );
+        }
+    else
+        {
+        aIsEmergencyNumber = iENListHandler->IsInListByNormalMode( aTelNumber ); 
+        }
+    
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CSosEmergencyNumberPolicyHandler::CpsssmHandleSimStatusEvent()
+// 
+// SIM event occurred, it's either for adding or removing
+// SIM emergency numbers. If SIM is rejected or removed
+// SIM emergency numbers are removed.
+//
+// Old list is cleared only if new list is received. Otherwise
+// it's stays valid.
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+void  CSosEmergencyNumberPolicyHandler::CpsssmHandleSimStatusEvent(
+    TSosEnPolicySimEmergencyNumberAction aAction )
+    {
+    // If not null there is something ongoing which should be cancelled first.
+    if ( iSimEnRetriver )
+        {
+        Cancel(); // retriever is also deleted.
+        }
+    
+    // We need to read new numbers.
+    if ( aAction == ESosEnPolicySimEmergencyNumberRead )
+        {
+        TInt err = KErrNone;
+
+        // _DPRINT( 4, "ENPolicy.EN.SimNumbers.create" );          // debug print
+
+        // The retrieve may fail, that possibility is TRAPed here.
+        TRAP( err, iSimEnRetriver = 
+            CRetrieveMobilePhoneENList::NewL( iENStore ) );
+
+        // _DDPRINT( 4, "ENPolicy.EN.SimNumbers.create.ok.", err ); // debug print
+
+        if( err == KErrNone )
+            {
+            iSimEnRetriver->Start( iStatus );
+            SetActive();
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CSosEmergencyNumberPolicyHandler::DoCancel()
+// 
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+void CSosEmergencyNumberPolicyHandler::DoCancel()
+    {
+    if ( iSimEnRetriver )
+        {
+        iSimEnRetriver->Cancel();
+        delete iSimEnRetriver;
+        iSimEnRetriver = NULL;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CSosEmergencyNumberPolicyHandler::RunL()
+// 
+// Number fetch complete. In case of error we stick to that
+// what we have, or use default list.
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+void CSosEmergencyNumberPolicyHandler::RunL()
+    {
+    if ( iStatus.Int() == KErrNone )
+        {
+        // ownership is transferred!
+        CMobilePhoneENList* list = iSimEnRetriver->RetrieveListL();
+        CleanupStack::PushL( list );
+        if ( list )
+            {
+            TInt count = list->Enumerate();
+
+            // _DDPRINT( 4, "ENPolicy.EN.SimNumber.count.", count ); // debug print
+
+            // clear old changeable stuff from list.
+            iENListHandler->ClearCurrentList();
+            for ( TInt i = 0; i < count; i++ )
+                {
+                const RMobileENStore::TMobileENEntryV1 entry = 
+                    list->GetEntryL( i );
+
+                // _DDPRINT( 4, "ENPolicy.EN.SimNumber.number.", entry.iNumber );
+
+                iENListHandler->AddToList( entry.iNumber, EFalse );  
+                }
+            }
+        CleanupStack::PopAndDestroy(); // list
+        }
+    delete iSimEnRetriver;
+    iSimEnRetriver = NULL;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CSosEmergencyNumberPolicyHandler::RunError
+//
+// Called when RunL leaves. 
+// The RunL can leave in EN list operations. It is ok to return KErrNone after
+// deleting the SimEnRetriever.
+//
+// -----------------------------------------------------------------------------
+//
+TInt CSosEmergencyNumberPolicyHandler::RunError( TInt /*aError*/ )
+    {
+    // delete the SimEnRetriever, because not done in RunL.
+    delete iSimEnRetriver;
+    iSimEnRetriver = NULL;
+
+    return KErrNone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CSosEmergencyNumberPolicyHandler::InitializeCentralRepositoryList()
+// 
+// Called once in the startup.
+// Adds universal (112) emergency number to Central Repository list,
+// and checks possible product specific values. After this,
+// these values are not changed.
+// -----------------------------------------------------------------------------
+//
+void CSosEmergencyNumberPolicyHandler::InitializeCentralRepositoryList()
+    {
+    // (From 3GPP specification 22.101, ftp://ftp.3gpp.org/specs/latest/Rel-8/22_series/22101-880.zip)
+    //
+    // "The ME shall identify a number dialled by the end user as a valid emergency number if it occurs under one or more 
+    //  of the following conditions:
+    //      a) 112 and 911 shall always be available. These numbers shall be stored on the ME.
+    //      b) Any emergency number stored on a SIM/USIM when the SIM/USIM is present.
+    //      c) 000, 08, 110, 999, 118 and 119 when a SIM/USIM is not present. These numbers shall be stored on the ME.
+    //      d) Additional emergency numbers that may have been downloaded by the serving network when the SIM/USIM is present."
+    
+    // Universal, 112
+    iENListHandler->AddToList( KEnPolicyUnivEmergencyNumber, ETrue );
+    // U.S, 911
+    iENListHandler->AddToList( KEnPolicyUSEmergencyNumber, ETrue );
+
+    if ( iSimMonitor->IsReadingAllowed() )
+        {
+        CpsssmHandleSimStatusEvent( ESosEnPolicySimEmergencyNumberRead );
+        }
+    else
+        {
+        iENListHandler->AddToList( KEnPolicyUKEmergencyNumber );
+        iENListHandler->AddToList( KEnPolicyAUEmergencyNumber );
+        iENListHandler->AddToList( KEnPolicyMXEmergencyNumber );
+        iENListHandler->AddToList( KEnPolicyAPACEmergencyNumber );
+        iENListHandler->AddToList( KEnPolicyJapanEmergencyNumber );
+        iENListHandler->AddToList( KEnPolicyJapanEmergencyNumber2 ); 
+        }
+
+    // Product specific numbers.
+    iENListHandler->AddToList( iENListHandler->ReadProductSpecificNumbers(), ETrue );
+    }
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/enpolicy/src/sosenpolicy/csosemergencynumberpolicymanager.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -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:  Provides SOS emergency number policy API to verify an emergency
+*                number.        
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "csosemergencynumberpolicymanager.h" 
+#include "csosemergencynumberpolicyhandler.h" 
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSosEmergencyNumberPolicyManager::~CSosEmergencyNumberPolicyManager()
+// -----------------------------------------------------------------------------
+//
+CSosEmergencyNumberPolicyManager::~CSosEmergencyNumberPolicyManager()
+    { 
+    delete iSosEnPolicyHandler;
+    }
+
+// -----------------------------------------------------------------------------
+// CSosEmergencyNumberPolicyManager::ConstructL()
+// -----------------------------------------------------------------------------
+//
+void CSosEmergencyNumberPolicyManager::ConstructL( RTelServer& aETelServer )
+    {
+    iSosEnPolicyHandler = CSosEmergencyNumberPolicyHandler::NewL( aETelServer);
+    }
+
+// -----------------------------------------------------------------------------
+// CSosEmergencyNumberPolicyManager::IsEmergencyNumber
+// 
+// -----------------------------------------------------------------------------
+//
+TInt CSosEmergencyNumberPolicyManager::IsEmergencyNumber ( 
+                                    TPhCltTelephoneNumber& aTelNumber, 
+                                    TPhCltEmergencyNumberQueryMode aMode,
+                                    TBool& aIsEmergencyNumber )
+    {       
+    return iSosEnPolicyHandler->IsEmergencyNumber( aTelNumber, 
+                                                   aMode, 
+                                                   aIsEmergencyNumber );
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// NewEnPolicy()
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CEmergencyNumberPolicy* NewEnPolicyL()
+    {
+    return new (ELeave) CSosEmergencyNumberPolicyManager;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/enpolicy/src/sosenpolicy/csosenpolicyenlisthandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,292 @@
+/*
+* Copyright (c) 2004-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:  Shared Data Monitor
+*
+*/
+
+
+// INCLUDES
+#include "csosenpolicyenlisthandler.h" 
+#include <e32property.h>
+#include <centralrepository.h>
+#include <telservicesinternalcrkeys.h>
+#include <defaultemergencynumberscrkeys.h>
+
+// FUNCTIONS
+
+// -----------------------------------------------------------------------------
+// CSosEnPolicyENListHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSosEnPolicyENListHandler* CSosEnPolicyENListHandler::NewL( 
+     )
+    {
+    CSosEnPolicyENListHandler* self = new ( ELeave ) 
+        CSosEnPolicyENListHandler();
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CSosEnPolicyENListHandler::~CSosEnPolicyENListHandler()
+// -----------------------------------------------------------------------------
+//
+CSosEnPolicyENListHandler::~CSosEnPolicyENListHandler()
+    {
+    if ( iListener )
+        {
+        iListener->StopListening();
+        delete iListener;
+        }
+    delete iRepository;
+    
+    iProductSpecificList.Zero();
+    iCurrentList.Zero();
+    }
+
+// -----------------------------------------------------------------------------
+// CSosEnPolicyENListHandler::CSosEnPolicyENListHandler
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSosEnPolicyENListHandler::CSosEnPolicyENListHandler( 
+    )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CSosEnPolicyENListHandler::ConstructL
+// Construction, 2nd phase.
+// -----------------------------------------------------------------------------
+//        
+void CSosEnPolicyENListHandler::ConstructL()
+    {
+    ClearCurrentList();
+    iRepository = CRepository::NewL( KCRUidDefaultEmergencyNumbers );
+    iListener = CCenRepNotifyHandler::NewL( 
+        *this, 
+        *iRepository, 
+        CCenRepNotifyHandler::EStringKey, 
+        KDefaultEmergencyNumbersList);
+    
+    iListener->StartListeningL();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CSosEnPolicyENListHandler::AddToList
+// 
+// Adds number to list with separator.
+// If numbers are set to permanent, also list start index is updated. 
+// Permanent numbers must be in the beginning of the list,
+// so SIM numbers are removed before writing!
+// -----------------------------------------------------------------------------
+//
+void CSosEnPolicyENListHandler::AddToList( 
+    const TDesC& aNumber, 
+    TBool aPermanent ) 
+    {
+    TInt length = aNumber.Length();
+    if ( length > 0 ) // for null string do nothing
+        {
+        // Remove non permanent numbers
+        if ( aPermanent )
+            {
+            ClearCurrentList();
+            }
+        // Write new ones
+    
+        for ( TInt i = 0; i < length; i++ )
+            {
+            iCurrentList[ iCurrentListPlace ] = aNumber[i];
+            iCurrentListPlace++;
+            }
+        iCurrentListPlace++;
+        // Update starting point
+        if ( aPermanent )
+            {
+            iCurrentListStart = iCurrentListPlace;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CSosEnPolicyENListHandler::ClearCurrentList
+// 
+// Clears list to be written to Central Repository.
+// Does not clear permanent numbers, from the begining of list
+// There is always 112 or 911 (WCDMA) and optionally product specific numbers.
+// Basically only deleted numbers are SIM emergency numbers.
+// -----------------------------------------------------------------------------
+//
+void CSosEnPolicyENListHandler::ClearCurrentList()
+    {
+    iCurrentList.SetLength( KEnPolicySDEmergencyNumberListLength );
+    iCurrentListPlace = iCurrentListStart;
+    for ( TInt i = iCurrentListStart; 
+          i < KEnPolicySDEmergencyNumberListLength; 
+          i++ )
+        {
+        iCurrentList[i] = KEnPolicySDNumberSeparator;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CSosEnPolicyENListHandler::IsInListByAdvancedMode
+// 
+// Checks if the number is in list by advanced mode check.
+//
+// -----------------------------------------------------------------------------
+//
+TBool CSosEnPolicyENListHandler::IsInListByAdvancedMode ( TDes& aNumber )
+    {    
+    TLex list( iCurrentList );
+    TLexMark mark;
+    TPtrC token_candidate( KNullDesC() ); 
+    
+    for ( TInt i = 0; i < KEnPolicySDEmergencyNumberListLength; i++ )
+        {
+        list.Mark( mark );
+        list.SkipCharacters();
+        TPtrC token;
+        token.Set( list.MarkedToken( mark ) );
+        if ( token.Length() && ( token == aNumber.Right( token.Length() ) ) )
+            {
+            // _DDPRINT( 4, "ENPolicy.SDM.IsInListAdvanced.ok.", place );
+            if( token_candidate == KNullDesC )
+                { 
+                token_candidate.Set( token ); 
+                } 
+            else 
+                { 
+                if( token.Length() > token_candidate.Length() ) 
+                    { 
+                    token_candidate.Set( token );     
+                    } 
+                } 
+            } 
+        list.Inc(); 
+        } 
+
+    if( token_candidate != KNullDesC ) 
+        { 
+        aNumber = token_candidate; 
+        return ETrue; 
+        }    
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CSosEnPolicyENListHandler::IsInListByNormalMode
+// 
+// Checks if the number is in list by normal mode check.
+//
+// -----------------------------------------------------------------------------
+//
+TBool CSosEnPolicyENListHandler::IsInListByNormalMode( 
+    const TDesC& aNumber )
+    {
+    TInt length = aNumber.Length();
+    TInt place = iCurrentList.Find( aNumber ); // first number of aNumber
+
+    // _DDPRINT( 4, "ENPolicy.SDM.IsInListNormal.ok.", place );  // debug print
+
+    if ( place < 0 )
+        {
+        // negative value is an error, not found!
+        // return immediately
+        return EFalse;
+        }
+
+    TInt endOfMatch = place + length; // end of number + 1
+
+    // we check the begining
+    if ( place > 0 )
+        {
+        // we are not in the begining of buffer, so we have to check
+        // char before that
+        if ( iCurrentList[ place -1 ] != KEnPolicySDNumberSeparator )
+            {
+            // this was just a substring numbers before that
+            return EFalse;
+            }
+        }
+
+    // beginning was ok, so we can continue
+    
+    // now checking the end
+    // there must be atleast one empty space in the end that
+    // we do the checking of number end.
+    if ( endOfMatch < ( iCurrentList.Length() - 2 ) )
+        {
+        if ( iCurrentList[ endOfMatch ] != KEnPolicySDNumberSeparator )
+            {
+            return EFalse;
+            }
+        }
+
+    // if we get so far, its ok.
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CSosEnPolicyENListHandler::ReadProductSpecificNumbers
+// 
+// Reads product specific values from Central Repository.
+// -----------------------------------------------------------------------------
+//
+const TDesC& CSosEnPolicyENListHandler::ReadProductSpecificNumbers()
+    {
+    // This is done only once in bootup phase.
+    iProductSpecificList.Zero();
+
+    TInt err = KErrNone;
+    err = iRepository->Get( KDefaultEmergencyNumbersList, 
+                            iProductSpecificList );
+
+    if ( err != KErrNone )
+        {
+        iProductSpecificList.Zero();
+        }
+
+    // _DDPRINT( 4, "ENPolicy.SDM.ReadPSN.list", iProductSpecificList );
+
+    return iProductSpecificList;
+    }
+
+// -----------------------------------------------------------------------------
+// CDosEmergencyNumberPolicy::HandleNotifyString
+// 
+// Inherited from MCenRepNotifyHandlerCallback.
+// -----------------------------------------------------------------------------
+//
+void CSosEnPolicyENListHandler::HandleNotifyString( 
+    TUint32 aId, const TDesC16& aNewValue )
+    {
+    if( aId == KDefaultEmergencyNumbersList )
+        {
+        iProductSpecificList.Zero();
+        iProductSpecificList.Copy( aNewValue );
+        
+        ClearCurrentList();
+        AddToList( iProductSpecificList );
+        }
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/enpolicy/src/sosenpolicy/csosenpolicysatrefresh.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,186 @@
+/*
+* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This module contains the implementation of CSosEnPolicySatRefresh
+*                class member functions.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include  <e32std.h>
+#include "csosemergencynumberpolicyhandler.h" 
+#include "csosenpolicysatrefresh.h" 
+
+#include <rsatrefresh.h> 
+#include <rsatsession.h> 
+
+#include  <startupdomainpskeys.h> // Property values
+
+// Constants
+_LIT( KENPolicyPanicCategory, "ENPolicyFault" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSosEnPolicySatRefresh::CSosEnPolicySatRefresh
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSosEnPolicySatRefresh::CSosEnPolicySatRefresh( CSosEmergencyNumberPolicyHandler& aCSosEmergencyNumberPolicyHandler ): 
+    CActive( EPriorityStandard ), iCSosEmergencyNumberPolicyHandler ( aCSosEmergencyNumberPolicyHandler )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CSosEnPolicySatRefresh::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSosEnPolicySatRefresh::ConstructL()
+    {
+    TInt err = KErrNotSupported;
+    iSatSession = new ( ELeave ) RSatSession;
+    iSatRefresh = new ( ELeave ) RSatRefresh( *this );
+ 
+    err = iProperty.Attach( KPSUidStartup, KPSGlobalSystemState );
+    __ASSERT_ALWAYS( err == KErrNone, User::Panic( 
+        KENPolicyPanicCategory, EEnPolicyPanicCentralRepositoryConnectionFailure ) );
+    IssueRequest();
+    }
+
+// -----------------------------------------------------------------------------
+// CSosEnPolicySatRefresh::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSosEnPolicySatRefresh* CSosEnPolicySatRefresh::NewL( CSosEmergencyNumberPolicyHandler& aCSosEmergencyNumberPolicyHandler )
+    {    
+    CSosEnPolicySatRefresh* self = new (ELeave) CSosEnPolicySatRefresh( aCSosEmergencyNumberPolicyHandler );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// Destructor
+CSosEnPolicySatRefresh::~CSosEnPolicySatRefresh()
+    {
+    if ( iSatRefresh )
+        {
+        // Cancel notifications.
+        iSatRefresh->Cancel();  
+        // Close SubSession.
+        iSatRefresh->Close();
+        }
+    delete iSatRefresh;
+    
+    if ( iSatSession )
+        {
+        iSatSession->Close();
+        }
+      delete iSatSession;
+
+    Cancel();
+    iProperty.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CSosEnPolicySatRefresh::AllowRefresh
+// Refresh query. Determines whether it allow the refresh to happen. 
+// -----------------------------------------------------------------------------
+//
+TBool CSosEnPolicySatRefresh::AllowRefresh( TSatRefreshType /*aType*/, const TSatRefreshFiles& /*aFiles*/ )
+    {
+    // Refresh is always allowed
+    return ETrue;
+    }
+ 
+// -----------------------------------------------------------------------------
+// CSosEnPolicySatRefresh::Refresh
+// Notification of refresh. In this method the client should not close 
+// or cancel the RSatRefresh subsession. 
+// -----------------------------------------------------------------------------
+//     
+void CSosEnPolicySatRefresh::Refresh( TSatRefreshType /*aType*/, const TSatRefreshFiles& /*aFiles*/ )
+    {
+    // Reload SIM Topics in case of refresh             
+    iCSosEmergencyNumberPolicyHandler.CpsssmHandleSimStatusEvent( CSosEmergencyNumberPolicyHandler::ESosEnPolicySimEmergencyNumberRead );
+    iSatRefresh->RefreshEFRead( EFalse );
+    }
+    
+    
+// -----------------------------------------------------------------------------
+// CSosEnPolicySimStatusMonitor::IssueRequest
+// 
+// Issue notify request to System agent.
+// -----------------------------------------------------------------------------
+//        
+void CSosEnPolicySatRefresh::IssueRequest()
+    {
+    iProperty.Subscribe( iStatus );
+    SetActive();
+    }
+    
+// -----------------------------------------------------------------------------
+// CSosEnPolicySatRefresh::RunL
+// 
+// Property event occurred.
+// -----------------------------------------------------------------------------
+//
+void CSosEnPolicySatRefresh::RunL()
+    {
+    TInt value;
+    iProperty.Get( KPSUidStartup, KPSGlobalSystemState, value );
+    if ( ESwStateNormalRfOn == value || ESwStateNormalRfOff == value  ) 
+        {
+        switch ( iStatus.Int() )
+            {
+            case KErrNotSupported:
+            case KErrCancel:
+                return;
+            case KErrNone:
+                {
+                iSatSession->ConnectL();
+                iSatRefresh->OpenL( *iSatSession );     
+                TSatRefreshFiles file;
+                file.Append( KEccEf );
+                iSatRefresh->NotifyFileChangeL( file );
+                break;  
+                }
+            default:
+                break;
+            }
+        }
+    else
+        {
+        IssueRequest(); 
+        }
+    }
+
+// -----------------------------------------------------------------------------
+//CSosEnPolicySatRefresh::DoCancel
+// 
+//  Cancellation of notify.
+// -----------------------------------------------------------------------------
+//
+void CSosEnPolicySatRefresh::DoCancel()
+    {
+    iProperty.Cancel();
+    }
+    
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/enpolicy/src/sosenpolicy/csosenpolicysimstatusmonitor.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,211 @@
+/*
+* Copyright (c) 2004-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:  SIM Status Monitor.
+*
+*/
+
+
+
+// INCLUDES
+#include    "csosenpolicysimstatusmonitor.h" 
+#include    <startupdomainpskeys.h> // Property values
+#include    <PSVariables.h> 
+
+
+
+// CONSTANTS
+const TUint KENPolicySAConnectionRetryTime = 2000000;  // 2s
+const TInt KENPolicySAConnectionRetries = 3;
+
+_LIT( KENPolicyPanicCategory, "ENPolicyFault" );
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+// -----------------------------------------------------------------------------
+// CSosEnPolicySimStatusMonitor::CSosEnPolicySimStatusMonitor
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSosEnPolicySimStatusMonitor::CSosEnPolicySimStatusMonitor( 
+    CSosEmergencyNumberPolicyHandler& aObserver ) :
+    CActive( EPriorityStandard ),
+    iObserver( aObserver )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CSosEnPolicySimStatusMonitor::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSosEnPolicySimStatusMonitor* CSosEnPolicySimStatusMonitor::NewL( 
+    CSosEmergencyNumberPolicyHandler& aObserver )
+    {
+    CSosEnPolicySimStatusMonitor* self = new ( ELeave ) 
+        CSosEnPolicySimStatusMonitor( aObserver );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CSosEnPolicySimStatusMonitor::~CSosEnPolicySimStatusMonitor
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CSosEnPolicySimStatusMonitor::~CSosEnPolicySimStatusMonitor()
+    {
+    Cancel();
+
+    iProperty.Close();
+
+    }
+
+// -----------------------------------------------------------------------------
+// CSosEnPolicySimStatusMonitor::ConstructL
+// 
+// Construction. Creates also connection to system agent.
+// -----------------------------------------------------------------------------
+//        
+void CSosEnPolicySimStatusMonitor::ConstructL()
+    {
+    TInt err = KErrNotSupported;
+    for( TInt i = 0; i < KENPolicySAConnectionRetries; i++ )
+        {
+        err = iProperty.Attach( KPSUidStartup, KPSSimStatus );
+        if( err == KErrNone )
+            {
+            i = KENPolicySAConnectionRetries;
+            }
+        else
+            {
+            // _DPRINT( 4, "ENPolicy.SimStatus.Attach.RETRY" );  
+            User::After( KENPolicySAConnectionRetryTime );
+            }
+        }
+    //if connection not established.
+    __ASSERT_ALWAYS( err == KErrNone, User::Panic( 
+        KENPolicyPanicCategory, EEnPolicyPanicCentralRepositoryConnectionFailure ) );
+    IssueRequest();
+    }
+
+// -----------------------------------------------------------------------------
+// CSosEnPolicySimStatusMonitor::DoCancel
+// 
+//  Cancellation of notify.
+// -----------------------------------------------------------------------------
+//
+void CSosEnPolicySimStatusMonitor::DoCancel()
+    {
+    iProperty.Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CSosEnPolicySimStatusMonitor::RunL
+// 
+// SIM event occurred.
+// Basically events make three kinds of responses.
+// If there is an error in notify, nothing is made. Othervice, event
+// may indicate that SIM is accessible or not. Depending on that, action is
+// send for observer.
+// -----------------------------------------------------------------------------
+//
+void CSosEnPolicySimStatusMonitor::RunL()
+    {
+    TInt state = KErrGeneral;
+
+    iProperty.Get( state );
+
+    // _DDPRINT( 4, "ENPolicy.SimStatus.status.e.", iStatus.Int() );    
+    // _DDPRINT( 4, "ENPolicy.SimStatus.status.", state );
+    CSosEmergencyNumberPolicyHandler::TSosEnPolicySimEmergencyNumberAction
+        action = CSosEmergencyNumberPolicyHandler::
+                    ESosEnPolicySimEmergencyNumberClear;
+    switch ( iStatus.Int() )
+        {
+        case KErrNotSupported:
+        case KErrCancel:
+            return;
+        case KErrNone:
+            {
+            if ( TranslateState( state ) )
+                {
+                action = 
+                    CSosEmergencyNumberPolicyHandler::
+                        ESosEnPolicySimEmergencyNumberRead;
+                }
+            iObserver.CpsssmHandleSimStatusEvent( action );
+            }
+        default:
+            break;
+        }
+    IssueRequest();
+    }
+
+// -----------------------------------------------------------------------------
+// CSosEnPolicySimStatusMonitor::IsReadingAllowed
+// 
+// Checks sim state from system agent
+// -----------------------------------------------------------------------------
+// 
+TBool CSosEnPolicySimStatusMonitor::IsReadingAllowed()
+    {
+    TInt state = KErrGeneral;
+
+    iProperty.Get( state );
+    return TranslateState( state );
+    }
+
+// -----------------------------------------------------------------------------
+// CSosEnPolicySimStatusMonitor::IssueRequest
+// 
+// Issue notify request to System agent.
+// -----------------------------------------------------------------------------
+//        
+void CSosEnPolicySimStatusMonitor::IssueRequest()
+    {
+    iProperty.Subscribe( iStatus );
+
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CSosEnPolicySimStatusMonitor::TranslateState
+// 
+// Translate the state information.
+// -----------------------------------------------------------------------------
+// 
+TBool CSosEnPolicySimStatusMonitor::TranslateState( TInt aState )
+    {
+    switch ( aState )
+        {
+        case ESimUsable:         
+        case ESimReadable:
+            return ETrue;
+        case  ESimStatusUninitialized:
+        case ESimNotReady:
+        case ESimNotSupported:
+        case ESimNotPresent:
+            return EFalse;
+        default:
+            return EFalse;
+        }
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/inc/cphcltdialer.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,100 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  It is dialer class.
+*
+*/
+
+
+#ifndef CPHCLTDIALER_H
+#define CPHCLTDIALER_H
+
+//  INCLUDES
+#include    <cphcltextphonebase.h> 
+#include    <cphcltextphonedialdata.h> 
+
+// FORWARD DECLARATIONS
+class CPhCltDialerDlg;
+
+// CLASS DECLARATION
+
+/**
+*  It is dialer class.
+*
+*  @lib phoneclient.lib
+*  @since 1.0
+*/
+class CPhCltDialer
+    : public CBase
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        *
+        * @return Pointer to created CPhCltDialer instance.
+        */
+        IMPORT_C static CPhCltDialer* NewL();
+        
+        /**
+        * Destructor.
+        */
+        ~CPhCltDialer();
+
+
+    public: // New functions
+
+        /** 
+        * Dial parameters.
+        *
+        * @return Returns dial data.
+        */
+        IMPORT_C CPhCltExtPhoneDialData& DialData();
+
+        /**
+        * Performs dialing with the dial data.
+        */
+        IMPORT_C void ExecuteLD();
+
+
+    private:
+
+        /**
+        * C++ constructor.
+        */
+        CPhCltDialer();
+        
+        /**
+        * Symbian OS constructor.
+        */
+        void ConstructL();
+
+        /**
+        * Cleanup action. Clears iDestroyed & iDialDlg.
+        */
+        static void DoClear( TAny* aAny );
+
+
+    private:    // Data
+
+        // Pointer to boolean indicating if this has been destroyed already.
+        TBool* iDestroyed;
+
+        // Dialer dialog
+        CPhCltDialerDlg* iDialDlg;
+
+    };
+
+#endif      // CPHCLTDIALER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/inc/cphcltextphonebase.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,118 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  It defines dial interface for phone client.
+*
+*/
+
+
+#ifndef CPHCLTEXTPHONEBASE_H
+#define CPHCLTEXTPHONEBASE_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "phclttypes.h" 
+
+// FORWARD DECLARATIONS
+class MPhCltExtPhoneObserver;
+class CPhCltExtPhoneDialData;
+
+// CLASS DECLARATION
+
+/**
+*  It defines dial interface for phone client.
+*
+*  Usage:
+*  
+*  To dial, you must have a string of characters from set 
+*  { 0, 1, 2, .. 9, #, *, +, p, P, w, W }. It is the only 
+*  mandatory parameter. String may also contain other characters,
+*  but then only a note is displayed. So you should proceed as follows:
+*       1. Check that string is acceptable. 
+*          (application specific grammar)
+*       2. If not, stop. Otherwise continue.
+*       3. Convert to string acceptable by phoneclient.
+*          Note PhCltUtils class may help.
+*       4. Dial using the class.
+*
+*  Note that dialling does not always mean creating a call. 
+*  (E.g. *#43# makes phone to interrogate status of call waiting.)
+*  
+*  In order to dial, you need instance of CPhCltExtPhoneBase. You 
+*  can create one as follows:
+*       iExtCall = CPhCltExtPhoneBase::NewL( this );
+*  (the parameter is pointer to observer)
+*
+*  Then you must fill dial parameters to instance of TPhCltExtPhoneDialData.
+*  (you can read more details from its header)
+*
+*       TPhCltExtPhoneDialData data;
+*       data.SetTelephoneNumber( .. );
+*       ..
+*
+*  And finally, you can dial. Note that the method is asynchronous and
+*  observer will be informed when phone starts dialing.
+*
+*       iExtCall->DialL( data );
+*
+*  Finally, you can delete the instance. If dialing is ongoing, this should
+*  be done after observer has been informed. You can also delete before that,
+*  but then the request might also be canceled.
+*
+*  @lib phoneclient.lib
+*  @since 1.0
+*/
+class CPhCltExtPhoneBase : public CActive
+    {
+    public:  // Constructors and destructor
+ 
+        /**
+        * Create an instance that implements the interface.
+        *
+        * @param aObserver It is the observer for the instance.
+        * @return Returns the created instance.
+        */
+        IMPORT_C static CPhCltExtPhoneBase* NewL( 
+            MPhCltExtPhoneObserver* aObserver );
+
+
+    public: // New fuctions    
+        
+
+       /**
+       * Makes a new call. This is the preferred way of dialling!
+       *
+       * @param aData The object containing the parameters for 
+       *              the dial request.
+       */
+       virtual void DialL( CPhCltExtPhoneDialData& aData ) = 0;
+
+
+    protected:
+
+        /**
+        * C++ constructor.
+        */
+        CPhCltExtPhoneBase( MPhCltExtPhoneObserver* aObserver );
+
+
+    protected: // Data
+        
+        // Observer to handle events.
+        MPhCltExtPhoneObserver* iObserver;
+
+    };
+
+#endif      // CPHCLTEXTPHONEBASE_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/inc/cphcltextphonedialdata.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,575 @@
+/*
+* 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:  It defines dial data.
+*
+*/
+
+
+#ifndef CPHCLTEXTPHONEDIALDATA_H   
+#define CPHCLTEXTPHONEDIALDATA_H  
+
+
+//  INCLUDES
+#include <e32base.h>
+#include <s32mem.h>
+#include <bldvariant.hrh>
+#include "phclttypes.h" 
+#include <cphcltdialdata.h> // Phone Client Notify API
+
+
+// Other constants used in TPhCltExtPhoneDialData ( default values )
+const TBool KPhCltDefaultAllowMatch = ETrue;   // Match is allowed
+const TBool KPhCltDefaultNumberEntry = EFalse; // No return to number entry.
+const TInt KPhCltDefaultNumberType = -1;       // No number type.
+
+
+// CONSTANTS
+//None.
+
+
+// FORWARD DECLARATIONS
+//None
+
+// CLASS DECLARATION
+/**
+* It defines the structure containing dial information.
+*
+* Fields:
+*
+*  window group    - When call is ended, set window group is actived.
+*
+*  show number     - Permission to show number. ETrue if it is allowed.
+*
+*  redial          - Automatic redial override.
+*
+*  name            - Name corresponding to number. Name must be defined
+*                    if shown number equals to EFalse.
+*  contact link      - Contact link. you should put always when you are dialing
+*                    from phonebook contact.
+*  tel number      - String that is to be dialled.
+*                    number fields are supported.
+*  allow match     - Permission to allow match. ETrue if match is to be done.
+*                    If you are dialing from sim pd or fdn, then this should
+*                    be EFalse.
+*  number entry    - Returns whether to return to the number entry on failure 
+*
+*  end other calls - Information if the existing calls are ended before
+*                    this new one is made.
+*                    Not mandatory. Set only if you know that the call is an 
+*                    emergency call.
+*  subaddress      - The calling party subaddress. Supports SAT features.
+*                    Defined in ITU-T I.330 and 3GPP TS 11.14.
+*  SATCall         - Set whether this is SAT originated call or not. 
+*                    Supports SAT features.
+*  bearer          - Bearer capabilities. Supports SAT features.
+*
+*  CallType        - The type of the call, i.e. voice (default) or video.
+*
+*  SendKey         - Call made with SendKey, optional.
+*
+*  Redial maximum duration - Automatic redial maximum duration
+*
+*  Initiate call   - true if iniate call false otherwise 
+*
+*  UUI             - User to user information sent on call setup phase.
+*
+*  @lib phoneclient.lib
+*  @since 3.2
+*/
+/**
+*  Dial data set for PhoneClient.
+*
+*  @lib ServiceHandler.lib
+*  @since Series 60 3.2
+*/
+NONSHARABLE_CLASS( CPhCltExtPhoneDialData ): public CPhCltDialData
+    {
+   
+   public:
+      /* 
+        *   TBools combined to one uint.
+        *
+        *   EPhCltCallFlagsDefault
+        *               Default flags, if nothing is not specified.
+        *   EPhCltCallFlagsAllowNumberShowing
+        *               Number showing is allowed.
+        *   EPhCltCallFlagsReturnToNumberEntryOnFailure
+        *               Return to Number Entry if there is an error.
+        *   EPhCltCallFlagsAllowPersonalDirectoryMatching
+        *               The number is matched to Personal Directory.
+        *   EPhCltCallFlagsEndBeforeDial
+        *               Other calls are ended before the new one is done.
+        *   EPhCltCallFlagsSAT
+        *               If set means that SAT has originated the call.
+        *   EPhCltCallFlagsVideoCall
+        *               If set means that this is video call.
+        *               Otherwise means normal, i.e. voice call.
+        *   EPhCltCallFlagsVoIPCall
+        *               If set means that this is VoIP call.
+        *               Otherwise means normal, i.e. voice call.
+        *   EPhCltCallFlagsSendKey
+        *               If set means that call made with SendKey.
+        */
+        enum TPhCltCallFlags
+            {
+            EPhCltCallFlagsDefault                           = 0x0000,
+            EPhCltCallFlagsAllowNumberShowing                = 0x0001,
+            EPhCltCallFlagsReturnToNumberEntryOnFailure      = 0x0002,
+            EPhCltCallFlagsAllowPersonalDirectoryMatching    = 0x0004,
+            EPhCltCallFlagsEndBeforeDial                     = 0x0008,
+            EPhCltCallFlagsSAT                               = 0x0020,
+            EPhCltCallFlagsVideoCall                         = 0x0040,
+            EPhCltCallFlagsVoIPCall                          = 0x0080,
+            EPhCltCallFlagsSendKey                           = 0x0100
+            };
+      
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CPhCltExtPhoneDialData* NewL();
+        
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CPhCltExtPhoneDialData* NewLC();
+        
+        
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CPhCltExtPhoneDialData* NewL( const TDesC8& aPackage );
+        
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CPhCltExtPhoneDialData* NewLC( const TDesC8& aPackage );
+        
+        /**
+        * Destructor.
+        */
+        IMPORT_C virtual ~CPhCltExtPhoneDialData();
+
+    public: // New functions
+    
+        /**
+        * Fills the parameter list.
+        * @since Series 60 3.2
+        * @param aInParamList In parameter used with CAiwService.
+        */  
+        IMPORT_C HBufC8* PackLC();
+        
+        
+        // Calculates dialdata package size
+        IMPORT_C TInt CalculatePackageSize() const;
+        
+        // Sets dial data parameters to CPhCltExtPhoneDialData object
+        void SetParamsL( const TDesC8& aPackage ); 
+               
+        
+   public: // Access - Getters
+         
+
+        /**
+        * Defines if mathing is allowed.
+        * @since Series 60 3.2
+        * @return Returns the allow match setting information.
+        */
+        IMPORT_C  TBool AllowMatch() const;
+        
+        /**
+        * Bearer capability.
+        * @since Series 60 3.2
+        * @return Returns bearer capability.
+        */
+        IMPORT_C const TPhCltBearerCapability& Bearer() const;
+        
+        /**
+        * Gives the current call type.
+        * @since Series 60 3.2
+        * @return Current call type.
+        */
+        IMPORT_C  TPhCltCallType CallType() const ;   
+         
+        /**
+        * Contact link field.
+        * @since Series 60 3.2
+        * @return Returns contack link item.
+        */
+        IMPORT_C const TDesC8& ContactLink() const;
+        
+        
+        /**
+        * End other calls param.
+        * @since Series 60 3.2
+        * @return Returns ETrue if other calls will be terminated.
+        *                 EFalse if calls are not terminated.
+        */
+        IMPORT_C TBool EndOtherCalls() const;
+        
+        /**
+        * Intiate Call
+        * @since Series 60 3.2
+        * @return Returns ETrue if call is itiate call EFalse otherwise
+        */
+        IMPORT_C  TBool InitiateCall() const;
+        
+        /**
+        * Name.
+        * @since Series 60 3.2
+        * @return Returns name.
+        */
+        IMPORT_C  const TPhCltNameBuffer& Name() const;
+        
+        
+        /**
+        * Redial information.
+        * @since Series 60 3.2
+        * @return Return the redial status,
+        */
+        IMPORT_C  TInt Redial() const;  
+        
+        /**
+        * Redial maximum duration
+        * @since Series 60 3.2
+        * @return Returns redial max duration.
+        */
+        IMPORT_C const TTimeIntervalSeconds RedialMaximumDuration() const;      
+                   
+        
+        /** 
+        * Return in failure.
+        * @since Series 60 3.2
+        * @return Returns whether to return to the number entry.
+        */
+        //IMPORT_C TBool ReturnToNumberEntryOnFailure() const;
+        
+        /**
+        * SAT Call.
+        * @since Series 60 3.2
+        * @return Returns ETrue if SAT call EFalse if not.
+        */
+        IMPORT_C  TBool SATCall() const;
+        
+        /** 
+        * SendKey pressed.
+        * @since Series 60 3.2
+        * @return Return ETrue if SendKey used.
+        */
+        IMPORT_C TBool SendKeyPressed() const;
+        
+        /**
+        * Show Number.
+        * @since Series 60 3.2
+        * @return Returns the number visibility.
+        */
+        IMPORT_C TBool ShowNumber() const;
+        
+        /**
+        * Sub address.
+        * @since Series 60 3.2
+        * @return Returns SAT call sub address.
+        */
+        IMPORT_C  const TPhCltSubAddress& SubAddress() const;
+        
+        /**
+        * Gives the current phone number.
+        * @since Series 60 3.2
+        * @return Telephone number.
+        */
+        IMPORT_C  const TPhCltTelephoneNumber& TelephoneNumber() const;
+        
+        /**
+        * Gives the current window group id.
+        * @since Series 60 3.2
+        * @return Window group id. 
+        */     
+        IMPORT_C  TInt WindowGroup() const; 
+        
+        /**
+         * Gives the user to user information.
+         * @since S60 v3.2
+         * @return User to user information.
+         */
+        IMPORT_C const TDesC& UUI() const;
+        
+    public: // Access - Setters
+    
+        /**
+        * Set whether the name entered in SetName should be matched
+        * against the personal directory.
+        * @since Series 60 3.2
+        * This should be set EFalse only if phone number has not been
+        * taken from phonebook.
+        *
+        * @param aAllowMatch Whether to allow matches.
+        */
+        IMPORT_C  void SetAllowMatch( TBool aAllowMatch );
+    
+        /**
+        * Set the bearer capability.
+        * @since Series 60 3.2
+        * @param aBearer The bearer capabilities as defined in GSM 04.08.
+        * @leaves KErrArgument if aBearer's length is longer than KAiwBearerLength
+        */
+        IMPORT_C void SetBearerL( const TPhCltBearerCapability& aBearer );
+        
+        /**
+        * Sets call type.
+        * @since Series 60 3.2
+        * @param aCallType calls' type.
+        */
+        IMPORT_C void SetCallType( TPhCltCallType aCallType );
+        
+        /**
+        * Set contact link.
+        * @since Series 60 3.2
+        * @param aContactLink Contact link information.
+        */
+       IMPORT_C void SetContactLinkL( const TDesC8& aContactLink );
+        
+        
+        /**
+        * Set parameter for end other calls. 
+        * @since Series 60 3.2
+        * If this is set to ETrue, other calls will be terminated before
+        * dial. Default is EFalse.
+        * @param aEndCalls Are the other calls ended.
+        */
+        IMPORT_C void SetEndOtherCalls( TBool aEndCalls  );
+        
+        /**
+        * Set Initiate call Etrue or EFalse
+        *@since Series 60 3.2
+        * @param aInitCall ETrue if call is intiate call
+        */
+        IMPORT_C void SetInitiateCall( TBool aInitCall );
+        
+        
+        /**
+        * Set the name of the person who is to be called.
+        * @since Series 60 3.2
+        * @param aName The name of the person being called.
+        * @leaves KErrArgument if aName length is over 50 characters.
+        */
+        IMPORT_C void SetNameL( const TPhCltNameBuffer& aName );
+        
+        
+        /**
+        * Change the redial mode.
+        * @since Series 60 3.2
+        * @param aRedial The new redial status
+        */
+  
+        IMPORT_C void SetRedial( TInt aRedial );
+        
+        /**
+        * Set redial max duration.
+        * @since Series 60 3.2
+        * @param aDuration redial max duration.
+        */
+        IMPORT_C void SetRedialMaximumDuration( TTimeIntervalSeconds aMaximumRedialDuration );       
+        
+        
+        /**
+        * Set whether to return to number entry.
+        *
+        * @param aReturn Whether to return to the number entry editor.
+        */
+        IMPORT_C void SetReturnToNumberEntryOnFailure( TBool aReturn );
+                
+        /**
+        * Set wheteher this is a SAT originated call or not.
+        * If this function is not called, the originator is assumed to 
+        * be other than SAT.
+        * @since Series 60 3.2
+        * @param aSATCall ETrue if SAT originated the call, EFalse otherwise.
+        */
+        IMPORT_C void SetSATCall( TBool aSATCall );
+        
+        
+        /**
+        * Set the value of SendKey.
+        *  @since Series 60 3.2
+        * @param aSendKey The value of SendKey.
+        */
+        IMPORT_C void SetSendKeyPressed( TBool aSendKey );
+        
+        /**
+        * Set the number visibility in the phone app.
+        * @since Series 60 3.2
+        * If this is set to EFalse, then number is not shown or written to 
+        * log event.
+        * @param aShowNumber Whether or not to show the number.
+        */
+        IMPORT_C void SetShowNumber( TBool aShowNumber );
+        
+        /**
+        * Set the calling party subaddress.
+        * Defined in ITU-T I.330 and 3GPP TS 11.14.
+        * @since Series 60 3.2
+        * @param aSubAddress The calling party subaddress.
+        * @leaves KErrArgument if aSubAddress length is longer than 
+        * KAiwSubAddressLength
+        */
+        IMPORT_C void SetSubAddressL( const TPhCltSubAddress& aSubAddress );
+        
+        /**
+        * Sets the phone number.
+        * @since Series 60 3.2
+        * @param aNumber Phone number, which maximum length is
+        * KMaximumPhoneNumberLength.
+        * @leaves KErrArgument if aPhoneNumber length is over KMaximumPhoneNumberLength
+        */
+        IMPORT_C void SetTelephoneNumber( const TPhCltTelephoneNumber& aNumber );
+        
+        /**
+        * Sets the window group identifier. When call is ended, set window group is actived.
+        * @since Series 60 3.2
+        * @param aWindowGroup Window group id.
+        */
+        IMPORT_C void SetWindowGroup( TInt aWindowGroup );
+     
+        /**
+        * Set the value of xSP Service Id. 
+        *
+        * @param aServiceId The value of Service Id.
+        */
+        IMPORT_C void SetServiceId( TUint32 aServiceId );
+        
+
+        /** 
+        * Service Id. VoIP2.2 implementation
+        * @return Return service id or zero.
+        */
+        IMPORT_C TUint32 ServiceId() const; 
+
+        
+        /**
+         * Sets user to user information. Maximum length is 
+         * KPhCltUUILength.
+         * @param aUUI User to user information.
+         * @since S60 v3.2
+         */
+        IMPORT_C void SetUUIL( const TDesC& aUUI );
+        
+      
+        
+                
+                      
+    // Constructors
+    
+     private: 
+     
+        /**
+        * C++ default constructor.
+        * @since Series 60 3.2
+        */
+        CPhCltExtPhoneDialData(); 
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        * @since Series 60 3.2
+        */
+        void ConstructL();
+        
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        * @since Series 60 3.2
+        * @param aPackage including dial data
+        */
+        void ConstructL( const TDesC8& aPackage ); 
+        
+     
+     //Private functions
+     
+     private:
+        /**
+        * Calculates variable descriptor size
+        * @since Series 60 3.2
+        * @param aDescriptor which size is calculated
+        */
+        TInt CalculateDescriptorSize( const TDesC& aDescriptor ) const;
+        
+        /**
+        * Calculates variable descriptor size
+        * @since Series 60 3.2
+        * @param aDescriptor which size is calculated
+        */
+        TInt CalculateDescriptorSize( const TDesC8& aDescriptor ) const;
+        
+        /**
+        * Read descriptor value from stream
+        * @since Series 60 3.2
+        * @param aStream used stream
+        * @param aDescriptor which is read from stream
+        */
+        void ReadDescriptorFromStreamL( RDesReadStream& aStream, HBufC8*& aDescriptor );
+        
+        /**
+        * Read descriptor value from stream
+        * @since Series 60 3.2
+        * @param aStream used stream
+        * @param aDescriptor which is read from stream
+        */
+        void ReadDescriptorFromStreamL( RDesReadStream& aStream, HBufC*& aDescriptor );
+        
+        /**
+        * Write descriptor value to stream
+        * @since Series 60 3.2
+        * @param aStream used stream
+        * @param aDescriptor which value is write to stream
+        */
+        void WriteDescriptorToStreamL( RDesWriteStream& aStream, const TDesC8& aDescriptor );
+        
+        /**
+        * Write descriptor value to stream
+        * @since Series 60 3.2
+        * @param aStream used stream
+        * @param aDescriptor which value is write to stream
+        */
+        void WriteDescriptorToStreamL( RDesWriteStream& aStream, const TDesC& aDescriptor );
+        
+     
+        /**
+        * Copy descriptor value to member descriptor
+        * @since Series 60 3.2
+        * @param aSource which is as copy source
+        * @param aMemberDescriptor is as copy destination
+        */
+        void CopyDescriptorToMemberDescriptorL( const TDesC& aSource, HBufC*& aMemberDescriptor );
+        
+        /**
+        * Copy descriptor value to member descriptor
+        * @since Series 60 3.2
+        * @param aSource which is as copy source
+        * @param aMemberDescriptor is as copy destination
+        */
+        void CopyDescriptorToMemberDescriptorL( const TDesC8& aSource, HBufC8*& aMemberDescriptor );        
+     
+        
+        /**
+        * Check descriptor max length
+        * Leaves with KErrArgument if aDescriptorLength is greated that aMaxAllowedDescriptorLenght
+        * @since Series 60 3.2
+        * @param aDescriptorLength is descriptor length
+        * @param  aMaxAllowedDescriptorLength maximum allowed descriptor length
+        */
+        void CheckDescriptorMaxLengthL( TInt aDescriptorLength, TInt aMaxAllowedDescriptorLength ) const;
+        
+
+    };
+
+#endif      // CPHCLTEXTPHONEDIALDATA_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/inc/mphcltextphoneobserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  It defines the interface for the observers of 
+*                the CPhCltExtPhoneBase.
+*
+*/
+
+
+#ifndef MPHCLTEXTPHONEOBSERVER_H   
+#define MPHCLTEXTPHONEOBSERVER_H   
+
+// CLASS DECLARATION
+
+/**
+*  Defines the interface for the observers of the CPhCltExtPhoneBase.
+*
+*  @lib phoneclient.lib
+*  @since 1.0
+*/
+class MPhCltExtPhoneObserver
+    {          
+    public:  // New functions   
+        
+        /**
+        * It is called whenever client's dial request is completed.
+        *
+        * @param aStatus It is the status of the operation.
+        *                <0 means Symbian OS error code.
+        */       
+        virtual void HandleDialL( const TInt aStatus ) = 0;
+        
+    };
+
+#endif      // MPHCLTEXTPHONEOBSERVER_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/inc/rphcltemergencycall.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,233 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Client side access to emergency call
+*
+*/
+
+
+#ifndef RPhCltEmergencyCall_H
+#define RPhCltEmergencyCall_H
+
+//  INCLUDES
+#include <e32std.h>
+#include "phclttypes.h" 
+#include "rphcltserver.h" 
+
+/**
+* Emergency number query mode
+*/
+enum TPhCltEmergencyNumberQueryMode
+    {
+    EPhCltEmergencyNumberQueryModeNormal = 0,  // Normal mode
+    EPhCltEmergencyNumberQueryModeAdvanced,    // advanced mode
+    EPhCltEmergencyNumberQueryModeNormalWriteback   // Same as "normal", but writes back emergency number
+    };
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+*  Client side access to emergency call
+*
+*  @lib phoneclient.lib
+*  @since Series60_1.0
+*/
+class RPhCltEmergencyCall : public RSubSessionBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        RPhCltEmergencyCall();
+
+
+    public:  // New functions
+
+        /**
+        * Opens the subsession.
+        *
+        * @param aServer It is the session of which subsession this is.
+        * @return Returns error code.
+        */
+        TInt Open( RPhCltServer& aServer );
+
+        /**
+         * Closes the subsession.
+         */
+        void Close();
+
+
+    public:
+
+       /**
+        * Returns information whether the number specified was an emergency number.
+        * 
+        * @param aNumber Number to be queried. aNumber might contain prefix (SS code)
+        *                and/or postfix (DTMF part).  
+        *                The aNumber parameter should be a buffer and the 
+        *                clients are provided with a typedef called 
+        *                TPhCltEmergencyNumber, which is equivalent to a 
+        *                TBuf< KPhCltEmergencyNumberSize > where 
+        *                KPhCltEmergencyNumberSize is defined as 100. 
+        *
+        * @param aIsEmergencyNumber If ETrue, then the aNumber 
+        *                           parameter included emergency number.
+        * @return Returns error code of the success of the operation.
+        */
+        TInt IsEmergencyPhoneNumber(
+            const TDesC& aNumber, 
+            TBool& aIsEmergencyNumber );
+
+        /**
+        * Method can be used to check if the number specified contains 
+        * a valid emergency number in the end of the number.
+        * 
+        * @param aNumber Number to be queried, matched emergency number 
+        *                is returned in this parameter.
+        *                The aNumber parameter should be a buffer and the 
+        *                clients are provided with a typedef called 
+        *                TPhCltTelephoneNumberwhich is equivalent to a 
+        *                TBuf< KPhCltTelephoneNumberLength > where 
+        *                KPhCltTelephoneNumberLength is defined as 100. 
+        *             
+        * @param aIsEmergencyNumber If ETrue, then the aNumber parameter 
+        *                           was emergency number. 
+        * @return Returns error code of the success of the operation.
+        */
+        TInt FindEmergencyPhoneNumber(
+            TDes& aNumber, 
+            TBool& aIsEmergencyNumber );
+
+        /**
+        * Initiates an emergency call.
+        *
+        * @param aReqStatus On return, KErrNone if the emergency call successfully reaches 
+        *                   the connected state. If the call set-up fails, the function 
+        *                   member will complete with an error.
+        *
+        * @param aNumber Emergency number to be dialed (optional).
+        *                The aNumber parameter should be a buffer and the 
+        *                clients are provided with a typedef called 
+        *                TPhCltEmergencyNumber,which is equivalent to a 
+        *                TBuf< KPhCltEmergencyNumberSize > where 
+        *                KPhCltEmergencyNumberSize is defined as 100. 
+        *
+        *                If the aNumber parameter supplies an "empty" buffer 
+        *                the call is created either dialing the default emergency 
+        *                phone number or use the SET UP EMERGENCY request  
+        *                that does not contain a dialling number.               
+        *
+        * @pre IsActive() returns EFalse, otherwise leaves with KErrInUse.
+        */
+        void DialEmergencyCall( TRequestStatus& aReqStatus, TDesC8& aNumber );
+        
+        /**
+        * Cancels an emergency call.
+        *
+        */
+        void CancelDialEmergencyCall();
+        
+        /**
+        * Returns information whether the number specified was an emergency 
+        * number and also returns the plain emergency number.
+        * 
+        * @param aNumber Number to be queried.aNumber might contain prefix (SS code)
+        *                and/or postfix (DTMF part).
+        *                The aNumber parameter should be a buffer and the 
+        *                clients are provided with a typedef called 
+        *                TPhCltEmergencyNumberwhich is equivalent to a 
+        *                TBuf< KPhCltEmergencyNumberSize > where 
+        *                KPhCltEmergencyNumberSize is defined as 100. 
+        *
+        * @param aMatchedEmergencyNumber Matched emergencynumber without prefix or 
+        *                postfix is returned in this parameter. The aMatchedEmergencyNumber 
+        *                parameter should be a buffer and the clients are
+        *                provided with atypedef called TPhCltEmergencyNumber,
+        *                which is equivalent to a TBuf< KPhCltEmergencyNumberSize > 
+        *                where KPhCltEmergencyNumberSize is defined as 100.
+        * 
+        * @param aIsEmergencyNumber If ETrue, then the aNumber 
+        *                           parameter included emergency number.
+        *
+        * @return Returns error code of the success of the operation.
+        */
+        TInt IsEmergencyPhoneNumber(
+            const TDesC& aNumber,
+            TDes& aMatchedEmergencyNumber, 
+            TBool& aIsEmergencyNumber );                    
+        
+       private:            
+           
+        /**
+         * Extract telephone number from string. If EFalse is returned
+         * then aString does not contain valid emergency number
+         * 
+         * @param aString string from which those characters are removed.
+         *
+         * @return ETrue - aString can be emergency number and aString
+         *                 contains a telephone number
+         *         EFalse - aString cannot be emergency number and aString
+         *                  does not contain a number that can be emergency number
+         */
+        TBool ExtractTelephoneNumber( TDes& aString );
+        
+        /**
+        * Finds start of dtmf string in string.
+        *
+        * @param   aString      Telephone number
+        *
+        * @return  Index where dtmf string starts or KErrNotFound if no
+        * dtmf found.
+        *
+        */
+        TInt FindStartOfDtmfString( const TDesC& aString );
+        
+        /**
+        * Removes CLIR ss code from beginning of the string if CLIR is
+        * found from string.
+        *
+        * @param    aString Telephone number
+        */
+        void RemoveCLIR( TDes& aString );
+        
+        /**
+         * Removes DTMF string from string.
+         * 
+         * @param aString Telephone number.
+         */
+        void RemoveDTMF( TDes& aString );
+        
+        /**
+        * Executes checks to given phone number to find out if it is a valid 
+        * emergency number. 
+        *
+        * @param    aString             Telephone number
+        * @param    aIsEmergencyNumber  If ETrue, then the aNumber parameter 
+        *                               was a valid emergency number.
+        *
+        * @return Returns error code of the success of the operation.
+        *
+        */
+        TInt ValidateNumber( TDes& aString, TBool& aIsEmergencyNumber, 
+                            const TBool aWriteEmergencyNumBack );
+                            
+                                 
+
+    };
+
+#endif // RPhCltEmergencyCall_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/bmarm/phoneclientu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,101 @@
+EXPORTS
+	__9RPhCltIhf @ 1 NONAME R3UNUSED ; RPhCltIhf::RPhCltIhf(void)
+	AppStarting__10RPhCltUssd @ 2 NONAME R3UNUSED ; RPhCltUssd::AppStarting(void)
+	AppTerminating__10RPhCltUssd23TPhCltUssdAppExitReason @ 3 NONAME R3UNUSED ; RPhCltUssd::AppTerminating(TPhCltUssdAppExitReason)
+	AppToBackground__10RPhCltUssd @ 4 NONAME R3UNUSED ; RPhCltUssd::AppToBackground(void)
+	AppToForeground__10RPhCltUssd @ 5 NONAME R3UNUSED ; RPhCltUssd::AppToForeground(void)
+	CancelNotifyCallAttempt__C16RPhCltCallNotify @ 6 NONAME R3UNUSED ; RPhCltCallNotify::CancelNotifyCallAttempt(void) const
+	CancelNotifyPhoneStatusRequest__C16RPhCltCallNotify @ 7 NONAME R3UNUSED ; RPhCltCallNotify::CancelNotifyPhoneStatusRequest(void) const
+	CancelReportPhoneStatus__C16RPhCltCallNotify @ 8 NONAME R3UNUSED ; RPhCltCallNotify::CancelReportPhoneStatus(void) const
+	CancelSend__10RPhCltUssd @ 9 NONAME R3UNUSED ; RPhCltUssd::CancelSend(void)
+	CleanupEmergencyListPushL__21RPhCltEmergencyNumberRt13RPointerArray1Z24CPhCltEmergencyTelNumber @ 10 NONAME R3UNUSED ; RPhCltEmergencyNumber::CleanupEmergencyListPushL(RPointerArray<CPhCltEmergencyTelNumber> &)
+	Close__10RPhCltUssd @ 11 NONAME R3UNUSED ; RPhCltUssd::Close(void)
+	Close__16RPhCltCallNotify @ 12 NONAME R3UNUSED ; RPhCltCallNotify::Close(void)
+	Close__18RPhCltResourceFile @ 13 NONAME R3UNUSED ; RPhCltResourceFile::Close(void)
+	Close__21RPhCltEmergencyNumber @ 14 NONAME R3UNUSED ; RPhCltEmergencyNumber::Close(void)
+	Close__9RPhCltIhf @ 15 NONAME R3UNUSED ; RPhCltIhf::Close(void)
+	Connect__12RPhCltServeri @ 16 NONAME R3UNUSED ; RPhCltServer::Connect(int)
+	ContactId__C22TPhCltExtPhoneDialData @ 17 NONAME R3UNUSED ; TPhCltExtPhoneDialData::ContactId(void) const
+	CreateAll__12RPhCltServerR14TRequestStatus @ 18 NONAME R3UNUSED ; RPhCltServer::CreateAll(TRequestStatus &)
+	DialData__12CPhCltDialer @ 19 NONAME R3UNUSED ; CPhCltDialer::DialData(void)
+	DialL__18CPhCltExtPhoneBaseRCt4TBuf1i50i @ 20 NONAME R3UNUSED ; CPhCltExtPhoneBase::DialL(TBuf<50> const &, int)
+	EmergencyNumberListLC__21RPhCltEmergencyNumberi @ 21 NONAME R3UNUSED ; RPhCltEmergencyNumber::EmergencyNumberListLC(int)
+	EndOtherCalls__C22TPhCltExtPhoneDialData @ 22 NONAME R3UNUSED ; TPhCltExtPhoneDialData::EndOtherCalls(void) const
+	ExecuteLD__12CPhCltDialer @ 23 NONAME R3UNUSED ; CPhCltDialer::ExecuteLD(void)
+	ExternalizeL__C24CPhCltEmergencyTelNumberR12RWriteStream @ 24 NONAME R3UNUSED ; CPhCltEmergencyTelNumber::ExternalizeL(RWriteStream &) const
+	InternalizeL__24CPhCltEmergencyTelNumberR11RReadStream @ 25 NONAME R3UNUSED ; CPhCltEmergencyTelNumber::InternalizeL(RReadStream &)
+	IsEmergenyPhoneNumber__21RPhCltEmergencyNumberRCt4TBuf1i50Ri30TPhCltEmergencyNumberQueryMode @ 26 NONAME ; RPhCltEmergencyNumber::IsEmergenyPhoneNumber(TBuf<50> const &, int &, TPhCltEmergencyNumberQueryMode)
+	IsValidChar__10PhCltUtilsG5TChar @ 27 NONAME R3UNUSED ; PhCltUtils::IsValidChar(TChar)
+	MCC__C24CPhCltEmergencyTelNumber @ 28 NONAME R3UNUSED ; CPhCltEmergencyTelNumber::MCC(void) const
+	MNC__C24CPhCltEmergencyTelNumber @ 29 NONAME R3UNUSED ; CPhCltEmergencyTelNumber::MNC(void) const
+	Name__C22TPhCltExtPhoneDialData @ 30 NONAME R3UNUSED ; TPhCltExtPhoneDialData::Name(void) const
+	NewLC__24CPhCltEmergencyTelNumber @ 31 NONAME R3UNUSED ; CPhCltEmergencyTelNumber::NewLC(void)
+	NewL__10CPhCltUssdi @ 32 NONAME R3UNUSED ; CPhCltUssd::NewL(int)
+	NewL__12CPhCltDialer @ 33 NONAME R3UNUSED ; CPhCltDialer::NewL(void)
+	NewL__18CPhCltExtPhoneBaseP22MPhCltExtPhoneObserver @ 34 NONAME R3UNUSED ; CPhCltExtPhoneBase::NewL(MPhCltExtPhoneObserver *)
+	NotifyCallAttempt__16RPhCltCallNotifyR14TRequestStatusR5TDes8 @ 35 NONAME R3UNUSED ; RPhCltCallNotify::NotifyCallAttempt(TRequestStatus &, TDes8 &)
+	NotifyPhoneStatusRequest__16RPhCltCallNotifyR14TRequestStatus @ 36 NONAME R3UNUSED ; RPhCltCallNotify::NotifyPhoneStatusRequest(TRequestStatus &)
+	NumberType__C22TPhCltExtPhoneDialData @ 37 NONAME R3UNUSED ; TPhCltExtPhoneDialData::NumberType(void) const
+	OpenL__18RPhCltResourceFileR7CCoeEnv @ 38 NONAME R3UNUSED ; RPhCltResourceFile::OpenL(CCoeEnv &)
+	Open__10RPhCltUssdR12RPhCltServer @ 39 NONAME R3UNUSED ; RPhCltUssd::Open(RPhCltServer &)
+	Open__16RPhCltCallNotifyR12RPhCltServer @ 40 NONAME R3UNUSED ; RPhCltCallNotify::Open(RPhCltServer &)
+	Open__21RPhCltEmergencyNumberR12RPhCltServer @ 41 NONAME R3UNUSED ; RPhCltEmergencyNumber::Open(RPhCltServer &)
+	Open__9RPhCltIhfR12RPhCltServeri @ 42 NONAME R3UNUSED ; RPhCltIhf::Open(RPhCltServer &, int)
+	Redial__C22TPhCltExtPhoneDialData @ 43 NONAME R3UNUSED ; TPhCltExtPhoneDialData::Redial(void) const
+	RemoveInvalidChars__10PhCltUtilsR6TDes16 @ 44 NONAME R3UNUSED ; PhCltUtils::RemoveInvalidChars(TDes16 &)
+	ReportPhoneStatus__16RPhCltCallNotifyR14TRequestStatusi @ 45 NONAME R3UNUSED ; RPhCltCallNotify::ReportPhoneStatus(TRequestStatus &, int)
+	RespondClient__16RPhCltCallNotifyi @ 46 NONAME R3UNUSED ; RPhCltCallNotify::RespondClient(int)
+	ReturnToNumberEntryOnFailure__C22TPhCltExtPhoneDialData @ 47 NONAME R3UNUSED ; TPhCltExtPhoneDialData::ReturnToNumberEntryOnFailure(void) const
+	SendUssdCancel__10CPhCltUssd @ 48 NONAME R3UNUSED ; CPhCltUssd::SendUssdCancel(void)
+	SendUssd__10CPhCltUssdRC6TDesC8 @ 49 NONAME R3UNUSED ; CPhCltUssd::SendUssd(TDesC8 const &)
+	SendUssd__10CPhCltUssdRC6TDesC8T1 @ 50 NONAME R3UNUSED ; CPhCltUssd::SendUssd(TDesC8 const &, TDesC8 const &)
+	SendUssd__10CPhCltUssdRC7TDesC16 @ 51 NONAME R3UNUSED ; CPhCltUssd::SendUssd(TDesC16 const &)
+	SendUssd__10RPhCltUssdR14TRequestStatusRC6TDesC8T2 @ 52 NONAME ; RPhCltUssd::SendUssd(TRequestStatus &, TDesC8 const &, TDesC8 const &)
+	SetAllowMatch__22TPhCltExtPhoneDialDatai @ 53 NONAME R3UNUSED ; TPhCltExtPhoneDialData::SetAllowMatch(int)
+	SetContactId__22TPhCltExtPhoneDialDatal @ 54 NONAME R3UNUSED ; TPhCltExtPhoneDialData::SetContactId(long)
+	SetEndOtherCalls__22TPhCltExtPhoneDialDatai @ 55 NONAME R3UNUSED ; TPhCltExtPhoneDialData::SetEndOtherCalls(int)
+	SetIhfMode__9RPhCltIhfii @ 56 NONAME R3UNUSED ; RPhCltIhf::SetIhfMode(int, int)
+	SetL__24CPhCltEmergencyTelNumberRCt4TBuf1i50UsUs @ 57 NONAME ; CPhCltEmergencyTelNumber::SetL(TBuf<50> const &, unsigned short, unsigned short)
+	SetName__22TPhCltExtPhoneDialDataRCt4TBuf1i50 @ 58 NONAME R3UNUSED ; TPhCltExtPhoneDialData::SetName(TBuf<50> const &)
+	SetNumberType__22TPhCltExtPhoneDialDatai @ 59 NONAME R3UNUSED ; TPhCltExtPhoneDialData::SetNumberType(int)
+	SetRedial__22TPhCltExtPhoneDialDatai @ 60 NONAME R3UNUSED ; TPhCltExtPhoneDialData::SetRedial(int)
+	SetReturnToNumberEntryOnFailure__22TPhCltExtPhoneDialDatai @ 61 NONAME R3UNUSED ; TPhCltExtPhoneDialData::SetReturnToNumberEntryOnFailure(int)
+	SetShowNumber__22TPhCltExtPhoneDialDatai @ 62 NONAME R3UNUSED ; TPhCltExtPhoneDialData::SetShowNumber(int)
+	SetTelephoneNumber__22TPhCltExtPhoneDialDataRCt4TBuf1i50 @ 63 NONAME R3UNUSED ; TPhCltExtPhoneDialData::SetTelephoneNumber(TBuf<50> const &)
+	SetWindowGroup__22TPhCltExtPhoneDialDatai @ 64 NONAME R3UNUSED ; TPhCltExtPhoneDialData::SetWindowGroup(int)
+	ShowNumber__C22TPhCltExtPhoneDialData @ 65 NONAME R3UNUSED ; TPhCltExtPhoneDialData::ShowNumber(void) const
+	StartUssdEditor__C10RPhCltUssd @ 66 NONAME R3UNUSED ; RPhCltUssd::StartUssdEditor(void) const
+	TelNumber__C24CPhCltEmergencyTelNumber @ 67 NONAME R3UNUSED ; CPhCltEmergencyTelNumber::TelNumber(void) const
+	TelephoneNumber__C22TPhCltExtPhoneDialData @ 68 NONAME R3UNUSED ; TPhCltExtPhoneDialData::TelephoneNumber(void) const
+	WindowGroupId__C22TPhCltExtPhoneDialData @ 69 NONAME R3UNUSED ; TPhCltExtPhoneDialData::WindowGroupId(void) const
+	"_._10CPhCltUssd" @ 70 NONAME R3UNUSED ; CPhCltUssd::~CPhCltUssd(void)
+	"_._24CPhCltEmergencyTelNumber" @ 71 NONAME R3UNUSED ; CPhCltEmergencyTelNumber::~CPhCltEmergencyTelNumber(void)
+	__10RPhCltUssd @ 72 NONAME R3UNUSED ; RPhCltUssd::RPhCltUssd(void)
+	__12RPhCltServer @ 73 NONAME R3UNUSED ; RPhCltServer::RPhCltServer(void)
+	__16RPhCltCallNotify @ 74 NONAME R3UNUSED ; RPhCltCallNotify::RPhCltCallNotify(void)
+	__18RPhCltResourceFile @ 75 NONAME R3UNUSED ; RPhCltResourceFile::RPhCltResourceFile(void)
+	__21RPhCltEmergencyNumber @ 76 NONAME R3UNUSED ; RPhCltEmergencyNumber::RPhCltEmergencyNumber(void)
+	__22TPhCltExtPhoneDialData @ 77 NONAME R3UNUSED ; TPhCltExtPhoneDialData::TPhCltExtPhoneDialData(void)
+	__22TPhCltExtPhoneDialDataRCt4TBuf1i50T1li @ 78 NONAME ; TPhCltExtPhoneDialData::TPhCltExtPhoneDialData(TBuf<50> const &, TBuf<50> const &, long, int)
+	__22TPhCltExtPhoneDialDataRCt4TBuf1i50i @ 79 NONAME R3UNUSED ; TPhCltExtPhoneDialData::TPhCltExtPhoneDialData(TBuf<50> const &, int)
+	__22TPhCltExtPhoneDialDataRCt4TBuf1i50l @ 80 NONAME R3UNUSED ; TPhCltExtPhoneDialData::TPhCltExtPhoneDialData(TBuf<50> const &, long)
+	__22TPhCltExtPhoneDialDataRCt4TBuf1i50li @ 81 NONAME ; TPhCltExtPhoneDialData::TPhCltExtPhoneDialData(TBuf<50> const &, long, int)
+	AllowMatch__C22TPhCltExtPhoneDialData @ 82 NONAME R3UNUSED ; TPhCltExtPhoneDialData::AllowMatch(void) const
+	SetIhfModeFromPhone__9RPhCltIhfii @ 83 NONAME R3UNUSED ; RPhCltIhf::SetIhfModeFromPhone(int, int)
+	NewL__19CPhCltUssdSatClienti @ 84 NONAME R3UNUSED ; CPhCltUssdSatClient::NewL(int)
+	SendSatMessage__19CPhCltUssdSatClientRC7TDesC16R6TDes16RiRQ219CPhCltUssdSatClient9TPhCltDcs @ 85 NONAME ; CPhCltUssdSatClient::SendSatMessage(TDesC16 const &, TDes16 &, int &, CPhCltUssdSatClient::TPhCltDcs &)
+	"_._19CPhCltUssdSatClient" @ 86 NONAME R3UNUSED ; CPhCltUssdSatClient::~CPhCltUssdSatClient(void)
+	SetEmergency__22TPhCltExtPhoneDialDatai @ 87 NONAME R3UNUSED ; TPhCltExtPhoneDialData::SetEmergency(int)
+	SetSubAddress__22TPhCltExtPhoneDialDataRCt4TBuf1i21 @ 88 NONAME R3UNUSED ; TPhCltExtPhoneDialData::SetSubAddress(TBuf<21> const &)
+	SetSATCall__22TPhCltExtPhoneDialDatai @ 89 NONAME R3UNUSED ; TPhCltExtPhoneDialData::SetSATCall(int)
+	SetBearer__22TPhCltExtPhoneDialDataRCt5TBuf81i14 @ 90 NONAME R3UNUSED ; TPhCltExtPhoneDialData::SetBearer(TBuf8<14> const &)
+	Emergency__C22TPhCltExtPhoneDialData @ 91 NONAME R3UNUSED ; TPhCltExtPhoneDialData::Emergency(void) const
+	SubAddress__C22TPhCltExtPhoneDialData @ 92 NONAME R3UNUSED ; TPhCltExtPhoneDialData::SubAddress(void) const
+	SATCall__C22TPhCltExtPhoneDialData @ 93 NONAME R3UNUSED ; TPhCltExtPhoneDialData::SATCall(void) const
+	Bearer__C22TPhCltExtPhoneDialData @ 94 NONAME R3UNUSED ; TPhCltExtPhoneDialData::Bearer(void) const
+	AsIPCStruct__C22TPhCltExtPhoneDialDataR14TPhCltCallArgs @ 95 NONAME R3UNUSED ; TPhCltExtPhoneDialData::AsIPCStruct(TPhCltCallArgs &) const
+	CallType__C22TPhCltExtPhoneDialData @ 96 NONAME R3UNUSED ; TPhCltExtPhoneDialData::CallType(void) const
+	SetCallType__22TPhCltExtPhoneDialData14TPhCltCallType @ 97 NONAME R3UNUSED ; TPhCltExtPhoneDialData::SetCallType(TPhCltCallType)
+	IsEmergencyPhoneNumber__21RPhCltEmergencyNumberRt4TBuf1i50Ri30TPhCltEmergencyNumberQueryMode @ 98 NONAME ; RPhCltEmergencyNumber::IsEmergencyPhoneNumber(TBuf<50> &, int &, TPhCltEmergencyNumberQueryMode)
+	SendSatMessageCancel__19CPhCltUssdSatClient @ 99 NONAME R3UNUSED ; CPhCltUssdSatClient::SendSatMessageCancel(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/bwins/phoneclient_aiwextu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,78 @@
+EXPORTS
+	??0RPhCltResourceFile@@QAE@XZ @ 1 NONAME ; RPhCltResourceFile::RPhCltResourceFile(void)
+	??0RPhCltServer@@QAE@XZ @ 2 NONAME ; RPhCltServer::RPhCltServer(void)
+	??1CPhCltCallNotify@@UAE@XZ @ 3 NONAME ; CPhCltCallNotify::~CPhCltCallNotify(void)
+	??1CPhCltExtPhoneDialData@@UAE@XZ @ 4 NONAME ; CPhCltExtPhoneDialData::~CPhCltExtPhoneDialData(void)
+	??1CPhCltUssdSatClient@@UAE@XZ @ 5 NONAME ; CPhCltUssdSatClient::~CPhCltUssdSatClient(void)
+	?AllowMatch@CPhCltExtPhoneDialData@@UBEHXZ @ 6 NONAME ; int CPhCltExtPhoneDialData::AllowMatch(void) const
+	?Bearer@CPhCltExtPhoneDialData@@UBEABV?$TBuf8@$0O@@@XZ @ 7 NONAME ; class TBuf8<14> const & CPhCltExtPhoneDialData::Bearer(void) const
+	?CalculatePackageSize@CPhCltExtPhoneDialData@@QBEHXZ @ 8 NONAME ; int CPhCltExtPhoneDialData::CalculatePackageSize(void) const
+	?CallType@CPhCltExtPhoneDialData@@UBE?AW4TPhCltCallType@@XZ @ 9 NONAME ; enum TPhCltCallType CPhCltExtPhoneDialData::CallType(void) const
+	?CancelNotifyDialRequest@CPhCltCallNotify@@QAEXXZ @ 10 NONAME ; void CPhCltCallNotify::CancelNotifyDialRequest(void)
+	?CancelNotifyComHandCommand@CPhCltCallNotify@@QBEXXZ @ 11 NONAME ; void CPhCltCallNotify::CancelNotifyComHandCommand(void) const
+	?CancelNotifyEmergencyCall@CPhCltCallNotify@@QBEXXZ @ 12 NONAME ; void CPhCltCallNotify::CancelNotifyEmergencyCall(void) const
+	?Close@CPhCltCallNotify@@QAEXXZ @ 13 NONAME ; void CPhCltCallNotify::Close(void)
+	?Close@RPhCltResourceFile@@QAEXXZ @ 14 NONAME ; void RPhCltResourceFile::Close(void)
+	?Connect@RPhCltServer@@QAEHH@Z @ 15 NONAME ; int RPhCltServer::Connect(int)
+	?ContactLink@CPhCltExtPhoneDialData@@UBEABVTDesC8@@XZ @ 16 NONAME ; class TDesC8 const & CPhCltExtPhoneDialData::ContactLink(void) const
+	?CreateAll@RPhCltServer@@QAEXAAVTRequestStatus@@@Z @ 17 NONAME ; void RPhCltServer::CreateAll(class TRequestStatus &)
+	?EndOtherCalls@CPhCltExtPhoneDialData@@UBEHXZ @ 18 NONAME ; int CPhCltExtPhoneDialData::EndOtherCalls(void) const
+	?InitiateCall@CPhCltExtPhoneDialData@@UBEHXZ @ 19 NONAME ; int CPhCltExtPhoneDialData::InitiateCall(void) const
+	?IsValidChar@PhCltUtils@@SAHVTChar@@@Z @ 20 NONAME ; int PhCltUtils::IsValidChar(class TChar)
+	?Name@CPhCltExtPhoneDialData@@UBEABV?$TBuf@$0DC@@@XZ @ 21 NONAME ; class TBuf<50> const & CPhCltExtPhoneDialData::Name(void) const
+	?NewL@CPhCltCallNotify@@SAPAV1@XZ @ 22 NONAME ; class CPhCltCallNotify * CPhCltCallNotify::NewL(void)
+	?NewL@CPhCltCommandHandler@@SAPAV1@XZ @ 23 NONAME ; class CPhCltCommandHandler * CPhCltCommandHandler::NewL(void)
+	?NewL@CPhCltEmergencyCall@@SAPAV1@PAVMPhCltEmergencyCallObserver@@@Z @ 24 NONAME ; class CPhCltEmergencyCall * CPhCltEmergencyCall::NewL(class MPhCltEmergencyCallObserver *)
+	?NewL@CPhCltExtPhoneBase@@SAPAV1@PAVMPhCltExtPhoneObserver@@@Z @ 25 NONAME ; class CPhCltExtPhoneBase * CPhCltExtPhoneBase::NewL(class MPhCltExtPhoneObserver *)
+	?NewL@CPhCltExtPhoneDialData@@SAPAV1@ABVTDesC8@@@Z @ 26 NONAME ; class CPhCltExtPhoneDialData * CPhCltExtPhoneDialData::NewL(class TDesC8 const &)
+	?NewL@CPhCltExtPhoneDialData@@SAPAV1@XZ @ 27 NONAME ; class CPhCltExtPhoneDialData * CPhCltExtPhoneDialData::NewL(void)
+	?NewL@CPhCltImageHandler@@SAPAV1@XZ @ 28 NONAME ; class CPhCltImageHandler * CPhCltImageHandler::NewL(void)
+	?NewL@CPhCltMessenger@@SAPAV1@ABVTUid@@ABH@Z @ 29 NONAME ; class CPhCltMessenger * CPhCltMessenger::NewL(class TUid const &, int const &)
+	?NewL@CPhCltUssd@@SAPAV1@H@Z @ 30 NONAME ; class CPhCltUssd * CPhCltUssd::NewL(int)
+	?NewL@CPhCltUssdInt@@SAPAV1@H@Z @ 31 NONAME ; class CPhCltUssdInt * CPhCltUssdInt::NewL(int)
+	?NewL@CPhCltUssdSatClient@@SAPAV1@H@Z @ 32 NONAME ; class CPhCltUssdSatClient * CPhCltUssdSatClient::NewL(int)
+	?NewLC@CPhCltExtPhoneDialData@@SAPAV1@ABVTDesC8@@@Z @ 33 NONAME ; class CPhCltExtPhoneDialData * CPhCltExtPhoneDialData::NewLC(class TDesC8 const &)
+	?NewLC@CPhCltExtPhoneDialData@@SAPAV1@XZ @ 34 NONAME ; class CPhCltExtPhoneDialData * CPhCltExtPhoneDialData::NewLC(void)
+	?NotifyDialRequest@CPhCltCallNotify@@QAEXPAVMPhCltDialRequestObserver@@@Z @ 35 NONAME ; void CPhCltCallNotify::NotifyDialRequest(class MPhCltDialRequestObserver *)
+	?NotifyComHandCommand@CPhCltCallNotify@@QAEXPAVMPhCltComHandRequestObserver@@AAVTDes8@@@Z @ 36 NONAME ; void CPhCltCallNotify::NotifyComHandCommand( class MPhCltComHandRequestObserver *)
+	?NotifyEmergencyCall@CPhCltCallNotify@@QAEXPAVMPhCltDialEmergencyRequestObserver@@AAVTDesC16@@@Z @ 37 NONAME ; void CPhCltCallNotify::NotifyEmergencyCall(class MPhCltDialEmergencyRequestObserver *, class TDesC16 &)
+	?Open@CPhCltCallNotify@@QAEHAAVRPhCltServer@@@Z @ 38 NONAME ; int CPhCltCallNotify::Open(class RPhCltServer &)
+	?OpenL@RPhCltResourceFile@@QAEXAAVCCoeEnv@@@Z @ 39 NONAME ; void RPhCltResourceFile::OpenL(class CCoeEnv &)
+	?PackLC@CPhCltExtPhoneDialData@@QAEPAVHBufC8@@XZ @ 40 NONAME ; class HBufC8 * CPhCltExtPhoneDialData::PackLC(void)
+	?Redial@CPhCltExtPhoneDialData@@UBEHXZ @ 41 NONAME ; int CPhCltExtPhoneDialData::Redial(void) const
+	?RedialMaximumDuration@CPhCltExtPhoneDialData@@UBE?BVTTimeIntervalSeconds@@XZ @ 42 NONAME ; class TTimeIntervalSeconds const CPhCltExtPhoneDialData::RedialMaximumDuration(void) const
+	?RemoveInvalidChars@PhCltUtils@@SAXAAVTDes16@@@Z @ 43 NONAME ; void PhCltUtils::RemoveInvalidChars(class TDes16 &)
+	?RemoveURIPrefixdAndDomainChars@PhCltUtils@@SAXAAVTDes16@@@Z @ 44 NONAME ; void PhCltUtils::RemoveURIPrefixdAndDomainChars(class TDes16 &)
+	?RespondClient@CPhCltCallNotify@@QAEHH@Z @ 45 NONAME ; int CPhCltCallNotify::RespondClient(int)
+	?RespondComHandClient@CPhCltCallNotify@@QAEHH@Z @ 46 NONAME ; int CPhCltCallNotify::RespondComHandClient(int)
+	?RespondEmergencyToClient@CPhCltCallNotify@@QAEHH@Z @ 47 NONAME ; int CPhCltCallNotify::RespondEmergencyToClient(int)
+	?SATCall@CPhCltExtPhoneDialData@@UBEHXZ @ 48 NONAME ; int CPhCltExtPhoneDialData::SATCall(void) const
+	?SendKeyPressed@CPhCltExtPhoneDialData@@UBEHXZ @ 49 NONAME ; int CPhCltExtPhoneDialData::SendKeyPressed(void) const
+	?SendSatMessage@CPhCltUssdSatClient@@QAEHABVTDesC16@@EAAVTDes16@@AAHAAE@Z @ 50 NONAME ; int CPhCltUssdSatClient::SendSatMessage(class TDesC16 const &, unsigned char, class TDes16 &, int &, unsigned char &)
+	?SendSatMessageCancel@CPhCltUssdSatClient@@QAEXXZ @ 51 NONAME ; void CPhCltUssdSatClient::SendSatMessageCancel(void)
+	?ServiceId@CPhCltExtPhoneDialData@@UBEKXZ @ 52 NONAME ; unsigned long CPhCltExtPhoneDialData::ServiceId(void) const
+	?SetAllowMatch@CPhCltExtPhoneDialData@@UAEXH@Z @ 53 NONAME ; void CPhCltExtPhoneDialData::SetAllowMatch(int)
+	?SetBearerL@CPhCltExtPhoneDialData@@UAEXABV?$TBuf8@$0O@@@@Z @ 54 NONAME ; void CPhCltExtPhoneDialData::SetBearerL(class TBuf8<14> const &)
+	?SetCallType@CPhCltExtPhoneDialData@@UAEXW4TPhCltCallType@@@Z @ 55 NONAME ; void CPhCltExtPhoneDialData::SetCallType(enum TPhCltCallType)
+	?SetContactLinkL@CPhCltExtPhoneDialData@@UAEXABVTDesC8@@@Z @ 56 NONAME ; void CPhCltExtPhoneDialData::SetContactLinkL(class TDesC8 const &)
+	?SetEndOtherCalls@CPhCltExtPhoneDialData@@UAEXH@Z @ 57 NONAME ; void CPhCltExtPhoneDialData::SetEndOtherCalls(int)
+	?SetInitiateCall@CPhCltExtPhoneDialData@@UAEXH@Z @ 58 NONAME ; void CPhCltExtPhoneDialData::SetInitiateCall(int)
+	?SetNameL@CPhCltExtPhoneDialData@@UAEXABV?$TBuf@$0DC@@@@Z @ 59 NONAME ; void CPhCltExtPhoneDialData::SetNameL(class TBuf<50> const &)
+	?SetRedial@CPhCltExtPhoneDialData@@UAEXH@Z @ 60 NONAME ; void CPhCltExtPhoneDialData::SetRedial(int)
+	?SetRedialMaximumDuration@CPhCltExtPhoneDialData@@UAEXVTTimeIntervalSeconds@@@Z @ 61 NONAME ; void CPhCltExtPhoneDialData::SetRedialMaximumDuration(class TTimeIntervalSeconds)
+	?SetSATCall@CPhCltExtPhoneDialData@@UAEXH@Z @ 62 NONAME ; void CPhCltExtPhoneDialData::SetSATCall(int)
+	?SetSendKeyPressed@CPhCltExtPhoneDialData@@UAEXH@Z @ 63 NONAME ; void CPhCltExtPhoneDialData::SetSendKeyPressed(int)
+	?SetServiceId@CPhCltExtPhoneDialData@@UAEXK@Z @ 64 NONAME ; void CPhCltExtPhoneDialData::SetServiceId(unsigned long)
+	?SetShowNumber@CPhCltExtPhoneDialData@@UAEXH@Z @ 65 NONAME ; void CPhCltExtPhoneDialData::SetShowNumber(int)
+	?SetSubAddressL@CPhCltExtPhoneDialData@@UAEXABV?$TBuf@$0BF@@@@Z @ 66 NONAME ; void CPhCltExtPhoneDialData::SetSubAddressL(class TBuf<21> const &)
+	?SetTelephoneNumber@CPhCltExtPhoneDialData@@UAEXABV?$TBuf@$0GE@@@@Z @ 67 NONAME ; void CPhCltExtPhoneDialData::SetTelephoneNumber(class TBuf<100> const &)
+	?SetUUIL@CPhCltExtPhoneDialData@@UAEXABVTDesC16@@@Z @ 68 NONAME ; void CPhCltExtPhoneDialData::SetUUIL(class TDesC16 const &)
+	?SetWindowGroup@CPhCltExtPhoneDialData@@UAEXH@Z @ 69 NONAME ; void CPhCltExtPhoneDialData::SetWindowGroup(int)
+	?ShowNumber@CPhCltExtPhoneDialData@@UBEHXZ @ 70 NONAME ; int CPhCltExtPhoneDialData::ShowNumber(void) const
+	?SubAddress@CPhCltExtPhoneDialData@@UBEABV?$TBuf@$0BF@@@XZ @ 71 NONAME ; class TBuf<21> const & CPhCltExtPhoneDialData::SubAddress(void) const
+	?TelephoneNumber@CPhCltExtPhoneDialData@@UBEABV?$TBuf@$0GE@@@XZ @ 72 NONAME ; class TBuf<100> const & CPhCltExtPhoneDialData::TelephoneNumber(void) const
+	?UUI@CPhCltExtPhoneDialData@@UBEABVTDesC16@@XZ @ 73 NONAME ; class TDesC16 const & CPhCltExtPhoneDialData::UUI(void) const
+	?WindowGroup@CPhCltExtPhoneDialData@@UBEHXZ @ 74 NONAME ; int CPhCltExtPhoneDialData::WindowGroup(void) const
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/bwins/phoneclient_aiwu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,89 @@
+EXPORTS
+	??0RPhCltIhf@@QAE@XZ @ 1 NONAME ; RPhCltIhf::RPhCltIhf(void)
+	??0RPhCltResourceFile@@QAE@XZ @ 2 NONAME ; RPhCltResourceFile::RPhCltResourceFile(void)
+	??0RPhCltServer@@QAE@XZ @ 3 NONAME ; RPhCltServer::RPhCltServer(void)
+	??0RPhCltUssd@@QAE@XZ @ 4 NONAME ; RPhCltUssd::RPhCltUssd(void)
+	??1CPhCltCallNotify@@UAE@XZ @ 5 NONAME ; CPhCltCallNotify::~CPhCltCallNotify(void)
+	??1CPhCltExtPhoneDialData@@UAE@XZ @ 6 NONAME ; CPhCltExtPhoneDialData::~CPhCltExtPhoneDialData(void)
+	??1CPhCltUssd@@UAE@XZ @ 7 NONAME ; CPhCltUssd::~CPhCltUssd(void)
+	??1CPhCltUssdSatClient@@UAE@XZ @ 8 NONAME ; CPhCltUssdSatClient::~CPhCltUssdSatClient(void)
+	?AllowMatch@CPhCltExtPhoneDialData@@QBEHXZ @ 9 NONAME ; int CPhCltExtPhoneDialData::AllowMatch(void) const
+	?AppStarting@RPhCltUssd@@IAEHXZ @ 10 NONAME ; int RPhCltUssd::AppStarting(void)
+	?AppTerminating@RPhCltUssd@@IAEHW4TPhCltUssdAppExitReason@@@Z @ 11 NONAME ; int RPhCltUssd::AppTerminating(enum TPhCltUssdAppExitReason)
+	?AppToBackground@RPhCltUssd@@IAEHXZ @ 12 NONAME ; int RPhCltUssd::AppToBackground(void)
+	?AppToForeground@RPhCltUssd@@IAEHXZ @ 13 NONAME ; int RPhCltUssd::AppToForeground(void)
+	?Bearer@CPhCltExtPhoneDialData@@QBEABV?$TBuf8@$0O@@@XZ @ 14 NONAME ; class TBuf8<14> const & CPhCltExtPhoneDialData::Bearer(void) const
+	?CalculatePackageSize@CPhCltExtPhoneDialData@@QBEHXZ @ 15 NONAME ; int CPhCltExtPhoneDialData::CalculatePackageSize(void) const
+	?CallType@CPhCltExtPhoneDialData@@QBE?AW4TPhCltCallType@@XZ @ 16 NONAME ; enum TPhCltCallType CPhCltExtPhoneDialData::CallType(void) const
+	?CancelNotifyCallAttempt@CPhCltCallNotify@@QBEXXZ @ 17 NONAME ; void CPhCltCallNotify::CancelNotifyCallAttempt(void) const
+	?CancelNotifyEmergencyCall@CPhCltCallNotify@@QBEXXZ @ 18 NONAME ; void CPhCltCallNotify::CancelNotifyEmergencyCall(void) const
+	?CancelSend@RPhCltUssd@@QAEXXZ @ 19 NONAME ; void RPhCltUssd::CancelSend(void)
+	?Close@CPhCltCallNotify@@QAEXXZ @ 20 NONAME ; void CPhCltCallNotify::Close(void)
+	?Close@RPhCltIhf@@QAEXXZ @ 21 NONAME ; void RPhCltIhf::Close(void)
+	?Close@RPhCltResourceFile@@QAEXXZ @ 22 NONAME ; void RPhCltResourceFile::Close(void)
+	?Close@RPhCltUssd@@QAEXXZ @ 23 NONAME ; void RPhCltUssd::Close(void)
+	?Connect@RPhCltServer@@QAEHH@Z @ 24 NONAME ; int RPhCltServer::Connect(int)
+	?ContactLink@CPhCltExtPhoneDialData@@QBEABVTDesC8@@XZ @ 25 NONAME ; class TDesC8 const & CPhCltExtPhoneDialData::ContactLink(void) const
+	?CreateAll@RPhCltServer@@QAEXAAVTRequestStatus@@@Z @ 26 NONAME ; void RPhCltServer::CreateAll(class TRequestStatus &)
+	?EndOtherCalls@CPhCltExtPhoneDialData@@QBEHXZ @ 27 NONAME ; int CPhCltExtPhoneDialData::EndOtherCalls(void) const
+	?InitiateCall@CPhCltExtPhoneDialData@@QBEHXZ @ 28 NONAME ; int CPhCltExtPhoneDialData::InitiateCall(void) const
+	?IsValidChar@PhCltUtils@@SAHVTChar@@@Z @ 29 NONAME ; int PhCltUtils::IsValidChar(class TChar)
+	?Name@CPhCltExtPhoneDialData@@QBEABV?$TBuf@$0DC@@@XZ @ 30 NONAME ; class TBuf<50> const & CPhCltExtPhoneDialData::Name(void) const
+	?NewL@CPhCltCallNotify@@SAPAV1@XZ @ 31 NONAME ; class CPhCltCallNotify * CPhCltCallNotify::NewL(void)
+	?NewL@CPhCltEmergencyCall@@SAPAV1@PAVMPhCltEmergencyCallObserver@@@Z @ 32 NONAME ; class CPhCltEmergencyCall * CPhCltEmergencyCall::NewL(class MPhCltEmergencyCallObserver *)
+	?NewL@CPhCltExtPhoneBase@@SAPAV1@PAVMPhCltExtPhoneObserver@@@Z @ 33 NONAME ; class CPhCltExtPhoneBase * CPhCltExtPhoneBase::NewL(class MPhCltExtPhoneObserver *)
+	?NewL@CPhCltExtPhoneDialData@@SAPAV1@ABVTDesC8@@@Z @ 34 NONAME ; class CPhCltExtPhoneDialData * CPhCltExtPhoneDialData::NewL(class TDesC8 const &)
+	?NewL@CPhCltExtPhoneDialData@@SAPAV1@XZ @ 35 NONAME ; class CPhCltExtPhoneDialData * CPhCltExtPhoneDialData::NewL(void)
+	?NewL@CPhCltUssd@@SAPAV1@H@Z @ 36 NONAME ; class CPhCltUssd * CPhCltUssd::NewL(int)
+	?NewL@CPhCltUssdSatClient@@SAPAV1@H@Z @ 37 NONAME ; class CPhCltUssdSatClient * CPhCltUssdSatClient::NewL(int)
+	?NewLC@CPhCltExtPhoneDialData@@SAPAV1@ABVTDesC8@@@Z @ 38 NONAME ; class CPhCltExtPhoneDialData * CPhCltExtPhoneDialData::NewLC(class TDesC8 const &)
+	?NewLC@CPhCltExtPhoneDialData@@SAPAV1@XZ @ 39 NONAME ; class CPhCltExtPhoneDialData * CPhCltExtPhoneDialData::NewLC(void)
+	?NotifyCallAttempt@CPhCltCallNotify@@QAEXAAVTRequestStatus@@AAVCPhCltExtPhoneDialData@@@Z @ 40 NONAME ; void CPhCltCallNotify::NotifyCallAttempt(class TRequestStatus &, class CPhCltExtPhoneDialData &)
+	?NotifyEmergencyCall@CPhCltCallNotify@@QAEXAAVTRequestStatus@@AAVTDesC16@@@Z @ 41 NONAME ; void CPhCltCallNotify::NotifyEmergencyCall(class TRequestStatus &, class TDesC16 &)
+	?Open@CPhCltCallNotify@@QAEHAAVRPhCltServer@@@Z @ 42 NONAME ; int CPhCltCallNotify::Open(class RPhCltServer &)
+	?Open@RPhCltIhf@@QAEHAAVRPhCltServer@@H@Z @ 43 NONAME ; int RPhCltIhf::Open(class RPhCltServer &, int)
+	?Open@RPhCltUssd@@QAEHAAVRPhCltServer@@@Z @ 44 NONAME ; int RPhCltUssd::Open(class RPhCltServer &)
+	?OpenL@RPhCltResourceFile@@QAEXAAVCCoeEnv@@@Z @ 45 NONAME ; void RPhCltResourceFile::OpenL(class CCoeEnv &)
+	?PackLC@CPhCltExtPhoneDialData@@QAEPAVHBufC8@@XZ @ 46 NONAME ; class HBufC8 * CPhCltExtPhoneDialData::PackLC(void)
+	?Redial@CPhCltExtPhoneDialData@@QBEHXZ @ 47 NONAME ; int CPhCltExtPhoneDialData::Redial(void) const
+	?RedialMaximumDuration@CPhCltExtPhoneDialData@@QBE?BVTTimeIntervalSeconds@@XZ @ 48 NONAME ; class TTimeIntervalSeconds const CPhCltExtPhoneDialData::RedialMaximumDuration(void) const
+	?RemoveInvalidChars@PhCltUtils@@SAXAAVTDes16@@@Z @ 49 NONAME ; void PhCltUtils::RemoveInvalidChars(class TDes16 &)
+	?RemoveURIPrefixdAndDomainChars@PhCltUtils@@SAXAAVTDes16@@@Z @ 50 NONAME ; void PhCltUtils::RemoveURIPrefixdAndDomainChars(class TDes16 &)
+	?RespondClient@CPhCltCallNotify@@QAEHH@Z @ 51 NONAME ; int CPhCltCallNotify::RespondClient(int)
+	?RespondEmergencyToClient@CPhCltCallNotify@@QAEHH@Z @ 52 NONAME ; int CPhCltCallNotify::RespondEmergencyToClient(int)
+	?SATCall@CPhCltExtPhoneDialData@@QBEHXZ @ 53 NONAME ; int CPhCltExtPhoneDialData::SATCall(void) const
+	?SendKeyPressed@CPhCltExtPhoneDialData@@QBEHXZ @ 54 NONAME ; int CPhCltExtPhoneDialData::SendKeyPressed(void) const
+	?SendSatMessage@CPhCltUssdSatClient@@QAEHABVTDesC16@@EAAVTDes16@@AAHAAE@Z @ 55 NONAME ; int CPhCltUssdSatClient::SendSatMessage(class TDesC16 const &, unsigned char, class TDes16 &, int &, unsigned char &)
+	?SendSatMessageCancel@CPhCltUssdSatClient@@QAEXXZ @ 56 NONAME ; void CPhCltUssdSatClient::SendSatMessageCancel(void)
+	?SendUssd@CPhCltUssd@@QAEHABVTDesC16@@@Z @ 57 NONAME ; int CPhCltUssd::SendUssd(class TDesC16 const &)
+	?SendUssd@CPhCltUssd@@QAEHABVTDesC8@@@Z @ 58 NONAME ; int CPhCltUssd::SendUssd(class TDesC8 const &)
+	?SendUssd@CPhCltUssd@@QAEHABVTDesC8@@E@Z @ 59 NONAME ; int CPhCltUssd::SendUssd(class TDesC8 const &, unsigned char)
+	?SendUssd@RPhCltUssd@@QAEXAAVTRequestStatus@@ABVTDesC8@@1@Z @ 60 NONAME ; void RPhCltUssd::SendUssd(class TRequestStatus &, class TDesC8 const &, class TDesC8 const &)
+	?SendUssdCancel@CPhCltUssd@@QAEXXZ @ 61 NONAME ; void CPhCltUssd::SendUssdCancel(void)
+	?SetAllowMatch@CPhCltExtPhoneDialData@@QAEXH@Z @ 62 NONAME ; void CPhCltExtPhoneDialData::SetAllowMatch(int)
+	?SetBearerL@CPhCltExtPhoneDialData@@QAEXABV?$TBuf8@$0O@@@@Z @ 63 NONAME ; void CPhCltExtPhoneDialData::SetBearerL(class TBuf8<14> const &)
+	?SetCallType@CPhCltExtPhoneDialData@@QAEXW4TPhCltCallType@@@Z @ 64 NONAME ; void CPhCltExtPhoneDialData::SetCallType(enum TPhCltCallType)
+	?SetContactLinkL@CPhCltExtPhoneDialData@@QAEXABVTDesC8@@@Z @ 65 NONAME ; void CPhCltExtPhoneDialData::SetContactLinkL(class TDesC8 const &)
+	?SetEndOtherCalls@CPhCltExtPhoneDialData@@QAEXH@Z @ 66 NONAME ; void CPhCltExtPhoneDialData::SetEndOtherCalls(int)
+	?SetIhfMode@RPhCltIhf@@QAEHHH@Z @ 67 NONAME ; int RPhCltIhf::SetIhfMode(int, int)
+	?SetIhfModeFromPhone@RPhCltIhf@@QAEHHH@Z @ 68 NONAME ; int RPhCltIhf::SetIhfModeFromPhone(int, int)
+	?SetInitiateCall@CPhCltExtPhoneDialData@@QAEXH@Z @ 69 NONAME ; void CPhCltExtPhoneDialData::SetInitiateCall(int)
+	?SetNameL@CPhCltExtPhoneDialData@@QAEXABV?$TBuf@$0DC@@@@Z @ 70 NONAME ; void CPhCltExtPhoneDialData::SetNameL(class TBuf<50> const &)
+	?SetRedial@CPhCltExtPhoneDialData@@QAEXH@Z @ 71 NONAME ; void CPhCltExtPhoneDialData::SetRedial(int)
+	?SetRedialMaximumDuration@CPhCltExtPhoneDialData@@QAEXVTTimeIntervalSeconds@@@Z @ 72 NONAME ; void CPhCltExtPhoneDialData::SetRedialMaximumDuration(class TTimeIntervalSeconds)
+	?SetSATCall@CPhCltExtPhoneDialData@@QAEXH@Z @ 73 NONAME ; void CPhCltExtPhoneDialData::SetSATCall(int)
+	?SetSendKeyPressed@CPhCltExtPhoneDialData@@QAEXH@Z @ 74 NONAME ; void CPhCltExtPhoneDialData::SetSendKeyPressed(int)
+	?SetShowNumber@CPhCltExtPhoneDialData@@QAEXH@Z @ 75 NONAME ; void CPhCltExtPhoneDialData::SetShowNumber(int)
+	?SetSubAddressL@CPhCltExtPhoneDialData@@QAEXABV?$TBuf@$0BF@@@@Z @ 76 NONAME ; void CPhCltExtPhoneDialData::SetSubAddressL(class TBuf<21> const &)
+	?SetTelephoneNumber@CPhCltExtPhoneDialData@@QAEXABV?$TBuf@$0GE@@@@Z @ 77 NONAME ; void CPhCltExtPhoneDialData::SetTelephoneNumber(class TBuf<100> const &)
+	?SetWindowGroup@CPhCltExtPhoneDialData@@QAEXH@Z @ 78 NONAME ; void CPhCltExtPhoneDialData::SetWindowGroup(int)
+	?ShowNumber@CPhCltExtPhoneDialData@@QBEHXZ @ 79 NONAME ; int CPhCltExtPhoneDialData::ShowNumber(void) const
+	?StartUssdEditor@RPhCltUssd@@QBEHXZ @ 80 NONAME ; int RPhCltUssd::StartUssdEditor(void) const
+	?SubAddress@CPhCltExtPhoneDialData@@QBEABV?$TBuf@$0BF@@@XZ @ 81 NONAME ; class TBuf<21> const & CPhCltExtPhoneDialData::SubAddress(void) const
+	?TelephoneNumber@CPhCltExtPhoneDialData@@QBEABV?$TBuf@$0GE@@@XZ @ 82 NONAME ; class TBuf<100> const & CPhCltExtPhoneDialData::TelephoneNumber(void) const
+	?WindowGroup@CPhCltExtPhoneDialData@@QBEHXZ @ 83 NONAME ; int CPhCltExtPhoneDialData::WindowGroup(void) const
+	?ServiceId@CPhCltExtPhoneDialData@@QBEKXZ @ 84 NONAME ; unsigned long CPhCltExtPhoneDialData::ServiceId(void) const
+	?SetServiceId@CPhCltExtPhoneDialData@@QAEXK@Z @ 85 NONAME ; void CPhCltExtPhoneDialData::SetServiceId(unsigned long)
+	?SetUUIL@CPhCltExtPhoneDialData@@QAEXABVTDesC16@@@Z @ 86 NONAME ; void CPhCltExtPhoneDialData::SetUUIL(class TDesC16 const &)
+	?UUI@CPhCltExtPhoneDialData@@QBEABVTDesC16@@XZ @ 87 NONAME ; class TDesC16 const & CPhCltExtPhoneDialData::UUI(void) const
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/bwins/phoneclient_extu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,91 @@
+EXPORTS
+	??0RPhCltCallNotify@@QAE@XZ @ 1 NONAME ; RPhCltCallNotify::RPhCltCallNotify(void)
+	??0RPhCltEmergencyNumber@@QAE@XZ @ 2 NONAME ; RPhCltEmergencyNumber::RPhCltEmergencyNumber(void)
+	??0RPhCltIhf@@QAE@XZ @ 3 NONAME ; RPhCltIhf::RPhCltIhf(void)
+	??0RPhCltResourceFile@@QAE@XZ @ 4 NONAME ; RPhCltResourceFile::RPhCltResourceFile(void)
+	??0RPhCltServer@@QAE@XZ @ 5 NONAME ; RPhCltServer::RPhCltServer(void)
+	??0TPhCltExtPhoneDialData@@QAE@ABV?$TBuf@$0DC@@@ABV?$TBuf@$0GE@@@JH@Z @ 6 NONAME ; TPhCltExtPhoneDialData::TPhCltExtPhoneDialData(class TBuf<50> const &, class TBuf<100> const &, long, int)
+	??0TPhCltExtPhoneDialData@@QAE@ABV?$TBuf@$0GE@@@H@Z @ 7 NONAME ; TPhCltExtPhoneDialData::TPhCltExtPhoneDialData(class TBuf<100> const &, int)
+	??0TPhCltExtPhoneDialData@@QAE@ABV?$TBuf@$0GE@@@J@Z @ 8 NONAME ; TPhCltExtPhoneDialData::TPhCltExtPhoneDialData(class TBuf<100> const &, long)
+	??0TPhCltExtPhoneDialData@@QAE@ABV?$TBuf@$0GE@@@JH@Z @ 9 NONAME ; TPhCltExtPhoneDialData::TPhCltExtPhoneDialData(class TBuf<100> const &, long, int)
+	??0TPhCltExtPhoneDialData@@QAE@XZ @ 10 NONAME ; TPhCltExtPhoneDialData::TPhCltExtPhoneDialData(void)
+	??1CPhCltEmergencyTelNumber@@UAE@XZ @ 11 NONAME ; CPhCltEmergencyTelNumber::~CPhCltEmergencyTelNumber(void)
+	??1CPhCltUssdSatClient@@UAE@XZ @ 12 NONAME ; CPhCltUssdSatClient::~CPhCltUssdSatClient(void)
+	?AllowMatch@TPhCltExtPhoneDialData@@QBEHXZ @ 13 NONAME ; int TPhCltExtPhoneDialData::AllowMatch(void) const
+	?AsIPCStruct@TPhCltExtPhoneDialData@@QBEXAAVTPhCltCallArgs@@@Z @ 14 NONAME ; void TPhCltExtPhoneDialData::AsIPCStruct(class TPhCltCallArgs &) const
+	?Bearer@TPhCltExtPhoneDialData@@QBEABV?$TBuf8@$0O@@@XZ @ 15 NONAME ; class TBuf8<14> const & TPhCltExtPhoneDialData::Bearer(void) const
+	?CallType@TPhCltExtPhoneDialData@@QBE?AW4TPhCltCallType@@XZ @ 16 NONAME ; enum TPhCltCallType TPhCltExtPhoneDialData::CallType(void) const
+	?CancelNotifyCallAttempt@RPhCltCallNotify@@QBEXXZ @ 17 NONAME ; void RPhCltCallNotify::CancelNotifyCallAttempt(void) const
+	?CancelNotifyComHandCommand@RPhCltCallNotify@@QBEXXZ @ 18 NONAME ; void RPhCltCallNotify::CancelNotifyComHandCommand(void) const
+	?Close@RPhCltCallNotify@@QAEXXZ @ 19 NONAME ; void RPhCltCallNotify::Close(void)
+	?Close@RPhCltEmergencyNumber@@QAEXXZ @ 20 NONAME ; void RPhCltEmergencyNumber::Close(void)
+	?Close@RPhCltIhf@@QAEXXZ @ 21 NONAME ; void RPhCltIhf::Close(void)
+	?Close@RPhCltResourceFile@@QAEXXZ @ 22 NONAME ; void RPhCltResourceFile::Close(void)
+	?Connect@RPhCltServer@@QAEHH@Z @ 23 NONAME ; int RPhCltServer::Connect(int)
+	?ContactId@TPhCltExtPhoneDialData@@QBEJXZ @ 24 NONAME ; long TPhCltExtPhoneDialData::ContactId(void) const
+	?CreateAll@RPhCltServer@@QAEXAAVTRequestStatus@@@Z @ 25 NONAME ; void RPhCltServer::CreateAll(class TRequestStatus &)
+	?DialData@CPhCltDialer@@QAEAAVTPhCltExtPhoneDialData@@XZ @ 26 NONAME ; class TPhCltExtPhoneDialData & CPhCltDialer::DialData(void)
+	?Emergency@TPhCltExtPhoneDialData@@QBEHXZ @ 27 NONAME ; int TPhCltExtPhoneDialData::Emergency(void) const
+	?EndOtherCalls@TPhCltExtPhoneDialData@@QBEHXZ @ 28 NONAME ; int TPhCltExtPhoneDialData::EndOtherCalls(void) const
+	?ExecuteLD@CPhCltDialer@@QAEXXZ @ 29 NONAME ; void CPhCltDialer::ExecuteLD(void)
+	?ExternalizeL@CPhCltEmergencyTelNumber@@QBEXAAVRWriteStream@@@Z @ 30 NONAME ; void CPhCltEmergencyTelNumber::ExternalizeL(class RWriteStream &) const
+	?InternalizeL@CPhCltEmergencyTelNumber@@QAEXAAVRReadStream@@@Z @ 31 NONAME ; void CPhCltEmergencyTelNumber::InternalizeL(class RReadStream &)
+	?IsEmergencyPhoneNumber@RPhCltEmergencyNumber@@QAEHAAV?$TBuf@$0GE@@@AAHW4TPhCltEmergencyNumberQueryMode@@@Z @ 32 NONAME ; int RPhCltEmergencyNumber::IsEmergencyPhoneNumber(class TBuf<100> &, int &, enum TPhCltEmergencyNumberQueryMode)
+	?IsEmergenyPhoneNumber@RPhCltEmergencyNumber@@QAEHABV?$TBuf@$0GE@@@AAHW4TPhCltEmergencyNumberQueryMode@@@Z @ 33 NONAME ; int RPhCltEmergencyNumber::IsEmergenyPhoneNumber(class TBuf<100> const &, int &, enum TPhCltEmergencyNumberQueryMode)
+	?IsValidChar@PhCltUtils@@SAHVTChar@@@Z @ 34 NONAME ; int PhCltUtils::IsValidChar(class TChar)
+	?MCC@CPhCltEmergencyTelNumber@@QBEGXZ @ 35 NONAME ; unsigned short CPhCltEmergencyTelNumber::MCC(void) const
+	?MNC@CPhCltEmergencyTelNumber@@QBEGXZ @ 36 NONAME ; unsigned short CPhCltEmergencyTelNumber::MNC(void) const
+	?Name@TPhCltExtPhoneDialData@@QBEABV?$TBuf@$0DC@@@XZ @ 37 NONAME ; class TBuf<50> const & TPhCltExtPhoneDialData::Name(void) const
+	?NewL@CPhCltCommandHandler@@SAPAV1@XZ @ 38 NONAME ; class CPhCltCommandHandler * CPhCltCommandHandler::NewL(void)
+	?NewL@CPhCltDialer@@SAPAV1@XZ @ 39 NONAME ; class CPhCltDialer * CPhCltDialer::NewL(void)
+	?NewL@CPhCltExtPhoneBase@@SAPAV1@PAVMPhCltExtPhoneObserver@@@Z @ 40 NONAME ; class CPhCltExtPhoneBase * CPhCltExtPhoneBase::NewL(class MPhCltExtPhoneObserver *)
+	?NewL@CPhCltImageHandler@@SAPAV1@XZ @ 41 NONAME ; class CPhCltImageHandler * CPhCltImageHandler::NewL(void)
+	?NewL@CPhCltMessenger@@SAPAV1@ABVTUid@@ABH@Z @ 42 NONAME ; class CPhCltMessenger * CPhCltMessenger::NewL(class TUid const &, int const &)
+	?NewL@CPhCltUssd@@SAPAV1@H@Z @ 43 NONAME ; class CPhCltUssd * CPhCltUssd::NewL(int)
+	?NewL@CPhCltUssdInt@@SAPAV1@H@Z @ 44 NONAME ; class CPhCltUssdInt * CPhCltUssdInt::NewL(int)
+	?NewL@CPhCltUssdSatClient@@SAPAV1@H@Z @ 45 NONAME ; class CPhCltUssdSatClient * CPhCltUssdSatClient::NewL(int)
+	?NewLC@CPhCltEmergencyTelNumber@@SAPAV1@XZ @ 46 NONAME ; class CPhCltEmergencyTelNumber * CPhCltEmergencyTelNumber::NewLC(void)
+	?NotifyCallAttempt@RPhCltCallNotify@@QAEXAAVTRequestStatus@@AAVTDes8@@@Z @ 47 NONAME ; void RPhCltCallNotify::NotifyCallAttempt(class TRequestStatus &, class TDes8 &)
+	?NotifyComHandCommand@RPhCltCallNotify@@QAEXAAVTRequestStatus@@AAVTDes8@@@Z @ 48 NONAME ; void RPhCltCallNotify::NotifyComHandCommand(class TRequestStatus &, class TDes8 &)
+	?NumberType@TPhCltExtPhoneDialData@@QBEHXZ @ 49 NONAME ; int TPhCltExtPhoneDialData::NumberType(void) const
+	?Open@RPhCltCallNotify@@QAEHAAVRPhCltServer@@@Z @ 50 NONAME ; int RPhCltCallNotify::Open(class RPhCltServer &)
+	?Open@RPhCltEmergencyNumber@@QAEHAAVRPhCltServer@@@Z @ 51 NONAME ; int RPhCltEmergencyNumber::Open(class RPhCltServer &)
+	?Open@RPhCltIhf@@QAEHAAVRPhCltServer@@H@Z @ 52 NONAME ; int RPhCltIhf::Open(class RPhCltServer &, int)
+	?OpenL@RPhCltResourceFile@@QAEXAAVCCoeEnv@@@Z @ 53 NONAME ; void RPhCltResourceFile::OpenL(class CCoeEnv &)
+	?Redial@TPhCltExtPhoneDialData@@QBEHXZ @ 54 NONAME ; int TPhCltExtPhoneDialData::Redial(void) const
+	?RedialMaximumDuration@TPhCltExtPhoneDialData@@QBE?AVTTimeIntervalSeconds@@XZ @ 55 NONAME ; class TTimeIntervalSeconds TPhCltExtPhoneDialData::RedialMaximumDuration(void) const
+	?RemoveInvalidChars@PhCltUtils@@SAXAAVTDes16@@@Z @ 56 NONAME ; void PhCltUtils::RemoveInvalidChars(class TDes16 &)
+	?RemoveURIPrefixdAndDomainChars@PhCltUtils@@SAXAAVTDes16@@@Z @ 57 NONAME ; void PhCltUtils::RemoveURIPrefixdAndDomainChars(class TDes16 &)
+	?RespondClient@RPhCltCallNotify@@QAEHH@Z @ 58 NONAME ; int RPhCltCallNotify::RespondClient(int)
+	?RespondComHandClient@RPhCltCallNotify@@QAEHH@Z @ 59 NONAME ; int RPhCltCallNotify::RespondComHandClient(int)
+	?ReturnToNumberEntryOnFailure@TPhCltExtPhoneDialData@@QBEHXZ @ 60 NONAME ; int TPhCltExtPhoneDialData::ReturnToNumberEntryOnFailure(void) const
+	?SATCall@TPhCltExtPhoneDialData@@QBEHXZ @ 61 NONAME ; int TPhCltExtPhoneDialData::SATCall(void) const
+	?SendKeyPressed@TPhCltExtPhoneDialData@@QBEHXZ @ 62 NONAME ; int TPhCltExtPhoneDialData::SendKeyPressed(void) const
+	?SendSatMessage@CPhCltUssdSatClient@@QAEHABVTDesC16@@EAAVTDes16@@AAHAAE@Z @ 63 NONAME ; int CPhCltUssdSatClient::SendSatMessage(class TDesC16 const &, unsigned char, class TDes16 &, int &, unsigned char &)
+	?SendSatMessageCancel@CPhCltUssdSatClient@@QAEXXZ @ 64 NONAME ; void CPhCltUssdSatClient::SendSatMessageCancel(void)
+	?SetAllowMatch@TPhCltExtPhoneDialData@@QAEXH@Z @ 65 NONAME ; void TPhCltExtPhoneDialData::SetAllowMatch(int)
+	?SetBearer@TPhCltExtPhoneDialData@@QAEXABV?$TBuf8@$0O@@@@Z @ 66 NONAME ; void TPhCltExtPhoneDialData::SetBearer(class TBuf8<14> const &)
+	?SetCallType@TPhCltExtPhoneDialData@@QAEXW4TPhCltCallType@@@Z @ 67 NONAME ; void TPhCltExtPhoneDialData::SetCallType(enum TPhCltCallType)
+	?SetContactId@TPhCltExtPhoneDialData@@QAEXJ@Z @ 68 NONAME ; void TPhCltExtPhoneDialData::SetContactId(long)
+	?SetEmergency@TPhCltExtPhoneDialData@@QAEXH@Z @ 69 NONAME ; void TPhCltExtPhoneDialData::SetEmergency(int)
+	?SetEndOtherCalls@TPhCltExtPhoneDialData@@QAEXH@Z @ 70 NONAME ; void TPhCltExtPhoneDialData::SetEndOtherCalls(int)
+	?SetIhfMode@RPhCltIhf@@QAEHHH@Z @ 71 NONAME ; int RPhCltIhf::SetIhfMode(int, int)
+	?SetIhfModeFromPhone@RPhCltIhf@@QAEHHH@Z @ 72 NONAME ; int RPhCltIhf::SetIhfModeFromPhone(int, int)
+	?SetL@CPhCltEmergencyTelNumber@@QAEXABV?$TBuf@$0GE@@@GG@Z @ 73 NONAME ; void CPhCltEmergencyTelNumber::SetL(class TBuf<100> const &, unsigned short, unsigned short)
+	?SetName@TPhCltExtPhoneDialData@@QAEXABV?$TBuf@$0DC@@@@Z @ 74 NONAME ; void TPhCltExtPhoneDialData::SetName(class TBuf<50> const &)
+	?SetNumberType@TPhCltExtPhoneDialData@@QAEXH@Z @ 75 NONAME ; void TPhCltExtPhoneDialData::SetNumberType(int)
+	?SetRedial@TPhCltExtPhoneDialData@@QAEXH@Z @ 76 NONAME ; void TPhCltExtPhoneDialData::SetRedial(int)
+	?SetRedialMaximumDuration@TPhCltExtPhoneDialData@@QAEXVTTimeIntervalSeconds@@@Z @ 77 NONAME ; void TPhCltExtPhoneDialData::SetRedialMaximumDuration(class TTimeIntervalSeconds)
+	?SetReturnToNumberEntryOnFailure@TPhCltExtPhoneDialData@@QAEXH@Z @ 78 NONAME ; void TPhCltExtPhoneDialData::SetReturnToNumberEntryOnFailure(int)
+	?SetSATCall@TPhCltExtPhoneDialData@@QAEXH@Z @ 79 NONAME ; void TPhCltExtPhoneDialData::SetSATCall(int)
+	?SetSendKeyPressed@TPhCltExtPhoneDialData@@QAEXH@Z @ 80 NONAME ; void TPhCltExtPhoneDialData::SetSendKeyPressed(int)
+	?SetShowNumber@TPhCltExtPhoneDialData@@QAEXH@Z @ 81 NONAME ; void TPhCltExtPhoneDialData::SetShowNumber(int)
+	?SetSubAddress@TPhCltExtPhoneDialData@@QAEXABV?$TBuf@$0BF@@@@Z @ 82 NONAME ; void TPhCltExtPhoneDialData::SetSubAddress(class TBuf<21> const &)
+	?SetTelephoneNumber@TPhCltExtPhoneDialData@@QAEXABV?$TBuf@$0GE@@@@Z @ 83 NONAME ; void TPhCltExtPhoneDialData::SetTelephoneNumber(class TBuf<100> const &)
+	?SetWindowGroup@TPhCltExtPhoneDialData@@QAEXH@Z @ 84 NONAME ; void TPhCltExtPhoneDialData::SetWindowGroup(int)
+	?ShowNumber@TPhCltExtPhoneDialData@@QBEHXZ @ 85 NONAME ; int TPhCltExtPhoneDialData::ShowNumber(void) const
+	?SubAddress@TPhCltExtPhoneDialData@@QBEABV?$TBuf@$0BF@@@XZ @ 86 NONAME ; class TBuf<21> const & TPhCltExtPhoneDialData::SubAddress(void) const
+	?TelNumber@CPhCltEmergencyTelNumber@@QBEABVTDesC16@@XZ @ 87 NONAME ; class TDesC16 const & CPhCltEmergencyTelNumber::TelNumber(void) const
+	?TelephoneNumber@TPhCltExtPhoneDialData@@QBEABV?$TBuf@$0GE@@@XZ @ 88 NONAME ; class TBuf<100> const & TPhCltExtPhoneDialData::TelephoneNumber(void) const
+	?WindowGroupId@TPhCltExtPhoneDialData@@QBEHXZ @ 89 NONAME ; int TPhCltExtPhoneDialData::WindowGroupId(void) const
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/bwins/phoneclientu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,103 @@
+EXPORTS
+	??0RPhCltCallNotify@@QAE@XZ @ 1 NONAME ; RPhCltCallNotify::RPhCltCallNotify(void)
+	??0RPhCltEmergencyNumber@@QAE@XZ @ 2 NONAME ; RPhCltEmergencyNumber::RPhCltEmergencyNumber(void)
+	??0RPhCltIhf@@QAE@XZ @ 3 NONAME ; RPhCltIhf::RPhCltIhf(void)
+	??0RPhCltResourceFile@@QAE@XZ @ 4 NONAME ; RPhCltResourceFile::RPhCltResourceFile(void)
+	??0RPhCltServer@@QAE@XZ @ 5 NONAME ; RPhCltServer::RPhCltServer(void)
+	??0RPhCltUssd@@QAE@XZ @ 6 NONAME ; RPhCltUssd::RPhCltUssd(void)
+	??0TPhCltExtPhoneDialData@@QAE@ABV?$TBuf@$0DC@@@ABV?$TBuf@$0GE@@@JH@Z @ 7 NONAME ; TPhCltExtPhoneDialData::TPhCltExtPhoneDialData(class TBuf<50> const &, class TBuf<100> const &, long, int)
+	??0TPhCltExtPhoneDialData@@QAE@ABV?$TBuf@$0GE@@@H@Z @ 8 NONAME ; TPhCltExtPhoneDialData::TPhCltExtPhoneDialData(class TBuf<100> const &, int)
+	??0TPhCltExtPhoneDialData@@QAE@ABV?$TBuf@$0GE@@@J@Z @ 9 NONAME ; TPhCltExtPhoneDialData::TPhCltExtPhoneDialData(class TBuf<100> const &, long)
+	??0TPhCltExtPhoneDialData@@QAE@ABV?$TBuf@$0GE@@@JH@Z @ 10 NONAME ; TPhCltExtPhoneDialData::TPhCltExtPhoneDialData(class TBuf<100> const &, long, int)
+	??0TPhCltExtPhoneDialData@@QAE@XZ @ 11 NONAME ; TPhCltExtPhoneDialData::TPhCltExtPhoneDialData(void)
+	??1CPhCltEmergencyTelNumber@@UAE@XZ @ 12 NONAME ; CPhCltEmergencyTelNumber::~CPhCltEmergencyTelNumber(void)
+	??1CPhCltUssd@@UAE@XZ @ 13 NONAME ; CPhCltUssd::~CPhCltUssd(void)
+	??1CPhCltUssdSatClient@@UAE@XZ @ 14 NONAME ; CPhCltUssdSatClient::~CPhCltUssdSatClient(void)
+	?AllowMatch@TPhCltExtPhoneDialData@@QBEHXZ @ 15 NONAME ; int TPhCltExtPhoneDialData::AllowMatch(void) const
+	?AppStarting@RPhCltUssd@@IAEHXZ @ 16 NONAME ; int RPhCltUssd::AppStarting(void)
+	?AppTerminating@RPhCltUssd@@IAEHW4TPhCltUssdAppExitReason@@@Z @ 17 NONAME ; int RPhCltUssd::AppTerminating(enum TPhCltUssdAppExitReason)
+	?AppToBackground@RPhCltUssd@@IAEHXZ @ 18 NONAME ; int RPhCltUssd::AppToBackground(void)
+	?AppToForeground@RPhCltUssd@@IAEHXZ @ 19 NONAME ; int RPhCltUssd::AppToForeground(void)
+	?AsIPCStruct@TPhCltExtPhoneDialData@@QBEXAAVTPhCltCallArgs@@@Z @ 20 NONAME ; void TPhCltExtPhoneDialData::AsIPCStruct(class TPhCltCallArgs &) const
+	?Bearer@TPhCltExtPhoneDialData@@QBEABV?$TBuf8@$0O@@@XZ @ 21 NONAME ; class TBuf8<14> const & TPhCltExtPhoneDialData::Bearer(void) const
+	?CallType@TPhCltExtPhoneDialData@@QBE?AW4TPhCltCallType@@XZ @ 22 NONAME ; enum TPhCltCallType TPhCltExtPhoneDialData::CallType(void) const
+	?CancelNotifyCallAttempt@RPhCltCallNotify@@QBEXXZ @ 23 NONAME ; void RPhCltCallNotify::CancelNotifyCallAttempt(void) const
+	?CancelNotifyPhoneStatusRequest@RPhCltCallNotify@@QBEXXZ @ 24 NONAME ; void RPhCltCallNotify::CancelNotifyPhoneStatusRequest(void) const
+	?CancelReportPhoneStatus@RPhCltCallNotify@@QBEXXZ @ 25 NONAME ; void RPhCltCallNotify::CancelReportPhoneStatus(void) const
+	?CancelSend@RPhCltUssd@@QAEXXZ @ 26 NONAME ; void RPhCltUssd::CancelSend(void)
+	?Close@RPhCltCallNotify@@QAEXXZ @ 27 NONAME ; void RPhCltCallNotify::Close(void)
+	?Close@RPhCltEmergencyNumber@@QAEXXZ @ 28 NONAME ; void RPhCltEmergencyNumber::Close(void)
+	?Close@RPhCltIhf@@QAEXXZ @ 29 NONAME ; void RPhCltIhf::Close(void)
+	?Close@RPhCltResourceFile@@QAEXXZ @ 30 NONAME ; void RPhCltResourceFile::Close(void)
+	?Close@RPhCltUssd@@QAEXXZ @ 31 NONAME ; void RPhCltUssd::Close(void)
+	?Connect@RPhCltServer@@QAEHH@Z @ 32 NONAME ; int RPhCltServer::Connect(int)
+	?ContactId@TPhCltExtPhoneDialData@@QBEJXZ @ 33 NONAME ; long TPhCltExtPhoneDialData::ContactId(void) const
+	?CreateAll@RPhCltServer@@QAEXAAVTRequestStatus@@@Z @ 34 NONAME ; void RPhCltServer::CreateAll(class TRequestStatus &)
+	?DialData@CPhCltDialer@@QAEAAVTPhCltExtPhoneDialData@@XZ @ 35 NONAME ; class TPhCltExtPhoneDialData & CPhCltDialer::DialData(void)
+	?Emergency@TPhCltExtPhoneDialData@@QBEHXZ @ 36 NONAME ; int TPhCltExtPhoneDialData::Emergency(void) const
+	?EndOtherCalls@TPhCltExtPhoneDialData@@QBEHXZ @ 37 NONAME ; int TPhCltExtPhoneDialData::EndOtherCalls(void) const
+	?ExecuteLD@CPhCltDialer@@QAEXXZ @ 38 NONAME ; void CPhCltDialer::ExecuteLD(void)
+	?ExternalizeL@CPhCltEmergencyTelNumber@@QBEXAAVRWriteStream@@@Z @ 39 NONAME ; void CPhCltEmergencyTelNumber::ExternalizeL(class RWriteStream &) const
+	?InternalizeL@CPhCltEmergencyTelNumber@@QAEXAAVRReadStream@@@Z @ 40 NONAME ; void CPhCltEmergencyTelNumber::InternalizeL(class RReadStream &)
+	?IsEmergencyPhoneNumber@RPhCltEmergencyNumber@@QAEHAAV?$TBuf@$0GE@@@AAHW4TPhCltEmergencyNumberQueryMode@@@Z @ 41 NONAME ; int RPhCltEmergencyNumber::IsEmergencyPhoneNumber(class TBuf<100> &, int &, enum TPhCltEmergencyNumberQueryMode)
+	?IsEmergenyPhoneNumber@RPhCltEmergencyNumber@@QAEHABV?$TBuf@$0GE@@@AAHW4TPhCltEmergencyNumberQueryMode@@@Z @ 42 NONAME ; int RPhCltEmergencyNumber::IsEmergenyPhoneNumber(class TBuf<100> const &, int &, enum TPhCltEmergencyNumberQueryMode)
+	?IsValidChar@PhCltUtils@@SAHVTChar@@@Z @ 43 NONAME ; int PhCltUtils::IsValidChar(class TChar)
+	?MCC@CPhCltEmergencyTelNumber@@QBEGXZ @ 44 NONAME ; unsigned short CPhCltEmergencyTelNumber::MCC(void) const
+	?MNC@CPhCltEmergencyTelNumber@@QBEGXZ @ 45 NONAME ; unsigned short CPhCltEmergencyTelNumber::MNC(void) const
+	?Name@TPhCltExtPhoneDialData@@QBEABV?$TBuf@$0DC@@@XZ @ 46 NONAME ; class TBuf<50> const & TPhCltExtPhoneDialData::Name(void) const
+	?NewL@CPhCltDialer@@SAPAV1@XZ @ 47 NONAME ; class CPhCltDialer * CPhCltDialer::NewL(void)
+	?NewL@CPhCltExtPhoneBase@@SAPAV1@PAVMPhCltExtPhoneObserver@@@Z @ 48 NONAME ; class CPhCltExtPhoneBase * CPhCltExtPhoneBase::NewL(class MPhCltExtPhoneObserver *)
+	?NewL@CPhCltUssd@@SAPAV1@H@Z @ 49 NONAME ; class CPhCltUssd * CPhCltUssd::NewL(int)
+	?NewL@CPhCltUssdSatClient@@SAPAV1@H@Z @ 50 NONAME ; class CPhCltUssdSatClient * CPhCltUssdSatClient::NewL(int)
+	?NewLC@CPhCltEmergencyTelNumber@@SAPAV1@XZ @ 51 NONAME ; class CPhCltEmergencyTelNumber * CPhCltEmergencyTelNumber::NewLC(void)
+	?NotifyCallAttempt@RPhCltCallNotify@@QAEXAAVTRequestStatus@@AAVTDes8@@@Z @ 52 NONAME ; void RPhCltCallNotify::NotifyCallAttempt(class TRequestStatus &, class TDes8 &)
+	?NotifyPhoneStatusRequest@RPhCltCallNotify@@QAEXAAVTRequestStatus@@@Z @ 53 NONAME ; void RPhCltCallNotify::NotifyPhoneStatusRequest(class TRequestStatus &)
+	?NumberType@TPhCltExtPhoneDialData@@QBEHXZ @ 54 NONAME ; int TPhCltExtPhoneDialData::NumberType(void) const
+	?Open@RPhCltCallNotify@@QAEHAAVRPhCltServer@@@Z @ 55 NONAME ; int RPhCltCallNotify::Open(class RPhCltServer &)
+	?Open@RPhCltEmergencyNumber@@QAEHAAVRPhCltServer@@@Z @ 56 NONAME ; int RPhCltEmergencyNumber::Open(class RPhCltServer &)
+	?Open@RPhCltIhf@@QAEHAAVRPhCltServer@@H@Z @ 57 NONAME ; int RPhCltIhf::Open(class RPhCltServer &, int)
+	?Open@RPhCltUssd@@QAEHAAVRPhCltServer@@@Z @ 58 NONAME ; int RPhCltUssd::Open(class RPhCltServer &)
+	?OpenL@RPhCltResourceFile@@QAEXAAVCCoeEnv@@@Z @ 59 NONAME ; void RPhCltResourceFile::OpenL(class CCoeEnv &)
+	?Redial@TPhCltExtPhoneDialData@@QBEHXZ @ 60 NONAME ; int TPhCltExtPhoneDialData::Redial(void) const
+	?RemoveInvalidChars@PhCltUtils@@SAXAAVTDes16@@@Z @ 61 NONAME ; void PhCltUtils::RemoveInvalidChars(class TDes16 &)
+	?RemoveURIPrefixdAndDomainChars@PhCltUtils@@SAXAAVTDes16@@@Z @ 62 NONAME ; void PhCltUtils::RemoveURIPrefixdAndDomainChars(class TDes16 &)
+	?ReportPhoneStatus@RPhCltCallNotify@@QAEXAAVTRequestStatus@@H@Z @ 63 NONAME ; void RPhCltCallNotify::ReportPhoneStatus(class TRequestStatus &, int)
+	?RespondClient@RPhCltCallNotify@@QAEHH@Z @ 64 NONAME ; int RPhCltCallNotify::RespondClient(int)
+	?ReturnToNumberEntryOnFailure@TPhCltExtPhoneDialData@@QBEHXZ @ 65 NONAME ; int TPhCltExtPhoneDialData::ReturnToNumberEntryOnFailure(void) const
+	?SATCall@TPhCltExtPhoneDialData@@QBEHXZ @ 66 NONAME ; int TPhCltExtPhoneDialData::SATCall(void) const
+	?SendSatMessage@CPhCltUssdSatClient@@QAEHABVTDesC16@@EAAVTDes16@@AAHAAE@Z @ 67 NONAME ; int CPhCltUssdSatClient::SendSatMessage(class TDesC16 const &, unsigned char, class TDes16 &, int &, unsigned char &)
+	?SendSatMessageCancel@CPhCltUssdSatClient@@QAEXXZ @ 68 NONAME ; void CPhCltUssdSatClient::SendSatMessageCancel(void)
+	?SendUssd@CPhCltUssd@@QAEHABVTDesC16@@@Z @ 69 NONAME ; int CPhCltUssd::SendUssd(class TDesC16 const &)
+	?SendUssd@CPhCltUssd@@QAEHABVTDesC8@@@Z @ 70 NONAME ; int CPhCltUssd::SendUssd(class TDesC8 const &)
+	?SendUssd@CPhCltUssd@@QAEHABVTDesC8@@E@Z @ 71 NONAME ; int CPhCltUssd::SendUssd(class TDesC8 const &, unsigned char)
+	?SendUssd@RPhCltUssd@@QAEXAAVTRequestStatus@@ABVTDesC8@@1@Z @ 72 NONAME ; void RPhCltUssd::SendUssd(class TRequestStatus &, class TDesC8 const &, class TDesC8 const &)
+	?SendUssdCancel@CPhCltUssd@@QAEXXZ @ 73 NONAME ; void CPhCltUssd::SendUssdCancel(void)
+	?SetAllowMatch@TPhCltExtPhoneDialData@@QAEXH@Z @ 74 NONAME ; void TPhCltExtPhoneDialData::SetAllowMatch(int)
+	?SetBearer@TPhCltExtPhoneDialData@@QAEXABV?$TBuf8@$0O@@@@Z @ 75 NONAME ; void TPhCltExtPhoneDialData::SetBearer(class TBuf8<14> const &)
+	?SetCallType@TPhCltExtPhoneDialData@@QAEXW4TPhCltCallType@@@Z @ 76 NONAME ; void TPhCltExtPhoneDialData::SetCallType(enum TPhCltCallType)
+	?SetContactId@TPhCltExtPhoneDialData@@QAEXJ@Z @ 77 NONAME ; void TPhCltExtPhoneDialData::SetContactId(long)
+	?SetEmergency@TPhCltExtPhoneDialData@@QAEXH@Z @ 78 NONAME ; void TPhCltExtPhoneDialData::SetEmergency(int)
+	?SetEndOtherCalls@TPhCltExtPhoneDialData@@QAEXH@Z @ 79 NONAME ; void TPhCltExtPhoneDialData::SetEndOtherCalls(int)
+	?SetIhfMode@RPhCltIhf@@QAEHHH@Z @ 80 NONAME ; int RPhCltIhf::SetIhfMode(int, int)
+	?SetIhfModeFromPhone@RPhCltIhf@@QAEHHH@Z @ 81 NONAME ; int RPhCltIhf::SetIhfModeFromPhone(int, int)
+	?SetL@CPhCltEmergencyTelNumber@@QAEXABV?$TBuf@$0GE@@@GG@Z @ 82 NONAME ; void CPhCltEmergencyTelNumber::SetL(class TBuf<100> const &, unsigned short, unsigned short)
+	?SetName@TPhCltExtPhoneDialData@@QAEXABV?$TBuf@$0DC@@@@Z @ 83 NONAME ; void TPhCltExtPhoneDialData::SetName(class TBuf<50> const &)
+	?SetNumberType@TPhCltExtPhoneDialData@@QAEXH@Z @ 84 NONAME ; void TPhCltExtPhoneDialData::SetNumberType(int)
+	?SetRedial@TPhCltExtPhoneDialData@@QAEXH@Z @ 85 NONAME ; void TPhCltExtPhoneDialData::SetRedial(int)
+	?SetReturnToNumberEntryOnFailure@TPhCltExtPhoneDialData@@QAEXH@Z @ 86 NONAME ; void TPhCltExtPhoneDialData::SetReturnToNumberEntryOnFailure(int)
+	?SetSATCall@TPhCltExtPhoneDialData@@QAEXH@Z @ 87 NONAME ; void TPhCltExtPhoneDialData::SetSATCall(int)
+	?SetShowNumber@TPhCltExtPhoneDialData@@QAEXH@Z @ 88 NONAME ; void TPhCltExtPhoneDialData::SetShowNumber(int)
+	?SetSubAddress@TPhCltExtPhoneDialData@@QAEXABV?$TBuf@$0BF@@@@Z @ 89 NONAME ; void TPhCltExtPhoneDialData::SetSubAddress(class TBuf<21> const &)
+	?SetTelephoneNumber@TPhCltExtPhoneDialData@@QAEXABV?$TBuf@$0GE@@@@Z @ 90 NONAME ; void TPhCltExtPhoneDialData::SetTelephoneNumber(class TBuf<100> const &)
+	?SetWindowGroup@TPhCltExtPhoneDialData@@QAEXH@Z @ 91 NONAME ; void TPhCltExtPhoneDialData::SetWindowGroup(int)
+	?ShowNumber@TPhCltExtPhoneDialData@@QBEHXZ @ 92 NONAME ; int TPhCltExtPhoneDialData::ShowNumber(void) const
+	?StartUssdEditor@RPhCltUssd@@QBEHXZ @ 93 NONAME ; int RPhCltUssd::StartUssdEditor(void) const
+	?SubAddress@TPhCltExtPhoneDialData@@QBEABV?$TBuf@$0BF@@@XZ @ 94 NONAME ; class TBuf<21> const & TPhCltExtPhoneDialData::SubAddress(void) const
+	?TelNumber@CPhCltEmergencyTelNumber@@QBEABVTDesC16@@XZ @ 95 NONAME ; class TDesC16 const & CPhCltEmergencyTelNumber::TelNumber(void) const
+	?TelephoneNumber@TPhCltExtPhoneDialData@@QBEABV?$TBuf@$0GE@@@XZ @ 96 NONAME ; class TBuf<100> const & TPhCltExtPhoneDialData::TelephoneNumber(void) const
+	?WindowGroupId@TPhCltExtPhoneDialData@@QBEHXZ @ 97 NONAME ; int TPhCltExtPhoneDialData::WindowGroupId(void) const
+	?SendKeyPressed@TPhCltExtPhoneDialData@@QBEHXZ @ 98 NONAME ; int TPhCltExtPhoneDialData::SendKeyPressed(void) const
+	?SetSendKeyPressed@TPhCltExtPhoneDialData@@QAEXH@Z @ 99 NONAME ; void TPhCltExtPhoneDialData::SetSendKeyPressed(int)
+	?RedialMaximumDuration@TPhCltExtPhoneDialData@@QBE?AVTTimeIntervalSeconds@@XZ @ 100 NONAME ; class TTimeIntervalSeconds TPhCltExtPhoneDialData::RedialMaximumDuration(void) const
+	?SetRedialMaximumDuration@TPhCltExtPhoneDialData@@QAEXVTTimeIntervalSeconds@@@Z @ 101 NONAME ; void TPhCltExtPhoneDialData::SetRedialMaximumDuration(class TTimeIntervalSeconds)
+
Binary file phoneclientserver/phoneclient/conf/ci_telephonyservices.confml has changed
Binary file phoneclientserver/phoneclient/conf/telephonyservices_102029ac.crml has changed
Binary file phoneclientserver/phoneclient/conf/telephonyservices_102078f1.crml has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/data/phoneclient.rss	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,227 @@
+/*
+* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This file contains all the resources for the module.
+*
+*/
+
+
+//  RESOURCE IDENTIFIER
+NAME    PhCl
+
+//  INCLUDES
+
+#include <eikon.rh>
+#include <avkon.loc>
+#include "phoneclient.hrh" 
+#include "eikon.rsg"
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.hrh>
+#include <avkon.mbg>
+
+//  RESOURCE DEFINITIONS 
+
+//----------------------------------------------------
+//   
+//    RSS_SIGNATURE
+//
+//
+//----------------------------------------------------
+//
+RESOURCE RSS_SIGNATURE { }
+
+
+//----------------------------------------------------
+//   
+//    TBUF
+//
+//
+//----------------------------------------------------
+//
+RESOURCE TBUF { buf="phoneclient"; }
+
+
+//----------------------------------------------------
+//   
+//    r_softkey_quit
+//
+//
+//----------------------------------------------------
+//
+RESOURCE CBA r_softkey_quit
+    {
+    buttons =
+        {
+        CBA_BUTTON {},
+        CBA_BUTTON {id=EAknSoftkeyClose; txt=text_softkey_quit;}
+        };
+    }
+
+
+//----------------------------------------------------
+//   
+//    r_text_unconfirmed
+//
+//
+//----------------------------------------------------
+//
+RESOURCE TBUF r_text_unconfirmed
+    {
+    buf = text_unconfirmed;
+    }
+
+
+//----------------------------------------------------
+//   
+//    r_text_not_done
+//
+//
+//----------------------------------------------------
+//
+RESOURCE TBUF r_text_not_done
+    {
+    buf = text_not_done;
+    }
+
+
+//----------------------------------------------------
+//   
+//    r_text_not_allowed
+//
+//
+//----------------------------------------------------
+//
+RESOURCE TBUF r_text_not_allowed
+    {
+    buf = text_not_allowed;
+    }
+
+
+//----------------------------------------------------
+//   
+//    r_text_result_unknown
+//
+//
+//----------------------------------------------------
+//
+RESOURCE TBUF r_text_result_unknown
+    {
+    buf = text_result_unknown;
+    }
+
+
+//----------------------------------------------------
+//   
+//    r_text_done
+//
+//
+//----------------------------------------------------
+//
+RESOURCE TBUF r_text_done
+    {
+    buf = text_done;
+    }
+
+
+//----------------------------------------------------
+//   
+//    r_text_no_service
+//
+//
+//----------------------------------------------------
+//
+RESOURCE TBUF r_text_no_service
+    {
+    buf = text_no_service;
+    }
+
+
+//----------------------------------------------------
+//   
+//    r_text_offline
+//
+//
+//----------------------------------------------------
+//
+RESOURCE TBUF r_text_offline
+    {
+    buf = qtn_offline_not_possible;
+    }
+
+
+//----------------------------------------------------
+//   
+//    r_text_sending
+//
+//
+//----------------------------------------------------
+//
+RESOURCE TBUF r_text_sending
+    {
+    buf = text_sending;
+    }
+
+
+// ---------------------------------------------------------
+//   
+//    r_phclt_softkeys_empty
+//
+//    Empty softkeys; note that AVKON empty softkey 
+//    resource can not be used, because flags are needed.
+//
+// ---------------------------------------------------------
+//
+RESOURCE CBA r_phclt_softkeys_empty
+    {
+    flags = EAknCBAFlagRespondWhenInvisible;
+
+    buttons =
+        {
+        CBA_BUTTON 
+            {
+            id = EAknSoftkeyEmpty; 
+            txt = text_softkey_empty;
+            },
+        CBA_BUTTON 
+            {
+            id = EAknSoftkeyEmpty; 
+            txt = text_softkey_empty;
+            }
+        };
+    }
+
+
+// ---------------------------------------------------------
+//   
+//    r_phclt_blank_dlg
+//
+// ---------------------------------------------------------
+//
+RESOURCE DIALOG r_phclt_blank_dlg
+    {
+    flags = ( EEikDialogFlagNoDrag | 
+              EEikDialogFlagNoTitleBar | 
+              EEikDialogFlagFillAppClientRect | 
+              EEikDialogFlagCbaButtons | 
+              EEikDialogFlagWait );
+
+    buttons = r_phclt_softkeys_empty; 
+    
+    items = 
+        {
+        };
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/data/phoneclient_stub.pkg	Wed Jul 21 18:26:52 2010 +0300
@@ -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: For packing phoneclient stub.
+;
+; Languages
+&EN
+
+; Header
+#{"PhoneClient"}, (0x1000084F), 1, 0, 0, TYPE=SA
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Files
+""-"z:\sys\bin\PhoneClient.dll"
+""-"z:\resource\PhoneClient.rsc"
Binary file phoneclientserver/phoneclient/data/phoneclient_stub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/eabi/phoneclient_aiwextu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,92 @@
+EXPORTS
+	_ZN10CPhCltUssd4NewLEi @ 1 NONAME
+	_ZN10PhCltUtils11IsValidCharE5TChar @ 2 NONAME
+	_ZN10PhCltUtils18RemoveInvalidCharsER6TDes16 @ 3 NONAME
+	_ZN10PhCltUtils30RemoveURIPrefixdAndDomainCharsER6TDes16 @ 4 NONAME
+	_ZN12RPhCltServer7ConnectEi @ 5 NONAME
+	_ZN12RPhCltServer9CreateAllER14TRequestStatus @ 6 NONAME
+	_ZN12RPhCltServerC1Ev @ 7 NONAME
+	_ZN12RPhCltServerC2Ev @ 8 NONAME
+	_ZN13CPhCltUssdInt4NewLEi @ 9 NONAME
+	_ZN15CPhCltMessenger4NewLERK4TUidRKi @ 10 NONAME
+	_ZN16CPhCltCallNotify13RespondClientEi @ 11 NONAME
+	_ZN16CPhCltCallNotify17NotifyDialRequestEP25MPhCltDialRequestObserver @ 12 NONAME
+	_ZN16CPhCltCallNotify19NotifyEmergencyCallEP34MPhCltDialEmergencyRequestObserverR7TDesC16 @ 13 NONAME
+	_ZN16CPhCltCallNotify20NotifyComHandCommandEP28MPhCltComHandRequestObserverR5TDes8 @ 14 NONAME
+	_ZN16CPhCltCallNotify20RespondComHandClientEi @ 15 NONAME
+	_ZN16CPhCltCallNotify24RespondEmergencyToClientEi @ 16 NONAME
+	_ZN16CPhCltCallNotify4NewLEv @ 17 NONAME
+	_ZN16CPhCltCallNotify4OpenER12RPhCltServer @ 18 NONAME
+	_ZN16CPhCltCallNotify5CloseEv @ 19 NONAME
+	_ZN16CPhCltCallNotifyD0Ev @ 20 NONAME
+	_ZN16CPhCltCallNotifyD1Ev @ 21 NONAME
+	_ZN16CPhCltCallNotifyD2Ev @ 22 NONAME
+	_ZN18CPhCltExtPhoneBase4NewLEP22MPhCltExtPhoneObserver @ 23 NONAME
+	_ZN18CPhCltImageHandler4NewLEv @ 24 NONAME
+	_ZN18RPhCltResourceFile5CloseEv @ 25 NONAME
+	_ZN18RPhCltResourceFile5OpenLER7CCoeEnv @ 26 NONAME
+	_ZN18RPhCltResourceFileC1Ev @ 27 NONAME
+	_ZN18RPhCltResourceFileC2Ev @ 28 NONAME
+	_ZN19CPhCltEmergencyCall4NewLEP27MPhCltEmergencyCallObserver @ 29 NONAME
+	_ZN19CPhCltUssdSatClient14SendSatMessageERK7TDesC16hR6TDes16RiRh @ 30 NONAME
+	_ZN19CPhCltUssdSatClient20SendSatMessageCancelEv @ 31 NONAME
+	_ZN19CPhCltUssdSatClient4NewLEi @ 32 NONAME
+	_ZN19CPhCltUssdSatClientD0Ev @ 33 NONAME
+	_ZN19CPhCltUssdSatClientD1Ev @ 34 NONAME
+	_ZN19CPhCltUssdSatClientD2Ev @ 35 NONAME
+	_ZN20CPhCltCommandHandler4NewLEv @ 36 NONAME
+	_ZN22CPhCltExtPhoneDialData10SetBearerLERK5TBuf8ILi14EE @ 37 NONAME
+	_ZN22CPhCltExtPhoneDialData10SetSATCallEi @ 38 NONAME
+	_ZN22CPhCltExtPhoneDialData11SetCallTypeE14TPhCltCallType @ 39 NONAME
+	_ZN22CPhCltExtPhoneDialData12SetServiceIdEm @ 40 NONAME
+	_ZN22CPhCltExtPhoneDialData13SetAllowMatchEi @ 41 NONAME
+	_ZN22CPhCltExtPhoneDialData13SetShowNumberEi @ 42 NONAME
+	_ZN22CPhCltExtPhoneDialData14SetSubAddressLERK4TBufILi21EE @ 43 NONAME
+	_ZN22CPhCltExtPhoneDialData14SetWindowGroupEi @ 44 NONAME
+	_ZN22CPhCltExtPhoneDialData15SetContactLinkLERK6TDesC8 @ 45 NONAME
+	_ZN22CPhCltExtPhoneDialData15SetInitiateCallEi @ 46 NONAME
+	_ZN22CPhCltExtPhoneDialData16SetEndOtherCallsEi @ 47 NONAME
+	_ZN22CPhCltExtPhoneDialData17SetSendKeyPressedEi @ 48 NONAME
+	_ZN22CPhCltExtPhoneDialData18SetTelephoneNumberERK4TBufILi100EE @ 49 NONAME
+	_ZN22CPhCltExtPhoneDialData24SetRedialMaximumDurationE20TTimeIntervalSeconds @ 50 NONAME
+	_ZN22CPhCltExtPhoneDialData4NewLERK6TDesC8 @ 51 NONAME
+	_ZN22CPhCltExtPhoneDialData4NewLEv @ 52 NONAME
+	_ZN22CPhCltExtPhoneDialData5NewLCERK6TDesC8 @ 53 NONAME
+	_ZN22CPhCltExtPhoneDialData5NewLCEv @ 54 NONAME
+	_ZN22CPhCltExtPhoneDialData6PackLCEv @ 55 NONAME
+	_ZN22CPhCltExtPhoneDialData7SetUUILERK7TDesC16 @ 56 NONAME
+	_ZN22CPhCltExtPhoneDialData8SetNameLERK4TBufILi50EE @ 57 NONAME
+	_ZN22CPhCltExtPhoneDialData9SetRedialEi @ 58 NONAME
+	_ZN22CPhCltExtPhoneDialDataD0Ev @ 59 NONAME
+	_ZN22CPhCltExtPhoneDialDataD1Ev @ 60 NONAME
+	_ZN22CPhCltExtPhoneDialDataD2Ev @ 61 NONAME
+	_ZN16CPhCltCallNotify23CancelNotifyDialRequestEv @ 62 NONAME
+	_ZNK16CPhCltCallNotify25CancelNotifyEmergencyCallEv @ 63 NONAME
+	_ZNK16CPhCltCallNotify26CancelNotifyComHandCommandEv @ 64 NONAME
+	_ZNK22CPhCltExtPhoneDialData10AllowMatchEv @ 65 NONAME
+	_ZNK22CPhCltExtPhoneDialData10ShowNumberEv @ 66 NONAME
+	_ZNK22CPhCltExtPhoneDialData10SubAddressEv @ 67 NONAME
+	_ZNK22CPhCltExtPhoneDialData11ContactLinkEv @ 68 NONAME
+	_ZNK22CPhCltExtPhoneDialData11WindowGroupEv @ 69 NONAME
+	_ZNK22CPhCltExtPhoneDialData12InitiateCallEv @ 70 NONAME
+	_ZNK22CPhCltExtPhoneDialData13EndOtherCallsEv @ 71 NONAME
+	_ZNK22CPhCltExtPhoneDialData14SendKeyPressedEv @ 72 NONAME
+	_ZNK22CPhCltExtPhoneDialData15TelephoneNumberEv @ 73 NONAME
+	_ZNK22CPhCltExtPhoneDialData20CalculatePackageSizeEv @ 74 NONAME
+	_ZNK22CPhCltExtPhoneDialData21RedialMaximumDurationEv @ 75 NONAME
+	_ZNK22CPhCltExtPhoneDialData3UUIEv @ 76 NONAME
+	_ZNK22CPhCltExtPhoneDialData4NameEv @ 77 NONAME
+	_ZNK22CPhCltExtPhoneDialData6BearerEv @ 78 NONAME
+	_ZNK22CPhCltExtPhoneDialData6RedialEv @ 79 NONAME
+	_ZNK22CPhCltExtPhoneDialData7SATCallEv @ 80 NONAME
+	_ZNK22CPhCltExtPhoneDialData8CallTypeEv @ 81 NONAME
+	_ZNK22CPhCltExtPhoneDialData9ServiceIdEv @ 82 NONAME
+	_ZTI13CPhCltUssdImp @ 83 NONAME ; #<TI>#
+	_ZTI16CPhCltCallNotify @ 84 NONAME ; #<TI>#
+	_ZTI19CPhCltUssdSatClient @ 85 NONAME ; #<TI>#
+	_ZTV13CPhCltUssdImp @ 86 NONAME ; #<VT>#
+	_ZTV16CPhCltCallNotify @ 87 NONAME ; #<VT>#
+	_ZTV19CPhCltUssdSatClient @ 88 NONAME ; #<VT>#
+	_ZTIN32CPhCltImageHandlerImplementation13CVtImageSaverE @ 89 NONAME ; #<TI>#
+	_ZTVN32CPhCltImageHandlerImplementation13CVtImageSaverE @ 90 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/eabi/phoneclient_aiwu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,107 @@
+EXPORTS
+	_ZN10CPhCltUssd14SendUssdCancelEv @ 1 NONAME
+	_ZN10CPhCltUssd4NewLEi @ 2 NONAME
+	_ZN10CPhCltUssd8SendUssdERK6TDesC8 @ 3 NONAME
+	_ZN10CPhCltUssd8SendUssdERK6TDesC8h @ 4 NONAME
+	_ZN10CPhCltUssd8SendUssdERK7TDesC16 @ 5 NONAME
+	_ZN10CPhCltUssdD0Ev @ 6 NONAME
+	_ZN10CPhCltUssdD1Ev @ 7 NONAME
+	_ZN10CPhCltUssdD2Ev @ 8 NONAME
+	_ZN10PhCltUtils11IsValidCharE5TChar @ 9 NONAME
+	_ZN10PhCltUtils18RemoveInvalidCharsER6TDes16 @ 10 NONAME
+	_ZN10PhCltUtils30RemoveURIPrefixdAndDomainCharsER6TDes16 @ 11 NONAME
+	_ZN10RPhCltUssd10CancelSendEv @ 12 NONAME
+	_ZN10RPhCltUssd11AppStartingEv @ 13 NONAME
+	_ZN10RPhCltUssd14AppTerminatingE23TPhCltUssdAppExitReason @ 14 NONAME
+	_ZN10RPhCltUssd15AppToBackgroundEv @ 15 NONAME
+	_ZN10RPhCltUssd15AppToForegroundEv @ 16 NONAME
+	_ZN10RPhCltUssd4OpenER12RPhCltServer @ 17 NONAME
+	_ZN10RPhCltUssd5CloseEv @ 18 NONAME
+	_ZN10RPhCltUssd8SendUssdER14TRequestStatusRK6TDesC8S4_ @ 19 NONAME
+	_ZN10RPhCltUssdC1Ev @ 20 NONAME
+	_ZN10RPhCltUssdC2Ev @ 21 NONAME
+	_ZN12RPhCltServer7ConnectEi @ 22 NONAME
+	_ZN12RPhCltServer9CreateAllER14TRequestStatus @ 23 NONAME
+	_ZN12RPhCltServerC1Ev @ 24 NONAME
+	_ZN12RPhCltServerC2Ev @ 25 NONAME
+	_ZN16CPhCltCallNotify13RespondClientEi @ 26 NONAME
+	_ZN16CPhCltCallNotify17NotifyCallAttemptER14TRequestStatusR22CPhCltExtPhoneDialData @ 27 NONAME
+	_ZN16CPhCltCallNotify19NotifyEmergencyCallER14TRequestStatusR7TDesC16 @ 28 NONAME
+	_ZN16CPhCltCallNotify24RespondEmergencyToClientEi @ 29 NONAME
+	_ZN16CPhCltCallNotify4NewLEv @ 30 NONAME
+	_ZN16CPhCltCallNotify4OpenER12RPhCltServer @ 31 NONAME
+	_ZN16CPhCltCallNotify5CloseEv @ 32 NONAME
+	_ZN16CPhCltCallNotifyD0Ev @ 33 NONAME
+	_ZN16CPhCltCallNotifyD1Ev @ 34 NONAME
+	_ZN16CPhCltCallNotifyD2Ev @ 35 NONAME
+	_ZN18CPhCltExtPhoneBase4NewLEP22MPhCltExtPhoneObserver @ 36 NONAME
+	_ZN18RPhCltResourceFile5CloseEv @ 37 NONAME
+	_ZN18RPhCltResourceFile5OpenLER7CCoeEnv @ 38 NONAME
+	_ZN18RPhCltResourceFileC1Ev @ 39 NONAME
+	_ZN18RPhCltResourceFileC2Ev @ 40 NONAME
+	_ZN19CPhCltEmergencyCall4NewLEP27MPhCltEmergencyCallObserver @ 41 NONAME
+	_ZN19CPhCltUssdSatClient14SendSatMessageERK7TDesC16hR6TDes16RiRh @ 42 NONAME
+	_ZN19CPhCltUssdSatClient20SendSatMessageCancelEv @ 43 NONAME
+	_ZN19CPhCltUssdSatClient4NewLEi @ 44 NONAME
+	_ZN19CPhCltUssdSatClientD0Ev @ 45 NONAME
+	_ZN19CPhCltUssdSatClientD1Ev @ 46 NONAME
+	_ZN19CPhCltUssdSatClientD2Ev @ 47 NONAME
+	_ZN22CPhCltExtPhoneDialData10SetBearerLERK5TBuf8ILi14EE @ 48 NONAME
+	_ZN22CPhCltExtPhoneDialData10SetSATCallEi @ 49 NONAME
+	_ZN22CPhCltExtPhoneDialData11SetCallTypeE14TPhCltCallType @ 50 NONAME
+	_ZN22CPhCltExtPhoneDialData13SetAllowMatchEi @ 51 NONAME
+	_ZN22CPhCltExtPhoneDialData13SetShowNumberEi @ 52 NONAME
+	_ZN22CPhCltExtPhoneDialData14SetSubAddressLERK4TBufILi21EE @ 53 NONAME
+	_ZN22CPhCltExtPhoneDialData14SetWindowGroupEi @ 54 NONAME
+	_ZN22CPhCltExtPhoneDialData15SetContactLinkLERK6TDesC8 @ 55 NONAME
+	_ZN22CPhCltExtPhoneDialData15SetInitiateCallEi @ 56 NONAME
+	_ZN22CPhCltExtPhoneDialData16SetEndOtherCallsEi @ 57 NONAME
+	_ZN22CPhCltExtPhoneDialData17SetSendKeyPressedEi @ 58 NONAME
+	_ZN22CPhCltExtPhoneDialData18SetTelephoneNumberERK4TBufILi100EE @ 59 NONAME
+	_ZN22CPhCltExtPhoneDialData24SetRedialMaximumDurationE20TTimeIntervalSeconds @ 60 NONAME
+	_ZN22CPhCltExtPhoneDialData4NewLERK6TDesC8 @ 61 NONAME
+	_ZN22CPhCltExtPhoneDialData4NewLEv @ 62 NONAME
+	_ZN22CPhCltExtPhoneDialData5NewLCERK6TDesC8 @ 63 NONAME
+	_ZN22CPhCltExtPhoneDialData5NewLCEv @ 64 NONAME
+	_ZN22CPhCltExtPhoneDialData6PackLCEv @ 65 NONAME
+	_ZN22CPhCltExtPhoneDialData8SetNameLERK4TBufILi50EE @ 66 NONAME
+	_ZN22CPhCltExtPhoneDialData9SetRedialEi @ 67 NONAME
+	_ZN22CPhCltExtPhoneDialDataD0Ev @ 68 NONAME
+	_ZN22CPhCltExtPhoneDialDataD1Ev @ 69 NONAME
+	_ZN22CPhCltExtPhoneDialDataD2Ev @ 70 NONAME
+	_ZN9RPhCltIhf10SetIhfModeEii @ 71 NONAME
+	_ZN9RPhCltIhf19SetIhfModeFromPhoneEii @ 72 NONAME
+	_ZN9RPhCltIhf4OpenER12RPhCltServeri @ 73 NONAME
+	_ZN9RPhCltIhf5CloseEv @ 74 NONAME
+	_ZN9RPhCltIhfC1Ev @ 75 NONAME
+	_ZN9RPhCltIhfC2Ev @ 76 NONAME
+	_ZNK10RPhCltUssd15StartUssdEditorEv @ 77 NONAME
+	_ZNK16CPhCltCallNotify23CancelNotifyCallAttemptEv @ 78 NONAME
+	_ZNK16CPhCltCallNotify25CancelNotifyEmergencyCallEv @ 79 NONAME
+	_ZNK22CPhCltExtPhoneDialData10AllowMatchEv @ 80 NONAME
+	_ZNK22CPhCltExtPhoneDialData10ShowNumberEv @ 81 NONAME
+	_ZNK22CPhCltExtPhoneDialData10SubAddressEv @ 82 NONAME
+	_ZNK22CPhCltExtPhoneDialData11ContactLinkEv @ 83 NONAME
+	_ZNK22CPhCltExtPhoneDialData11WindowGroupEv @ 84 NONAME
+	_ZNK22CPhCltExtPhoneDialData12InitiateCallEv @ 85 NONAME
+	_ZNK22CPhCltExtPhoneDialData13EndOtherCallsEv @ 86 NONAME
+	_ZNK22CPhCltExtPhoneDialData14SendKeyPressedEv @ 87 NONAME
+	_ZNK22CPhCltExtPhoneDialData15TelephoneNumberEv @ 88 NONAME
+	_ZNK22CPhCltExtPhoneDialData20CalculatePackageSizeEv @ 89 NONAME
+	_ZNK22CPhCltExtPhoneDialData21RedialMaximumDurationEv @ 90 NONAME
+	_ZNK22CPhCltExtPhoneDialData4NameEv @ 91 NONAME
+	_ZNK22CPhCltExtPhoneDialData6BearerEv @ 92 NONAME
+	_ZNK22CPhCltExtPhoneDialData6RedialEv @ 93 NONAME
+	_ZNK22CPhCltExtPhoneDialData7SATCallEv @ 94 NONAME
+	_ZNK22CPhCltExtPhoneDialData8CallTypeEv @ 95 NONAME
+	_ZTI10CPhCltUssd @ 96 NONAME ; #<TI>#
+	_ZTI16CPhCltCallNotify @ 97 NONAME ; #<TI>#
+	_ZTI19CPhCltUssdSatClient @ 98 NONAME ; #<TI>#
+	_ZTV10CPhCltUssd @ 99 NONAME ; #<VT>#
+	_ZTV16CPhCltCallNotify @ 100 NONAME ; #<VT>#
+	_ZTV19CPhCltUssdSatClient @ 101 NONAME ; #<VT>#
+	_ZN22CPhCltExtPhoneDialData12SetServiceIdEm @ 102 NONAME
+	_ZNK22CPhCltExtPhoneDialData9ServiceIdEv @ 103 NONAME
+	_ZN22CPhCltExtPhoneDialData7SetUUILERK7TDesC16 @ 104 NONAME
+	_ZNK22CPhCltExtPhoneDialData3UUIEv @ 105 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/eabi/phoneclient_extu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,113 @@
+EXPORTS
+	_ZN10CPhCltUssd4NewLEi @ 1 NONAME
+	_ZN10PhCltUtils11IsValidCharE5TChar @ 2 NONAME
+	_ZN10PhCltUtils18RemoveInvalidCharsER6TDes16 @ 3 NONAME
+	_ZN10PhCltUtils30RemoveURIPrefixdAndDomainCharsER6TDes16 @ 4 NONAME
+	_ZN12CPhCltDialer4NewLEv @ 5 NONAME
+	_ZN12CPhCltDialer8DialDataEv @ 6 NONAME
+	_ZN12CPhCltDialer9ExecuteLDEv @ 7 NONAME
+	_ZN12RPhCltServer7ConnectEi @ 8 NONAME
+	_ZN12RPhCltServer9CreateAllER14TRequestStatus @ 9 NONAME
+	_ZN12RPhCltServerC1Ev @ 10 NONAME
+	_ZN12RPhCltServerC2Ev @ 11 NONAME
+	_ZN13CPhCltUssdInt4NewLEi @ 12 NONAME
+	_ZN15CPhCltMessenger4NewLERK4TUidRKi @ 13 NONAME
+	_ZN16RPhCltCallNotify13RespondClientEi @ 14 NONAME
+	_ZN16RPhCltCallNotify17NotifyCallAttemptER14TRequestStatusR5TDes8 @ 15 NONAME
+	_ZN16RPhCltCallNotify20NotifyComHandCommandER14TRequestStatusR5TDes8 @ 16 NONAME
+	_ZN16RPhCltCallNotify20RespondComHandClientEi @ 17 NONAME
+	_ZN16RPhCltCallNotify4OpenER12RPhCltServer @ 18 NONAME
+	_ZN16RPhCltCallNotify5CloseEv @ 19 NONAME
+	_ZN16RPhCltCallNotifyC1Ev @ 20 NONAME
+	_ZN16RPhCltCallNotifyC2Ev @ 21 NONAME
+	_ZN18CPhCltExtPhoneBase4NewLEP22MPhCltExtPhoneObserver @ 22 NONAME
+	_ZN18CPhCltImageHandler4NewLEv @ 23 NONAME
+	_ZN18RPhCltResourceFile5CloseEv @ 24 NONAME
+	_ZN18RPhCltResourceFile5OpenLER7CCoeEnv @ 25 NONAME
+	_ZN18RPhCltResourceFileC1Ev @ 26 NONAME
+	_ZN18RPhCltResourceFileC2Ev @ 27 NONAME
+	_ZN19CPhCltUssdSatClient14SendSatMessageERK7TDesC16hR6TDes16RiRh @ 28 NONAME
+	_ZN19CPhCltUssdSatClient20SendSatMessageCancelEv @ 29 NONAME
+	_ZN19CPhCltUssdSatClient4NewLEi @ 30 NONAME
+	_ZN19CPhCltUssdSatClientD0Ev @ 31 NONAME
+	_ZN19CPhCltUssdSatClientD1Ev @ 32 NONAME
+	_ZN19CPhCltUssdSatClientD2Ev @ 33 NONAME
+	_ZN20CPhCltCommandHandler4NewLEv @ 34 NONAME
+	_ZN21RPhCltEmergencyNumber21IsEmergenyPhoneNumberERK4TBufILi100EERi30TPhCltEmergencyNumberQueryMode @ 35 NONAME
+	_ZN21RPhCltEmergencyNumber22IsEmergencyPhoneNumberER4TBufILi100EERi30TPhCltEmergencyNumberQueryMode @ 36 NONAME
+	_ZN21RPhCltEmergencyNumber4OpenER12RPhCltServer @ 37 NONAME
+	_ZN21RPhCltEmergencyNumber5CloseEv @ 38 NONAME
+	_ZN21RPhCltEmergencyNumberC1Ev @ 39 NONAME
+	_ZN21RPhCltEmergencyNumberC2Ev @ 40 NONAME
+	_ZN22TPhCltExtPhoneDialData10SetSATCallEi @ 41 NONAME
+	_ZN22TPhCltExtPhoneDialData11SetCallTypeE14TPhCltCallType @ 42 NONAME
+	_ZN22TPhCltExtPhoneDialData12SetContactIdEl @ 43 NONAME
+	_ZN22TPhCltExtPhoneDialData12SetEmergencyEi @ 44 NONAME
+	_ZN22TPhCltExtPhoneDialData13SetAllowMatchEi @ 45 NONAME
+	_ZN22TPhCltExtPhoneDialData13SetNumberTypeEi @ 46 NONAME
+	_ZN22TPhCltExtPhoneDialData13SetShowNumberEi @ 47 NONAME
+	_ZN22TPhCltExtPhoneDialData13SetSubAddressERK4TBufILi21EE @ 48 NONAME
+	_ZN22TPhCltExtPhoneDialData14SetWindowGroupEi @ 49 NONAME
+	_ZN22TPhCltExtPhoneDialData16SetEndOtherCallsEi @ 50 NONAME
+	_ZN22TPhCltExtPhoneDialData17SetSendKeyPressedEi @ 51 NONAME
+	_ZN22TPhCltExtPhoneDialData18SetTelephoneNumberERK4TBufILi100EE @ 52 NONAME
+	_ZN22TPhCltExtPhoneDialData24SetRedialMaximumDurationE20TTimeIntervalSeconds @ 53 NONAME
+	_ZN22TPhCltExtPhoneDialData31SetReturnToNumberEntryOnFailureEi @ 54 NONAME
+	_ZN22TPhCltExtPhoneDialData7SetNameERK4TBufILi50EE @ 55 NONAME
+	_ZN22TPhCltExtPhoneDialData9SetBearerERK5TBuf8ILi14EE @ 56 NONAME
+	_ZN22TPhCltExtPhoneDialData9SetRedialEi @ 57 NONAME
+	_ZN22TPhCltExtPhoneDialDataC1ERK4TBufILi100EEi @ 58 NONAME
+	_ZN22TPhCltExtPhoneDialDataC1ERK4TBufILi100EEl @ 59 NONAME
+	_ZN22TPhCltExtPhoneDialDataC1ERK4TBufILi100EEli @ 60 NONAME
+	_ZN22TPhCltExtPhoneDialDataC1ERK4TBufILi50EERKS0_ILi100EEli @ 61 NONAME
+	_ZN22TPhCltExtPhoneDialDataC1Ev @ 62 NONAME
+	_ZN22TPhCltExtPhoneDialDataC2ERK4TBufILi100EEi @ 63 NONAME
+	_ZN22TPhCltExtPhoneDialDataC2ERK4TBufILi100EEl @ 64 NONAME
+	_ZN22TPhCltExtPhoneDialDataC2ERK4TBufILi100EEli @ 65 NONAME
+	_ZN22TPhCltExtPhoneDialDataC2ERK4TBufILi50EERKS0_ILi100EEli @ 66 NONAME
+	_ZN22TPhCltExtPhoneDialDataC2Ev @ 67 NONAME
+	_ZN24CPhCltEmergencyTelNumber12InternalizeLER11RReadStream @ 68 NONAME
+	_ZN24CPhCltEmergencyTelNumber4SetLERK4TBufILi100EEtt @ 69 NONAME
+	_ZN24CPhCltEmergencyTelNumber5NewLCEv @ 70 NONAME
+	_ZN24CPhCltEmergencyTelNumberD0Ev @ 71 NONAME
+	_ZN24CPhCltEmergencyTelNumberD1Ev @ 72 NONAME
+	_ZN24CPhCltEmergencyTelNumberD2Ev @ 73 NONAME
+	_ZN9RPhCltIhf10SetIhfModeEii @ 74 NONAME
+	_ZN9RPhCltIhf19SetIhfModeFromPhoneEii @ 75 NONAME
+	_ZN9RPhCltIhf4OpenER12RPhCltServeri @ 76 NONAME
+	_ZN9RPhCltIhf5CloseEv @ 77 NONAME
+	_ZN9RPhCltIhfC1Ev @ 78 NONAME
+	_ZN9RPhCltIhfC2Ev @ 79 NONAME
+	_ZNK16RPhCltCallNotify23CancelNotifyCallAttemptEv @ 80 NONAME
+	_ZNK16RPhCltCallNotify26CancelNotifyComHandCommandEv @ 81 NONAME
+	_ZNK22TPhCltExtPhoneDialData10AllowMatchEv @ 82 NONAME
+	_ZNK22TPhCltExtPhoneDialData10NumberTypeEv @ 83 NONAME
+	_ZNK22TPhCltExtPhoneDialData10ShowNumberEv @ 84 NONAME
+	_ZNK22TPhCltExtPhoneDialData10SubAddressEv @ 85 NONAME
+	_ZNK22TPhCltExtPhoneDialData11AsIPCStructER14TPhCltCallArgs @ 86 NONAME
+	_ZNK22TPhCltExtPhoneDialData13EndOtherCallsEv @ 87 NONAME
+	_ZNK22TPhCltExtPhoneDialData13WindowGroupIdEv @ 88 NONAME
+	_ZNK22TPhCltExtPhoneDialData14SendKeyPressedEv @ 89 NONAME
+	_ZNK22TPhCltExtPhoneDialData15TelephoneNumberEv @ 90 NONAME
+	_ZNK22TPhCltExtPhoneDialData21RedialMaximumDurationEv @ 91 NONAME
+	_ZNK22TPhCltExtPhoneDialData28ReturnToNumberEntryOnFailureEv @ 92 NONAME
+	_ZNK22TPhCltExtPhoneDialData4NameEv @ 93 NONAME
+	_ZNK22TPhCltExtPhoneDialData6BearerEv @ 94 NONAME
+	_ZNK22TPhCltExtPhoneDialData6RedialEv @ 95 NONAME
+	_ZNK22TPhCltExtPhoneDialData7SATCallEv @ 96 NONAME
+	_ZNK22TPhCltExtPhoneDialData8CallTypeEv @ 97 NONAME
+	_ZNK22TPhCltExtPhoneDialData9ContactIdEv @ 98 NONAME
+	_ZNK22TPhCltExtPhoneDialData9EmergencyEv @ 99 NONAME
+	_ZNK24CPhCltEmergencyTelNumber12ExternalizeLER12RWriteStream @ 100 NONAME
+	_ZNK24CPhCltEmergencyTelNumber3MCCEv @ 101 NONAME
+	_ZNK24CPhCltEmergencyTelNumber3MNCEv @ 102 NONAME
+	_ZNK24CPhCltEmergencyTelNumber9TelNumberEv @ 103 NONAME
+	_ZTI12CPhCltDialer @ 104 NONAME ; #<TI>#
+	_ZTI13CPhCltUssdImp @ 105 NONAME ; #<TI>#
+	_ZTI19CPhCltUssdSatClient @ 106 NONAME ; #<TI>#
+	_ZTI24CPhCltEmergencyTelNumber @ 107 NONAME ; #<TI>#
+	_ZTV12CPhCltDialer @ 108 NONAME ; #<VT>#
+	_ZTV13CPhCltUssdImp @ 109 NONAME ; #<VT>#
+	_ZTV19CPhCltUssdSatClient @ 110 NONAME ; #<VT>#
+	_ZTV24CPhCltEmergencyTelNumber @ 111 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/eabi/phoneclientu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,128 @@
+EXPORTS
+	_ZN10CPhCltUssd14SendUssdCancelEv @ 1 NONAME
+	_ZN10CPhCltUssd4NewLEi @ 2 NONAME
+	_ZN10CPhCltUssd8SendUssdERK6TDesC8 @ 3 NONAME
+	_ZN10CPhCltUssd8SendUssdERK6TDesC8h @ 4 NONAME
+	_ZN10CPhCltUssd8SendUssdERK7TDesC16 @ 5 NONAME
+	_ZN10CPhCltUssdD0Ev @ 6 NONAME
+	_ZN10CPhCltUssdD1Ev @ 7 NONAME
+	_ZN10CPhCltUssdD2Ev @ 8 NONAME
+	_ZN10PhCltUtils11IsValidCharE5TChar @ 9 NONAME
+	_ZN10PhCltUtils18RemoveInvalidCharsER6TDes16 @ 10 NONAME
+	_ZN10PhCltUtils30RemoveURIPrefixdAndDomainCharsER6TDes16 @ 11 NONAME
+	_ZN10RPhCltUssd10CancelSendEv @ 12 NONAME
+	_ZN10RPhCltUssd11AppStartingEv @ 13 NONAME
+	_ZN10RPhCltUssd14AppTerminatingE23TPhCltUssdAppExitReason @ 14 NONAME
+	_ZN10RPhCltUssd15AppToBackgroundEv @ 15 NONAME
+	_ZN10RPhCltUssd15AppToForegroundEv @ 16 NONAME
+	_ZN10RPhCltUssd4OpenER12RPhCltServer @ 17 NONAME
+	_ZN10RPhCltUssd5CloseEv @ 18 NONAME
+	_ZN10RPhCltUssd8SendUssdER14TRequestStatusRK6TDesC8S4_ @ 19 NONAME
+	_ZN10RPhCltUssdC1Ev @ 20 NONAME
+	_ZN10RPhCltUssdC2Ev @ 21 NONAME
+	_ZN12CPhCltDialer4NewLEv @ 22 NONAME
+	_ZN12CPhCltDialer8DialDataEv @ 23 NONAME
+	_ZN12CPhCltDialer9ExecuteLDEv @ 24 NONAME
+	_ZN12RPhCltServer7ConnectEi @ 25 NONAME
+	_ZN12RPhCltServer9CreateAllER14TRequestStatus @ 26 NONAME
+	_ZN12RPhCltServerC1Ev @ 27 NONAME
+	_ZN12RPhCltServerC2Ev @ 28 NONAME
+	_ZN16RPhCltCallNotify13RespondClientEi @ 29 NONAME
+	_ZN16RPhCltCallNotify17NotifyCallAttemptER14TRequestStatusR5TDes8 @ 30 NONAME
+	_ZN16RPhCltCallNotify17ReportPhoneStatusER14TRequestStatusi @ 31 NONAME
+	_ZN16RPhCltCallNotify24NotifyPhoneStatusRequestER14TRequestStatus @ 32 NONAME
+	_ZN16RPhCltCallNotify4OpenER12RPhCltServer @ 33 NONAME
+	_ZN16RPhCltCallNotify5CloseEv @ 34 NONAME
+	_ZN16RPhCltCallNotifyC1Ev @ 35 NONAME
+	_ZN16RPhCltCallNotifyC2Ev @ 36 NONAME
+	_ZN18CPhCltExtPhoneBase4NewLEP22MPhCltExtPhoneObserver @ 37 NONAME
+	_ZN18RPhCltResourceFile5CloseEv @ 38 NONAME
+	_ZN18RPhCltResourceFile5OpenLER7CCoeEnv @ 39 NONAME
+	_ZN18RPhCltResourceFileC1Ev @ 40 NONAME
+	_ZN18RPhCltResourceFileC2Ev @ 41 NONAME
+	_ZN19CPhCltUssdSatClient14SendSatMessageERK7TDesC16hR6TDes16RiRh @ 42 NONAME
+	_ZN19CPhCltUssdSatClient20SendSatMessageCancelEv @ 43 NONAME
+	_ZN19CPhCltUssdSatClient4NewLEi @ 44 NONAME
+	_ZN19CPhCltUssdSatClientD0Ev @ 45 NONAME
+	_ZN19CPhCltUssdSatClientD1Ev @ 46 NONAME
+	_ZN19CPhCltUssdSatClientD2Ev @ 47 NONAME
+	_ZN21RPhCltEmergencyNumber21IsEmergenyPhoneNumberERK4TBufILi100EERi30TPhCltEmergencyNumberQueryMode @ 48 NONAME
+	_ZN21RPhCltEmergencyNumber22IsEmergencyPhoneNumberER4TBufILi100EERi30TPhCltEmergencyNumberQueryMode @ 49 NONAME
+	_ZN21RPhCltEmergencyNumber4OpenER12RPhCltServer @ 50 NONAME
+	_ZN21RPhCltEmergencyNumber5CloseEv @ 51 NONAME
+	_ZN21RPhCltEmergencyNumberC1Ev @ 52 NONAME
+	_ZN21RPhCltEmergencyNumberC2Ev @ 53 NONAME
+	_ZN22TPhCltExtPhoneDialData10SetSATCallEi @ 54 NONAME
+	_ZN22TPhCltExtPhoneDialData11SetCallTypeE14TPhCltCallType @ 55 NONAME
+	_ZN22TPhCltExtPhoneDialData12SetContactIdEl @ 56 NONAME
+	_ZN22TPhCltExtPhoneDialData12SetEmergencyEi @ 57 NONAME
+	_ZN22TPhCltExtPhoneDialData13SetAllowMatchEi @ 58 NONAME
+	_ZN22TPhCltExtPhoneDialData13SetNumberTypeEi @ 59 NONAME
+	_ZN22TPhCltExtPhoneDialData13SetShowNumberEi @ 60 NONAME
+	_ZN22TPhCltExtPhoneDialData13SetSubAddressERK4TBufILi21EE @ 61 NONAME
+	_ZN22TPhCltExtPhoneDialData14SetWindowGroupEi @ 62 NONAME
+	_ZN22TPhCltExtPhoneDialData16SetEndOtherCallsEi @ 63 NONAME
+	_ZN22TPhCltExtPhoneDialData18SetTelephoneNumberERK4TBufILi100EE @ 64 NONAME
+	_ZN22TPhCltExtPhoneDialData31SetReturnToNumberEntryOnFailureEi @ 65 NONAME
+	_ZN22TPhCltExtPhoneDialData7SetNameERK4TBufILi50EE @ 66 NONAME
+	_ZN22TPhCltExtPhoneDialData9SetBearerERK5TBuf8ILi14EE @ 67 NONAME
+	_ZN22TPhCltExtPhoneDialData9SetRedialEi @ 68 NONAME
+	_ZN22TPhCltExtPhoneDialDataC1ERK4TBufILi100EEi @ 69 NONAME
+	_ZN22TPhCltExtPhoneDialDataC1ERK4TBufILi100EEl @ 70 NONAME
+	_ZN22TPhCltExtPhoneDialDataC1ERK4TBufILi100EEli @ 71 NONAME
+	_ZN22TPhCltExtPhoneDialDataC1ERK4TBufILi50EERKS0_ILi100EEli @ 72 NONAME
+	_ZN22TPhCltExtPhoneDialDataC1Ev @ 73 NONAME
+	_ZN22TPhCltExtPhoneDialDataC2ERK4TBufILi100EEi @ 74 NONAME
+	_ZN22TPhCltExtPhoneDialDataC2ERK4TBufILi100EEl @ 75 NONAME
+	_ZN22TPhCltExtPhoneDialDataC2ERK4TBufILi100EEli @ 76 NONAME
+	_ZN22TPhCltExtPhoneDialDataC2ERK4TBufILi50EERKS0_ILi100EEli @ 77 NONAME
+	_ZN22TPhCltExtPhoneDialDataC2Ev @ 78 NONAME
+	_ZN24CPhCltEmergencyTelNumber12InternalizeLER11RReadStream @ 79 NONAME
+	_ZN24CPhCltEmergencyTelNumber4SetLERK4TBufILi100EEtt @ 80 NONAME
+	_ZN24CPhCltEmergencyTelNumber5NewLCEv @ 81 NONAME
+	_ZN24CPhCltEmergencyTelNumberD0Ev @ 82 NONAME
+	_ZN24CPhCltEmergencyTelNumberD1Ev @ 83 NONAME
+	_ZN24CPhCltEmergencyTelNumberD2Ev @ 84 NONAME
+	_ZN9RPhCltIhf10SetIhfModeEii @ 85 NONAME
+	_ZN9RPhCltIhf19SetIhfModeFromPhoneEii @ 86 NONAME
+	_ZN9RPhCltIhf4OpenER12RPhCltServeri @ 87 NONAME
+	_ZN9RPhCltIhf5CloseEv @ 88 NONAME
+	_ZN9RPhCltIhfC1Ev @ 89 NONAME
+	_ZN9RPhCltIhfC2Ev @ 90 NONAME
+	_ZNK10RPhCltUssd15StartUssdEditorEv @ 91 NONAME
+	_ZNK16RPhCltCallNotify23CancelNotifyCallAttemptEv @ 92 NONAME
+	_ZNK16RPhCltCallNotify23CancelReportPhoneStatusEv @ 93 NONAME
+	_ZNK16RPhCltCallNotify30CancelNotifyPhoneStatusRequestEv @ 94 NONAME
+	_ZNK22TPhCltExtPhoneDialData10AllowMatchEv @ 95 NONAME
+	_ZNK22TPhCltExtPhoneDialData10NumberTypeEv @ 96 NONAME
+	_ZNK22TPhCltExtPhoneDialData10ShowNumberEv @ 97 NONAME
+	_ZNK22TPhCltExtPhoneDialData10SubAddressEv @ 98 NONAME
+	_ZNK22TPhCltExtPhoneDialData11AsIPCStructER14TPhCltCallArgs @ 99 NONAME
+	_ZNK22TPhCltExtPhoneDialData13EndOtherCallsEv @ 100 NONAME
+	_ZNK22TPhCltExtPhoneDialData13WindowGroupIdEv @ 101 NONAME
+	_ZNK22TPhCltExtPhoneDialData15TelephoneNumberEv @ 102 NONAME
+	_ZNK22TPhCltExtPhoneDialData28ReturnToNumberEntryOnFailureEv @ 103 NONAME
+	_ZNK22TPhCltExtPhoneDialData4NameEv @ 104 NONAME
+	_ZNK22TPhCltExtPhoneDialData6BearerEv @ 105 NONAME
+	_ZNK22TPhCltExtPhoneDialData6RedialEv @ 106 NONAME
+	_ZNK22TPhCltExtPhoneDialData7SATCallEv @ 107 NONAME
+	_ZNK22TPhCltExtPhoneDialData8CallTypeEv @ 108 NONAME
+	_ZNK22TPhCltExtPhoneDialData9ContactIdEv @ 109 NONAME
+	_ZNK22TPhCltExtPhoneDialData9EmergencyEv @ 110 NONAME
+	_ZNK24CPhCltEmergencyTelNumber12ExternalizeLER12RWriteStream @ 111 NONAME
+	_ZNK24CPhCltEmergencyTelNumber3MCCEv @ 112 NONAME
+	_ZNK24CPhCltEmergencyTelNumber3MNCEv @ 113 NONAME
+	_ZNK24CPhCltEmergencyTelNumber9TelNumberEv @ 114 NONAME
+	_ZTI10CPhCltUssd @ 115 NONAME ; #<TI>#
+	_ZTI12CPhCltDialer @ 116 NONAME ; #<TI>#
+	_ZTI19CPhCltUssdSatClient @ 117 NONAME ; #<TI>#
+	_ZTI24CPhCltEmergencyTelNumber @ 118 NONAME ; #<TI>#
+	_ZTV10CPhCltUssd @ 119 NONAME ; #<VT>#
+	_ZTV12CPhCltDialer @ 120 NONAME ; #<VT>#
+	_ZTV19CPhCltUssdSatClient @ 121 NONAME ; #<VT>#
+	_ZTV24CPhCltEmergencyTelNumber @ 122 NONAME ; #<VT>#
+	_ZN22TPhCltExtPhoneDialData17SetSendKeyPressedEi @ 123 NONAME
+	_ZNK22TPhCltExtPhoneDialData14SendKeyPressedEv @ 124 NONAME
+	_ZN22TPhCltExtPhoneDialData24SetRedialMaximumDurationE20TTimeIntervalSeconds @ 125 NONAME
+	_ZNK22TPhCltExtPhoneDialData21RedialMaximumDurationEv @ 126 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  build file for PhoneClient.
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+
+PRJ_EXPORTS
+
+  ../inc/emergencynumber/emergencynumber_aiw/rphcltemergencycall.h  |../../inc/rphcltemergencycall.h
+  ../inc/misc/telservicesinternalcrkeys.h                           |../../../inc/telservicesinternalcrkeys.h
+  ../inc/misc/telservicesvariant.hrh                                  |../../../inc/telservicesvariant.hrh
+  ../inc/extcall/extcall_aiw/cphcltextphonedialdata.h  |../../inc/cphcltextphonedialdata.h
+  ../inc/extcallwrapper/extcallwrapper_aiw/mphcltextphoneobserver.h  |../../inc/mphcltextphoneobserver.h
+  ../inc/extcallwrapper/extcallwrapper_aiw/cphcltextphonebase.h  |../../inc/cphcltextphonebase.h
+  ../inc/extcallwrapper/extcallwrapper_aiw/cphcltdialer.h  |../../inc/cphcltdialer.h
+
+../data/phoneclient_stub.sis                 /epoc32/data/z/system/install/phoneclient_stub.sis
+
+// IBY files
+../rom/phoneclient.iby                      CORE_MW_LAYER_IBY_EXPORT_PATH(phoneclient.iby)
+
+// Generic configuration interface for component cenrep settings  
+../conf/telephonyservices.confml                  MW_LAYER_CONFML(telephonyservices.confml)
+../conf/telephonyservices_102029ac.crml             MW_LAYER_CRML(telephonyservices_102029ac.crml)
+../conf/telephonyservices_102078f1.crml             MW_LAYER_CRML(telephonyservices_102078f1.crml)
+
+PRJ_MMPFILES
+../group/phoneclient.mmp
+
+PRJ_TESTMMPFILES
+// specify the .mmp files required for building any test programs here
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/group/phoneclient.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,140 @@
+/*
+* 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:  Phone Client DLL defines the API for Phone server.
+*
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+// Capability assignment.
+CAPABILITY CAP_CLIENT_DLL
+
+// Assign Vendor ID.
+VENDORID VID_DEFAULT
+
+TARGET          phoneclient.dll
+TARGETTYPE      dll
+UID             0x1000008d 0x1000084F
+
+SOURCEPATH      ../src/notifier/notifier_aiw 
+SOURCE          cphcltcallnotify.cpp 
+SOURCE          rphcltcallnotify.cpp 
+SOURCE          cphcltdialrequestmonitor.cpp
+SOURCE          cphcltdialemergencyrequestmonitor.cpp
+SOURCE          cphcltcomhandrequestmonitor.cpp
+
+
+SOURCEPATH      ../src/extcall/extcall_aiw 
+SOURCE          rphcltextcall.cpp 
+SOURCE          cphcltextphonedialdata.cpp 
+SOURCE          cphcltdialdata.cpp
+
+SOURCEPATH      ../src/extcallwrapper/extcallwrapper_aiw 
+SOURCE          cphcltextphone.cpp 
+SOURCE          cphcltextphonebase.cpp 
+
+SOURCEPATH      ../src/ussd/ussd_ext 
+SOURCE          rphcltussd.cpp
+
+SOURCEPATH      ../src/ussdwrapper 
+SOURCE          cphcltussdrequesthandler.cpp 
+
+SOURCE          cphcltussdsatclient.cpp 
+  
+SOURCE          cphcltussdint.cpp 
+SOURCE          cphcltussdimp.cpp 
+SOURCE          cphcltussdext.cpp 
+
+SOURCE      cphcltussdnotecontroller.cpp 
+
+SOURCEPATH      ../src/emergencynumber/emergencynumber_aiw 
+SOURCE          cphcltemergencycall.cpp 
+SOURCE          rphcltemergencycall.cpp 
+SOURCE          cphcltemergencycallimpl.cpp 
+
+SOURCEPATH      ../src/session 
+SOURCE          rphcltserver.cpp 
+
+SOURCEPATH      ../src 
+SOURCE          phcltutils.cpp 
+SOURCE          rphcltresourcefile.cpp 
+
+SOURCEPATH      ../src/commandhandler 
+SOURCE          cphcltcommandhandler.cpp 
+SOURCE          cphcltcomhandimplementation.cpp 
+SOURCE          rphcltcommandhandler.cpp 
+SOURCEPATH      ../src/imagehandler 
+SOURCE          cphcltimagehandler.cpp 
+SOURCE          cphcltbaseimageparams.cpp 
+SOURCE          cphcltoperatorlogocontainer.cpp 
+SOURCE          cphcltimagehandlerimplementation.cpp 
+SOURCE          rphcltimagehandler.cpp 
+SOURCEPATH      ../src/messenger 
+SOURCE          cphcltmessenger.cpp 
+SOURCE          rphcltmessenger.cpp 
+SOURCE          cphcltmessengerimplementation.cpp 
+
+
+
+SOURCEPATH      ../src 
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   ../../../inc
+SYSTEMINCLUDE        /epoc32/include/mw/hb/hbwidgets
+SYSTEMINCLUDE        /epoc32/include/mw/hb/hbcore
+SYSTEMINCLUDE        /epoc32/include/platform/mw/loc
+SYSTEMINCLUDE        /epoc32/include/platform/mw/loc/sc
+
+USERINCLUDE     ../inc/extcall/extcall_aiw 
+USERINCLUDE     ../inc/notifier/notifier_aiw 
+USERINCLUDE     ../inc/extcallwrapper/extcallwrapper_aiw 
+USERINCLUDE     ../inc/emergencynumber/emergencynumber_aiw 
+
+USERINCLUDE     ../inc/session 
+USERINCLUDE     ../inc/sharedclientserver 
+
+USERINCLUDE     ../inc/ussdwrapper/ussd_ext 
+USERINCLUDE     ../inc/ussd/ussd_ext 
+USERINCLUDE     ../inc/commandhandler 
+USERINCLUDE     ../inc/imagehandler 
+USERINCLUDE     ../inc/messenger 
+USERINCLUDE     ../inc/ussdwrapper 
+USERINCLUDE     ../inc 
+
+
+LIBRARY         euser.lib
+LIBRARY         aknnotify.lib
+LIBRARY         cone.lib
+LIBRARY         estor.lib
+LIBRARY         commonengine.lib 
+LIBRARY         eikdlg.lib
+LIBRARY         eikcoctl.lib
+LIBRARY         etelmm.lib
+LIBRARY         gsmu.lib
+LIBRARY         efsrv.lib
+LIBRARY         charconv.lib
+LIBRARY         fbscli.lib
+LIBRARY         hbwidgets.lib
+LIBRARY         flogger.lib
+LIBRARY         hbcore.lib
+
+
+#ifdef WINSCW
+    DEFFILE ../bwins/phoneclient_aiwext.def
+#else
+    DEFFILE ../eabi/phoneclient_aiwext.def
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/commandhandler/cphcltcomhandimplementation.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,142 @@
+/*
+* Copyright (c) 2003-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:  Implementation of the PhCltExtension interface.
+*
+*/
+
+
+
+#ifndef CPHCLTCOMHANDLIMPLEMENTATION_H
+#define CPHCLTCOMHANDLIMPLEMENTATION_H
+
+
+//  INCLUDES
+
+#include    "rphcltcommandhandler.h" 
+#include    "rphcltcommandhandlernotify.h" 
+#include    "rphcltserver.h" 
+
+
+// CLASS DECLARATION
+
+/**
+*  Implementation of the CPhCltCommandHandler interface.
+*
+*
+*  @lib PhoneClient.lib
+*  @since 3.2
+*/
+NONSHARABLE_CLASS( CPhCltCommandHandlerImplementation )
+:   public CPhCltCommandHandler
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CPhCltCommandHandlerImplementation* NewL();
+        
+
+        /**
+        * Destructor.
+        */
+        virtual ~CPhCltCommandHandlerImplementation();
+
+
+    public: // Functions from base classes
+
+        /**
+        * @see CPhCltCommandHandler.
+        */
+        void Atd(
+            TRequestStatus& aStatus, 
+            const TPhCltTelephoneNumber& aTelephoneNumber );
+            
+
+        /**
+        * @see CPhCltCommandHandler.
+        */
+        void Ata(
+            TRequestStatus& aStatus );
+
+
+        /**
+        * @see CPhCltCommandHandler.
+        */
+        void Chld(
+            TRequestStatus& aStatus, 
+            const TPhCltChldCommand aChldCommand,
+            const TUint aCallNumber );
+
+
+        /**
+        * @see CPhCltCommandHandler.
+        */
+        void Chup(
+            TRequestStatus& aStatus );
+
+
+        /**
+        * @see CPhCltCommandHandler.
+        */
+        void Vts(
+            TRequestStatus& aStatus, 
+            const TPhCltDtmfTone aDtmfTone,
+            const TPhCltDtmfAction aAction );
+
+        /**
+        * @see CPhCltCommandHandler.
+        */
+        void CancelAsyncRequest( 
+            const TPhCltComHandCommand aReqToCancel );
+
+        /**
+        * @see CPhCltCommandHandler.
+        */
+        void MuteMicrophone( TRequestStatus& aStatus, const TBool aMute );
+        
+        /**
+        * @see CPhCltCommandHandler.
+        */
+        void MuteRingingTone( TRequestStatus& aStatus );
+
+    private:
+
+        /**
+        * C++ constructor.
+        */
+        CPhCltCommandHandlerImplementation();
+
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+
+    private:    // Data
+
+        // The command handler to perform requests.
+        RPhCltCommandHandler    iCommandHandler;
+        
+        //RPhCltServer class instance creates phonesession
+        RPhCltServer iServer;
+
+    };
+
+
+#endif      // CPHCLTCOMHANDLIMPLEMENTATION_H
+
+  
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/commandhandler/rphcltcommandhandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,186 @@
+/*
+* Copyright (c) 2003-2004 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class is used to perform command handler originated 
+*                commands.
+*
+*/
+
+
+#ifndef RPHCLTCOMMANDHANDLER_H
+#define RPHCLTCOMMANDHANDLER_H
+
+
+//  INCLUDES
+#include <e32base.h>
+#include <phclttypes.h> 
+//#include "cphcltcommandhandlernotify.h" 
+#include "cphcltcommandhandler.h" 
+
+// FORWARD DECLARATIONS
+class RPhCltServer;
+
+// CLASS DECLARATION
+
+/**
+*  PhoneClient command handler interface.
+*  The user of this API has to take care that there is only at most one 
+*  request, i.e. function call, ongoing (active) at the time. However, the 
+*  corresponding Cancel method can be called while request is ongoing.
+*  
+*  @lib PhoneClient.lib
+*  @since 3.2
+
+*/
+class RPhCltCommandHandler
+:   public RSubSessionBase
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Constructor.
+        */
+        RPhCltCommandHandler();
+
+
+    public: // New functions
+
+        /**
+        * Open subsession to server.
+        * 
+        * @param aServer Pre-opened server session.
+        * @return Symbian OS error code of the success of the opening.
+        */
+        TInt Open( RPhCltServer& aServer );
+
+
+        /**
+        * Close subsession.
+        */
+        void Close();
+
+        /**
+        * Dial. Only voice call is supported.
+        *
+        * @param aStatus The status updated when function call is completed.
+        *                KErrNone if successful, Symbian error code otherwise.
+        * @param aTelephoneNumber The telephony number .
+        */
+            
+        void Atd(
+            TRequestStatus& aStatus, 
+            const TPhCltTelephoneNumber& aTelephoneNumber );
+        
+
+        /**
+        * Answer the call. 
+        * Does not need response according to specification.
+        *  
+        * @param aStatus The status updated when function call is completed.
+        *                KErrNone if successful, Symbian error code otherwise.
+        *                KErrNotReady if there is no call to be answered.
+        */
+        void Ata(
+            TRequestStatus& aStatus );
+
+
+        /**
+        * Call hold and multiparty handling.
+        * 
+        * @param aStatus The status updated when function call is completed.
+        *                KErrNone if successful, Symbian error code otherwise.
+        * @param aChldCommand The command to be performed.
+        * @param aCallNumber The call number where the command specified in
+        *                    aChldCommand is targeted. 
+        *                    Not used currently.
+        */
+        void Chld(
+            TRequestStatus& aStatus, 
+            const TPhCltChldCommand aChldCommand,
+            const TUint aCallNumber );
+
+
+        /**
+        * Hang up current call.
+        * Does not need response according to specification.
+        *  
+        * @param aStatus The status updated when function call is completed.
+        *                KErrNone if successful, Symbian error code otherwise.
+        */
+        void Chup(
+            TRequestStatus& aStatus );
+
+
+        /**
+        * DTMF sending, starting and stopping in same function. 
+        * Does not need response according to specification.
+        *
+        * @param aStatus The status updated when function call is completed.
+        *                KErrNone if successful, Symbian error code otherwise.
+        * @param aDtmfTone The DTMF tone to be sent.
+        * @param aActivation Desired DTMF action.
+        */
+        void Vts(
+            TRequestStatus& aStatus, 
+            const TPhCltDtmfTone aDtmfTone,
+            const TPhCltDtmfAction aAction );
+
+        /**
+        * Cancel the ongoing asynchronous request.
+        *
+        * @param aReqToCancel The request to be canceled.
+        */
+        void CancelAsyncRequest( 
+            const TPhCltComHandCommand aReqToCancel );
+
+        /**
+        * Mute Microphone.
+        *
+        * @since 2.8
+        * @param aStatus The status updated when function call is completed.
+        *                KErrNone if successful, Symbian error code otherwise.
+        * @param aMute ETrue if Mic Mute is set on.
+        */
+        void MuteMicrophone(
+            TRequestStatus& aStatus,
+            const TBool aMute );
+
+
+        /**
+        * Mute RingingTone.
+        *
+        * @since 2.8
+        * @param aStatus The status updated when function call is completed.
+        *                KErrNone if successful, Symbian error code otherwise.
+        */
+        void MuteRingingTone(
+            TRequestStatus& aStatus );
+            
+    private:
+
+        // Prohibit copy constructor if not deriving from CBase.
+        RPhCltCommandHandler( const RPhCltCommandHandler& );
+
+        // Prohibit assigment operator if not deriving from CBase.
+        RPhCltCommandHandler& operator=( const RPhCltCommandHandler& );
+
+
+    private:    // Data
+
+        // Command handler arguments.
+        TPckgBuf< TPhCltComHandCommandParameters >  iComHandParams;
+    };
+
+#endif      // RPHCLTCOMMANDHANDLER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/commandhandler/rphcltcommandhandlernotify.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2003-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:  Observer getting notifications about 
+*                command handler requests from Phone Server.
+*
+*/
+
+#ifndef RPHCLTCOMMANDHANDLERNOTIFY_H
+#define RPHCLTCOMMANDHANDLERNOTIFY_H
+
+//  INCLUDES
+#include <e32base.h>
+
+
+//  FORWARD DECLARATIONS
+class RPhCltServer;
+
+
+// CLASS DECLARATION
+
+/**
+*  Observer getting notifications about command handler requests
+*  from Phone Server.
+*
+*  @lib PhoneClient.lib
+*  @since 3.2
+*/
+class RPhCltCommandHandlerNotify 
+:   public RSubSessionBase
+    {
+    public: // Constructors and destructors.
+
+        /**
+         * Constructor.
+         */
+        RPhCltCommandHandlerNotify();
+
+
+    public: // New functions
+
+        /**
+        * Open subsession to server.
+        * 
+        * @param aServer Pre-opened server session.
+        * @return Symbian OS error code of the success of the opening.
+        */
+        TInt Open( RPhCltServer& aServer );
+
+
+        /**
+        * Close subsession.
+        */
+        void Close();
+    
+
+        /**
+        * Notifies when a Command handler request arrives.
+        *
+        * @param aStatus Status to be changed when command handler request
+        *                has arrived.
+        * @param aCommandArgs Command argument storage place. 
+        *                     That is, packaged version of class 
+        *                     TPhCltComHandCommandParameters.
+        */
+        void NotifyComHandCommand( 
+            TRequestStatus& aStatus, 
+            TDes8& aCommandArgs );
+
+
+        /**
+        * Cancel pending command handler request notification.
+        */
+        void CancelNotifyComHandCommand() const;
+        
+
+        /**
+        * Respond to client's command handler request.
+        *
+        * @param aResultCode Result of the response 
+        *        (previous function execution).
+        * @return KErrNone if respond succeeded, otherwise Symbian error code.
+        */
+        TInt RespondClient( const TInt aResultCode );
+
+
+    private:
+
+        // Prohibit copy constructor if not deriving from CBase.
+        RPhCltCommandHandlerNotify( const RPhCltCommandHandlerNotify& );
+
+        // Prohibit assigment operator if not deriving from CBase.
+        RPhCltCommandHandlerNotify& operator=( 
+            const RPhCltCommandHandlerNotify& );
+
+    };
+
+#endif    // RPHCLTCOMMANDHANDLERNOTIFY_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/emergencynumber/cphcltemergencytelnumber.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Emergency Telephony Number
+*
+*/
+
+
+#ifndef CPHCLTEMERGENCYTELNUMBER_H
+#define CPHCLTEMERGENCYTELNUMBER_H
+
+//  INCLUDES
+#include <e32std.h>
+#include "phclttypes.h" 
+#include "rphcltserver.h" 
+
+// CLASS DECLARATION
+
+/**
+*  Emergency Telephony Number.
+*
+*  @lib phoneclient.lib
+*  @since 1.0
+*/
+class CPhCltEmergencyTelNumber : public CBase
+    {
+    public:
+
+        /**
+        * Two-phased constructor.
+        *
+        * @return Pointer to created CPhCltEmergencyTelNumber instance.
+        */
+        IMPORT_C static CPhCltEmergencyTelNumber* NewLC();
+
+        /**
+        * Destructor.
+        */
+        IMPORT_C ~CPhCltEmergencyTelNumber();
+
+
+    public: // [In|Ex]ternalize
+
+        /**
+        * Read an emergency number from a stream.
+        *
+        * @param aStream The stream from which the emergency number is read.
+        */
+        IMPORT_C void InternalizeL( RReadStream& aStream );
+
+        /**
+        * Write an emergency number to a stream.
+        *
+        * @param aStream The stream where the emergency number is written.
+        */
+        IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
+
+
+    public: // Access
+
+        /**
+        * Return the phone number.
+        *
+        * @return The telephony number field of the emergency number.
+        */
+        IMPORT_C const TDesC& TelNumber() const;
+
+        /**
+        * Return the MNC field.
+        *
+        * @return The MNC field of the emergency number.
+        */
+        IMPORT_C TUint16 MNC() const;
+
+        /**
+        * Return the MCC field.
+        *
+        * @return The MCC field of the emergency number.
+        */
+        IMPORT_C TUint16 MCC() const;
+
+        /**
+        * Set details of the emergency number.
+        *
+        * @param aNumber Telephony number field of the emergency number.
+        * @param aMNC MNC field of the emergency number.
+        * @param aMCC MCC field of the emergency number.
+        */
+        IMPORT_C void SetL( 
+            const TPhCltTelephoneNumber& aNumber, 
+            TUint16 aMNC, 
+            TUint16 aMCC );
+
+
+    private:
+
+        // MNC field of the emergency number.
+        TUint16 iFieldMNC;
+
+        // MCC field of the emergency number.
+        TUint16 iFieldMCC;
+
+        // Telephony number field of the emergency number.
+        HBufC* iTelNumber;
+
+    };
+
+
+#endif // CPHCLTEMERGENCYTELNUMBER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/emergencynumber/emergencynumber_aiw/cphcltemergencycallimpl.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,126 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Client side access to emergency call
+*
+*/
+
+
+#ifndef CPHCLTEMERGENCYCALLIMPL_H
+#define CPHCLTEMERGENCYCALLIMPL_H
+
+//  INCLUDES
+#include <e32std.h>
+#include "rphcltserver.h" 
+#include "cphcltemergencycall.h" 
+#include "rphcltemergencycall.h" 
+
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+*  Client side access to emergency call
+*
+*  @lib phoneclient.lib
+*  @since Series60_1.0
+*/
+NONSHARABLE_CLASS( CPhCltEmergencyCallImpl ) : public CPhCltEmergencyCall
+    {
+    public: // Constructors and destructors.
+
+        static CPhCltEmergencyCallImpl* NewL( 
+            MPhCltEmergencyCallObserver* aObserver );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CPhCltEmergencyCallImpl();
+
+    public: // Emergency number API
+
+        /**
+        * @See CPhCltEmergencyCall 
+        */
+        virtual TInt IsEmergencyPhoneNumber(
+            const TDesC& aNumber, 
+            TBool& aIsEmergencyNumber );
+
+        /**
+        * @See CPhCltEmergencyCall
+        */
+        virtual TInt FindEmergencyPhoneNumber(
+            TDes& aNumber, 
+            TBool& aIsEmergencyNumber );
+
+        /**
+        * @See CPhCltEmergencyCall
+        */
+        virtual void DialEmergencyCallL( const TDesC& aNumber );
+        
+        /**
+        * @See CPhCltEmergencyCall
+        */
+        virtual TInt IsEmergencyPhoneNumber(
+            const TDesC& aNumber, 
+            TDes& aMatchedEmergencyNumber, 
+            TBool& aIsEmergencyNumber );                    
+
+    private:
+    
+        /**
+        * C++ constructor.
+        */
+        CPhCltEmergencyCallImpl( MPhCltEmergencyCallObserver* aObserver );
+        
+        /**
+        * Symbian OS constructor.
+        */
+        void ConstructL();
+        
+        /**
+        * From CActive, it is called when object is active and 
+        * request has been processed.
+        */
+        void RunL();
+
+        /**
+        * From CActive, calcels pending request.
+        */
+        void DoCancel();
+        
+        /**
+        * Check that active object is not active and subsession
+        * before attempting a dial
+        */
+        void DialEmergencyPreconditionCheckL();
+        
+    private:
+        
+        // RClass instance
+        RPhCltEmergencyCall iEmergencyCall;
+        
+        // wrapper for emergencynumber
+        TPtrC8 iEmergencyCallNumberPtr;
+        
+        //RPhCltServer
+        RPhCltServer iServer;
+        
+       //EmergencyCallNumber
+       TPhCltEmergencyNumber iEmergencyCallNumber;
+    };
+
+#endif // CPHCLTEMERGENCYCALLIMPL_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/emergencynumber/emergencynumber_aiw/rphcltemergencycall.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,233 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Client side access to emergency call
+*
+*/
+
+
+#ifndef RPhCltEmergencyCall_H
+#define RPhCltEmergencyCall_H
+
+//  INCLUDES
+#include <e32std.h>
+#include "phclttypes.h" 
+#include "rphcltserver.h" 
+
+/**
+* Emergency number query mode
+*/
+enum TPhCltEmergencyNumberQueryMode
+    {
+    EPhCltEmergencyNumberQueryModeNormal = 0,  // Normal mode
+    EPhCltEmergencyNumberQueryModeAdvanced,    // advanced mode
+    EPhCltEmergencyNumberQueryModeNormalWriteback   // Same as "normal", but writes back emergency number
+    };
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+*  Client side access to emergency call
+*
+*  @lib phoneclient.lib
+*  @since Series60_1.0
+*/
+class RPhCltEmergencyCall : public RSubSessionBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        RPhCltEmergencyCall();
+
+
+    public:  // New functions
+
+        /**
+        * Opens the subsession.
+        *
+        * @param aServer It is the session of which subsession this is.
+        * @return Returns error code.
+        */
+        TInt Open( RPhCltServer& aServer );
+
+        /**
+         * Closes the subsession.
+         */
+        void Close();
+
+
+    public:
+
+       /**
+        * Returns information whether the number specified was an emergency number.
+        * 
+        * @param aNumber Number to be queried. aNumber might contain prefix (SS code)
+        *                and/or postfix (DTMF part).  
+        *                The aNumber parameter should be a buffer and the 
+        *                clients are provided with a typedef called 
+        *                TPhCltEmergencyNumber, which is equivalent to a 
+        *                TBuf< KPhCltEmergencyNumberSize > where 
+        *                KPhCltEmergencyNumberSize is defined as 100. 
+        *
+        * @param aIsEmergencyNumber If ETrue, then the aNumber 
+        *                           parameter included emergency number.
+        * @return Returns error code of the success of the operation.
+        */
+        TInt IsEmergencyPhoneNumber(
+            const TDesC& aNumber, 
+            TBool& aIsEmergencyNumber );
+
+        /**
+        * Method can be used to check if the number specified contains 
+        * a valid emergency number in the end of the number.
+        * 
+        * @param aNumber Number to be queried, matched emergency number 
+        *                is returned in this parameter.
+        *                The aNumber parameter should be a buffer and the 
+        *                clients are provided with a typedef called 
+        *                TPhCltTelephoneNumberwhich is equivalent to a 
+        *                TBuf< KPhCltTelephoneNumberLength > where 
+        *                KPhCltTelephoneNumberLength is defined as 100. 
+        *             
+        * @param aIsEmergencyNumber If ETrue, then the aNumber parameter 
+        *                           was emergency number. 
+        * @return Returns error code of the success of the operation.
+        */
+        TInt FindEmergencyPhoneNumber(
+            TDes& aNumber, 
+            TBool& aIsEmergencyNumber );
+
+        /**
+        * Initiates an emergency call.
+        *
+        * @param aReqStatus On return, KErrNone if the emergency call successfully reaches 
+        *                   the connected state. If the call set-up fails, the function 
+        *                   member will complete with an error.
+        *
+        * @param aNumber Emergency number to be dialed (optional).
+        *                The aNumber parameter should be a buffer and the 
+        *                clients are provided with a typedef called 
+        *                TPhCltEmergencyNumber,which is equivalent to a 
+        *                TBuf< KPhCltEmergencyNumberSize > where 
+        *                KPhCltEmergencyNumberSize is defined as 100. 
+        *
+        *                If the aNumber parameter supplies an "empty" buffer 
+        *                the call is created either dialing the default emergency 
+        *                phone number or use the SET UP EMERGENCY request  
+        *                that does not contain a dialling number.               
+        *
+        * @pre IsActive() returns EFalse, otherwise leaves with KErrInUse.
+        */
+        void DialEmergencyCall( TRequestStatus& aReqStatus, TDesC8& aNumber );
+        
+        /**
+        * Cancels an emergency call.
+        *
+        */
+        void CancelDialEmergencyCall();
+        
+        /**
+        * Returns information whether the number specified was an emergency 
+        * number and also returns the plain emergency number.
+        * 
+        * @param aNumber Number to be queried.aNumber might contain prefix (SS code)
+        *                and/or postfix (DTMF part).
+        *                The aNumber parameter should be a buffer and the 
+        *                clients are provided with a typedef called 
+        *                TPhCltEmergencyNumberwhich is equivalent to a 
+        *                TBuf< KPhCltEmergencyNumberSize > where 
+        *                KPhCltEmergencyNumberSize is defined as 100. 
+        *
+        * @param aMatchedEmergencyNumber Matched emergencynumber without prefix or 
+        *                postfix is returned in this parameter. The aMatchedEmergencyNumber 
+        *                parameter should be a buffer and the clients are
+        *                provided with atypedef called TPhCltEmergencyNumber,
+        *                which is equivalent to a TBuf< KPhCltEmergencyNumberSize > 
+        *                where KPhCltEmergencyNumberSize is defined as 100.
+        * 
+        * @param aIsEmergencyNumber If ETrue, then the aNumber 
+        *                           parameter included emergency number.
+        *
+        * @return Returns error code of the success of the operation.
+        */
+        TInt IsEmergencyPhoneNumber(
+            const TDesC& aNumber,
+            TDes& aMatchedEmergencyNumber, 
+            TBool& aIsEmergencyNumber );                    
+        
+       private:            
+           
+        /**
+         * Extract telephone number from string. If EFalse is returned
+         * then aString does not contain valid emergency number
+         * 
+         * @param aString string from which those characters are removed.
+         *
+         * @return ETrue - aString can be emergency number and aString
+         *                 contains a telephone number
+         *         EFalse - aString cannot be emergency number and aString
+         *                  does not contain a number that can be emergency number
+         */
+        TBool ExtractTelephoneNumber( TDes& aString );
+        
+        /**
+        * Finds start of dtmf string in string.
+        *
+        * @param   aString      Telephone number
+        *
+        * @return  Index where dtmf string starts or KErrNotFound if no
+        * dtmf found.
+        *
+        */
+        TInt FindStartOfDtmfString( const TDesC& aString );
+        
+        /**
+        * Removes CLIR ss code from beginning of the string if CLIR is
+        * found from string.
+        *
+        * @param    aString Telephone number
+        */
+        void RemoveCLIR( TDes& aString );
+        
+        /**
+         * Removes DTMF string from string.
+         * 
+         * @param aString Telephone number.
+         */
+        void RemoveDTMF( TDes& aString );
+        
+        /**
+        * Executes checks to given phone number to find out if it is a valid 
+        * emergency number. 
+        *
+        * @param    aString             Telephone number
+        * @param    aIsEmergencyNumber  If ETrue, then the aNumber parameter 
+        *                               was a valid emergency number.
+        *
+        * @return Returns error code of the success of the operation.
+        *
+        */
+        TInt ValidateNumber( TDes& aString, TBool& aIsEmergencyNumber, 
+                            const TBool aWriteEmergencyNumBack );
+                            
+                                 
+
+    };
+
+#endif // RPhCltEmergencyCall_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/emergencynumber/rphcltemergencynumber.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,120 @@
+/*
+* 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:  Client side access to emergency number information
+*
+*/
+
+
+
+#ifndef RPHCLTEMERGENCYNUMBER_H
+#define RPHCLTEMERGENCYNUMBER_H
+
+//  INCLUDES
+#include "phclttypes.h" 
+#include "rphcltserver.h" 
+#include <e32std.h>
+
+// FORWARD DECLARATIONS
+
+/**
+* Emergency number query mode
+*/
+enum TPhCltEmergencyNumberQueryMode
+    {
+    EPhCltEmergencyNumberQueryModeNormal = 0,  // Normal mode
+    EPhCltEmergencyNumberQueryModeAdvanced     // advanced mode
+    };
+
+// CLASS DECLARATION
+
+/**
+*  Client side access to emergency number information
+*
+*  @lib phoneclient.lib
+*  @since Series60_1.0
+*/
+class RPhCltEmergencyNumber : public RSubSessionBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        IMPORT_C RPhCltEmergencyNumber();
+      
+
+    public:  // New functions
+
+        /**
+        * Opens the subsession.
+        *
+        * @param aServer It is the session of which subsession this is.
+        * @return Returns error code.
+        */       
+        IMPORT_C TInt Open( RPhCltServer& aServer );
+
+        /**
+         * Closes the subsession.
+         */       
+        IMPORT_C void Close();
+
+
+    public: // Emergency number API
+
+        /**
+        * Returns information whether the number specified would initiate 
+        * an emergency call.
+        * 
+        * @param aNumber Number to be queried.
+        * @param aIsEmergencyNumber If ETrue, then the aNumber parameter 
+        *                           was emergency number. 
+        * @param aMode Emergency number query mode, default: normal. 
+        * @return Returns error code of the success of the operation.
+        */
+        IMPORT_C TInt IsEmergenyPhoneNumber(
+            const TPhCltTelephoneNumber& aNumber, 
+            TBool& aIsEmergencyNumber,
+            TPhCltEmergencyNumberQueryMode aMode = 
+                EPhCltEmergencyNumberQueryModeNormal );
+
+        /**
+        * Returns information whether the number specified would initiate 
+        * an emergency call.
+        * 
+        * @param aNumber Number to be queried, matched emergency number is 
+        *                 returned if a correct emergency number is found at
+        *                 the last of the number.
+        * @param aIsEmergencyNumber If ETrue, then the aNumber parameter 
+        *                           was emergency number. 
+        * @param aMode Emergency number query mode, default: normal. 
+        * @return Returns error code of the success of the operation.
+        */
+        IMPORT_C TInt IsEmergencyPhoneNumber(
+            TPhCltTelephoneNumber& aNumber, 
+            TBool& aIsEmergencyNumber,
+            TPhCltEmergencyNumberQueryMode aMode = 
+                EPhCltEmergencyNumberQueryModeNormal );
+
+
+
+    private: 
+
+        // Internal cleanup support
+        static void CleanupEmergencyList( TAny* aList );
+
+    };
+        
+#endif // RPHCLTEMERGENCYNUMBER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/extcall/extcall_aiw/cphcltextphonedialdata.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,575 @@
+/*
+* 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:  It defines dial data.
+*
+*/
+
+
+#ifndef CPHCLTEXTPHONEDIALDATA_H   
+#define CPHCLTEXTPHONEDIALDATA_H  
+
+
+//  INCLUDES
+#include <e32base.h>
+#include <s32mem.h>
+#include <bldvariant.hrh>
+#include "phclttypes.h" 
+#include <cphcltdialdata.h> // Phone Client Notify API
+
+
+// Other constants used in TPhCltExtPhoneDialData ( default values )
+const TBool KPhCltDefaultAllowMatch = ETrue;   // Match is allowed
+const TBool KPhCltDefaultNumberEntry = EFalse; // No return to number entry.
+const TInt KPhCltDefaultNumberType = -1;       // No number type.
+
+
+// CONSTANTS
+//None.
+
+
+// FORWARD DECLARATIONS
+//None
+
+// CLASS DECLARATION
+/**
+* It defines the structure containing dial information.
+*
+* Fields:
+*
+*  window group    - When call is ended, set window group is actived.
+*
+*  show number     - Permission to show number. ETrue if it is allowed.
+*
+*  redial          - Automatic redial override.
+*
+*  name            - Name corresponding to number. Name must be defined
+*                    if shown number equals to EFalse.
+*  contact link      - Contact link. you should put always when you are dialing
+*                    from phonebook contact.
+*  tel number      - String that is to be dialled.
+*                    number fields are supported.
+*  allow match     - Permission to allow match. ETrue if match is to be done.
+*                    If you are dialing from sim pd or fdn, then this should
+*                    be EFalse.
+*  number entry    - Returns whether to return to the number entry on failure 
+*
+*  end other calls - Information if the existing calls are ended before
+*                    this new one is made.
+*                    Not mandatory. Set only if you know that the call is an 
+*                    emergency call.
+*  subaddress      - The calling party subaddress. Supports SAT features.
+*                    Defined in ITU-T I.330 and 3GPP TS 11.14.
+*  SATCall         - Set whether this is SAT originated call or not. 
+*                    Supports SAT features.
+*  bearer          - Bearer capabilities. Supports SAT features.
+*
+*  CallType        - The type of the call, i.e. voice (default) or video.
+*
+*  SendKey         - Call made with SendKey, optional.
+*
+*  Redial maximum duration - Automatic redial maximum duration
+*
+*  Initiate call   - true if iniate call false otherwise 
+*
+*  UUI             - User to user information sent on call setup phase.
+*
+*  @lib phoneclient.lib
+*  @since 3.2
+*/
+/**
+*  Dial data set for PhoneClient.
+*
+*  @lib ServiceHandler.lib
+*  @since Series 60 3.2
+*/
+NONSHARABLE_CLASS( CPhCltExtPhoneDialData ): public CPhCltDialData
+    {
+   
+   public:
+      /* 
+        *   TBools combined to one uint.
+        *
+        *   EPhCltCallFlagsDefault
+        *               Default flags, if nothing is not specified.
+        *   EPhCltCallFlagsAllowNumberShowing
+        *               Number showing is allowed.
+        *   EPhCltCallFlagsReturnToNumberEntryOnFailure
+        *               Return to Number Entry if there is an error.
+        *   EPhCltCallFlagsAllowPersonalDirectoryMatching
+        *               The number is matched to Personal Directory.
+        *   EPhCltCallFlagsEndBeforeDial
+        *               Other calls are ended before the new one is done.
+        *   EPhCltCallFlagsSAT
+        *               If set means that SAT has originated the call.
+        *   EPhCltCallFlagsVideoCall
+        *               If set means that this is video call.
+        *               Otherwise means normal, i.e. voice call.
+        *   EPhCltCallFlagsVoIPCall
+        *               If set means that this is VoIP call.
+        *               Otherwise means normal, i.e. voice call.
+        *   EPhCltCallFlagsSendKey
+        *               If set means that call made with SendKey.
+        */
+        enum TPhCltCallFlags
+            {
+            EPhCltCallFlagsDefault                           = 0x0000,
+            EPhCltCallFlagsAllowNumberShowing                = 0x0001,
+            EPhCltCallFlagsReturnToNumberEntryOnFailure      = 0x0002,
+            EPhCltCallFlagsAllowPersonalDirectoryMatching    = 0x0004,
+            EPhCltCallFlagsEndBeforeDial                     = 0x0008,
+            EPhCltCallFlagsSAT                               = 0x0020,
+            EPhCltCallFlagsVideoCall                         = 0x0040,
+            EPhCltCallFlagsVoIPCall                          = 0x0080,
+            EPhCltCallFlagsSendKey                           = 0x0100
+            };
+      
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CPhCltExtPhoneDialData* NewL();
+        
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CPhCltExtPhoneDialData* NewLC();
+        
+        
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CPhCltExtPhoneDialData* NewL( const TDesC8& aPackage );
+        
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CPhCltExtPhoneDialData* NewLC( const TDesC8& aPackage );
+        
+        /**
+        * Destructor.
+        */
+        IMPORT_C virtual ~CPhCltExtPhoneDialData();
+
+    public: // New functions
+    
+        /**
+        * Fills the parameter list.
+        * @since Series 60 3.2
+        * @param aInParamList In parameter used with CAiwService.
+        */  
+        IMPORT_C HBufC8* PackLC();
+        
+        
+        // Calculates dialdata package size
+        IMPORT_C TInt CalculatePackageSize() const;
+        
+        // Sets dial data parameters to CPhCltExtPhoneDialData object
+        void SetParamsL( const TDesC8& aPackage ); 
+               
+        
+   public: // Access - Getters
+         
+
+        /**
+        * Defines if mathing is allowed.
+        * @since Series 60 3.2
+        * @return Returns the allow match setting information.
+        */
+        IMPORT_C  TBool AllowMatch() const;
+        
+        /**
+        * Bearer capability.
+        * @since Series 60 3.2
+        * @return Returns bearer capability.
+        */
+        IMPORT_C const TPhCltBearerCapability& Bearer() const;
+        
+        /**
+        * Gives the current call type.
+        * @since Series 60 3.2
+        * @return Current call type.
+        */
+        IMPORT_C  TPhCltCallType CallType() const ;   
+         
+        /**
+        * Contact link field.
+        * @since Series 60 3.2
+        * @return Returns contack link item.
+        */
+        IMPORT_C const TDesC8& ContactLink() const;
+        
+        
+        /**
+        * End other calls param.
+        * @since Series 60 3.2
+        * @return Returns ETrue if other calls will be terminated.
+        *                 EFalse if calls are not terminated.
+        */
+        IMPORT_C TBool EndOtherCalls() const;
+        
+        /**
+        * Intiate Call
+        * @since Series 60 3.2
+        * @return Returns ETrue if call is itiate call EFalse otherwise
+        */
+        IMPORT_C  TBool InitiateCall() const;
+        
+        /**
+        * Name.
+        * @since Series 60 3.2
+        * @return Returns name.
+        */
+        IMPORT_C  const TPhCltNameBuffer& Name() const;
+        
+        
+        /**
+        * Redial information.
+        * @since Series 60 3.2
+        * @return Return the redial status,
+        */
+        IMPORT_C  TInt Redial() const;  
+        
+        /**
+        * Redial maximum duration
+        * @since Series 60 3.2
+        * @return Returns redial max duration.
+        */
+        IMPORT_C const TTimeIntervalSeconds RedialMaximumDuration() const;      
+                   
+        
+        /** 
+        * Return in failure.
+        * @since Series 60 3.2
+        * @return Returns whether to return to the number entry.
+        */
+        //IMPORT_C TBool ReturnToNumberEntryOnFailure() const;
+        
+        /**
+        * SAT Call.
+        * @since Series 60 3.2
+        * @return Returns ETrue if SAT call EFalse if not.
+        */
+        IMPORT_C  TBool SATCall() const;
+        
+        /** 
+        * SendKey pressed.
+        * @since Series 60 3.2
+        * @return Return ETrue if SendKey used.
+        */
+        IMPORT_C TBool SendKeyPressed() const;
+        
+        /**
+        * Show Number.
+        * @since Series 60 3.2
+        * @return Returns the number visibility.
+        */
+        IMPORT_C TBool ShowNumber() const;
+        
+        /**
+        * Sub address.
+        * @since Series 60 3.2
+        * @return Returns SAT call sub address.
+        */
+        IMPORT_C  const TPhCltSubAddress& SubAddress() const;
+        
+        /**
+        * Gives the current phone number.
+        * @since Series 60 3.2
+        * @return Telephone number.
+        */
+        IMPORT_C  const TPhCltTelephoneNumber& TelephoneNumber() const;
+        
+        /**
+        * Gives the current window group id.
+        * @since Series 60 3.2
+        * @return Window group id. 
+        */     
+        IMPORT_C  TInt WindowGroup() const; 
+        
+        /**
+         * Gives the user to user information.
+         * @since S60 v3.2
+         * @return User to user information.
+         */
+        IMPORT_C const TDesC& UUI() const;
+        
+    public: // Access - Setters
+    
+        /**
+        * Set whether the name entered in SetName should be matched
+        * against the personal directory.
+        * @since Series 60 3.2
+        * This should be set EFalse only if phone number has not been
+        * taken from phonebook.
+        *
+        * @param aAllowMatch Whether to allow matches.
+        */
+        IMPORT_C  void SetAllowMatch( TBool aAllowMatch );
+    
+        /**
+        * Set the bearer capability.
+        * @since Series 60 3.2
+        * @param aBearer The bearer capabilities as defined in GSM 04.08.
+        * @leaves KErrArgument if aBearer's length is longer than KAiwBearerLength
+        */
+        IMPORT_C void SetBearerL( const TPhCltBearerCapability& aBearer );
+        
+        /**
+        * Sets call type.
+        * @since Series 60 3.2
+        * @param aCallType calls' type.
+        */
+        IMPORT_C void SetCallType( TPhCltCallType aCallType );
+        
+        /**
+        * Set contact link.
+        * @since Series 60 3.2
+        * @param aContactLink Contact link information.
+        */
+       IMPORT_C void SetContactLinkL( const TDesC8& aContactLink );
+        
+        
+        /**
+        * Set parameter for end other calls. 
+        * @since Series 60 3.2
+        * If this is set to ETrue, other calls will be terminated before
+        * dial. Default is EFalse.
+        * @param aEndCalls Are the other calls ended.
+        */
+        IMPORT_C void SetEndOtherCalls( TBool aEndCalls  );
+        
+        /**
+        * Set Initiate call Etrue or EFalse
+        *@since Series 60 3.2
+        * @param aInitCall ETrue if call is intiate call
+        */
+        IMPORT_C void SetInitiateCall( TBool aInitCall );
+        
+        
+        /**
+        * Set the name of the person who is to be called.
+        * @since Series 60 3.2
+        * @param aName The name of the person being called.
+        * @leaves KErrArgument if aName length is over 50 characters.
+        */
+        IMPORT_C void SetNameL( const TPhCltNameBuffer& aName );
+        
+        
+        /**
+        * Change the redial mode.
+        * @since Series 60 3.2
+        * @param aRedial The new redial status
+        */
+  
+        IMPORT_C void SetRedial( TInt aRedial );
+        
+        /**
+        * Set redial max duration.
+        * @since Series 60 3.2
+        * @param aDuration redial max duration.
+        */
+        IMPORT_C void SetRedialMaximumDuration( TTimeIntervalSeconds aMaximumRedialDuration );       
+        
+        
+        /**
+        * Set whether to return to number entry.
+        *
+        * @param aReturn Whether to return to the number entry editor.
+        */
+        IMPORT_C void SetReturnToNumberEntryOnFailure( TBool aReturn );
+                
+        /**
+        * Set wheteher this is a SAT originated call or not.
+        * If this function is not called, the originator is assumed to 
+        * be other than SAT.
+        * @since Series 60 3.2
+        * @param aSATCall ETrue if SAT originated the call, EFalse otherwise.
+        */
+        IMPORT_C void SetSATCall( TBool aSATCall );
+        
+        
+        /**
+        * Set the value of SendKey.
+        *  @since Series 60 3.2
+        * @param aSendKey The value of SendKey.
+        */
+        IMPORT_C void SetSendKeyPressed( TBool aSendKey );
+        
+        /**
+        * Set the number visibility in the phone app.
+        * @since Series 60 3.2
+        * If this is set to EFalse, then number is not shown or written to 
+        * log event.
+        * @param aShowNumber Whether or not to show the number.
+        */
+        IMPORT_C void SetShowNumber( TBool aShowNumber );
+        
+        /**
+        * Set the calling party subaddress.
+        * Defined in ITU-T I.330 and 3GPP TS 11.14.
+        * @since Series 60 3.2
+        * @param aSubAddress The calling party subaddress.
+        * @leaves KErrArgument if aSubAddress length is longer than 
+        * KAiwSubAddressLength
+        */
+        IMPORT_C void SetSubAddressL( const TPhCltSubAddress& aSubAddress );
+        
+        /**
+        * Sets the phone number.
+        * @since Series 60 3.2
+        * @param aNumber Phone number, which maximum length is
+        * KMaximumPhoneNumberLength.
+        * @leaves KErrArgument if aPhoneNumber length is over KMaximumPhoneNumberLength
+        */
+        IMPORT_C void SetTelephoneNumber( const TPhCltTelephoneNumber& aNumber );
+        
+        /**
+        * Sets the window group identifier. When call is ended, set window group is actived.
+        * @since Series 60 3.2
+        * @param aWindowGroup Window group id.
+        */
+        IMPORT_C void SetWindowGroup( TInt aWindowGroup );
+     
+        /**
+        * Set the value of xSP Service Id. 
+        *
+        * @param aServiceId The value of Service Id.
+        */
+        IMPORT_C void SetServiceId( TUint32 aServiceId );
+        
+
+        /** 
+        * Service Id. VoIP2.2 implementation
+        * @return Return service id or zero.
+        */
+        IMPORT_C TUint32 ServiceId() const; 
+
+        
+        /**
+         * Sets user to user information. Maximum length is 
+         * KPhCltUUILength.
+         * @param aUUI User to user information.
+         * @since S60 v3.2
+         */
+        IMPORT_C void SetUUIL( const TDesC& aUUI );
+        
+      
+        
+                
+                      
+    // Constructors
+    
+     private: 
+     
+        /**
+        * C++ default constructor.
+        * @since Series 60 3.2
+        */
+        CPhCltExtPhoneDialData(); 
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        * @since Series 60 3.2
+        */
+        void ConstructL();
+        
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        * @since Series 60 3.2
+        * @param aPackage including dial data
+        */
+        void ConstructL( const TDesC8& aPackage ); 
+        
+     
+     //Private functions
+     
+     private:
+        /**
+        * Calculates variable descriptor size
+        * @since Series 60 3.2
+        * @param aDescriptor which size is calculated
+        */
+        TInt CalculateDescriptorSize( const TDesC& aDescriptor ) const;
+        
+        /**
+        * Calculates variable descriptor size
+        * @since Series 60 3.2
+        * @param aDescriptor which size is calculated
+        */
+        TInt CalculateDescriptorSize( const TDesC8& aDescriptor ) const;
+        
+        /**
+        * Read descriptor value from stream
+        * @since Series 60 3.2
+        * @param aStream used stream
+        * @param aDescriptor which is read from stream
+        */
+        void ReadDescriptorFromStreamL( RDesReadStream& aStream, HBufC8*& aDescriptor );
+        
+        /**
+        * Read descriptor value from stream
+        * @since Series 60 3.2
+        * @param aStream used stream
+        * @param aDescriptor which is read from stream
+        */
+        void ReadDescriptorFromStreamL( RDesReadStream& aStream, HBufC*& aDescriptor );
+        
+        /**
+        * Write descriptor value to stream
+        * @since Series 60 3.2
+        * @param aStream used stream
+        * @param aDescriptor which value is write to stream
+        */
+        void WriteDescriptorToStreamL( RDesWriteStream& aStream, const TDesC8& aDescriptor );
+        
+        /**
+        * Write descriptor value to stream
+        * @since Series 60 3.2
+        * @param aStream used stream
+        * @param aDescriptor which value is write to stream
+        */
+        void WriteDescriptorToStreamL( RDesWriteStream& aStream, const TDesC& aDescriptor );
+        
+     
+        /**
+        * Copy descriptor value to member descriptor
+        * @since Series 60 3.2
+        * @param aSource which is as copy source
+        * @param aMemberDescriptor is as copy destination
+        */
+        void CopyDescriptorToMemberDescriptorL( const TDesC& aSource, HBufC*& aMemberDescriptor );
+        
+        /**
+        * Copy descriptor value to member descriptor
+        * @since Series 60 3.2
+        * @param aSource which is as copy source
+        * @param aMemberDescriptor is as copy destination
+        */
+        void CopyDescriptorToMemberDescriptorL( const TDesC8& aSource, HBufC8*& aMemberDescriptor );        
+     
+        
+        /**
+        * Check descriptor max length
+        * Leaves with KErrArgument if aDescriptorLength is greated that aMaxAllowedDescriptorLenght
+        * @since Series 60 3.2
+        * @param aDescriptorLength is descriptor length
+        * @param  aMaxAllowedDescriptorLength maximum allowed descriptor length
+        */
+        void CheckDescriptorMaxLengthL( TInt aDescriptorLength, TInt aMaxAllowedDescriptorLength ) const;
+        
+
+    };
+
+#endif      // CPHCLTEXTPHONEDIALDATA_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/extcall/extcall_aiw/rphcltcallnotify.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,143 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  RCallNotify observer getting notifications about call requests
+*                from Phone Server.
+*
+*/
+
+#ifndef RPHCLTCALLNOTIFY_H
+#define RPHCLTCALLNOTIFY_H
+
+//  INCLUDES
+#include <e32base.h>
+
+
+//  FORWARD DECLARATIONS
+class RPhCltServer;
+class CPhCltExtPhoneDialData;
+
+// CLASS DECLARATION
+
+/**
+*  RCallNotify observer getting notifications about call requests
+*  from Phone Server.
+*
+*  @lib phoneclient.lib
+*  @since 1.0
+*/
+class RPhCltCallNotify : public RSubSessionBase
+    {
+    public: // Constructors and destructors.
+
+        /**
+         * Constructor.
+         */
+        RPhCltCallNotify();
+
+
+    public: // New functions
+
+        /**
+        * Open subsession to server.
+        * 
+        * @param aServer Pre-opened server session.
+        * @return Symbian OS error code of the success of the opening.
+        */
+        TInt Open( RPhCltServer& aServer );
+
+        /**
+        * Close subsession.
+        */
+        void Close();
+    
+        /**
+        * Notifies when a call request arrives.
+        *
+        * @param aStatus Status to be changed when call request have arrived.
+        * @param aDatalength  Dial data length.
+        */
+        void NotifyCallAttempt( 
+            TRequestStatus& aStatus, 
+           TPckg< TInt >& aDataLength );
+        /**
+        * Cancel pending call attempt notification.
+        */
+        void CancelNotifyCallAttempt() const;
+        
+        /**
+        * Respond to client request to make a call
+        *
+        * @param aResultCode Result of the response.
+        */
+        TInt RespondClient( const TInt aResultCode );
+        
+        void GetDialData( TDes8& aData );
+        
+        /**
+        * Notifies when a emergency call request arrives.
+        *
+        * @param aStatus Status to be changed when call request have arrived.
+        * @param aEmergencyNumber 
+        *
+        */
+        void NotifyEmergencyCall( 
+            TRequestStatus& aStatus,
+            TDes8& aEmergencyNumber
+             );
+        /**
+        * Cancel pending call attempt notification.
+        */
+        void CancelNotifyEmergencyCall() const;
+        
+        /**
+        * Respond to client request to make a emergency call
+        *
+        * @param aResultCode Result of the response.
+        * @return Symbian OS error code of the success of the opening.
+        */
+        TInt RespondEmergencyToClient( const TInt aResultCode ); 
+        
+        /**
+        * Notifies when a Command handler request arrives.
+        *
+        * @param aStatus Status to be changed when command handler request
+        *                has arrived.
+        * @param aCommandArgs Command argument storage place. 
+        *                     That is, packaged version of class 
+        *                     TPhCltComHandCommandParameters.
+        */
+        void NotifyComHandCommand( 
+            TRequestStatus& aStatus, 
+            TDes8& aCommandArgs );
+
+        /**
+        * Cancel pending command handler request notification.
+        */
+        void CancelNotifyComHandCommand() const;
+        
+        /**
+        * Respond to client's command handler request.
+        *
+        * @param aResultCode Result of the response 
+        *        (previous function execution).
+        * @return KErrNone if respond succeeded, otherwise Symbian error code.
+        */
+        TInt RespondComHandClient( const TInt aResultCode );
+ 
+    };
+
+
+#endif    // RPHCLTCALLNOTIFY_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/extcall/extcall_aiw/rphcltextcall.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,98 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  It is the client side remote class of call subsession object.
+*
+*/
+
+
+#ifndef RPHCLTEXTCALL_H
+#define RPHCLTEXTCALL_H
+
+//  INCLUDES
+#include <e32std.h>
+#include "phclttypes.h" 
+#include "rphcltserver.h" 
+
+// FORWARD DECLARATIONS
+class CPhCltExtPhoneDialData;
+
+// CLASS DECLARATION
+
+/**
+*  It is the client side remote class of call subsession object.
+*
+*  @lib phoneclient.lib
+*  @since 1.0
+*/
+class RPhCltExtCall : public RSubSessionBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+         * C++ default constructor.
+         */
+        RPhCltExtCall();
+   
+        
+    public:  // New functions
+
+        /**
+         * Opens the subsession.
+         *
+         * @param aServer It is the session of which subsession this is.
+         * @return Returns error code.
+         */       
+        TInt Open( RPhCltServer& aServer );
+
+        /**
+         * Closes the subsession.
+         */       
+        void Close();
+                
+        /**
+        * Makes a call (asynchronous).
+        *
+        * @param aStatus It is used to notify the completion of the request. 
+        *                Then it indicates the success/failure of the operation.
+        * @param aData The object containing the dial parameters
+        * @param aLength dial data package length
+        */       
+        void Dial( 
+            TRequestStatus& aStatus, 
+            TDesC8& aData, TInt aLength );
+
+        /**
+        * Cancels the dialling request.
+        */       
+        void CancelDial() const;
+
+    private:
+                
+        // By default, prohibit copy constructor
+        RPhCltExtCall( const RPhCltExtCall& );
+        // Prohibit assigment operator
+        RPhCltExtCall& operator= ( const RPhCltExtCall& );
+        
+    
+
+       
+   
+    private: // Data
+
+        
+
+    };
+#endif      // RPHCLTEXTCALL_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/extcall/rphcltextcall.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,117 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  It is the client side remote class of call subsession object.
+*
+*/
+
+
+#ifndef RPHCLTEXTCALL_H
+#define RPHCLTEXTCALL_H
+
+//  INCLUDES
+#include <e32std.h>
+#include "phclttypes.h" 
+#include "rphcltserver.h" 
+
+// FORWARD DECLARATIONS
+class TPhCltExtPhoneDialData;
+
+// CLASS DECLARATION
+
+/**
+*  It is the client side remote class of call subsession object.
+*
+*  @lib phoneclient.lib
+*  @since 1.0
+*/
+class RPhCltExtCall : public RSubSessionBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+         * C++ default constructor.
+         */
+        RPhCltExtCall();
+   
+        
+    public:  // New functions
+
+        /**
+         * Opens the subsession.
+         *
+         * @param aServer It is the session of which subsession this is.
+         * @return Returns error code.
+         */       
+        TInt Open( RPhCltServer& aServer );
+
+        /**
+         * Closes the subsession.
+         */       
+        void Close();
+
+        /**
+        * Makes a call (asynchronous).
+        *
+        * @param aStatus It is used to notify the completion of the request. 
+        *                Then it indicates the success/failure of the 
+        *                operation.
+        * @param aNumber It is the number to be dialled.
+        * @param aName The name to show in UI.
+        * @param aWindowGroupId It is the id of the window group to be brought
+        *                       foreground after the call has been ended.
+        * @param aRedial Redial settings
+        * @param aContactId Contact Id to be asked from the phonebook.
+        * @param aAllowNumberShowing Is it allowed to show the number?
+        */       
+        void Dial( 
+            TRequestStatus& aStatus, 
+            const TPhCltTelephoneNumber& aNumber,
+            const TPhCltNameBuffer& aName,
+            const TInt aWindowGroupId,
+            const TInt aRedial,
+            const TPhCltContactId aContactId,
+            const TBool aAllowNumberShowing );
+
+        /**
+        * Makes a call (asynchronous).
+        *
+        * @param aStatus It is used to notify the completion of the request. 
+        *                Then it indicates the success/failure of the operation.
+        * @param aData The object containing the dial parameters
+        */       
+        void Dial( 
+            TRequestStatus& aStatus, 
+            const TPhCltExtPhoneDialData& aData);
+
+        /**
+        * Cancels the dialling request.
+        */       
+        void CancelDial() const;
+
+    private:
+                
+        // By default, prohibit copy constructor
+        RPhCltExtCall( const RPhCltExtCall& );
+        // Prohibit assigment operator
+        RPhCltExtCall& operator= ( const RPhCltExtCall& );
+
+    private: // Data
+
+        // Call arguments.
+        TPckgBuf< TPhCltCallArgs > iArgs;
+    };
+        
+#endif      // RPHCLTEXTCALL_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/extcall/tphcltextphonedialdata.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,475 @@
+/*
+* 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:  It defines dial data.
+*
+*/
+
+
+#ifndef TPHCLTEXTPHONEDIALDATA_H   
+#define TPHCLTEXTPHONEDIALDATA_H  
+
+
+//  INCLUDES
+#include "phclttypes.h" 
+
+// Constant used as window group id to indicate that we wish to go to idle.
+const TInt KPhCltGoToIdle = 0;
+
+// Constants used in Redial parameter
+const TInt KPhCltRedialDefault = -1;          // Default redial.
+const TInt KPhCltRedialOff = -2;              // Redial is off.
+const TInt KPhCltRedialWithDefaultTime = -3;  // Redial on, with default time.
+const TInt KPhCltRedial = 0;    // Forced redial.
+
+// Other constants used in TPhCltExtPhoneDialData ( default values )
+const TBool KPhCltDefaultAllowMatch = ETrue;   // Match is allowed
+const TBool KPhCltDefaultNumberEntry = EFalse; // No return to number entry.
+const TInt KPhCltDefaultNumberType = -1;       // No number type.
+
+// CLASS DECLARATION
+
+/**
+* It defines the structure containing dial information.
+*
+* Fields:
+*
+*  window group    - When call is ended, set window group is actived.
+*  show number     - Permission to show number. ETrue iff it is allowed.
+*  redial          - Automatic redial override.
+*  name            - Name corresponding to number. Name must be defined
+*                    if shown number equals to EFalse.
+*  contact id      - Contact id. you should put always when you are dialing
+*                    from phonebook contact.
+*  tel number      - String that is to be dialled.
+*  number type     - Number type override. See PbkFields.hrh. Only phone
+*                    number fields are supported.
+*  allow match     - Permission to allow match. ETrue iff match is to be done.
+*                    If you are dialing from sim pd or fdn, then this should
+*                    be EFalse.
+*  number entry    - not used. 
+*  end other calls - Information if the existing calls are ended before
+*                    this new one is made.
+*  emergency       - Information whether this is an emergency call or not.
+*                    Not mandatory. Set only if you know that the call is an 
+*                    emergency call.
+*  subaddress      - The calling party subaddress. Supports SAT features.
+*                    Defined in ITU-T I.330 and 3GPP TS 11.14.
+*  SATCall         - Set whether this is SAT originated call or not. 
+*                    Supports SAT features.
+*  bearer          - Bearer capabilities. Supports SAT features.
+*
+*  CallType        - The type of the call, i.e. voice (default) or video.
+*
+*  SendKey         - Call made with SendKey, optional.
+*
+*  Redial maximum duration - Automatic redial maximum duration
+*
+*  @lib phoneclient.lib
+*  @since 1.0
+*/
+class TPhCltExtPhoneDialData
+    {          
+    public:
+
+        /**
+        * Construct a dial data package
+        */
+        IMPORT_C TPhCltExtPhoneDialData();
+
+        /**
+        * Construct a dial data package
+        *
+        * @param aNumber Number to be used in this package.
+        * @param aContactId Contact ID to be used in this package.
+        */
+        IMPORT_C TPhCltExtPhoneDialData( 
+            const TPhCltTelephoneNumber& aNumber,
+            TPhCltContactId aContactId );
+
+        /**
+        * Construct a dial data package
+        *
+        * @param aNumber Number to be used in the package.
+        * @param aWindowGroupId Windoww Group ID to be used in this package.
+        */
+        IMPORT_C TPhCltExtPhoneDialData( 
+            const TPhCltTelephoneNumber& aNumber,
+            TInt aWindowGroupId );
+
+        /**
+        * Construct a dial data package
+        *
+        * @param aNumber Number to be used in the package.
+        * @param aContactId Contact ID to be used in this package.
+        * @param aWindowGroupId Windoww Group ID to be used in this package.
+        */
+        IMPORT_C TPhCltExtPhoneDialData( 
+            const TPhCltTelephoneNumber& aNumber,
+            TPhCltContactId aContactId, 
+            TInt aWindowGroupId );
+
+        /**
+        * Construct a dial data package
+        *
+        * @param aName Name to be used in the package.
+        * @param aNumber Number to be used in the package.
+        * @param aContactId Contact ID to be used in this package.
+        * @param aWindowGroupId Windoww Group ID to be used in this package.
+        */
+        IMPORT_C TPhCltExtPhoneDialData( 
+            const TPhCltNameBuffer& aName,
+            const TPhCltTelephoneNumber& aNumber, 
+            TPhCltContactId aContactId, 
+            TInt aWindowGroupId );
+
+
+    public: // Access - Setters
+
+        /**
+        * Set the window group of requesting application.
+        *
+        * @param aWindowGroupId The window group identifier.
+        */
+        IMPORT_C void SetWindowGroup( TInt aWindowGroupId );
+
+        /**
+        * Set the number visibility in the phone app.
+        *
+        * If this is set to EFalse, then number is not shown or written to 
+        * log event.
+        *
+        * @param aShowNumber Whether or not to show the number.
+        */
+        IMPORT_C void SetShowNumber( TBool aShowNumber );
+
+        /**
+        * Change the redial mode.
+        *
+        * @param aRedial The new redial status
+        */
+        IMPORT_C void SetRedial( TInt aRedial );
+        
+        /**
+        * Set the value of RedialMaximumDuration. 
+        *
+        * @param aMaxDuration The value of duration in seconds.
+        */
+        IMPORT_C void SetRedialMaximumDuration( TTimeIntervalSeconds aMaximumRedialDuration );
+
+        /**
+        * Set the name of the person who is to be called.
+        *
+        * @param aName The name of the person being called.
+        */
+        IMPORT_C void SetName( const TPhCltNameBuffer& aName );
+
+        /**
+        * Set the contact Id of the person being called.
+        *
+        * @param aContactId The contacts model contact id of the person being
+        *                   called.
+        */
+        IMPORT_C void SetContactId( TPhCltContactId aContactId );
+
+        /**
+        * Set the number of the person to be called.
+        * This is mandatory.
+        *
+        * @param aNumber The number of the person being called.
+        */
+        IMPORT_C void SetTelephoneNumber( 
+            const TPhCltTelephoneNumber& aNumber );
+
+        /**
+        * Set whether to return to number entry.
+        *
+        * @param aReturn Whether to return to the number entry editor.
+        */
+        IMPORT_C void SetReturnToNumberEntryOnFailure( TBool aReturn );
+
+        /**
+        * Set whether the name entered in SetName should be matched
+        * against the personal directory (=phonebook).
+        *
+        * This should be set EFalse only if phone number has not been
+        * taken from phonebook.
+        *
+        * @param aAllowMatch Whether to allow matches.
+        */
+        IMPORT_C void SetAllowMatch( TBool aAllowMatch );
+
+        /**
+        * Set the number type. 
+        * 
+        * See PbkFields.hrh. Only phone number fields are supported.
+        *
+        * @param aNumberType The number type.
+        */
+        IMPORT_C void SetNumberType( TInt aNumberType );
+
+        /**
+        * Set parameter for end other calls. 
+        * 
+        * If this is set to ETrue, other calls will be terminated before
+        * dial. Default is EFalse.
+        *
+        * @param aEndCalls Are the other calls ended.
+        */
+        IMPORT_C void SetEndOtherCalls( TBool aEndCalls );
+
+        /**
+        * Set whether this is known to be an emergency call or not.
+        * If this function is not called, it is assumed that the call
+        * is not an emergency call. However, in Phone application side it is 
+        * checked whether the call actually is an emergency call or not before 
+        * dialing.
+        *
+        * @param aEmergency 
+        *        ETrue if the call is known to be an emergency call.
+        *        EFalse if the call is not known to be an emergency call
+        *        (default).
+        */
+        IMPORT_C void SetEmergency( TBool aEmergency );
+
+        /**
+        * Set the calling party subaddress.
+        * Defined in ITU-T I.330 and 3GPP TS 11.14.
+        *
+        * @param aSubAddress The calling party subaddress.
+        */
+        IMPORT_C void SetSubAddress( const TPhCltSubAddress& aSubAddress );
+
+        /**
+        * Set wheteher this is a SAT originated call or not.
+        * If this function is not called, the originator is assumed to 
+        * be other than SAT.
+        *
+        * @param aSATCall ETrue if SAT originated the call, EFalse otherwise.
+        */
+        IMPORT_C void SetSATCall( TBool aSATCall );
+
+        /**
+        * Set the bearer capability.
+        *
+        * @param aBearer The bearer capabilities as defined in GSM 04.08.
+        */
+        IMPORT_C void SetBearer( const TPhCltBearerCapability& aBearer );
+
+        /**
+        * Set the call type. 
+        *
+        * @param aCallType The call type.
+        */
+        IMPORT_C void SetCallType( TPhCltCallType aCallType );
+        
+        /**
+        * Set the value of SendKey. 
+        *
+        * @param aSendKey The value of SendKey.
+        */
+        IMPORT_C void SetSendKeyPressed( TBool aSendKey );
+
+
+    public: // Access - Getters
+
+        /**
+        * Return the window group id. 
+        *
+        * @return Returns KPhCltGoToIdle if no id has previously been specified.
+        */
+        IMPORT_C TInt WindowGroupId() const;
+
+        /** 
+        * Redial information.
+        * 
+        * @return Return the redial status,
+        */
+        IMPORT_C TInt Redial() const;
+        
+        /**
+        * Automatic redial maximum duration . 
+        *
+        * @return  value of duration in seconds.
+        */
+        IMPORT_C TTimeIntervalSeconds RedialMaximumDuration( ) const;
+
+        /** 
+        * Number type.
+        *
+        * @return Return the number type.
+        */
+        IMPORT_C TInt NumberType() const;
+
+        /** 
+        * Return in failure.
+        * 
+        * @return Returns whether to return to the number entry.
+        */
+        IMPORT_C TBool ReturnToNumberEntryOnFailure() const;
+
+        /** 
+        * Is match allowed.
+        * 
+        * @return Returns the allow match setting.
+        */
+        IMPORT_C TBool AllowMatch() const;
+
+        /** 
+        * Number showing.
+        * 
+        * @return Returns the number visibility.
+        */
+        IMPORT_C TBool ShowNumber() const;
+
+        /** 
+        * Name
+        * 
+        * @return Return the name of the recipient.
+        */
+        IMPORT_C const TPhCltNameBuffer& Name() const;
+
+        /** 
+        * Contact ID
+        * 
+        * @return Returns the contact id or KPhCltNoContact if none specified.
+        */
+        IMPORT_C TPhCltContactId ContactId() const;
+
+        /** 
+        * Telephone number
+        * 
+        * @return Returns the telephone number.
+        */
+        IMPORT_C const TPhCltTelephoneNumber& TelephoneNumber() const;
+
+        /** 
+        * End other calls
+        * 
+        * @return Returns ETrue if other calls should be ended before dial.
+        */
+        IMPORT_C TBool EndOtherCalls() const;
+
+        /** 
+        * Emergency status (is emergency call or not).
+        * 
+        * @return Returns ETrue if the call is emergency call.
+        *                 EFalse if the call is not emergency call.
+        */
+        IMPORT_C TBool Emergency() const;
+
+        /** 
+        * Calling party subaddress.
+        * 
+        * @return Returns the calling party subaddress.
+        */
+        IMPORT_C const TPhCltSubAddress& SubAddress() const;
+
+        /** 
+        * SAT call information.
+        * 
+        * @return Returns ETrue if SAT is the originator of the call.
+        *                 EFalse otherwise.
+        */
+        IMPORT_C TBool SATCall( ) const;
+
+        /** 
+        * Bearer capability.
+        * 
+        * @return Returns the bearer capabilities as defined in GSM 04.08.
+        */
+        IMPORT_C const TPhCltBearerCapability& Bearer( ) const;
+
+        /** 
+        * Call type.
+        *
+        * @return Return the call type.
+        */
+        IMPORT_C TPhCltCallType CallType() const;
+        
+        /** 
+        * SendKey pressed.
+        *
+        * @return Return ETrue if SendKey used.
+        */
+        IMPORT_C TBool SendKeyPressed() const;
+
+
+    public:
+        
+        /** 
+        * Returns the call argumets through the parameter.
+        * 
+        * @param aReturn The call arguments are stored here.
+        */
+        IMPORT_C void AsIPCStruct( TPhCltCallArgs& aReturn ) const;
+
+
+    private: // Member data
+        
+        // The window group identifier storage.
+        TInt                      iWindowGroup;
+
+        // The new redial status storage.
+        TInt                      iRedial;
+        
+        //Automatic redial maximum duration
+        TTimeIntervalSeconds      iRedialMaximumDuration;
+
+        // The number type information storage.
+        TInt                      iNumberType;
+
+        // The number visibility information storage.
+        TBool                     iShowNumber;
+
+        // Return to the number entry editor information storage.
+        TBool                     iReturnToNumberEntryOnFailure;
+
+        // Allow match information storage.
+        TBool                     iAllowMatch;
+        
+        // The name information storage.
+        TPhCltNameBuffer          iName;
+
+        // The contact ID storage.
+        TPhCltContactId           iContactId;
+
+        // Telephony number storage.
+        TPhCltTelephoneNumber     iTelNumber;
+        
+        // Information storage of the other call termination.
+        TBool                     iEndOtherCalls;
+
+        // The emergency call information.
+        TBool                     iEmergencyCall;
+
+        // The calling party subaddress.
+        TPhCltSubAddress          iSubAddress;
+
+        // The information whether this is SAT originated call or not.
+        TBool                     iSATCall;
+
+        // The bearer capability.
+        TPhCltBearerCapability    iBearer;
+
+        // Call type.
+        TPhCltCallType            iCallType;
+        
+        // SendKey
+        TBool                     iSendKey;
+
+    };
+
+#endif // TPHCLTEXTPHONEDIALDATA_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/extcallwrapper/extcallwrapper_aiw/cphcltdialer.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,100 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  It is dialer class.
+*
+*/
+
+
+#ifndef CPHCLTDIALER_H
+#define CPHCLTDIALER_H
+
+//  INCLUDES
+#include    <cphcltextphonebase.h> 
+#include    <cphcltextphonedialdata.h> 
+
+// FORWARD DECLARATIONS
+class CPhCltDialerDlg;
+
+// CLASS DECLARATION
+
+/**
+*  It is dialer class.
+*
+*  @lib phoneclient.lib
+*  @since 1.0
+*/
+class CPhCltDialer
+    : public CBase
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        *
+        * @return Pointer to created CPhCltDialer instance.
+        */
+        IMPORT_C static CPhCltDialer* NewL();
+        
+        /**
+        * Destructor.
+        */
+        ~CPhCltDialer();
+
+
+    public: // New functions
+
+        /** 
+        * Dial parameters.
+        *
+        * @return Returns dial data.
+        */
+        IMPORT_C CPhCltExtPhoneDialData& DialData();
+
+        /**
+        * Performs dialing with the dial data.
+        */
+        IMPORT_C void ExecuteLD();
+
+
+    private:
+
+        /**
+        * C++ constructor.
+        */
+        CPhCltDialer();
+        
+        /**
+        * Symbian OS constructor.
+        */
+        void ConstructL();
+
+        /**
+        * Cleanup action. Clears iDestroyed & iDialDlg.
+        */
+        static void DoClear( TAny* aAny );
+
+
+    private:    // Data
+
+        // Pointer to boolean indicating if this has been destroyed already.
+        TBool* iDestroyed;
+
+        // Dialer dialog
+        CPhCltDialerDlg* iDialDlg;
+
+    };
+
+#endif      // CPHCLTDIALER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/extcallwrapper/extcallwrapper_aiw/cphcltdialerdlg.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,111 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  It is dialer class.
+*
+*/
+
+
+#ifndef CPHCLTDIALERDLG_H
+#define CPHCLTDIALERDLG_H
+
+//  INCLUDES
+#include    <eikdialg.h>
+#include    "mphcltextphoneobserver.h" 
+#include    "cphcltextphonebase.h" 
+#include    <cphcltextphonedialdata.h> 
+
+// FORWARD DECLARATIONS
+class CPhCltExtPhoneBase;
+
+// CLASS DECLARATION
+
+/**
+*  It is dialer class.
+*
+*  @lib phoneclient.lib
+*  @since 1.0
+*/
+NONSHARABLE_CLASS( CPhCltDialerDlg )
+    : public CEikDialog,
+      private MPhCltExtPhoneObserver
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Destructor.
+        */
+        ~CPhCltDialerDlg();
+
+
+    public: // New functions
+
+        /** 
+        * Dial parameters.
+        *
+        * @returns Returns dial data.
+        */
+        CPhCltExtPhoneDialData& DialData();
+
+        /**
+        * Dial using given information.
+        */
+        void ExecuteDialLD();
+
+
+    private:
+
+        /**
+        * From CEikDialog, called before layout.
+        */
+        void PreLayoutDynInitL();
+        
+        /**
+        * From CEikDialog, called after layout.
+        */
+        void PostLayoutDynInitL();
+
+        /**
+        * Check if it's ok to exit.
+        */
+        TBool OkToExitL( TInt aButtonId );
+
+        /**
+        * From CEikDialog, draw.
+        */
+        void Draw( const TRect& aRect ) const;
+
+        /**
+        * From MPhCltExtPhoneObserver, handles status of dial.
+        *
+        * @param aStatus status.
+        */
+        void HandleDialL( const TInt aStatus );
+
+
+    private:    // Data
+
+        // Pointer to error.
+        TInt* iError;
+
+        // Reference to dial data.
+        CPhCltExtPhoneDialData* iData;
+
+        // Instance of phone client.
+        CPhCltExtPhoneBase* iPhoneClient;
+
+    };
+
+#endif      // CPHCLTDIALERDLG_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/extcallwrapper/extcallwrapper_aiw/cphcltextphone.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,133 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  It is the class for active object for making calls.
+*
+*/
+
+
+#ifndef CPHCLTEXTPHONE_H   
+#define CPHCLTEXTPHONE_H   
+
+//  INCLUDES
+#include <e32base.h>
+#include "cphcltextphonebase.h" 
+#include "rphcltserver.h" 
+#include "rphcltextcall.h" 
+
+
+// FORWARD DECLARATIONS
+class MPhCltExtPhoneObserver;
+
+
+// CLASS DECLARATION
+
+/**
+*  It is the class for active object for making calls.
+*
+*  @lib phoneclient.lib
+*  @since 1.0
+*/
+NONSHARABLE_CLASS( CPhCltExtPhone )
+    : public CPhCltExtPhoneBase        
+    {
+    public:  // Constructors and destructor
+        /**
+        * Two-phased constructor.
+        *
+        * @param aObserver It is the observer for the instance.
+        * @return Pointer to created CPhCltExtPhone instance.
+        */
+        static CPhCltExtPhone* NewL( MPhCltExtPhoneObserver* aObserver );
+
+        /**
+        * Destructor.
+        */
+        ~CPhCltExtPhone(); 
+
+
+    public: // From baseclass
+
+
+        /**
+        * From CPhCltExtPhoneBase, Makes a new call.
+        *
+        * @param aData The populated dialing data.
+        */
+        virtual void DialL( CPhCltExtPhoneDialData& aData );
+
+
+    private:
+    
+        /**
+        * C++ constructor.
+        */
+        CPhCltExtPhone( MPhCltExtPhoneObserver* aObserver );
+
+        /**
+        * Symbian OS constructor.
+        */
+        void ConstructL();   
+
+        /**
+        * From CActive, it is called when object is active and 
+        * request has been processed.
+        */
+        void RunL();
+
+        /**
+        * From CActive, calcels pending request.
+        */
+        void DoCancel();
+
+        /**
+        * Check that suitable preconditions have been satisified
+        * before attempting a dial
+        */
+        void DialPreconditionCheckL();
+
+
+    private:  // Data
+
+        // Enumeration for the dialing operation modes.
+        enum TMode 
+            {
+            EIdle,     // In idle state.
+            EDialling  // In dialling state.
+            };
+        
+        // Status information of the phone.
+        // Not used. Just for BC.
+        TPckgBuf< TInt > iPhoneStatus;
+
+        // Call instance to perform dialing.
+        RPhCltExtCall iCall;
+        
+        // Server that is used in dialing.
+        RPhCltServer iServer;
+
+        // Mode of the dialing operation.
+        TMode iMode;
+        
+        /*
+         * Package needs to member variable because it is possible that client
+         * has high priority and in this case it is possible that package is deleted 
+         * too early.
+         */
+        HBufC8* iPackage;
+       
+    };
+
+#endif      // CPHCLTEXTPHONE_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/extcallwrapper/extcallwrapper_aiw/cphcltextphonebase.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,118 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  It defines dial interface for phone client.
+*
+*/
+
+
+#ifndef CPHCLTEXTPHONEBASE_H
+#define CPHCLTEXTPHONEBASE_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "phclttypes.h" 
+
+// FORWARD DECLARATIONS
+class MPhCltExtPhoneObserver;
+class CPhCltExtPhoneDialData;
+
+// CLASS DECLARATION
+
+/**
+*  It defines dial interface for phone client.
+*
+*  Usage:
+*  
+*  To dial, you must have a string of characters from set 
+*  { 0, 1, 2, .. 9, #, *, +, p, P, w, W }. It is the only 
+*  mandatory parameter. String may also contain other characters,
+*  but then only a note is displayed. So you should proceed as follows:
+*       1. Check that string is acceptable. 
+*          (application specific grammar)
+*       2. If not, stop. Otherwise continue.
+*       3. Convert to string acceptable by phoneclient.
+*          Note PhCltUtils class may help.
+*       4. Dial using the class.
+*
+*  Note that dialling does not always mean creating a call. 
+*  (E.g. *#43# makes phone to interrogate status of call waiting.)
+*  
+*  In order to dial, you need instance of CPhCltExtPhoneBase. You 
+*  can create one as follows:
+*       iExtCall = CPhCltExtPhoneBase::NewL( this );
+*  (the parameter is pointer to observer)
+*
+*  Then you must fill dial parameters to instance of TPhCltExtPhoneDialData.
+*  (you can read more details from its header)
+*
+*       TPhCltExtPhoneDialData data;
+*       data.SetTelephoneNumber( .. );
+*       ..
+*
+*  And finally, you can dial. Note that the method is asynchronous and
+*  observer will be informed when phone starts dialing.
+*
+*       iExtCall->DialL( data );
+*
+*  Finally, you can delete the instance. If dialing is ongoing, this should
+*  be done after observer has been informed. You can also delete before that,
+*  but then the request might also be canceled.
+*
+*  @lib phoneclient.lib
+*  @since 1.0
+*/
+class CPhCltExtPhoneBase : public CActive
+    {
+    public:  // Constructors and destructor
+ 
+        /**
+        * Create an instance that implements the interface.
+        *
+        * @param aObserver It is the observer for the instance.
+        * @return Returns the created instance.
+        */
+        IMPORT_C static CPhCltExtPhoneBase* NewL( 
+            MPhCltExtPhoneObserver* aObserver );
+
+
+    public: // New fuctions    
+        
+
+       /**
+       * Makes a new call. This is the preferred way of dialling!
+       *
+       * @param aData The object containing the parameters for 
+       *              the dial request.
+       */
+       virtual void DialL( CPhCltExtPhoneDialData& aData ) = 0;
+
+
+    protected:
+
+        /**
+        * C++ constructor.
+        */
+        CPhCltExtPhoneBase( MPhCltExtPhoneObserver* aObserver );
+
+
+    protected: // Data
+        
+        // Observer to handle events.
+        MPhCltExtPhoneObserver* iObserver;
+
+    };
+
+#endif      // CPHCLTEXTPHONEBASE_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/extcallwrapper/extcallwrapper_aiw/mphcltextphoneobserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  It defines the interface for the observers of 
+*                the CPhCltExtPhoneBase.
+*
+*/
+
+
+#ifndef MPHCLTEXTPHONEOBSERVER_H   
+#define MPHCLTEXTPHONEOBSERVER_H   
+
+// CLASS DECLARATION
+
+/**
+*  Defines the interface for the observers of the CPhCltExtPhoneBase.
+*
+*  @lib phoneclient.lib
+*  @since 1.0
+*/
+class MPhCltExtPhoneObserver
+    {          
+    public:  // New functions   
+        
+        /**
+        * It is called whenever client's dial request is completed.
+        *
+        * @param aStatus It is the status of the operation.
+        *                <0 means Symbian OS error code.
+        */       
+        virtual void HandleDialL( const TInt aStatus ) = 0;
+        
+    };
+
+#endif      // MPHCLTEXTPHONEOBSERVER_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/ihf/rphcltihf.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,111 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 for Ihf mode handling in phone client.
+*
+*/
+
+#ifndef RPHCLTIHF_H
+#define RPHCLTIHF_H
+
+// INCLUDES
+#include    <etelmm.h>            // ETel
+
+#include "phclttypes.h" 
+
+// FORWARD DECLARATIONS
+class RWsSession;
+class RPhCltServer;
+
+// CLASS DECLARATION
+/**
+*  Session for Ihf mode handling in phone client.
+*
+*  @lib phoneclient.lib
+*  @since 1.0
+*/
+class RPhCltIhf : public RSubSessionBase
+    {
+
+    public:  // Constructors and destructor  
+
+        /**
+        * Constructor.
+        */      
+        IMPORT_C RPhCltIhf();
+
+
+    public: // New functions    
+
+        /**
+        * Creates a subsession with the phone server.
+        * 
+        * @param aServer Pre-opened server session.
+        * @param aPriority Priority for the active object handling notify 
+        *                  events. Not used.
+        * @return Symbian OS standard error code.
+        */      
+        IMPORT_C TInt Open( 
+            RPhCltServer& aServer, 
+            TInt aPriority = CActive::EPriorityStandard );
+
+        /**
+        * Closes the subsession. Cancels all notify requests.
+        * Remember to call this to a connected session in some point.
+        */
+        IMPORT_C void Close();
+
+
+    public: // API
+        
+        /**
+        * Set Ihf mode
+        *
+        * @param aMode ETrue to set IHF mode on, otherwise set IHF mode off
+        * @param aShowNote ETrue if the IHF activation/deactivation note 
+        *                  should be shown
+        * @return Standard Symbian OS error code. Note, if the note can't be 
+        *         shown, the system will not return any error code. The error 
+        *         code just means the IHF mode changing is failed. If aMode is 
+        *         same as current IHF mode of the system, KErrAlreadyExist will
+        *         be returned.
+        *         If the headset or other audio accessory is connected, then 
+        *         IHF mode can't be activated, and KErrAccessDenied will be 
+        *         returned.
+        */
+        IMPORT_C TInt SetIhfMode( 
+            TBool aMode, 
+            TBool aShowNote = EFalse );
+    
+        /**
+        * Set Ihf mode for Phone application only.
+        *
+        * @param aMode ETrue to set IHF mode on, otherwise set IHF mode off
+        * @param aShowNote ETrue if the IHF activation/deactivation note should
+        *                  be shown
+        * @return Standard Symbian OS error code. Note, if the note can't be 
+        *         shown, the system will not return any error code. The error 
+        *         code just means the IHF mode changing is failed. If aMode is 
+        *         same as current IHF mode of the system, KErrAlreadyExist will
+        *         be returned.
+        *         If the headset or other audio accessory is connected, then IHF
+        *         mode can't be activated, and KErrAccessDenied will be 
+        *         returned.
+        */
+        IMPORT_C TInt SetIhfModeFromPhone( 
+            TBool aMode, 
+            TBool aShowNote = EFalse );
+
+    };
+
+#endif // RPHCLTIHF_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/imagehandler/cphcltimagehandlerimplementation.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,168 @@
+/*
+* Copyright (c) 2004-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 PhCltExtension Image handler interface.
+*
+*/
+
+
+
+#ifndef CPHCLTIMAGEHANDLERIMPLEMENTATION_H
+#define CPHCLTIMAGEHANDLERIMPLEMENTATION_H
+
+
+//  INCLUDES
+#include    <cphcltimagehandler.h> 
+#include    "rphcltimagehandler.h" 
+#include    "rphcltserver.h" 
+
+/**
+*  Implementation of image handler interface.
+*
+*  @lib PhoneClient.lib
+*  @since Series60 3.2
+*/
+NONSHARABLE_CLASS ( CPhCltImageHandlerImplementation )
+:   public CPhCltImageHandler, public MPhCltImageObserver
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CPhCltImageHandlerImplementation* NewL();
+
+        /**
+        * Destructor.
+        */
+        ~CPhCltImageHandlerImplementation();
+
+    public: // Functions from base classes
+
+        /**
+        * @see CPhCltImageHandler.
+        */        
+        TInt SaveImages( CPhCltImageParams& aParams );
+            
+        /**
+        * @see CPhCltImageHandler.
+        */
+        TInt LoadImages( CPhCltImageParams*& aParams );
+
+        /**
+        * @see CPhCltImageHandler::CPhCltBaseImageParamsL().
+        */
+        virtual CPhCltImageParams* 
+            CPhCltBaseImageParamsL( const TPhCltImageType aType ); 
+        
+        /**
+        * @see CPhCltImageHandler::OpenDefaultVtImage().
+        */
+        virtual TInt OpenDefaultVtImage( RFile& aFile );
+        
+        /**
+        * @see CPhCltImageHandler::SaveVtImage()
+        */
+        virtual void SaveVtImageL( MPhCltImageObserver& aObserver,
+            const TDesC& aImagePath );
+
+        /**
+        * @see CPhCltImageHandler::CancelSaveVtImage
+        */
+        virtual void CancelSaveVtImage();
+                
+        /**
+        * @see CPhCltImageHandler::OpenVtImage()
+        */
+        virtual TInt OpenVtImage( RFile& aFile );
+    
+    public: // from MPhCltImageObserver    
+    
+        virtual void HandleImageSaveCompleteL( TInt aResult );
+        
+    private:
+
+        /**
+        * C++ constructor.
+        */
+        CPhCltImageHandlerImplementation();
+        
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Common code for opening default and user defined image.
+        */                               
+        TInt OpenVtImageCommon( 
+            RFile& aFile, 
+            const TBool aDefaultImage );
+
+        /**
+        * Internal class for handling asynchronous image saving.
+        */
+        class CVtImageSaver : public CActive
+        {
+        public:
+
+            /** Saves VT image. Deletes itself after observer callback 
+             * or cancellation */
+            static CVtImageSaver* SaveLD(
+                MPhCltImageObserver& aObserver,
+                RPhCltImageHandler& aHandler,
+                const TDesC& aImagePath );
+            
+        private:
+            CVtImageSaver( 
+                MPhCltImageObserver& aObserver,
+                RPhCltImageHandler& aHandler );
+            
+            ~CVtImageSaver();
+        
+        private:
+            void DoSave( const TDesC& aImagePath );
+            
+        private: // from CActive
+        
+            /** handles observer callback */
+            void RunL();
+            
+            /**  */
+            void DoCancel();
+            
+        private:
+        
+        MPhCltImageObserver& iObserver;
+        RPhCltImageHandler& iHandler;
+        };
+        
+    private: // Data
+        RPhCltImageHandler iStillHandler;
+        
+        //RPhCltServer class instance creates phonesession
+        RPhCltServer iServer;
+
+        // Observer for async image saving
+        MPhCltImageObserver* iObserver;
+                
+        // not owned
+        CVtImageSaver* iVtImageSaver;
+        
+
+    };
+
+#endif      // CPHCLTIMAGEHANDLERIMPLEMENTATION_H
+
+  
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/imagehandler/cphcltoperatorlogocontainer.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2004-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:  Operator logo container.
+*
+*/
+
+#ifndef CPHCLTOPERATORLOGOCONTAINER_H
+#define CPHCLTOPERATORLOGOCONTAINER_H
+
+// INCLUDES
+#include   <cphcltbaseimageparams.h> 
+#include    <fbs.h>
+
+// CLASS DECLARATION
+
+/**
+*  Image handler Subsession.
+*
+*  @since Series60 3.0
+*/
+NONSHARABLE_CLASS( CPhCltOperatorLogoContainer ) : public CBase
+    {
+    public:  // Constructors and destructor
+    
+        /**
+        * Destructor.
+        */
+        ~CPhCltOperatorLogoContainer();
+        
+        /**
+        * Constructor.
+        * @param aCountryCode country code for operator logo
+        * @param aNetworkCode network code for operator logo
+        * @param aBitmap bitmap to store.
+        */
+        CPhCltOperatorLogoContainer( 
+            const TPhCltCountryCode aCountryCode,
+            const TPhCltNetworkCode aNetworkCode,
+            const TPhCltExtOperatorLogoType aLogoType, 
+            CFbsBitmap* aBitmap );
+            
+        // Stored image.
+        CFbsBitmap* iBitmap;
+        
+        // Operator logo country code.
+        TPhCltCountryCode iCountryCode;
+        
+        // Operator logo network code.
+        TPhCltNetworkCode iNetworkCode;
+        
+        // Operator logo type.
+        TPhCltExtOperatorLogoType iLogoType;        
+    };
+
+#endif // CPHCLTOPERATORLOGOCONTAINER_H
+
+// End of file.
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/imagehandler/rphcltimagehandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,148 @@
+/*
+* Copyright (c) 2004-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  PhoneServer interface for image handling.
+*
+*/
+
+#ifndef RPHCLTIMAGEHANDLER_H
+#define RPHCLTIMAGEHANDLER_H
+
+//  INCLUDES
+#include    <e32base.h>
+#include    <phclttypes.h> 
+#include    "cphcltoperatorlogocontainer.h" 
+#include    "cphcltbaseimageparams.h" 
+
+
+//  FORWARD DECLARATIONS
+class RPhCltServer;
+
+
+/**
+*  PhoneServer interface for image handling.
+*
+*  @lib PhoneClient.lib
+*  @since S60 v3.2
+*/
+class RPhCltImageHandler 
+:   public RSubSessionBase
+    {
+    public: // Constructors and destructors.
+
+        /**
+         * Constructor.
+         */
+        RPhCltImageHandler();
+
+    public: // New functions.
+
+        /**
+        * Open subsession to server.
+        * 
+        * @param aServer Pre-opened server session.
+        * @return Symbian OS error code of the success of the opening.
+        */
+        TInt Open( RPhCltServer& aServer );
+
+        /**
+        * Close subsession.
+        */
+        void Close();
+    
+        /**
+        * Save image(s).
+        *
+        * @param aParam An array of bitmap handles passed.
+        * @return KErrNone if successful, Symbian error code otherwise.
+        */
+        TInt SaveImages( CPhCltImageParams& aParams );
+            
+        /**
+        * Load image(s).
+        *
+        * @param aParam An array of bitmap handles passed.
+        * @return KErrNone if successful, Symbian error code otherwise.
+        */
+        TInt LoadImages( CPhCltImageParams*& aParams );
+
+        /**
+        * Saves VT still image.
+        */
+        void SaveVtImage( TRequestStatus& aStatus, const TDesC& aFilePath );
+        
+        /**
+         * Cancels image saving
+         */
+        void CancelSaveVtImage();
+
+        /**
+        * Opens VT still image file. Returns file handle that can be
+        * used with AdoptFromServer.
+        * @param aFileHandle file handle
+        * @param aOpenDefault if true, opens predefined, if false opens
+        * user defined image file.
+        */
+        TInt OpenVtImage( TInt& aFileHandle, const TBool aOpenDefault = EFalse );
+        
+    private:
+
+        // Prohibit copy constructor if not deriving from CBase.
+        RPhCltImageHandler( const RPhCltImageHandler& );
+
+        // Prohibit assigment operator if not deriving from CBase.
+        RPhCltImageHandler& operator=( 
+            const RPhCltImageHandler& );
+            
+    private: // New functions.
+        
+        /**
+        * Finalizes image load.
+        * @param aImages handle array
+        * @return Symbian error code.
+        */
+        TInt FinalizeLoad( TPckgBuf< TPhCltImageArray >& aImages );
+
+        /**
+        * Creates a copy of image.
+        * @param aImages handle array
+        * @return copied bitmap.
+        */
+        CFbsBitmap* CreateBitMapL( const TInt aHandle );
+        
+        /**
+        * Ducplicates vt still images.
+        * @param aImages handle array
+        */
+        void CopyStillsL( TPhCltImageArray& aImages );  
+        
+        /**
+        * Duplicates operator logos.
+        * @param aImages handle array
+        */
+        void CopyLogosL( TPhCltImageArray& aImages );
+        
+            
+    private: // Data
+    
+        // Duplicated VT images.
+        RPointerArray<CFbsBitmap> iVTBitMaps;
+        
+        // Duplicated operator logos.
+        RPointerArray<CPhCltOperatorLogoContainer> iOperatorLogos;
+
+    };
+
+#endif    // RPHCLTIMAGEHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/messenger/cphcltmessengerimplementation.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,111 @@
+/*
+* Copyright (c) 2004-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:  Implementation of the PhCltExtension Messenger interface.
+*
+*/
+
+
+
+#ifndef CPhCltMessengerIMPLEMENTATION_H
+#define CPhCltMessengerIMPLEMENTATION_H
+
+
+//  INCLUDES
+#include    <cphcltmessenger.h> 
+#include    "rphcltmessenger.h" 
+#include    "rphcltserver.h" 
+
+/**
+*  Implementation of the CPhCltMessenger interface.
+*
+*
+*  @lib PhoneClient.lib
+*  @since 3.2
+*/
+NONSHARABLE_CLASS( CPhCltMessengerImplementation )
+:   public CPhCltMessenger
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CPhCltMessengerImplementation* NewL( const TUid& aCategoryUid,
+            const TInt& aDefaultMessageSize = KPhCltDefMesSize );
+        
+
+        /**
+        * Destructor.
+        */
+        ~CPhCltMessengerImplementation();
+
+
+    public: // Functions from base classes
+
+        /**
+        * @see CPhCltMessenger::Receive().
+        */
+        void Receive(
+            TRequestStatus& aStatus,
+            TInt& aMessageSize,
+            TDes8& aMessagePayload );
+
+
+        /**
+        * @see CPhCltMessenger::Send().
+        */
+        void Send(
+            TRequestStatus& aStatus,
+            const TDesC8& aMessagePayload );
+
+
+        /**
+        * @see CPhCltMessenger::CancelRequest().
+        */
+        void CancelRequest( const TPhCltMessengerRequest& aRequest );
+
+
+        /**
+        * @see CPhCltMessenger::Skip().
+        */
+        void Skip();
+
+
+    private:
+
+        /**
+        * C++ constructor.
+        */
+        CPhCltMessengerImplementation();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL( const TUid& aCategoryUid,
+            const TInt& aDefaultMessageSize );
+
+    private:    // Data
+
+        // The messenger to perform requests.
+        RPhCltMessenger    iMessenger;
+        
+        //RPhCltServer class instance creates phonesession
+        RPhCltServer iServer;
+    };
+
+
+#endif      // CPhCltMessengerIMPLEMENTATION_H
+
+  
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/messenger/rphcltmessenger.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,148 @@
+/*
+* 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:  This class is used to perform messenger originated commands.
+*
+*/
+
+
+#ifndef RPhCltMessenger_H
+#define RPhCltMessenger_H
+
+
+//  INCLUDES
+#include <e32base.h>
+#include <cphcltmessenger.h> 
+
+// FORWARD DECLARATIONS
+class RPhCltServer;
+
+
+/**
+*  Messenger interface: provides two-way communication between 
+*  two or more clients.
+*
+* @lib PhoneClient.lib 
+* @since 3.2
+*  
+*/
+class RPhCltMessenger
+:   public RSubSessionBase
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Constructor.
+        */
+        RPhCltMessenger();
+
+        /**
+        * Desstructor.
+        */
+        ~RPhCltMessenger();
+
+
+    public:
+
+        /**
+        * Open session ready to be sending and receiving messages.
+        *
+        * @param aServer      Pre-opened server session.
+        * @param aCategoryUid Category of messages to be sent or received.
+        *                     Note that there can be many kinds of message uids
+        *                     below one category uid.
+        * @param aDefaultMessageSize The default size of the messages to be sent
+        *                            or received, In bytes. Can be bigger than 
+        *                            KPhCltDefMesSize, but then functionality
+        *                            is not guaranteed.
+        * @return Error code. KErrNone if successful.
+        */
+        TInt Open(
+            RPhCltServer& aServer,
+            const TUid& aCategoryUid,
+            const TInt& aDefaultMessageSize );
+
+
+        /**
+        * Closes the session.
+        */
+        void Close();
+
+
+        /**
+        * Receives next message. No memory is allocated during the operation of
+        * this method.
+        * 
+        * @param aStatus This request will be completed once message has been 
+        *                received.
+        * @param aMessageSize Tells the size of the received message. If smaller
+        *        than the size of the aMessagePayload, then only the beginning 
+        *        of the received message is copied to aMessagePayload.
+        *                     
+        * @param aMessagePayload Payload of the message. Contains the TUid at 
+        *                        the beginning of the message when completed.
+        */ 
+        void Receive(
+            TRequestStatus& aStatus,
+            TInt& aMessageSize,
+            TDes8& aMessagePayload );
+
+
+        /**
+        * Sends message. This is completed only after message has been
+        * delivered to receiver.
+        * No memory is allocated during the operation of this method.
+        * 
+        * @param aStatus This request will be completed once message has been 
+        *                sent.
+        * @param aMessagePayload Payload of the message.
+        */
+        void Send(
+            TRequestStatus& aStatus,
+            const TDesC8& aMessagePayload );
+
+
+        /**
+        * Cancel request. This method should only be called during destruction 
+        * to make sure that messages are not missed.
+        * 
+        * @param aRequest request to be canceled.
+        */
+        void CancelRequest( const TPhCltMessengerRequest& aRequest );
+
+
+        /**
+        * Skip one message. This method should be called only if Receive 
+        * indicates that there is not enough space in aMessagePayload.
+        * Of course, you should attempt to recover, i.e. call Receive with big 
+        * enough aMessagePayload buffer before calling this method.
+        */
+        void Skip();
+
+
+    private:    // Data
+
+        // Container for received message size.
+        TPtr8                               iReceiveMessageSize;
+
+        // Used in Receive and Send methods to contain the parameters.
+        TPhCltMessengerParameters           iMessengerParameters;
+
+        // The packaged version of the iMessengerParameters.
+        TPckg< TPhCltMessengerParameters >  iMesParPckg;
+
+    };
+
+#endif      // RPhCltMessenger_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/misc/telservicesinternalcrkeys.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2004-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Telephony Services internal Central Repository keys
+*
+*/
+
+
+#ifndef TELSERVICESINTERNALCRKEYS_H
+#define TELSERVICESINTERNALCRKEYS_H
+
+#include <e32std.h>
+
+/******************************************************************************
+* Telephony Services Variation API
+* Keys under this category are used in defining Telephony Services variation.
+******************************************************************************/
+const TUid KCRUidTelSrvVariation = { 0x102029AC };
+
+/**
+* Telephony Services Local Variation Flags. Values are defined in 
+* TelephonyServicesVariant.hrh.
+*/
+const TUint32 KTelSrvVariationFlags             = 0x00000001;
+
+#endif      // TELSERVICESINTERNALCRKEYS_H
+
+// End of file
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/misc/telservicesvariant.hrh	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,87 @@
+/*
+* 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:  This file contains values for CenRep keys specifying
+*                Telephony Services specific software settings. 
+*
+*
+*/
+
+
+#ifndef TELSERVICESVARIANT_HRH
+#define TELSERVICESVARIANT_HRH
+
+/**
+* KTelSrvLVFlagAdvancedENCheck defines if advanced emergency number check
+* is enabled. 
+* When the flag is set, the advanced emergency number check feature is enabled.
+* @since S60 2.6
+*/
+#define KTelSrvLVFlagAdvancedENCheck 0x00000001
+
+/**
+* KTelSrvLVFlagUssdTone defines if the USSD tone play functionality is 
+* enabled.
+* When the flag is set, tone is played when USSD message is received. 
+* @since S60 2.6
+*/
+#define KTelSrvLVFlagUssdTone 0x00000002
+
+/** 
+* KTelSrvLVFlagZeroDial is on/off setting for zero dialling.
+* When it is set on in KTelSrvVariationFlags zero dialling is enabled
+* (0 considered as a phone number), if not GSM standards are followed.
+*/
+#define KTelSrvLVFlagZeroDial 0x00000004
+
+/** 
+* KTelSrvLVFlagTwoDigitDial is on/off setting for 2-digit dial.
+* When it is set on in KTelSrvVariationFlags the feature is enabled.
+* Note: in addition to the value of the key, DOS side variable is read. Two
+* digit calling is enabled if both variables indicate that the feature
+* should be enabled.
+*/
+#define KTelSrvLVFlagTwoDigitDial 0x00000008
+
+/**
+* KTelSrvLVFlagLifeTimer defines if life timer functionality is enabled. 
+* When the flag is set, the life timer feature is enabled.
+*/
+#define KTelSrvLVFlagLifeTimer 0x00000010
+
+/** 
+* KTelephonyLVFlagStandardCugIndexing defines the range of CUG indexes
+* that is in use.
+*
+* When the flag is set implementation is GSM 04.80 compliant.
+*    Default CUG index : 0xFFFF
+*    CUG index range   : 0 - 32767 (decimal)
+*
+* When the flag is NOT set legacy implementation is followed.
+*    Default CUG index : 0
+*    CUG index range   : 1 - 32767 (decimal)
+*
+*/
+#define KTelephonyLVFlagStandardCugIndexing 0x00000020
+
+/**
+* KTelephonyLVFlagDivertDualAffect defines special dual activation/deactivation
+* funtionality. If flag is enabled phonesettings component checks SIM and
+* if used SIM supports this feature phonesettings assumes that every CFU
+* activation/deactivation request affect to both lines.
+* @since Series 60 5.1
+*/
+#define KTelephonyLVFlagDivertDualAffect 0x00000040
+
+#endif // TELSERVICESVARIANT_HRH
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/notifier/notifier_aiw/cphcltcomhandrequestmonitor.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CPhCltComHandRequestMonitor observer getting notifications about 
+*                command handling requests from Phone Server.
+*
+*/
+
+#ifndef CPHCLTCOMHANDREQUESTMONITOR_H
+#define CPHCLTCOMHANDREQUESTMONITOR_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <phclttypes.h> 
+
+
+//  FORWARD DECLARATIONS
+class RPhCltServer;
+class CPhCltDialData;
+class MPhCltComHandRequestObserver;
+class CPhCltExtPhoneDialData;
+class RPhCltCallNotify;
+
+// CLASS DECLARATION
+
+/**
+*  CCallNotify observer getting notifications about call requests
+*  from Phone Server.
+*
+*  @lib phoneclient.lib
+*  @since 1.0
+*/
+NONSHARABLE_CLASS( CPhCltComHandRequestMonitor ) : public CActive
+    {
+    public: // Constructors and destructors.
+
+        
+        static CPhCltComHandRequestMonitor* NewL(RPhCltCallNotify& aCltNotify);
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CPhCltComHandRequestMonitor();
+        
+    public: // New functions
+
+        
+        
+        /**
+        * Notifies when a Command handler request arrives.
+        *
+        * @param aStatus Status to be changed when command handler request
+        *                has arrived.
+        * @param aCommandArgs Command argument storage place. 
+        *                     That is, packaged version of class 
+        *                     TPhCltComHandCommandParameters.
+        */
+        void NotifyComHandCommand( 
+            MPhCltComHandRequestObserver* , 
+            TDes8& aCommandArgs );
+
+    
+        /**
+        * Respond to client's command handler request.
+        *
+        * @param aResultCode Result of the response 
+        *        (previous function execution).
+        * @return KErrNone if respond succeeded, otherwise Symbian error code.
+        */
+        TInt RespondComHandClient( const TInt aResultCode );
+
+    
+    private:
+    
+        /*
+        * Constructor.
+        */
+        CPhCltComHandRequestMonitor(RPhCltCallNotify& aCallNotify);
+        
+        
+    private: // Functions from base classes
+        
+        /**
+        * From CActive. 
+        * Called when send request is completed.
+        */
+        void RunL();
+        
+        
+        /**
+        * From CActive. 
+        * Called when active request is canceled.
+        */
+        void DoCancel();
+        
+    private:
+        
+        //RClass instance
+        RPhCltCallNotify& iCallNotify;
+               
+
+        // Pointer to dial observer
+        MPhCltComHandRequestObserver* iObserver;
+    
+    };
+
+
+#endif    // CPHCLTCOMHANDREQUESTMONITOR_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/notifier/notifier_aiw/cphcltdialemergencyrequestmonitor.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CPhCltDialEmergencyRequestMonitor observer getting notifications about call requests
+*                from Phone Server.
+*
+*/
+
+#ifndef CPHCLTDIALEMERGENCYREQUESTMONITOR_H
+#define CPHCLTDIALEMERGENCYREQUESTMONITOR_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <phclttypes.h> 
+
+
+//  FORWARD DECLARATIONS
+class RPhCltServer;
+class RPhCltCallNotify;
+class MPhCltDialEmergencyRequestObserver;
+
+
+// CLASS DECLARATION
+
+/**
+*  CCallNotify observer getting notifications about call requests
+*  from Phone Server.
+*
+*  @lib phoneclient.lib
+*  @since 1.0
+*/
+NONSHARABLE_CLASS( CPhCltDialEmergencyRequestMonitor ): public CActive
+    {
+    public: // Constructors and destructors.
+
+        
+        static CPhCltDialEmergencyRequestMonitor* NewL(RPhCltCallNotify& aCltNotify);
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CPhCltDialEmergencyRequestMonitor();
+        
+    public: // New functions
+
+    
+        /**
+        * Notifies when a emergency call request arrives.
+        *
+        * @param aStatus Status to be changed when call request have arrived.
+        */        
+        void NotifyEmergencyCall( 
+            MPhCltDialEmergencyRequestObserver* aObserver,
+            TDesC& aEmergencyNumber );
+
+
+        /**
+        * Respond to client request to make emergency call
+        *
+        * @param aResultCode Result of the response.
+        */
+        TInt RespondEmergencyToClient( const TInt aResultCode );
+        
+    
+    private:
+    
+        /*
+        * Constructor.
+        */
+        CPhCltDialEmergencyRequestMonitor(RPhCltCallNotify& aCallNotify);
+        
+        
+    private: // Functions from base classes
+        
+        /**
+        * From CActive. 
+        * Called when send request is completed.
+        */
+        void RunL();
+        
+        /**
+        * From CActive.
+        * Called when RunL leaves.
+        */        
+        TInt RunError(TInt aError);
+        
+        /**
+        * From CActive. 
+        * Called when active request is canceled.
+        */
+        void DoCancel();
+        
+    private:
+        
+        //RClass instance
+        RPhCltCallNotify& iCallNotify;
+               
+        //Pointer to emergencynumber
+        TPtr8 iEmergencyCallNumberPtr;
+
+        // Pointer to dial observer
+        MPhCltDialEmergencyRequestObserver* iObserver;
+    
+    };
+
+
+#endif    // CPHCLTDIALEMERGENCYREQUESTMONITOR_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/notifier/notifier_aiw/cphcltdialrequestmonitor.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CPhCltDialRequestMonitor observer getting notifications about call requests
+*                from Phone Server.
+*
+*/
+
+#ifndef CPHCLTDIALREQUESTMONITOR_H
+#define CPHCLTDIALREQUESTMONITOR_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <phclttypes.h> 
+
+//  FORWARD DECLARATIONS
+class RPhCltServer;
+class CPhCltDialData;
+class MPhCltDialRequestObserver;
+class CPhCltExtPhoneDialData;
+class MPhCltComHandRequestObserver;
+class RPhCltCallNotify;
+
+// CLASS DECLARATION
+
+/**
+*  CCallNotify observer getting notifications about call requests
+*  from Phone Server.
+*
+*  @lib phoneclient.lib
+*  @since 1.0
+*/
+NONSHARABLE_CLASS( CPhCltDialRequestMonitor ): public CActive
+    {
+    public: // Constructors and destructors.
+
+        
+        static CPhCltDialRequestMonitor* NewL(RPhCltCallNotify& aCallNotify);
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CPhCltDialRequestMonitor();
+        
+    public: // New functions
+
+    
+        /**
+        * Notify dial requests through given observer.
+        * @param aObserver dial request observer
+        */
+        void NotifyDialRequest( 
+            MPhCltDialRequestObserver* aObserver );
+
+        /**
+        * Respond to client request to make a call
+        *
+        * @param aResultCode Result of the response.
+        */
+        TInt RespondClient( const TInt aResultCode );
+        
+    
+    private:
+    
+        /*
+        * Constructor.
+        */
+        CPhCltDialRequestMonitor(RPhCltCallNotify& aCallNotify);
+        
+        
+    private: // Functions from base classes
+        
+        /**
+        * From CActive. 
+        * Called when send request is completed.
+        */
+        void RunL();
+        
+        /**
+        * From CActive.
+        * Called when RunL leaves.
+        */        
+        TInt RunError(TInt aError);
+        
+        /**
+        * From CActive. 
+        * Called when active request is canceled.
+        */
+        void DoCancel();
+        
+    private:
+        
+        //RClass instance
+        RPhCltCallNotify& iCallNotify;
+               
+        //Used to get dial data length from server
+        TInt iDialDataLength;
+        
+        //Package buffer for dial data length 
+        TPckg< TInt > iDataLengthPckg;
+
+
+        // Pointer to dial observer
+        MPhCltDialRequestObserver* iObserver;
+    
+    };
+
+
+#endif    // CPhCLTDIALREQUESTMONITOR_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/rphcltresourcefile.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  It is phoneclient resource file loader.
+*
+*/
+
+
+#ifndef RPHCLTRESOURCEFILE_H
+#define RPHCLTRESOURCEFILE_H
+
+//  INCLUDES
+#include    <e32base.h>
+
+
+// FORWARD DECLARATIONS
+class CCoeEnv;
+class RConeResourceLoader;
+
+
+// CLASS DECLARATION
+
+/**
+*  It is PhoneClient resource file loader.
+*
+*  @lib phoneclient.lib
+*  @since 1.0
+*/
+class RPhCltResourceFile
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * C++ constructor.
+        */
+        IMPORT_C RPhCltResourceFile();
+              
+
+    public: // New functions
+
+        /**
+        * Opens resource file.
+        *
+        * Note: Panics if you try to reopen.
+        *
+        * @param aEnv Coe env.
+        */
+        IMPORT_C void OpenL( CCoeEnv& aEnv );
+
+        /**
+        * Closes resource file.
+        */
+        IMPORT_C void Close();
+
+
+    public: // Functions from base classes
+        
+        // Prohibit copy constructor if not deriving from CBase.
+        RPhCltResourceFile( const RPhCltResourceFile& );
+        // Prohibit assigment operator if not deriving from CBase.
+        RPhCltResourceFile& operator= ( const RPhCltResourceFile& );
+
+
+    private:    // Data
+        
+        // Resource file loader.
+        RConeResourceLoader* iLoader;
+
+    };
+
+#endif      // RPHCLTRESOURCEFILE_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/session/phoneclient.hrh	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  PhoneClient resource header file.
+*                Contains common definitions for menu id:s
+*
+*/
+
+
+#ifndef PHONECLIENT_HRH
+#define PHONECLIENT_HRH
+
+// The PhoneClient USSD note ids.
+enum TPhCliUssdNotes
+    {
+    EPhCliUssdRequestingNote = 1
+    };
+
+#endif    // PHONECLIENT_HRH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/sharedclientserver/phcltclientserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,303 @@
+/*
+* 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:  Common constants.
+*
+*/
+
+
+#ifndef PHCLTCLIENTSERVER_H
+#define PHCLTCLIENTSERVER_H
+
+
+
+// INCLUDES
+#include <e32base.h>
+#ifdef SYMBIAN_OLD_EXPORT_LOCATION // Include should be removed when flag disabled from builds
+#include <cntdef.h>
+#endif
+#include <etelmm.h>
+#include <data_caging_path_literals.hrh>
+
+// CONSTANTS
+
+
+// Server startup related
+const TUid KPhCltServerUid = { 0x10000850 }; // from PhoneServer.mmp
+_LIT( PHONE_SERVER_NAME, "Phone Server" );
+
+_LIT( KPhServerPathAndNameWINS, "PhoneServer" );
+_LIT( KPhServerPathAndNameMARM, "PhoneServer.exe" );
+
+_LIT( KPhServerThreadName, "PhoneServerThread" );
+_LIT( KPhServerThreadNameFormat, "0x%8x" );
+const TInt KPhMaxServerThreadNameLength = 30;
+const TUint KDefaultHeapSize = 0x10000;
+
+const TUid KUssdSecureId = { 0x10005955 };
+const TUid KSatSecureId = { 0x1000A833 };
+const TUid KPhoneSecureId = { 0x100058b3 };
+#if defined(__WINSCW__)
+const TUid KEunitExeRunnerId = {0x20000fb3 }; // To enable module testing using EUnit
+#endif // __WINSCW__
+
+// Phone client panic code - when the client is panicked by the server
+_LIT( KPhClientPanicCategory, "PhoneClient" );
+
+// Resource file for USSD part.
+_LIT( KPhClientAndServerResourceFileName, "PhoneServer" );
+_LIT( KPhCltServerZDrive, "z:" );
+
+_LIT( KPhClientAndServerResourceFileExtensionWild, ".R??" );
+_LIT( KPhClientAndServerResourceFileExtensionNoWild, ".RSC" );
+const TInt KPhSrvMagicResourceFileSignature = 0;
+
+// PhoneClient resource file.
+_LIT( KPhCltResourceFileNameAndPath, "phoneclient.rsc" );
+
+// The max amount of encoded USSD octects.
+const TInt KPhCltUssdMax7BitCharacterOctets = 
+    RMobileUssdMessaging::KGsmUssdDataSize; // 160
+// The max amount of characters to be encoded as USSD octects. 
+const TInt KPhCltUssdMax8BitCharacters = 
+    ( KPhCltUssdMax7BitCharacterOctets * 8 ) / 7; // 182
+
+
+// DATA TYPES
+
+// Server initiated Client Panics - when the client is
+// mis-using the server API
+enum TPhCltServerInitiatedPanic
+    {
+    EPhCltServerInitiatedPanicInvalidRequest = 0, // Request is invalid.
+    EPhCltServerInitiatedPanicInvalidHandle,      // Handle is invalid.
+    EPhCltServerInitiatedPanicBadDescriptor,      // Descriptor is invalid.
+    // Session request is inappropriate.
+    EPhCltServerInitiatedPanicInappropriateSessionRequest,
+    // The active object or request is already active.
+    EPhCltServerInitiatedPanicRequestAlreadyActive,
+    // The request is not active.
+    EPhCltServerInitiatedPanicRequestNotActive,
+
+    // From ussd
+    EPhCltServerInitiatedPanicNotAssigned,        // Not assigned.
+    EPhCltServerInitiatedPanicNotConnected,       // Connection not established.
+    // The handler is missing.
+    EPhCltServerInitiatedPanicNotifyHandlerMissing,
+    EPhCltServerInitiatedPanicWaitingIsUsed,      // Waiting is used.
+    //
+    EPhCltServerInitiatedPanicLast   // Keep as last.
+    };
+
+// Opcodes used in message passing between Phone Client and Phone Server.
+enum TPhCltServerRequest
+    {
+    /**
+    * ----> FROM RPhCltExtCall
+    */
+    EPhoneServerExtCallSubSessionOpen = 0,       // Open ExtCall subsession.
+    EPhoneServerExtCallSubSessionClose,          // Close ExtCall subsession.
+    EPhoneServerExtCallSubSessionMakeCall,       // Make a call.
+    EPhoneServerExtCallSubSessionMakeCallCancel, // Cancel call creation.
+
+    /**
+    * ----> FROM RPhCltCallNotify
+    */
+    EPhoneServerNotifySubSessionOpen = 100,      // Open notify subsession.
+    EPhoneServerNotifySubSessionClose,           // Close notify subsession.
+    // Notify call request attempt.
+    EPhoneServerNotifySubSessionNotifyCallRequest,
+    // Notify call request canceling.
+    EPhoneServerNotifySubSessionNotifyCallRequestCancel,
+    // Notify call status request.
+    EPhoneServerNotifySubSessionNotifyStatusRequest,
+    // Notify call status request cancel.
+    EPhoneServerNotifySubSessionNotifyStatusRequestCancel,
+    // Report phone status.
+    EPhoneServerNotifySubSessionReportPhoneStatus,
+    // Report phone status cancel.
+    EPhoneServerNotifySubSessionReportPhoneStatusCancel,
+    // Report the result of the call.
+    EPhoneServerNotifySubSessionReportCallResult,
+    // Notify dial data
+    EPhoneServerNotifySubSessionDialData,
+        
+
+    /**
+    * ----> FROM RPhCltUssd
+    */
+    EPhoneServerUSSDSubSessionOpen = 200,       // Open USSD subsession.
+    EPhoneServerUSSDSubSessionClose,            // Close USSD subsession.
+    EPhoneServerUSSDSubSessionSendMessage,      // Send USSD message.
+    EPhoneServerUSSDSubSessionSendMessageCancel,// Cancel USSD message sending.
+    EPhoneServerUSSDSubSessionStartEditing,     // Start Service command editor.
+    EPhoneServerUSSDSubSessionAppStarting,      // SCE is starting.
+    EPhoneServerUSSDSubSessionAppTerminating,   // SCE is terminating.
+    EPhoneServerUSSDSubSessionAppToForeground,  // SCE comes to foreground.
+    EPhoneServerUSSDSubSessionAppToBackground,  // SCE goes to background.
+    EPhoneServerUSSDSubSessionStartSAT,         // SAT session is started.
+    EPhoneServerUSSDSubSessionStopSAT,          // Stop SAT session.
+
+    /**
+    * ----> FROM RPhCltEmergencyNumber
+    */
+    EPhoneServerEmergencyNumberSubSessionOpen = 300, // Open EN subsession.
+    EPhoneServerEmergencyNumberSubSessionClose,      // Close EN subsession.
+    // Check is the number emergency number or not.
+    EPhoneServerEmergencyNumberSubSessionIsEmergencyNumber,
+    EPhoneServerEmergencyNumberSubsessionEmergencyDial,
+    EPhoneServerEmergencyNumberSubsessionEmergencyDialCancel,
+    /**
+    * ---> FROM RPhCltIhf
+    */
+    EPhoneServerIhfSubSessionOpen = 400,        // Open IHF subsession.
+    EPhoneServerIhfSubSessionClose,             // Close IHF subsession.
+    EPhoneServerIhfSubSessionSetMode,           // Set IHF mode.
+    EPhoneServerIhfSubSessionSetModeFromPhone,  // Set IHF mode from Phone app.
+
+    /**
+    * ----> Other
+    */
+    EPhoneCreateAll = 500,  // Create all subsessions
+
+    //
+    EPhoneServerLast,        // Keep as last for PhoneClient.
+
+    /**
+    * ----> Base for Phone Client extensions, that may be defined in some other
+    *       header file.    
+    */
+    EPhoneServerExtensionBase = 600,
+    
+    /**
+    * ----> FROM RPhCltEmergencyCallNotify
+    */
+    //EPhoneServerNotifyEmergencySubSessionOpen,
+    EPhoneServerNotifyEmergencySubSessionOpen = 1500,      // Open notify subsession.
+    EPhoneServerNotifyEmergencySubSessionClose,           // Close notify subsession.
+    // Notify call request attempt.
+    EPhoneServerNotifyEmergencySubSessionNotifyCallRequest,
+    // Notify call request canceling.
+    EPhoneServerNotifyEmergencySubSessionNotifyCallRequestCancel,
+    // Report the result of the call.
+    EPhoneServerNotifyEmergencySubSessionReportCallResult 
+   
+
+
+    };
+    
+    /**
+* Opcodes used in message passing between Phone Client and Phone Server.
+*/
+enum TPhCltComHandServerRequest
+    {
+    /**
+    * ---> FROM RPhCltCommandHandler
+    */
+    // Open command handler subsession.
+    EPhoneServerComHandSubSessionOpen = EPhoneServerExtensionBase, 
+    EPhoneServerComHandSubSessionClose,      // Close comhand subsession.
+    EPhoneServerComHandSubSessionAtd,        // Atd.
+    EPhoneServerComHandSubSessionAta,        // Ata.
+    EPhoneServerComHandSubSessionChld,       // Chld.
+    EPhoneServerComHandSubSessionChup,       // Chup.
+    EPhoneServerComHandSubSessionVts,        // Vts.
+    EPhoneServerComHandSubSessionCancel,     // Cancel ongoing request.
+    EPhoneServerComHandSubSessionMuteMic,    // MuteMic
+    EPhoneServerComHandSubSessionMuteRingingTone,   // MuteRingingTone
+
+    /**
+    * ----> FROM RPhCltCommandHandlerNotify
+    */
+    // Open command handler notify subsession.
+    EPhoneServerComHandNotifySubSessionOpen = EPhoneServerExtensionBase + 100,
+    // Close command handler notify subsession.
+    EPhoneServerComHandNotifySubSessionClose,
+    // Notify command handler request attempt.
+    EPhoneServerComHandNotifySubSessionComHandRequest,
+    // Notify command handler request canceling.
+    EPhoneServerComHandNotifySubSessionComHandRequestCancel,
+    // Report the result of the command handler request.
+    EPhoneServerComHandNotifySubSessionReportComHandResult,   
+    //
+    EPhoneServerComHandLast        // Keep as last.
+    };
+
+/**
+* Opcodes used in message passing between 
+* Phone Client Extension Messenger and Phone Server.
+*/
+enum TPhCltMessengerServerRequest
+    {
+    /**
+    * ---> FROM RPhCltMessenger
+    * @since 2.6
+    */
+    // Open Messenger subsession.
+    EPhoneServerMessengerSubSessionOpen = EPhoneServerExtensionBase + 200,
+    // Construct (reserve memory for) opened subsession.
+    EPhoneServerMessengerSubSessionConstruct,
+    EPhoneServerMessengerSubSessionClose,    // Close Messenger subsession.
+    EPhoneServerMessengerSubSessionReceive,  // Receive.
+    EPhoneServerMessengerSubSessionSend,     // Send.
+    EPhoneServerMessengerSubSessionCancel,   // CancelRequest.
+    EPhoneServerMessengerSubSessionSkip,     // Skip.
+
+    EPhoneServerMessengerLast                // Keep as last.
+    };
+
+/**
+* Opcodes used in message passing between 
+* Phone Client Extension and Phone Server.
+* Image handling specific.
+*
+* @since Series 60 3.0
+*/
+
+enum TPhCltImageHandlerRequest 
+    {
+    EPhoneServerImageHandlerSubSessionOpen = EPhoneServerExtensionBase + 300,
+    EPhoneServerImageHandlerSubSessionClose,     // Closes image handler subsession.
+    EPhoneServerImageHandlerSubSessionSave,      // SaveImages (deprecated for VT)
+    EPhoneServerImageHandlerSubSessionLoad,      // LoadImages (deprecated for VT)
+    EPhoneServerImageHandlerSubSessionCommitLoad, // Finalize load operation
+    EPhoneServerSaveVtImage,                    // saves VT image file
+    EPhoneServerOpenVtImage,                    // opens VT image file
+    EPhoneServerSaveVtImageCancel
+    };
+
+
+
+    /**
+* Enumerates fixed operator logo indexes.
+*
+* @since Series60 3.2
+*
+* EPhCltOperatorLogoIndex - only one logo at a time.
+* EPhCltCountryCode - logo specific country code.
+* EPhCltNetworkCode - logo specific country code.
+* EPhCltLogoTypeIndex - logo type
+*/
+enum TPhCltExtOperatorLogoIndexes
+    {
+    EPhCltExtIndexNotSet = -1,
+    EPhCltExtOperatorLogoIndex = 0,
+    EPhCltExtCountryCodeIndex,
+    EPhCltExtNetworkCodeIndex,
+    EPhCltExtLogoTypeIndex
+    };
+
+
+#endif      // PHCLTCLIENTSERVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/ussd/ussd_ext/rphcltussd.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,156 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  USSD subsession.
+*
+*/
+
+
+#ifndef RPHCLTUSSD_H
+#define RPHCLTUSSD_H
+
+// INCLUDES
+#include <e32std.h>
+#include <phclttypes.h> 
+#include <cphcltussd.h> 
+
+
+// FORWARD DECLARATIONS
+class RPhCltServer;
+
+
+// CLASS DECLARATION
+
+/**
+*  USSD subsession.
+*
+*  @lib phoneclient.lib
+*  @since 1.0
+*/
+class RPhCltUssd : public RSubSessionBase
+    {
+
+    public: // New functions        
+
+        /**
+        * Constructor.
+        */      
+        RPhCltUssd();
+
+        /**
+        * Creates a subsession with the phone server.
+        * 
+        * @param aServer Pre-opened PhCltServer session.
+        * @return Symbian OS standard error code.
+        */      
+        TInt Open( RPhCltServer& aServer );
+
+        /**
+        * Closes the session. Cancels all notify requests.
+        * Remember to call this to a connected session in some point.
+        */
+        void Close();
+
+        //------------------From app and phone idle-----------------------
+
+        /**
+        * Tells server to start sending the given string.
+        *
+        * @param aReqStatus Status request to be completed after sending.
+        * @param aMsgData The 7-bit buffer.
+        * @param aMsgAttribute Send definitions.
+        */
+        void SendUssd( 
+            TRequestStatus& aReqStatus, 
+            const TDesC8& aMsgData, 
+            const TDesC8& aMsgAttribute );
+
+        /**
+        * Informs the server that the active object taking care of notify 
+        * events has issued Cancel() so server can delete all notifys/events 
+        * concerning it and sent a cancel signal.
+        */      
+        void CancelSend();
+
+        //---------------From msg center-------------------
+
+        /**
+        * Starts editor. Creates own window server session.
+        *
+        * @return Error code.
+        */
+        TInt StartUssdEditor() const ;
+
+
+        // ------------ For SAT -------------------
+
+        /**
+        * Starts SAT session.
+        *
+        * @param aStatus Completed status.
+        * @param aReceiveMessage Received message.
+        * @param aShowNotesAndDcs Contains the information of note showing,
+        *                         ( Phone Client -> Phone Server ) and
+        *                         The used dcs in received message
+        *                         ( Phone Server -> Phone Client ).
+        */
+        void StartSAT( 
+            TRequestStatus& aStatus, 
+            TDes& aReceiveMessage, 
+            TPckg< TUint >& aShowNotesAndDcs );
+
+        /**
+        * Cancels SAT session.
+        */ 
+        void StopSAT();
+
+
+
+        //--------------------- From app ------------------------------
+
+        /**
+        * UI informs that it is been created
+        * 
+        * @return Error code.
+        */
+       TInt AppStarting();
+
+        /**
+        * UI informs that it is terminating.
+        *
+        * @param aExitReason The reason why the application was terminated.
+        * @return Error code.
+        */
+        TInt AppTerminating( 
+            TPhCltUssdAppExitReason aExitReason );
+
+        /**
+        * UI informs that it is brougth to foreground.
+        *
+        * @return Should the editor be emptied?
+        */
+        TBool AppToForeground();
+
+        /**
+        * UI informs that it is gone background.
+        *
+        * @return Error code.
+        */
+        TInt AppToBackground();
+
+
+
+
+    };
+
+#endif // RPHCLTUSSD_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/ussdwrapper/cphcltussdnotecontroller.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,114 @@
+/*
+* 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:  Encapsulates an active object used in controlling notes.
+*
+*/
+
+
+#ifndef CPHCLTUSSDNOTECONTROLLER_H
+#define CPHCLTUSSDNOTECONTROLLER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <hbdeviceprogressdialogsymbian.h>
+#include "mphcltussdnotecontrollercallback.h" 
+#include "cphcltussdcommonconstant.h"
+
+
+// CLASS DECLARATION
+
+/**
+*   Encapsulates an active object used in controlling notes.
+*
+*  @lib phoneclient.lib
+*/
+NONSHARABLE_CLASS( CPhCltUssdNoteController ) : public CBase,
+                                                public MHbDeviceProgressDialogObserver
+    {
+    public:  // Constructor and destructor
+
+        /**
+        * Two-phased constructor.
+        * 
+        * @param aCallBack a callback to be notified events from note controller.
+        * @param aPriority active object priority.
+        * @return Pointer to created CPhCltUssdImp instance.
+        */
+        static CPhCltUssdNoteController* NewL( 
+                MPhCltUssdNoteControllerCallBack& aCallBack );
+
+        /**
+        * Destructor.
+        */
+        ~CPhCltUssdNoteController();
+
+    public:
+
+        /**
+        * Shows global Information note.
+        */
+        void ShowGlobalInformationNoteL( const TPhCltUssdInformationType aInfoType );
+
+        /**
+        * Shows global wait note.
+        */
+        void ShowGlobalWaitNoteL();
+
+        /**
+        * Destroys global wait note.
+        */
+        void DestroyGlobalWaitNote();
+
+        /**
+        * From base class MHbDeviceProgressDialogObserver
+        */
+        void ProgressDialogCancelled(
+            const CHbDeviceProgressDialogSymbian* aProgressDialog);
+
+        /**
+        * From base class MHbDeviceProgressDialogObserver
+        */
+        void ProgressDialogClosed(
+            const CHbDeviceProgressDialogSymbian* aProgressDialog);
+
+    private:
+
+        /**
+        * C++ constructor.
+        */
+        CPhCltUssdNoteController( 
+            MPhCltUssdNoteControllerCallBack& aCallBack );
+
+        /**
+        * Symbian 2nd phase constructor.
+        */
+        void ConstructL();
+
+    private:    // Data
+
+        /**
+        * Own,Global wait note.
+        */
+        CHbDeviceProgressDialogSymbian* iGlobalWaitNote;
+
+        /**
+        * Not own,callback to be notified when wait note is dismissed.
+        */
+        MPhCltUssdNoteControllerCallBack& iCallBack;
+
+    };
+
+#endif // CPHCLTUSSDNOTECONTROLLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/ussdwrapper/cphcltussdrequesthandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,126 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 an active object used in notify services.
+*
+*/
+
+
+#ifndef CPHCLTUSSDREQUESTHANDLER_H
+#define CPHCLTUSSDREQUESTHANDLER_H
+
+// INCLUDES
+#include <e32base.h>
+#include "rphcltussd.h"
+#include "rphcltserver.h" 
+
+// FORWARD DECLARATIONS
+class MPhCltUssdRequestHandler;
+
+// CLASS DECLARATION
+
+/**
+*  Encapsulates an active object used in notify services.
+*
+*  @lib phoneclient.lib
+*  @since 1.0
+*/
+NONSHARABLE_CLASS( CPhCltUssdRequestHandler ) : public CActive
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        * 
+        * @param aHandler Handler for the USSD messages.
+        * @param aPriority Priority to be used.
+        * @return Pointer to created CPhCltUssdRequestHandler instance.
+        */        
+        static CPhCltUssdRequestHandler* NewL( 
+            MPhCltUssdRequestHandler& aHandler,
+            TInt aPriority );
+        
+        /**
+        * Destructor.
+        */
+        ~CPhCltUssdRequestHandler();
+
+
+    public:
+
+        /**
+        * Send string.
+        *
+        * @param aMsgData 7-bit data.
+        * @param aMsgAttribute Definitions.
+        */
+        void SendUssd( 
+            const TDesC8& aMsgData, 
+            const TDesC8& aMsgAttribute );
+
+        /**
+        * Cancel send.
+        */
+        void SendUssdCancel();
+        
+        /**
+        * USSD Client
+        *                 
+        * @return Reference to RPhCltUssd instance.
+        */  
+        RPhCltUssd& UssdClient();
+        
+
+    private: // From base classes
+        
+        /*
+        * From CActive. Called when send is done.
+        */
+        void RunL();
+
+        /**
+        * From CActive. Called when send is cancelled.
+        */
+        void DoCancel();
+
+
+    private:
+
+        /**
+        * C++ constructor.
+        */
+        CPhCltUssdRequestHandler( 
+            MPhCltUssdRequestHandler& aHandler,
+            TInt aPriority );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+        
+
+    private:    // Data
+
+        // The handler for requests.
+        MPhCltUssdRequestHandler& iHandler;
+
+        // Server connection to be used to perform functionality.
+        RPhCltServer iPhClient;
+
+        // USSD subsession to server side.
+        RPhCltUssd iUssdClient;
+    };
+
+#endif // CPHCLTUSSDREQUESTHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/ussdwrapper/mphcltussdnotecontrollercallback.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Mixing class for CPhCltUssdNoteController. 
+*
+*/
+
+
+#ifndef MPHCLTUSSDNOTECONTROLLERCALLBACK_H
+#define MPHCLTUSSDNOTECONTROLLERCALLBACK_H
+
+// INCLUDES
+#include <e32std.h>
+
+
+// CLASS DECLARATION
+
+/**
+*  Abstract interface for handling the notify events from note controller.
+*  User derives his class from this and implements GlobalWaitNoteHidden().
+*
+*  @lib phoneclient.lib
+*  @since 9.1
+*/
+
+class MPhCltUssdNoteControllerCallBack
+    {
+    
+    public: // New functions
+
+        /**
+        * Called when global wait note is hidden, to background.
+        * 
+        * @param aError Error code.
+        */    
+        virtual void GlobalWaitNoteHidden() = 0;
+    };
+
+
+#endif //MPHCLTUSSDNOTECONTROLLERCALLBACK_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/ussdwrapper/mphcltussdrequesthandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Abstract interface for handling the notify events 
+*                from the server.
+*
+*/
+
+#ifndef MPHCLTUSSDREQUESTHANDLER_H
+#define MPHCLTUSSDREQUESTHANDLER_H
+
+// INCLUDES
+#include <e32std.h>
+
+
+// CLASS DECLARATION
+
+/**
+*  Abstract interface for handling the notify events from the server.
+*  User derives his class from this and implements HandleNotifyL().
+*
+*  @lib phoneclient.lib
+*  @since 1.0
+*/
+
+class MPhCltUssdRequestHandler
+    {
+    
+    public: // New functions
+
+        /**
+        * Called when send completes.
+        * 
+        * @param aError Error code.
+        */    
+        virtual void HandleSendEventL( const TInt aError ) = 0;
+    };
+
+
+#endif // MPHCLTUSSDREQUESTHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/inc/ussdwrapper/ussd_ext/cphcltussdimp.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,226 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Interface for sending messages.
+*
+*/
+
+
+#ifndef CPHCLTUSSDIMP_H
+#define CPHCLTUSSDIMP_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "mphcltussdrequesthandler.h" 
+#include "mphcltussdnotecontrollercallback.h" 
+#include "rphcltussd.h"
+
+#include "rphcltserver.h" 
+#include "cphcltussdint.h" 
+
+
+// FORWARD DECLARATIONS
+class CPhCltUssdRequestHandler;
+class CPhCltUssdNoteController;
+
+
+// CLASS DECLARATION
+
+/**
+*  Interface for sending messages.
+*
+*  @lib phoneclient.lib
+*  @since 1.0
+*/
+class CPhCltUssdImp:
+    public CPhCltUssdInt,
+    public MPhCltUssdRequestHandler, 
+    public MPhCltUssdNoteControllerCallBack
+    
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        *
+        * @param aShowNotes If ETrue, notes are shown.
+        * @return Pointer to created CPhCltUssdImp instance.
+        */
+        static CPhCltUssdImp* NewL( TBool aShowNotes = ETrue );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CPhCltUssdImp();
+        
+     
+     
+     public: // New functions
+
+        /**
+        * Send Ussd string to network with default DCS.
+        *
+        * @param aMsgData Unicode string to be sent.
+        * @return Error code.
+        */
+        virtual TInt SendUssd( const TDesC& aMsgData  );
+
+        /**
+        * Send Ussd buffer to network with default DCS.
+        *
+        * @param aMsgData 7-bit buffer to be sent.
+        * @return Error code.
+        */
+        virtual TInt SendUssd( const TDesC8& aMsgData );
+
+        /**
+        * Send Ussd buffer to network with given DCS.
+        *
+        * @param aMsgData 7-bit buffer to be sent.
+        * @param iSendDcs Specifies DCS and the send type.
+        * @return Error code.
+        */
+        virtual TInt SendUssd( 
+            const TDesC8& aMsgData, 
+            const TUint8 iSendDcs );
+
+        /**
+        * Cancels outstanding Send request.
+        */
+        virtual void SendUssdCancel(); 
+        
+        /**
+        * Starts editor. Creates own window server session.
+        *
+        * @return Error code.
+        */
+        TInt StartUssdEditor() const;
+        
+        /**
+        * UI informs that it is been created
+        * 
+        * @return Error code.
+        */
+        virtual TInt AppStarting(); 
+        
+        /**
+        * UI informs that it is terminating.
+        *
+        * @param aExitReason The reason why the application was terminated.
+        * @return Error code.
+        */
+        virtual TInt AppTerminating( 
+            TPhCltUssdAppExitReason aExitReason );
+            
+        /* UI informs that it is brougth to foreground.
+        *
+        * @return Should the editor be emptied?
+        */
+        virtual TBool AppToForeground();
+        
+        /**
+        * UI informs that it is gone background.
+        *
+        * @return Error code.
+        */
+        virtual TInt AppToBackground();
+        
+        
+        /**
+        * Starts SAT session.
+        *
+        * @param aStatus Completed status.
+        * @param aReceiveMessage Received message.
+        * @param aShowNotesAndDcs Contains the information of note showing,
+        *                         ( Phone Client -> Phone Server ) and
+        *                         The used dcs in received message
+        *                         ( Phone Server -> Phone Client ).
+        */
+        void StartSAT( 
+            TRequestStatus& aStatus, 
+            TDes& aReceiveMessage, 
+            TPckg< TUint >& aShowNotesAndDcs );
+        
+        /**
+        * Cancels SAT session.
+        */ 
+        void StopSAT();
+        
+        /**
+        * Set data coding scheme
+        * 
+        * @param aDCS data coding scheme value
+        */
+        void SetDCS( TUint8 aDCS );
+        
+        
+         
+     protected:  // From base classes
+        
+
+        // Called when send completes.
+        void HandleSendEventL( const TInt aError );
+
+        // Hidden when the user cancel the wait dialog.
+        void GlobalWaitNoteHidden();
+        
+        
+
+    private: // New functions
+
+        // Constructor. 
+         CPhCltUssdImp();
+
+        // Symbian 2nd phase constructor.
+        void ConstructL( TBool aShowNotes );
+
+        // Encodes the message.
+        void EncodeL( const TDesC& aSrc, TDes8& aDes );
+        
+        // Finds CR character        
+        void FindFirstCarriageReturnL( 
+        const TDesC& aBuffer ,
+        TUint& aSkipChars , 
+        TUint& aStartBit );
+        
+    private:    // Data
+
+        // The handler of the request.
+        CPhCltUssdRequestHandler* iRequestHandler;
+
+        // Wait scheduler used in this class. 
+        CActiveSchedulerWait* iWait;
+
+        // TInt to sending error store place.
+        TInt iSendError;
+        
+        // Data coding scheme value
+        TUint8 iDCS;
+        
+        // Data coding scheme value for ussd sending
+        TUint8 iDCS2;
+        
+        //RPhCltUssd class instance
+        RPhCltUssd  iCltUssd;
+        
+        //RPhCltServer class instance creates phonesession
+        RPhCltServer iServer;
+        
+        //CPhCltUssdNoteController class instance
+        CPhCltUssdNoteController* iNoteController;
+        
+    };
+
+#endif // CPHCLTUSSDIMP_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/rom/phoneclient.iby	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,25 @@
+/*
+* 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:  IBY file of PhoneClient
+*
+*/
+
+
+#ifndef __PHONECLIENT_IBY__
+#define __PHONECLIENT_IBY__
+
+
+file=ABI_DIR\BUILD_DIR\phoneclient.dll              SHARED_LIB_DIR\phoneclient.dll
+data=ZSYSTEM\install\phoneclient_stub.sis           system\install\phoneclient_stub.sis
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/commandhandler/cphcltcomhandimplementation.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,184 @@
+/*
+* Copyright (c) 2003-2004 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of the PhoneClient  interface.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "cphcltcomhandimplementation.h" 
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhCltCommandHandlerImplementation::CPhCltCommandHandlerImplementation
+// 
+// C++ constructor can NOT contain any code, that might leave.
+// -----------------------------------------------------------------------------
+//
+CPhCltCommandHandlerImplementation::CPhCltCommandHandlerImplementation()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltCommandHandlerImplementation::ConstructL
+// 
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CPhCltCommandHandlerImplementation::ConstructL()
+    {
+    User::LeaveIfError( iServer.Connect() );    
+    User::LeaveIfError (iCommandHandler.Open( iServer ) ); 
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltCommandHandlerImplementation::NewL
+// 
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPhCltCommandHandlerImplementation* CPhCltCommandHandlerImplementation::NewL()
+    {
+    CPhCltCommandHandlerImplementation* self = 
+        new (ELeave) CPhCltCommandHandlerImplementation();   
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+    
+
+// -----------------------------------------------------------------------------
+// CPhCltCommandHandlerImplementation::~CPhCltCommandHandlerImplementation
+// 
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CPhCltCommandHandlerImplementation::~CPhCltCommandHandlerImplementation()
+    {
+    // Close Subsession.
+    iCommandHandler.Close();
+    iServer.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltCommandHandlerImplementation::Atd
+// 
+// Dial. Only voice call is supported.
+// -----------------------------------------------------------------------------
+//
+void CPhCltCommandHandlerImplementation::Atd(
+    TRequestStatus& aStatus, 
+    const TPhCltTelephoneNumber& aTelephoneNumber )
+    {
+    iCommandHandler.Atd( aStatus, aTelephoneNumber );
+    }
+ 
+// -----------------------------------------------------------------------------
+// CPhCltCommandHandlerImplementation::Ata
+// 
+// Answer the call. 
+// -----------------------------------------------------------------------------
+//
+void CPhCltCommandHandlerImplementation::Ata(
+    TRequestStatus& aStatus )
+    {
+    iCommandHandler.Ata( aStatus );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltCommandHandlerImplementation::Chld
+// 
+// Call hold and multiparty handling.
+// -----------------------------------------------------------------------------
+//
+void CPhCltCommandHandlerImplementation::Chld(
+    TRequestStatus& aStatus, 
+    const TPhCltChldCommand aChldCommand,
+    const TUint aCallNumber )
+    {
+    iCommandHandler.Chld( aStatus, aChldCommand, aCallNumber );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltCommandHandlerImplementation::Chup
+// 
+// Hangup current call.
+// -----------------------------------------------------------------------------
+//
+void CPhCltCommandHandlerImplementation::Chup(
+    TRequestStatus& aStatus )
+    {
+    iCommandHandler.Chup( aStatus );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltCommandHandlerImplementation::Vts
+// 
+// DTMF sending, starting and stopping in same function. 
+// -----------------------------------------------------------------------------
+//
+void CPhCltCommandHandlerImplementation::Vts(
+    TRequestStatus& aStatus, 
+    const TPhCltDtmfTone aDtmfTone,
+    const TPhCltDtmfAction aAction )
+    {
+    iCommandHandler.Vts( aStatus, aDtmfTone, aAction );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltCommandHandlerImplementation::CancelAsyncRequest
+// 
+// Cancel the ongoing asynchronous request.
+// -----------------------------------------------------------------------------
+//
+void CPhCltCommandHandlerImplementation::CancelAsyncRequest( 
+    const TPhCltComHandCommand aReqToCancel )
+    {
+    iCommandHandler.CancelAsyncRequest( aReqToCancel );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltCommandHandlerImplementation::MuteMicrophone
+// -----------------------------------------------------------------------------
+//
+
+void CPhCltCommandHandlerImplementation::MuteMicrophone( 
+    TRequestStatus& aStatus, const TBool aMute )
+    {
+    iCommandHandler.MuteMicrophone( aStatus, aMute );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltCommandHandlerImplementation::MuteRingingTone
+// -----------------------------------------------------------------------------
+//
+
+void CPhCltCommandHandlerImplementation::MuteRingingTone( 
+    TRequestStatus& aStatus  )
+    {
+    iCommandHandler.MuteRingingTone( aStatus );
+    }
+    
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/commandhandler/cphcltcommandhandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Command Handler Base class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "cphcltcommandhandler.h" 
+#include    "cphcltcomhandimplementation.h" 
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhCltCommandHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CPhCltCommandHandler* CPhCltCommandHandler::NewL()
+    {
+    return CPhCltCommandHandlerImplementation::NewL();
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltCommandHandler::CPhCltCommandHandler
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPhCltCommandHandler::CPhCltCommandHandler( )
+    {
+    }
+    
+
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/commandhandler/rphcltcommandhandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,272 @@
+/*
+* Copyright (c) 2003-2004 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class is used to perform command handler originated 
+*                commands.
+*
+*/
+
+
+
+// INCLUDES
+
+#include    "rphcltcommandhandler.h" 
+#include    <rphcltserver.h> 
+#include    <phclttypes.h> 
+#include    "phcltclientserver.h" 
+#include    <e32std.h>
+#include    <e32base.h>
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// RPhCltCommandHandler::RPhCltCommandHandler
+// 
+// C++ constructor can NOT contain any code, that might leave.
+// -----------------------------------------------------------------------------
+//
+RPhCltCommandHandler::RPhCltCommandHandler()
+:   RSubSessionBase(),
+    iComHandParams( TPhCltComHandCommandParameters() )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltCommandHandler::Open
+// 
+// Open subsession to Phone Server.
+// -----------------------------------------------------------------------------
+//
+TInt RPhCltCommandHandler::Open( RPhCltServer& aServer )
+    {
+    __ASSERT_ALWAYS( aServer.Handle(), User::Panic( 
+            KPhClientPanicCategory, 
+            EPhCltClientSidePanicNullHandle ) );
+
+    return CreateSubSession( 
+        aServer, 
+        EPhoneServerComHandSubSessionOpen, 
+        TIpcArgs() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltCommandHandler::Close
+// 
+// Close subsession.
+// -----------------------------------------------------------------------------
+//
+void RPhCltCommandHandler::Close()
+    {
+    CloseSubSession( EPhoneServerComHandSubSessionClose );
+    }
+
+// -----------------------------------------------------------------------------
+// RPhCltCommandHandler::Atd
+// 
+// Dial. Only voice call is supported.
+// -----------------------------------------------------------------------------
+//
+void RPhCltCommandHandler::Atd(
+    TRequestStatus& aStatus, 
+    const TPhCltTelephoneNumber& aTPhCltTelephoneNumber )
+    {
+    __ASSERT_ALWAYS( SubSessionHandle(), User::Panic( 
+        KPhClientPanicCategory, EPhCltClientSidePanicNullHandle ) );
+
+    // This is Atd function call.
+    iComHandParams().iCommandHandlerCommand = EPhCltCommandAtd;
+    iComHandParams().iTelNumber = aTPhCltTelephoneNumber;
+    SendReceive( 
+        EPhoneServerComHandSubSessionAtd, 
+        TIpcArgs( &iComHandParams ), 
+        aStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// RPhCltCommandHandler::Ata
+// 
+// Answer the call. 
+// -----------------------------------------------------------------------------
+//
+void RPhCltCommandHandler::Ata(
+    TRequestStatus& aStatus )
+    {
+    __ASSERT_ALWAYS( 
+        SubSessionHandle(), User::Panic( 
+            KPhClientPanicCategory, EPhCltClientSidePanicNullHandle ) );
+
+    // This is Ata function call.
+    iComHandParams().iCommandHandlerCommand = EPhCltCommandAta;
+
+    // Ata method does not have parameters <=> Uniformity reason for this.
+    SendReceive( 
+        EPhoneServerComHandSubSessionAta, 
+        TIpcArgs( &iComHandParams ),
+        aStatus );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltCommandHandler::Chld
+// 
+// Call hold and multiparty handling.
+// -----------------------------------------------------------------------------
+//
+void RPhCltCommandHandler::Chld(
+    TRequestStatus& aStatus, 
+    const TPhCltChldCommand aChldCommand,
+    const TUint aCallNumber )
+    {
+    __ASSERT_ALWAYS( 
+        SubSessionHandle(), User::Panic( 
+            KPhClientPanicCategory, EPhCltClientSidePanicNullHandle ) );
+
+    // Save the chld arguments.
+    iComHandParams().iChldCommand    = aChldCommand;
+    iComHandParams().iChldCallNumber = aCallNumber;
+    
+    // This is Chld function call.
+    iComHandParams().iCommandHandlerCommand = EPhCltCommandChld;
+
+    SendReceive( 
+        EPhoneServerComHandSubSessionChld, 
+        TIpcArgs( &iComHandParams ),
+        aStatus );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltCommandHandler::Chup
+// 
+// Hangup current call.
+// -----------------------------------------------------------------------------
+//
+void RPhCltCommandHandler::Chup(
+    TRequestStatus& aStatus )
+    {
+    __ASSERT_ALWAYS( 
+        SubSessionHandle(), User::Panic( 
+            KPhClientPanicCategory, EPhCltClientSidePanicNullHandle ) );
+
+    // This is Chup function call.
+    iComHandParams().iCommandHandlerCommand = EPhCltCommandChup;
+
+    // Chup method does not have parameters <=> Uniformity reason for this.
+    SendReceive( 
+        EPhoneServerComHandSubSessionChup, 
+        TIpcArgs( &iComHandParams ),
+        aStatus );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltCommandHandler::Vts
+// 
+// DTMF sending, starting and stopping in same function. 
+// -----------------------------------------------------------------------------
+//
+void RPhCltCommandHandler::Vts(
+    TRequestStatus& aStatus, 
+    const TPhCltDtmfTone aDtmfTone,
+    const TPhCltDtmfAction aAction )
+    {
+    __ASSERT_ALWAYS( 
+        SubSessionHandle(), User::Panic( 
+            KPhClientPanicCategory, EPhCltClientSidePanicNullHandle ) );
+
+    // Save the Vts arguments.
+    iComHandParams().iDtmfTone   = aDtmfTone;
+    iComHandParams().iDtmfAction = aAction;
+    
+    // This is Vts function call.
+    iComHandParams().iCommandHandlerCommand = EPhCltCommandVts;
+
+    SendReceive( 
+        EPhoneServerComHandSubSessionVts, 
+        TIpcArgs( &iComHandParams ),
+        aStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// RPhCltCommandHandler::CancelAsyncRequest
+// 
+// Cancel the ongoing asynchronous request.
+// -----------------------------------------------------------------------------
+//
+void RPhCltCommandHandler::CancelAsyncRequest( 
+    const TPhCltComHandCommand aReqToCancel )
+    {
+    __ASSERT_ALWAYS( SubSessionHandle(), User::Panic( 
+        KPhClientPanicCategory, EPhCltClientSidePanicNullHandle ) );
+
+    // Save the cancel arguments.
+    iComHandParams().iCommandHandlerCommand = aReqToCancel;
+
+    SendReceive( 
+        EPhoneServerComHandSubSessionCancel, 
+        TIpcArgs( &iComHandParams ) );
+    }
+
+// -----------------------------------------------------------------------------
+// RPhCltCommandHandler::MuteMicrophone
+// 
+// -----------------------------------------------------------------------------
+//
+void RPhCltCommandHandler::MuteMicrophone(
+    TRequestStatus& aStatus, const TBool aMute )
+    {
+    __ASSERT_ALWAYS( SubSessionHandle(), User::Panic( 
+        KPhClientPanicCategory, EPhCltClientSidePanicNullHandle ) );
+    
+    // Save the MuteMic arguments.
+    iComHandParams().iMute = aMute;
+
+     // This is MuteMic function call.
+    iComHandParams().iCommandHandlerCommand = EPhCltCommandMuteMic;
+
+    // MuteMic method does not have parameters <=> Uniformity reason for this.
+    SendReceive( 
+        EPhoneServerComHandSubSessionMuteMic, 
+        TIpcArgs( &iComHandParams ),
+        aStatus );
+
+    }
+
+// -----------------------------------------------------------------------------
+// RPhCltCommandHandler::MuteRingingTone
+// 
+// -----------------------------------------------------------------------------
+//
+void RPhCltCommandHandler::MuteRingingTone(
+    TRequestStatus& aStatus )
+    {
+    __ASSERT_ALWAYS( SubSessionHandle(), User::Panic( 
+        KPhClientPanicCategory, EPhCltClientSidePanicNullHandle ) );
+
+     // This is MuteRingingTone function call.
+    iComHandParams().iCommandHandlerCommand = EPhCltCommandMuteRingingTone;
+
+    // MuteRingingTone method does not have parameters <=> Uniformity reason for this.
+    SendReceive( 
+        EPhoneServerComHandSubSessionMuteRingingTone, 
+        TIpcArgs( &iComHandParams ),
+        aStatus );
+
+    }    
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/commandhandler/rphcltcommandhandlernotify.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2003-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:  Observer getting notifications about command handler requests
+*                from Phone Server.
+*
+*/
+
+
+
+//  INCLUDES
+
+#include    "rphcltcommandhandlernotify.h" 
+#include    <rphcltserver.h> 
+#include    <phclttypes.h> 
+#include    "phcltclientserver.h" 
+#include    <e32base.h>
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// RPhCltCommandHandlerNotify::RPhCltCommandHandlerNotify
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+RPhCltCommandHandlerNotify::RPhCltCommandHandlerNotify()
+:   RSubSessionBase()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltCommandHandlerNotify::Open
+// 
+// Open subsession to Phone Server.
+// -----------------------------------------------------------------------------
+//
+TInt RPhCltCommandHandlerNotify::Open( RPhCltServer& aServer )
+    {
+    return CreateSubSession( 
+        aServer, 
+        EPhoneServerComHandNotifySubSessionOpen, 
+        TIpcArgs() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltCommandHandlerNotify::Close
+// 
+// Close subsession.
+// -----------------------------------------------------------------------------
+//
+void RPhCltCommandHandlerNotify::Close()
+    {
+    CloseSubSession( EPhoneServerComHandNotifySubSessionClose );
+    }
+    
+
+// -----------------------------------------------------------------------------
+// RPhCltCommandHandlerNotify::NotifyComHandCommand
+// 
+// Notifies when a Command handler request arrives.
+// -----------------------------------------------------------------------------
+//
+void RPhCltCommandHandlerNotify::NotifyComHandCommand( 
+    TRequestStatus& aStatus, 
+    TDes8& aCommandArgs )
+    {
+    SendReceive( 
+        EPhoneServerComHandNotifySubSessionComHandRequest, 
+        TIpcArgs( &aCommandArgs ),
+        aStatus );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltCommandHandlerNotify::CancelNotifyComHandCommand
+// 
+// Cancel pending command handler request notification.
+// -----------------------------------------------------------------------------
+//
+void RPhCltCommandHandlerNotify::CancelNotifyComHandCommand() const
+    {
+    SendReceive( 
+        EPhoneServerComHandNotifySubSessionComHandRequestCancel, 
+        TIpcArgs() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltCommandHandlerNotify::RespondClient
+// 
+// Respond to client's command handler request.
+// -----------------------------------------------------------------------------
+//
+TInt RPhCltCommandHandlerNotify::RespondClient( 
+    const TInt aResultCode )
+    {
+    return Send( 
+        EPhoneServerComHandNotifySubSessionReportComHandResult, 
+        TIpcArgs( aResultCode ) );
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/emergencynumber/emergencynumber_aiw/cphcltemergencycall.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CPhCltEmergencyCall class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "cphcltemergencycall.h" 
+#include    "cphcltemergencycallimpl.h" 
+#include    "phclttypes.h" 
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhCltEmergencyCall::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CPhCltEmergencyCall* CPhCltEmergencyCall::NewL( 
+    MPhCltEmergencyCallObserver* aObserver )
+    {
+    return CPhCltEmergencyCallImpl::NewL( aObserver );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltEmergencyCall::CPhCltEmergencyCall
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPhCltEmergencyCall::CPhCltEmergencyCall( MPhCltEmergencyCallObserver* aObserver )
+    : CActive( EPriorityStandard ), iObserver( aObserver )
+    {
+    }
+    
+
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/emergencynumber/emergencynumber_aiw/cphcltemergencycallimpl.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,200 @@
+/*
+* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation of CPhCltEmergencyCallImpl class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "rphcltserver.h" 
+#include "cphcltemergencycallimpl.h" 
+#include "mphcltemergencycallobserver.h" 
+
+_LIT( KEmNumber, "112" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+// -----------------------------------------------------------------------------
+// CPhCltEmergencyCallImpl::CPhCltEmergencyCallImpl
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPhCltEmergencyCallImpl::CPhCltEmergencyCallImpl( 
+    MPhCltEmergencyCallObserver* aObserver ) : 
+        CPhCltEmergencyCall( aObserver ), 
+        iEmergencyCallNumberPtr( NULL, 0 )
+    {
+    CActiveScheduler::Add( this );
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhCltEmergencyCallImpl::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPhCltEmergencyCallImpl* CPhCltEmergencyCallImpl::NewL(
+    MPhCltEmergencyCallObserver* aObserver )
+    {
+    CPhCltEmergencyCallImpl* self = 
+        new ( ELeave ) CPhCltEmergencyCallImpl( aObserver);
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self ); 
+    return self;
+    }
+    
+// Destructor
+CPhCltEmergencyCallImpl::~CPhCltEmergencyCallImpl()
+    { 
+    Cancel();
+    iEmergencyCall.Close(); 
+    iServer.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltEmergencyCallImpl::ConstructL
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhCltEmergencyCallImpl::ConstructL()
+    {
+    User::LeaveIfError( iServer.Connect() );
+    User::LeaveIfError( iEmergencyCall.Open( iServer ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltEmergencyCallImpl::RunL
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhCltEmergencyCallImpl::RunL()
+    {
+    // inform observer
+    if(iObserver)
+        {
+        iObserver->HandleEmergencyDialL( iStatus.Int() );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltEmergencyCallImpl::DoCancel
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhCltEmergencyCallImpl::DoCancel()
+    {
+    iEmergencyCall.CancelDialEmergencyCall();
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhCltEmergencyCallImpl::IsEmergenyPhoneNumber
+// 
+// -----------------------------------------------------------------------------
+//
+TInt CPhCltEmergencyCallImpl::IsEmergencyPhoneNumber( 
+    const TDesC& aNumber, 
+    TBool& aIsEmergencyNumber )
+    {
+    return iEmergencyCall.IsEmergencyPhoneNumber( 
+        aNumber, 
+        aIsEmergencyNumber );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltEmergencyCallImpl::IsEmergenyPhoneNumber
+// 
+// -----------------------------------------------------------------------------
+//
+TInt CPhCltEmergencyCallImpl::IsEmergencyPhoneNumber( 
+    const TDesC& aNumber,
+    TDes& aMatchedEmergencyNumber, 
+    TBool& aIsEmergencyNumber )
+    {
+   
+    return iEmergencyCall.IsEmergencyPhoneNumber( 
+        aNumber,
+        aMatchedEmergencyNumber, 
+        aIsEmergencyNumber );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltEmergencyCallImpl::FindEmergencyPhoneNumber
+// 
+// -----------------------------------------------------------------------------
+//
+TInt CPhCltEmergencyCallImpl::FindEmergencyPhoneNumber( 
+    TDes& aNumber, 
+    TBool& aIsEmergencyNumber )
+    {
+    return iEmergencyCall.FindEmergencyPhoneNumber( 
+        aNumber, 
+        aIsEmergencyNumber );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltEmergencyCallImpl::DialEmergencyCallL
+// 
+// Sends a dial request to the server.
+// -----------------------------------------------------------------------------
+//
+void CPhCltEmergencyCallImpl::DialEmergencyCallL( 
+    const TDesC& aNumber )
+    {
+    TBool isEmNumber( EFalse );
+    TInt error( KErrNone );
+    DialEmergencyPreconditionCheckL();
+    
+    if ( aNumber.Length() < 1 )
+        {
+        iEmergencyCallNumber.Copy( KEmNumber );
+        }
+    else
+        {
+        TPhCltEmergencyNumber matchedEmNumber; 
+        error = IsEmergencyPhoneNumber( aNumber, 
+            matchedEmNumber, isEmNumber );
+        
+        if ( !isEmNumber  || error )
+            {
+            User::Leave( KErrArgument );
+            }    
+        iEmergencyCallNumber = matchedEmNumber;
+        }
+        
+    iEmergencyCallNumberPtr.Set( 
+        reinterpret_cast<const TText8*>( &iEmergencyCallNumber ), 
+        sizeof( TPhCltEmergencyNumber ) );
+    iEmergencyCall.DialEmergencyCall( iStatus, iEmergencyCallNumberPtr );
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltEmergencyCallImpl::DialEmergencyPreconditionCheckL
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhCltEmergencyCallImpl::DialEmergencyPreconditionCheckL()
+    {
+    if( IsActive() )
+        {
+        User::Leave( KErrInUse );
+        }
+    if( iEmergencyCall.SubSessionHandle() == 0 )
+        {
+        User::Leave( KErrBadHandle );
+        }
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/emergencynumber/emergencynumber_aiw/rphcltemergencycall.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,373 @@
+/*
+* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation of RPhCltEmergencyCall class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <cphcltemergencycall.h> // for TPhCltEmergencyNumber
+#include    "rphcltemergencycall.h" 
+#include    "phcltclientserver.h" 
+#include    "phcltutils.h" 
+
+// CONSTANTS
+_LIT( KPhCltDtmfCharp, "p" );
+_LIT( KPhCltDtmfCharw, "w" );
+_LIT( KPhCltSsCLIRSuppress, "*31#" );    // Outgoing CLI Release (release)
+_LIT( KPhCltSsCLIRInvoke, "#31#" );   // Outgoing CLI Release (withhold)
+
+// Emergency number (number part) max size
+const TInt KPhCltMaxEmergencyNumberLength = 6; 
+// Min length of CLIR
+const TInt KPhCltMinSsStringLength = 4; 
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// RPhCltEmergencyCall::RPhCltEmergencyCall
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+RPhCltEmergencyCall::RPhCltEmergencyCall() 
+    : RSubSessionBase()
+    {    
+    }
+
+// -----------------------------------------------------------------------------
+// RPhCltEmergencyCall::Open
+// 
+// Creates a subsession, as part of the given session.
+// -----------------------------------------------------------------------------
+//
+TInt RPhCltEmergencyCall::Open( RPhCltServer& aServer )
+    {
+    __ASSERT_ALWAYS( aServer.Handle(), User::Panic( 
+        KPhClientPanicCategory, 
+        EPhCltClientSidePanicNullHandle ) );
+
+    return CreateSubSession( 
+        aServer, 
+        EPhoneServerEmergencyNumberSubSessionOpen,
+        TIpcArgs() );
+    }
+
+// -----------------------------------------------------------------------------
+// RPhCltEmergencyCall::Close
+// 
+// Closes the subsession.
+// -----------------------------------------------------------------------------
+//
+void RPhCltEmergencyCall::Close()
+    {
+    CloseSubSession( EPhoneServerEmergencyNumberSubSessionClose );
+    }
+
+// -----------------------------------------------------------------------------
+// RPhCltEmergencyCall::IsEmergenyPhoneNumber
+// 
+// Checks if telephonenumber is an emergency number.
+// -----------------------------------------------------------------------------
+//
+TInt RPhCltEmergencyCall::IsEmergencyPhoneNumber( 
+    const TDesC& aNumber, 
+    TBool& aIsEmergencyNumber )
+    {
+    aIsEmergencyNumber = EFalse;    
+    TPhCltEmergencyNumber emNumber;
+    
+    // Maximum total number size check
+    if ( aNumber.Length() > KPhCltEmergencyNumberSize )
+        {
+        return KErrArgument; 
+        }
+        
+    emNumber.Copy( aNumber );        
+    TBool writeEmergencyNumberBack( EFalse );
+    
+    // Actual check if the number provided is a valid emergency number
+    TInt result = ValidateNumber( emNumber, aIsEmergencyNumber, 
+                                writeEmergencyNumberBack );    
+
+    return result;    
+    }
+
+// -----------------------------------------------------------------------------
+// RPhCltEmergencyCall::IsEmergenyPhoneNumber
+// 
+// Checks if telephonenumber is an emergency number.
+// -----------------------------------------------------------------------------
+//
+TInt RPhCltEmergencyCall::IsEmergencyPhoneNumber( 
+    const TDesC& aNumber,
+    TDes& aMatchedEmergencyNumber, 
+    TBool& aIsEmergencyNumber )
+    {
+    aIsEmergencyNumber = EFalse;
+    
+    // Maximum total number size check
+    if ( aNumber.Length() > KPhCltEmergencyNumberSize )
+        {
+        return KErrArgument; 
+        }
+        
+    aMatchedEmergencyNumber.Copy( aNumber );   
+    TBool writeEmergencyNumberBack( ETrue );
+
+    // Actual check if the number provided is a valid emergency number    
+    TInt result = ValidateNumber( aMatchedEmergencyNumber, aIsEmergencyNumber, 
+                                writeEmergencyNumberBack );
+                                
+    // Reset the matched number, if no match was found
+    if ( !aIsEmergencyNumber )
+        {
+        aMatchedEmergencyNumber = KNullDesC;
+        }
+                                
+    return result;    
+    }
+    
+// -----------------------------------------------------------------------------
+// RPhCltEmergencyCall::FindEmergencyPhoneNumber
+// 
+// Checks if telephonenumber is an emergency number.
+// Found emergency number returned
+// -----------------------------------------------------------------------------
+//
+TInt RPhCltEmergencyCall::FindEmergencyPhoneNumber( 
+    TDes& aNumber, 
+    TBool& aIsEmergencyNumber )
+    {   
+    TPckg< TBool > pIsEmergencyNumber( aIsEmergencyNumber );
+    
+    if ( aNumber.Length() > KPhCltTelephoneNumberLength )
+        {
+        return KErrArgument;
+        }
+    
+    TPckg< TPhCltTelephoneNumber > pNumber( 
+        static_cast<TPhCltTelephoneNumber&>( aNumber ) );
+            
+    return SendReceive( 
+        EPhoneServerEmergencyNumberSubSessionIsEmergencyNumber, 
+        TIpcArgs( 
+            &pNumber,
+            &pIsEmergencyNumber,
+            EPhCltEmergencyNumberQueryModeAdvanced ) );
+    }
+    
+// -----------------------------------------------------------------------------
+// RPhCltEmergencyCall::DialEmergencyCall
+// 
+// Sends a dial request to the server.
+// -----------------------------------------------------------------------------
+//
+void RPhCltEmergencyCall::DialEmergencyCall( 
+    TRequestStatus& aReqStatus, 
+    TDesC8& aNumber )
+    {
+    return SendReceive( 
+        EPhoneServerEmergencyNumberSubsessionEmergencyDial,
+        TIpcArgs( &aNumber ),
+        aReqStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// RPhCltEmergencyCall::CancelDialEmergencyCall
+// 
+// Cancels an emergency call.
+// -----------------------------------------------------------------------------
+//
+void RPhCltEmergencyCall::CancelDialEmergencyCall()
+    {
+    SendReceive( 
+        EPhoneServerEmergencyNumberSubsessionEmergencyDialCancel,
+        TIpcArgs() );
+    }
+
+// -----------------------------------------------------------------------------
+// Extracts telephone number out of string. Valid emergency number can
+// have CLIR SS code and DTMF in it.
+// -----------------------------------------------------------------------------
+//
+TBool RPhCltEmergencyCall::ExtractTelephoneNumber( TDes& aString )
+    {    
+    // Emergency number may contain CLIR ss code, so remove
+    // possible CLIR code from the number.
+    RemoveCLIR( aString );
+    
+    // Emergency number may contain DTMF. 
+    RemoveDTMF( aString );
+    
+    if ( aString.Length() )
+        {
+        // First character in emergency can be +, but after that all characters must be digits.
+        const TChar KPlusChar = '+';
+        TChar firstCharacter = aString[0];
+        if ( firstCharacter == KPlusChar )
+            {
+            aString = aString.Right( aString.Length()-1 );
+            }
+        
+        // Number should be only digits.
+        for ( TInt i = 0; i < aString.Length(); i++ )
+            {
+            TChar character = aString[i];
+            if ( !character.IsDigit() )
+                {
+                return EFalse;
+                }
+            }
+        }
+
+    // This might be a valid emergency number. Final check is
+    // done by EnPolicy.
+    if ( aString.Length() )
+        {
+        return ETrue;
+        }
+    // If string length is zero after parsing, no reason to check it
+    // with EnPolicy, jus return EFalse.
+    else
+        {
+        return EFalse;
+        }
+    
+    }
+    
+// -----------------------------------------------------------------------------
+// Finds start of DTMF string. DTMF string starts with p or w character.
+// -----------------------------------------------------------------------------
+//
+TInt RPhCltEmergencyCall::FindStartOfDtmfString( const TDesC& aString )
+    {
+    // If string contains 'p' or 'w' returns true.
+    TInt indexp; //char 'p' index
+    TInt indexw;// char 'w' index
+    TPtrC ptrDtmfCharp( KPhCltDtmfCharp );
+    TPtrC ptrDtmfCharw( KPhCltDtmfCharw );
+
+    indexp = aString.Locate( ptrDtmfCharp[ 0 ] );
+    indexw = aString.Locate( ptrDtmfCharw[ 0 ] ); 
+
+    TInt dtmfIndex = KErrNotFound;
+    if ( indexp != KErrNotFound || indexw != KErrNotFound )
+        {
+        // dtmf char found
+        if ( indexw == KErrNotFound )
+            {
+            // char p index
+            dtmfIndex = indexp;    
+            }   
+        else if ( indexp == KErrNotFound )
+            {
+            // char w index
+            dtmfIndex = indexw;    
+            }                 
+        else
+            {
+            // Both chars p and w found, smaller index selected
+            indexp < indexw ? dtmfIndex = indexp : dtmfIndex = indexw;    
+            }         
+        }      
+    
+    return dtmfIndex; 
+    }
+
+// -----------------------------------------------------------------------------
+// Removes CLIR SS code
+// -----------------------------------------------------------------------------
+//    
+void RPhCltEmergencyCall::RemoveCLIR( TDes& aString )
+    {
+    
+    // Check for valid SS codes. Compare returns zero if strings match.
+    if ( !aString.Left( KPhCltMinSsStringLength ).Compare( KPhCltSsCLIRInvoke ) ||
+        !aString.Left( KPhCltMinSsStringLength ).Compare( KPhCltSsCLIRSuppress ) )        
+        {
+        // Extract string after the CLIR ss code.  
+        aString = aString.Right( aString.Length() - KPhCltSsCLIRInvoke().Length() );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Removes DTMF from string.
+// -----------------------------------------------------------------------------
+// 
+void RPhCltEmergencyCall::RemoveDTMF( TDes& aString )
+    {
+    const TInt dtmfIndex  = FindStartOfDtmfString( aString );
+    if ( dtmfIndex != KErrNotFound )
+        {               
+        aString = aString.Left( dtmfIndex );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// RPhCltEmergencyCall::ValidateNumber
+//
+// -----------------------------------------------------------------------------
+//    
+TInt RPhCltEmergencyCall::ValidateNumber( TDes& aString,
+                                        TBool& aIsEmergencyNumber,
+                                        const TBool aWriteEmergencyNumBack )
+    {
+    TPckg<TBool> pIsEmergencyNumber( aIsEmergencyNumber );
+    
+    // Check and remove additional characters from the phone number
+    TBool isPotentialEmNumber = ExtractTelephoneNumber( aString ); 
+    
+    // Pass the number on to EnPolicy for further check
+    if ( isPotentialEmNumber )
+        {
+        // Maximum length of digit part check
+        if ( aString.Length() > KPhCltMaxEmergencyNumberLength )
+            {
+            return KErrArgument;
+            }
+                   
+        // Use write-back mode if requested            
+        if ( aWriteEmergencyNumBack )
+            {
+            TPckg< TPhCltTelephoneNumber > pNumber( 
+                static_cast<TPhCltTelephoneNumber&>( aString ) );
+            return SendReceive( 
+                EPhoneServerEmergencyNumberSubSessionIsEmergencyNumber, 
+                TIpcArgs( 
+                    &pNumber,
+                    &pIsEmergencyNumber,
+                    EPhCltEmergencyNumberQueryModeNormalWriteback ) );                    
+            }
+        // Else use the normal mode
+        else
+            {
+            TPckgC<TPhCltEmergencyNumber> pNumber( aString ); 
+            return SendReceive( 
+                EPhoneServerEmergencyNumberSubSessionIsEmergencyNumber, 
+                TIpcArgs( 
+                    &pNumber,
+                    &pIsEmergencyNumber,
+                    EPhCltEmergencyNumberQueryModeNormal ) );
+            }                     
+        }
+    else
+        {
+        return KErrNone;
+        }
+    }
+    
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/extcall/extcall_aiw/cphcltdialdata.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* 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:  Ext Phone Dial Data.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <cphcltdialdata.h>
+#include "cphcltextphonedialdata.h" // For correct default values 
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CPhCltDialData::CPhCltDialData
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPhCltDialData::CPhCltDialData():
+    iTelNumber( KNullDesC ),
+    iCallType( EPhCltVoice ),
+    iName( KNullDesC ), 
+    iWindowGroup( KPhCltGoToIdle ), 
+    iRedial( KPhCltRedialDefault ), 
+    iSubAddress( KNullDesC ),
+    iShowNumber( ETrue ), 
+    iAllowMatch( KPhCltDefaultAllowMatch ),
+    iSATCall( EFalse ),
+    iEndOtherCalls( EFalse ),
+    iBearer( KNullDesC8 ),
+    iSendKey( EFalse ),
+    iReturnToNumberEntryOnFailure( KPhCltDefaultNumberEntry ), 
+    iInitCall ( EFalse ), 
+    iFlags( CPhCltExtPhoneDialData::EPhCltCallFlagsDefault ),
+    iServiceId( NULL )
+    { 
+    iRedialMaximumDuration = 0;
+    }
+
+
+// Destructor
+CPhCltDialData::~CPhCltDialData()
+    {  
+    delete iContactLink;
+    iContactLink = NULL;
+    delete iUUI; 
+    iUUI = NULL;
+    }
+
+void CPhCltDialData::ConstructL()
+    {
+    iContactLink = KNullDesC8().AllocL();
+    iUUI = KNullDesC().AllocL();
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/extcall/extcall_aiw/cphcltextphonedialdata.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,742 @@
+/*
+* 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:  Ext Phone Dial Data.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "cphcltextphonedialdata.h" 
+#include <cphcltdialdata.h>
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CPhCltExtPhoneDialData::CPhCltExtPhoneDialData
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPhCltExtPhoneDialData::CPhCltExtPhoneDialData()
+    : CPhCltDialData()
+    { 
+    iRedialMaximumDuration = 0;      
+    }
+
+
+// ---------------------------------------------------------------------------
+// 
+// Symbian OS constructor
+// 
+// ---------------------------------------------------------------------------
+//
+void CPhCltExtPhoneDialData::ConstructL()
+    {
+    CPhCltDialData::ConstructL();
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Symbian OS constructor  
+// Initialises the member data from package.
+//
+// ---------------------------------------------------------------------------
+//
+void CPhCltExtPhoneDialData::ConstructL(
+    const TDesC8& aPackage ) 
+    {
+    RDesReadStream stream( aPackage );
+    CleanupClosePushL( stream );
+    
+    stream >> iTelNumber;
+    iCallType = static_cast<TPhCltCallType>( stream.ReadInt32L() );
+    stream >> iName;
+    iWindowGroup = stream.ReadInt32L();
+    iRedial = stream.ReadInt32L();
+    iRedialMaximumDuration = stream.ReadInt32L();
+    ReadDescriptorFromStreamL( stream, iContactLink );
+    stream >> iSubAddress;
+    iShowNumber = stream.ReadInt32L();
+    iAllowMatch = stream.ReadInt32L();
+    iSATCall = stream.ReadInt32L(); 
+    iEndOtherCalls = stream.ReadInt32L();
+    stream >> iBearer;
+    iSendKey = stream.ReadInt32L();
+    iReturnToNumberEntryOnFailure = stream.ReadInt32L();
+    iInitCall = stream.ReadInt32L();
+    iFlags = stream.ReadUint32L();
+    iServiceId = stream.ReadUint32L();
+    ReadDescriptorFromStreamL( stream, iUUI );
+    CleanupStack::PopAndDestroy( 1 ); // stream;
+    }
+// -----------------------------------------------------------------------------
+// CPhCltExtPhoneDialData::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CPhCltExtPhoneDialData* CPhCltExtPhoneDialData::NewL()
+    {
+    CPhCltExtPhoneDialData* self = CPhCltExtPhoneDialData::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltExtPhoneDialData::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CPhCltExtPhoneDialData* CPhCltExtPhoneDialData::NewLC(  )
+    {
+    CPhCltExtPhoneDialData* self = new( ELeave ) CPhCltExtPhoneDialData;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// First phase constructor
+// Initialises the member data from package.
+// 
+// --------------------------------------------------------------------------- 
+//    
+EXPORT_C CPhCltExtPhoneDialData* CPhCltExtPhoneDialData::NewL( 
+    const TDesC8& aPackage )
+    {
+    CPhCltExtPhoneDialData* self = CPhCltExtPhoneDialData::NewLC( aPackage );
+    CleanupStack::Pop( self );
+    return self;
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// First phase constructor
+// Initialises the member data from package.
+// 
+// --------------------------------------------------------------------------- 
+//
+EXPORT_C CPhCltExtPhoneDialData* CPhCltExtPhoneDialData::NewLC(
+    const TDesC8& aPackage )
+    {
+    CPhCltExtPhoneDialData* self = new( ELeave ) CPhCltExtPhoneDialData;
+    CleanupStack::PushL( self );
+    self->ConstructL( aPackage );
+    return self;
+    }
+
+// Destructor
+EXPORT_C CPhCltExtPhoneDialData::~CPhCltExtPhoneDialData()
+    {
+    }
+
+
+ // Access - Setters  
+ 
+// ---------------------------------------------------------------------------
+// Sets allow match.
+// ---------------------------------------------------------------------------
+//   
+EXPORT_C void CPhCltExtPhoneDialData::SetAllowMatch( TBool aAllowMatch ) 
+    {
+    iAllowMatch = aAllowMatch;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets bearer.
+// ---------------------------------------------------------------------------
+EXPORT_C void CPhCltExtPhoneDialData::SetBearerL ( 
+const TPhCltBearerCapability& aBearer )
+    {
+    iBearer = aBearer;
+    }
+    
+// ---------------------------------------------------------------------------
+// Sets call type.
+// ---------------------------------------------------------------------------
+//   
+EXPORT_C void CPhCltExtPhoneDialData::SetCallType( TPhCltCallType aCallType ) 
+    {
+    iCallType = aCallType;
+    }
+ 
+// ---------------------------------------------------------------------------
+// Sets used contact link.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPhCltExtPhoneDialData::SetContactLinkL( const TDesC8& aContactLink ) 
+    {
+    CopyDescriptorToMemberDescriptorL( aContactLink, iContactLink );
+    }
+
+// ---------------------------------------------------------------------------
+// Sets end other calls.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPhCltExtPhoneDialData::SetEndOtherCalls( TBool aEndCalls ) 
+    {
+    iEndOtherCalls = aEndCalls ;
+    }
+ 
+ // ---------------------------------------------------------------------------
+// Set initiate call.
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C void CPhCltExtPhoneDialData::SetInitiateCall( TBool aInitCall )
+    {
+    iInitCall = aInitCall;
+    } 
+// ---------------------------------------------------------------------------
+// Set name.
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C void CPhCltExtPhoneDialData::SetNameL( const TPhCltNameBuffer& aName ) 
+    {
+    iName = aName;
+    }
+    
+// ---------------------------------------------------------------------------
+// Sets phone number.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPhCltExtPhoneDialData::SetTelephoneNumber(
+    const TPhCltTelephoneNumber& aNumber ) 
+    {
+    iTelNumber = aNumber;
+    }
+  
+// ---------------------------------------------------------------------------
+// Sets redial value.
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C void CPhCltExtPhoneDialData::SetRedial( TInt aRedial ) 
+    {
+    iRedial = aRedial;
+    }
+    
+// ---------------------------------------------------------------------------
+// Sets redial max duration time.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPhCltExtPhoneDialData::SetRedialMaximumDuration( 
+    TTimeIntervalSeconds aMaximumRedialDuration ) 
+    {
+    iRedialMaximumDuration = aMaximumRedialDuration;
+    }
+  
+// ---------------------------------------------------------------------------
+// Sets SAT call.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPhCltExtPhoneDialData::SetSATCall( TBool aIsSATCall ) 
+    {
+    iSATCall = aIsSATCall;
+    }
+
+// -----------------------------------------------------------------------------
+// SetSendKeyPressed
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CPhCltExtPhoneDialData::SetSendKeyPressed( TBool aSendKey )
+    {
+    iSendKey = aSendKey;
+    }
+
+// ---------------------------------------------------------------------------
+// Set show number.
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C void CPhCltExtPhoneDialData::SetShowNumber( TBool aShowNumber ) 
+    {
+    iShowNumber = aShowNumber;
+    } 
+    
+// ---------------------------------------------------------------------------
+// Sets SubAddress for SAT call.
+// ---------------------------------------------------------------------------
+EXPORT_C void CPhCltExtPhoneDialData::SetSubAddressL( 
+    const TPhCltSubAddress& aSubAddress )
+    {
+    iSubAddress = aSubAddress;
+    }
+    
+// ---------------------------------------------------------------------------
+// Sets window group.
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C void CPhCltExtPhoneDialData::SetWindowGroup( TInt aWindowGroup ) 
+    {
+    iWindowGroup = aWindowGroup;
+    }
+  
+// ---------------------------------------------------------------------------
+// Sets window group.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPhCltExtPhoneDialData::SetUUIL( const TDesC& aUUI )
+    {
+    CopyDescriptorToMemberDescriptorL( aUUI, iUUI );
+    }
+
+// Access - Getters 
+
+// ---------------------------------------------------------------------------
+// Return allow match.
+// ---------------------------------------------------------------------------
+//   
+EXPORT_C TBool CPhCltExtPhoneDialData::AllowMatch() const 
+    {
+    return iAllowMatch;
+    }
+    
+// ---------------------------------------------------------------------------
+// Returns bearer.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TPhCltBearerCapability& CPhCltExtPhoneDialData::Bearer() const
+    {
+    return iBearer;
+    }
+    
+// ---------------------------------------------------------------------------
+// Returns call type.
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TPhCltCallType  CPhCltExtPhoneDialData::CallType() const 
+    {
+    return iCallType;
+    }
+
+// ---------------------------------------------------------------------------
+// Return contact link.
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C const TDesC8& CPhCltExtPhoneDialData::ContactLink() const 
+    {
+    return *iContactLink;
+    } 
+     
+// ---------------------------------------------------------------------------
+// Returns end other calls value.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CPhCltExtPhoneDialData::EndOtherCalls() const
+    {
+    return iEndOtherCalls;
+    }
+    
+// ---------------------------------------------------------------------------
+// Returns initiate call.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CPhCltExtPhoneDialData::InitiateCall() const 
+    {
+    return iInitCall;
+    } 
+    
+// ---------------------------------------------------------------------------
+// Returns name.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TPhCltNameBuffer& CPhCltExtPhoneDialData::Name() const 
+    {
+    return iName;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns phone number.
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C const TPhCltTelephoneNumber& CPhCltExtPhoneDialData::TelephoneNumber() const 
+    {
+    return iTelNumber;    
+    }
+
+// ---------------------------------------------------------------------------
+// Return redial value.
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CPhCltExtPhoneDialData::Redial() const 
+    {
+    return iRedial;
+    }
+// ---------------------------------------------------------------------------
+// Returns redial max duration.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TTimeIntervalSeconds CPhCltExtPhoneDialData::RedialMaximumDuration() const
+    {
+    return iRedialMaximumDuration;
+    }   
+
+// ---------------------------------------------------------------------------
+// Returns SAT call value.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CPhCltExtPhoneDialData::SATCall() const
+    {
+    return iSATCall;    
+    }
+    
+ // -----------------------------------------------------------------------------
+// SendKeyPressed
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool CPhCltExtPhoneDialData::SendKeyPressed() const
+    {
+    return iSendKey;
+    }
+        
+// ---------------------------------------------------------------------------
+// Returns show number.
+// ---------------------------------------------------------------------------
+//   
+EXPORT_C TBool CPhCltExtPhoneDialData::ShowNumber() const 
+    {
+    return iShowNumber;
+    }
+    
+// ---------------------------------------------------------------------------
+// Returns subaddress.
+// ---------------------------------------------------------------------------
+//   
+EXPORT_C const TPhCltSubAddress& CPhCltExtPhoneDialData::SubAddress() const
+    {
+    return iSubAddress;
+    }
+    
+// ---------------------------------------------------------------------------
+// Return window group.
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CPhCltExtPhoneDialData::WindowGroup() const
+    {
+    return iWindowGroup;
+    }
+    
+// ---------------------------------------------------------------------------
+// Return user to user information
+// ---------------------------------------------------------------------------
+//      
+EXPORT_C const TDesC& CPhCltExtPhoneDialData::UUI() const 
+    {
+    return *iUUI;
+    }
+ 
+ // Other member functions   
+
+// ---------------------------------------------------------------------------
+// Calculates the size of descriptor in package. Note that to retreave 
+// a descriptor from stream in ConstructL we need to know the size of a
+// descriptor in order to allocate right size descriptor. This is the reason
+// for adding sizeof( int ) to descriptor length.
+// ---------------------------------------------------------------------------
+// 
+TInt CPhCltExtPhoneDialData::CalculateDescriptorSize( const TDesC& aDescriptor ) const 
+    {
+    // sizeof( TInt ) is for the length of a descriptor.
+    return sizeof( TInt ) + aDescriptor.Length() * 2; // unicode takes 2 bytes.
+    }
+    
+// ---------------------------------------------------------------------------
+// Calculates the size of descriptor in package. Note that to retreave 
+// a descriptor from stream in ConstructL we need to know the size of a
+// descriptor in order to allocate right size descriptor. This is the reason
+// for adding sizeof( int ) to descriptor length.
+// ---------------------------------------------------------------------------
+// 
+TInt CPhCltExtPhoneDialData::CalculateDescriptorSize( const TDesC8& aDescriptor ) const 
+    {
+    // sizeof( TInt ) is for the length of a descriptor in stream
+    return sizeof( TInt ) + aDescriptor.Length();
+    }   
+    
+// ---------------------------------------------------------------------------
+// Calculates the size of all member data.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CPhCltExtPhoneDialData::CalculatePackageSize() const
+    {
+    TInt packageSize = 0;
+    packageSize += CalculateDescriptorSize( iTelNumber );
+    packageSize += sizeof( iCallType );
+    packageSize += CalculateDescriptorSize( iName );
+    packageSize += sizeof( iWindowGroup );
+    packageSize += sizeof( iRedial );
+    packageSize+=sizeof( iRedialMaximumDuration.Int() );
+    packageSize += CalculateDescriptorSize( *iContactLink );
+    packageSize += CalculateDescriptorSize( iSubAddress );
+    packageSize += sizeof( iShowNumber);
+    packageSize += sizeof( iAllowMatch );
+    packageSize += sizeof( iSATCall );
+    packageSize += sizeof( iEndOtherCalls );
+    packageSize += CalculateDescriptorSize( iBearer );
+    packageSize += sizeof (iSendKey );
+    packageSize += sizeof( iReturnToNumberEntryOnFailure);
+    packageSize += sizeof (iInitCall );
+    packageSize += sizeof( iFlags );
+    packageSize += sizeof( iServiceId );
+    packageSize += CalculateDescriptorSize( *iUUI );
+    return packageSize;
+    }
+    
+// ---------------------------------------------------------------------------
+// Checks that descriptorLength is not longer than maximum allowed descriptor
+// length.
+// ---------------------------------------------------------------------------
+//   
+void CPhCltExtPhoneDialData::CheckDescriptorMaxLengthL( 
+    TInt aDescriptorLength, TInt aMaxAllowedDescriptorLength ) const
+    {
+    if( aDescriptorLength > aMaxAllowedDescriptorLength )
+        {
+        User::Leave( KErrArgument );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Copies aSource descriptor to aMemberDescriptor. This quarantees that member
+// descriptor will be valid even if the allocation fails.
+// ---------------------------------------------------------------------------
+//   
+void CPhCltExtPhoneDialData::CopyDescriptorToMemberDescriptorL( 
+    const TDesC& aSource, 
+    HBufC*& aMemberDescriptor )
+    {
+    HBufC* temp = aSource.AllocL();
+    delete aMemberDescriptor;
+    aMemberDescriptor = temp;
+    }
+
+// ---------------------------------------------------------------------------
+// Copies aSource descriptor to aMemberDescriptor. This quarantees that member
+// descriptor will be valid even if the allocation fails.
+// ---------------------------------------------------------------------------
+//       
+void CPhCltExtPhoneDialData::CopyDescriptorToMemberDescriptorL( 
+    const TDesC8& aSource, 
+    HBufC8*& aMemberDescriptor )
+    {
+    HBufC8* temp = aSource.AllocL();
+    delete aMemberDescriptor;
+    aMemberDescriptor = temp;
+    }
+              
+  
+// ---------------------------------------------------------------------------
+// Reads descriptor from stream.
+// ---------------------------------------------------------------------------
+//  
+void CPhCltExtPhoneDialData::ReadDescriptorFromStreamL( 
+    RDesReadStream& aStream,
+    HBufC8*& aDescriptor 
+    )
+    {
+    const TInt descLength( aStream.ReadInt32L() );
+    if ( aDescriptor )
+        {
+        delete aDescriptor;
+        }
+    // Not to cleanupstack, aDescriptor is member variable
+    aDescriptor = HBufC8::NewL( descLength ); 
+    TPtr8 ptr = aDescriptor->Des();
+    aStream.ReadL( ptr, descLength );
+    }    
+    
+// ---------------------------------------------------------------------------
+// Reads descriptor from stream.
+// ---------------------------------------------------------------------------
+//  
+void CPhCltExtPhoneDialData::ReadDescriptorFromStreamL( 
+    RDesReadStream& aStream, 
+    HBufC*& aDescriptor )
+    {
+   const TInt descLength( aStream.ReadInt32L() );
+    if ( aDescriptor )
+        {
+        delete aDescriptor;
+        }
+    // Not to cleanupstack, aDescriptor will be member variable
+    aDescriptor = HBufC::NewL( descLength ); 
+    TPtr16 ptr = aDescriptor->Des();
+    aStream.ReadL( ptr, descLength );
+    }
+
+// ---------------------------------------------------------------------------
+// Writes descriptor to stream.
+// ---------------------------------------------------------------------------
+//  
+void CPhCltExtPhoneDialData::WriteDescriptorToStreamL( 
+    RDesWriteStream& aStream, 
+    const TDesC8& aDescriptor ) 
+    {
+    aStream.WriteInt32L( aDescriptor.Length() );
+    aStream.WriteL( aDescriptor );
+    }
+    
+// ---------------------------------------------------------------------------
+// Writes descriptor to stream.
+// ---------------------------------------------------------------------------
+//  
+void CPhCltExtPhoneDialData::WriteDescriptorToStreamL( 
+    RDesWriteStream& aStream, 
+    const TDesC& aDescriptor ) 
+    {
+    aStream.WriteInt32L( aDescriptor.Length() );
+    aStream.WriteL( aDescriptor );
+    }    
+
+// ---------------------------------------------------------------------------
+// Packs the member data to descriptor. Ownershipd of returned descriptor
+// is given for caller.
+// ---------------------------------------------------------------------------
+//  
+EXPORT_C HBufC8* CPhCltExtPhoneDialData::PackLC() 
+    {
+    HBufC8* package = HBufC8::NewLC( CalculatePackageSize() );
+    
+    TPtr8 des = package->Des();
+    RDesWriteStream stream( des );
+    
+    CleanupClosePushL( stream );
+
+    stream << iTelNumber;     
+    stream.WriteInt32L( iCallType );       
+    stream << iName;
+    stream.WriteInt32L( iWindowGroup );
+    stream.WriteInt32L( iRedial );
+    stream.WriteInt32L( iRedialMaximumDuration.Int() );
+    WriteDescriptorToStreamL( stream, *iContactLink );
+    stream << iSubAddress;
+    stream.WriteInt32L( iShowNumber );
+    stream.WriteInt32L( iAllowMatch );
+    stream.WriteInt32L( iSATCall);
+    stream.WriteInt32L( iEndOtherCalls );
+    stream << iBearer;
+    stream.WriteInt32L( iSendKey );
+    stream.WriteInt32L( iReturnToNumberEntryOnFailure );
+    stream.WriteInt32L( iInitCall );
+    
+    
+    iFlags = EPhCltCallFlagsDefault;
+
+    if ( iShowNumber )
+        {
+        iFlags |= EPhCltCallFlagsAllowNumberShowing;
+        }
+
+    if ( iAllowMatch )
+        {
+        iFlags |= 
+            EPhCltCallFlagsAllowPersonalDirectoryMatching;
+        }
+    if ( iEndOtherCalls )
+        {
+           iFlags |= EPhCltCallFlagsEndBeforeDial;
+        }
+
+    if ( iSATCall )
+        {
+        iFlags |= EPhCltCallFlagsSAT;
+        }
+
+    if ( ( iCallType == EPhCltVideo ) || ( iCallType == EPhCltForcedVideo  ) )
+        {
+        iFlags |= EPhCltCallFlagsVideoCall;
+        }
+
+    if ( iCallType == EPhCltCallVoIP   )
+        {
+        iFlags |= EPhCltCallFlagsVoIPCall;
+        }
+
+      
+      if ( iSendKey )
+        {
+        iFlags |= EPhCltCallFlagsSendKey;
+        }
+
+    stream.WriteUint32L( iFlags );   
+    stream.WriteUint32L( iServiceId );
+    WriteDescriptorToStreamL( stream, *iUUI );
+    stream.CommitL();
+    
+    CleanupStack::PopAndDestroy( 1 ); // stream
+    
+    return package;   
+    
+      }    
+
+// -----------------------------------------------------------------------------
+// CPhCltExtPhoneDialData::SetServiceId
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CPhCltExtPhoneDialData::SetServiceId( TUint32 aServiceId )
+    {
+    iServiceId = aServiceId;
+    } 
+// -----------------------------------------------------------------------------
+// CPhCltExtPhoneDialData::ServiceId
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint32 CPhCltExtPhoneDialData::ServiceId() const
+    {
+    return iServiceId;
+    }
+    
+// ---------------------------------------------------------------------------
+// Sets dial data values using given package
+//
+// ---------------------------------------------------------------------------
+//
+void CPhCltExtPhoneDialData::SetParamsL(
+    const TDesC8& aPackage ) 
+    {
+    RDesReadStream stream( aPackage );
+    CleanupClosePushL( stream );
+    
+    stream >> iTelNumber;
+    iCallType = static_cast<TPhCltCallType>( stream.ReadInt32L() );
+    stream >> iName;
+    iWindowGroup = stream.ReadInt32L();
+    iRedial = stream.ReadInt32L();
+    iRedialMaximumDuration = stream.ReadInt32L();
+    ReadDescriptorFromStreamL( stream, iContactLink );
+    stream >> iSubAddress;
+    iShowNumber = stream.ReadInt32L();
+    iAllowMatch = stream.ReadInt32L();
+    iSATCall = stream.ReadInt32L(); 
+    iEndOtherCalls = stream.ReadInt32L();
+    stream >> iBearer;
+    iSendKey = stream.ReadInt32L();
+    iReturnToNumberEntryOnFailure = stream.ReadInt32L();
+    iInitCall = stream.ReadInt32L();
+    iFlags = stream.ReadUint32L();
+    iServiceId = stream.ReadUint32L();
+    ReadDescriptorFromStreamL( stream, iUUI );
+
+    CleanupStack::PopAndDestroy( 1 ); // stream;
+    }
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/extcall/extcall_aiw/rphcltextcall.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,111 @@
+/*
+* 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:  Ext Call
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "rphcltserver.h" 
+#include    "rphcltextcall.h" 
+#include    "cphcltextphonedialdata.h" 
+#include    "phcltclientserver.h" 
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// RPhCltExtCall::RPhCltExtCall
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+RPhCltExtCall::RPhCltExtCall() 
+    : RSubSessionBase()
+    {    
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltExtCall::Open
+// 
+// Creates a subsession, as part of the given session.
+// -----------------------------------------------------------------------------
+//
+TInt RPhCltExtCall::Open( RPhCltServer& aServer )
+    {
+    __ASSERT_ALWAYS( aServer.Handle(), User::Panic( 
+        KPhClientPanicCategory, 
+        EPhCltClientSidePanicNullHandle ) );
+
+    return CreateSubSession( 
+        aServer, 
+        EPhoneServerExtCallSubSessionOpen, 
+        TIpcArgs() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltExtCall::Close
+// 
+// Closes the subsession.
+// -----------------------------------------------------------------------------
+//
+void RPhCltExtCall::Close()
+    {
+    CloseSubSession( EPhoneServerExtCallSubSessionClose );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltExtCall::Dial
+// 
+// Sends a dial request to the server.
+// -----------------------------------------------------------------------------
+//
+void RPhCltExtCall::Dial( 
+    TRequestStatus& aStatus, 
+    TDesC8& aData, TInt aLength )
+    {
+    __ASSERT_ALWAYS( SubSessionHandle(), User::Panic( KPhClientPanicCategory,
+        EPhCltClientSidePanicNullHandle ) );
+    
+    TPckg< TInt > pDataLength( aLength );
+    SendReceive(  
+        EPhoneServerExtCallSubSessionMakeCall, 
+        TIpcArgs( &aData, aLength ), 
+        aStatus ); 
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltExtCall::CancelDial
+// 
+// Cancels the pending dial request.
+// -----------------------------------------------------------------------------
+//
+void RPhCltExtCall::CancelDial() const
+    {
+    __ASSERT_ALWAYS( const_cast< RPhCltExtCall* >( this )->SubSessionHandle(), 
+        User::Panic( 
+            KPhClientPanicCategory, EPhCltClientSidePanicNullHandle ) );
+
+    SendReceive( 
+        EPhoneServerExtCallSubSessionMakeCallCancel, 
+        TIpcArgs() );
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/extcall/rphcltextcall.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,145 @@
+/*
+* 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:  Ext Call
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "rphcltserver.h" 
+#include    "rphcltextcall.h" 
+#include    "tphcltextphonedialdata.h" 
+#include    "phcltclientserver.h" 
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// RPhCltExtCall::RPhCltExtCall
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+RPhCltExtCall::RPhCltExtCall() 
+    : RSubSessionBase(), iArgs( TPhCltCallArgs() )
+    {    
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltExtCall::Open
+// 
+// Creates a subsession, as part of the given session.
+// -----------------------------------------------------------------------------
+//
+TInt RPhCltExtCall::Open( RPhCltServer& aServer )
+    {
+    __ASSERT_ALWAYS( aServer.Handle(), User::Panic( 
+        KPhClientPanicCategory, 
+        EPhCltClientSidePanicNullHandle ) );
+
+    return CreateSubSession( 
+        aServer, 
+        EPhoneServerExtCallSubSessionOpen, 
+        TIpcArgs() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltExtCall::Close
+// 
+// Closes the subsession.
+// -----------------------------------------------------------------------------
+//
+void RPhCltExtCall::Close()
+    {
+    CloseSubSession( EPhoneServerExtCallSubSessionClose );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltExtCall::Dial
+// 
+// Sends a dial request to the server.
+// -----------------------------------------------------------------------------
+//
+void RPhCltExtCall::Dial( 
+    TRequestStatus& aStatus, 
+    const TPhCltTelephoneNumber& aNumber,
+    const TPhCltNameBuffer& aName,
+    const TInt aWindowGroupId,
+    const TInt aRedial,
+    const TPhCltContactId aContactId,
+    const TBool aAllowNumberShowing )    
+    {
+    __ASSERT_ALWAYS( SubSessionHandle(), User::Panic( 
+        KPhClientPanicCategory,
+        EPhCltClientSidePanicNullHandle ) );
+
+    // Populate a temporary arguments package
+    TPhCltExtPhoneDialData args( aName, aNumber, aContactId, aWindowGroupId );
+    args.SetRedial( aRedial );
+    args.SetShowNumber( aAllowNumberShowing );
+    
+    // Do the dial
+    Dial( aStatus, args );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltExtCall::Dial
+// 
+// Sends a dial request to the server.
+// -----------------------------------------------------------------------------
+//
+void RPhCltExtCall::Dial( 
+    TRequestStatus& aStatus, 
+    const TPhCltExtPhoneDialData& aData )
+    {
+    __ASSERT_ALWAYS( SubSessionHandle(), User::Panic( KPhClientPanicCategory,
+        EPhCltClientSidePanicNullHandle ) );
+    
+    // Save the arguments
+    TPhCltCallArgs args;
+    aData.AsIPCStruct( args );
+    iArgs() = args;
+
+    // Request the dial
+    SendReceive( 
+        EPhoneServerExtCallSubSessionMakeCall, 
+        TIpcArgs( &iArgs ), 
+        aStatus );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltExtCall::CancelDial
+// 
+// Cancels the pending dial request.
+// -----------------------------------------------------------------------------
+//
+void RPhCltExtCall::CancelDial() const
+    {
+    __ASSERT_ALWAYS( const_cast< RPhCltExtCall* >( this )->SubSessionHandle(), 
+        User::Panic( 
+            KPhClientPanicCategory, EPhCltClientSidePanicNullHandle ) );
+
+    SendReceive( 
+        EPhoneServerExtCallSubSessionMakeCallCancel, 
+        TIpcArgs() );
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/extcall/tphcltextphonedialdata.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,654 @@
+/*
+* 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:  Ext Phone Dial Data.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "tphcltextphonedialdata.h" 
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::TPhCltExtPhoneDialData
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TPhCltExtPhoneDialData::TPhCltExtPhoneDialData()
+    : iWindowGroup( KPhCltGoToIdle ), 
+    iRedial( KPhCltRedialDefault ), 
+    iNumberType( KPhCltDefaultNumberType ), 
+    iShowNumber( ETrue ), 
+    iReturnToNumberEntryOnFailure( KPhCltDefaultNumberEntry ), 
+    iAllowMatch( KPhCltDefaultAllowMatch ), 
+    iName( KNullDesC ), 
+    iContactId( KPhCltNoContact), 
+    iTelNumber( KNullDesC ),
+    iEndOtherCalls( EFalse ),
+    iEmergencyCall( EFalse ),
+    iSubAddress( KNullDesC ),
+    iSATCall( EFalse ),
+    iBearer( KNullDesC8 ),
+    iCallType( EPhCltVoice ),
+    iSendKey( EFalse )
+    {
+    iRedialMaximumDuration = 0;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::TPhCltExtPhoneDialData
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TPhCltExtPhoneDialData::TPhCltExtPhoneDialData( 
+    const TPhCltTelephoneNumber& aNumber, 
+    TPhCltContactId aContactId )
+    : iWindowGroup( KPhCltGoToIdle), 
+    iRedial( KPhCltRedialDefault ),
+    iNumberType( KPhCltDefaultNumberType ), 
+    iShowNumber( ETrue ), 
+    iReturnToNumberEntryOnFailure( KPhCltDefaultNumberEntry ), 
+    iAllowMatch( KPhCltDefaultAllowMatch ), 
+    iName( KNullDesC ), 
+    iContactId( aContactId ), 
+    iTelNumber( aNumber ),
+    iEndOtherCalls( EFalse ),
+    iEmergencyCall( EFalse ),
+    iSubAddress( KNullDesC ),
+    iSATCall( EFalse ),
+    iBearer( KNullDesC8 ),
+    iCallType( EPhCltVoice ),
+    iSendKey( EFalse )
+    {
+    iRedialMaximumDuration = 0;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::TPhCltExtPhoneDialData
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TPhCltExtPhoneDialData::TPhCltExtPhoneDialData( 
+    const TPhCltTelephoneNumber& aNumber, 
+    TInt aWindowGroupId )
+    : iWindowGroup( aWindowGroupId ), 
+    iRedial( KPhCltRedialDefault ),
+    iNumberType( KPhCltDefaultNumberType ), 
+    iShowNumber( ETrue ),
+    iReturnToNumberEntryOnFailure( KPhCltDefaultNumberEntry ),
+    iAllowMatch( KPhCltDefaultAllowMatch ), 
+    iName( KNullDesC ),
+    iContactId( KPhCltNoContact ), 
+    iTelNumber( aNumber ),
+    iEndOtherCalls( EFalse ),
+    iEmergencyCall( EFalse ),
+    iSubAddress( KNullDesC ),
+    iSATCall( EFalse ),
+    iBearer( KNullDesC8 ),
+    iCallType( EPhCltVoice ),
+    iSendKey( EFalse )
+    {
+    iRedialMaximumDuration = 0;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::TPhCltExtPhoneDialData
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TPhCltExtPhoneDialData::TPhCltExtPhoneDialData( 
+    const TPhCltTelephoneNumber& aNumber, 
+    TPhCltContactId aContactId, 
+    TInt aWindowGroupId )
+    : iWindowGroup( aWindowGroupId ), 
+    iRedial( KPhCltRedialDefault ),
+    iNumberType( KPhCltDefaultNumberType ), 
+    iShowNumber( ETrue ), 
+    iReturnToNumberEntryOnFailure( KPhCltDefaultNumberEntry ),
+    iAllowMatch( KPhCltDefaultAllowMatch ), 
+    iName (KNullDesC ),
+    iContactId( aContactId ), 
+    iTelNumber( aNumber ),
+    iEndOtherCalls( EFalse ),
+    iEmergencyCall( EFalse ),
+    iSubAddress( KNullDesC ),
+    iSATCall( EFalse ),
+    iBearer( KNullDesC8 ),
+    iCallType( EPhCltVoice ),
+    iSendKey( EFalse )
+    {
+    iRedialMaximumDuration = 0;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::TPhCltExtPhoneDialData
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TPhCltExtPhoneDialData::TPhCltExtPhoneDialData( 
+    const TPhCltNameBuffer& aName, 
+    const TPhCltTelephoneNumber& aNumber, 
+    TPhCltContactId aContactId, 
+    TInt aWindowGroupId )
+    : iWindowGroup( aWindowGroupId ), 
+    iRedial( KPhCltRedialDefault ),
+    iNumberType( KPhCltDefaultNumberType ), 
+    iShowNumber( ETrue ),
+    iReturnToNumberEntryOnFailure( KPhCltDefaultNumberEntry ), 
+    iAllowMatch( KPhCltDefaultAllowMatch ), 
+    iName( aName ), 
+    iContactId( aContactId ), 
+    iTelNumber( aNumber ),
+    iEndOtherCalls( EFalse ),
+    iEmergencyCall( EFalse ),
+    iSubAddress( KNullDesC ),
+    iSATCall( EFalse ),
+    iBearer( KNullDesC8 ),
+    iCallType( EPhCltVoice ),
+    iSendKey( EFalse )
+    {
+    iRedialMaximumDuration = 0;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::SetWindowGroup
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void TPhCltExtPhoneDialData::SetWindowGroup( TInt aWindowGroupId )
+    {
+    iWindowGroup = aWindowGroupId;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::SetShowNumber
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void TPhCltExtPhoneDialData::SetShowNumber( TBool aShowNumber )
+    {
+    iShowNumber = aShowNumber;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::SetRedial
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void TPhCltExtPhoneDialData::SetRedial( TInt aRedial )
+    {
+    iRedial = aRedial;
+    }
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::Set redial maximum duration
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void TPhCltExtPhoneDialData::SetRedialMaximumDuration( TTimeIntervalSeconds aMaximumRedialDuration )
+    {
+    iRedialMaximumDuration = aMaximumRedialDuration;
+    }
+    
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::SetName
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void TPhCltExtPhoneDialData::SetName( const TPhCltNameBuffer& aName )
+    {
+    iName = aName;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::SetContactId
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void TPhCltExtPhoneDialData::SetContactId( 
+    TPhCltContactId aContactId )
+    {
+    iContactId = aContactId;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::SetTelephoneNumber
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void TPhCltExtPhoneDialData::SetTelephoneNumber( 
+    const TPhCltTelephoneNumber& aNumber )
+    {
+    iTelNumber = aNumber;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::SetReturnToNumberEntryOnFailure
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void TPhCltExtPhoneDialData::SetReturnToNumberEntryOnFailure( 
+    TBool aReturn )
+    {
+    iReturnToNumberEntryOnFailure = aReturn;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::SetAllowMatch
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void TPhCltExtPhoneDialData::SetAllowMatch( TBool aAllowMatch )
+    {
+    iAllowMatch = aAllowMatch;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::SetNumberType
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void TPhCltExtPhoneDialData::SetNumberType( TInt aNumberType )
+    {
+    iNumberType = aNumberType;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::SetEndOtherCalls
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void TPhCltExtPhoneDialData::SetEndOtherCalls( TBool aEndCalls )
+    {
+    iEndOtherCalls = aEndCalls;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::SetEmergency
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void TPhCltExtPhoneDialData::SetEmergency( TBool aEmergency )
+    {
+    iEmergencyCall = aEmergency;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::SetSubAddress
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void TPhCltExtPhoneDialData::SetSubAddress( 
+    const TPhCltSubAddress& aSubAddress )
+    {
+    iSubAddress = aSubAddress;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::SetSATCall
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void TPhCltExtPhoneDialData::SetSATCall( TBool aSATCall )
+    {
+    iSATCall = aSATCall;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::SetBearer
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void TPhCltExtPhoneDialData::SetBearer( 
+    const TPhCltBearerCapability& aBearer )
+    {
+    iBearer = aBearer;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::SetCallType
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void TPhCltExtPhoneDialData::SetCallType( TPhCltCallType aCallType )
+    {
+    iCallType = aCallType;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::SetSendKeyPressed
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void TPhCltExtPhoneDialData::SetSendKeyPressed( TBool aSendKey )
+    {
+    iSendKey = aSendKey;
+    }
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::WindowGroupId
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt TPhCltExtPhoneDialData::WindowGroupId() const
+    {
+    return iWindowGroup;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::Redial
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt TPhCltExtPhoneDialData::Redial() const
+    {
+    return iRedial;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData:: Redial maximum duration
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TTimeIntervalSeconds TPhCltExtPhoneDialData::RedialMaximumDuration( ) const
+    {
+    return iRedialMaximumDuration;
+    }  
+    
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::NumberType
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt TPhCltExtPhoneDialData::NumberType() const
+    {
+    return iNumberType;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::ReturnToNumberEntryOnFailure
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool TPhCltExtPhoneDialData::ReturnToNumberEntryOnFailure() const
+    {
+    return iReturnToNumberEntryOnFailure;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::AllowMatch
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool TPhCltExtPhoneDialData::AllowMatch() const
+    {
+    return iAllowMatch;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::ShowNumber
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool TPhCltExtPhoneDialData::ShowNumber() const
+    {
+    return iShowNumber;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::Name
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TPhCltNameBuffer& TPhCltExtPhoneDialData::Name() const
+    {
+    return iName;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::ContactId
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TPhCltContactId TPhCltExtPhoneDialData::ContactId() const
+    {
+    return iContactId;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::TelephoneNumber
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TPhCltTelephoneNumber& 
+    TPhCltExtPhoneDialData::TelephoneNumber() const
+    {
+    return iTelNumber;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::EndOtherCalls
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool TPhCltExtPhoneDialData::EndOtherCalls() const
+    {
+    return iEndOtherCalls;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::Emergency
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool TPhCltExtPhoneDialData::Emergency() const
+    {
+    return iEmergencyCall;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::SubAddress
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TPhCltSubAddress& TPhCltExtPhoneDialData::SubAddress() const
+    {
+    return iSubAddress;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::SATCall
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool TPhCltExtPhoneDialData::SATCall() const
+    {
+    return iSATCall;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::Bearer
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TPhCltBearerCapability& TPhCltExtPhoneDialData::Bearer() const
+    {
+    return iBearer;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::CallType
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TPhCltCallType TPhCltExtPhoneDialData::CallType() const
+    {
+    return iCallType;
+    }
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::SendKeyPressed
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool TPhCltExtPhoneDialData::SendKeyPressed() const
+    {
+    return iSendKey;
+    }
+
+// -----------------------------------------------------------------------------
+// TPhCltExtPhoneDialData::AsIPCStruct
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void TPhCltExtPhoneDialData::AsIPCStruct( TPhCltCallArgs& aReturn ) 
+    const
+    {
+    aReturn.iContactId = iContactId;
+    aReturn.iName = iName;
+    aReturn.iRedial = iRedial;
+    aReturn.iTelNumber = iTelNumber;
+    aReturn.iWindowGroup = iWindowGroup;
+    aReturn.iNumberType = iNumberType;
+    aReturn.iSubAddress = iSubAddress;
+    aReturn.iBearer = iBearer;
+    aReturn.iRedialMaximumDuration = iRedialMaximumDuration;
+    // Flags
+    aReturn.iFlags = TPhCltCallArgs::EPhCltCallFlagsDefault;
+
+    if ( iShowNumber )
+        {
+        aReturn.iFlags |= TPhCltCallArgs::EPhCltCallFlagsAllowNumberShowing;
+        }
+
+    if ( iReturnToNumberEntryOnFailure )
+        {
+        aReturn.iFlags |= 
+            TPhCltCallArgs::EPhCltCallFlagsReturnToNumberEntryOnFailure;
+        }
+    if ( iAllowMatch )
+        {
+        aReturn.iFlags |= 
+            TPhCltCallArgs::EPhCltCallFlagsAllowPersonalDirectoryMatching;
+        }
+    if ( iEndOtherCalls )
+        {
+        aReturn.iFlags |= TPhCltCallArgs::EPhCltCallFlagsEndBeforeDial;
+        }
+
+    if ( iEmergencyCall )
+        {
+        aReturn.iFlags |= TPhCltCallArgs::EPhCltCallFlagsEmergencyCall;
+        }
+
+    if ( iSATCall )
+        {
+        aReturn.iFlags |= TPhCltCallArgs::EPhCltCallFlagsSAT;
+        }
+
+    if ( ( iCallType == EPhCltVideo ) || ( iCallType == EPhCltForcedVideo ) )
+        {
+        aReturn.iFlags |= TPhCltCallArgs::EPhCltCallFlagsVideoCall;
+        }
+
+    if ( iCallType == EPhCltCallVoIP )
+        {
+        aReturn.iFlags |= TPhCltCallArgs::EPhCltCallFlagsVoIPCall;
+        }
+        
+    if ( iSendKey )
+        {
+        aReturn.iFlags |= TPhCltCallArgs::EPhCltCallFlagsSendKey;
+        }
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/extcallwrapper/cphcltdialer.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,138 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Dialer class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "cphcltdialer.h" 
+#include    "cphcltdialerdlg.h" 
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CPhCltDialer::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CPhCltDialer* CPhCltDialer::NewL()
+    {
+    CPhCltDialer* self = 
+        new ( ELeave ) CPhCltDialer;
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+
+// Destructor
+CPhCltDialer::~CPhCltDialer()
+    {
+    if ( iDestroyed )
+        {
+        *iDestroyed = ETrue;
+        iDestroyed = NULL;
+        }
+
+    delete iDialDlg;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltDialer::DialData
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TPhCltExtPhoneDialData& 
+    CPhCltDialer::DialData()
+    {
+    return iDialDlg->DialData();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltDialer::ExecuteLD
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CPhCltDialer::ExecuteLD()
+    {
+    TBool destroyed = EFalse;
+    iDestroyed = &destroyed;
+
+    CleanupStack::PushL( this );
+    CleanupStack::PushL( TCleanupItem( DoClear, this ) );
+
+    iDialDlg->ExecuteDialLD();
+
+    if ( !destroyed )
+        {
+        CleanupStack::PopAndDestroy(); // DoClear
+        CleanupStack::PopAndDestroy( this );
+        }
+    else
+        {
+        // Already deleted
+        CleanupStack::Pop();
+        CleanupStack::Pop( this );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltDialer::CPhCltDialer
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPhCltDialer::CPhCltDialer()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltDialer::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CPhCltDialer::ConstructL()
+    {
+    iDialDlg = new ( ELeave ) CPhCltDialerDlg;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltDialer::DoClear
+//
+// -----------------------------------------------------------------------------
+//
+void CPhCltDialer::DoClear( TAny* aAny )
+    {
+    CPhCltDialer* dialer =
+        reinterpret_cast< CPhCltDialer* >( aAny );
+
+    dialer->iDestroyed = NULL;
+    dialer->iDialDlg = NULL;
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/extcallwrapper/cphcltdialerdlg.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,141 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Dialer Dialog
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "cphcltdialerdlg.h" 
+#include    <phoneclient.rsg>
+#include    <cphcltextphonebase.h> 
+
+#include    <avkon.hrh>
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// Destructor
+CPhCltDialerDlg::~CPhCltDialerDlg()
+    {
+    delete iPhoneClient;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltDialerDlg::DialData
+//
+// -----------------------------------------------------------------------------
+//
+TPhCltExtPhoneDialData& CPhCltDialerDlg::DialData()
+    {
+    return iData;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltDialerDlg::ExecuteDialLD
+//
+// -----------------------------------------------------------------------------
+//
+void CPhCltDialerDlg::ExecuteDialLD()
+    {
+    TInt error = KErrNone;
+    iError = &error;
+    if (!iData.Emergency())
+        {
+        ExecuteLD( R_PHCLT_BLANK_DLG );
+        }
+    else
+        {
+        iPhoneClient = CPhCltExtPhoneBase::NewL( this );
+        iPhoneClient->DialL( iData );
+        }
+    User::LeaveIfError( error );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltDialerDlg::PreLayoutDynInitL
+//
+// -----------------------------------------------------------------------------
+//
+void CPhCltDialerDlg::PreLayoutDynInitL()
+    {
+    MakeVisible( EFalse );
+    ButtonGroupContainer().MakeVisible( EFalse );
+
+    // Create phone client and pass observer.
+    iPhoneClient = CPhCltExtPhoneBase::NewL( this );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltDialerDlg::PostLayoutDynInitL
+//
+// -----------------------------------------------------------------------------
+//
+void CPhCltDialerDlg::PostLayoutDynInitL()
+    {
+    iPhoneClient->DialL( iData );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltDialerDlg::OkToExitL
+//
+// -----------------------------------------------------------------------------
+//
+TBool CPhCltDialerDlg::OkToExitL( TInt aButtonId )
+    {
+    if ( aButtonId == EAknSoftkeyEmpty )
+        {
+        return EFalse;
+        }
+    else
+        {
+        return CEikDialog::OkToExitL( aButtonId );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltDialerDlg::Draw
+//
+// -----------------------------------------------------------------------------
+//
+void CPhCltDialerDlg::Draw( const TRect& /*aRect*/ ) const
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltDialerDlg::HandleDialL
+//
+// -----------------------------------------------------------------------------
+//
+void CPhCltDialerDlg::HandleDialL( const TInt aStatus )
+    {
+    if ( iError )
+        {
+        *iError = aStatus;
+        iError = NULL;
+        }
+
+    delete this;
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/extcallwrapper/cphcltextphone.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,200 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Ext Phone for dialing.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32std.h>
+#include    "rphcltextcall.h" 
+#include    "rphcltserver.h" 
+#include    "mphcltextphoneobserver.h" 
+#include    "cphcltextphone.h" 
+
+
+// LOCAL CONSTANTS AND MACROS
+
+// Panic codes.
+enum TPhCltExtPhonePanic
+    {
+    EPhCltExtPhonePanicNoObserver,           // No observer found.
+    EPhCltExtPhonePanicInvalidOperationMode  // Operation mode was invalid.
+    };
+
+
+// LOCAL FUNCTION PROTOTYPES
+
+// Panic function. Called if panic situation happens.
+void Panic( TPhCltExtPhonePanic aPanic );
+
+
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// Panic
+// 
+// Panics the client
+//
+// -----------------------------------------------------------------------------
+//
+void Panic( TPhCltExtPhonePanic aPanic )
+    {
+    _LIT(KPhCltExtPhonePanicCategory, "CPhCltExtPhone");
+    User::Panic( KPhCltExtPhonePanicCategory, aPanic );
+    }
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhCltExtPhone::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPhCltExtPhone* CPhCltExtPhone::NewL( MPhCltExtPhoneObserver* aObserver )
+    {
+    CPhCltExtPhone* self = new ( ELeave ) CPhCltExtPhone( aObserver );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+    }   
+
+
+// Destructor
+CPhCltExtPhone::~CPhCltExtPhone()
+    {
+    // Cancel, close subsessions and finally close the session.
+
+    Cancel();
+    iCall.Close();
+    iServer.Close();
+    }
+
+
+
+
+// -----------------------------------------------------------------------------
+// CPhCltExtPhone::DialL
+// 
+// If a request is pending, leave with error code KErrInUse.
+// Otherwise, create a dial request. 
+// -----------------------------------------------------------------------------
+//
+void CPhCltExtPhone::DialL( const TPhCltExtPhoneDialData& aData )
+    {
+    DialPreconditionCheckL();
+    iCall.Dial( iStatus, aData );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltExtPhone::CPhCltExtPhone
+// -----------------------------------------------------------------------------
+//
+CPhCltExtPhone::CPhCltExtPhone( MPhCltExtPhoneObserver* aObserver )
+    : CPhCltExtPhoneBase( aObserver ), iMode( EIdle )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltExtPhone::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CPhCltExtPhone::ConstructL() 
+    {
+    User::LeaveIfError( iServer.Connect() );
+    User::LeaveIfError( iCall.Open( iServer ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltExtPhone::RunL
+// 
+// The method is called when a request is completed. Thus,
+// it calls appropriate observer method.
+// -----------------------------------------------------------------------------
+//
+void CPhCltExtPhone::RunL()
+    {
+    __ASSERT_ALWAYS( iObserver, Panic( EPhCltExtPhonePanicNoObserver ) );
+    if( iStatus != KErrCancel )
+        {
+        switch( iMode )
+            {                         
+            case EDialling:
+                iObserver->HandleDialL( iStatus.Int() );
+                break;
+            case EIdle:
+                break;
+            default:
+                Panic( EPhCltExtPhonePanicInvalidOperationMode );
+                break;
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltExtPhone::DoCancel
+// 
+// Cancels the pending request.
+// -----------------------------------------------------------------------------
+//
+void CPhCltExtPhone::DoCancel()
+    {
+    switch( iMode )
+        {                         
+        case EDialling:
+            iCall.CancelDial();
+            break;
+        case EIdle:
+            break;
+        default:
+            Panic( EPhCltExtPhonePanicInvalidOperationMode );
+            break;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltExtPhone::DialPreconditionCheckL
+// 
+// See header
+// -----------------------------------------------------------------------------
+//
+void CPhCltExtPhone::DialPreconditionCheckL()
+    {
+    if( IsActive() )
+        {
+        User::Leave( KErrInUse );
+        }
+    if( iCall.SubSessionHandle() == 0 )
+        {
+        User::Leave( KErrBadHandle );
+        }
+    iMode = EDialling;
+    SetActive();
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/extcallwrapper/cphcltextphonebase.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Ext Phone Base, dialing base class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "cphcltextphonebase.h" 
+#include    "cphcltextphone.h" 
+#include    "phclttypes.h" 
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhCltExtPhoneBase::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CPhCltExtPhoneBase* CPhCltExtPhoneBase::NewL( 
+    MPhCltExtPhoneObserver* aObserver )
+    {
+    return CPhCltExtPhone::NewL( aObserver );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltExtPhoneBase::CPhCltExtPhoneBase
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPhCltExtPhoneBase::CPhCltExtPhoneBase( MPhCltExtPhoneObserver* aObserver )
+    : CActive( EPriorityStandard ), iObserver( aObserver )
+    {
+    }
+    
+
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/extcallwrapper/extcallwrapper_aiw/cphcltdialer.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,138 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Dialer class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "cphcltdialer.h" 
+#include    "cphcltdialerdlg.h" 
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CPhCltDialer::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CPhCltDialer* CPhCltDialer::NewL()
+    {
+    CPhCltDialer* self = 
+        new ( ELeave ) CPhCltDialer;
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+
+// Destructor
+CPhCltDialer::~CPhCltDialer()
+    {
+    if ( iDestroyed )
+        {
+        *iDestroyed = ETrue;
+        iDestroyed = NULL;
+        }
+
+    delete iDialDlg;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltDialer::DialData
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CPhCltExtPhoneDialData& 
+    CPhCltDialer::DialData()
+    {
+    return iDialDlg->DialData();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltDialer::ExecuteLD
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CPhCltDialer::ExecuteLD()
+    {
+    TBool destroyed = EFalse;
+    iDestroyed = &destroyed;
+
+    CleanupStack::PushL( this );
+    CleanupStack::PushL( TCleanupItem( DoClear, this ) );
+
+    iDialDlg->ExecuteDialLD();
+
+    if ( !destroyed )
+        {
+        CleanupStack::PopAndDestroy(); // DoClear
+        CleanupStack::PopAndDestroy( this );
+        }
+    else
+        {
+        // Already deleted
+        CleanupStack::Pop();
+        CleanupStack::Pop( this );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltDialer::CPhCltDialer
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPhCltDialer::CPhCltDialer()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltDialer::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CPhCltDialer::ConstructL()
+    {
+    iDialDlg = new ( ELeave ) CPhCltDialerDlg;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltDialer::DoClear
+//
+// -----------------------------------------------------------------------------
+//
+void CPhCltDialer::DoClear( TAny* aAny )
+    {
+    CPhCltDialer* dialer =
+        reinterpret_cast< CPhCltDialer* >( aAny );
+
+    dialer->iDestroyed = NULL;
+    dialer->iDialDlg = NULL;
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/extcallwrapper/extcallwrapper_aiw/cphcltdialerdlg.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,141 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Dialer Dialog
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "cphcltdialerdlg.h" 
+#include    <phoneclient.rsg>
+#include    <cphcltextphonebase.h> 
+
+#include    <avkon.hrh>
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// Destructor
+CPhCltDialerDlg::~CPhCltDialerDlg()
+    {
+    delete iPhoneClient;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltDialerDlg::DialData
+//
+// -----------------------------------------------------------------------------
+//
+CPhCltExtPhoneDialData& CPhCltDialerDlg::DialData()
+    {
+    return *iData;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltDialerDlg::ExecuteDialLD
+//
+// -----------------------------------------------------------------------------
+//
+void CPhCltDialerDlg::ExecuteDialLD()
+    {
+    TInt error = KErrNone;
+    iError = &error;
+    if (!iData->Emergency())
+        {
+        ExecuteLD( R_PHCLT_BLANK_DLG );
+        }
+    else
+        {
+        iPhoneClient = CPhCltExtPhoneBase::NewL( this );
+        iPhoneClient->DialL( *iData );
+        }
+    User::LeaveIfError( error );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltDialerDlg::PreLayoutDynInitL
+//
+// -----------------------------------------------------------------------------
+//
+void CPhCltDialerDlg::PreLayoutDynInitL()
+    {
+    MakeVisible( EFalse );
+    ButtonGroupContainer().MakeVisible( EFalse );
+
+    // Create phone client and pass observer.
+    iPhoneClient = CPhCltExtPhoneBase::NewL( this );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltDialerDlg::PostLayoutDynInitL
+//
+// -----------------------------------------------------------------------------
+//
+void CPhCltDialerDlg::PostLayoutDynInitL()
+    {
+    iPhoneClient->DialL( *iData );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltDialerDlg::OkToExitL
+//
+// -----------------------------------------------------------------------------
+//
+TBool CPhCltDialerDlg::OkToExitL( TInt aButtonId )
+    {
+    if ( aButtonId == EAknSoftkeyEmpty )
+        {
+        return EFalse;
+        }
+    else
+        {
+        return CEikDialog::OkToExitL( aButtonId );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltDialerDlg::Draw
+//
+// -----------------------------------------------------------------------------
+//
+void CPhCltDialerDlg::Draw( const TRect& /*aRect*/ ) const
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltDialerDlg::HandleDialL
+//
+// -----------------------------------------------------------------------------
+//
+void CPhCltDialerDlg::HandleDialL( const TInt aStatus )
+    {
+    if ( iError )
+        {
+        *iError = aStatus;
+        iError = NULL;
+        }
+
+    delete this;
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/extcallwrapper/extcallwrapper_aiw/cphcltextphone.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,191 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Ext Phone for dialing.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32std.h>
+#include    "mphcltextphoneobserver.h" 
+#include    "cphcltextphone.h" 
+#include    "cphcltextphonedialdata.h" 
+
+// LOCAL CONSTANTS AND MACROS
+
+// Panic codes.
+enum TPhCltExtPhonePanic
+    {
+    EPhCltExtPhonePanicNoObserver,           // No observer found.
+    EPhCltExtPhonePanicInvalidOperationMode  // Operation mode was invalid.
+    };
+
+
+// LOCAL FUNCTION PROTOTYPES
+
+// Panic function. Called if panic situation happens.
+void Panic( TPhCltExtPhonePanic aPanic );
+
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// Panic
+// 
+// Panics the client
+//
+// -----------------------------------------------------------------------------
+//
+void Panic( TPhCltExtPhonePanic aPanic )
+    {
+    _LIT(KPhCltExtPhonePanicCategory, "CPhCltExtPhone");
+    User::Panic( KPhCltExtPhonePanicCategory, aPanic );
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhCltExtPhone::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPhCltExtPhone* CPhCltExtPhone::NewL( MPhCltExtPhoneObserver* aObserver )
+    {
+    CPhCltExtPhone* self = new ( ELeave ) CPhCltExtPhone( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }   
+
+// Destructor
+CPhCltExtPhone::~CPhCltExtPhone()
+    {
+    delete iPackage;
+    
+    // Cancel, close subsessions and finally close the session.
+    Cancel();
+    iCall.Close();
+    iServer.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltExtPhone::DialL
+// 
+// If a request is pending, leave with error code KErrInUse.
+// Otherwise, create a dial request. 
+// -----------------------------------------------------------------------------
+//
+void CPhCltExtPhone::DialL( CPhCltExtPhoneDialData& aData )
+    {
+    DialPreconditionCheckL();
+    delete iPackage;
+    iPackage = NULL;
+    
+    // packs params 
+    iPackage = aData.PackLC();
+    CleanupStack::Pop( iPackage );    
+    TInt datalength = aData.CalculatePackageSize();
+    if ( iPackage )
+        {
+        iCall.Dial( iStatus, *iPackage, datalength );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltExtPhone::CPhCltExtPhone
+// -----------------------------------------------------------------------------
+//
+CPhCltExtPhone::CPhCltExtPhone( MPhCltExtPhoneObserver* aObserver )
+    : CPhCltExtPhoneBase( aObserver ), iMode( EIdle )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltExtPhone::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CPhCltExtPhone::ConstructL() 
+    {
+    User::LeaveIfError( iServer.Connect() );
+    User::LeaveIfError( iCall.Open( iServer ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltExtPhone::RunL
+// 
+// The method is called when a request is completed. Thus,
+// it calls appropriate observer method.
+// -----------------------------------------------------------------------------
+//
+void CPhCltExtPhone::RunL()
+    {
+    __ASSERT_ALWAYS( iObserver, Panic( EPhCltExtPhonePanicNoObserver ) );
+    switch( iMode )
+        {                         
+        case EDialling:
+            iObserver->HandleDialL( iStatus.Int() );
+            break;
+        case EIdle:
+            break;
+        default:
+            Panic( EPhCltExtPhonePanicInvalidOperationMode );
+            break;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltExtPhone::DoCancel
+// 
+// Cancels the pending request.
+// -----------------------------------------------------------------------------
+//
+void CPhCltExtPhone::DoCancel()
+    {
+    switch( iMode )
+        {                         
+        case EDialling:
+            iCall.CancelDial();
+            break;
+        case EIdle:
+            break;
+        default:
+            Panic( EPhCltExtPhonePanicInvalidOperationMode );
+            break;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltExtPhone::DialPreconditionCheckL
+// 
+// See header
+// -----------------------------------------------------------------------------
+//
+void CPhCltExtPhone::DialPreconditionCheckL()
+    {
+    if( IsActive() )
+        {
+        User::Leave( KErrInUse );
+        }
+    if( iCall.SubSessionHandle() == 0 ) 
+        {
+        User::Leave( KErrBadHandle );
+        }
+    iMode = EDialling;
+    SetActive();
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/extcallwrapper/extcallwrapper_aiw/cphcltextphonebase.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Ext Phone Base, dialing base class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "cphcltextphonebase.h" 
+#include    "cphcltextphone.h" 
+#include    "phclttypes.h" 
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhCltExtPhoneBase::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CPhCltExtPhoneBase* CPhCltExtPhoneBase::NewL( 
+    MPhCltExtPhoneObserver* aObserver )
+    {
+    return CPhCltExtPhone::NewL( aObserver );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltExtPhoneBase::CPhCltExtPhoneBase
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPhCltExtPhoneBase::CPhCltExtPhoneBase( MPhCltExtPhoneObserver* aObserver )
+    : CActive( EPriorityStandard ), iObserver( aObserver )
+    {
+    }
+    
+
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/ihf/rphcltihf.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,103 @@
+/*
+* 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:  IHF
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "rphcltserver.h" 
+#include "rphcltihf.h" 
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// RPhCltIhf::RPhCltIhf
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RPhCltIhf::RPhCltIhf( )
+    : RSubSessionBase()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltIhf::Open
+// Connect to the  server - default number of message slots = 1
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RPhCltIhf::Open( RPhCltServer& aServer, TInt /*aPriority*/ )
+    {
+    __ASSERT_ALWAYS( aServer.Handle() , 
+        User::Panic( KPhClientPanicCategory , KErrBadHandle ) );
+
+    return CreateSubSession( 
+        aServer, 
+        EPhoneServerIhfSubSessionOpen, 
+        TIpcArgs() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltIhf::Close
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RPhCltIhf::Close()
+    {    
+    CloseSubSession( EPhoneServerIhfSubSessionClose );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltIhf::SetIhfMode
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RPhCltIhf::SetIhfMode( TBool aMode, TBool aShowNote )
+    {
+    __ASSERT_ALWAYS( SubSessionHandle() , 
+        User::Panic( KPhClientPanicCategory , KErrBadHandle ) );
+
+    return SendReceive( 
+        EPhoneServerIhfSubSessionSetMode, 
+        TIpcArgs( 
+            aMode,
+            aShowNote ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltIhf::SetIhfModeFromPhone
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RPhCltIhf::SetIhfModeFromPhone( TBool aMode, TBool aShowNote )
+    {
+    __ASSERT_ALWAYS( SubSessionHandle() , 
+        User::Panic( KPhClientPanicCategory , KErrBadHandle ) );
+    
+    return SendReceive( 
+        EPhoneServerIhfSubSessionSetModeFromPhone, 
+        TIpcArgs( 
+            aMode,
+            aShowNote ) );
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/ihf/rphcltihfstub.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,82 @@
+/*
+* 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:  IHF
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "rphcltserver.h" 
+#include "rphcltihf.h" 
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// RPhCltIhf::RPhCltIhf
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RPhCltIhf::RPhCltIhf( )
+    : RSubSessionBase()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltIhf::Open
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RPhCltIhf::Open( RPhCltServer& /*aServer*/, TInt /*aPriority*/ )
+    {
+    return KErrNotSupported;
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltIhf::Close
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RPhCltIhf::Close()
+    {    
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltIhf::SetIhfMode
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RPhCltIhf::SetIhfMode( TBool /*aMode*/, TBool /*aShowNote*/ )
+    {
+    return KErrNotSupported;
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltIhf::SetIhfModeFromPhone
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RPhCltIhf::SetIhfModeFromPhone( 
+        TBool /*aMode*/, TBool /*aShowNote*/ )
+    {
+    return KErrNotSupported;
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/imagehandler/cphcltbaseimageparams.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,263 @@
+/*
+* 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:  Parameter class.
+*
+*/
+
+
+#include    "cphcltbaseimageparams.h" 
+#include    "phcltclientserver.h" 
+// -----------------------------------------------------------------------------
+// CPhCltBaseImageParams::CPhCltBaseImageParams
+// 
+// C++ constructor.
+// -----------------------------------------------------------------------------
+//
+CPhCltBaseImageParams::CPhCltBaseImageParams( 
+    const TPhCltImageType aType )
+    {
+    iImages().iType = aType;    
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltBaseImageParams::Type
+// 
+// Returns type.
+// -----------------------------------------------------------------------------
+//
+TPhCltImageType CPhCltBaseImageParams::Type() const
+    {
+    return iImages().iType;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltBaseImageParams::AddImage
+// 
+// Adds an image.
+// -----------------------------------------------------------------------------
+//
+void CPhCltBaseImageParams::AddImageL( TInt aHandle )
+    {
+    if ( iImages().iImageCount > KPhCltImagesArrayLen - 1 ) 
+        {
+        User::Leave( KErrOverflow );
+        }
+    iImages().iImages[ iImages().iImageCount ] = aHandle;
+    iImages().iImageCount++;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltBaseImageParams::Clean
+// 
+// Cleans class content.
+// -----------------------------------------------------------------------------
+//
+void CPhCltBaseImageParams::Clean()
+    {
+    iImages().iImageCount = 0;
+    for ( TInt i = 0; i < KPhCltImagesArrayLen; i++ )
+        {
+        iImages().iImages[ i ] = 0;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltBaseImageParams::CPhCltBaseImageParams
+// 
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CPhCltBaseImageParams::~CPhCltBaseImageParams()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltBaseImageParams::operator=
+// 
+// Assignment operator.
+// -----------------------------------------------------------------------------
+//
+CPhCltBaseImageParams& CPhCltBaseImageParams::
+    operator=( const CPhCltBaseImageParams& aParamClass )
+    {
+    Clean();
+    this->iImages().iType = aParamClass.iImages().iType;
+    this->iImages().iImageCount = aParamClass.iImages().iImageCount;
+    for ( TInt i = 0; i < KPhCltImagesArrayLen; i++ )
+        {
+        iImages().iImages[ i ] = aParamClass.iImages().iImages[ i ];
+        }
+    return *this;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltBaseImageParams::GetImageL
+// 
+// Gets an image handle.
+// -----------------------------------------------------------------------------
+//
+TInt CPhCltBaseImageParams::GetImageL( const TInt aIndex ) const
+    {
+    if ( aIndex > iImages().iImageCount - 1 ) 
+        {
+        User::Leave( KErrArgument );
+        }
+    return iImages().iImages[ aIndex ];
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltBaseImageParams::Count
+// 
+// Return image count.
+// -----------------------------------------------------------------------------
+//
+TInt CPhCltBaseImageParams::Count() const
+    {
+    return iImages().iImageCount;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltBaseImageParams::Images
+// 
+// Returns all images.
+// -----------------------------------------------------------------------------
+//
+TPckgBuf< TPhCltImageArray >& CPhCltBaseImageParams::Images()
+    {
+    return iImages;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltBaseImageParams::CPhCltBaseImageParams
+// 
+// C++ constructor.
+// -----------------------------------------------------------------------------
+//
+CPhCltExtVTImageParams::CPhCltExtVTImageParams( const TPhCltImageType aType ) 
+    : CPhCltBaseImageParams( aType )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltBaseImageParams::NewL
+// 
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CPhCltExtVTImageParams* CPhCltExtVTImageParams::NewL( 
+    const TPhCltImageType aType )
+    {
+    CPhCltExtVTImageParams* self = NULL; 
+    if ( aType != EPhCltTypeVTDefault )  // default image opening changed
+        {
+        self = new( ELeave ) CPhCltExtVTImageParams( aType );
+        }
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltExtVTImageParams::~CPhCltExtVTImageParams
+// 
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CPhCltExtVTImageParams::~CPhCltExtVTImageParams()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltExtOperatorLogoParams::CPhCltExtOperatorLogoParams
+// 
+// C++ constructor.
+// -----------------------------------------------------------------------------
+//
+CPhCltExtOperatorLogoParams::CPhCltExtOperatorLogoParams()
+: CPhCltBaseImageParams( EPhCltTypeOperatorLogo )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltBaseImageParams::NewL
+// 
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CPhCltExtOperatorLogoParams* CPhCltExtOperatorLogoParams::NewL()
+    {
+    CPhCltExtOperatorLogoParams* self =
+        new( ELeave )CPhCltExtOperatorLogoParams();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltBaseImageParams::CPhCltBaseImageParams
+// 
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CPhCltExtOperatorLogoParams::~CPhCltExtOperatorLogoParams()
+    {
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhCltExtOperatorLogoParams::AddImage
+// 
+// Adds an image.
+// -----------------------------------------------------------------------------
+//
+void CPhCltExtOperatorLogoParams::AddImageL( TInt aHandle )
+    {
+    iImages().iImages[ EPhCltExtOperatorLogoIndex ] = aHandle;
+    iImages().iImageCount = 1;
+    }    
+    
+// -----------------------------------------------------------------------------
+// CPhCltBaseImageParams::operator=
+// 
+// Assignment operator.
+// -----------------------------------------------------------------------------
+//
+CPhCltBaseImageParams& CPhCltExtOperatorLogoParams::
+    operator=( const CPhCltBaseImageParams& aParamClass )
+    {
+    Clean();
+    this->iImages().iType = aParamClass.iImages().iType;
+    this->iImages().iImageCount = aParamClass.iImages().iImageCount;
+    this->iImages().iImages[ EPhCltExtOperatorLogoIndex ] = 
+        aParamClass.iImages().iImages[ EPhCltExtOperatorLogoIndex ];
+    this->iImages().iImages[ EPhCltExtCountryCodeIndex ] = 
+        aParamClass.iImages().iImages[ EPhCltExtCountryCodeIndex ];
+    this->iImages().iImages[ EPhCltExtNetworkCodeIndex ] = 
+        aParamClass.iImages().iImages[ EPhCltExtNetworkCodeIndex ];
+    this->iImages().iImages[ EPhCltExtLogoTypeIndex ] = 
+        aParamClass.iImages().iImages[ EPhCltExtLogoTypeIndex ];        
+    return *this;
+    }    
+    
+// -----------------------------------------------------------------------------
+// CPhCltExtOperatorLogoParams::SetCodesL
+// 
+// Sets country and network code.
+// -----------------------------------------------------------------------------
+//    
+void CPhCltExtOperatorLogoParams::SetCodesL( const TPhCltCountryCode aCountryCode, 
+    const TPhCltNetworkCode aNetworkCode,
+    const TPhCltExtOperatorLogoType aLogoType )
+    {
+    iImages().iImages[ EPhCltExtCountryCodeIndex ] = aCountryCode;
+    iImages().iImages[ EPhCltExtNetworkCodeIndex ] = aNetworkCode;
+    iImages().iImages[ EPhCltExtLogoTypeIndex ] = aLogoType;
+    }    
+
+// END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/imagehandler/cphcltimagehandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 Handler Base class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "cphcltimagehandler.h" 
+#include    "cphcltimagehandlerimplementation.h" 
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhCltMessenger::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CPhCltImageHandler* CPhCltImageHandler::NewL()
+    {
+    return CPhCltImageHandlerImplementation::NewL();
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltMessenger::CPhCltMessenger
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPhCltImageHandler::CPhCltImageHandler( )
+    {
+    }
+    
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/imagehandler/cphcltimagehandlerimplementation.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,286 @@
+/*
+* 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:  Implementation of the PhoneClient Messenger interface.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "cphcltimagehandlerimplementation.h" 
+
+#ifdef _DEBUG
+#define _DxPRINT( x ) RDebug::Print(_L( x ) );
+#define _DxPRINT2( x,y ) RDebug::Print(_L( x ), y );
+#else
+#define _DxPRINT(x)
+#define _DxPRINT2( x,y ) 
+#endif
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhCltImageHandlerImplementation::NewL
+// 
+// Creates Phone Client image handler instance.
+// -----------------------------------------------------------------------------
+//
+CPhCltImageHandlerImplementation* 
+    CPhCltImageHandlerImplementation::NewL()
+    {
+    CPhCltImageHandlerImplementation* self = 
+        new (ELeave) CPhCltImageHandlerImplementation();   
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltImageHandlerImplementation::~CPhCltImageHandlerImplementation
+// 
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CPhCltImageHandlerImplementation::~CPhCltImageHandlerImplementation()
+    {
+    iStillHandler.Close();
+    iServer.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltImageHandlerImplementation::SaveImages
+// 
+// Saves a number of images to PhoneServer.
+// -----------------------------------------------------------------------------
+//
+TInt CPhCltImageHandlerImplementation::
+    SaveImages( CPhCltImageParams& aParams )
+    {
+    return iStillHandler.SaveImages( aParams );
+    }
+  
+// -----------------------------------------------------------------------------
+// CPhCltImageHandlerImplementation::LoadImages
+// 
+// Loads a number of images from PhoneServer.
+// -----------------------------------------------------------------------------
+//  
+TInt CPhCltImageHandlerImplementation::
+    LoadImages( CPhCltImageParams*& aParams )
+    {
+    return iStillHandler.LoadImages( aParams );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltImageHandlerImplementation::CPhCltImageHandlerImplementation
+// 
+// C++ constructor.
+// -----------------------------------------------------------------------------
+//
+CPhCltImageHandlerImplementation::CPhCltImageHandlerImplementation()
+    {
+    }
+    
+    
+ // -----------------------------------------------------------------------------
+// CPhCltImageHandlerImplementation::ConstructL
+// 
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CPhCltImageHandlerImplementation::ConstructL()
+    {
+    User::LeaveIfError( iServer.Connect() );    
+    User::LeaveIfError ( iStillHandler.Open( iServer ) ); 
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltImageHandlerImplementation::CPhCltBaseImageParamsL
+// 
+// Creates Phone Client image handler parameter class instance.
+// -----------------------------------------------------------------------------
+//
+CPhCltImageParams* CPhCltImageHandlerImplementation::
+    CPhCltBaseImageParamsL( const TPhCltImageType aType )
+    {
+    CPhCltBaseImageParams* param = NULL;
+    switch ( aType )
+        {
+        case EPhCltTypeVTStill:        
+        case EPhCltTypeVTDefault: // <- this returns NULL
+            param = CPhCltExtVTImageParams::NewL( aType );
+            break;
+        case EPhCltTypeOperatorLogo:
+            param = CPhCltExtOperatorLogoParams::NewL();
+            break;
+        default:
+            User::Leave( KErrArgument );
+            break;
+        }
+    return param;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltImageHandlerImplementation::OpenDefaultVtImage
+// 
+// Opens Video telephony default image.
+// -----------------------------------------------------------------------------
+//
+TInt CPhCltImageHandlerImplementation::OpenDefaultVtImage( RFile& aFile )
+    {
+    _DxPRINT("CPhCltImageHandlerImplementation.OpenDefaultVtImage")
+    return OpenVtImageCommon( aFile, ETrue );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltImageHandlerImplementation::SaveVtImageL
+// -----------------------------------------------------------------------------
+void CPhCltImageHandlerImplementation::SaveVtImageL( 
+    MPhCltImageObserver& aObserver,
+    const TDesC& aImagePath )
+    {
+    // new style saving not supported yet
+    User::Leave( KErrNotSupported );    
+    iVtImageSaver =
+        CPhCltImageHandlerImplementation::CVtImageSaver::SaveLD( 
+            *this, iStillHandler, aImagePath );
+    iObserver = &aObserver;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltImageHandlerImplementation::CancelSaveVtImage
+// -----------------------------------------------------------------------------
+void CPhCltImageHandlerImplementation::CancelSaveVtImage()
+    {
+    if ( iVtImageSaver )
+        {
+        iVtImageSaver->Cancel();
+        iVtImageSaver = NULL;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CPhCltImageHandlerImplementation::OpenVtImageCommon
+// -----------------------------------------------------------------------------
+TInt CPhCltImageHandlerImplementation::OpenVtImageCommon( 
+    RFile& aFile, 
+    const TBool aDefaultImage )
+    {
+    _DxPRINT2("CPhCltImageHandlerImplementation.OpenDefaultVtImage default=%d",
+        aDefaultImage)
+    TInt fileServerHandle( 0 );    
+    TInt fileHandle( 0 );
+    // ensure file handle is not open
+    aFile.Close();
+    fileServerHandle = iStillHandler.OpenVtImage( fileHandle, aDefaultImage );
+    _DxPRINT2("CPhCltImageHandlerImplementation.OpenDefaultVtImage fileServerHandle=%d",
+        fileServerHandle )
+    TInt result( fileServerHandle );
+    if ( fileServerHandle > 0 )
+        {
+        result = aFile.AdoptFromServer( fileServerHandle, fileHandle );
+        }
+   _DxPRINT2("CPhCltImageHandlerImplementation.OpenDefaultVtImage result=%d",
+        result )
+    return result;
+    }
+        
+// -----------------------------------------------------------------------------
+// CPhCltImageHandlerImplementation::OpenVtImage
+// -----------------------------------------------------------------------------
+TInt CPhCltImageHandlerImplementation::OpenVtImage( RFile& aFile )
+    {   
+    return OpenVtImageCommon( aFile, EFalse );    
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltImageHandlerImplementation::HandleImageSaveCompleteL
+// -----------------------------------------------------------------------------
+void CPhCltImageHandlerImplementation::HandleImageSaveCompleteL( TInt aResult )
+    {
+    if ( iObserver )
+        {
+        iVtImageSaver = NULL; // the saver deletes itself
+        MPhCltImageObserver* obs = iObserver;
+        iObserver = NULL;
+        obs->HandleImageSaveCompleteL( aResult );        
+        }
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhCltImageHandlerImplementation::CVtImageSaver::SaveLD
+// -----------------------------------------------------------------------------
+CPhCltImageHandlerImplementation::CVtImageSaver* 
+    CPhCltImageHandlerImplementation::CVtImageSaver::SaveLD(
+    MPhCltImageObserver& aObserver,
+    RPhCltImageHandler& aHandler,
+    const TDesC& aImagePath )
+    {
+    CPhCltImageHandlerImplementation::CVtImageSaver* saver = 
+        new ( ELeave ) CPhCltImageHandlerImplementation::CVtImageSaver(
+        aObserver, aHandler );
+    CleanupStack::PushL( saver );
+    saver->DoSave( aImagePath );
+    CleanupStack::Pop();
+    return saver;
+    }
+
+                                      
+// -----------------------------------------------------------------------------
+// CPhCltImageHandlerImplementation::CVtImageSaver::CVtImageSaver
+// -----------------------------------------------------------------------------
+CPhCltImageHandlerImplementation::CVtImageSaver::CVtImageSaver( 
+    MPhCltImageObserver& aObserver,
+    RPhCltImageHandler& aHandler ) : CActive( CActive::EPriorityStandard ),
+    iObserver( aObserver), iHandler( aHandler )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltImageHandlerImplementation::CVtImageSaver::~CVtImageSaver
+// -----------------------------------------------------------------------------
+CPhCltImageHandlerImplementation::CVtImageSaver::~CVtImageSaver()
+    {
+    Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltImageHandlerImplementation::CVtImageSaver::DoSave
+// -----------------------------------------------------------------------------
+void CPhCltImageHandlerImplementation::CVtImageSaver::DoSave( 
+    const TDesC& aImagePath )
+    {
+    iHandler.SaveVtImage( iStatus, aImagePath );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltImageHandlerImplementation::CVtImageSaver::RunL
+// -----------------------------------------------------------------------------
+void CPhCltImageHandlerImplementation::CVtImageSaver::RunL()
+    {
+    MPhCltImageObserver& observer = iObserver;
+    delete this;
+    TRAP_IGNORE( observer.HandleImageSaveCompleteL( iStatus.Int() ) );    
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltImageHandlerImplementation::CVtImageSaver::DoCancel
+// -----------------------------------------------------------------------------
+void CPhCltImageHandlerImplementation::CVtImageSaver::DoCancel()
+    {
+    iHandler.CancelSaveVtImage();
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/imagehandler/cphcltoperatorlogocontainer.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2004-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:  Operator logo container.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "cphcltoperatorlogocontainer.h" 
+
+// CONSTANTS
+
+
+// -----------------------------------------------------------------------------
+// CPhCltOperatorLogoContainer::CPhCltOperatorLogoContainer
+// 
+// Constructor.
+// -----------------------------------------------------------------------------
+//   
+CPhCltOperatorLogoContainer::CPhCltOperatorLogoContainer(
+    const TPhCltCountryCode aCountryCode, const TPhCltNetworkCode aNetworkCode,
+    const TPhCltExtOperatorLogoType aLogoType, CFbsBitmap* aBitmap ) :
+    iBitmap( aBitmap ), iCountryCode( aCountryCode ), 
+    iNetworkCode( aNetworkCode ), iLogoType( aLogoType )
+    {
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhCltOperatorLogoContainer::~CPhCltOperatorLogoContainer
+// 
+// Destructor.
+// -----------------------------------------------------------------------------
+//   
+CPhCltOperatorLogoContainer::~CPhCltOperatorLogoContainer( ) 
+    {
+    delete iBitmap;
+    iBitmap = NULL;
+    }
+    
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/imagehandler/rphcltimagehandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,282 @@
+/*
+* Copyright (c) 2004-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:  TPhoneServer interface for image handling.
+*
+*/
+
+
+// INCLUDES
+
+#include    "rphcltimagehandler.h" 
+#include    "phcltclientserver.h" 
+#include    <rphcltserver.h> 
+#include    <e32std.h>
+#include    <e32base.h>
+#include    <fbs.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// RPhCltImageHandler::RPhCltImageHandler
+// 
+// C++ constructor can NOT contain any code, that might leave.
+// -----------------------------------------------------------------------------
+//
+RPhCltImageHandler::RPhCltImageHandler()
+:   RSubSessionBase()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltImageHandler::Open
+// 
+// Open subsession to Phone Server.
+// -----------------------------------------------------------------------------
+//
+TInt RPhCltImageHandler::Open( RPhCltServer& aServer )
+    {
+    __ASSERT_ALWAYS( aServer.Handle(), User::Panic( 
+            KPhClientPanicCategory, 
+            EPhCltClientSidePanicNullHandle ) );
+
+    return CreateSubSession( 
+        aServer, 
+        EPhoneServerImageHandlerSubSessionOpen, 
+        TIpcArgs() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltImageHandler::Close
+// 
+// Close subsession.
+// -----------------------------------------------------------------------------
+//
+void RPhCltImageHandler::Close()
+    {
+    iVTBitMaps.ResetAndDestroy();
+    iOperatorLogos.ResetAndDestroy();
+    CloseSubSession( EPhoneServerImageHandlerSubSessionClose );
+    }
+
+// -----------------------------------------------------------------------------
+// RPhCltImageHandler::SaveImages
+// 
+// Saves images to Phoneserver.
+// -----------------------------------------------------------------------------
+//
+TInt RPhCltImageHandler::SaveImages( CPhCltImageParams& aParams )
+    {
+    __ASSERT_ALWAYS( 
+        SubSessionHandle(), User::Panic( 
+            KPhClientPanicCategory, EPhCltClientSidePanicNullHandle ) );
+
+    return SendReceive( 
+        EPhoneServerImageHandlerSubSessionSave, 
+        TIpcArgs( 
+            &aParams.Images()) );
+    }     
+    
+// -----------------------------------------------------------------------------
+// RPhCltImageHandler::LoadImages
+// 
+// Loads images from Phoneserver.
+// -----------------------------------------------------------------------------
+//
+TInt RPhCltImageHandler::LoadImages( CPhCltImageParams*& aParams )
+    {
+    __ASSERT_ALWAYS( 
+        SubSessionHandle(), User::Panic( 
+            KPhClientPanicCategory, EPhCltClientSidePanicNullHandle ) );
+
+    const TInt ret = SendReceive( EPhoneServerImageHandlerSubSessionLoad, 
+        TIpcArgs( &aParams->Images() ) );
+        
+    // No point in commiting if failed.
+    if ( ret != KErrNone )
+        {
+        return ret;
+        }
+    return FinalizeLoad( aParams->Images() );
+    }
+ 
+// -----------------------------------------------------------------------------
+// RPhCltImageHandler::FinalizeLoad
+// 
+// Duplicates loaded images, and commits transaction.
+// -----------------------------------------------------------------------------
+//    
+TInt RPhCltImageHandler::FinalizeLoad( TPckgBuf< TPhCltImageArray >& aImages )
+    {
+    TRAPD( err, 
+        {
+        switch( aImages.operator()().iType )
+            {
+            case EPhCltTypeVTStill:
+            case EPhCltTypeVTDefault:
+                CopyStillsL( aImages.operator()() );
+                break;
+            case EPhCltTypeOperatorLogo:
+                CopyLogosL( aImages.operator()() );
+                break;
+            default:
+                break;
+            }
+        } );
+
+    // Must release in any case
+    const TInt ret = SendReceive( EPhoneServerImageHandlerSubSessionCommitLoad, 
+        TIpcArgs( &aImages ) );
+
+    return err != KErrNone ? err : ret;
+
+    }
+
+// -----------------------------------------------------------------------------
+// RPhCltImageHandler::CopyLogos
+// 
+// Replaces / appends a new logo.
+// -----------------------------------------------------------------------------
+//    
+void RPhCltImageHandler::CopyLogosL( TPhCltImageArray& aImages )
+    {
+    TBool found( EFalse );
+    CFbsBitmap* bitMap = 
+        CreateBitMapL( aImages.iImages[ EPhCltExtOperatorLogoIndex ] );
+
+    // Check if there is one stored already, replace handle if so.
+    for ( TInt i = 0; i < iOperatorLogos.Count(); i ++ )
+        {
+        if ( aImages.iImages[ EPhCltExtCountryCodeIndex ] == 
+            iOperatorLogos[ i ]->iCountryCode && 
+            aImages.iImages[ EPhCltExtNetworkCodeIndex ] == 
+            iOperatorLogos[ i ]->iNetworkCode && 
+            aImages.iImages[ EPhCltExtLogoTypeIndex ] == 
+            iOperatorLogos[ i ]->iLogoType            
+             )
+            {
+            delete iOperatorLogos[ i ]->iBitmap;
+            iOperatorLogos[ i ]->iBitmap = bitMap;
+            found = ETrue;
+            break;
+            }
+        }
+
+    // Else add a new one.
+    if ( !found )
+        {
+        CPhCltOperatorLogoContainer* logo = 
+            new (ELeave)CPhCltOperatorLogoContainer(
+            aImages.iImages[ EPhCltExtCountryCodeIndex ], 
+            aImages.iImages[ EPhCltExtNetworkCodeIndex ],
+            ( TPhCltExtOperatorLogoType )
+            aImages.iImages[ EPhCltExtLogoTypeIndex ],
+            bitMap );
+        CleanupStack::PushL(logo);
+        iOperatorLogos.AppendL( logo );
+        CleanupStack::Pop(logo);
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// RPhCltImageHandler::CopyStillsL
+// 
+// Creates new duplicates of still images.
+// -----------------------------------------------------------------------------
+//   
+void RPhCltImageHandler::CopyStillsL( TPhCltImageArray& aImages ) 
+    {
+    // Remove all first.
+    iVTBitMaps.ResetAndDestroy();
+    iVTBitMaps.ReserveL(aImages.iImageCount);
+    for ( TInt i = 0 ; i < aImages.iImageCount; i ++ )
+        {
+        CFbsBitmap* bitMap = 
+            CreateBitMapL( aImages.iImages[ i ] );
+        CleanupStack::PushL( bitMap );
+        iVTBitMaps.AppendL( bitMap );
+        CleanupStack::Pop(bitMap);
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// RPhCltImageHandler::CreateBitMapL
+// 
+// Creates new duplicate of still image.
+// -----------------------------------------------------------------------------
+//   
+CFbsBitmap* RPhCltImageHandler::CreateBitMapL( const TInt aHandle )
+    {
+    CFbsBitmap* bitMap = new ( ELeave ) CFbsBitmap();
+    CleanupStack::PushL( bitMap );
+    User::LeaveIfError( bitMap->Duplicate( aHandle ) );
+    CleanupStack::Pop( bitMap );
+    return bitMap;
+    }
+
+// -----------------------------------------------------------------------------
+// RPhCltImageHandler::SaveVtImage
+// 
+// Saves VT Image.
+// -----------------------------------------------------------------------------
+//   
+void RPhCltImageHandler::SaveVtImage( 
+    TRequestStatus& aStatus, 
+    const TDesC& aFilePath )
+    {
+    __ASSERT_ALWAYS( 
+        SubSessionHandle(), User::Panic( 
+            KPhClientPanicCategory, EPhCltClientSidePanicNullHandle ) );
+    const TPtrC8 ptr8( reinterpret_cast<const TUint8*> ( aFilePath.Ptr() ), 
+        aFilePath.Size() );
+    TIpcArgs args( &ptr8 );
+    SendReceive( 
+        EPhoneServerSaveVtImage,
+        args,
+        aStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// RPhCltImageHandler::CancelSaveVtImage
+// 
+// 
+// -----------------------------------------------------------------------------
+//   
+void RPhCltImageHandler::CancelSaveVtImage()
+    {
+    SendReceive( EPhoneServerSaveVtImageCancel );
+    }
+
+// -----------------------------------------------------------------------------
+// RPhCltImageHandler::OpenVtImage
+// 
+// Opens VT Image file.
+// -----------------------------------------------------------------------------
+//   
+TInt RPhCltImageHandler::OpenVtImage( 
+    TInt& aFileHandle,
+    const TBool aOpenDefault )
+    {
+    __ASSERT_ALWAYS( 
+        SubSessionHandle(), User::Panic( 
+            KPhClientPanicCategory, EPhCltClientSidePanicNullHandle ) );
+    TPckg<TInt> pckg1( aFileHandle );
+    TPckg<TBool> pckg2( aOpenDefault );
+    TIpcArgs args( &pckg1, &pckg2 );
+    return SendReceive(
+        EPhoneServerOpenVtImage, args );
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/messenger/cphcltmessenger.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Messenger Base class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "cphcltmessenger.h" 
+#include    "cphcltmessengerimplementation.h" 
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhCltMessenger::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CPhCltMessenger* CPhCltMessenger::NewL( const TUid& aCategoryUid,
+            const TInt& aDefaultMessageSize )
+    {
+    return CPhCltMessengerImplementation::NewL( aCategoryUid, aDefaultMessageSize);
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltMessenger::CPhCltMessenger
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPhCltMessenger::CPhCltMessenger( )
+    {
+    }
+    
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/messenger/cphcltmessengerimplementation.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,141 @@
+/*
+* 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:  Implementation of the PhoneClient Messenger interface.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "cphcltmessengerimplementation.h" 
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhCltMessengerImplementation::CPhCltMessengerImplementation
+// 
+// C++ constructor can NOT contain any code, that might leave.
+// -----------------------------------------------------------------------------
+//
+CPhCltMessengerImplementation::CPhCltMessengerImplementation()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltMessengerImplementation::ConstructL
+// 
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CPhCltMessengerImplementation::ConstructL( const TUid& aCategoryUid,
+            const TInt& aDefaultMessageSize )
+    {
+    User::LeaveIfError( iServer.Connect() );    
+    User::LeaveIfError (iMessenger.Open( iServer, aCategoryUid,
+        aDefaultMessageSize ) ); 
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltMessengerImplementation::NewL
+// 
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPhCltMessengerImplementation* CPhCltMessengerImplementation::NewL( const TUid& aCategoryUid,
+            const TInt& aDefaultMessageSize )
+    {
+    CPhCltMessengerImplementation* self = 
+        new ( ELeave ) CPhCltMessengerImplementation;   
+   CleanupStack::PushL( self );
+    self->ConstructL( aCategoryUid, aDefaultMessageSize );
+    CleanupStack::Pop();
+    return self;
+    }
+    
+
+// -----------------------------------------------------------------------------
+// CPhCltMessengerImplementation::~CPhCltMessengerImplementation
+// 
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CPhCltMessengerImplementation::~CPhCltMessengerImplementation()
+    {
+    // Ensure that clean-up is done properly.
+    iMessenger.Close();
+    iServer.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltMessengerImplementation::Receive
+// 
+// Receive message.
+// -----------------------------------------------------------------------------
+//
+void CPhCltMessengerImplementation::Receive(
+    TRequestStatus& aStatus,
+    TInt& aMessageSize,
+    TDes8& aMessagePayload )
+    {
+    iMessenger.Receive(
+        aStatus,
+        aMessageSize,
+        aMessagePayload );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltMessengerImplementation::Send
+// 
+// Send message.
+// -----------------------------------------------------------------------------
+//
+void CPhCltMessengerImplementation::Send(
+    TRequestStatus& aStatus,
+    const TDesC8& aMessagePayload )
+    {
+    iMessenger.Send(
+        aStatus,
+        aMessagePayload );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltMessengerImplementation::CancelRequest
+// 
+// Cancel ongoing request.
+// -----------------------------------------------------------------------------
+//
+void CPhCltMessengerImplementation::CancelRequest(
+    const TPhCltMessengerRequest& aRequest )
+    {
+    iMessenger.CancelRequest( aRequest );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltMessengerImplementation::Skip
+// 
+// Skip the current message.
+// -----------------------------------------------------------------------------
+//
+void CPhCltMessengerImplementation::Skip()
+    {
+    iMessenger.Skip();
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/messenger/rphcltmessenger.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,207 @@
+/*
+* 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:  This class is used to perform Phone Client Extension 
+*                Messenger originated commands.
+*
+*/
+
+
+
+// INCLUDES
+
+#include    "rphcltmessenger.h" 
+#include    <rphcltserver.h> 
+#include    "phcltclientserver.h" 
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// RPhCltMessenger::RPhCltMessenger
+// 
+// C++ constructor can NOT contain any code, that might leave.
+// -----------------------------------------------------------------------------
+//
+RPhCltMessenger::RPhCltMessenger()
+:   RSubSessionBase(),
+    iReceiveMessageSize( NULL, 0 ),
+    iMesParPckg( iMessengerParameters )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltMessenger::~RPhCltMessenger
+// 
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+RPhCltMessenger::~RPhCltMessenger()
+    {
+    // Ensure that the subsession is closed.
+    Close();
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltMessenger::Open
+// 
+// Open subsession to Phone Server.
+// -----------------------------------------------------------------------------
+//
+TInt RPhCltMessenger::Open(
+    RPhCltServer& aServer,
+    const TUid& aCategoryUid,
+    const TInt& aDefaultMessageSize )
+    {
+    __ASSERT_ALWAYS( aServer.Handle(), User::Panic( 
+            KPhClientPanicCategory, 
+            EPhCltClientSidePanicNullHandle ) );
+
+    TInt err = CreateSubSession( 
+        aServer, 
+        EPhoneServerMessengerSubSessionOpen, 
+        TIpcArgs() );
+
+
+    // If subsession was created successfully, construct it properly.
+    if ( !err )
+        {
+        // Set the needed variables to be transferred to PhoneServer side.
+        iMessengerParameters.iCategoryUid = aCategoryUid;
+        iMessengerParameters.iDefaultMessageSize = aDefaultMessageSize;
+
+        err = SendReceive( 
+            EPhoneServerMessengerSubSessionConstruct, 
+            TIpcArgs( &iMesParPckg ) );
+
+        // If memory reservations failed, close subsession.
+        if ( err )
+            {
+            Close();
+            }
+        }
+    
+    return err;
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltMessenger::Close
+// 
+// Close subsession.
+// -----------------------------------------------------------------------------
+//
+void RPhCltMessenger::Close()
+    {
+    CloseSubSession( EPhoneServerMessengerSubSessionClose );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltMessenger::Receive
+// 
+// Receive message.
+// -----------------------------------------------------------------------------
+//
+void RPhCltMessenger::Receive(
+    TRequestStatus& aStatus,
+    TInt& aMessageSize,
+    TDes8& aMessagePayload )
+    {
+    __ASSERT_ALWAYS( 
+        SubSessionHandle(), User::Panic( 
+            KPhClientPanicCategory, EPhCltClientSidePanicNullHandle ) );
+
+    // Set message size variables to be byte descriptor.
+    iReceiveMessageSize.Set( ( TUint8* )&aMessageSize, 0, sizeof( TInt ) ) ;
+    iMessengerParameters.iReceiveMessageSizePtr = &iReceiveMessageSize;
+
+    iMessengerParameters.iReceiveBufferMaxSize = aMessagePayload.MaxSize();
+
+    SendReceive( 
+        EPhoneServerMessengerSubSessionReceive, 
+        TIpcArgs( 
+            &iMesParPckg,
+            &aMessagePayload,
+            &iReceiveMessageSize ), 
+        aStatus );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltMessenger::Send
+// 
+// Send message.
+// -----------------------------------------------------------------------------
+//
+void RPhCltMessenger::Send(
+    TRequestStatus& aStatus,
+    const TDesC8& aMessagePayload )
+    {
+    __ASSERT_ALWAYS( 
+        SubSessionHandle(), User::Panic( 
+            KPhClientPanicCategory, EPhCltClientSidePanicNullHandle ) );
+
+    iMessengerParameters.iSendPayloadLength = aMessagePayload.Length();
+
+    SendReceive( 
+        EPhoneServerMessengerSubSessionSend, 
+        TIpcArgs( 
+            &iMesParPckg, 
+            &aMessagePayload ), 
+        aStatus );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltMessenger::CancelRequest
+// 
+// Cancel ongoing request.
+// -----------------------------------------------------------------------------
+//
+void RPhCltMessenger::CancelRequest( const TPhCltMessengerRequest& aRequest )
+    {
+    __ASSERT_ALWAYS( SubSessionHandle(), User::Panic( 
+        KPhClientPanicCategory, EPhCltClientSidePanicNullHandle ) );
+
+    iMessengerParameters.iCancelRequest = aRequest;
+
+    SendReceive( 
+        EPhoneServerMessengerSubSessionCancel, 
+        TIpcArgs( &iMesParPckg ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltMessenger::Skip
+// 
+// Skip the current message.
+// -----------------------------------------------------------------------------
+//
+void RPhCltMessenger::Skip()
+    {
+    __ASSERT_ALWAYS( 
+        SubSessionHandle(), User::Panic( 
+            KPhClientPanicCategory, EPhCltClientSidePanicNullHandle ) );
+
+    SendReceive( 
+        EPhoneServerMessengerSubSessionSkip, 
+        TIpcArgs()  );
+    }
+
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/notifier/notifier_aiw/cphcltcallnotify.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,198 @@
+/*
+* 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:  Call Notify
+*
+*/
+
+
+
+//  Include Files
+#include    <cphcltemergencycall.h> // for TPhCltEmergencyNumber
+#include    <cphcltcallnotify.h> 
+#include    <cphcltdialdata.h>
+#include    <mphcltdialrequestobserver.h>
+
+#include    "rphcltserver.h" 
+#include    "cphcltextphonedialdata.h" 
+#include    "rphcltcallnotify.h" 
+#include    "cphcltdialrequestmonitor.h"
+#include    "cphcltdialemergencyrequestmonitor.h"
+#include    "cphcltcomhandrequestmonitor.h"
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhCltCallNotify::CPhCltCallNotify
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPhCltCallNotify::CPhCltCallNotify() 
+    {
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhCltCallNotify::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CPhCltCallNotify* CPhCltCallNotify::NewL()
+    {
+    CPhCltCallNotify* self = new ( ELeave ) CPhCltCallNotify; 
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+    
+    // Destructor
+EXPORT_C CPhCltCallNotify::~CPhCltCallNotify()
+    {  
+    delete iComHandMonitor;
+    delete iDialMonitor;
+    delete iDialEmergencyMonitor;
+    delete iCallNotify;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltCallNotify::Open
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CPhCltCallNotify::Open( RPhCltServer& aServer )
+    {
+    TInt retVal = iCallNotify->Open( aServer );
+    return retVal;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltCallNotify::Close
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CPhCltCallNotify::Close()
+    {
+    iCallNotify->Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltCallNotify::NotifyCallAttempt
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CPhCltCallNotify::NotifyDialRequest( 
+    MPhCltDialRequestObserver* aObserver )
+    {
+    iDialMonitor->NotifyDialRequest( aObserver );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltCallNotify::CancelNotifyCallAttempt
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CPhCltCallNotify::CancelNotifyDialRequest()
+    {
+    iDialMonitor->Cancel();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltCallNotify::RespondClient
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CPhCltCallNotify::RespondClient( const TInt aResultCode )
+    {
+    return iDialMonitor->RespondClient( aResultCode  );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltCallNotify::NotifyEmergencyCall()
+// 
+// -----------------------------------------------------------------------------
+//  
+EXPORT_C void CPhCltCallNotify::NotifyEmergencyCall( 
+    MPhCltDialEmergencyRequestObserver* aObserver, 
+    TDesC& aEmergencyNumber )
+    {   
+    iDialEmergencyMonitor->NotifyEmergencyCall( aObserver, aEmergencyNumber );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltCallNotify::CancelNotifyEmergencyCall()
+// 
+// -----------------------------------------------------------------------------
+//  
+EXPORT_C void CPhCltCallNotify::CancelNotifyEmergencyCall() const
+    {
+    iDialEmergencyMonitor->Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltCallNotify::RespondEmergencyToClient()
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CPhCltCallNotify::RespondEmergencyToClient( 
+    const TInt aResultCode )
+    {
+    return iDialEmergencyMonitor->RespondEmergencyToClient( aResultCode  );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltCallNotify::NotifyComHandCommand
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CPhCltCallNotify::NotifyComHandCommand(  
+    MPhCltComHandRequestObserver* aObserver, TDes8& aCommandArgs )
+    {
+    iComHandMonitor->NotifyComHandCommand( aObserver, aCommandArgs );
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhCltCallNotify::CancelNotifyComHandCommand
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CPhCltCallNotify::CancelNotifyComHandCommand() const
+    {
+    iComHandMonitor->Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltCallNotify::RespondComHandClient
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CPhCltCallNotify::RespondComHandClient( 
+    const TInt aResultCode )
+    {
+    return iComHandMonitor->RespondComHandClient( aResultCode );
+    }
+    
+    
+void CPhCltCallNotify::ConstructL() 
+    {
+    iCallNotify = new (ELeave) RPhCltCallNotify();
+    iDialMonitor = CPhCltDialRequestMonitor::NewL(*iCallNotify);
+    iComHandMonitor = CPhCltComHandRequestMonitor::NewL(*iCallNotify);
+    iDialEmergencyMonitor = CPhCltDialEmergencyRequestMonitor::NewL(*iCallNotify);
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/notifier/notifier_aiw/cphcltcomhandrequestmonitor.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,125 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Call Notify
+*
+*/
+
+
+
+//  Include Files
+#include    "cphcltcomhandrequestmonitor.h"
+#include    "rphcltcallnotify.h" 
+#include    <mphcltcomhandrequestobserver.h>
+#include    <e32base.h>
+
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhCltComHandRequestMonitor::CPhCltComHandRequestMonitor
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPhCltComHandRequestMonitor::CPhCltComHandRequestMonitor(
+    RPhCltCallNotify& aCallNotify):  
+        CActive( EPriorityStandard ), iCallNotify(aCallNotify)
+    {
+    CActiveScheduler::Add( this );
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhCltComHandRequestMonitor::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPhCltComHandRequestMonitor* CPhCltComHandRequestMonitor::NewL(RPhCltCallNotify& aCallNotify) 
+    {
+    CPhCltComHandRequestMonitor* self = new ( ELeave ) CPhCltComHandRequestMonitor(aCallNotify); 
+    return self;
+    }
+    
+    // Destructor
+CPhCltComHandRequestMonitor::~CPhCltComHandRequestMonitor()
+    {  
+    Cancel();
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhCltCallNotify::RespondComHandClient
+// 
+// -----------------------------------------------------------------------------
+//
+TInt CPhCltComHandRequestMonitor::RespondComHandClient( 
+    const TInt aResultCode )
+    {
+    return iCallNotify.RespondComHandClient( aResultCode );
+    }    
+
+// -----------------------------------------------------------------------------
+// CPhCltComHandRequestMonitor::RunL()
+// 
+// -----------------------------------------------------------------------------
+//    
+void CPhCltComHandRequestMonitor::RunL()
+    {
+    TInt error = iStatus.Int();
+    if ( !error ) 
+        {
+        iObserver->ComHandRequest( );    
+        }   
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltComHandRequestMonitor::CancelNotifyComHandCommand()
+// 
+// -----------------------------------------------------------------------------
+//    
+void CPhCltComHandRequestMonitor::DoCancel()
+    {
+    iCallNotify.CancelNotifyComHandCommand();
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CPhCltComHandRequestMonitor::NotifyComHandCommand
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhCltComHandRequestMonitor::NotifyComHandCommand( 
+    MPhCltComHandRequestObserver* aObserver,
+    TDes8& aCommandArgs )
+    {
+    if ( !IsActive() )
+        {
+        iObserver = aObserver;
+        iCallNotify.NotifyComHandCommand( 
+            iStatus, 
+            aCommandArgs );
+        SetActive();
+        }
+    }
+    
+
+    
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/notifier/notifier_aiw/cphcltdialemergencyrequestmonitor.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,140 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Call Notify
+*
+*/
+
+
+
+//  Include Files
+#include    <cphcltemergencycall.h> // for TPhCltEmergencyNumber 
+#include    "cphcltdialemergencyrequestmonitor.h"
+#include    <mphcltdialemergencyrequestobserver.h>
+#include    "rphcltserver.h" 
+#include    "rphcltcallnotify.h" 
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhCltDialEmergencyRequestMonitor::CPhCltDialEmergencyRequestMonitor
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPhCltDialEmergencyRequestMonitor::CPhCltDialEmergencyRequestMonitor(RPhCltCallNotify& aCallNotify) 
+    :  CActive( CActive::EPriorityStandard ),
+    iCallNotify(aCallNotify),
+    iEmergencyCallNumberPtr( NULL, 0, 0 )    
+    {
+    CActiveScheduler::Add( this );
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhCltDialEmergencyRequestMonitor::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPhCltDialEmergencyRequestMonitor* CPhCltDialEmergencyRequestMonitor::NewL(
+        RPhCltCallNotify& aCltNotify)
+    {
+    CPhCltDialEmergencyRequestMonitor* self = 
+        new ( ELeave ) CPhCltDialEmergencyRequestMonitor(aCltNotify); 
+    return self;
+    }
+    
+    // Destructor
+CPhCltDialEmergencyRequestMonitor::~CPhCltDialEmergencyRequestMonitor()
+    {  
+    Cancel();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltDialEmergencyRequestMonitor::RunL()
+// 
+// -----------------------------------------------------------------------------
+//    
+void CPhCltDialEmergencyRequestMonitor::RunL()
+    {
+    TInt error = iStatus.Int();
+    if ( !error ) 
+        {
+        iObserver->DialEmergencyRequest( );    
+        }
+    }
+
+TInt CPhCltDialEmergencyRequestMonitor::RunError(TInt /*aErr*/)
+    {
+    // RunL failed because of leave in SetParamsL,
+    // 
+    // TODO check how to react
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltDialEmergencyRequestMonitor::DoCancel()
+// 
+// -----------------------------------------------------------------------------
+//    
+void CPhCltDialEmergencyRequestMonitor::DoCancel()
+    {
+    iCallNotify.CancelNotifyEmergencyCall();
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltDialEmergencyRequestMonitor::NotifyEmergencyCall()
+// 
+// -----------------------------------------------------------------------------
+//  
+void CPhCltDialEmergencyRequestMonitor::NotifyEmergencyCall( 
+    MPhCltDialEmergencyRequestObserver* aObserver, 
+    TDesC& aEmergencyNumber )
+    {
+    
+    if ( !IsActive() )
+        {
+    
+        iEmergencyCallNumberPtr.Set( reinterpret_cast<TText8*>( &aEmergencyNumber ), 
+                             sizeof( TPhCltEmergencyNumber ),
+                             sizeof( TPhCltEmergencyNumber ) );
+        
+        iObserver = aObserver;
+        
+        iCallNotify.NotifyEmergencyCall( 
+            iStatus, 
+            iEmergencyCallNumberPtr
+             );
+        SetActive();
+        }
+         
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltDialEmergencyRequestMonitor::RespondEmergencyToClient()
+// 
+// -----------------------------------------------------------------------------
+//
+TInt CPhCltDialEmergencyRequestMonitor::RespondEmergencyToClient( 
+    const TInt aResultCode )
+    {
+    return iCallNotify.RespondEmergencyToClient( aResultCode  );
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/notifier/notifier_aiw/cphcltdialrequestmonitor.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,144 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 Notify
+*
+*/
+
+
+
+//  Include Files
+#include    <cphcltemergencycall.h> // for TPhCltEmergencyNumber 
+#include    <mphcltdialrequestobserver.h>
+
+#include    "rphcltserver.h" 
+#include    "cphcltextphonedialdata.h" 
+#include    "cphcltdialdata.h"
+#include    "cphcltdialrequestmonitor.h"
+#include    "rphcltcallnotify.h" 
+
+
+
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhCltDialRequestMonitor::CPhCltDialRequestMonitor
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPhCltDialRequestMonitor::CPhCltDialRequestMonitor(RPhCltCallNotify& aCallNotify) 
+    :  CActive( EPriorityStandard ), 
+       iCallNotify(aCallNotify),
+      iDataLengthPckg ( iDialDataLength )
+    {
+    CActiveScheduler::Add( this );
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhCltDialRequestMonitor::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPhCltDialRequestMonitor* CPhCltDialRequestMonitor::NewL(
+        RPhCltCallNotify& aCltNotify)
+    {
+    CPhCltDialRequestMonitor* self = new ( ELeave ) CPhCltDialRequestMonitor(aCltNotify); 
+    return self;
+    }
+    
+    // Destructor
+CPhCltDialRequestMonitor::~CPhCltDialRequestMonitor()
+    {  
+    Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltDialRequestMonitor::NotifyCallAttempt
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhCltDialRequestMonitor::NotifyDialRequest( 
+    MPhCltDialRequestObserver* aObserver )
+    {
+    if ( !IsActive() )
+        {
+        iCallNotify.NotifyCallAttempt( iStatus, iDataLengthPckg ); 
+        iObserver = aObserver;
+        SetActive();
+        }
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CPhCltDialRequestMonitor::RespondClient
+// 
+// -----------------------------------------------------------------------------
+//
+TInt CPhCltDialRequestMonitor::RespondClient( const TInt aResultCode )
+    {
+    return iCallNotify.RespondClient( aResultCode  );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltDialRequestMonitor::RunL()
+// 
+// -----------------------------------------------------------------------------
+//    
+void CPhCltDialRequestMonitor::RunL()
+    {
+    TInt error = iStatus.Int();
+    if ( !error ) 
+        {
+        // Lazy initialization for dial data.
+        CPhCltDialData *dialData = (CPhCltDialData*) CPhCltExtPhoneDialData::NewL();
+
+        CleanupStack::PushL( dialData );
+            
+        HBufC8* package = HBufC8::NewLC ( iDialDataLength );
+        TPtr8 ptr ( package->Des());
+        
+        //Fetch dial data from server
+        iCallNotify.GetDialData( ptr );
+        ((CPhCltExtPhoneDialData*)dialData)->SetParamsL( *package );
+        CleanupStack::PopAndDestroy( package );
+        CleanupStack::Pop( dialData );
+        iObserver->DialRequest( dialData );
+        }
+    
+    }
+
+TInt CPhCltDialRequestMonitor::RunError(TInt /*aErr*/)
+    {
+    // RunL failed because of leave in SetParamsL,
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltDialRequestMonitor::DoCancel()
+// 
+// -----------------------------------------------------------------------------
+//    
+void CPhCltDialRequestMonitor::DoCancel()
+    {
+    iCallNotify.CancelNotifyCallAttempt();    
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/notifier/notifier_aiw/rphcltcallnotify.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,206 @@
+/*
+* 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:  Call Notify
+*
+*/
+
+
+
+//  Include Files
+#include "rphcltcallnotify.h" 
+#include "rphcltserver.h" 
+#include "phcltclientserver.h" 
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// RPhCltCallNotify::RPhCltCallNotify
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+RPhCltCallNotify::RPhCltCallNotify() 
+    : RSubSessionBase()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltCallNotify::Open
+// -----------------------------------------------------------------------------
+//
+TInt RPhCltCallNotify::Open( RPhCltServer& aServer )
+    {
+    return CreateSubSession( 
+        aServer,
+        EPhoneServerNotifySubSessionOpen,
+        TIpcArgs() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltCallNotify::Close
+// -----------------------------------------------------------------------------
+//
+void RPhCltCallNotify::Close()
+    {
+    CloseSubSession( EPhoneServerNotifySubSessionClose );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltCallNotify::NotifyCallAttempt
+// 
+// -----------------------------------------------------------------------------
+//
+void RPhCltCallNotify::NotifyCallAttempt( 
+    TRequestStatus& aStatus,
+    TPckg< TInt >& aDataLength )
+    {
+    SendReceive( 
+        EPhoneServerNotifySubSessionNotifyCallRequest, 
+        TIpcArgs( &aDataLength ), 
+        aStatus );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltCallNotify::CancelNotifyCallAttempt
+//
+// -----------------------------------------------------------------------------
+//
+void RPhCltCallNotify::CancelNotifyCallAttempt() const
+    {
+    SendReceive( 
+        EPhoneServerNotifySubSessionNotifyCallRequestCancel,
+        TIpcArgs() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltCallNotify::RespondClient
+// 
+// -----------------------------------------------------------------------------
+//
+TInt RPhCltCallNotify::RespondClient( const TInt aResultCode )
+    {
+    return Send( 
+        EPhoneServerNotifySubSessionReportCallResult,
+        TIpcArgs( aResultCode ) );
+    }
+ 
+ // -----------------------------------------------------------------------------
+// RPhCltCallNotify::GetDialData
+// 
+// -----------------------------------------------------------------------------
+//   
+ void RPhCltCallNotify::GetDialData( TDes8& aData )
+    {
+    
+    SendReceive( 
+        EPhoneServerNotifySubSessionDialData, 
+        TIpcArgs( &aData) );
+    }
+
+// -----------------------------------------------------------------------------
+// RPhCltCallNotify::NotifyEmergencyCall
+// 
+// -----------------------------------------------------------------------------
+//
+void RPhCltCallNotify::NotifyEmergencyCall( 
+    TRequestStatus& aStatus,
+    TDes8& aEmergencyNumber
+     )
+    {
+    SendReceive( 
+        EPhoneServerNotifyEmergencySubSessionNotifyCallRequest, 
+        TIpcArgs( &aEmergencyNumber ), 
+        aStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// RPhCltCallNotify::CancelNotifyEmergencyCall
+//
+// -----------------------------------------------------------------------------
+//
+void RPhCltCallNotify::CancelNotifyEmergencyCall() const
+    {
+    SendReceive( 
+        EPhoneServerNotifyEmergencySubSessionNotifyCallRequestCancel,
+        TIpcArgs() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltCallNotify::RespondEmergencyToClient
+// 
+// -----------------------------------------------------------------------------
+//
+TInt RPhCltCallNotify::RespondEmergencyToClient( const TInt aResultCode )
+    {
+    return Send( 
+        EPhoneServerNotifyEmergencySubSessionReportCallResult,
+        TIpcArgs( aResultCode ) );
+    }
+
+ // -----------------------------------------------------------------------------
+// RPhCltCallNotify::NotifyComHandCommand
+// 
+// Notifies when a Command handler request arrives.
+// -----------------------------------------------------------------------------
+//
+void RPhCltCallNotify::NotifyComHandCommand( 
+    TRequestStatus& aStatus, 
+    TDes8& aCommandArgs )
+    {
+    SendReceive( 
+        EPhoneServerComHandNotifySubSessionComHandRequest, 
+        TIpcArgs( &aCommandArgs ),
+        aStatus );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltCallNotify::CancelNotifyComHandCommand
+// 
+// Cancel pending command handler request notification.
+// -----------------------------------------------------------------------------
+//
+void RPhCltCallNotify::CancelNotifyComHandCommand() const
+    {
+    SendReceive( 
+        EPhoneServerComHandNotifySubSessionComHandRequestCancel, 
+        TIpcArgs() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltCallNotify::RespondComHandClient
+// 
+// Respond to client's command handler request.
+// -----------------------------------------------------------------------------
+//
+TInt RPhCltCallNotify::RespondComHandClient( 
+    const TInt aResultCode )
+    {
+    return Send( 
+        EPhoneServerComHandNotifySubSessionReportComHandResult, 
+        TIpcArgs( aResultCode ) );
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/notifier/rphcltcallnotify.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,171 @@
+/*
+* 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:  Call Notify
+*
+*/
+
+
+
+//  Include Files
+#include    "rphcltcallnotify.h" 
+#include    "rphcltserver.h" 
+
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// Stub function to complete an asynchronous request
+//
+// -----------------------------------------------------------------------------
+//
+static void CompleteRequest( TRequestStatus& aStatus, TInt aCompletionCode )
+    {
+    TRequestStatus* status = &aStatus;
+    User::RequestComplete( status, aCompletionCode );
+    }
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// RPhCltCallNotify::RPhCltCallNotify
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RPhCltCallNotify::RPhCltCallNotify() 
+    : RSubSessionBase()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltCallNotify::Open
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RPhCltCallNotify::Open( RPhCltServer& aServer )
+    {
+    return CreateSubSession( 
+        aServer,
+        EPhoneServerNotifySubSessionOpen,
+        TIpcArgs() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltCallNotify::Close
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RPhCltCallNotify::Close()
+    {
+    CloseSubSession( EPhoneServerNotifySubSessionClose );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltCallNotify::NotifyCallAttempt
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RPhCltCallNotify::NotifyCallAttempt( 
+    TRequestStatus& aStatus,
+    TDes8& aCallArgs )
+    {
+    SendReceive( 
+        EPhoneServerNotifySubSessionNotifyCallRequest, 
+        TIpcArgs( &aCallArgs ), 
+        aStatus );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltCallNotify::CancelNotifyCallAttempt
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RPhCltCallNotify::CancelNotifyCallAttempt() const
+    {
+    SendReceive( 
+        EPhoneServerNotifySubSessionNotifyCallRequestCancel,
+        TIpcArgs() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltCallNotify::NotifyPhoneStatusRequest
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RPhCltCallNotify::NotifyPhoneStatusRequest( 
+    TRequestStatus& aStatus )
+    {
+    // Stub
+    __ASSERT_DEBUG( EFalse, User::Invariant() );
+    CompleteRequest( aStatus, KErrNone );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltCallNotify::CancelNotifyPhoneStatusRequest
+//
+// NOT SUPPORTED.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RPhCltCallNotify::CancelNotifyPhoneStatusRequest() const
+    {
+    // Stub, don't call
+    __ASSERT_DEBUG( EFalse, User::Invariant() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltCallNotify::ReportPhoneStatus
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RPhCltCallNotify::ReportPhoneStatus( 
+    TRequestStatus& aStatus,
+    const TInt aPhoneStatus )
+    {
+    // Stub
+    __ASSERT_DEBUG( EFalse, User::Invariant() );
+    CompleteRequest( aStatus, aPhoneStatus );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltCallNotify::CancelReportPhoneStatus
+// 
+// NOT SUPPORTED.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RPhCltCallNotify::CancelReportPhoneStatus() const
+    {
+    // Stub, don't call
+    __ASSERT_DEBUG( EFalse, User::Invariant() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltCallNotify::RespondClient
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RPhCltCallNotify::RespondClient( const TInt aResultCode )
+    {
+    return Send( 
+        EPhoneServerNotifySubSessionReportCallResult,
+        TIpcArgs( aResultCode ) );
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/notifier/rphcltextcallnotify.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,156 @@
+/*
+* 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:  Call Notify
+*
+*/
+
+
+
+//  Include Files
+
+#include    "rphcltcallnotify.h" 
+#include    "phcltclientserver.h" 
+#include    "rphcltserver.h" 
+
+
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// RPhCltExtCallNotify::RPhCltExtCallNotify
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RPhCltCallNotify::RPhCltCallNotify() 
+    : RSubSessionBase()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltExtCallNotify::Open
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RPhCltCallNotify::Open( RPhCltServer& aServer )
+    {
+    return CreateSubSession( 
+        aServer,
+        EPhoneServerNotifySubSessionOpen,
+        TIpcArgs() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltExtCallNotify::Close
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RPhCltCallNotify::Close()
+    {
+    CloseSubSession( EPhoneServerNotifySubSessionClose );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltExtCallNotify::NotifyCallAttempt
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RPhCltCallNotify::NotifyCallAttempt( 
+    TRequestStatus& aStatus,
+    TDes8& aCallArgs )
+    {
+    SendReceive( 
+        EPhoneServerNotifySubSessionNotifyCallRequest, 
+        TIpcArgs( &aCallArgs ), 
+        aStatus );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltExtCallNotify::CancelNotifyCallAttempt
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RPhCltCallNotify::CancelNotifyCallAttempt() const
+    {
+    SendReceive( 
+        EPhoneServerNotifySubSessionNotifyCallRequestCancel,
+        TIpcArgs() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltExtCallNotify::RespondClient
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RPhCltCallNotify::RespondClient( const TInt aResultCode )
+    {
+    return Send( 
+        EPhoneServerNotifySubSessionReportCallResult,
+        TIpcArgs( aResultCode ) );
+    }
+  
+ // -----------------------------------------------------------------------------
+// RPhCltExtCallNotify::NotifyComHandCommand
+// 
+// Notifies when a Command handler request arrives.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RPhCltCallNotify::NotifyComHandCommand( 
+    TRequestStatus& aStatus, 
+    TDes8& aCommandArgs )
+    {
+    SendReceive( 
+        EPhoneServerComHandNotifySubSessionComHandRequest, 
+        TIpcArgs( &aCommandArgs ),
+        aStatus );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltExtCallNotify::CancelNotifyComHandCommand
+// 
+// Cancel pending command handler request notification.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RPhCltCallNotify::CancelNotifyComHandCommand() const
+    {
+    SendReceive( 
+        EPhoneServerComHandNotifySubSessionComHandRequestCancel, 
+        TIpcArgs() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltExtCallNotify::RespondComHandClient
+// 
+// Respond to client's command handler request.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RPhCltCallNotify::RespondComHandClient( 
+    const TInt aResultCode )
+    {
+    return Send( 
+        EPhoneServerComHandNotifySubSessionReportComHandResult, 
+        TIpcArgs( aResultCode ) );
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/phcltutils.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Utils
+*
+*/
+
+
+// INCLUDE FILES
+#include    "phcltutils.h" 
+
+
+// CONSTANTS
+_LIT( KPhCltValidChars, "+0123456789*#pwPW" );
+//Prefix for Sip.
+_LIT( KSipPrefix, "sip:" );
+//Prefix for Tel.
+_LIT( KTelPrefix, "tel:" );
+//Prefix for Sos.
+_LIT( KSosPrefix, "sos:" );
+// @ char
+_LIT( KAt, "@" );
+// Prefix length
+const TInt KPrefixLength = 4;
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// PhCltUtils::IsValidChar
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool PhCltUtils::IsValidChar( TChar aChar )
+    {
+    TPtrC valid( KPhCltValidChars );
+
+    return valid.Locate( aChar ) != KErrNotFound;
+    }
+
+
+// -----------------------------------------------------------------------------
+// PhCltUtils::RemoveInvalidChars
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void PhCltUtils::RemoveInvalidChars( TDes& aString )
+    {
+    TInt index = aString.Length() - 1;
+
+    for ( ; index >= 0; index-- )
+        {
+        if ( !IsValidChar( aString[ index ] ) )
+            {
+            aString.Delete( index, 1 ); // one character
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// PhCltUtils::RemoveURIPrefixdAndDomainChars
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void PhCltUtils::RemoveURIPrefixdAndDomainChars( TDes& aString )
+    {
+      // Does number contains prefix. If yes then remove it
+
+    if ( 0 == aString.FindC( KSipPrefix ) ||
+         0 == aString.FindC( KTelPrefix ) ||
+           0 == aString.FindC( KSosPrefix ) )
+        {
+        aString.Delete( 0, KPrefixLength );
+          }
+      // Does Number contains domain part. If yes remove it at beging of @ character.
+    TInt atIndex = aString.Find( KAt );
+    TInt telNumberLength = aString.Length();
+      if ( 0 < atIndex && 
+           atIndex < telNumberLength )
+        {
+            aString.Delete( atIndex, telNumberLength - atIndex );
+            }
+    }
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/rphcltresourcefile.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,98 @@
+/*
+* 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:  Resource File handler.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "rphcltresourcefile.h" 
+#include    "ConeResLoader.h" 
+#include    "phcltclientserver.h" 
+
+
+// CONSTANTS
+
+// Panic category
+_LIT( KPhCltResourceFilePanic, "PhCltRes" );
+
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// RPhCltResourceFile::RPhCltResourceFile
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RPhCltResourceFile::RPhCltResourceFile()
+    : iLoader( NULL )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltResourceFile::OpenL
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RPhCltResourceFile::OpenL( CCoeEnv& aEnv )
+    {
+    // Must not be called if already loaded.
+    __ASSERT_ALWAYS( 
+        !iLoader, 
+        User::Panic( KPhCltResourceFilePanic, KErrNone ) );
+
+    TFileName* tmpFileName =
+        new ( ELeave ) TFileName;
+    CleanupStack::PushL( tmpFileName );
+    tmpFileName->Append( KPhCltServerZDrive );
+    tmpFileName->Append( KDC_RESOURCE_FILES_DIR );
+    tmpFileName->Append( KPhCltResourceFileNameAndPath );
+    tmpFileName->ZeroTerminate();
+
+    // Load resource file
+    RConeResourceLoader* loader = 
+        new ( ELeave ) RConeResourceLoader( aEnv );
+    CleanupStack::PushL( loader );
+    loader->OpenL( *tmpFileName );
+    CleanupStack::Pop( loader );
+
+    // Completed, store loader.
+    iLoader = loader;
+
+    CleanupStack::PopAndDestroy( tmpFileName );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltResourceFile::Close
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RPhCltResourceFile::Close()
+    {
+    if ( iLoader )
+        {
+        iLoader->Close();
+        delete iLoader;
+        iLoader = NULL;
+        }
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/session/rphcltserver.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,208 @@
+/*
+* 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:  Server connection handler.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32math.h>
+#include    <e32uid.h>
+#include    "phclttypes.h" 
+#include    "rphcltserver.h" 
+#include    "phcltclientserver.h" 
+
+// CONSTANTS
+
+// Information of Phone Server Startup failure, used in panic call.
+_LIT( PH_SRV_SU_FAILURE, "PhSrvStartUp" );
+
+// The number of Phone Server startup attempts.
+const TInt KPhCltNumberOfRetryAttempts = 4;
+
+// The phase were the Phone Server failure happened.
+// Useful in debug purposes if Phone Server startup fails.
+enum 
+    {
+    EPhSrvStartupFailurePhase1,  // First phase
+    EPhSrvStartupFailurePhase2   // Second phase
+    };     
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// RPhCltServer::RPhCltServer
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RPhCltServer::RPhCltServer() 
+    : RSessionBase()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// RPhCltServer::Version
+// 
+// Returns version.
+// -----------------------------------------------------------------------------
+//
+TVersion RPhCltServer::Version() const
+    {
+    return TVersion( KPhoneServerMajorVersionNumber,
+                     KPhoneServerMinorVersionNumber,
+                     KPhoneServerBuildVersionNumber );
+    }
+
+// -----------------------------------------------------------------------------
+// RPhCltServer::Connect
+// 
+// Creates connection to the server. If server is not running,
+// it is also launched.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RPhCltServer::Connect( TInt aMessageSlots )
+    {
+    TInt err = KErrGeneral;
+    TInt count = KPhCltNumberOfRetryAttempts;
+    FOREVER
+        {
+        err = CreateSession( PHONE_SERVER_NAME, Version(), aMessageSlots );
+        if ( err != KErrNotFound && err != KErrServerTerminated )
+            {
+            break;
+            }
+        // Need to restart server
+        if ( --count < 0 )
+            {
+            break;
+            }
+        err = StartServer();
+        if ( err != KErrNone && err != KErrAlreadyExists )
+            {
+            if ( err != KErrNotFound )
+                {
+                break;
+                }
+            Panic( EPhCltPanicServerUnexpectedServerNotFound );
+            }
+        }
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// RPhCltServer::CreateAll
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RPhCltServer::CreateAll( TRequestStatus& aStatus )
+    {
+    SendReceive( 
+        EPhoneCreateAll,
+        TIpcArgs(),
+        aStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// RPhCltServer::StartServer
+// 
+// Launches the phone server, which is assumed to be not
+// already running.
+// -----------------------------------------------------------------------------
+//
+TInt RPhCltServer::StartServer()
+    {
+    // The uid of the DLL/EXE - used to identify the correct target
+    const TUidType KPhServerUidType( 
+        KExecutableImageUid, 
+        KSharedLibraryUid, 
+        KPhCltServerUid );
+    
+
+    //////////////////////////////////////////////////////////////////////////
+    // On MARM, the server is an exe, so it is run inside its own process. 
+    // The server itself takes care of creating a thread and finalizing the 
+    // construction of the server. We pass the signalling object via the 
+    // command line.
+    //////////////////////////////////////////////////////////////////////////
+
+    RProcess serverUnitOfExecution;
+
+    TFileName pathName( KPhCltServerZDrive );
+    pathName.Append( KDC_PROGRAMS_DIR );
+    pathName.Append( KPhServerPathAndNameMARM );
+    pathName.ZeroTerminate();
+
+    TInt err = serverUnitOfExecution.Create( 
+        pathName,
+        KNullDesC, 
+        KPhServerUidType );
+
+    if ( err != KErrNone )
+        {
+        User::Panic( PH_SRV_SU_FAILURE, err );
+        }
+    serverUnitOfExecution.SetPriority( EPriorityHigh );
+
+
+    // Now wait for the server to start up, and also observe if the server
+    // thread dies for any reason.
+
+
+    TRequestStatus stat;
+    serverUnitOfExecution.Rendezvous( stat );
+    if ( stat != KRequestPending )
+        {
+        User::Panic( PH_SRV_SU_FAILURE, EPhSrvStartupFailurePhase1 );
+
+        serverUnitOfExecution.Kill( KErrAbort );    // abort startup
+        }
+    else
+        {
+        serverUnitOfExecution.Resume(); // logon ok
+        }
+
+    // wait for start or death
+    User::WaitForRequest( stat ); 
+    // we can't use the 'exit reason' if the server panicked as this
+    // is the panic 'reason' and may be '0' which cannot be distinguished
+    // from KErrNone
+    err = ( serverUnitOfExecution.ExitType() == EExitPanic ) 
+        ? KErrGeneral : stat.Int();
+
+    serverUnitOfExecution.Close();
+
+
+    return err;
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltServer::Panic
+// 
+// Panics the client thread
+// -----------------------------------------------------------------------------
+//
+void RPhCltServer::Panic( TPhCltPanicTypes aPanic )
+    {
+    User::Panic( KPhClientPanicCategory, aPanic );
+    }
+
+
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/ussd/ussd_ext/rphcltussd.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,222 @@
+/*
+* 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:  USSD handler class.
+*
+*/
+
+
+// INCLUDE FILES
+#include "rphcltserver.h" 
+#include "rphcltussd.h"
+#include "phcltclientserver.h" 
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// RPhCltUssd::RPhCltUssd
+// Constructor
+// 
+// -----------------------------------------------------------------------------
+//
+RPhCltUssd::RPhCltUssd()
+    : RSubSessionBase()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltUssd::Open
+// Open USSD subsession to the Phone Server.
+// 
+// -----------------------------------------------------------------------------
+//
+TInt RPhCltUssd::Open( RPhCltServer& aServer )
+    {
+    return CreateSubSession( 
+        aServer,
+        EPhoneServerUSSDSubSessionOpen,
+        TIpcArgs() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltUssd::Close
+// 
+// Closes the subsession
+// -----------------------------------------------------------------------------
+//
+void RPhCltUssd::Close()
+    {    
+    CloseSubSession( EPhoneServerUSSDSubSessionClose );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltUssd::StartUssdEditor
+// 
+// Request Ussd App to start
+// ---------------------------------------------------------------------------
+//
+TInt RPhCltUssd::StartUssdEditor() const
+    {
+    return SendReceive(
+        EPhoneServerUSSDSubSessionStartEditing,
+        TIpcArgs() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltUssd::AppStarting
+// 
+// App informs the server about the start-up.
+// -----------------------------------------------------------------------------
+//
+TInt RPhCltUssd::AppStarting()
+    {
+    return SendReceive(
+        EPhoneServerUSSDSubSessionAppStarting,
+        TIpcArgs() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltUssd::AppTerminating
+// 
+// App informs the server about the termination
+// -----------------------------------------------------------------------------
+//
+TInt RPhCltUssd::AppTerminating( 
+    TPhCltUssdAppExitReason aExitReason )
+    {
+    TPckg< TPhCltUssdAppExitReason > exitReasonPckg( aExitReason );
+
+    return SendReceive(
+        EPhoneServerUSSDSubSessionAppTerminating,
+        TIpcArgs( &exitReasonPckg ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltUssd::AppToForeground
+// 
+// App informs the server about the foreground event
+// -----------------------------------------------------------------------------
+//
+TBool RPhCltUssd::AppToForeground()
+    {
+    TInt ret = SendReceive(
+        EPhoneServerUSSDSubSessionAppToForeground, 
+        TIpcArgs() );
+    if ( ret > 0 )
+        {
+        return ETrue;
+        }
+    return EFalse;
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltUssd::AppToBackgroud
+// 
+// App informs the server about the background event
+// -----------------------------------------------------------------------------
+//
+TInt RPhCltUssd::AppToBackground()
+    {
+    return SendReceive(
+        EPhoneServerUSSDSubSessionAppToBackground,
+        TIpcArgs() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltUssd::SendUssd
+// 
+// Send Ussd string to the server - async
+// -----------------------------------------------------------------------------
+//
+void RPhCltUssd::SendUssd(
+    TRequestStatus& aReqStatus, 
+    const TDesC8& aMsgData, 
+    const TDesC8& aMsgAttribute )
+    {
+    SendReceive(
+        EPhoneServerUSSDSubSessionSendMessage,
+        TIpcArgs( 
+            &aMsgData,
+            aMsgData.Length(),
+            &aMsgAttribute ),
+        aReqStatus );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltUssd::CancelSend
+// 
+// Cancels the send
+// -----------------------------------------------------------------------------
+//
+void RPhCltUssd::CancelSend()
+    {
+    SendReceive(
+        EPhoneServerUSSDSubSessionSendMessageCancel,
+        TIpcArgs() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltUssd::StartSAT
+// 
+// Starts SAT interaction.
+// -----------------------------------------------------------------------------
+//
+void RPhCltUssd::StartSAT( 
+    TRequestStatus& aStatus , 
+    TDes& aReceiveMessage, 
+    TPckg< TUint >& aShowNotesAndDcs )
+    {
+    __ASSERT_ALWAYS( 
+        SubSessionHandle() , 
+        User::Panic( KPhClientPanicCategory , KErrBadHandle ) );
+
+    SendReceive(
+        EPhoneServerUSSDSubSessionStartSAT,
+        TIpcArgs(
+            &aShowNotesAndDcs,
+            aReceiveMessage.MaxLength(),
+            &aReceiveMessage ),
+        aStatus );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RPhCltUssd::StopSAT
+// 
+// End SAT interaction.
+// -----------------------------------------------------------------------------
+//
+void RPhCltUssd::StopSAT()
+    {
+    __ASSERT_ALWAYS( 
+        SubSessionHandle() , 
+        User::Panic( KPhClientPanicCategory , KErrBadHandle ) );
+
+    SendReceive(
+        EPhoneServerUSSDSubSessionStopSAT,
+        TIpcArgs() );
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/ussdwrapper/cphcltussdext.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Ussd Interface, 
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <cphcltussd.h> 
+#include "cphcltussdimp.h" 
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhCltUssd::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CPhCltUssd* CPhCltUssd::NewL( TBool aShowNotes )
+    {
+    return CPhCltUssdImp::NewL( aShowNotes );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltUssd::CPhCltUssd
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPhCltUssd::CPhCltUssd( )    
+    {
+    }
+    
+
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/ussdwrapper/cphcltussdimp.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,898 @@
+/*
+* 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:  Interface for sending messages.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "cphcltussdimp.h" 
+#include "cphcltussdrequesthandler.h" 
+#include "phcltclientserver.h" 
+#include <phclttypes.h> 
+
+#include <etelmm.h>
+#include <f32file.h>
+#include <charconv.h>
+#include <gsmuelem.h>
+#include <coemain.h>  
+//#include <phoneclient.rsg> 
+#include <exterror.h>
+
+#include <gsmerror.h>
+#include <etelsat.h>
+
+#include "mphcltussdnotecontrollercallback.h" 
+#include "cphcltussdnotecontroller.h" 
+#include "cphcltussdcommonconstant.h"
+#include "tflogger.h"
+// CONSTANTS
+
+const TUint8 KPhCltUssdDcsDefaultAlphabet = 0x0f; // 00001111
+                       
+const TUint8 KPhCltUssdDcsAlphabetDefaultPrecededLanguage = 0x10; // 00010000 
+const TUint8 KPhCltUssdDcsAlphabetDefaultPrecededLanguageSkipChars3 = 3;
+const TUint8 KPhCltUssdDcsAlphabetDefaultPrecededLanguageSkipChars2 = 2;
+const TUint8 KPhCltUssdDcsAlphabetDefaultPrecededLanguageStartBit = 5;
+
+const TUint8 KPhCltUssdDcsAlphabetUCS2PrecededLanguage = 0x11;   // 00010001
+const TUint8 KPhCltUssdDcsAlphabetUCS2PrecededLanguageSkipChars = 2;
+
+const TUint8 KPhCltUssdDcsGeneralInformationMask = 0xc0;         // 11000000
+const TUint8 KPhCltUssdDcsGeneralInformation = 0x40;             // 01xxxxxx
+const TUint8 KPhCltUssdDcsGeneralInformationCompressed = 0x20;   // xx1xxxxx
+const TUint8 KPhCltUssdDcsGeneralInformationSimMask = 0x13;      // 00010011
+const TUint8 KPhCltUssdDcsGeneralInformationSim = 0x12;          // xxx1xx10
+const TUint8 KPhCltUssdDcsGeneralInformationAlphabetMask = 0x0c; // 00001100
+const TUint8 KPhCltUssdDcsGeneralInformationAlphabet8Bit = 0x04; // xxxx01xx 
+const TUint8 KPhCltUssdDcsGeneralInformationAlphabetUCS2 = 0x08; // xxxx10xx 
+
+const TUint8 KPhCltUssdDcsMessageHandlingAlphabetMask = 0xf4;    // 11110100
+const TUint8 KPhCltUssdDcsMessageHandlingAlphabet8Bit = 0xf4;    // 1111x1xx 
+
+const TUint8 KPhCltUssdCarriageReturn = 0x0d;
+const TUint8 KPhCltUssdDcsNotSet  = 0x00; // not set
+
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// CLASS DECLARATION
+
+#ifndef TPHCLTUSSDALPHABETPACKER_H
+#define TPHCLTUSSDALPHABETPACKER_H
+
+/**
+* Class for packing the Ussd string.
+*/
+class TPhCltUssdAlphabetPacker
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Constructor.
+        *
+        * @param aAlphabet The used Data Coding Scheme.
+        * @param aIsBinary Is the data binary.
+        * @param aStartBit The start bit of the conversion.
+        */
+        TPhCltUssdAlphabetPacker(
+            TSmsDataCodingScheme::TSmsAlphabet aAlphabet,
+            TBool aIsBinary,
+            TInt aStartBit );
+
+    public:  // New functions
+
+        /**
+        * Pack the given string to the desired coding scheme.
+        *
+        * @param aOut The output string of packing
+        * @param aIn The string to be packed.
+        * @return The number of octets used.
+        */
+        TInt PackL(TDes8& aOut,const TDesC8& aIn);
+
+        /**
+        * Convert and pack the given string to the desired coding scheme.
+        *
+        * @param aCharacterSetConverter The character converter.
+        * @param aFs Reference to file system.
+        * @param aOut The output string of packing
+        * @param aIn The string to be packed.
+        * @param aConvertedNumUDUnits The number of converted units.
+        * @return The number of octets used.
+        */
+        TInt ConvertAndPackL(
+            CCnvCharacterSetConverter& aCharacterSetConverter,
+            RFs& aFs,
+            TDes8& aOut,
+            const TDesC& aIn,
+            TInt& aConvertedNumUDUnits );
+
+        /**
+        * Return information of how many octets are required when
+        * the aNumUDUnits number of characters is packed.
+        *
+        * @param aNumUDUnits The number of characters to be packed.
+        * @return The number of octets required.
+        */
+        TInt PackedOctetsRequiredL( TInt aNumUDUnits ) const;
+        
+    private:
+
+        // Private helper methods
+        TInt ElementSizeInBitsL() const;
+        
+    private:    // Data
+
+        // The Data Coding Scheme of the conversion.
+        TSmsDataCodingScheme::TSmsAlphabet iAlphabet;
+
+        // Information is the given descriptor binary.
+        TBool iIsBinary;
+
+        // The start bit of the conversion.
+        TInt iStartBit;
+    };
+
+#endif // TPHCLTUSSDALPHABETPACKER_H
+
+
+// -----------------------------------------------------------------------------
+// TPhCltUssdAlphabetPacker::TPhCltUssdAlphabetPacker
+//
+// -----------------------------------------------------------------------------
+//
+TPhCltUssdAlphabetPacker::TPhCltUssdAlphabetPacker(
+    TSmsDataCodingScheme::TSmsAlphabet aAlphabet,
+    TBool aIsBinary,
+    TInt aStartBit)
+    : iAlphabet( aAlphabet ),
+      iIsBinary( aIsBinary ),
+      iStartBit( aStartBit )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltUssdAlphabetPacker::PackL
+//
+// -----------------------------------------------------------------------------
+//
+TInt TPhCltUssdAlphabetPacker::PackL( TDes8& aOut,const TDesC8& aIn )
+    {
+    // Ensure we've got the right length
+    TInt packedOctetsRequired = PackedOctetsRequiredL( aIn.Length() );
+    if ( packedOctetsRequired > ( aOut.MaxLength() - aOut.Length() ) )
+        {
+        User::Leave( KErrOverflow );
+        }
+
+    // Do the conversion
+    TInt elementSizeInBits = ElementSizeInBitsL();
+    if ( elementSizeInBits == 8 ) // 8 bit data
+        {
+        // Straight copy here
+        aOut.Append( aIn );
+        }
+    else if ( elementSizeInBits == 7 ) // Need packing to 7-bit
+        {
+        // Get raw pointers and do packing
+        TUint8* outPtr = ( TUint8* )aOut.Ptr() + aOut.Length();
+        const TUint8* inPtr = aIn.Ptr();
+        
+        outPtr[0] = 0;
+        for ( TInt i = 0; i < aIn.Length() ; i++ )
+            {
+            TUint8 to = inPtr[i];
+            *outPtr |= ( to << iStartBit );
+            if ( iStartBit )
+                {
+                outPtr++;
+                *outPtr = ( TUint8 ) ( to >> ( 8 - iStartBit ) );
+                }
+            iStartBit = ( iStartBit + 7 )%8; // roll 0,1,2,3,4,5,6,7,0,1,2,...
+            
+            if ( i == aIn.Length() - 1 ) // if this is the last time
+                {
+                if ( ( to == KPhCltUssdCarriageReturn && iStartBit == 0 ) || 
+                     iStartBit == 1 )
+                    {
+                    //We have to add one CR more
+                    *outPtr |= ( KPhCltUssdCarriageReturn << iStartBit );
+                    if ( iStartBit )
+                        {
+                        outPtr++;
+                        *outPtr = ( TUint8 ) (
+                            KPhCltUssdCarriageReturn >> ( 8 - iStartBit ) );
+                        }
+                    else
+                        {
+                        packedOctetsRequired++;
+                        }
+                    iStartBit = ( iStartBit + 7 )%8;
+                    }
+                }
+            }
+        // Increment the length for the packed data
+        aOut.SetLength( aOut.Length() + packedOctetsRequired );
+        }
+    else
+        {
+        User::Invariant();
+        }
+    // Return number of bytes used
+    return packedOctetsRequired;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltUssdAlphabetPacker::ConvertAndPackL
+//
+// -----------------------------------------------------------------------------
+//
+TInt TPhCltUssdAlphabetPacker::ConvertAndPackL(
+    CCnvCharacterSetConverter& aCharacterSetConverter,
+    RFs& aFs,
+    TDes8& aOut,
+    const TDesC& aIn,
+    TInt& aConvertedNumUDUnits )
+    {
+    
+    // Do the conversion
+    CSmsAlphabetConverter* converter = 
+        CSmsAlphabetConverter::NewLC( 
+            aCharacterSetConverter, aFs, iAlphabet, iIsBinary );
+
+    TPtrC8 convertedPtr = converter->ConvertFromNativeL( aIn );
+    aConvertedNumUDUnits = convertedPtr.Length();
+
+    // Do the packing
+    TInt octetsUsed = PackL( aOut,convertedPtr );
+
+    // Cleanup and return
+    CleanupStack::PopAndDestroy(); // converter
+    return octetsUsed;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltUssdAlphabetPacker::PackedOctetsRequiredL
+//
+// -----------------------------------------------------------------------------
+//
+TInt TPhCltUssdAlphabetPacker::PackedOctetsRequiredL( TInt aNumUDUnits ) const
+
+    {  
+    TInt octetsRequired = 0;
+    TInt elementSizeInBits = ElementSizeInBitsL();
+    if ( elementSizeInBits == 8 )
+        {
+        octetsRequired=aNumUDUnits;
+        }
+    else
+        {
+        octetsRequired =
+            ( iStartBit + aNumUDUnits*elementSizeInBits + 7 )/8;    // Rounds up
+        }
+    return octetsRequired;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhCltUssdAlphabetPacker::ElementSizeInBitsL
+//
+// -----------------------------------------------------------------------------
+//
+TInt TPhCltUssdAlphabetPacker::ElementSizeInBitsL() const
+    {   
+    if ( iIsBinary )
+        return 8;
+    switch ( iAlphabet )
+        {
+        case TSmsDataCodingScheme::ESmsAlphabet7Bit:
+            {
+            return 7;
+            }
+        case TSmsDataCodingScheme::ESmsAlphabet8Bit:
+        case TSmsDataCodingScheme::ESmsAlphabetUCS2:
+            {
+            return 8;
+            }
+        default:
+            {
+            User::Leave( KErrGsmSMSDataCodingSchemeNotSupported );
+            return 8;
+            }
+        }
+    }
+
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdImp::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPhCltUssdImp* CPhCltUssdImp::NewL( TBool aShowNotes )
+    {
+    TFLOGSTRING("CPhCltUssdImp: NewL call")
+    CPhCltUssdImp* self = new( ELeave ) CPhCltUssdImp;
+    CleanupStack::PushL( self );
+    self->ConstructL( aShowNotes );
+    CleanupStack::Pop(); // self
+    TFLOGSTRING("CPhCltUssdImp: NewL exit")
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdImp::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CPhCltUssdImp::ConstructL( TBool aShowNotes )
+    {
+    TFLOGSTRING("CPhCltUssdImp: ConstructL call")
+    // The note controller is needed only if the notes are shown.
+    iNoteController = NULL;
+    
+    if ( aShowNotes )
+        {
+        iNoteController = CPhCltUssdNoteController::NewL( 
+            *this );
+        }
+
+    iDCS = KPhCltUssdDcsDefaultAlphabet;
+    iWait = new( ELeave ) CActiveSchedulerWait;
+
+    // The one that send the request forward.
+    iRequestHandler = CPhCltUssdRequestHandler::NewL( 
+        *this, 
+        CActive::EPriorityStandard );
+    TFLOGSTRING("CPhCltUssdImp: ConstructL exit")
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdImp::CPhCltUssdImp
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPhCltUssdImp::CPhCltUssdImp()
+    {
+    TFLOGSTRING("CPhCltUssdImp: CPhCltUssdImp call_exit")
+    } 
+
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdImp::~CPhCltUssdImp
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CPhCltUssdImp::~CPhCltUssdImp()
+    {
+    TFLOGSTRING("CPhCltUssdImp: ~CPhCltUssdImp call") 
+    if ( iWait )
+        {
+        if ( iWait->IsStarted() )
+            {
+            iWait->AsyncStop();
+            }
+        delete iWait;
+        iWait = NULL;
+        }
+
+    delete iRequestHandler;
+    iRequestHandler = NULL;
+    
+    delete iNoteController;
+    iNoteController = NULL;
+    TFLOGSTRING("CPhCltUssdImp: ~CPhCltUssdImp exit") 
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdImp::HandleSendEventL
+// 
+// Called when the Send request is completed. aError might be
+// positive -> the Send is completed due received message.
+// -----------------------------------------------------------------------------
+//
+void CPhCltUssdImp::HandleSendEventL( const TInt aError )
+    {
+    iSendError = Min( aError , KErrNone );
+    TFLOGSTRING2("CPhCltUssdImp: HandleSendEventL\
+            aError = %d call", aError)
+    // iNoteController is allocated only if notes are shown.
+    if ( iNoteController )
+        {
+        // Send request is completed, now destroy the wait note
+        iNoteController->DestroyGlobalWaitNote();
+
+        // Show a different note depenging on the error code.
+        if ( aError <= 0 )
+            {
+            switch ( aError )
+                {
+                // All Ok.
+                case KErrNone:
+                    iNoteController->ShowGlobalInformationNoteL( EPhCltUssdDone );
+                    break;
+
+                // Operation cancelled.
+                case KErrCancel:
+                    iNoteController->ShowGlobalInformationNoteL( EPhCltUssdUnconfirme );
+                    break;
+
+                // Ongoing Ussd session or the string is barred due SS request
+                // or Fixed Dialling feature.
+                case KErrInUse:
+                case KErrAccessDenied:
+                case KErrGsmSSCallBarred:
+                    iNoteController->ShowGlobalInformationNoteL( EPhCltUssdNotallowed );
+                    break;
+
+                // No network coverage.
+                case KErrGsmSMSNoNetworkService:
+                    iNoteController->ShowGlobalInformationNoteL(EPhCltUssdNoservice );
+                    break;
+
+                // Offline mode.
+                case KErrGsmOfflineOpNotAllowed:
+                    iNoteController->ShowGlobalInformationNoteL( EPhCltUssdOffline );
+                    break;
+                    
+                case KErrSatControl:
+                    break; 
+
+                // Unknown error.
+                default:
+                    iNoteController->ShowGlobalInformationNoteL( EPhCltUssdNotDone );
+                    break;
+                }
+            }
+        }
+
+    // Let the original active object (one that did the send request) run again.
+    if ( iWait->IsStarted() )
+        {
+        iWait->AsyncStop();
+        }
+    TFLOGSTRING("CPhCltUssdImp: HandleSendEventL exit")
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdImp::SendUssd
+// 
+// 16-bit buffer is packed into 7-bit stream and sent.
+// Default alphabet is used.
+// -----------------------------------------------------------------------------
+//
+TInt CPhCltUssdImp::SendUssd( const TDesC& aMsgData )
+    {
+    __ASSERT_ALWAYS( aMsgData.Length() <= KPhCltUssdMax8BitCharacters,
+        User::Invariant() );
+
+    TRAPD( err ,
+        {
+        HBufC8* buffer8 = HBufC8::NewLC( KPhCltUssdMax7BitCharacterOctets );
+        
+        TPtr8 ptr8 = buffer8->Des();
+        EncodeL( aMsgData , ptr8 );
+        
+        User::LeaveIfError( SendUssd( ptr8 ) );
+        
+        CleanupStack::PopAndDestroy(); // ptr8
+        });
+
+    return err;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdImp::SendUssd
+// 
+// Packed buffer is send to the network with default alphabet.
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+
+TInt CPhCltUssdImp::SendUssd( const TDesC8& aMsgData )
+    {
+    __ASSERT_ALWAYS( aMsgData.Length() <= KPhCltUssdMax7BitCharacterOctets,
+        User::Invariant() );
+ 
+    return SendUssd( aMsgData , iDCS );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdImp::SendUssd
+// 
+// Packed buffer is sent to network with given alphabet.
+// -----------------------------------------------------------------------------
+//
+TInt CPhCltUssdImp::SendUssd( 
+    const TDesC8& aMsgData, 
+    const TUint8 iSendDcs )
+    {
+    TFLOGSTRING("CPhCltUssdImp: SendUssd call")
+    __ASSERT_ALWAYS( aMsgData.Length() <= KPhCltUssdMax7BitCharacterOctets,
+        User::Invariant() );
+
+    RMobileUssdMessaging::TMobileUssdAttributesV1 attribute;
+
+    attribute.iFlags = 
+        RMobileUssdMessaging::KUssdDataFormat + 
+        RMobileUssdMessaging::KUssdMessageDcs;
+    if ( iDCS2  == KPhCltDcs7Bit )
+        {
+        attribute.iFormat = RMobileUssdMessaging::EFormatPackedString;
+        }
+    else
+        {
+        attribute.iFormat = RMobileUssdMessaging::EFormatUnspecified;
+        }
+        
+    if ( iSendDcs == KPhCltUssdDcsNotSet  ) // 0x00
+        {
+        attribute.iDcs = KPhCltUssdDcsDefaultAlphabet;
+        }
+    else
+        {
+        attribute.iDcs = iSendDcs;
+        } 
+    
+    RMobileUssdMessaging::TMobileUssdAttributesV1Pckg 
+        attributePckg( attribute );
+
+
+    if ( iWait->IsStarted() )
+        {
+        return KErrInUse;
+        }
+
+    iSendError = KErrNone;
+    TFLOGSTRING("CPhCltUssdImp: SendUssd iRequestHandler")
+    iRequestHandler->SendUssd( aMsgData , attributePckg );
+    // iNoteController is allocated only if notes are shown.
+    TFLOGSTRING("CPhCltUssdImp: SendUssd ShowGlobalWaitNoteL")
+    if ( iNoteController )
+        {
+        TRAP_IGNORE( iNoteController->ShowGlobalWaitNoteL(); 
+                    );
+        }
+    TFLOGSTRING("CPhCltUssdImp: SendUssd iWait") 
+
+    // Set this active object to wait the completion of the send request.
+    iWait->Start();
+
+    TFLOGSTRING("CPhCltUssdImp: SendUssd exit") 
+    return iSendError;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdImp::SendUssdCancel
+// 
+// Cancels the out-standing request.
+// -----------------------------------------------------------------------------
+//
+void CPhCltUssdImp::SendUssdCancel()
+    {
+    TFLOGSTRING("CPhCltUssdImp: SendUssdCancel call")
+    iRequestHandler->SendUssdCancel();
+    TFLOGSTRING("CPhCltUssdImp: SendUssdCancel exit")
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdImp::StartUssdEditor
+// 
+// Request Ussd App to start
+// ---------------------------------------------------------------------------
+//
+TInt CPhCltUssdImp::StartUssdEditor() const
+    {
+    return iRequestHandler->UssdClient().StartUssdEditor();
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdImp::AppStarting
+// 
+// UI informs that it is been created
+// -----------------------------------------------------------------------------
+//
+TInt CPhCltUssdImp::AppStarting()
+    {
+    TFLOGSTRING("CPhCltUssdImp: AppStarting call")
+    TInt res = iRequestHandler->UssdClient().AppStarting();
+    TFLOGSTRING2("CPhCltUssdImp: AppStarting exit res = %d",res)
+    return res;
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhCltUssdImp::AppTerminating
+// 
+// UI informs that it is terminating
+// -----------------------------------------------------------------------------
+//    
+TInt CPhCltUssdImp::AppTerminating( 
+      TPhCltUssdAppExitReason aExitReason )
+    {
+    TFLOGSTRING("CPhCltUssdImp: AppTerminating call")
+    TInt res = iRequestHandler->UssdClient().AppTerminating( aExitReason );
+    TFLOGSTRING2("CPhCltUssdImp: AppTerminating exit res = %d",res)
+    return res;
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhCltUssdImp::AppToForeground
+// 
+// UI informs that it is brougth to foreground
+// -----------------------------------------------------------------------------
+//    
+TBool CPhCltUssdImp::AppToForeground()
+    {
+    TFLOGSTRING("CPhCltUssdImp: AppToForeground call")
+    TBool res =  iRequestHandler->UssdClient().AppToForeground();
+    TFLOGSTRING2("CPhCltUssdImp: AppToForeground exit res = %d",res)
+    return res;
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhCltUssdImp::AppToBackground
+// 
+// UI informs that it is gone background
+// -----------------------------------------------------------------------------
+//    
+TInt CPhCltUssdImp::AppToBackground()
+    {
+    TFLOGSTRING("CPhCltUssdImp: AppToBackground call")
+    TInt res = iRequestHandler->UssdClient().AppToBackground();
+    TFLOGSTRING2("CPhCltUssdImp: AppToBackground exit res = %d",res)
+    return res;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdImp::StartSAT
+// 
+// 
+// -----------------------------------------------------------------------------
+//    
+void  CPhCltUssdImp::StartSAT( 
+            TRequestStatus& aStatus, 
+            TDes& aReceiveMessage, 
+            TPckg< TUint >& aShowNotesAndDcs )
+    {
+    TFLOGSTRING("CPhCltUssdImp: StartSAT call")
+    iRequestHandler->UssdClient().StartSAT( aStatus, aReceiveMessage, aShowNotesAndDcs );
+    TFLOGSTRING("CPhCltUssdImp: StartSAT exit")
+    }
+ 
+// -----------------------------------------------------------------------------
+// CPhCltUssdImp::StopSAT
+// 
+// Cancels SAT session
+// -----------------------------------------------------------------------------
+//   
+ void CPhCltUssdImp::StopSAT()
+    {
+    TFLOGSTRING("CPhCltUssdImp: StopSAT call")
+    iRequestHandler->UssdClient().StopSAT();
+    TFLOGSTRING("CPhCltUssdImp: StopSAT exit")
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdImp::GlobalWaitNoteHidden
+//
+// Dialog is hidden by the cancel key.
+// -----------------------------------------------------------------------------
+//
+void CPhCltUssdImp::GlobalWaitNoteHidden()
+    {
+    TFLOGSTRING("CPhCltUssdImp: GlobalWaitNoteHidden call")
+    TFLOGSTRING("CPhCltUssdImp: GlobalWaitNoteHidden exit")
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdImp::EncodeL
+//
+// Converts a given Uniocde string into 7-bit buffer.
+// -----------------------------------------------------------------------------
+//
+void CPhCltUssdImp::EncodeL( const TDesC& aSrc, TDes8& aDes )
+    {
+    TFLOGSTRING("CPhCltUssdImp: EncodeL call")
+    aDes.Zero();
+    TSmsDataCodingScheme::TSmsAlphabet alphabet = 
+        TSmsDataCodingScheme::ESmsAlphabet7Bit; // default
+        
+    CCnvCharacterSetConverter* charConv = CCnvCharacterSetConverter::NewLC();
+    
+    TUint cutChars = 0;
+    TUint startBit = 0;
+
+    if ( iDCS == KPhCltUssdDcsAlphabetDefaultPrecededLanguage )
+        {
+        alphabet = TSmsDataCodingScheme::TSmsDataCodingScheme::ESmsAlphabet7Bit;
+        FindFirstCarriageReturnL( aSrc , cutChars , startBit );
+        
+        }
+    else if ( iDCS == KPhCltUssdDcsAlphabetUCS2PrecededLanguage )
+        {
+        alphabet = TSmsDataCodingScheme::ESmsAlphabetUCS2;
+        cutChars = KPhCltUssdDcsAlphabetUCS2PrecededLanguageSkipChars;
+        }
+    else if ( (iDCS & KPhCltUssdDcsGeneralInformationMask)  == 
+            KPhCltUssdDcsGeneralInformation ) // General data coding information
+        {
+        //Is text compressed?
+        if ( iDCS & KPhCltUssdDcsGeneralInformationCompressed )
+            {
+            User::Leave( KErrNotSupported );
+            }
+        // Is SIM specific message
+        else if ( ( iDCS & KPhCltUssdDcsGeneralInformationSimMask ) 
+                   == KPhCltUssdDcsGeneralInformationSim )
+            {
+            User::Leave( KErrAbort ); // Do not show any messages
+            }
+        // 8 bit data?
+        else if ( ( iDCS & KPhCltUssdDcsGeneralInformationAlphabetMask ) ==  
+                   KPhCltUssdDcsGeneralInformationAlphabet8Bit )
+            {
+            alphabet = TSmsDataCodingScheme::ESmsAlphabet8Bit;
+            }
+        // UCS2 bit data?
+        else if ( ( iDCS & KPhCltUssdDcsGeneralInformationAlphabetMask ) == 
+                   KPhCltUssdDcsGeneralInformationAlphabetUCS2 )
+            {
+            alphabet = TSmsDataCodingScheme::ESmsAlphabetUCS2;
+            }
+        }
+    // Data coding/message handling
+    else if ( ( iDCS & KPhCltUssdDcsMessageHandlingAlphabetMask ) 
+               == KPhCltUssdDcsMessageHandlingAlphabet8Bit )
+        {
+        alphabet = TSmsDataCodingScheme::ESmsAlphabet8Bit;
+        }
+    
+    TPhCltUssdAlphabetPacker* packer = 
+        new ( ELeave ) TPhCltUssdAlphabetPacker( 
+            alphabet, EFalse, startBit );
+        CleanupStack::PushL( packer );
+        
+   
+    RFs fs;
+    User::LeaveIfError( fs.Connect() );
+    CleanupClosePushL( fs );
+    
+    TInt numberOfElem = 0;
+   // packer->ConvertAndPackL( 
+    //    *charConv , fs , aDes , aSrc , numberOfElem );
+        
+        
+    if ( alphabet == TSmsDataCodingScheme::ESmsAlphabet7Bit )
+        {
+        //TInt numberOfElem = (( aSrc.Length() - cutChars ) * 8 - startBit ) / 7;
+            
+         packer->ConvertAndPackL( 
+        *charConv , fs , aDes , aSrc.Right( aSrc.Length() - cutChars ), numberOfElem );
+
+        // DCS was 7-bit data.
+        iDCS2 = KPhCltDcs7Bit; 
+        }
+    else // ESmsAlphabet8Bit || ESmsAlphabetUCS2
+        {
+        CSmsAlphabetConverter* converter =
+            CSmsAlphabetConverter::NewLC(
+                *charConv ,fs, alphabet, EFalse );
+
+        aDes = converter->ConvertFromNativeL(
+            aSrc.Right( aSrc.Length() - cutChars ) );
+        CleanupStack::PopAndDestroy(); //converter
+
+        if( alphabet == TSmsDataCodingScheme::ESmsAlphabet8Bit )
+            {
+            // DCS was 8-bit data.
+            iDCS2 = KPhCltDcs8Bit;
+            }
+        else if( alphabet == TSmsDataCodingScheme::ESmsAlphabetUCS2 )
+            {
+             //DCS was UCS2 data.
+            iDCS2 = KPhCltDcsUcs2;
+            }
+        // If DCS not 8-bit or UCS2, then EPhCltDcsUnknown is returned.
+        }
+    
+    CleanupStack::PopAndDestroy(3); // fs, packer, charConv
+    TFLOGSTRING("CPhCltUssdImp: EncodeL exit")
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdImp::SetDCS()
+//
+// Set data coding scheme 
+// -----------------------------------------------------------------------------
+//
+void CPhCltUssdImp::SetDCS( TUint8 aDCS )
+    {
+    iDCS = aDCS;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdImp::FindFirstCarriageReturnL
+// -----------------------------------------------------------------------------
+//
+void CPhCltUssdImp::FindFirstCarriageReturnL( 
+    const TDesC& aBuffer ,
+    TUint& aSkipChars , 
+    TUint& aStartBit )
+    {
+    if ( aBuffer.Length() < 3 )
+        {
+        User::Leave( KErrUnderflow );
+        }
+
+    aSkipChars = 0;
+    aStartBit = 0;
+
+    // Try out two different cases:
+    // 1. Find CR from thrid byte
+    // 2. Find CR from second byte, starting from bit 6
+
+    // 1.:
+    if ( aBuffer[2] == KPhCltUssdCarriageReturn )
+        {
+        aSkipChars = KPhCltUssdDcsAlphabetDefaultPrecededLanguageSkipChars3;
+        aStartBit = 0;
+        return;
+        }
+
+    // 2.:
+    // First put the pieces together and then compare
+    // Take last 2 bits from the second byte:
+    TUint result1 = aBuffer[1];
+    result1 = result1 >> 6;
+
+    // Take first 5 bits from the third byte:
+    TUint result2 = aBuffer[2];
+    result2 = result2 & 0x1f; // bits 0-4.
+    result2 = result2 << 2; // move to bits 2-6.
+
+    TUint result = result1 + result2; // 0000 00xx + 0xxx xx00
+    if ( result == KPhCltUssdCarriageReturn )
+        {
+        aSkipChars = KPhCltUssdDcsAlphabetDefaultPrecededLanguageSkipChars2;
+        aStartBit = KPhCltUssdDcsAlphabetDefaultPrecededLanguageStartBit;
+        return;
+        }
+
+    // Is was not case 1. or 2. so we are not supporting sort of string.
+    User::Leave( KErrNotSupported );
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/ussdwrapper/cphcltussdint.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Ussd Interface, 
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "cphcltussdint.h" 
+#include "cphcltussdimp.h" 
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdInt::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CPhCltUssdInt* CPhCltUssdInt::NewL( TBool aShowNotes )
+    {
+    return CPhCltUssdImp::NewL( aShowNotes );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdInt::CPhCltUssdInt
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPhCltUssdInt::CPhCltUssdInt( )    
+    {
+    }
+    
+
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/ussdwrapper/cphcltussdnotecontroller.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -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:  Ussd note controller
+*
+*/
+
+
+// INCLUDE FILES
+#include <hbdevicemessageboxsymbian.h>
+#include <hbdeviceprogressdialogsymbian.h>
+#include <hbtextresolversymbian.h>
+
+#include "phcltclientserver.h" 
+#include "cphcltussdnotecontroller.h" 
+#include "tflogger.h"
+
+_LIT(KUssdLocFilename, "ussd_");
+_LIT(KCommonLocFilename, "common_");
+_LIT(KPath, "z:\\resource\\qt\\translations");
+_LIT(KUssdRequesting, "txt_common_info_requesting"); // Requesting
+_LIT(KUssdDone, "txt_ussd_dpopinfo_done"); // Done
+_LIT(KUssdNotDone, "txt_ussd_dpopinfo_not_done"); // NotDone
+_LIT(KUssdNotAllowed, "txt_ussd_dpopinfo_not_allowed"); //NotAllowed
+_LIT(KUssdUnconfirmed, "txt_ussd_dpopinfo_request_not_confirmed"); // Unconfirmed
+_LIT(KUssdNoService, "txt_ussd_dpopinfo_no_service"); // NoService
+_LIT(KUssdOffline, "txt_ussd_dpopinfo_unable_to_use_network_phone_is"); // Offline
+_LIT(KUssdHide, "txt_common_button_hide"); // Hide
+
+const int KPhCltUssdProgressBarMaxLength = 10;
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdNoteController::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPhCltUssdNoteController* CPhCltUssdNoteController::NewL(
+        MPhCltUssdNoteControllerCallBack& aCallBack )
+    {
+    TFLOGSTRING("CPhCltUssdNoteController: NewL call")
+    CPhCltUssdNoteController* self = new( ELeave ) 
+        CPhCltUssdNoteController( aCallBack );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    TFLOGSTRING("CPhCltUssdNoteController: NewL exit")
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdNoteController::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CPhCltUssdNoteController::ConstructL()
+    {
+    TFLOGSTRING( "CPhCltUssdNoteController: ConstructL call_exit" ) 
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdNoteController::CPhCltUssdNoteController
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CPhCltUssdNoteController::CPhCltUssdNoteController(
+    MPhCltUssdNoteControllerCallBack& aCallBack )
+    : iGlobalWaitNote( NULL ),
+      iCallBack( aCallBack )
+    {
+    TFLOGSTRING("CPhCltUssdNoteController: CPhCltUssdNoteController call")
+    TFLOGSTRING("CPhCltUssdNoteController: CPhCltUssdNoteController exit")
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdNoteController:~CPhCltUssdNoteController
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPhCltUssdNoteController::~CPhCltUssdNoteController()
+    {
+    TFLOGSTRING("CPhCltUssdNoteController: ~CPhCltUssdNoteController call")
+    DestroyGlobalWaitNote();
+    TFLOGSTRING("CPhCltUssdNoteController: ~CPhCltUssdNoteController exit")
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdNoteController::ShowGlobalInformationNoteL
+// -----------------------------------------------------------------------------
+void CPhCltUssdNoteController::ShowGlobalInformationNoteL( 
+        const TPhCltUssdInformationType aInfoType )
+    {
+    TFLOGSTRING2("CPhCltUssdNoteController: ShowGlobalInformationNoteL\
+            aInfoType = %d call", aInfoType)
+    const TBool textResolver = HbTextResolverSymbian::Init( 
+        KUssdLocFilename, KPath );
+    TFLOGSTRING2("CPhCltUssdNoteController: ShowGlobalInformationNoteL\
+        ussd textResolver = %d", textResolver ) 
+    HBufC* temp(NULL);
+    switch ( aInfoType )
+        {
+        case EPhCltUssdUnconfirme:
+            {
+            temp = HbTextResolverSymbian::LoadLC( KUssdUnconfirmed );
+            break;
+            }
+        case EPhCltUssdNotallowed:
+            {
+            temp = HbTextResolverSymbian::LoadLC( KUssdNotAllowed );
+            break;
+            }
+        case EPhCltUssdNoservice:
+            {
+            temp = HbTextResolverSymbian::LoadLC( KUssdNoService );
+            break;
+            }
+        case EPhCltUssdOffline:
+            {
+            temp = HbTextResolverSymbian::LoadLC( KUssdOffline );
+            break;
+            }
+        case EPhCltUssdDone:
+            {
+            temp = HbTextResolverSymbian::LoadLC( KUssdDone );
+            break;
+            }
+        case EPhCltUssdNotDone:
+            {
+            temp = HbTextResolverSymbian::LoadLC( KUssdNotDone );
+            break;
+            }
+        default:
+            {
+            User::Leave( KErrArgument );
+            break;
+            }
+        }
+    CHbDeviceMessageBoxSymbian* dlg = CHbDeviceMessageBoxSymbian::NewL(
+            CHbDeviceMessageBoxSymbian::EInformation);
+    CleanupStack::PushL( dlg );
+    dlg->SetTextL( temp->Des() );
+    dlg->SetButton( CHbDeviceMessageBoxSymbian::EAcceptButton, ETrue );
+    dlg->ExecL();
+    CleanupStack::PopAndDestroy( dlg );
+    CleanupStack::PopAndDestroy( temp );
+    TFLOGSTRING("CPhCltUssdNoteController: ShowGlobalInformationNoteL exit")
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdNoteController::ShowGlobalWaitNoteL
+// -----------------------------------------------------------------------------
+void CPhCltUssdNoteController::ShowGlobalWaitNoteL( )
+    {
+    TFLOGSTRING("CPhCltUssdNoteController: ShowGlobalWaitNoteL call")
+    DestroyGlobalWaitNote();
+    TBool textResolver = HbTextResolverSymbian::Init( 
+        KCommonLocFilename, KPath );
+    TFLOGSTRING2("CPhCltUssdNoteController: ConstructL\
+        init common textResolver = %d", textResolver ) 
+    //CHbDeviceProgressDialogSymbian
+    iGlobalWaitNote = CHbDeviceProgressDialogSymbian::NewL(
+            CHbDeviceProgressDialogSymbian::EProgressDialog );
+    CleanupStack::PushL( iGlobalWaitNote );
+    HBufC* context = HbTextResolverSymbian::LoadLC( KUssdRequesting );
+    iGlobalWaitNote->SetTextL( context->Des() );
+    HBufC* bottonText = HbTextResolverSymbian::LoadLC( KUssdHide );
+    iGlobalWaitNote->SetButtonTextL( bottonText->Des() );
+    iGlobalWaitNote->SetObserver( this );
+    TFLOGSTRING("CPhCltUssdNoteController: ShowGlobalWaitNoteL before setactive")
+    iGlobalWaitNote->SetRange(0,KPhCltUssdProgressBarMaxLength);
+    iGlobalWaitNote->SetProgressValue( KPhCltUssdProgressBarMaxLength );
+    iGlobalWaitNote->SetAutoClose( EFalse );
+    iGlobalWaitNote->ShowL();
+    TFLOGSTRING("CPhCltUssdNoteController: ShowGlobalWaitNoteL after ShowL")
+    CleanupStack::PopAndDestroy( bottonText );
+    CleanupStack::PopAndDestroy( context );
+    CleanupStack::Pop( iGlobalWaitNote );
+    TFLOGSTRING("CPhCltUssdNoteController: ShowGlobalWaitNoteL after setactive")
+    TFLOGSTRING("CPhCltUssdNoteController: ShowGlobalWaitNoteL exit")
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdNoteController::DestroyGlobalWaitNote
+// -----------------------------------------------------------------------------
+void CPhCltUssdNoteController::DestroyGlobalWaitNote()
+    {
+    TFLOGSTRING("CPhCltUssdNoteController: DestroyGlobalWaitNote call")
+    if ( iGlobalWaitNote )
+        {
+        iGlobalWaitNote->Close();
+        delete iGlobalWaitNote;
+        iGlobalWaitNote = NULL;
+        }
+    TFLOGSTRING("CPhCltUssdNoteController: DestroyGlobalWaitNote exit")
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdNoteController::ProgressDialogCancelled
+//
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhCltUssdNoteController::ProgressDialogCancelled(
+        const CHbDeviceProgressDialogSymbian* /*aProgressDialog*/)
+    {
+    TFLOGSTRING("CPhCltUssdNoteController: ProgressDialogCancelled call")
+    iCallBack.GlobalWaitNoteHidden();
+    TFLOGSTRING("CPhCltUssdNoteController: ProgressDialogCancelled exit")
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdNoteController::ProgressDialogClosed
+//
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhCltUssdNoteController::ProgressDialogClosed(
+        const CHbDeviceProgressDialogSymbian* /*aProgressDialog*/)
+    {
+    TFLOGSTRING("CPhCltUssdNoteController: ProgressDialogClosed call")
+    TFLOGSTRING("CPhCltUssdNoteController: ProgressDialogClosed exit")
+    }
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/ussdwrapper/cphcltussdrequesthandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,145 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Ussd Notify Handler
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "cphcltussdrequesthandler.h" 
+#include "mphcltussdrequesthandler.h" 
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdRequestHandler::CPhCltUssdRequestHandler
+// C++ constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPhCltUssdRequestHandler::CPhCltUssdRequestHandler(
+    MPhCltUssdRequestHandler& aHandler,
+    TInt aPriority )
+    : CActive( aPriority ), iHandler( aHandler )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdRequestHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPhCltUssdRequestHandler* CPhCltUssdRequestHandler::NewL( 
+    MPhCltUssdRequestHandler& aHandler,
+    TInt aPriority )
+    {
+    CPhCltUssdRequestHandler* self = 
+        new( ELeave ) CPhCltUssdRequestHandler( aHandler , aPriority );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(); // self
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdRequestHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CPhCltUssdRequestHandler::ConstructL()
+    {
+    User::LeaveIfError( iPhClient.Connect() );
+    User::LeaveIfError( iUssdClient.Open( iPhClient ) );
+    }
+
+
+// Destructor
+CPhCltUssdRequestHandler::~CPhCltUssdRequestHandler()
+    {
+    Cancel();
+
+    //iUssdClient.CancelSend(); Fix to ou1cimx1#265402
+    iUssdClient.Close();
+
+    iPhClient.Close();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdRequestHandler::SendUssd
+//
+// Called when Sending
+// -----------------------------------------------------------------------------
+void CPhCltUssdRequestHandler::SendUssd( 
+    const TDesC8& aMsgData, 
+    const TDesC8& aMsgAttribute )
+    {
+    iUssdClient.SendUssd( iStatus , aMsgData , aMsgAttribute );
+    SetActive();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdRequestHandler::SendUssdCancel
+// 
+// -----------------------------------------------------------------------------
+void CPhCltUssdRequestHandler::SendUssdCancel()
+    {
+    if ( IsActive() )
+        {
+        Cancel();
+        TRAP_IGNORE( iHandler.HandleSendEventL( KErrCancel ) );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdRequestHandler::UssdClient
+// 
+// Returns USSD Client instance
+// -----------------------------------------------------------------------------
+RPhCltUssd& CPhCltUssdRequestHandler::UssdClient()
+    {
+    return iUssdClient;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdRequestHandler::RunL
+//
+// Called when Send completes
+// -----------------------------------------------------------------------------
+void CPhCltUssdRequestHandler::RunL()
+    {
+    iHandler.HandleSendEventL( iStatus.Int() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdRequestHandler::DoCancel
+//
+// Called when Send is cancelled
+// -----------------------------------------------------------------------------
+
+void CPhCltUssdRequestHandler::DoCancel()
+    {
+    iUssdClient.CancelSend();
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneclient/src/ussdwrapper/cphcltussdsatclient.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,365 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Ussd Sat Client.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "cphcltussdimp.h" 
+#include    "phcltclientserver.h" 
+#include    <cphcltussdsatclient.h> 
+#include    <cphcltussd.h> 
+
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+#ifndef CPHCLTUSSDSATACTIVE_H
+#define CPHCLTUSSDSATACTIVE_H
+
+/**
+* The waiter class for SAT sessions.
+*/
+NONSHARABLE_CLASS( CPhCltUssdSatActive ) : public CActive
+    {
+    public:
+
+        /**
+        * Constructor.
+        */
+        CPhCltUssdSatActive();
+
+        /**
+        * Destructor.
+        */
+        ~CPhCltUssdSatActive();
+
+        /**
+        * Set this active object active.
+        * Hides the function derived from CActive.
+        */
+        void SetActive();
+
+        /**
+        * Wait until the Sat Session is ended.
+        * @return The error code of the session.
+        */
+        TInt WaitSatSessionToEnd();
+
+
+    protected:  // From base classes
+
+        /**
+        * @see CActive::RunL
+        */
+        void RunL();
+
+        /**
+        * @see CActive::DoCancel
+        */
+        void DoCancel();
+
+
+    private:
+
+        // The Active scheduler waiter.
+        CActiveSchedulerWait iSatWaiter;
+
+        // The error code storage place.
+        TInt* iError;
+    };
+
+#endif // CPHCLTUSSDSATACTIVE_H
+
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdSatActive::CPhCltUssdSatActive
+//
+// -----------------------------------------------------------------------------
+//
+CPhCltUssdSatActive::CPhCltUssdSatActive() : CActive( EPriorityStandard )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+
+// Destructor
+CPhCltUssdSatActive::~CPhCltUssdSatActive()
+    {
+    Cancel();
+    if ( iSatWaiter.IsStarted() )
+        {
+        iSatWaiter.AsyncStop();
+        }
+
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdSatActive::SetActive
+//
+// -----------------------------------------------------------------------------
+//
+void CPhCltUssdSatActive::SetActive()
+    {
+    CActive::SetActive();
+    iError = NULL;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdSatActive::WaitSatSessionToEnd
+//
+// -----------------------------------------------------------------------------
+//
+TInt CPhCltUssdSatActive::WaitSatSessionToEnd()
+    {
+    if ( !IsActive() )
+        {
+        if ( iError )
+            {
+            return *iError;
+            }
+        else
+            {
+            return KErrNone;
+            }
+        }
+
+    TInt error = KErrNone;
+    iError = &error;
+    iSatWaiter.Start();
+    return error;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdSatActive::RunL
+//
+// -----------------------------------------------------------------------------
+//
+void CPhCltUssdSatActive::RunL()
+    {
+    if ( iError )
+        {
+        *iError = iStatus.Int();
+        }
+    if ( iSatWaiter.IsStarted() )
+        {
+        iSatWaiter.AsyncStop();
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdSatActive::DoCancel
+//
+// -----------------------------------------------------------------------------
+//
+void CPhCltUssdSatActive::DoCancel()
+    {
+    if ( iError )
+        {
+        *iError = KErrCancel;
+        }
+    }
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdSatClient::CPhCltUssdSatClient
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPhCltUssdSatClient::CPhCltUssdSatClient()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdSatClient::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CPhCltUssdSatClient::ConstructL( TBool aShowNotes )
+    {
+    iUssdWrapper = CPhCltUssdImp::NewL( aShowNotes );
+
+    iShowNotes = aShowNotes;
+
+    iSatActive = new( ELeave ) CPhCltUssdSatActive();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdSatClient::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CPhCltUssdSatClient* CPhCltUssdSatClient::NewL( TBool aShowNotes )
+    {
+    CPhCltUssdSatClient* self = new ( ELeave ) CPhCltUssdSatClient;
+    
+    CleanupStack::PushL( self );
+    self->ConstructL( aShowNotes );
+    CleanupStack::Pop();
+    
+    return self;
+    }
+
+
+// Destructor
+EXPORT_C CPhCltUssdSatClient::~CPhCltUssdSatClient()
+    {
+    if ( iSatActive )
+        {
+        if ( iSatActive->IsActive() )
+            {
+            iUssdWrapper->StopSAT();
+            }
+        delete iSatActive;
+        iSatActive = NULL;
+        }
+
+    delete iUssdWrapper;
+    iUssdWrapper = NULL;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdSatClient::SendSatMessage
+// Send SAT message and receive the last message.
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CPhCltUssdSatClient::SendSatMessage( 
+    const TDesC& aSendMessage, 
+    const TUint8 iSendDcs,
+    TDes& aReceiveMessage,
+    TBool& aSendCompletedFirst,
+    TUint8& aReceivedDcs) 
+    {
+    // Do not process request if earlier request is ongoing.
+    if ( iSatActive->IsActive() )
+        {
+        // Stop (complete) the earlier request so that we can send new
+        // SATmessage during next function call.
+        iUssdWrapper->StopSAT();
+        return KErrInUse;
+        }
+    iUssdWrapper->SetDCS( iSendDcs );
+    iSatError = KErrNone;
+    iSendCompletedFirst = &aSendCompletedFirst;
+    *iSendCompletedFirst = ETrue;
+    iReceiveMessage.Set( aReceiveMessage );
+    aReceiveMessage.Zero();
+    aReceivedDcs = EPhCltDcsUnknown;
+    
+    iShowNotesAndDcs = 0; // reset the variable
+    if ( iShowNotes )
+        {
+        iShowNotesAndDcs = KPhCltShowNotes;
+        }
+
+    TPckg< TUint > showNotesAndDcs( iShowNotesAndDcs );
+
+    // Send receive message to the server. status is completed when Ussd session
+    // ends.
+    iUssdWrapper->StartSAT( 
+        iSatActive->iStatus, 
+        aReceiveMessage , 
+        showNotesAndDcs );
+
+    iSatActive->SetActive();
+
+    
+    // Now send the string according to the parameter.
+    TPtrC pMessage( aSendMessage );
+    iSatError = iUssdWrapper->SendUssd( pMessage );
+
+    if ( iSatError != KErrNone )
+        {
+        iSendCompletedFirst = NULL;
+        iUssdWrapper->StopSAT();
+
+        iSatActive->WaitSatSessionToEnd();
+        return iSatError; // Message send error
+        }
+    
+    // Wait until the Ussd conversation is over:
+    TInt satWaiterError = iSatActive->WaitSatSessionToEnd();
+    if ( satWaiterError > KErrNone )
+        {
+        *iSendCompletedFirst = EFalse;
+        }
+    
+    // Get the error code:
+    iSatError = Min ( iSatError, satWaiterError );
+    
+    iSendCompletedFirst = NULL;
+
+    // Return the DCS to the caller.
+    DecodeDcs( aReceivedDcs );
+    aReceivedDcs = iShowNotesAndDcs;
+    return iSatError; // Receive error code
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdSatClient::SendSatMessageCancel
+// 
+// Cancels the out-standing request.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CPhCltUssdSatClient::SendSatMessageCancel()
+    {
+    iUssdWrapper->SendUssdCancel();
+    iSendCompletedFirst = NULL;
+    iUssdWrapper->StopSAT();
+    iSatActive->Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltUssdSatClient::DecodeDcs
+// 
+// In this function the DCS received from PhoneServer is decoded.
+// -----------------------------------------------------------------------------
+//
+void CPhCltUssdSatClient::DecodeDcs( TUint8& aReceivedDcs ) 
+    {
+    // Check what DCS was used, and update aReceivedDcs
+    if ( iShowNotesAndDcs == KPhCltDcs7Bit )
+        {
+        aReceivedDcs = EPhCltDcs7Bit;
+        }
+    else if ( iShowNotesAndDcs == KPhCltDcs8Bit )
+        {
+        aReceivedDcs = EPhCltDcs8Bit;
+        }
+    else if ( iShowNotesAndDcs == KPhCltDcsUcs2 )
+        {
+        aReceivedDcs = EPhCltDcsUCS2;
+        }
+    else
+        {
+        aReceivedDcs = EPhCltDcsUnknown;
+        }
+    }
+
+
+//  End of File  
--- a/phoneclientserver/phoneclient/tsrc/public/basic/ut_ussd/ut_testenv.cpp	Tue Jul 06 14:53:02 2010 +0300
+++ b/phoneclientserver/phoneclient/tsrc/public/basic/ut_ussd/ut_testenv.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -20,34 +20,42 @@
 // ====================================================================
 EtelMsgLoop::EtelMsgLoop()
 {
-	mSendMessageReqStatus = 0;
-
-	mReceiveMessageReqStatus = 0;
-	mReceiveMessageData = 0;
-	mReceiveMessageAttributes = 0;
-
-	mNetworkReleaseReqStatus = 0;
-	mNetworkReleaseMessageData = 0;
-	mNetworkReleaseMessageAttributes = 0;
+    mSendMessageReqStatus = 0;
+    
+    mReceiveMessageReqStatus = 0;
+    mReceiveMessageData = 0;
+    mReceiveMessageAttributes = 0;
+    
+    mNetworkReleaseReqStatus = 0;
+    mNetworkReleaseMessageData = 0;
+    mNetworkReleaseMessageAttributes = 0;
 }
 
 void EtelMsgLoop::receive( const TDesC8& msg, const TDesC8& attr )
 {
-	QVERIFY2(mReceiveMessageReqStatus, "EtelMsgLoop: unable to receive");
-	mReceiveMessageData->Copy( msg );
-	mReceiveMessageAttributes->Copy( attr );
+    qDebug("EtelMsgLoop::receive mReceiveMessageReqStatus in =%d",
+        mReceiveMessageReqStatus);
+    mReceiveMessageData->Copy( msg );
+    mReceiveMessageAttributes->Copy( attr );
     const TestMode& mode = TestEnv::env().testMode();
-	User::RequestComplete(mReceiveMessageReqStatus, mode.m_error);
+    User::RequestComplete(mReceiveMessageReqStatus, mode.m_error);
+    qDebug("EtelMsgLoop::receive mReceiveMessageReqStatus out =%d",
+        mReceiveMessageReqStatus);
+    QVERIFY(mReceiveMessageReqStatus == 0);
 }
 
 void EtelMsgLoop::networkRelease( const TDesC8& msg, const TDesC8& attr )
 {
-	QVERIFY2(mNetworkReleaseReqStatus, "EtelMsgLoop: unable to networkRelease");
-	mNetworkReleaseMessageData->Copy( msg );
-	if ( mNetworkReleaseMessageAttributes )
-		mNetworkReleaseMessageAttributes->Copy( attr );
-    const TestMode& mode = TestEnv::env().testMode();
-	User::RequestComplete(mNetworkReleaseReqStatus, mode.m_error);
+    qDebug("EtelMsgLoop::networkRelease mNetworkReleaseReqStatus in =%d", 
+        mNetworkReleaseReqStatus);
+    mNetworkReleaseMessageData->Copy( msg );
+    if ( mNetworkReleaseMessageAttributes )
+        mNetworkReleaseMessageAttributes->Copy( attr );
+        const TestMode& mode = TestEnv::env().testMode();
+        User::RequestComplete(mNetworkReleaseReqStatus, mode.m_error);
+    qDebug("EtelMsgLoop::networkRelease mNetworkReleaseReqStatus out =%d", 
+        mNetworkReleaseReqStatus);
+    QVERIFY(mNetworkReleaseReqStatus == 0);
 }
 
 // ====================================================================
@@ -83,10 +91,10 @@
     // create the main USSD resource manager class
     m_resourceManager = new CPhSrvResourceManager(m_fs);
     TRAP(leave, m_resourceManager->ConstructL());
-    QVERIFY(leave==0);
+    QVERIFY(leave == 0);
     m_ussdManager = new CPhSrvUssdManager(m_fs,*m_resourceManager);
     TRAP(leave,m_ussdManager->ConstructL(*this));
-    QVERIFY(leave==0);
+    QVERIFY(leave == 0);
     m_fakeMessage = new RMessage2();
 }
 
--- a/phoneclientserver/phoneclient/tsrc/public/basic/ut_ussd/ut_ussd.cpp	Tue Jul 06 14:53:02 2010 +0300
+++ b/phoneclientserver/phoneclient/tsrc/public/basic/ut_ussd/ut_ussd.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -339,9 +339,9 @@
     receive(msg1,RMobileUssdMessaging::EUssdMTRequest);
     activeSleep(1000);
     receive(msg2,RMobileUssdMessaging::EUssdMTRequest);
-    //activeSleep(1000);
+    activeSleep(1000);
     receive(msg3,RMobileUssdMessaging::EUssdMTNotify);
-    //activeSleep(1000);
+    activeSleep(1000);
 
     TestEnv::destroy();
     QTest::qSleep(200);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/bmarm/phoneserveru.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,4 @@
+EXPORTS
+	New__12CPhSrvServer @ 1 NONAME ; CPhSrvServer::New(void)
+	StartThread__Fv @ 2 NONAME ; StartThread(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/bwins/phoneserver.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	?WinsMain@@YAHXZ @ 1 NONAME ; int __cdecl WinsMain(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/bwins/phoneserveru.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,5 @@
+EXPORTS
+	?New@CPhSrvServer@@SAXXZ @ 1 NONAME ; public: static void __cdecl CPhSrvServer::New(void)
+	?StartThread@@YAHXZ @ 2 NONAME ; int __cdecl StartThread(void)
+	?ThreadFunction@CPhSrvServer@@SAHPAX@Z @ 3 NONAME ; public: static int __cdecl CPhSrvServer::ThreadFunction(void *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/group/backup_registration.xml	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,7 @@
+<?xml version="1.0" standalone="yes"?>
+<backup_registration>
+    <passive_backup>
+      <include_directory name = "\" />
+    </passive_backup>
+    <restore requires_reboot = "no"/>
+</backup_registration>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* 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:  Phone Server build file.
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+
+backup_registration.xml  z:/private/10000850/backup_registration.xml
+
+phoneserver_stub.sis                /epoc32/data/z/system/install/phoneserver_stub.sis
+
+// IBY files
+../rom/phoneserver.iby              CORE_MW_LAYER_IBY_EXPORT_PATH(phoneserver.iby)
+
+// LOC files
+../loc/phoneserver.loc              MW_LAYER_LOC_EXPORT_PATH(phoneserver.loc)
+
+PRJ_MMPFILES
+../group/phoneserver.mmp
+
+PRJ_TESTMMPFILES
+// specify the .mmp files required for building any test programs here
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/group/phoneserver.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,151 @@
+/*
+* 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:  Phone Server project specification file.
+*
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include <bldvariant.hrh>
+
+// Capability assignment.
+CAPABILITY CAP_SERVER NetworkControl
+// Assign Vendor ID.
+VENDORID VID_DEFAULT
+
+TARGET          phoneserver.exe
+EPOCSTACKSIZE   0x5000
+
+TARGETPATH      /system/programs
+TARGETTYPE      EXE
+
+UID             0x1000008d 0x10000850
+
+SOURCEPATH     .
+START RESOURCE ../src/resources/phoneserver.rss 
+HEADER
+TARGETPATH   RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END  // RESOURCE
+
+SOURCEPATH      ../src/standard 
+SOURCE          phsrvstartup.cpp 
+SOURCE          phsrvsubsessionfactory.cpp 
+SOURCE          phsrvutils.cpp 
+
+SOURCE          cphsrvscheduler.cpp 
+SOURCE          cphsrvserver.cpp 
+SOURCE          cphsrvsession.cpp 
+SOURCE          cphsrvresourcemanager.cpp 
+SOURCE          cphsrvphonecontroller.cpp 
+SOURCE          cphsrvemergencynumbermanager.cpp 
+
+SOURCE          cphsrvsubsessionbase.cpp 
+SOURCE          cphsrvsubsessionussd.cpp 
+
+SOURCE          phsrvdebuginfo.cpp 
+
+SOURCEPATH  ../src/standard/standard_aiw 
+SOURCE          cphcltextphonedialdata.cpp 
+SOURCE          cphcltdialdata.cpp
+SOURCE          cphsrvemergencyrequestmanager.cpp 
+SOURCE          cphsrvcallrequest.cpp 
+SOURCE          cphsrvcallrequestmanager.cpp 
+SOURCE          cphsrvsubsessionnotifier.cpp 
+SOURCE          cphsrvsubsessionextcall.cpp 
+SOURCE          cphsrvsubsessionemergencynum.cpp 
+
+SOURCEPATH  ../src/imagehandler 
+SOURCE      cphsrvsubsessionimagehandler.cpp 
+SOURCE      cphsrvimagesaver.cpp
+
+SOURCEPATH      ../src/ussd 
+SOURCE          cphsrvussdreplytimer.cpp 
+SOURCE          cphsrvussdsendhandler.cpp 
+SOURCE          cphsrvussdreceivehandler.cpp 
+SOURCE          cphsrvussdmanager.cpp 
+SOURCE      cphsrvussdnotifynwrelease.cpp 
+
+SOURCEPATH      ../src/commandhandler 
+#if defined( __AT_HANDLER )
+SOURCE          cphsrvsubsessioncommandhandler.cpp 
+SOURCE          cphsrvcomhandrequest.cpp 
+#else  // No __AT_HANDLER defined, so stub version is used.
+SOURCE          cphsrvsubsessioncommandhandlerstub.cpp 
+SOURCE          cphsrvsubsessioncommandhandlernotifystub.cpp 
+#endif // __AT_HANDLER
+
+SOURCEPATH      ../src/commandhandler/commandhandler_aiw 
+
+#if defined( __AT_HANDLER )
+SOURCE          cphsrvcomhandrequestmanager.cpp 
+#else  // No __AT_HANDLER defined, so stub version is used.
+SOURCE          cphsrvcomhandrequestmanagerstub.cpp 
+#endif // __AT_HANDLER
+
+SOURCEPATH      ../src/messenger 
+#if defined( __CS_VIDEO_TELEPHONY )
+SOURCE          cphsrvmessengerobject.cpp 
+SOURCE          cphsrvmessengerrequestmanager.cpp 
+SOURCE          cphsrvsubsessionmessenger.cpp 
+#else  // No __CS_VIDEO_TELEPHONY defined, so stub version is used.
+SOURCE          cphsrvmessengerrequestmanagerstub.cpp 
+SOURCE          cphsrvsubsessionmessengerstub.cpp 
+#endif // __CS_VIDEO_TELEPHONY
+
+USERINCLUDE     ../inc/standard 
+USERINCLUDE     ../inc/standard/standard_aiw 
+USERINCLUDE     ../inc/ussd 
+USERINCLUDE     ../inc/commandhandler 
+USERINCLUDE     ../inc/messenger 
+USERINCLUDE     ../inc/imagehandler 
+
+USERINCLUDE     ../../phoneclient/inc/sharedclientserver 
+
+// <-- QT PHONE START-->
+MW_LAYER_SYSTEMINCLUDE
+// <-- QT PHONE END-->
+
+SYSTEMINCLUDE   ../../../inc
+SYSTEMINCLUDE    ../../inc // for RPhCltEmergencyCall.h, CPhCltExtPhoneDialData.h
+
+// TEMPORARY DEFINITION FOR TELEPHONY VARIATION HEADERS
+SYSTEMINCLUDE   ../../../../../app/phone/inc
+
+// TEMPORARY DEFINITION FOR Orbit Device Dialog
+SYSTEMINCLUDE /epoc32/include/mw/hb/hbwidgets
+SYSTEMINCLUDE /epoc32/include/mw/hb/hbcore
+
+LIBRARY        efsrv.lib
+LIBRARY        apgrfx.lib
+LIBRARY        charconv.lib
+LIBRARY        euser.lib
+LIBRARY        ws32.lib
+LIBRARY        etel.lib
+LIBRARY        bafl.lib
+LIBRARY        gsmu.lib
+LIBRARY        apparc.lib
+LIBRARY        customapi.lib
+LIBRARY        etelmm.lib 
+LIBRARY        commonengine.lib
+LIBRARY        featmgr.lib
+LIBRARY        fbscli.lib 
+LIBRARY        estor.lib    
+LIBRARY        centralrepository.lib
+LIBRARY        imageconversion.lib  
+LIBRARY        bitmaptransforms.lib 
+LIBRARY        hbwidgets.lib
+LIBRARY        hbcore.lib
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/group/phoneserver_stub.pkg	Wed Jul 21 18:26:52 2010 +0300
@@ -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: For packing phoneserver stub.
+;
+; Languages
+&EN
+
+; Header
+#{"PhoneServer"}, (0x10000850), 1, 0, 0, TYPE=SA
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Files
+""-"z:\sys\bin\PhoneServer.exe"
+""-"z:\resource\PhoneServer.rsc"
Binary file phoneclientserver/phoneserver/group/phoneserver_stub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/commandhandler/cphsrvcomhandrequest.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,159 @@
+/*
+* Copyright (c) 2003-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:  Command Handler Request.
+*
+*/
+
+
+#ifndef CPHSRVCOMHANDREQUEST_H
+#define CPHSRVCOMHANDREQUEST_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include <phclttypes.h> 
+#include <cphcltcommandhandler.h> 
+
+// CONSTANTS
+
+
+// FORWARD DECLARATIONS
+class CPhSrvSubSessionBase;
+
+
+// CLASS DECLARATION
+
+/**
+*  Command handler request class.
+*
+*  @since 2.6
+*/
+class CPhSrvComHandRequest : public CBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Constructor. For normal requests, i.e. that are reserved when 
+        * they arrive.
+        *
+        * @param aMessage The outstanding client request which will be completed
+        *                 when the command handler initiation outcome is known.
+        * @param aParams  The command handler request arguments.
+        * @param aSubSessionHandle The subsession handle.
+        * @return Pointer to created CPhSrvComHandRequest instance.
+        */
+        static CPhSrvComHandRequest* NewLC(
+            const RMessage2& aMessage, 
+            const TPhCltComHandCommandParameters& aParams,
+            TInt aSubSessionHandle );
+
+        /**
+        * Constructor for Emergency request object only.
+        *
+        * @return Pointer to created CPhSrvComHandRequest instance.
+        */
+        static CPhSrvComHandRequest* NewL();
+
+
+    public: // New functions
+
+        /**
+        * Tell the external client (the requester) the result of their 
+        * actions. This information has come via the notifier
+        * (i.e. phone app engine).
+        *
+        * @param aResultOfAttemptingCall 
+        *        The result of initiating an earlier command handler request.
+        */
+        void InformOfComHandRequestAttemptResult( 
+            TPhCltPhoneResults aResultOfAttemptingRequest );
+
+        /**
+        * Cancel the asynchronous command handler process. 
+        * Completes client request with KErrCancel.
+        */
+        void Cancel();
+
+        /**
+        * The sub-session handle.
+        *
+        * @return The unique handle associated with the subsession which 
+        *         initiated a command handler request.
+        */
+        TInt SubSessionHandle() const;
+
+        /**
+        * The parameters for the command handler request.
+        *
+        * @return The command handler request parameters.
+        */
+        const TPhCltComHandCommandParameters& 
+            ComHandParameters() const;
+
+        /**
+        * Update Emergency request status.
+        * 
+        * @param aMessage The outstanding client request which will be completed
+        *                 when the command handler initiation outcome is known.
+        * @param aArguments The command handler request parameters.
+        * @param aSubSessionHandle Subsession handle to emergency request.
+        */
+        void UpdateEmergencyRequest( 
+            const RMessage2& aMessage, 
+            const TPhCltComHandCommandParameters& aParams,
+            TInt aSubSessionHandle );
+
+        /**
+        * Clear the Emergency request object data.
+        */
+        void ClearEmergencyRequest();
+
+
+    private:
+
+        /**
+        * C++ constructor
+        */
+        CPhSrvComHandRequest( 
+            const RMessage2& aMessage, 
+            const TPhCltComHandCommandParameters& aParams,
+            TInt aSubSessionHandle );
+
+        /**
+        * C++ constructor
+        */
+        CPhSrvComHandRequest();
+
+
+    private:  // Data
+
+        // A request made by the external command handler interface that the
+        // phone app should handle. It completes them sequentially after its 
+        // finished the previous request.
+        RMessage2                       iPendingRequestPointer;
+
+        // The object responsible for processing external client command 
+        // handler requests. 
+        // This is essentially an interface to the phone app engine.
+        TPhCltComHandCommandParameters  iComHandParams;
+
+        // A handle to the subsession that initiated this request.
+        TInt                            iSubSessionHandle;
+    };
+
+
+#endif // CPHSRVCOMHANDREQUEST_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/commandhandler/cphsrvcomhandrequestmanager.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,142 @@
+/*
+* Copyright (c) 2003-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:  Command Handler Request Manager.
+*
+*/
+
+
+#ifndef CPHSRVCOMHANDREQUESTMANAGER_H
+#define CPHSRVCOMHANDREQUESTMANAGER_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include "mphsrvcomhandnegotiators.h" 
+#include "mphsrvcomhandinitiators.h" 
+
+
+
+
+// FORWARD DECLARATIONS
+class CPhSrvComHandRequest;
+class CPhSrvServer;
+
+// CLASS DECLARATION
+
+/**
+*  Command handler request manager.
+*
+*  @since 2.6
+*/
+class CPhSrvComHandRequestManager : 
+    public CBase, 
+    public MPhSrvComHandNegotiator
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Constructor.
+        * 
+        * @param aServer The server instance.
+        */
+        CPhSrvComHandRequestManager( CPhSrvServer& aServer );
+
+        /**
+        * Destructor.
+        */
+        ~CPhSrvComHandRequestManager();
+
+        /**
+        * Symbian 2nd phase constructor.
+        */
+        void ConstructL();
+
+
+    public: // Functions from base classes
+
+        /**
+        * @see MPhSrvComHandNegotiators
+        */
+        void NegotiatorRequestL( 
+            const RMessage2& aMessage, 
+            const TPhCltComHandCommandParameters& aParams,
+            CPhSrvSubSessionBase& aSubSession );
+
+        /**
+        * @see MPhSrvComHandNegotiators
+        */
+        void NegotiatorRequestCancel( 
+            CPhSrvSubSessionBase& aSubSession );
+
+        /**
+        * @see MPhSrvComHandNegotiators
+        */
+        void SetNegotiatorReadyRequestL( 
+            MPhSrvComHandInitiator& aInitiator );
+
+        /**
+        * @see MPhSrvComHandNegotiators
+        */
+        void SetNegotiatorReadyRequestCancel( 
+            MPhSrvComHandInitiator& aInitiator );
+
+        /**
+        * @see MPhSrvComHandNegotiators
+        */
+        virtual void SetNegotiatorAttemptedRequestResponseValue( 
+            TPhCltPhoneResults aResult );
+
+
+    private: 
+
+        /**
+        * Updates the request queue.
+        */
+        void UpdateQueue();
+
+        /**
+        * Checks whether there already is request from this client (subsession).
+        * 
+        * @param aSubSession The client who's requests are searched.
+        * @return ETrue if there already is request from this client, 
+        *         otherwise EFalse.
+        */
+        TBool RequestAlreadyExists( CPhSrvSubSessionBase& aSubSession );
+
+
+    private:    // Data
+
+        // A list of requests made by the external command handler interface 
+        // that the phone app should handle. It completes them sequentially 
+        // after its finished the previous request.
+        // Index 0 is reserved for the emergency request.
+        RPointerArray< CPhSrvComHandRequest >*  iOutstandingComHandRequests;
+
+        // The object responsible for processing external client command 
+        // handler requests. 
+        // This is essentially an interface to the phone app engine.
+        MPhSrvComHandInitiator*                 iComHandInitiator;
+
+        // The server instance.
+        CPhSrvServer&                           iServer;
+
+        // If NULL, then the active request was deleted during execution.
+        CPhSrvComHandRequest*                   iActiveRequest;
+    };
+
+
+#endif // CPHSRVCOMHANDREQUESTMANAGER_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/commandhandler/cphsrvsubsessioncommandhandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,107 @@
+/*
+* Copyright (c) 2003-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:  Subsession for Command Handler.
+*
+*/
+
+#ifndef CPHSRVSUBSESSIONCOMMANDHANDLER_H
+#define CPHSRVSUBSESSIONCOMMANDHANDLER_H
+
+
+// INCLUDES
+#include "cphsrvsubsessionbase.h" 
+
+
+// CLASS DECLARATION
+
+/**
+*  Command Handler Subsession.
+*
+*  @since 2.6
+*/
+class CPhSrvSubSessionCommandHandler 
+:   public CPhSrvSubSessionBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * 
+        * @return CPhSrvSubSessionCommandHandler subsession.
+        */
+        static CPhSrvSubSessionBase* NewL(
+            CPhSrvSession& aSession );
+
+
+    private: // Functions from base classes   
+
+        /**
+        * @see MPhSrvMessageDecoder
+        */
+        TBool PhSrvMessageDecoderCanProcessMessage( TInt aFunction );
+
+        /**
+        * @see MPhSrvMessageProcessor
+        */
+        void PhSrvMessageProcessorHandleMessageL( const RMessage2& aMessage );
+
+
+    private: // SubSession function handlers
+
+        void CmdSubSessionClose( const RMessage2& aMessage );
+
+        void CmdSubSessionComHandAtdL( 
+            const RMessage2& aMessage );
+
+        void CmdSubSessionComHandAtaL( 
+            const RMessage2& aMessage );
+
+        void CmdSubSessionComHandChldL( 
+            const RMessage2& aMessage );
+
+        void CmdSubSessionComHandChupL( 
+            const RMessage2& aMessage );
+
+        void CmdSubSessionComHandVtsL( 
+            const RMessage2& aMessage );
+
+        void CmdSubSessionComHandCancelL( 
+            const RMessage2& aMessage );
+
+        void CmdSubSessionComHandForwardRequestL(
+            const RMessage2& aMessage );
+        
+        void CmdSubSessionComHandMuteMicL( 
+            const RMessage2& aMessage );
+        
+        void CmdSubSessionComHandMuteRingingToneL( 
+            const RMessage2& aMessage );
+            
+        TBool IsCancelAllowed(
+            const RMessage2& aMessage );
+    private: 
+
+        /**
+        * Constructor.
+        *
+        * @param aSession The session where this subsession belongs.
+        */
+        CPhSrvSubSessionCommandHandler( CPhSrvSession& aSession );
+        
+    };
+
+#endif // CPHSRVSUBSESSIONCOMMANDHANDLER_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/commandhandler/cphsrvsubsessioncommandhandlernotify.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2003-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:  Subsession for Command Handler notify.
+*
+*/
+
+#ifndef CPHSRVSUBSESSIONCOMHANDNOTIFY_H
+#define CPHSRVSUBSESSIONCOMHANDNOTIFY_H
+
+
+// INCLUDES
+#include "cphsrvsubsessionbase.h" 
+#include "mphsrvcomhandinitiators.h" 
+
+// CLASS DECLARATION
+
+/**
+*  Command handler Subsession.
+*
+*  @since 2.6
+*/
+class CPhSrvSubSessionCommandHandlerNotify 
+:   public CPhSrvSubSessionBase,
+    public MPhSrvComHandInitiator
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * 
+        * @return CPhSrvSubSessionCommandHandlerNotify subsession.
+        */
+        static CPhSrvSubSessionBase* NewL(
+            CPhSrvSession& aSession );
+
+        /**
+        * Destructor.
+        *
+        */
+        ~CPhSrvSubSessionCommandHandlerNotify();
+
+
+    private: // Functions from base classes
+
+        /**
+        * @see MPhSrvMessageDecoder
+        */
+        TBool PhSrvMessageDecoderCanProcessMessage( TInt aFunction );
+
+        /**
+        * @see MPhSrvMessageProcessor
+        */
+        void PhSrvMessageProcessorHandleMessageL( const RMessage2& aMessage );
+
+        /**
+        * @see MPhSrvComHandInitiator
+        */
+        void InitiatorMakeAsynchronousComHandRequest( 
+            const TPhCltComHandCommandParameters& 
+                aParams );
+
+        /**
+        * @see MPhSrvComHandInitiator
+        */
+        TBool InitiatorIsReadyToPerformRequest() const;
+
+
+    private: // SubSession function handlers
+
+        void CmdSubSessionClose( const RMessage2& aMessage );
+
+        void CmdSubSessionComHandNotifyRequestL( 
+            const RMessage2& aMessage );
+
+        void CmdSubSessionComHandNotifyRequestCancelL( 
+            const RMessage2& aMessage );
+
+        void CmdSubSessionComHandNotifyReportL( 
+            const RMessage2& aMessage );
+
+
+    private: 
+
+        /**
+        * Constructor.
+        *
+        * @param aSession The session where this subsession belongs.
+        */
+        CPhSrvSubSessionCommandHandlerNotify( CPhSrvSession& aSession );
+        
+
+        
+    private:     // Data
+
+        // Indicates whether we have an pending request
+        TBool                       iHavePendingComHandRequestPointer;
+    
+        // Initialized when the phone app engine is 
+        // ready to handle command handler requests.
+        RMessage2                   iPendingComHandRequestPointer;
+
+    };
+
+
+#endif // CPHSRVSUBSESSIONCOMHANDNOTIFY_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/commandhandler/mphsrvcomhandinitiators.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2003-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:  Command Handler Object Initiators.
+*
+*/
+
+
+#ifndef MPHSRVCOMHANDINITIATORS_H
+#define MPHSRVCOMHANDINITIATORS_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include "phcltclientserver.h" 
+#include <cphcltcommandhandler.h> 
+// FORWARD DECLARATIONS
+
+
+
+// CLASS DECLARATION
+
+/**
+*  Initiator functions class.
+*
+*  @since 2.6
+*/
+class MPhSrvComHandInitiator
+    {
+    public: // New functions
+
+        /**
+        * Called by the command handler manager when it wants to make a request,
+        * in response to a request from the external command handler interface.
+        *
+        * @param aParams The command handler parameters.
+        */
+        virtual void InitiatorMakeAsynchronousComHandRequest( 
+            const TPhCltComHandCommandParameters& aParams ) = 0;
+
+        /**
+        * Called by the command handler manager to find out if there is a 
+        * registered notification handler.
+        *
+        * @return ETrue if there is pending notification request.
+        */
+        virtual TBool InitiatorIsReadyToPerformRequest() const = 0;
+    };
+
+#endif // MPHSRVCOMHANDINITIATORS_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/commandhandler/mphsrvcomhandnegotiators.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,99 @@
+/*
+* Copyright (c) 2003-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:  Command Handler Negotiators.
+*
+*/
+
+
+#ifndef MPHSRVCOMHANDNEGOTIATORS_H
+#define MPHSRVCOMHANDNEGOTIATORS_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include <cphcltcommandhandler.h> 
+
+// FORWARD DECLARATIONS
+class MPhSrvComHandInitiator;
+class MPhSrvComHandInitiatorStatus;
+class CPhSrvSubSessionBase;
+
+
+// CLASS DECLARATION
+
+
+/**
+*  Abstract command handler negotiators class.
+*
+*  @since 2.6
+*/
+class MPhSrvComHandNegotiator
+    {
+    public: // New functions
+
+        /**
+        * Make a command handler request.
+        *
+        * @param aMessage Message to be negotiated.
+        * @param aParams Request parameters.
+        * @param aSubSession Subsession for command handler.
+        */
+        virtual void NegotiatorRequestL( 
+            const RMessage2& aMessage, 
+            const TPhCltComHandCommandParameters& aParams,
+            CPhSrvSubSessionBase& aSubSession ) = 0;
+
+        /**
+        * Cancel's an oustanding command handler request. 
+        * If the specified subsession doesn't have an oustanding request, 
+        * then the subsession is panicked.
+        *
+        * @param aSubSession Subsession that has the command handler request.
+        */
+        virtual void NegotiatorRequestCancel( 
+            CPhSrvSubSessionBase& aSubSession ) = 0;
+
+        /**
+        * Called by the command handler notifier subsession when it's ready 
+        * to negotiate (perform another request) with the external interface.
+        *
+        * @param aInitiator Command handler initiator instance.
+        */
+        virtual void SetNegotiatorReadyRequestL( 
+            MPhSrvComHandInitiator& aInitiator ) = 0;
+
+        /**
+        * Called by the command handler notifier subsession when it isn't going
+        * to be available to make further requests (session has closed)
+        *
+        * @param aInitiator Command handler initiator instance.
+        */
+        virtual void SetNegotiatorReadyRequestCancel( 
+            MPhSrvComHandInitiator& aInitiator ) = 0;
+
+        /**
+        * Called by the command handler notifier subsession when it's attempted
+        * to perform a request - the command handler negotiator can then inform
+        * the external command handler interface of the result.
+        *
+        * @param aResult Result of the request perfom.
+        */
+        virtual void SetNegotiatorAttemptedRequestResponseValue( 
+            TPhCltPhoneResults aResult ) = 0;
+    };
+
+#endif // MPHSRVCOMHANDNEGOTIATORS_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/imagehandler/cphsrvimagesaver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image saver header
+*
+*/
+
+
+#ifndef C_CPHSRVIMAGESAVER_H
+#define C_CPHSRVIMAGESAVER_H
+
+#include <e32base.h>
+
+class RFs;
+class MPhSrvImageSaverObserver;
+class CFileMan;
+class CImageDecoder;
+class CBitmapScaler;
+
+/**
+*  Image saver.
+*
+*  @since S60 v5.0
+*/
+NONSHARABLE_CLASS( CPhSrvImageSaver )
+:   public CActive
+    {
+public: // constructor
+    
+    static CPhSrvImageSaver* NewL( 
+        RFs& aFs,
+        const TFileName& aPrivatePath,
+        MPhSrvImageSaverObserver& aObserver );
+    
+    ~CPhSrvImageSaver();
+
+public: // new methods
+
+    void SaveImageL( const TDesC& aFileName );
+
+    void CopyImageL( const TDesC& aFileName );
+    
+    void ScaleImageL();
+    
+    TInt IsPrimaryFileInUse( TBool& aIsInUse );
+    
+    TInt ConstructVtFileSaveName( 
+        const TDesC& aSourceFileName, 
+        TName& aTargetFileName );
+
+private: // from CActive
+
+    void RunL();
+    
+    void DoCancel();    
+    
+private:
+
+    void ConstructL();
+        
+    CPhSrvImageSaver( RFs& aFs, 
+        const TFileName& aPrivatePath,
+        MPhSrvImageSaverObserver& aObserver);
+        
+private:
+
+    // file server session
+    RFs& iFs;
+
+    // path to private directory
+    const TFileName& iPath;
+    
+    // for checking image files
+    CFileMan* iFileManager;
+    
+    // for decoding image file
+    CImageDecoder* iImageDecoder;
+    
+    // for scaling single frame image
+    CBitmapScaler* iScaler;
+    
+    // for notifying save completion
+    MPhSrvImageSaverObserver& iObserver;
+    
+    
+
+    };
+
+#endif // C_CPHSRVIMAGESAVER_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/imagehandler/cphsrvsubsessionimagehandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,325 @@
+/*
+* 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:  Subsession for image handler.
+*
+*/
+
+#ifndef CPHSRVSUBSESSIONIMAGEHANDLER_H
+#define CPHSRVSUBSESSIONIMAGEHANDLER_H
+
+// INCLUDES
+#include    "cphsrvsubsessionbase.h" 
+#include    "cphsrvimagesaver.h"
+#include    "mphsrvimagesaverobserver.h"
+#include   <cphcltbaseimageparams.h> 
+#include    <bautils.h>
+#include    <fbs.h>
+#include    <phoneclientserverdomainpstypes.h> 
+#include    <phoneclientserverdomainpskeys.h> 
+
+// CLASS DECLARATION
+
+/**
+*  Image handler Subsession.
+*
+*  @since Series60 3.0
+*/
+class CPhSrvSubSessionImageHandler
+:   public CPhSrvSubSessionBase, public MPhSrvImageSaverObserver
+    {
+    NONSHARABLE_CLASS( CPhSrvOperatorLogoContainer ) : public CBase
+        {
+        public:  // Constructors and destructor
+        
+            /**
+            * Destructor.
+            */
+            ~CPhSrvOperatorLogoContainer();
+            
+            /**
+            * Constructor.
+            * @param aCountryCode country code for operator logo
+            * @param aNetworkCode network code for operator logo
+            * @param aBitmap bitmap to store.
+            */
+            CPhSrvOperatorLogoContainer( 
+                const TPhCltCountryCode aCountryCode,
+                const TPhCltNetworkCode aNetworkCode,
+                const TPhCltExtOperatorLogoType aLogoType, 
+                CFbsBitmap* aBitmap );
+                
+            // Stored image.
+            CFbsBitmap* iBitmap;
+            
+            // Operator logo country code.
+            TPhCltCountryCode iCountryCode;
+            
+            // Operator logo network code.
+            TPhCltNetworkCode iNetworkCode;
+            
+            // Operator logo type.
+            TPhCltExtOperatorLogoType iLogoType;                    
+        };    
+            
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * 
+        * @param aSession The pre-opened Phone Server session.
+        * @return CPhSrvSubSessionImageHandler subsession.
+        */
+        static CPhSrvSubSessionBase* NewL(CPhSrvSession& aSession );
+
+        /**
+        * Destructor.
+        *
+        */
+        ~CPhSrvSubSessionImageHandler();
+    
+    public: // from MPhSrvImageSaverObserver
+        /**
+         * @see MPhSrvImageSaverObserver::ImageSaved
+         */
+        virtual void ImageSaved( TInt aResult );
+                
+    private: // Functions from base classes.
+
+        /**
+        * @see MPhSrvMessageDecoder
+        */
+        TBool PhSrvMessageDecoderCanProcessMessage( TInt aFunction );
+
+        /**
+        * @see MPhSrvMessageProcessor
+        */
+        void PhSrvMessageProcessorHandleMessageL( const RMessage2& aMessage );
+
+    private: // SubSession function handlers.
+
+        /**
+        * Handle the close command.
+        * 
+        * @param aMessage The received message.
+        */
+        void CmdSubSessionClose( const RMessage2& aMessage );
+
+        /**
+        * Handle the save command.
+        * 
+        * @param aMessage The received message.
+        */
+        void CmdSubSessionSaveImagesL( const RMessage2& aMessage );
+
+        /**
+        * Handle the load command.
+        * 
+        * @param aMessage The received message.
+        */
+        void CmdSubSessionLoadImagesL( const RMessage2& aMessage );
+                                          
+        /**
+         * Open default VT image file and transfer handle to client.
+         */
+        void CmdSubSessionOpenDefaultVtImageL( const RMessage2& aMessage );
+        
+        /**
+         * Resolve default VT image file name.
+         */
+        TInt ResolveDefaultVtImageFileName( TDes& aFileName );
+                         
+        /**
+         * Saves user defined VT image
+         */
+        void CmdSubSessionSaveVtImageL( const RMessage2& aMessage );
+                         
+        /**
+        * Complete the load command.
+        * 
+        * @param aMessage The received message.
+        */
+        void CmdSubSessionCommitLoadL( const RMessage2& aMessage );
+
+    private: // New functions.
+    
+        /** 
+        * Updates Publish & Subscribe information with an event
+        * happened to a operator logo.
+        * @param aCountryCode country code for a logo
+        * @param aNetworkCode network code for a logo
+        * @param aEvent event that occurred
+        * @return Symbian error code.
+        */
+        TInt NotifyListeners( 
+            const TPhCltCountryCode aCountryCode, 
+            const TPhCltNetworkCode aNetworkCode,
+            const 
+                TTelephonyOTALogoUpdate::TPSOperatorLogoUpdateEvent aEvent );
+                
+        /** 
+        * Updates Publish & Subscribe information with an event
+        * happened to a operator logo.
+        * @param aCountryCode country code for a logo
+        * @param aNetworkCode network code for a logo
+        * @param aEvent event that occurred
+        * @return Symbian error code.
+        */
+        TInt NotifyListeners( 
+            const TPhCltCountryCode aCountryCode, 
+            const TPhCltNetworkCode aNetworkCode,
+            const 
+                TTelOTALogoUpdate::TPSOperatorLogoUpdateEvent aEvent );
+    
+        /**
+        * Parses operator logo file name and path.
+        * @param aCountryCode country code to use in deletion
+        * @param aNetworkCode network code to use in deletion
+        * @param aLogoType type of logo to delete
+        * @param aFileName file name in return
+        */        
+        void ConstructLogoFileNameL( 
+            const TPhCltCountryCode aCountryCode, 
+            const TPhCltNetworkCode aNetworkCode,
+            const TPhCltExtOperatorLogoType aLogoType,
+            TDes& aFileName );
+    
+        /**
+        * Converts given logo type to file name id.
+        * @param aLogoType logo type to convert'
+        * @param aType type in return
+        */
+        void AppendLogoTypeAsTextL( 
+            const TPhCltExtOperatorLogoType aLogoType, TDes& aType );
+    
+        /**
+        * Checks logo deletion and deletes if needed.
+        * @param aCountryCode country code to use in deletion
+        * @param aNetworkCode network code to use in deletion
+        * @param aLogoType type of logo to delete
+        * @param aFileHandle file handle to be checked
+        * @return ETrue if deleted
+        */
+        TBool DeleteLogoL( 
+            const TPhCltCountryCode aCountryCode, 
+            const TPhCltNetworkCode aNetworkCode, 
+            const TPhCltExtOperatorLogoType aLogoType,
+            const TInt aFileHandle );
+    
+
+        /**
+        * Does saving of video telephony images.
+        * 
+        * @param aImages Image handle array.
+        */
+        void DoSaveVTImageL( TPhCltImageArray& aImages );
+
+        /**
+        * Loads a video telephony image from file.
+        * @param aImages image handle array to return.
+        */
+        void DoLoadVTImagesL( TPhCltImageArray& aImages );
+
+        /**
+        * Reads video telephony images from private path.
+        * @param aDefaultImage ETrue reads default image
+        *                      EFalse reads user defined image
+        */
+        void DoReadVTImagesL( const TBool aDefaultImage );
+        
+        /**
+        * Constructs search path for VT still/default image.
+        * It contains image name with wild card.
+        * @param aDefaultImage ETrue path for default image
+        *                      EFalse path for still image
+        * @param aPath returns plain drive+path w/o wild cards
+        * @return search path
+        */
+        HBufC* ConstructVTImageSearchPathLC( 
+            const TBool aDefaultImage,
+            TPtrC& aPath ) const;
+
+        /**
+        * Does saving of operator logos.
+        * 
+        * @param aImages Image handle array.
+        */
+        void DoSaveOperatorLogoL( TPhCltImageArray& aImages );
+
+        /**
+        * Loads operator logo image from file.
+        * @param aImages image handle array to return.
+        */
+        void DoLoadOperatorLogoL( TPhCltImageArray& aImages );
+
+        /**
+        * Completes operator logo loading, and releases resources.
+        * @param aImages image handle array.        
+        */
+        void DoCommitLoadLogo( TPhCltImageArray& aImages );
+        
+        /**
+        * Completes vt image loading, and releases resources.    
+        */
+        void DoCommitLoadVTL();
+
+        /**        
+        * Creates image storage directory.
+        */
+        void MakeImageDirL();        
+        
+    private: 
+
+        /**
+        * Constructor.
+        *
+        * @param aSession The session where this subsession belongs.
+        */
+        CPhSrvSubSessionImageHandler( CPhSrvSession& aSession );
+
+        /**
+        * Symbian constructor that may leave.
+        */
+        void ConstructL();
+
+    private: // Data.
+
+        // Stored VT bitmaps
+        RPointerArray<CFbsBitmap> iVTBitMaps;
+        
+        // Stored operator logos.
+        RPointerArray<CPhSrvOperatorLogoContainer> iOperatorLogos;
+        
+        // File server handle.
+        RFs iFs;
+
+        // Path to privates.
+        TFileName iFilePath;
+        
+        // Used for defining pubsub key.
+        TBool  iPropertyDefined;
+
+        //System drive name 
+        TFileName iDriveName;
+                                      
+        // Pointer to object performing image saving. Not owned.
+        CPhSrvImageSaver* iImageSaver;          
+        
+        // message entry for VT image saving
+        RMessage2 iSaveVtImageMessage;
+    };
+
+#endif // CPHSRVSUBSESSIONIMAGEHANDLER_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/imagehandler/mphsrvimagesaverobserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 saver observer interface
+*
+*/
+
+
+#ifndef M_MPHSRVIMAGESAVEROBSERVER_H
+#define M_MPHSRVIMAGESAVEROBSERVER_H
+
+#include    <e32def.h>
+
+/**
+ *  Observer interface for .
+ *
+ *  @since S60 v5.0
+ */
+NONSHARABLE_CLASS( MPhSrvImageSaverObserver )
+    {
+public:
+    /**
+     * Callback that is called when image is saved.
+     */
+    virtual void ImageSaved( TInt aResult ) = 0;       
+    };
+
+#endif // M_MPHSRVIMAGESAVEROBSERVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/messenger/cphsrvmessengerobject.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,208 @@
+/*
+* 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:  Messenger object. Contains both send and receive request 
+*                storages.
+*
+*/
+
+
+#ifndef CPHSRVMESSENGEROBJECT_H
+#define CPHSRVMESSENGEROBJECT_H
+
+
+// INCLUDES
+#include <e32base.h>
+
+#include "phsrvmessengertypes.h" 
+#include <cphcltcommandhandler.h> 
+
+// FORWARD DECLARATIONS
+class CPhSrvSubSessionBase;
+
+
+// CLASS DECLARATION
+
+/**
+*  Messenger object, i.e. request storage class.
+*
+*  @since 2.6
+*/
+class CPhSrvMessengerObject : public CBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor. 
+        *
+        * @param aSubSession The subsession that owns this object.
+        * @param aParameters The Construct parameters.
+        * @return Pointer to created CPhSrvMessengerObject instance.
+        */
+        static CPhSrvMessengerObject* NewLC(
+            CPhSrvSubSessionBase& aSubSession,
+            const TPhCltMessengerParameters& aParameters );
+
+
+        /**
+        * Destructor
+        */
+        ~CPhSrvMessengerObject();
+
+
+    public: // New functions
+
+        /**
+        * Tell the external client (the requester) the result of their 
+        * actions. 
+        *
+        * @param aResultOfAttemptingCall 
+        *        The result of executing the Messenger request.
+        * @param aRequest The request which result this is.
+        */
+        void InformOfMessengerRequest( 
+            const TPhCltPhoneResults aResultOfAttemptingRequest,
+            const TPhCltMessengerCommand aRequest );
+
+
+        /**
+        * The sub-session handle.
+        *
+        * @return The unique handle associated with the subsession which 
+        *         initiated a command handler request.
+        */
+        TInt SubSessionHandle() const;
+
+
+        /**
+        * Sets the given request active. Use IsRequestActive() to check
+        * whether request can be set active or not.
+        *
+        * @param aParameters The request and it's data that is set active.
+        * @param aMessage The request status container.
+        * @param aSentDataId The Id associated for sent message. Valid only
+        *                    if the request is Send.
+        */
+        void SetActive( 
+            const TPhCltMessengerParameters& aParameters,
+            const RMessage2& aMessage,
+            const TUint aSentDataId );
+
+
+        /**
+        * Checks if the given request is already active.
+        *
+        * @param aRequest The request which is checked.
+        * @return ETrue if aRequest is active, EFalse otherwise.
+        */
+        TBool IsRequestActive( const TPhCltMessengerCommand aRequest ) const;
+
+
+        /**
+        * Check whether this object is ready to receive the message or not.
+        * 
+        * @param aSentMessage The message that should be received.
+        * @param aSentDataId The Id of the sent message to be received.
+        * @return ETrue if object is ready to receive, EFalse otherwise.
+        */
+        TBool IsReadyToReceive( 
+            const TDesC8& aSentMessage,
+            const TUint aSentDataId );
+
+
+        /**
+        * Complete the active receive request. Use IsRequestActive() to find
+        * out whether this method can be called.
+        * 
+        * @param aSentMessage The sent message that is given to receiver.
+        * @param aSentDataId The Id of the sent message.
+        * @return KErrNone if the completion was successful, 
+        *         Symbian error code otherwise.
+        */
+        TInt CompleteReceive(
+            const TDesC8& aSentMessage,
+            const TUint aSentDataId );
+
+
+        /**
+        * Return objects Send data length.
+        * 
+        * @return The object's Send data length.
+        */
+        TInt GetSendDataLength();
+
+
+        /**
+        * Return objects Send data.
+        * 
+        * @param aDes The descriptor that will contain the sent data after 
+        *             return. Use GetSendDataLength() to see how big buffer is
+        *             needed to return whole sent message.
+        */
+        void GetSendData( TDes8& sDes ) const;
+
+
+        /**
+        * Return objects interested Uid.
+        * 
+        * @return The Uid of the messages this object is interested.
+        */
+        const TUid& GetUid() const;
+
+
+        /**
+        * Return the ID of the sent message.
+        * 
+        * @return The Id of the sent message.
+        */
+        TUint SentDataId();
+
+
+        /**
+        * Check if the received message is skipped or not.
+        * 
+        * @return ETrue if the given message is skipped, otherwise EFalse.
+        */
+        TBool IsMessageSkipped(
+            const TUint aSentDataId );
+
+
+    private:
+
+        /**
+        * C++ constructor
+        */
+        CPhSrvMessengerObject(
+            CPhSrvSubSessionBase& aSubSession );
+
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL( const TPhCltMessengerParameters& aParameters );
+
+
+    private:  // Data
+
+        // The Messenger object parameters.
+        TPhSrvMessengerParameters      iParameters;
+
+        // A handle to the subsession that initiated this request.
+        CPhSrvSubSessionBase&          iSubSession;
+    };
+
+
+#endif // CPHSRVMESSENGEROBJECT_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/messenger/cphsrvmessengerrequestmanager.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,207 @@
+/*
+* 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:  Messenger Request Manager.
+*
+*/
+
+
+#ifndef CPHSRVMESSENGERREQUESTMANAGER_H
+#define CPHSRVMESSENGERREQUESTMANAGER_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include "mphsrvmessengernegotiators.h" 
+#include <cphcltcommandhandler.h> 
+
+// FORWARD DECLARATIONS
+class CPhSrvMessengerObject;
+class CPhSrvServer;
+
+
+// CONSTANTS
+
+// Type for array used in this class.
+typedef RPointerArray< CPhSrvMessengerObject > RMessengerArray;
+
+
+// CLASS DECLARATION
+
+/**
+*  Messenger request manager.
+*
+*  @since 2.6
+*/
+class CPhSrvMessengerRequestManager
+:   public CBase, 
+    public MPhSrvMessengerNegotiator
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Constructor.
+        * 
+        * @param aServer The server instance.
+        */
+        CPhSrvMessengerRequestManager( CPhSrvServer& aServer );
+
+        /**
+        * Destructor.
+        */
+        ~CPhSrvMessengerRequestManager();
+
+        /**
+        * Symbian 2nd phase constructor.
+        */
+        void ConstructL();
+
+
+    public: // Functions from base classes
+
+        /**
+        * @see MPhSrvMessengerNegotiators
+        */
+        void NegotiatorRequest( 
+            CPhSrvSubSessionBase& aSubSession,
+            const TPhCltMessengerParameters& aParameters,
+            const RMessage2& aMessage );
+
+        /**
+        * @see MPhSrvMessengerNegotiators
+        */
+        void NegotiatorRequestCancel( 
+            CPhSrvSubSessionBase& aSubSession,
+            const TPhCltMessengerCommand aRequestType );
+
+        /**
+        * @see MPhSrvMessengerNegotiators
+        */
+        void NegotiatorRequestConstructL( 
+            CPhSrvSubSessionBase& aSubSession,
+            const TPhCltMessengerParameters& aParameters,
+            const RMessage2& aMessage );
+
+        /**
+        * @see MPhSrvMessengerNegotiators
+        */
+        void NegotiatorRequestDelete( 
+            CPhSrvSubSessionBase& aSubSession );
+
+
+    private: 
+
+        /**
+        * Updates the request objects.
+        * 
+        * @param aEntry The entry whose information is updated.
+        * @param aCommand The command that was performed for aEntry.
+        */
+        void UpdateMessengerChain(
+            CPhSrvMessengerObject* aEntry,
+            TPhCltMessengerCommand aCommand );
+
+        /**
+        * Handle all Send requests at one time.
+        * 
+        * @param aEntry The object whose information is updated.
+        * @param aSendArray The send array that is handled.
+        */
+        void HandleAllSendRequests(
+            CPhSrvMessengerObject* aEntry,
+            RMessengerArray* aSendArray );
+
+        /**
+        * Handles the Send Requests.
+        * 
+        * @param aEntry The entry whose information is updated.
+        * @param aSendArray The send array that is handled.
+        * @return ETrue if Send was fully handled, EFalse otherwise.
+        */
+        TBool HandleSendRequest( 
+            CPhSrvMessengerObject* aEntry,
+            RMessengerArray* aSendArray );
+
+        /**
+        * Checks whether there already is active request from this client 
+        * (subsession). Checks Send,Receive and Skip requests.
+        * If request is not active, then sets it active.
+        * 
+        * @param aSubSession The client who's requests are searched.
+        * @param aParameters Contains the request type that is checked.
+        *                    If not active, sets the given request to be active.
+        * @param aMessage    The received message.
+
+        * @return ETrue if there already was request from this client, 
+        *         otherwise EFalse.
+        */
+        TBool RequestAlreadyExists( 
+            const CPhSrvSubSessionBase& aSubSession,
+            const TPhCltMessengerParameters& aParameters,
+            const RMessage2& aMessage );
+
+
+        /**
+        * Returns the correct array which contains messenger objects.
+        * 
+        * @return The array containing the messenger objects.
+        */
+        RMessengerArray* MessengerArray();
+
+
+        /**
+        * Returns the correct array which contains send chain.
+        * 
+        * @return The array containing the send chain.
+        */
+        RMessengerArray* SendChain();
+
+
+    private:    // Data
+
+        // A list of request objects received from external Messenger interface.
+        // Messenger request manager completes them sequentially 
+        // after its finished the previous request.
+        RMessengerArray*                        iMessengerObjects;
+
+        // The server instance.
+        CPhSrvServer&                           iServer;
+
+        // A FIFO chain of Send requests made by the external Messenger 
+        // interface clients. They are completed sequentially.
+        RMessengerArray*                        iSendChain;
+
+        // The object whose Receive / Skip is waited.
+        CPhSrvMessengerObject*                  iRequestObject;
+
+        // The variable for Ids for sent messages.
+        TUint                                   iSentDataIdGenerator;
+
+        // The pointer to hold the default size (KPhCltDefMesSize)
+        // buffer at startup, exist always if construction valid.
+        // This buffer can be changed to bigger one during execution
+        // if memory allocation is successful.
+        HBufC8*                                 iDefaultSizeBuffer;
+
+        // Tells whether there is Send operation ongoing or not.
+        // ETrue if Send request have been processed at least once but not
+        // completed yet.
+        TBool                                   iSendProcessOngoing;
+
+    };
+
+
+#endif // CPHSRVMESSENGERREQUESTMANAGER_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/messenger/cphsrvsubsessionmessenger.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,155 @@
+/*
+* 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:  Subsession for Messenger.
+*
+*/
+
+#ifndef CPHSRVSUBSESSIONMESSENGER_H
+#define CPHSRVSUBSESSIONMESSENGER_H
+
+
+// INCLUDES
+#include "cphsrvsubsessionbase.h" 
+#include <cphcltmessenger.h> 
+
+// FORWARD DECLARATIONS
+class MPhSrvMessengerNegotiator;
+
+
+
+// CLASS DECLARATION
+
+/**
+*  Messenger Subsession.
+*
+*  @since 2.6
+*/
+class CPhSrvSubSessionMessenger
+:   public CPhSrvSubSessionBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * 
+        * @param aSession The pre-opened Phone Server session.
+        * @return CPhSrvSubSessionMessenger subsession.
+        */
+        static CPhSrvSubSessionBase* NewL(
+            CPhSrvSession& aSession );
+
+        /**
+        * Destructor.
+        *
+        */
+        ~CPhSrvSubSessionMessenger();
+
+
+    private: // Functions from base classes   
+
+        /**
+        * @see MPhSrvMessageDecoder
+        */
+        TBool PhSrvMessageDecoderCanProcessMessage( TInt aFunction );
+
+        /**
+        * @see MPhSrvMessageProcessor
+        */
+        void PhSrvMessageProcessorHandleMessageL( const RMessage2& aMessage );
+
+
+    private: // SubSession function handlers
+
+        /**
+        * Handle the close command.
+        * 
+        * @param aMessage The received message.
+        */
+        void CmdSubSessionClose( const RMessage2& aMessage );
+
+        /**
+        * Handle the construct command.
+
+        */
+        void CmdSubSessionMessengerConstructL( const RMessage2& aMessage );
+
+        /**
+        * Handle the receive command.
+        */
+        void CmdSubSessionMessengerReceive( const RMessage2& aMessage );
+
+        /**
+        * Handle the send command.
+        * 
+        * @param aMessage The received message.
+        */
+        void CmdSubSessionMessengerSend( const RMessage2& aMessage );
+
+        /**
+        * Handle the skip command.
+        * 
+        * @param aMessage The received message.
+        */
+        void CmdSubSessionMessengerSkip( const RMessage2& aMessage );
+
+        /**
+        * Handle the cancel command.
+        * 
+        * @param aMessage The received message.
+        */
+        void CmdSubSessionMessengerCancel( const RMessage2& aMessage );
+
+
+    private: // Helper functions.
+
+        /**
+        * Returns the Messenger negotiator.
+        * 
+        * @return Messenger negotiator.
+        */
+        MPhSrvMessengerNegotiator& GetMessengerNegotiator();
+
+        /**
+        * Forwards the request to messenger negotiator.
+        * 
+        * @param aSubSession Subsession for messenger.
+        * @param aParameters The request parameters.
+        * @param aMessage The received message.
+        */
+        void ForwardRequest(
+            CPhSrvSubSessionBase& aSubSession,
+            const TPhCltMessengerParameters& aParameters,
+            const RMessage2& aMessage );
+
+        /**
+        * Cleans the negotiator side.
+        */
+        void Clean();
+
+
+    private: 
+
+        /**
+        * Constructor.
+        *
+        * @param aSession The session where this subsession belongs.
+        */
+        CPhSrvSubSessionMessenger( CPhSrvSession& aSession );
+
+    };
+
+#endif // CPHSRVSUBSESSIONMESSENGER_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/messenger/mphsrvmessengernegotiators.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,94 @@
+/*
+* 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:  Messenger Negotiators.
+*
+*/
+
+
+#ifndef MPHSRVMESSENGERNEGOTIATORS_H
+#define MPHSRVMESSENGERNEGOTIATORS_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include "phsrvmessengertypes.h" 
+#include <cphcltmessenger.h> 
+
+// FORWARD DECLARATIONS
+class CPhSrvSubSessionBase;
+
+
+// CLASS DECLARATION
+
+
+/**
+*  Abstract messenger negotiators class.
+*
+*  @since 2.6
+*/
+class MPhSrvMessengerNegotiator
+    {
+    public: // New functions
+
+        /**
+        * Make a messenger request.
+        *
+        * @param aSubSession Subsession for messenger.
+        * @param aParameters The request parameters.
+        * @param aMessage The received message. Used also in panic situations.
+        */
+        virtual void NegotiatorRequest( 
+            CPhSrvSubSessionBase& aSubSession,
+            const TPhCltMessengerParameters& aParameters,
+            const RMessage2& aMessage ) = 0;
+
+        /**
+        * Cancel an oustanding messenger request. 
+        * If the specified subsession doesn't have an oustanding request, 
+        * then the subsession is paniced.
+        *
+        * @param aSubSession Subsession that has the messenger request.
+        * @param aRequestType The type of the request to be canceled.
+        */
+        virtual void NegotiatorRequestCancel( 
+            CPhSrvSubSessionBase& aSubSession,
+            const TPhCltMessengerCommand aRequestType ) = 0;
+
+        /**
+        * Construct, i.e. reserve space for the subsession given 
+        * as parameter.
+        *
+        * @param aSubSession Subsession that is constructed.
+        * @param aParameters The needed construct parameters.
+        * @param aMessage The message that is completed when request is ready.
+        */
+        virtual void NegotiatorRequestConstructL( 
+            CPhSrvSubSessionBase& aSubSession,
+            const TPhCltMessengerParameters& aParameters,
+            const RMessage2& aMessage ) = 0;
+
+        /**
+        * Delete, i.e. free all the space reserved for the subsession given 
+        * as parameter.
+        *
+        * @param aSubSession Subsession whose memory is freed.
+        */
+        virtual void NegotiatorRequestDelete( 
+            CPhSrvSubSessionBase& aSubSession ) = 0;
+    };
+
+#endif // MPHSRVMESSENGERNEGOTIATORS_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/messenger/phsrvmessengertypes.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,110 @@
+/*
+* 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:  Types used in PhoneServer Messenger related functionality.
+*
+*/
+
+
+#ifndef PHSRVMESSENGERTYPES_H
+#define PHSRVMESSENGERTYPES_H
+
+
+// INCLUDES
+#include <cphcltmessenger.h> 
+
+// DATA TYPES
+
+
+/**
+* The Messenger parameters defined as in one class.
+* The handler of received messenger request must first check the
+* performed request, and then read the appropriate parameters.
+* 
+* @since 2.6
+*/
+class TPhSrvMessengerParameters
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * C++ constructor.
+        * Set the default parameter values. 
+        */
+        inline TPhSrvMessengerParameters() :
+            iMessengerCommand( EPhCltMesCommandUnknown ), 
+            iDefaultMessageSize( 0 ),
+            iSendMessagePtr( NULL ),
+            iSendPayloadLength( 0 ),
+            iSendDataValid( EFalse ),
+            iSentDataId( 0 ),
+            iReceiveBufferMaxSize( 0 ),
+            iReceiveDataValid( EFalse ),
+            iSkipNextMessage( EFalse ),
+            iSkippedSentDataId( 0 )
+            {
+            iCategoryUid = TUid::Uid( 0 );
+            }
+
+
+    public:    // Data  
+
+        // The Messenger Negotiator command.
+        TPhCltMessengerCommand  iMessengerCommand;
+
+        // The message types that are listened.
+        TUid                    iCategoryUid;
+
+        // The default message size.
+        TInt                    iDefaultMessageSize;
+
+
+        // The Send message payload.
+        const TDesC8*           iSendMessagePtr;
+
+        // The length of the sent message.
+        TInt                    iSendPayloadLength;
+
+        // Tells whether send data is valid or not.
+        TBool                   iSendDataValid;
+
+        // The Send message status to be completed when ready.
+        RMessage2               iSendStatus;
+
+        // The ID of the sent message.
+        TUint                   iSentDataId;
+
+        // The maximum size of the receive buffer.
+        TInt                    iReceiveBufferMaxSize;
+        // The Receive message parameters.
+        //TPhCltMessengerParameters iReceiveParameters;
+
+        // Tells whether receive data is valid or not.
+        TBool                   iReceiveDataValid;
+
+        // The Receive message status, size and payload 
+        // to be completed when ready.
+        RMessage2               iReceiveMessage;
+
+
+        // Is the next Sent message Skipped?
+        TBool                   iSkipNextMessage;
+
+        // The ID of the Skipped message.
+        TUint                   iSkippedSentDataId;
+
+    };
+
+#endif // PHSRVMESSENGERTYPES_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/standard/cphsrvemergencynumbermanager.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,86 @@
+/*
+* 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:  Retrieves and manages the emergency numbers from EnPolicy.
+*
+*/
+
+
+
+#ifndef CPHSRVEMERGENCYNUMBERMANAGER_H
+#define CPHSRVEMERGENCYNUMBERMANAGER_H
+
+// INCLUDES
+#include <e32base.h>                        // cbase
+#include "mphsrvemergencynumbermanager.h" // interface 
+
+// FORWARD DECLARATIONS
+class MPhSrvPhoneInterface;
+class CEmergencyNumberPolicy;
+
+// CLASS DECLARATION
+
+/**
+*  Retrieves and manages the emergency numbers from EnPolicy.
+*
+*  @since 1.0
+*/
+class CPhSrvEmergencyNumberManager :
+    public CBase,
+    public MPhSrvEmergencyNumberManager
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Constructor.
+        * @param aPhone a reference of phone interface.
+        */
+        CPhSrvEmergencyNumberManager( MPhSrvPhoneInterface& aPhone );
+
+        /**
+        * Destructor.
+        */
+        ~CPhSrvEmergencyNumberManager();
+
+        /**
+        * Symbian 2nd phase constructor.
+        * @param aIsDosEnPolicy ETrue if Dos emergency policy is enabled.
+        */
+        void ConstructL( TBool aIsDosEnPolicy );
+
+
+    public: // Functions from base classes
+
+        /**
+        * @see MPhSrvEmergencyNumberManager
+        */
+        TBool EmergencyNumberManagerIsEmergencyNumberL( 
+            TDes& aNumber, 
+            TPhCltEmergencyNumberQueryMode aMode );
+
+    private:     // Data
+
+        // Contains Phoneserver phone interfaces.
+        MPhSrvPhoneInterface&          iPhone;
+      
+        // Contains Emergency policy DLL interface.
+        RLibrary                       iEnPolicyLib;    
+
+        // Pointer to Emergency policy interface.
+        CEmergencyNumberPolicy*        iEmergencyNumberPolicy;
+
+    };
+
+#endif // CPHSRVEMERGENCYNUMBERMANAGER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/standard/cphsrvphonecontroller.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Phone Controller.
+*
+*/
+
+
+#ifndef CPHSRVPHONECONTROLLER_H
+#define CPHSRVPHONECONTROLLER_H
+
+
+// INCLUDES
+#include    <etelmm.h>            // ETel
+#include <rmmcustomapi.h>         // CustomAPI
+#include "mphsrvphoneinterface.h" // The interface class 
+
+
+// CLASS DECLARATION
+
+/**
+*  Interface to the server-wide phone.
+*
+*  @since 1.0
+*/
+class CPhSrvPhoneController : 
+    public CBase, 
+    public MPhSrvPhoneInterface
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Destructor.
+        */
+        ~CPhSrvPhoneController();
+
+        /**
+        * Symbian OS second phase constructor
+        */
+        void ConstructL();
+
+
+    public: // Functions from base classes
+
+        /**
+        * @see MPhSrvPhoneInterface
+        */
+        RTelServer& PhSrvETelServer();
+
+        /**
+        * @see MPhSrvPhoneInterface
+        */
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        RMobilePhone& PhSrvMobilePhone();
+
+        /**
+        * @see MPhSrvPhoneInterface
+        */
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        RMmCustomAPI& PhSrvCustomPhone();
+
+
+    private:     // Data
+
+        // The RTelServer instance.
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        RTelServer iETelServer;
+
+        // The CustomAPI instance.
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        RMmCustomAPI iCustomPhone;
+
+        // The RMobilePhone instance.
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        RMobilePhone iMobilePhone;
+    };
+
+#endif // CPHSRVPHONECONTROLLER_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/standard/cphsrvresourcemanager.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 Manager.
+*
+*/
+
+#ifndef CPHSRVRESOURCEMANAGER_H
+#define CPHSRVRESOURCEMANAGER_H
+
+
+// INCLUDES
+#include <barsc.h>
+#include <f32file.h>
+
+
+// CLASS DECLARATION
+
+/**
+*  The resource manager.
+*
+*  @since 1.0
+*/
+class CPhSrvResourceManager : 
+    public CBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * C++ constructor.
+        *
+        * @param aFsSession The file session.
+        */
+        CPhSrvResourceManager( RFs& aFsSession );
+
+        /**
+        * C++ destructor.
+        */
+        ~CPhSrvResourceManager();
+
+        /**
+        * Symbian OS second phase constructor
+        */
+        void ConstructL();
+
+
+    public: // New functions
+
+        /**
+        * Read some text from the resource file.
+        *
+        * @param aResourceId The resource identifier to read
+        * @return The resource text on the cleanup stack
+        */
+        HBufC* ReadResourceLC( TUint aResourceId );
+
+
+    private:  // Data
+
+        // The file session.
+        RFs&            iFsSession;
+
+        // The resource file.
+        RResourceFile   iResourceFile;
+    };
+
+#endif // CPHSRVRESOURCEMANAGER_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/standard/cphsrvscheduler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Phone Server scheduler.
+*
+*/
+
+
+#ifndef CPHSRVSCHEDULER_H
+#define CPHSRVSCHEDULER_H
+
+// INCLUDES
+#include <e32base.h>
+
+
+// CLASS DECLARATION
+
+/**
+*  It is the scheduler for active objects.
+*  
+*  @since 1.0
+*/
+class CPhSrvScheduler : 
+    public CActiveScheduler
+    {
+    public: // Constructors and destructors
+
+        /**
+        * C++ default constructor.
+        */
+        CPhSrvScheduler();
+
+
+    public: // Functions from base classes
+
+        /**
+        * From CActiveScheduler, it is called in case of unhandled error.
+        *
+        * @param aError It is the error code.
+        */
+        void Error( TInt anError ) const;
+
+    };
+
+#endif      // CPHSRVSCHEDULER_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/standard/cphsrvserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,355 @@
+/*
+* 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:  Server.
+*
+*/
+
+
+#ifndef CPHSRVSERVER_H
+#define CPHSRVSERVER_H
+
+
+// INCLUDES
+#include "mphsrvphoneinterface.h" 
+#include "phcltclientserver.h" 
+#include <rphcltserver.h> 
+#include <fbs.h>
+#include <f32file.h>
+
+
+// FORWARD DECLARATIONS
+class CPhSrvSession;
+class CPhSrvUssdManager;
+class CPhSrvPhoneController;
+class CPhSrvResourceManager;
+class CPhSrvCallRequestManager;
+class CPhSrvEmergencyRequestManager;
+class CPhSrvEmergencyNumberManager;
+class MPhSrvNegotiatorCall;
+class MPhSrvEmergencyNumberManager;
+class MPhSrvComHandNegotiator;
+class CPhSrvComHandRequestManager;
+class CPhSrvMessengerRequestManager;
+class MPhSrvMessengerNegotiator;
+class MPhSrvEmergencyNegotiatorCall;
+
+
+// CLASS DECLARATION
+
+/**
+*  It is the server class for Phone Server.
+*
+*  @since 1.0
+*/
+class CPhSrvServer : 
+    public CServer2
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * Creates a new server and starts it.
+        */
+        static CPhSrvServer* NewL();
+       
+        /**
+        * Destructor.
+        */
+        ~CPhSrvServer();
+        
+
+    public: // New functions
+
+        /**
+        * Connects to Font and bitmap server.
+        * @return Symbian error code
+        */
+        TInt ConnectFBS();
+
+        /**
+        * Disconnects Font and bitmap server.
+        * @param aForce do we force disconnect
+        */
+        void DisconnectFBS( TBool aForce = EFalse );
+
+        /**
+        * Creates all managers.
+        *
+        * @param aSession The session for subsessions.
+        */ 
+        void CreateAllL( CPhSrvSession& aSession );
+
+        /** 
+        * Cancels create all.
+        *
+        * @param aSession The session for subsessions.
+        */
+        void CancelCreateAll( CPhSrvSession& aSession );
+
+        /**
+        * Creates a new object container.
+        *
+        * @return Returns the created instance.
+        */
+        CObjectCon* NewContainerL() const;
+        
+        /**
+        * Removes an object container.
+        *
+        * @param  aCon object container 
+        */
+        void RemoveContainer( CObjectCon* aCon );
+
+        /**
+        * Access to the call negotiator
+        *
+        * @return The call negotiator
+        */
+        MPhSrvNegotiatorCall& CallNegotiatorL();
+        
+        /**
+        * Access to the call negotiator
+        * NOTE: This is not safe call if IsCallNegotiator() return False
+        * @return The call negotiator
+        */
+        MPhSrvNegotiatorCall& CallNegotiator() const;
+
+        /**
+        * Access to the USSD manager
+        *
+        * @return The USSD manager
+        */
+        CPhSrvUssdManager& UssdManagerL();
+        
+        
+        /**
+        * Access to the call negotiator
+        *
+        * @return The call negotiator
+        */
+        MPhSrvEmergencyNegotiatorCall& EmergencyCallNegotiatorL();
+        
+        /**
+        * Access to the call negotiator
+        * NOTE: This is not safe call if IsEmergencyCallNegotiator() return
+        * false.
+        * @return The call negotiator
+        */
+        MPhSrvEmergencyNegotiatorCall& EmergencyCallNegotiator() const;
+
+        /**
+        * Ask if there is a emergency call negotiator.
+        *
+        * @return ETrue if there is emergency call negotiator.
+        */
+        TBool IsEmergencyCallNegotiator() const;
+
+        /**
+        * Access to the phone
+        *
+        * @return The phone interface
+        */
+        MPhSrvPhoneInterface& PhoneInterfaceL();
+
+        /**
+        * Access to the emergency number manager
+        *
+        * @return The emergency number manager
+        */
+        MPhSrvEmergencyNumberManager& EmergencyNumberManagerL();
+
+        /**
+        * Ask if there is a call negotiator.
+        *
+        * @return ETrue if there is call negotiator.
+        */
+        TBool IsCallNegotiator() const;
+
+        /**
+        * Ask if there is a ussd manager
+        *
+        * @return ETrue if there is ussd manager.
+        */
+        TBool IsUssdManager() const;
+
+        /**
+        * Access to the command handler negotiator.
+        * @since 2.6
+        *
+        * @return The command handler negotiator
+        */
+        MPhSrvComHandNegotiator& ComHandNegotiatorL();
+        
+        /**
+         * Access to the command handler negotiator.
+         * NOTE: This is not a safe call if
+         * IsComHandNegotiator() return false.
+         */
+        MPhSrvComHandNegotiator& ComHandNegotiator() const;
+
+        /**
+        * Ask if there is a command handler negotiator.
+        * @since 2.6
+        *
+        * @return ETrue if there is command handler negotiator.
+        */
+        TBool IsComHandNegotiator() const;
+
+        /**
+        * Access to the messenger negotiator.
+        * @since 2.6
+        *
+        * @return The messenger negotiator
+        */
+        MPhSrvMessengerNegotiator& MessengerNegotiatorL();
+        
+        /**
+        * Access to the messenger negotiator.
+        * NOTE: This is not a safe call if IsMessengerNegotiator()
+        * return false.
+        * @since 5.0
+        *
+        * @return The messenger negotiator
+        */
+        MPhSrvMessengerNegotiator& MessengerNegotiator() const;
+
+        /**
+        * Ask if there is a messenger negotiator.
+        * @since 2.6
+        *
+        * @return ETrue if there is messenger negotiator.
+        */
+        TBool IsMessengerNegotiator() const;
+
+
+    public: // Functions from base classes
+        
+        /**
+        * From CServer, create a new session.
+        *
+        * @param aVersion It is the version of the client api.
+        * @param aMessage Connect message from Client.
+        * @return Returns a new session.
+        */          
+        CSession2* NewSessionL(
+            const TVersion &aVersion,
+            const RMessage2& aMessage ) const;
+        
+
+    private: // New functions
+        
+        /**
+        * C++ constructor.
+        */
+        CPhSrvServer( TInt aPriority );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        * @since 2.8
+        */
+        void ConstructL();
+           
+        /**
+        * Returns file server session.
+        */
+        RFs& FsSessionL();
+
+
+        /**
+        * Returns resource manager.
+        */
+        CPhSrvResourceManager& ResourceManagerL();
+
+        /**
+        * Performs step in create all.
+        */
+        TInt CreateAllStepL();
+
+        /**
+        * Performs an step.
+        */
+        void PerformNextStepL();
+
+        /**
+        * Complete create all.
+        */
+        void CompleteCreateAll( TInt aError );
+
+        /**
+        * Create all step.
+        */
+        static TInt DoCreateAllStepL( TAny* aAny );       
+
+    private:     // Data
+    
+        // The file server session for the whole server.
+        RFs                            iFsSession;
+
+
+        // The object responsible for controlling the server resource file.
+        CPhSrvResourceManager*         iResourceFileManager;
+
+        // The object responsible for controlling the interface to the phone.
+        CPhSrvPhoneController*         iPhoneController;
+
+        // The object container indexer which owns and manages the CObjectCon 
+        // instances ensuring that each container has a unique handle spanning 
+        // all sub-sessions.
+        // As well as owning the object containers, it also is responsible 
+        // for creating new ones.
+        mutable CObjectConIx*          iObjectConIx;
+
+        // The object responsible for acting as the bridge between an external 
+        // call client, and the phone app engine notifier client.
+        CPhSrvCallRequestManager*      iCallRequestManager;
+        
+        // The object responsible for acting as the bridge between an external 
+        // call client, and the phone app engine notifier client.
+        CPhSrvEmergencyRequestManager*      iEmergencyRequestManager;
+
+        // Responsible for all USSD related server functionality.
+        CPhSrvUssdManager*             iUssdManager;
+
+        // Responsible for all emergency number related functionality.
+        CPhSrvEmergencyNumberManager*  iEmergencyNumberManager;
+        
+        // The object responsible for acting as the bridge between an external
+        // command handler client, and the phone app engine notifier client.
+        CPhSrvComHandRequestManager*   iComHandRequestManager;
+
+        // The object responsible for handling messenger requests.
+        CPhSrvMessengerRequestManager* iMessengerRequestManager;
+
+        // CREATE ALL VARIABLES
+
+        // Idle object for create all.
+        CIdle*                         iCreateAll;
+
+        // Step index.
+        TInt                           iCreateAllStep;
+
+        // Error.
+        TInt                           iCreateAllError;
+
+        // Array of sessions.
+        RPointerArray< CPhSrvSession > iCreateAllArray;
+
+        // Reference count for font and bitmap server connections.
+        TInt                           iFBSConnections;
+    };
+
+#endif      // CPHSRVSERVER_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/standard/cphsrvsession.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,224 @@
+/*
+* 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:  Server Session.
+*
+*/
+
+
+#ifndef CPHSRVSESSION_H
+#define CPHSRVSESSION_H
+
+// INCLUDES
+#include <e32base.h>
+#include "phcltclientserver.h" 
+
+// FORWARD DECLARATIONS
+class CPhSrvServer;
+class CPhSrvCallNotify;
+class CPhSrvReqManager;
+class CPhSrvExtCall;
+class CPhSrvSubSessionBase;
+
+// CLASS DECLARATION
+
+/**
+*  It is the session class for Phone Server.
+*
+*  @since 1.0
+*/
+class CPhSrvSession : public CSession2
+    {
+    friend class CPhSrvSubSessionBase;
+
+
+    public: // Constructors and destructor
+        
+        /**
+         * Two-phased constructor.
+         *
+         * @param aServer It is the main server object.
+         * @return Returns a new session.
+         */
+        static CPhSrvSession* NewL( 
+            CPhSrvServer& aServer );
+
+        /**
+        * Destructor.
+        */
+        ~CPhSrvSession();
+
+
+    public: // Functions from base classes
+
+        /**
+        * From CSession2, it is called whenever request is processed.
+        * 
+        * @param aMessage It is the request.
+        */
+        void ServiceL( const RMessage2& aMessage );
+
+
+    public: // Sub-session access
+
+        /**
+        * Phone Server reference.
+        *
+        * @return The phone server.
+        */
+        CPhSrvServer& PhoneServer() const;
+
+        /**
+        * Get information of the count of subsessions.
+        *
+        * @return The number of subsession objects.
+        */
+        TInt SubSessionCount() const;
+
+        /**
+        * Return a specific subsession.
+        *
+        * @return The subsession at location aIndex.
+        */
+        CPhSrvSubSessionBase& SubSessionAt(TInt aIndex) const;
+
+        /**
+        * Closes subsession by handle.
+        *
+        * @param aMessage It contains the handle to the subsession.
+        */
+        void CloseSubSession( const RMessage2& aMessage );
+
+        /**
+        * Panics the client thread.
+        *
+        * @param aMessage The client to be panicked.
+        * @param aPanic It is the reason for panic.
+        */
+        void PanicClient(
+            const RMessage2& aMessage,
+            TPhCltServerInitiatedPanic aPanic ) const;
+            
+        /**
+        * Writes to client address space inside and
+        * catch bad descriptors.
+        *
+        * @param aMessage The client.
+        * @param aLocation The location where the data is written.
+        * @param aDes The data that is written.
+        * @param aOffset The data location where to start the writing.
+        */
+        void Write( 
+            const RMessage2& aMessage,
+            TInt aLocation,
+            const TDesC8& aDes,
+            TInt aOffset = 0 );
+
+        /**
+        * Reads from client address space and
+        * catch bad descriptors.
+        *
+        * @param aMessage The client.
+        * @param aLocation The location where the data is read.
+        * @param aDes The read data storage.
+        * @param aOffset The data location where to start the reading.
+        */
+        void Read(
+            const RMessage2& aMessage,
+            TInt aLocation,
+            TDes8& aDes,
+            TInt aOffset = 0 );
+
+        /**
+        * Reads from client address space and
+        * catch bad descriptors (unicode aware)
+        *
+        * @param aMessage The client.
+        * @param aLocation The location where the data is read.
+        * @param aDes The read data storage.
+        * @param aOffset The data location where to start the reading.
+        */
+        void Read(
+            const RMessage2& aMessage,
+            TInt aLocation,
+            TDes& aDes,
+            TInt aOffset = 0 );
+
+        /**
+        * Complete create all request.
+        *
+        * @param aError The error code that is returned.
+        */
+        void CompleteCreateAll( TInt aError );
+
+
+    private:
+
+        /**
+        * C++ constructor.
+        */
+        CPhSrvSession();
+        
+        /**
+        * Symbian OS constructor.
+        */
+        void ConstructL( CPhSrvServer& aServer );
+
+        /**
+        * Return the unique handle associated with this subsession
+        *
+        * @return The unique handle associated with a subsession.
+        */
+        TInt SubSessionUniqueHandle( 
+            const CPhSrvSubSessionBase& aSubSession ) const;
+
+        /**
+        * Service a request - called by ServiceL within a trap
+        * harness so that we can catch leaves, and complete messages
+        * properly.
+        * 
+        * @param aMessage The message from the client [sub]session.
+        */
+        void ProcessRequestL( const RMessage2& aMessage );
+
+        /**
+        * Handle function.
+        *
+        * @param aFunction function.
+        * @return ETrue iff handled here.
+        */
+        TBool HandleCommandL( const RMessage2& aMessage );
+
+
+    private:    // Data
+
+        // The container for all objects in this session (i.e. the 
+        // subsession CObject's from the client-side).
+        CObjectCon*     iContainer;
+
+        // The index of open objects associated with this session.
+        CObjectIx*      iObjectIx;
+
+        // Server.
+        CPhSrvServer*   iServer;
+
+        // Flag, ETrue if message ok.
+        TBool           iCreateAll;
+
+        // Message for create all.
+        RMessage2       iCreateAllMsg;
+    };
+
+#endif      // CPHSRVSESSION_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/standard/cphsrvsubsessionbase.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,172 @@
+/*
+* 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:  Sub Session Base.
+*
+*/
+
+
+#ifndef CPHSRVSUBSESSIONBASE_H
+#define CPHSRVSUBSESSIONBASE_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include "mphsrvmessageprocessor.h" 
+
+
+// FORWARD DECLARATIONS
+class CPhSrvSubSessionNotifier;
+class CPhSrvSession;
+
+
+// CLASS DECLARATION
+
+/**
+*  The base class for all subsessions.
+*
+*  @since 1.0
+*/
+class CPhSrvSubSessionBase : 
+    public CObject, 
+    public MPhSrvMessageProcessor
+    {
+    public:
+
+        /*
+        * The subsessions type.
+        *
+        *   EPhSrvSubSessionTypeUndefined        Undefined subsession, error.
+        *   EPhSrvSubSessionTypeExternalCall     Call subsession.
+        *   EPhSrvSubSessionTypeCallNotifier     CallNotifiers subsession.
+        *   EPhSrvSubSessionTypeUssd             USSD subsession.
+        *   EPhSrvSubSessionTypeIhf              IHF subsession.
+        *   EPhSrvSubSessionTypeEmergencyNumber  Emergency number subsession.
+        *   EPhSrvSubSessionTypeComHand          Command Handler subsession.
+        *   EPhSrvSubSessionTypeComHandNotify    ComHand Notify subsession.
+        *   EPhSrvSubSessionTypeMessenger        Messenger subsession.
+        *   EPhSrvSubSessionTypeImageHandler     Image handler subsession.
+        *   EPhSrvSubSessionTypeEmergencyCall    Emergency call subsession.
+        */
+        enum TPhSrvSubSessionType
+            {
+            EPhSrvSubSessionTypeUndefined = KErrNotFound,
+            EPhSrvSubSessionTypeExternalCall    = 0,
+            EPhSrvSubSessionTypeCallNotifier    = 1,
+            EPhSrvSubSessionTypeUssd            = 2,
+            EPhSrvSubSessionTypeIhf             = 3,
+            EPhSrvSubSessionTypeEmergencyNumber = 4,
+            EPhSrvSubSessionTypeComHand         = 5,
+            EPhSrvSubSessionTypeComHandNotify   = 6,
+            EPhSrvSubSessionTypeMessenger       = 7,
+            EPhSrvSubSessionTypeImageHandler    = 8,
+            EPhSrvSubSessionTypeEmergencyCall   = 9
+
+            };
+
+    public:  // Constructors and destructor
+
+        /**
+        * Create an instance of this class
+        *
+        * @param aSession The session where this subsession belongs.
+        * @param aType The type of subsession that this object should represent.
+        */
+        CPhSrvSubSessionBase( 
+            CPhSrvSession& aSession, 
+            TPhSrvSubSessionType aType );
+
+        /**
+        * Complete construction of the subsession.
+        */
+        virtual void ConstructL() { }
+
+
+    public: // Access
+
+        /**
+        * Return the owning session.
+        *
+        * @return A handle to the owning session.
+        */
+        CPhSrvSession& PhoneSession();
+
+        /**
+        * Return the owning session.
+        *
+        * @return A constant handle to the owning session.
+        */
+        const CPhSrvSession& PhoneSession() const;
+
+        /**
+        * Return the type of this sub-session object.
+        *
+        * @return The type of this sub-session object.
+        */
+        TPhSrvSubSessionType Type() const;
+
+        /**
+        * Return the unique handle associated with this subsession.
+        *
+        * @return The unique handle associated with a subsession.
+        */
+        TInt SubSessionUniqueHandle() const;
+
+
+    public:
+
+        /**
+        * Writes to client address space and
+        * catch bad descriptors.
+        *
+        * @param aMessage The client.
+        * @param aPtr The location where the data is written.
+        * @param aDes The data that is written.
+        * @param aOffset The data location where to start the writing.
+        */
+        void Write( 
+            const RMessage2& aMessage,
+            TInt aLocation,
+            const TDesC8& aDes,
+            TInt aOffset = 0 );
+
+        /**
+        * Reads from client address space and
+        * catch bad descriptors.
+        *
+        * @param aMessage The client.
+        * @param aPtr The location where the data is read.
+        * @param aDes The read data storage.
+        * @param aOffset The data location where to start the reading.
+        */
+        void Read(
+            const RMessage2& aMessage,
+            TInt aLocation,
+            TDes8& aDes,
+            TInt aOffset = 0 );
+
+
+    private: // Data
+
+        // A handle to the session which owns this subsession.
+        CPhSrvSession& iSession;
+
+        // The type of sub-session that this object represents.
+        TPhSrvSubSessionType iSubSessionType;
+    };
+
+
+#endif      // CPHSRVSUBSESSIONBASE_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/standard/cphsrvsubsessionextcall.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,114 @@
+/*
+* 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:  Sub Session Ext Call.
+*
+*/
+
+#ifndef CPHSRVSUBSESSIONEXTCALL_H
+#define CPHSRVSUBSESSIONEXTCALL_H
+
+
+// INCLUDES
+#include "cphsrvsubsessionbase.h" 
+#include <cphcltextphonedialdata.h> 
+
+// CLASS DECLARATION
+
+/**
+*  Ext Call Subsession.
+*
+*  @since 1.0
+*/
+class CPhSrvSubSessionExtCall : public CPhSrvSubSessionBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Constructor.
+        *
+        * @param aSession The session where this subsession belongs.
+        */
+        CPhSrvSubSessionExtCall( CPhSrvSession& aSession );
+
+
+    private: // Functions from base classes
+
+        /**
+        * @see MPhSrvMessageDecoder
+        */
+        TBool PhSrvMessageDecoderCanProcessMessage( TInt aFunction );
+
+        /**
+        * @see MPhSrvMessageProcessor
+        */
+        void PhSrvMessageProcessorHandleMessageL( const RMessage2& aMessage );
+
+
+    private: // SubSession function handlers
+
+        /**
+        * Close subsession
+        *
+        * @param aMessage Message to be processed.
+        */
+        void CmdSubSessionCloseL( const RMessage2& aMessage );
+        
+        /**
+        * Makes call
+        *
+        * @param aMessage Message to be processed.
+        */
+        void CmdSubSessionMakeCallL( const RMessage2& aMessage );
+        
+        /**
+        * Cancels call
+        *
+        * @param aMessage Message to be processed.
+        */
+        void CmdSubSessionMakeCallCancelL( const RMessage2& aMessage );
+        
+        /**
+        * Creates call argument object
+        *
+        * @param aMessage Message to be processed.
+        */
+        void CreateCallArgsL( const RMessage2& aMessage );
+        
+        /**
+        * Finds chars 'p' and 'w' from input string
+        *
+        * @param aString Input string (telephone number).
+        * @return returns true if number contains chars 'p' or 'w'
+        */
+        TBool IsDtmfPhoneNumber( const TDesC& aString );
+
+    private:     // Data
+
+        // Indicates whether we have an pending request.
+        TBool       iHavePendingDialRequestPointer;
+    
+        // Initialized when the client initiates an dial request. This object 
+        // will complete the request when the phone app has responded with 
+        // the result of the dial.
+        RMessage2   iPendingDialRequestPointer;
+
+        // Call arguments
+        CPhCltExtPhoneDialData* iCallArgs;
+        
+    };
+
+#endif // CPHSRVSUBSESSIONEXTCALL_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/standard/cphsrvsubsessionussd.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,103 @@
+/*
+* 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:  Subsession for Ussd.
+*
+*/
+
+#ifndef CPHSRVSUBSESSIONUSSD_H
+#define CPHSRVSUBSESSIONUSSD_H
+
+
+// INCLUDES
+#include "cphsrvsubsessionbase.h" 
+#include "mphsrvussdmessagesentobserver.h" 
+
+
+// CLASS DECLARATION
+
+/**
+*  USSD Subsession.
+*
+*  @since 1.0
+*/
+class CPhSrvSubSessionUssd : 
+    public CPhSrvSubSessionBase, 
+    public MPhSrvUssdMessageSentObserver
+    {
+    public:
+
+        /**
+        * Constructor.
+        *
+        * @param aSession The session where this subsession belongs.
+        */
+        CPhSrvSubSessionUssd( CPhSrvSession& aSession );
+
+        
+    private: // Functions from base classes
+
+        /**
+        * @see MPhSrvMessageDecoder
+        */
+        TBool PhSrvMessageDecoderCanProcessMessage( TInt aFunction );
+        
+        /**
+        * @see MPhSrvMessageProcessor
+        */
+        void PhSrvMessageProcessorHandleMessageL( const RMessage2& aMessage );
+        
+        /**
+        * @see MPhSrvUssdMessageSentObserver
+        */
+        void UssdMessageSentObserverHandleResult( TInt aError );
+        
+
+    private: // SubSession function handlers
+
+        void CmdSubSessionCloseL( const RMessage2& aMessage );
+
+        void CmdSubSessionSendMessageL( const RMessage2& aMessage );
+
+        void CmdSubSessionSendMessageCancelL( const RMessage2& aMessage );
+
+        void CmdSubSessionStartEditingL( const RMessage2& aMessage );
+
+        void CmdSubSessionAppStartingL( const RMessage2& aMessage );
+
+        void CmdSubSessionAppTerminatingL( const RMessage2& aMessage );
+
+        void CmdSubSessionAppToForegroundL( const RMessage2& aMessage );
+
+        void CmdSubSessionAppToBackgroundL( const RMessage2& aMessage );
+
+        void CmdSubSessionStartSATL( const RMessage2& aMessage );
+
+        void CmdSubSessionStopSATL( const RMessage2& aMessage );
+
+
+    private:    // Data
+        
+        // Indicates whether we have a pending send request.
+        TBool       iHavePendingSendMessagePointer;
+        
+        // Initialized when the client initiates a send message request.
+        RMessage2   iPendingSendMessagePointer;
+        
+    };
+
+
+#endif // CPHSRVSUBSESSIONUSSD_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/standard/kphsrvconfigure.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build configuration file for Phone Server.
+*
+*/
+
+
+#ifndef PHSRVCONFIGURE_H
+#define PHSRVCONFIGURE_H
+
+
+//////////////////////////////////////////////////////////////////////////////
+//  DEBUGGING
+//////////////////////////////////////////////////////////////////////////////
+/** When defined debugging features are built in. */
+
+//#define __PHSRV_DEBUG_INFO__
+
+#ifdef __PHSRV_DEBUG_INFO__
+
+/** When defined, phone server prints RDEBUG messages. */
+#define __PHSRV_PRINT_DEBUG_INFO__
+
+/** When defined, phone server writes log. 
+*/
+//#define __PHSRV_DEBUG_WRITE_LOG__
+
+#endif
+
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/standard/mphsrvmessageprocessor.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,75 @@
+/*
+* 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:  Message Processor interface class.
+*
+*/
+
+
+#ifndef MPHSRVMESSAGEPROCESSOR_H
+#define MPHSRVMESSAGEPROCESSOR_H
+
+
+// INCLUDES
+#include <e32base.h>
+
+
+// CLASS DECLARATION
+
+/**
+*  Abstract message decoder class.
+*
+*  @since 1.0 
+*/
+class MPhSrvMessageDecoder
+    {
+    public: // New functions
+
+        /**
+        * Returns ETrue if this object can understand the specified
+        * message function.
+        *
+        * @return Whether this object can understand the specified 
+        *         client/server operation.
+        */
+        virtual TBool PhSrvMessageDecoderCanProcessMessage( 
+            TInt aFunction ) = 0;
+    };
+
+
+
+// CLASS DECLARATION
+
+/**
+*  Abstract message processor class.
+*
+*  @since 1.0 
+*/
+class MPhSrvMessageProcessor : public MPhSrvMessageDecoder
+    {
+    public: // New functions
+
+        /**
+        * Process the specified client/server message.
+        *
+        * @param aMessage Message to be processed.
+        */
+        virtual void PhSrvMessageProcessorHandleMessageL( 
+            const RMessage2& aMessage ) = 0;
+    };
+
+
+#endif // MPHSRVMESSAGEPROCESSOR
+
+       
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/standard/mphsrvphoneinterface.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Phone Interface.
+*
+*/
+
+
+#ifndef MPHSRVPHONEINTERFACE_H
+#define MPHSRVPHONEINTERFACE_H
+
+
+// FORWARD DECLARATIONS
+class RTelServer;
+class RMobilePhone;
+class RMmCustomAPI;
+
+
+// CLASS DECLARATION
+
+/**
+*  Phone interfaces for other classes.
+*
+*  @since 1.0
+*/
+class MPhSrvPhoneInterface
+    {
+    public: // New functions
+
+        /**
+        * Return a connection to ETel.
+        *
+        * @return An ETel connection.
+        */
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        virtual RTelServer& PhSrvETelServer() = 0;
+
+        /**
+        * Return a connection to the phone.
+        *
+        * @return Phone connection.
+        */
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        virtual RMobilePhone& PhSrvMobilePhone() = 0;
+
+        /**
+        * Return a connection to the phone.
+        *
+        * @return Phone connection.
+        */
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        virtual RMmCustomAPI& PhSrvCustomPhone() = 0;
+    };
+
+#endif // MPHSRVPHONEINTERFACE_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/standard/phsrvdebuginfo.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,210 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 debug information.
+*
+*/
+
+
+#ifndef CPHSRVGDEBUGINFO_H
+#define CPHSRVGDEBUGINFO_H
+
+// INCLUDES
+
+#include <e32base.h>            // TInt, cbase
+#include "kphsrvconfigure.h" // Debugging feature defines 
+
+// MACROS
+//----------------------------------------------------------------------------
+// These macros are for debugging purposes. 
+// Can be enabled or disabled from KPhSrvConfigure.h
+// If disabled, macros are empty and no additionall resources used.
+// If Enabled. This class PhSrvDebugInfo is additional load.
+// Operations are quite heavy weight because use of debug prints and
+// threads local storage.
+//----------------------------------------------------------------------------
+#ifdef __PHSRV_DEBUG_INFO__
+#pragma message("\\PhoneServer\\Inc\\Standard\\KPhSrvConfigure.h(107): Warning: ** DEBUG PRINTS ARE ENABLED! ** ") 
+// For printing only text.
+#define _DPRINT(l,t) { PhSrvDebugInfo::Print((l), _L(t) ); }
+// For printing text folloved by number.
+#define _DDPRINT(l,t,n) { \
+    TBuf<60> buf; \
+    buf.Append( _L(t) ); \
+    buf.AppendNum( (TInt)n ); \
+    PhSrvDebugInfo::Print((l), buf ); }
+// For print text followed by text
+#define _DSPRINT(l,t,s) { \
+    TBuf<60> buf; \
+    buf.Append( _L(t) ); \
+    buf.Append( s.Right(Min(s.Length(), 30 )) ); \
+    PhSrvDebugInfo::Print( (l), buf ); }
+#else
+#define _DPRINT(l,t)
+#define _DDPRINT(l,t,n)
+#define _DSPRINT(l,t,s)
+#endif
+
+#if defined __PHSRV_DEBUG_TESTER__ && defined __PhSrv_DEBUG_INFO__
+// Init & uninit
+#ifdef __PHSRV_DEBUG_TESTER_ALWAYS__
+#define PHSRV_TESTER_INIT() PhSrvDebugInfo::SetTestMonitorL( ETrue )
+#define PHSRV_TESTER_UNINIT() PhSrvDebugInfo::SetTestMonitorL( EFalse )
+#else
+#define PHSRV_TESTER_INIT()
+#define PHSRV_TESTER_UNINIT()
+#endif
+
+// Enable & disable
+#define PHSRV_TESTER_ENABLE() PhSrvDebugInfo::SetTestMonitorL( ETrue )
+#define PHSRV_TESTER_DISABLE() PhSrvDebugInfo::SetTestMonitorL( EFalse )
+
+// Leave if set.
+#define PHSRV_TESTER_LEAVE( c, e ) \
+    { \
+    PhSrvDebugInfo::TPhSrvDebugTestData _i; PhSrvDebugInfo::GetTestData( _i ); \
+    if ( _i.iCase == (c) ) \
+        { \
+        _i.iDone++; \
+        PhSrvDebugInfo::SetTestData( _i ); \
+        User::Leave( (e) ); \
+        } \
+    }
+
+// Leave if set, reset also.
+#define PHSRV_TESTER_LEAVERESET( c, e ) \
+    { \
+    PhSrvDebugInfo::TPhSrvDebugTestData _i; PhSrvDebugInfo::GetTestData( _i ); \
+    if ( _i.iCase == (c) ) \
+        { \
+        _i.iCase = _i.iDone = 0; \
+        PhSrvDebugInfo::SetTestData( _i ); \
+        User::Leave( (e) ); \
+        } \
+    }
+
+// Leave if set, reset if amounts reached
+#define PHSRV_TESTER_LEAVERESET3( c, e, a ) \
+    { \
+    PhSrvDebugInfo::TPhSrvDebugTestData _i; PhSrvDebugInfo::GetTestData( _i ); \
+    if ( _i.iCase == (c) ) \
+        { \
+        _i.iDone++; \
+        if ( _i.iDone > (a) ) \
+            { \
+            _i.iCase = _i.iDone = 0; \
+            PhSrvDebugInfo::SetTestData( _i ); \
+            } \
+        User::Leave( (e) ); \
+        } \
+    }
+
+// Set failnext if set, reset
+#define PHSRV_TESTER_FAILNEXT( c ) \
+    { \
+    PhSrvDebugInfo::TPhSrvDebugTestData _i; PhSrvDebugInfo::GetTestData( _i ); \
+    if ( _i.iCase == (c) ) \
+        { \
+        User::__DbgSetAllocFail( RHeap::EUser, RHeap::EFailNext, 1 ); \
+        } \
+    }
+
+// Reset fail next
+#define PHSRV_TESTER_FAILNEXT_RESET() User::__DbgSetAllocFail( RHeap::EUser, RHeap::ENone, 1 )
+
+#else
+
+// Init & uninit
+#define PHSRV_TESTER_INIT()
+#define PHSRV_TESTER_UNINIT()
+
+// Enable & disable
+#define PHSRV_TESTER_ENABLE()
+#define PHSRV_TESTER_DISABLE()
+
+// Leave
+#define PHSRV_TESTER_LEAVE( c, e )
+#define PHSRV_TESTER_LEAVERESET( c, e )
+#define PHSRV_TESTER_LEAVERESET3( c, e, a )
+#define PHSRV_TESTER_FAILNEXT( c )
+#define PHSRV_TESTER_FAILNEXT_RESET()
+
+#endif
+
+// FORWARD DECLARATIONS
+class RFs;
+class RFile;
+//class CPhSrvDebugTestMonitor;
+
+// CLASS DECLARATION
+
+/**
+*   Debugging level. From 0-. 
+*   00   None 
+*   01   PhoneEngine, Call     
+*   02   PhoneEngine, Audio
+*   03   PhoneEngine, Indicators, Services & others
+*   04   PhoneServer
+*   05   Phone, logging
+*   06   Phone, autom. redial.
+*   07   Phone, 
+*   08   Phone, 
+*   09   
+*   10   Phone, recovery system & indicators
+*   11   Phone, ui 
+*
+*  @lib phoneengine
+*  @since 1.2
+*/
+class PhSrvDebugInfo : public CBase
+    {
+    private:
+        NONSHARABLE_CLASS( CPhSrvDebugData ) : public CBase
+            {
+            public: 
+               ~CPhSrvDebugData();
+              
+                void CreateFile();
+                void ReleaseFile();
+                TBool IsFile() const;
+                void WriteFile( const TDesC8& aDes );
+               
+            private:
+                RFs* iFs;
+                RFile* iFile;
+             
+            };
+
+    public:  // Constructors and destructor
+    
+    
+        /**
+        * Prints text if area set.
+        *
+        * @param aArea area of text.
+        * @param aText text to be printed.
+        */
+        static void Print( TInt aArea, const TDesC& aText );
+    
+        
+
+    private:
+        
+        // Creates debug data.
+        static CPhSrvDebugData* CreateData();
+
+     
+
+    };
+#endif         
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/standard/phsrvstartup.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,62 @@
+/*
+* 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:  Static Phone Server startup utility class.
+*
+*/
+
+
+#ifndef PHSRVSTARTUP_H
+#define PHSRVSTARTUP_H
+
+
+// INCLUDES
+#include <phclttypes.h> 
+
+
+// FORWARD DECLARATIONS
+//None.
+
+// CLASS DECLARATION
+
+/**
+* Static server startup utility class. Encapsulates all the knowledge of how 
+* to start and prepare the phone server, including build target (WINS/MARM) 
+* specific functionality.
+*
+* @since 1.0
+*/
+class PhoneServerStartUpUtils
+    {
+    public: // New functions
+
+
+        /**
+        * Creates a new server and starts it.
+        */
+        static void CreateAndRunServerL();
+
+        /**
+        * Prepare the server thread, i.e. create a cleanup stack environment 
+        * and start the server for real.
+        *
+        * @return Symbian error code of the operation.
+        */
+        static TInt PrepareServerEnvironment();
+    };
+
+
+#endif  // PHSRVSTARTUP_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/standard/phsrvsubsessionfactory.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* 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:  Sub Session Factory.
+*
+*/
+
+
+#ifndef PHSRVSUBSESSIONFACTORY_H
+#define PHSRVSUBSESSIONFACTORY_H
+
+// INCLUDES
+#include <e32std.h>
+
+
+// FORWARD DECLARATIONS
+class CPhSrvSession;
+class CPhSrvSubSessionBase;
+
+
+// CLASS DECLARATION
+
+/**
+*  Subsession creation factory.
+*
+*  @since 1.0
+*/
+class PhSrvSubSessionFactory
+    {
+    public: // New functions
+
+        /**
+        * Whether or not a specified function should result in a new 
+        * subsession being created.
+        *
+        * @param aFunction Function to be evaluated.
+        * @return ETrue if the function (opcode) requires a new subsession.
+        */
+        static TBool PhSrvSubSessionFactoryIsCreationFunction(TInt aFunction);
+
+        /**
+        * Create a new subsession according to the function (opcode) type.
+        *
+        * @param aFunction Function to be created.
+        * @param aSession Session where the subsession belongs.
+        * @return A new subsession, left on the cleanup stack.
+        */
+        static CPhSrvSubSessionBase* PhSrvSubSessionFactoryCreateLC( 
+            TInt aFunction, 
+            CPhSrvSession& aSession );
+            
+        /**
+        * Check Secure ID for a new subsession.
+        *
+        * @param aFunction Function to be created.
+        * @param aSID Secure ID of the process
+        * @return ETrue if a new subsession creation is allowed
+        */     
+        static TBool PhSrvSubSessionFactoryIsCreationAllowed(
+            TInt aFunction,
+            TUint32 aSID );   
+    
+    };
+
+#endif      // PHSRVSUBSESSIONFACTORY_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/standard/phsrvutils.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,115 @@
+/*
+* 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:  Phone Server Utils.
+*
+*/
+
+
+#ifndef PHSRVUTILS_H
+#define PHSRVUTILS_H
+
+// DATA TYPES
+
+/* 
+*   EPhoneServerPanicNoWaitingRequestsToDeque         No waiting requests.
+*   EPhoneServerPanicModeLogicFault                   Logic failure.
+*   EPhoneServerPanicCouldNotStartServer              Server startup failure.
+*   EPhoneServerPanicSchedulerError                   Schedule failure.
+*   EPhoneServerPanicNoInitiatingCallObject           Missing call object.
+*   EPhoneServerPanicExistingCallInitiatorFault       Existing initiator fail.
+*   EPhoneServerPanicNoCallInitiatorFault             Missing initiator failure.
+*   EPhoneServerPanicInitiatorHandleMisMatchFault     Mismatch failure.
+*   EPhoneServerPanicNoPendingSendRequestFault        Sending failure.
+*   EPhoneServerPanicNoPendingTimeOutRequestFault     Timeout failure.
+*   EPhoneServerPanicUssdAutoReplyTimerAlreadyActive  Timer already active.
+*   EPhoneServerPanicInvalidInitiatorPriority         Initiator failure.
+*   EPhoneServerPanicCannotOpenPrimaryVoiceLine       Primary line open failure.
+*   EPhoneServerPanicCouldNotRenameServerThread       Renaming of thread failed.
+*   EPhoneServerPanicLineTypeInvalid                  Invalid line type.
+*   EPhoneServerPanicSharedDataConnectionFailure      Shared data failure.
+*   EPhoneServerPanicSystemAgentConnectionFailure     System agent failure.
+*   EPhoneServerPanicEmergencyCallRequestFailure      Emergency call failure.
+*   EPhoneServerPanicExistingComHandInitiatorFault    Existing ComHand fail.
+*   EPhoneServerPanicTooManyRequestsOngoing           More than one req/subses.
+*   EPhoneServerPanicMissingComInitiator              Com initiator missing
+*   EPhoneServerPanicMissingMessNegotiator            Messenger negotiator missing
+*   EPhoneServerPanicMissingEmerNegotiator            Emergency call negotiator missing
+*   
+*   EPhoneServerPanicLast                             Keep as last value!
+*/
+enum TPhoneServerPanic
+    {
+    EPhoneServerPanicNoWaitingRequestsToDeque = 0,
+    EPhoneServerPanicModeLogicFault = 1,
+    EPhoneServerPanicCouldNotStartServer = 2,
+    EPhoneServerPanicSchedulerError = 3,
+    EPhoneServerPanicNoInitiatingCallObject = 4,
+    EPhoneServerPanicExistingCallInitiatorFault = 5,
+    EPhoneServerPanicNoCallInitiatorFault = 6,
+    EPhoneServerPanicInitiatorHandleMisMatchFault = 7,
+    EPhoneServerPanicNoPendingSendRequestFault = 8,
+    EPhoneServerPanicNoPendingTimeOutRequestFault = 9,
+    EPhoneServerPanicUssdAutoReplyTimerAlreadyActive = 10,
+    EPhoneServerPanicInvalidInitiatorPriority = 11,
+    EPhoneServerPanicCannotOpenPrimaryVoiceLine = 12,
+    EPhoneServerPanicCouldNotRenameServerThread = 13,
+    EPhoneServerPanicLineTypeInvalid = 14,
+    EPhoneServerPanicSharedDataConnectionFailure = 15,
+    EPhoneServerPanicSystemAgentConnectionFailure = 16,
+    EPhoneServerPanicEmergencyCallRequestFailure = 17,
+    EPhoneServerPanicExistingComHandInitiatorFault = 18,
+    EPhoneServerPanicTooManyRequestsOngoing = 19,
+    EPhoneServerPanicMissingComInitiator = 20,
+    EPhoneServerPanicMissingMessNegotiator = 21,
+    EPhoneServerPanicMissingEmerNegotiator = 22,
+
+    EPhoneServerPanicLast   // Keep as last!
+    };
+
+// CLASS DECLARATION
+
+/**
+*  Phone Server utils class.
+*
+*  @since 1.0
+*/
+class PhoneServerUtils
+    {
+    public: // New functions
+
+        /**
+        * Panic function for Phone Server usage.
+        * 
+        * @param aPanic Panic code.
+        */
+        static void Panic( TPhoneServerPanic aPanic );
+
+
+        /**
+        * Panic the client using Phone Server.
+        * @since 2.6
+        * 
+        * @param aPanic Panic code.
+        * @param aMessage The client to be paniced.
+        */
+        static void PanicClient( 
+            TPhoneServerPanic aPanic,
+            const RMessage2& aMessage );
+    };
+
+
+#endif // PHSRVUTILS_H
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/standard/standard_aiw/cphsrvcallrequest.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,159 @@
+/*
+* 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:  Call Request.
+*
+*/
+
+
+#ifndef CPHSRVCALLREQUEST_H
+#define CPHSRVCALLREQUEST_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include <cphcltextphonedialdata.h> 
+
+// CONSTANTS
+
+// Default emergency number
+_LIT( KPhSrvUsedEmergencyCallNumber , "112" );
+
+
+// FORWARD DECLARATIONS
+class CPhSrvSubSessionBase;
+
+
+// CLASS DECLARATION
+
+/**
+*  Call request class.
+*
+*  @since 1.0
+*/
+class CPhSrvCallRequest : public CBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Tell the external client (who requested that a number was called) the
+        * result of their actions. This information has come via the notifier
+        * (i.e. the phone app engine).
+        *
+        * @param aMessage The outstanding client request which will be completed
+        *                 when the call initiation outcome is known.
+        * @param aArguments The call arguments, such as phone number, contact 
+        *                   id, client window group etc.
+        * @param aSubSessionHandle The subsession handle.
+        * @return Pointer to created CPhSrvCallRequest instance.
+        */
+        static CPhSrvCallRequest* NewLC(
+            const RMessage2& aMessage, 
+            CPhCltExtPhoneDialData& aArguments,
+            TInt aSubSessionHandle );
+
+        /**
+        * Constructor for Emergency call object only.
+        */
+        static CPhSrvCallRequest* NewL();
+
+    public: // New functions
+
+        /**
+        * Tell the external client (who requested that a number was called) the
+        * result of their actions. This information has come via the notifier
+        * (i.e. the phone app engine).
+        *
+        * @param aResultOfAttemptingCall 
+        *        The result of initiating an earlier call.
+        */
+        void InformOfCallAttemptResult( 
+            TPhCltPhoneResults aResultOfAttemptingCall );
+
+        /**
+        * Cancel the asynchronous dial process. Completes client request with
+        * KErrCancel
+        */
+        void Cancel();
+
+        /**
+        * The sub-session handle.
+        *
+        * @return The unique handle associated with the subsession which 
+        *         initiated a call request.
+        */
+        TInt SubSessionHandle() const;
+
+        /**
+        * The arguments for the call.
+        *
+        * @return The call arguments.
+        */
+         CPhCltExtPhoneDialData& CallArguments() const;
+    
+        /**
+        * Update Emergency call status
+        * @param aMessage The outstanding client request which will be completed
+        *                 when the call initiation outcome is known.
+        * @param aArguments The call arguments, such as phone number, 
+        *                   contact id, client window group etc.
+        * @param aSubSessionHandle Subsession handle to emergency call.
+        */
+        void UpdateEmercgencyCall( 
+            const RMessage2& aMessage, 
+            CPhCltExtPhoneDialData& aArguments,
+            TInt aSubSessionHandle );
+
+        /**
+        * Clear the Emergency call object data.
+        */
+        void ClearEmergencyCall();
+
+
+    private:
+
+        /**
+        * C++ constructor
+        */
+        CPhSrvCallRequest( 
+            const RMessage2& aMessage, 
+            CPhCltExtPhoneDialData& aArguments,
+            TInt aSubSessionHandle );
+
+        /**
+        * C++ constructor
+        */
+        CPhSrvCallRequest();
+        
+        
+    private:  // Data
+
+        // A list of requests made by the external call interface that the phone
+        // app should dial. It completes them sequentially after its finished 
+        // the previous call.
+        RMessage2       iPendingRequestPointer;
+        
+        // The object responsible for processing external client call requests. 
+        // This is essentially an interface to the phone app engine.
+        
+        CPhCltExtPhoneDialData* iCallArguments;
+
+        // A handle to the subsession that initiated this request.
+        TInt            iSubSessionHandle;
+    };
+
+
+#endif // CPHSRVCALLREQUEST_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/standard/standard_aiw/cphsrvcallrequestmanager.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,111 @@
+/*
+* 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:  Call Request Manager.
+*
+*/
+
+
+#ifndef CPHSRVCALLREQUESTMANAGER_H
+#define CPHSRVCALLREQUESTMANAGER_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include "mphsrvobjectnegotiators.h" 
+#include "mphsrvobjectinitiators.h" 
+#include <cphcltextphonedialdata.h> 
+
+// FORWARD DECLARATIONS
+class CPhSrvCallRequest;
+
+
+// CLASS DECLARATION
+
+/**
+*  Call request manager.
+*
+*  @since 1.0
+*/
+class CPhSrvCallRequestManager : 
+    public CBase, 
+    public MPhSrvNegotiatorCall
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Constructor.
+        */
+        CPhSrvCallRequestManager();
+
+        /**
+        * Destructor.
+        */
+        ~CPhSrvCallRequestManager();
+
+        /**
+        * Symbian 2nd phase constructor.
+        */
+        void ConstructL();
+
+
+    public: // Functions from base classes
+
+        /**
+        * @see MPhSrvNegotiatorCallBase
+        */
+        void NegotiatorDialL( 
+            const RMessage2& aMessage,  
+            CPhCltExtPhoneDialData& aArgs,
+            CPhSrvSubSessionBase& aSubSession );
+
+        /**
+        * @see MPhSrvNegotiatorCallBase
+        */
+        void NegotiatorDialCancelL( CPhSrvSubSessionBase& aSubSession );
+
+        /**
+        * @see MPhSrvNegotiatorCall
+        */
+        void SetNegotiatorReadyCallL( MPhSrvInitiatorCall& aInitiator );
+
+        /**
+        * @see MPhSrvNegotiatorCall
+        */
+        void SetNegotiatorReadyCallCancel( MPhSrvInitiatorCall& aInitiator );
+
+        /**
+        * @see MPhSrvNegotiatorCall
+        */
+        void SetNegotiatorAttemptedCallResponseValue( 
+            TPhCltPhoneResults aResult );
+
+
+    private:    // Data
+
+        // A list of requests made by the external call interface that the phone
+        // app should dial. It completes them sequentially after its finished 
+        // the previous call.
+        // Index 0 is reserved for the emergency call.
+        RPointerArray<CPhSrvCallRequest>*  iOutstandingRequestsCall;
+
+        // The object responsible for processing external client call requests. 
+        // This is essentially an interface to the phone app engine.
+        MPhSrvInitiatorCall*               iCallInitiator;
+    };
+
+
+#endif // CPHSRVCALLREQUESTMANAGER_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/standard/standard_aiw/cphsrvemergencyrequestmanager.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,118 @@
+/*
+* 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:  Emergency call request manager.
+*
+*/
+
+
+#ifndef CPHSRVEMERGENCYREQUESTMANAGER_H
+#define CPHSRVEMERGENCYREQUESTMANAGER_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include "mphsrvemergencynegotiators.h" 
+#include "mphsrvemergencyinitiators.h" 
+
+
+// FORWARD DECLARATIONS
+class CPhSrvCallRequest;
+
+
+// CLASS DECLARATION
+
+/**
+*  Call request manager.
+*
+*  @since 1.0
+*/
+class CPhSrvEmergencyRequestManager : 
+    public CBase, 
+    public MPhSrvEmergencyNegotiatorCall
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Constructor.
+        */
+        CPhSrvEmergencyRequestManager();
+
+        /**
+        * Destructor.
+        */
+        ~CPhSrvEmergencyRequestManager();
+
+        /**
+        * Symbian 2nd phase constructor.
+        */
+        void ConstructL();
+
+
+    public: // Functions from base classes
+
+        /**
+        * @see MPhSrvEmergencyCallBase
+        */
+        void EmergencyDialL( const RMessage2& aMessage );
+           
+        /**
+        * @see MPhSrvEmergencyCallBase
+        */
+        void EmergencyDialCancel();
+
+        /**
+        * @see MPhSrvNegotiatorCall
+        */
+        void SetNegotiatorReadyCall( MPhSrvEmergencyCall& aInitiator );
+
+        /**
+        * @see MPhSrvNegotiatorCall
+        */
+        void SetNegotiatorReadyCallCancel( MPhSrvEmergencyCall& aInitiator );
+
+        /**
+        * @see MPhSrvNegotiatorCall
+        */
+        void SetNegotiatorAttemptedCallResponseValue( 
+            TPhCltPhoneResults aResult );
+
+    private:
+        
+        /**
+        * Does emergency call request
+        */
+        void DoMakeEmergencyDial( const RMessage2& aMessage );    
+                    
+    private:    // Data
+
+        // The object responsible for processing external client call requests. 
+        // This is essentially an interface to the phone app engine.
+        MPhSrvEmergencyCall* iEmergencyInitiator;
+        
+        // Pending request message pointer 
+        RMessagePtr2 iPendingRequestPointer;
+        
+        // Pending request message 
+        RMessage2 iPendingRequest;
+        
+        // Pending request flag 
+        TBool iIsRequestPending;
+        
+    };
+
+
+#endif // CPHSRVEMERGENCYREQUESTMANAGER_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/standard/standard_aiw/cphsrvsubsessionemergencynum.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,76 @@
+/*
+* 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:  Emergency Number Subsession.
+*
+*/
+
+#ifndef CPHSRVSUBSESSIONEMERGENCYNUM_H
+#define CPHSRVSUBSESSIONEMERGENCYNUM_H
+
+
+// INCLUDES
+#include "cphsrvsubsessionbase.h" 
+
+
+// CLASS DECLARATION
+
+/**
+*  Emergency Number subsession.
+*
+*  @since 1.0
+*/
+class CPhSrvSubSessionEmergencyNum : public CPhSrvSubSessionBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Constructor
+        *
+        * @param aSession The session where this subsession belongs. 
+        */
+        CPhSrvSubSessionEmergencyNum( CPhSrvSession& aSession );
+
+        /**
+        * @see CPhSrvSubSessionBase
+        */
+        void ConstructL();
+
+
+    private:
+        /**
+        * @see MPhSrvMessageDecoder
+        */
+        TBool PhSrvMessageDecoderCanProcessMessage( TInt aFunction );
+
+        /**
+        * @see MPhSrvMessageProcessor
+        */
+        void PhSrvMessageProcessorHandleMessageL( const RMessage2& aMessage );
+
+    private: // SubSession function handlers
+
+        void CmdSubSessionCloseL( const RMessage2& aMessage );
+
+        void CmdSubSessionIsEmergencyNumberL( const RMessage2& aMessage );
+        
+        void CmdSubSessionDialEmergencyCallL( const RMessage2& aMessage );
+        
+        void CmdSubSessionDialEmergencyCallCancelL( const RMessage2& aMessage ); 
+
+    };
+
+#endif // CPHSRVSUBSESSIONEMERGENCYNUM_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/standard/standard_aiw/cphsrvsubsessionnotifier.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,191 @@
+/*
+* 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:  Sub Session Notifier.
+*
+*/
+
+
+#ifndef CPHSRVSUBSESSIONNOTIFIER_H
+#define CPHSRVSUBSESSIONNOTIFIER_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include <cphcltextphonedialdata.h> 
+#include <cphcltemergencycall.h> // for TPhCltEmergencyNumber 
+#include "cphsrvsubsessionbase.h" 
+#include "mphsrvemergencyinitiators.h" 
+#include "mphsrvobjectinitiators.h" 
+#include "mphsrvcomhandinitiators.h" 
+
+// CLASS DECLARATION
+
+/**
+*  Call Notifier Subsession.
+*
+*  @since 1.0
+*/
+class CPhSrvSubSessionNotifier :
+    public CPhSrvSubSessionBase, 
+    public MPhSrvComHandInitiator, 
+    public MPhSrvInitiatorCall,
+    public MPhSrvEmergencyCall
+    {
+    private:
+
+
+    public:  // Constructors and destructor
+
+        /**
+        * Constructor
+        *
+        * @param aSession The session where this subsession belongs. 
+        */
+        CPhSrvSubSessionNotifier( CPhSrvSession& aSession );
+
+        /**
+        * Destructor
+        */
+        ~CPhSrvSubSessionNotifier();
+
+        /**
+        * Symbian 2nd phase constructor.
+        */
+        void ConstructL();
+       
+
+    private:  // Functions from base classes
+
+        /**
+        * @see MPhSrvMessageDecoder
+        */
+        TBool PhSrvMessageDecoderCanProcessMessage( TInt aFunction );
+
+        /**
+        * @see MPhSrvMessageProcessor
+        */
+        void PhSrvMessageProcessorHandleMessageL( const RMessage2& aMessage );
+
+        /**
+        * Called by the notification manager when the phone app engine should
+        * be informed that it needs to make a call.
+        *
+        * @see MPhSrvInitiatorCall
+        */      
+        void InitiatorMakeAsynchronousCallL( CPhCltExtPhoneDialData& aArgs  );
+        /**                             
+        * Does this subsession have a pending request?
+        *
+        * @see MPhSrvInitiatorCall
+        */
+        TBool InitiatorIsReadyToMakeCall() const;
+        
+        /**
+        * Called by the notification manager when the phone app engine should
+        * be informed that it needs to make a call.
+        *
+        * @see MPhSrvInitiatorCall
+        */
+        void InitiatorMakeEmergencyCall( const RMessage2& aMessage );
+        
+        /**
+        * Does this subsession have a pending request?
+        *
+        * @see MPhSrvInitiatorCall
+        */
+        TBool InitiatorIsReadyToMakeEmergencyCall() const;
+        
+        /**
+        * @see MPhSrvComHandInitiator
+        */
+        void InitiatorMakeAsynchronousComHandRequest( 
+            const TPhCltComHandCommandParameters& 
+                aParams );
+        
+        /**
+        * @see MPhSrvComHandInitiator
+        */
+        TBool InitiatorIsReadyToPerformRequest() const;
+
+    private: // SubSession function handlers
+
+        void CmdSubSessionCloseL( const RMessage2& aMessage );
+
+        void CmdSubSessionNotifyCallRequestL( const RMessage2& aMessage );
+
+        void CmdSubSessionNotifyCallRequestCancelL( const RMessage2& aMessage );
+
+        void CmdSubSessionReportCallResultL( const RMessage2& aMessage );
+        
+        void CmdSubSessionDialDataL ( const RMessage2& aMessage );
+
+        void CmdSubSessionNotifyEmergencyL ( const RMessage2& aMessage );
+
+        void CmdSubSessionNotifyEmergencyCancel( const RMessage2& aMessage );
+
+        void CmdSubSessionReportEmergencyCallResultL( const RMessage2& aMessage );
+
+        void CmdSubSessionComHandNotifyRequestL( 
+            const RMessage2& aMessage );
+
+        void CmdSubSessionComHandNotifyRequestCancelL( 
+            const RMessage2& aMessage );
+
+        void CmdSubSessionComHandNotifyReportL( 
+            const RMessage2& aMessage );
+            
+        /**
+        * Clones call arguments to object
+        *
+        * @param aArgs Arguments to be cloned.
+        */    
+        void CmdSubSessionCloneDialDataL( CPhCltExtPhoneDialData& aArgs );
+        
+    private:     // Data
+
+        // Indicates whether we have an pending request
+        TBool                            iHavePendingDialRequestPointer;
+    
+        // Initialized when the phone app engine is 
+        // ready to handle dial requests.
+        RMessage2                        iPendingDialRequestPointer;
+        
+        // Indicates whether we have an pending request
+        TBool                            iHavePendingEmergencyRequestPointer;
+    
+        // Initialized when the phone app engine is 
+        // ready to handle dial requests.
+        RMessage2                        iPendingEmergencyRequestPointer;
+        
+        //Dialdata pointer used to save dialdata arguments (for phone)
+        CPhCltExtPhoneDialData*          iDialData;
+        
+        TPhCltEmergencyNumber            iTelNumber;
+   
+        TPckg< TPhCltEmergencyNumber >   iTelNumberPckg;
+        
+        // Indicates whether we have an pending request
+        TBool                       iHavePendingComHandRequestPointer;
+    
+        // Initialized when the phone app engine is 
+        // ready to handle command handler requests.
+        RMessage2                   iPendingComHandRequestPointer;
+        
+
+    };
+
+#endif      // CPHSRVSUBSESSIONNOTIFIER_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/standard/standard_aiw/mphsrvemergencyinitiators.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Object Initiators.
+*
+*/
+
+
+#ifndef MPHSRVEMERGENCYINITIATORS_H
+#define MPHSRVEMERGENCYINITIATORS_H
+
+
+// INCLUDES
+#include <e32base.h>
+
+
+// FORWARD DECLARATIONS
+
+
+// CLASS DECLARATION
+
+/**
+*  Initiator functions class.
+*
+*  @since 1.0 
+*/
+class MPhSrvEmergencyCall
+    {
+    public: // New functions
+
+        /**
+        * Called by the call manager when it wants to make a emergency call response
+        * to a request from the external call interface.
+        *
+        */
+        virtual void InitiatorMakeEmergencyCall( const RMessage2& aMessage )=0;//const TPhCltTelephoneNumber aNumber ) =0;
+        
+        /**
+        * Called by the call manager to find out if there is a registered
+        * notification handler .
+        *
+        * @return ETrue if there is pending notification request.
+        */
+        virtual TBool InitiatorIsReadyToMakeEmergencyCall() const = 0;
+       
+    };
+
+#endif // MPHSRVEMERGENCYINITIATORS_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/standard/standard_aiw/mphsrvemergencynegotiators.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,107 @@
+/*
+* 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:  Object Negotiators.
+*
+*/
+
+
+#ifndef MPHSRVEMERGENCYNEGOTIATORS_H
+#define MPHSRVEMERGENCYNEGOTIATORS_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include <phclttypes.h> 
+
+
+// FORWARD DECLARATIONS
+class MPhSrvEmergencyCall;
+class CPhSrvSubSessionBase;
+
+
+// CLASS DECLARATION
+
+/**
+*  Base class for call negotiators.
+*
+*  @since 1.0
+*/
+class MPhSrvEmergencyCallBase
+    {
+    public: // New functions
+
+        /**
+        * Makes an dial request.
+        *
+        * @param aMessage Message to be negotiated.
+        * @param aArgs Call arguments.
+        * @param aSubSession Subsession for dial.
+        */
+        virtual void EmergencyDialL( 
+           const RMessage2& aMessage) = 0;
+           
+          
+        /**
+        * Cancel's an oustanding dial request. If the specified subsession 
+        * doesn't have an oustanding dial request, then the subsession is 
+        * panicked.
+        *
+        * @param aSubSession Subsession that has the dial request.
+        */
+        virtual void EmergencyDialCancel() = 0;
+    };
+
+/**
+*  Abstract call negotiators class.
+*
+*  @since 1.0
+*/
+class MPhSrvEmergencyNegotiatorCall : public MPhSrvEmergencyCallBase
+    {
+    public: // New functions
+
+        /**
+        * Called by the call notifier subsession when it's ready to negotiate
+        * (make another call) with the external call interface.
+        *
+        * @param aInitiator Call initiator instance.
+        */
+        virtual void SetNegotiatorReadyCall( 
+            MPhSrvEmergencyCall& aInitiator ) = 0;
+
+        /**
+        * Called by the call notifier subsession when it isn't going to be
+        * available to make further calls (session has closed)
+        *
+        * @param aInitiator Call initiator instance.
+        */
+        virtual void SetNegotiatorReadyCallCancel( 
+            MPhSrvEmergencyCall& aInitiator ) = 0;
+
+        /**
+        * Called by the call notifier subsession when it's attempted to make a
+        * call - the call negotiator can then inform the external call 
+        * interface of the result.
+        *
+        * @param aResult Result of the call attempt.
+        */
+        virtual void SetNegotiatorAttemptedCallResponseValue( 
+            TPhCltPhoneResults aResult ) = 0;
+    };
+
+
+#endif // MPHSRVEMERGENCYNEGOTIATORS_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/standard/standard_aiw/mphsrvemergencynumbermanager.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Emergency Number Manager.
+*
+*/
+
+
+#ifndef MPHSRVEMERGENCYNUMBERMANAGER_H
+#define MPHSRVEMERGENCYNUMBERMANAGER_H
+
+// INCLUDES
+#include "phcltclientserver.h" 
+#include <rphcltemergencycall.h> 
+
+// FORWARD DECLARATIONS
+
+
+// CLASS DECLARATION
+
+/**
+*  The interface to the emergency number manager.
+*
+*  @since 1.0 
+*/
+class MPhSrvEmergencyNumberManager
+    {
+    public:  // New functions
+
+        /**
+        * Checks aNumber to see if it qualifies as an emergency number.
+        * 
+        * @param aNumber Number to be checked.
+        * @param aMode Emergency number query check mode.
+        * @return True if the specified number is an emergency number.
+        */
+        virtual TBool EmergencyNumberManagerIsEmergencyNumberL(
+            TDes& aNumber, 
+            TPhCltEmergencyNumberQueryMode aMode ) = 0;
+    };
+
+
+#endif // MPHSRVEMERGENCYNUMBERMANAGER_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/standard/standard_aiw/mphsrvobjectinitiators.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Object Initiators.
+*
+*/
+
+
+#ifndef MPHSRVOBJECTINITIATORS_H
+#define MPHSRVOBJECTINITIATORS_H
+
+
+// INCLUDES
+#include <e32base.h>
+
+
+// FORWARD DECLARATIONS
+class CPhCltExtPhoneDialData;
+
+// CLASS DECLARATION
+
+/**
+*  Initiator functions class.
+*
+*  @since 1.0 
+*/
+class MPhSrvInitiatorCall
+    {
+    public: // New functions
+
+        /**
+        * Called by the call manager when it wants to make a call (in response
+        * to a request from the external call interface).
+        *
+        * @param aArgs The call parameters.
+        */
+        virtual void InitiatorMakeAsynchronousCallL( 
+            CPhCltExtPhoneDialData& aArgs ) =0;
+        /**
+        * Called by the call manager to find out if there is a registered
+        * notification handler.
+        *
+        * @return ETrue if there is pending notification request.
+        */
+        virtual TBool InitiatorIsReadyToMakeCall() const = 0;
+       
+    };
+
+#endif // MPHSRVOBJECTINITIATORS_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/standard/standard_aiw/mphsrvobjectnegotiators.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,110 @@
+/*
+* 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:  Object Negotiators.
+*
+*/
+
+
+#ifndef MPHSRVOBJECTNEGOTIATORS_H
+#define MPHSRVOBJECTNEGOTIATORS_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include <phclttypes.h> 
+#include <cphcltextphonedialdata.h> 
+
+// FORWARD DECLARATIONS
+class MPhSrvInitiatorCall;
+class MPhSrvInitiatorStatus;
+class CPhSrvSubSessionBase;
+
+
+// CLASS DECLARATION
+
+/**
+*  Base class for call negotiators.
+*
+*  @since 1.0
+*/
+class MPhSrvNegotiatorCallBase
+    {
+    public: // New functions
+
+        /**
+        * Makes an dial request.
+        *
+        * @param aMessage Message to be negotiated.
+        * @param aArgs Call arguments.
+        * @param aSubSession Subsession for dial.
+        */
+        virtual void NegotiatorDialL( 
+            const RMessage2& aMessage, 
+            CPhCltExtPhoneDialData& aArgs, 
+            CPhSrvSubSessionBase& aSubSession ) = 0;
+
+        /**
+        * Cancel's an oustanding dial request. If the specified subsession 
+        * doesn't have an oustanding dial request, then the subsession is 
+        * panicked.
+        *
+        * @param aSubSession Subsession that has the dial request.
+        */
+        virtual void NegotiatorDialCancelL( 
+            CPhSrvSubSessionBase& aSubSession ) = 0;
+    };
+
+
+/**
+*  Abstract call negotiators class.
+*
+*  @since 1.0
+*/
+class MPhSrvNegotiatorCall : public MPhSrvNegotiatorCallBase
+    {
+    public: // New functions
+
+        /**
+        * Called by the call notifier subsession when it's ready to negotiate
+        * (make another call) with the external call interface.
+        *
+        * @param aInitiator Call initiator instance.
+        */
+        virtual void SetNegotiatorReadyCallL( 
+            MPhSrvInitiatorCall& aInitiator ) = 0;
+
+        /**
+        * Called by the call notifier subsession when it isn't going to be
+        * available to make further calls (session has closed)
+        *
+        * @param aInitiator Call initiator instance.
+        */
+        virtual void SetNegotiatorReadyCallCancel( 
+            MPhSrvInitiatorCall& aInitiator ) = 0;
+
+        /**
+        * Called by the call notifier subsession when it's attempted to make a
+        * call - the call negotiator can then inform the external call 
+        * interface of the result.
+        *
+        * @param aResult Result of the call attempt.
+        */
+        virtual void SetNegotiatorAttemptedCallResponseValue( 
+            TPhCltPhoneResults aResult ) = 0;
+    };
+
+#endif // MPHSRVOBJECTNEGOTIATORS_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/standard/standard_noaiw/cphsrvcallrequest.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,160 @@
+/*
+* 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:  Call Request.
+*
+*/
+
+
+#ifndef CPHSRVCALLREQUEST_H
+#define CPHSRVCALLREQUEST_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include <phclttypes.h> 
+
+
+// CONSTANTS
+
+// Default emergency number
+_LIT( KPhSrvUsedEmergencyCallNumber , "112" );
+
+
+// FORWARD DECLARATIONS
+class CPhSrvSubSessionBase;
+
+
+// CLASS DECLARATION
+
+/**
+*  Call request class.
+*
+*  @since 1.0
+*/
+class CPhSrvCallRequest : public CBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Tell the external client (who requested that a number was called) the
+        * result of their actions. This information has come via the notifier
+        * (i.e. the phone app engine).
+        *
+        * @param aMessage The outstanding client request which will be completed
+        *                 when the call initiation outcome is known.
+        * @param aArguments The call arguments, such as phone number, contact 
+        *                   id, client window group etc.
+        * @param aSubSessionHandle The subsession handle.
+        * @return Pointer to created CPhSrvCallRequest instance.
+        */
+        static CPhSrvCallRequest* NewLC(
+            const RMessage2& aMessage, 
+            const TPhCltCallArgs& aArguments, 
+            TInt aSubSessionHandle );
+
+        /**
+        * Constructor for Emergency call object only.
+        */
+        static CPhSrvCallRequest* NewL();
+
+
+    public: // New functions
+
+        /**
+        * Tell the external client (who requested that a number was called) the
+        * result of their actions. This information has come via the notifier
+        * (i.e. the phone app engine).
+        *
+        * @param aResultOfAttemptingCall 
+        *        The result of initiating an earlier call.
+        */
+        void InformOfCallAttemptResult( 
+            TPhCltPhoneResults aResultOfAttemptingCall );
+
+        /**
+        * Cancel the asynchronous dial process. Completes client request with
+        * KErrCancel
+        */
+        void Cancel();
+
+        /**
+        * The sub-session handle.
+        *
+        * @return The unique handle associated with the subsession which 
+        *         initiated a call request.
+        */
+        TInt SubSessionHandle() const;
+
+        /**
+        * The arguments for the call.
+        *
+        * @return The call arguments.
+        */
+        const TPhCltCallArgs& CallArguments() const;
+
+        /**
+        * Update Emergency call status
+        * @param aMessage The outstanding client request which will be completed
+        *                 when the call initiation outcome is known.
+        * @param aArguments The call arguments, such as phone number, 
+        *                   contact id, client window group etc.
+        * @param aSubSessionHandle Subsession handle to emergency call.
+        */
+        void UpdateEmercgencyCall( 
+            const RMessage2& aMessage, 
+            const TPhCltCallArgs& aArguments, 
+            TInt aSubSessionHandle );
+
+        /**
+        * Clear the Emergency call object data.
+        */
+        void ClearEmergencyCall();
+
+
+    private:
+
+        /**
+        * C++ constructor
+        */
+        CPhSrvCallRequest( 
+            const RMessage2& aMessage, 
+            const TPhCltCallArgs& aArguments, 
+            TInt aSubSessionHandle );
+
+        /**
+        * C++ constructor
+        */
+        CPhSrvCallRequest();
+
+
+    private:  // Data
+
+        // A list of requests made by the external call interface that the phone
+        // app should dial. It completes them sequentially after its finished 
+        // the previous call.
+        RMessage2       iPendingRequestPointer;
+
+        // The object responsible for processing external client call requests. 
+        // This is essentially an interface to the phone app engine.
+        TPhCltCallArgs  iCallArguments;
+
+        // A handle to the subsession that initiated this request.
+        TInt            iSubSessionHandle;
+    };
+
+
+#endif // CPHSRVCALLREQUEST_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/standard/standard_noaiw/cphsrvcallrequestmanager.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,111 @@
+/*
+* 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:  Call Request Manager.
+*
+*/
+
+
+#ifndef CPHSRVCALLREQUESTMANAGER_H
+#define CPHSRVCALLREQUESTMANAGER_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include "mphsrvobjectnegotiators.h" 
+#include "mphsrvobjectinitiators.h" 
+
+
+// FORWARD DECLARATIONS
+class CPhSrvCallRequest;
+
+
+// CLASS DECLARATION
+
+/**
+*  Call request manager.
+*
+*  @since 1.0
+*/
+class CPhSrvCallRequestManager : 
+    public CBase, 
+    public MPhSrvNegotiatorCall
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Constructor.
+        */
+        CPhSrvCallRequestManager();
+
+        /**
+        * Destructor.
+        */
+        ~CPhSrvCallRequestManager();
+
+        /**
+        * Symbian 2nd phase constructor.
+        */
+        void ConstructL();
+
+
+    public: // Functions from base classes
+
+        /**
+        * @see MPhSrvNegotiatorCallBase
+        */
+        void NegotiatorDialL( 
+            const RMessage2& aMessage, 
+            const TPhCltCallArgs& aArgs, 
+            CPhSrvSubSessionBase& aSubSession );
+
+        /**
+        * @see MPhSrvNegotiatorCallBase
+        */
+        void NegotiatorDialCancel( CPhSrvSubSessionBase& aSubSession );
+
+        /**
+        * @see MPhSrvNegotiatorCall
+        */
+        void SetNegotiatorReadyCall( MPhSrvInitiatorCall& aInitiator );
+
+        /**
+        * @see MPhSrvNegotiatorCall
+        */
+        void SetNegotiatorReadyCallCancel( MPhSrvInitiatorCall& aInitiator );
+
+        /**
+        * @see MPhSrvNegotiatorCall
+        */
+        void SetNegotiatorAttemptedCallResponseValue( 
+            TPhCltPhoneResults aResult );
+
+
+    private:    // Data
+
+        // A list of requests made by the external call interface that the phone
+        // app should dial. It completes them sequentially after its finished 
+        // the previous call.
+        // Index 0 is reserved for the emergency call.
+        RPointerArray<CPhSrvCallRequest>*  iOutstandingRequestsCall;
+
+        // The object responsible for processing external client call requests. 
+        // This is essentially an interface to the phone app engine.
+        MPhSrvInitiatorCall*               iCallInitiator;
+    };
+
+
+#endif // CPHSRVCALLREQUESTMANAGER_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/standard/standard_noaiw/cphsrvsubsessionemergencynum.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,72 @@
+/*
+* 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:  Emergency Number Subsession.
+*
+*/
+
+#ifndef CPHSRVSUBSESSIONEMERGENCYNUM_H
+#define CPHSRVSUBSESSIONEMERGENCYNUM_H
+
+
+// INCLUDES
+#include "cphsrvsubsessionbase.h" 
+
+
+// CLASS DECLARATION
+
+/**
+*  Emergency Number subsession.
+*
+*  @since 1.0
+*/
+class CPhSrvSubSessionEmergencyNum : public CPhSrvSubSessionBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Constructor
+        *
+        * @param aSession The session where this subsession belongs. 
+        */
+        CPhSrvSubSessionEmergencyNum( CPhSrvSession& aSession );
+
+        /**
+        * @see CPhSrvSubSessionBase
+        */
+        void ConstructL();
+
+
+    private:
+        /**
+        * @see MPhSrvMessageDecoder
+        */
+        TBool PhSrvMessageDecoderCanProcessMessage( TInt aFunction );
+
+        /**
+        * @see MPhSrvMessageProcessor
+        */
+        void PhSrvMessageProcessorHandleMessageL( const RMessage2& aMessage );
+
+    private: // SubSession function handlers
+
+        void CmdSubSessionCloseL( const RMessage2& aMessage );
+
+        void CmdSubSessionIsEmergencyNumberL( const RMessage2& aMessage );
+
+    };
+
+#endif // CPHSRVSUBSESSIONEMERGENCYNUM_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/standard/standard_noaiw/cphsrvsubsessionnotifier.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,146 @@
+/*
+* 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:  Sub Session Notifier.
+*
+*/
+
+
+#ifndef CPHSRVSUBSESSIONNOTIFIER_H
+#define CPHSRVSUBSESSIONNOTIFIER_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include "cphsrvsubsessionbase.h" 
+#include "mphsrvobjectinitiators.h" 
+#include "cphsrvsubsessionnotifier.h" 
+#include "mphsrvcomhandinitiators.h" 
+
+// CLASS DECLARATION
+
+/**
+*  Call Notifier Subsession.
+*
+*  @since 1.0
+*/
+class CPhSrvSubSessionNotifier :
+    public CPhSrvSubSessionBase, 
+    public MPhSrvInitiatorCall,
+    public MPhSrvComHandInitiator
+    {
+    private:
+
+
+    public:  // Constructors and destructor
+
+        /**
+        * Constructor
+        *
+        * @param aSession The session where this subsession belongs. 
+        */
+        CPhSrvSubSessionNotifier( CPhSrvSession& aSession );
+
+        /**
+        * Destructor
+        */
+        ~CPhSrvSubSessionNotifier();
+
+        /**
+        * Symbian 2nd phase constructor.
+        */
+        void ConstructL();
+
+
+    private:  // Functions from base classes
+
+        /**
+        * @see MPhSrvMessageDecoder
+        */
+        TBool PhSrvMessageDecoderCanProcessMessage( TInt aFunction );
+
+        /**
+        * @see MPhSrvMessageProcessor
+        */
+        void PhSrvMessageProcessorHandleMessageL( const RMessage2& aMessage );
+
+        /**
+        * Called by the notification manager when the phone app engine should
+        * be informed that it needs to make a call.
+        *
+        * @see MPhSrvInitiatorCall
+        */
+        void InitiatorMakeAsynchronousCall( const TPhCltCallArgs& aArgs );
+
+        /**
+        * Does this subsession have a pending request?
+        *
+        * @see MPhSrvInitiatorCall
+        */
+        TBool InitiatorIsReadyToMakeCall() const;
+
+        /**
+        * @see MPhSrvComHandInitiator
+        */
+        void InitiatorMakeAsynchronousComHandRequest( 
+            const TPhCltComHandCommandParameters& 
+                aParams );
+        
+        
+        /**
+        * @see MPhSrvComHandInitiator
+        */
+        TBool InitiatorIsReadyToPerformRequest() const;
+
+    private: // SubSession function handlers
+
+        void CmdSubSessionCloseL( const RMessage2& aMessage );
+
+        void CmdSubSessionNotifyCallRequestL( const RMessage2& aMessage );
+
+        void CmdSubSessionNotifyCallRequestCancelL( const RMessage2& aMessage );
+
+        void CmdSubSessionReportCallResultL( const RMessage2& aMessage );
+        
+        void CmdSubSessionComHandNotifyRequestL( 
+            const RMessage2& aMessage );
+
+        void CmdSubSessionComHandNotifyRequestCancelL( 
+            const RMessage2& aMessage );
+
+        void CmdSubSessionComHandNotifyReportL( 
+            const RMessage2& aMessage );
+
+    private:     // Data
+
+        // Indicates whether we have an pending request
+        TBool                            iHavePendingDialRequestPointer;
+    
+        // Initialized when the phone app engine is 
+        // ready to handle dial requests.
+        RMessage2                        iPendingDialRequestPointer;
+        
+        // Indicates whether we have an pending request
+        TBool                       iHavePendingComHandRequestPointer;
+    
+        // Initialized when the phone app engine is 
+        // ready to handle command handler requests.
+        RMessage2                   iPendingComHandRequestPointer;
+        
+
+    };
+
+#endif      // CPHSRVSUBSESSIONNOTIFIER_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/standard/standard_noaiw/mphsrvemergencynumbermanager.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Emergency Number Manager.
+*
+*/
+
+
+#ifndef MPHSRVEMERGENCYNUMBERMANAGER_H
+#define MPHSRVEMERGENCYNUMBERMANAGER_H
+
+
+// INCLUDES
+#include  <rphcltemergencynumber.h> 
+
+// FORWARD DECLARATIONS
+
+
+// CLASS DECLARATION
+
+/**
+*  The interface to the emergency number manager.
+*
+*  @since 1.0 
+*/
+class MPhSrvEmergencyNumberManager
+    {
+    public:  // New functions
+
+        /**
+        * Checks aNumber to see if it qualifies as an emergency number.
+        * 
+        * @param aNumber Number to be checked.
+        * @param aMode Emergency number query check mode.
+        * @return True if the specified number is an emergency number.
+        */
+        virtual TBool EmergencyNumberManagerIsEmergencyNumberL(
+            TDes& aNumber, 
+            TPhCltEmergencyNumberQueryMode aMode ) = 0;
+    };
+
+
+#endif // MPHSRVEMERGENCYNUMBERMANAGER_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/standard/standard_noaiw/mphsrvobjectinitiators.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Object Initiators.
+*
+*/
+
+
+#ifndef MPHSRVOBJECTINITIATORS_H
+#define MPHSRVOBJECTINITIATORS_H
+
+
+// INCLUDES
+#include <e32base.h>
+
+
+// FORWARD DECLARATIONS
+class TPhCltCallArgs;
+
+
+// CLASS DECLARATION
+
+/**
+*  Initiator functions class.
+*
+*  @since 1.0 
+*/
+class MPhSrvInitiatorCall
+    {
+    public: // New functions
+
+        /**
+        * Called by the call manager when it wants to make a call (in response
+        * to a request from the external call interface).
+        *
+        * @param aArgs The call parameters.
+        */
+        virtual void InitiatorMakeAsynchronousCall( 
+            const TPhCltCallArgs& aArgs ) = 0;
+
+        /**
+        * Called by the call manager to find out if there is a registered
+        * notification handler.
+        *
+        * @return ETrue if there is pending notification request.
+        */
+        virtual TBool InitiatorIsReadyToMakeCall() const = 0;
+    };
+
+#endif // MPHSRVOBJECTINITIATORS_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/standard/standard_noaiw/mphsrvobjectnegotiators.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,110 @@
+/*
+* 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:  Object Negotiators.
+*
+*/
+
+
+#ifndef MPHSRVOBJECTNEGOTIATORS_H
+#define MPHSRVOBJECTNEGOTIATORS_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include <phclttypes.h> 
+
+
+// FORWARD DECLARATIONS
+class MPhSrvInitiatorCall;
+class MPhSrvInitiatorStatus;
+class CPhSrvSubSessionBase;
+
+
+// CLASS DECLARATION
+
+/**
+*  Base class for call negotiators.
+*
+*  @since 1.0
+*/
+class MPhSrvNegotiatorCallBase
+    {
+    public: // New functions
+
+        /**
+        * Makes an dial request.
+        *
+        * @param aMessage Message to be negotiated.
+        * @param aArgs Call arguments.
+        * @param aSubSession Subsession for dial.
+        */
+        virtual void NegotiatorDialL( 
+            const RMessage2& aMessage, 
+            const TPhCltCallArgs& aArgs, 
+            CPhSrvSubSessionBase& aSubSession ) = 0;
+
+        /**
+        * Cancel's an oustanding dial request. If the specified subsession 
+        * doesn't have an oustanding dial request, then the subsession is 
+        * panicked.
+        *
+        * @param aSubSession Subsession that has the dial request.
+        */
+        virtual void NegotiatorDialCancel( 
+            CPhSrvSubSessionBase& aSubSession ) = 0;
+    };
+
+
+/**
+*  Abstract call negotiators class.
+*
+*  @since 1.0
+*/
+class MPhSrvNegotiatorCall : public MPhSrvNegotiatorCallBase
+    {
+    public: // New functions
+
+        /**
+        * Called by the call notifier subsession when it's ready to negotiate
+        * (make another call) with the external call interface.
+        *
+        * @param aInitiator Call initiator instance.
+        */
+        virtual void SetNegotiatorReadyCall( 
+            MPhSrvInitiatorCall& aInitiator ) = 0;
+
+        /**
+        * Called by the call notifier subsession when it isn't going to be
+        * available to make further calls (session has closed)
+        *
+        * @param aInitiator Call initiator instance.
+        */
+        virtual void SetNegotiatorReadyCallCancel( 
+            MPhSrvInitiatorCall& aInitiator ) = 0;
+
+        /**
+        * Called by the call notifier subsession when it's attempted to make a
+        * call - the call negotiator can then inform the external call 
+        * interface of the result.
+        *
+        * @param aResult Result of the call attempt.
+        */
+        virtual void SetNegotiatorAttemptedCallResponseValue( 
+            TPhCltPhoneResults aResult ) = 0;
+    };
+
+#endif // MPHSRVOBJECTNEGOTIATORS_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/ussd/cphsrvussdmanager.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,436 @@
+/*
+* 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:  Handles all the Ussd sessions.
+*
+*/
+
+#ifndef CPHSRVUSSDMANAGER_H
+#define CPHSRVUSSDMANAGER_H
+
+
+// INCLUDES
+#include <etelmm.h>            // ETel
+#include "phcltclientserver.h" 
+#include "mphsrvussdnetworkobserver.h" 
+#include "mphsrvussdreplytimerobserver.h" 
+#include <badesca.h>
+#include <hbdevicemessageboxsymbian.h>
+
+// FORWARD DECLARATIONS
+class RFs;
+class CPhSrvResourceManager;
+class CPhSrvUssdSendHandler;
+class CPhSrvUssdReceiveHandler;
+class CPhSrvUssdReplyTimer;
+class MPhSrvPhoneInterface;
+class MPhSrvUssdMessageSentObserver;
+class CPhSrvUssdSessionCancelWaiter;
+class CPhSrvUssdNotifyNWRelease;
+
+// CLASS DECLARATION
+
+/**
+*  Handles all the Ussd sessions.
+*
+*  @since 1.0
+*/
+class CPhSrvUssdManager : 
+    public CActive, 
+    public MPhSrvUssdNetworkObserver, 
+    public MPhSrvUssdReplyTimerObserver,
+    public MHbDeviceMessageBoxObserver
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * C++ constructor.
+        *
+        * @param aFsSession The file session.
+        * @param aResourceManager The resource manager.
+        */
+        CPhSrvUssdManager( 
+            RFs& aFsSession, 
+            CPhSrvResourceManager& aResourceManager
+         );
+
+        /**
+        * C++ destructor.
+        */
+        ~CPhSrvUssdManager();
+        
+        /**
+        * Symbian OS second phase constructor
+        *
+        * @param aPhoneInterface The phone interfaces.
+        */
+        void ConstructL( MPhSrvPhoneInterface& aPhoneInterface );
+        
+
+    public: // New functions
+        
+        /**
+        * Send the USSD message.
+        * 
+        * @param aMsgData The USSD message to be sent.
+        * @param aMsgAttribute The USSD message attributes.
+        * @param aObserver Observer for sent event.
+        */
+        void SendUssdL( 
+            const TDesC8& aMsgData, 
+            RMobileUssdMessaging::TMobileUssdAttributesV1& aMsgAttribute, 
+            MPhSrvUssdMessageSentObserver& aObserver );
+
+        /**
+        * Cancel sending the USSD.
+        */
+        void SendUssdCancel();
+
+        
+        /**
+        * These are called when status of Ussd application changes.
+        * 
+        * @return 0 if editor should not be cleared.
+        */
+        void InformUssdApplicationStarting();
+        void InformUssdApplicationTerminatingL( const RMessage2& aMessage );
+        TInt InformUssdApplicationToForeground();      
+        void InformUssdApplicationToBackground();
+        
+        /**
+        * Starts the editor.
+        */
+        void RequestStartEditingL();
+
+        /**
+        * SAT starts.
+        *
+        * @param aSatMessage Message to be comleted when session ends.
+        */
+        void InformStartSAT( const RMessage2& aSatMessage );
+
+        /**
+        * SAT ends.
+        */
+        void InformStopSAT();
+        
+        /**
+        * Completes SAT request if it's ongoing.
+        *
+        * @param aReceiveString If session end with a string it is passed
+        *        as a paramter.
+        * @param aError Completion code.
+        * @return The error code of the SAT request.
+        */
+         void CompleteSatL( 
+            TDesC* aReceiveString, 
+            TInt aError );
+        
+    protected: // From base classes
+        
+        /**
+        * @see MPhSrvUssdNetworkObserver
+        */
+        void UssdNetworkObserverHandleSendEventL( TInt aError );
+        
+        /**
+        * @see MPhSrvUssdNetworkObserver
+        */
+        void UssdNetworkObserverHandleReceivedEventL(
+            const TDes8& aMsgData, 
+            const RMobileUssdMessaging::TMobileUssdAttributesV1& 
+                  aMsgAttributes,
+            TInt aError );
+
+        void UssdNetworkObserverHandleNotifyNWReleaseL( 
+        const RMobilePhone::TMobilePhoneSendSSRequestV3 & aReturnResult, 
+        TInt aError );
+        
+        /**
+        * @see MPhSrvUssdReplyTimerObserver
+        */
+        void UssdReplyTimerObserverHandleExpiredL( TInt aError );
+        
+        /**
+        * @see MHbDeviceMessageBoxObserver
+        */        
+        void MessageBoxClosed(const CHbDeviceMessageBoxSymbian* aMessageBox,
+            CHbDeviceMessageBoxSymbian::TButtonId aButton);
+        
+        /*
+        * @see CActive
+        */
+        void RunL();
+        
+        /*
+        * @see CActive
+        */
+        void DoCancel();
+        
+        /*
+        * @see CActive
+        */
+        TInt RunError( TInt aError );
+
+    private: // New functions
+        
+        CPhSrvUssdSendHandler& SendHandlerL();
+
+        void ShowErrorNoteL( TInt aError );
+
+        void DecodeL( 
+            const TDesC8& aSrc, 
+            TDes& aDes, 
+            TUint8 aDcs );
+       
+        void FindFirstCarriageReturnL( 
+            const TDesC8& aBuffer ,
+            TUint& aSkipChars , 
+            TUint& aStartBit );
+        
+        /** Display the "Done" note */
+        void ShowDoneNoteL();
+        
+        /** Check is the ussd app running 
+         * @return app running or not
+         */
+        TBool UssdAppTaskExistsL();
+        
+        // If the notification array is empty, close the session.
+        void TryCloseSession();
+        
+        // Close the session; clear state etc.
+        void CloseSession();
+        
+        /** Second stage handler for received messages 
+         */
+        void UssdHandleReceivedEventL(
+            const TDes8& aMsgData, 
+            const RMobileUssdMessaging::TMobileUssdAttributesV1& 
+                  aMsgAttributes);
+        // Restart the reply timer
+        void RestartReplyTimerL();
+        
+        /** Is the reply timer up and running? */
+        TBool NetworkWaitingForAnAnswer();
+        
+        // Set timer and activate it if there are notifications available
+        void SetActiveIfPendingNotificationsExist();
+        
+        // Launch the global message query (used from RunL)
+        void LaunchGlobalMessageQueryL();
+        
+        // Send an MO ACK message if any such are pending
+        void ProcessMoAcksL();
+        
+        // Trigger an asynchronous call to call ProcessMoAcksL later
+        void AsyncProcessMoAcks();
+        
+        // The static callback function for AsyncProcessMoAcks
+        static TInt MoAckCallback(TAny *);
+        
+        /**
+        * Return boolean value that states whether or not 
+        * indicated feature is supported or not.
+        * 
+        * @since 2.1
+        * @param aFeatureId The feature that is inspected 
+        *        (see values from Telephony_Variant.hrh)
+        * @return ETrue if the feature is supported, EFalse otherwise.
+        */
+        TBool IsTelephonyFeatureSupported( const TInt aFeatureId );
+
+        /**
+        * Play USSD tone.
+        * 
+        * @since 2.1
+        * @return KErrNone if successful, otherwise Symbian error code.
+        */
+        TInt PlayUssdTone();
+
+        /**
+        * Returns telephony variant read-only data.
+        * 
+        * @since 2.1
+        * @return Error code.
+        */
+        TInt GetTelephonyVariantData();
+
+        /**
+        * Send the MO acknowledgement.
+        * 
+        * @since 2.6
+        */
+        void SendMoAcknowledgementL();
+        
+        /**
+        * Return boolean value that states whether notes are shown or not
+        * 
+        * @since 3.0
+        */
+        TBool ShowNotesL();
+        
+        /**
+        * Check notify message array
+        * 
+        * @since 3.1
+        */
+        void CheckArray( );
+        
+        /**
+        * Clears notify message array
+        * 
+        * @since 3.1
+        */
+        void ClearArrayL();
+        
+        /**
+        * Returns notify message count
+        * 
+        * @since 3.1
+        */
+        TInt NotifyCount();
+        
+        
+        /**
+        * Updates Notify Message
+        * 
+        * @since 3.1
+        */
+        void UpdateNotifyMessageL();
+        
+        /**
+        * Turn lights on
+        * 
+        * @since 3.1
+        */
+        void TurnLightsOn();
+        
+        /**
+        * Load default string by QT style localization
+        * @param aText default string id defined by _LIT
+        */        
+        const TPtrC LoadDefaultString( const TDesC& aText );
+
+    private:     // Data
+        
+        // The file session reference.
+        RFs& iFsSession;
+        
+        // The resource manager reference.
+        CPhSrvResourceManager& iResourceManager;
+
+        // The USSD functionality in lower level (TSY).
+        RMobileUssdMessaging iMobileUssdMessaging;
+        
+        // The observer waiting message sent notification.
+        MPhSrvUssdMessageSentObserver* iObserver;
+
+        // The send operation handler.
+        CPhSrvUssdSendHandler* iUssdSendHandler;
+
+        // The receive operation handler.
+        CPhSrvUssdReceiveHandler* iUssdReceiveHandler;
+        
+        // The network release notifier.
+         CPhSrvUssdNotifyNWRelease* iUssdNotifyNWRelease;
+        
+        // The reply timer.
+        CPhSrvUssdReplyTimer* iUssdReplyTimer;
+        
+        // The buffer for received message.
+        TBuf< KPhCltUssdMax8BitCharacters > iReceivedMessage;
+        
+        // The message query for showing USSD operation queries.
+        CHbDeviceMessageBoxSymbian* iDeviceDialog;
+       
+        // Is editor emptied.
+        TBool iEmptyEditor;
+        
+        // Will the editor be started.
+        TBool iStartEditor;
+        
+        // The timer.
+        RTimer iTimer;
+
+        // Is there pending SAT message.
+        TBool iHavePendingSatMessagePointer;
+
+        // The pending SAT message.
+        RMessage2 iPendingSatMessagePointer;
+
+        // Reference to phone interfaces.
+        MPhSrvPhoneInterface* iPhoneInterface;
+
+        // The used DCS in the SAT message
+        TUint iDCS;
+
+        // Softkeys in Global MessageQuery.
+        TInt iSoftkeys;
+
+        // Global MessageQuery launching indicator.
+        TBool iLaunchGMQ;
+
+        // Local Telephony variant read-only data.
+        TInt iVariantReadOnlyValues;
+
+        // The buffer for received decoded message.
+        TBuf< KPhCltUssdMax8BitCharacters > iDecodedMessage;
+
+        // If ETrue, then the last received USSD message was EUssdMtNotify.
+        TBool iNotifyMessage;
+        
+        //NotifyNetWorkRelease return result
+        RMobilePhone::TMobilePhoneSendSSRequestV3 iReturnResult;
+        
+        //NotifyNetWorkRelease return result
+        RMobilePhone::TMobilePhoneSendSSRequestV3Pckg iReturnResultPckg;
+        
+        // Array for notify messages
+        CDesCArray* iNotifyArray;
+        
+        //Sending Release status
+        TBool iSendRelease;
+
+        // Notify array reset status
+        TBool iClearArray;
+
+        // Sat cancel status
+        TBool iSatCanceled;
+        
+        // Show Done note
+        TBool iShowDone;
+
+        // Checks if received message type is Reply
+        TBool iMsgTypeReply;
+        
+        // Has the transaction been closed or not
+        TBool iNetworkReleased;
+        
+        // Is the current send operation an MO ACK message or not 
+        TBool iSendingAck;
+        
+        // Number of MO ACK messages pending to be sent. Normally max 2.
+        TInt iAcksToBeSent;
+        
+        // An asynchronous callback for sending MO ACK messages
+        CAsyncCallBack* iMoAckCallback;
+        
+        HBufC* iTextBuffer;
+
+    };
+    
+#endif // CPHSRVUSSDMANAGER_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/ussd/cphsrvussdnotifynwrelease.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,126 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Get network message.
+*
+*/
+
+
+#ifndef CPHSRVUSSDNOTIFYNWRELEASE_H
+#define CPHSRVUSSDNOTIFYNWRELEASE_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include <etelmm.h>            // ETel
+
+
+// FORWARD DECLARATIONS
+class MPhSrvUssdNetworkObserver;
+
+
+// CLASS DECLARATION
+
+/**
+*  Get network message.
+*
+*  @since 1.0
+*/
+class CPhSrvUssdNotifyNWRelease : public CActive
+    {
+    public:
+        
+        /**
+        * C++ constructor.
+        *
+        * @param aObserver Observer for receive actions.
+        * @param aUssdMessaging The actual sending class.
+        */
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        CPhSrvUssdNotifyNWRelease( 
+            MPhSrvUssdNetworkObserver& aObserver,
+            RMobileUssdMessaging& aUssdMessaging );
+
+        /**
+        * Destructor.
+        */
+        ~CPhSrvUssdNotifyNWRelease();
+        
+        /**
+        * Symbian OS second phase constructor.
+        */
+        void ConstructL();
+
+
+    public:  // New functions
+        
+        /**
+        *  Notifies a client of a MT USSD release message to the mobile device
+        *
+        * @return errorcode
+        */
+       TInt NotifyNetworkRelease(); 
+
+
+    private:  // Functions from base classes
+        
+        /**
+        * From CActive. 
+        * Called when Ussd message is received.
+        */
+        void RunL();
+        
+        /**
+        * From CActive. 
+        * Called when receive is cancelled.
+        */
+        void DoCancel();
+        
+        /**
+        * From CActive. 
+        * Called when RunL leaves.
+        */
+        TInt RunError( TInt aError );
+
+
+    private:    // Data
+        
+        // If this is true, receiving starts automatically.
+        TBool iAutoReceive;
+        
+        // The observer for actions.
+        MPhSrvUssdNetworkObserver& iObserver;
+
+        // The actual sending class.
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        RMobileUssdMessaging& iUssdMessaging;
+
+        // The USSD message data.
+        
+         RMobilePhone::TMobilePhoneSendSSRequestV3 iReturnResult;
+        
+         RMobilePhone::TMobilePhoneSendSSRequestV3Pckg iReturnResultPckg;
+        
+   
+    };
+
+#endif // CPHSRVUSSDNOTIFYNWRELEASE_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/ussd/cphsrvussdreceivehandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Get network message.
+*
+*/
+
+
+#ifndef CPHSRVUSSDRECEIVEHANDLER_H
+#define CPHSRVUSSDRECEIVEHANDLER_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include <etelmm.h>            // ETel
+
+
+// FORWARD DECLARATIONS
+class MPhSrvUssdNetworkObserver;
+
+
+// CLASS DECLARATION
+
+/**
+*  Get network message.
+*
+*  @since 1.0
+*/
+class CPhSrvUssdReceiveHandler : public CActive
+    {
+    public:
+        
+        /**
+        * C++ constructor.
+        *
+        * @param aObserver Observer for receive actions.
+        * @param aUssdMessaging The actual sending class.
+        */
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        CPhSrvUssdReceiveHandler( 
+            MPhSrvUssdNetworkObserver& aObserver,
+            RMobileUssdMessaging& aUssdMessaging );
+
+        /**
+        * Destructor.
+        */
+        ~CPhSrvUssdReceiveHandler();
+        
+        /**
+        * Symbian OS second phase constructor.
+        */
+        void ConstructL();
+
+
+    public:  // New functions
+        
+        /**
+        * Request that this object attempts to receive a message.
+        *
+        * @return Error code
+        */
+        TInt StartReceiving();
+
+
+    private:  // Functions from base classes
+        
+        /**
+        * From CActive. 
+        * Called when Ussd message is received.
+        */
+        void RunL();
+        
+        /**
+        * From CActive. 
+        * Called when receive is cancelled.
+        */
+        void DoCancel();
+        
+        /**
+        * From CActive. 
+        * Called when RunL leaves.
+        */
+        TInt RunError( TInt aError );
+
+
+    private:    // Data
+        
+        // If this is true, receiving starts automatically.
+        TBool iAutoReceive;
+        
+        // The observer for actions.
+        MPhSrvUssdNetworkObserver& iObserver;
+
+        // The actual sending class.
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        RMobileUssdMessaging& iUssdMessaging;
+
+        // The USSD message data.
+        RMobileUssdMessaging::TGsmUssdMessageData iMsgData;
+
+        // USSD message attributes.
+        RMobileUssdMessaging::TMobileUssdAttributesV1 iMsgAttributes;
+
+        // USSD message attributes as package.
+        RMobileUssdMessaging::TMobileUssdAttributesV1Pckg iMsgAttributesPckg;
+
+    private:
+        friend class CPhSrvUssdTester; // For test purposes only.
+    };
+
+#endif // CPHSRVUSSDRECEIVEHANDLER_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/ussd/cphsrvussdreplytimer.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,132 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  A timer based class used to notify objects when an automatic
+*                response is expected.
+*
+*/
+
+
+#ifndef CPHSRVUSSDREPLYTIMER_H
+#define CPHSRVUSSDREPLYTIMER_H
+
+
+// INCLUDES
+#include <e32base.h>
+
+
+// FORWARD DECLARATIONS
+class MPhSrvUssdReplyTimerObserver;
+
+
+// CLASS DECLARATION
+
+/**
+*  A timer based class used to notify objects when an 
+*  automatic response is expected
+*
+*  @since 1.0
+*/
+class CPhSrvUssdReplyTimer : public CTimer
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        *
+        * @param aObserver Observer for reply timer expiration event.
+        */
+        static CPhSrvUssdReplyTimer* 
+            NewL( MPhSrvUssdReplyTimerObserver& aObserver );
+
+        /**
+        * Destructor.
+        */
+        ~CPhSrvUssdReplyTimer();
+        
+
+    public: // New functions
+
+        /**
+        * Query is the timer active or not.
+        * 
+        * @return True if timer is running/paused.
+        */
+        TBool IsTimerActive() const;
+
+        /**
+        * Start the timer.
+        */
+        void Start();
+
+        /**
+        * Pause the timer.
+        */
+        void Pause();
+
+        /**
+        * Continue paused timer.
+        */
+        void Continue();
+
+        /**
+        * Stop the timer.
+        */
+        void Stop();
+
+
+    private: // Functions from base classes
+
+        /**
+        * From CActive
+        */
+        void RunL();
+
+        /**
+        * From CActive
+        */
+        TInt RunError( TInt aError );
+
+
+    private:
+
+        /**
+        * C++ constructor.
+        */
+        CPhSrvUssdReplyTimer( MPhSrvUssdReplyTimerObserver& aObserver );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+
+    private:     // Data
+
+        // The actual timer.
+        RTimer iTimer;
+
+        // The counter for remaining time.
+        TTimeIntervalMicroSeconds32 iTimeLeft;
+
+        // When the timer was started last time.
+        TTime iLastStartTime;
+
+        // Observer for timer events.
+        MPhSrvUssdReplyTimerObserver& iObserver;
+    };
+
+#endif // CPHSRVUSSDREPLYTIMER_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/ussd/cphsrvussdsendhandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,127 @@
+/*
+* 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:  Sends USSD message to the network.
+*
+*/
+
+#ifndef CPHSRVUSSDSENDHANDLER_H
+#define CPHSRVUSSDSENDHANDLER_H
+
+// INCLUDES
+#include    <etelmm.h>            
+
+// FORWARD DECLARATIONS
+class MPhSrvUssdNetworkObserver;
+class MPhSrvPhoneInterface;
+class CPhSrvUssdSessionCancelWaiter;
+
+// CLASS DECLARATION
+
+/**
+*  Sends message to the network.
+*
+*  @since Series60_1.0
+*/
+class CPhSrvUssdSendHandler : public CActive
+    {
+    
+    public:  // Constructors and destructor     
+
+        /**
+        * C++ constructor.
+        *
+        * @param aObserver Observer for send events.
+        * @param aUssdMessaging The actual sender instance.
+        * @param aPhoneInterface Phone interfaces.
+        */
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        CPhSrvUssdSendHandler( 
+            MPhSrvUssdNetworkObserver& aObserver,
+            RMobileUssdMessaging& aUssdMessaging,
+            MPhSrvPhoneInterface& aPhoneInterface );
+
+        /**
+        * Destructor
+        */
+        ~CPhSrvUssdSendHandler();
+
+
+    public: // New functions
+        
+        /**
+        * Send USSD message.
+        *
+        * @param aMsgData USSD message to be sent.
+        * @param aMsgAttribute USSD message attributes.
+        */
+        void SendUssdL( 
+            const TDesC8& aMsgData, 
+            const TDesC8& aMsgAttribute );
+
+        /**
+        * Cancel send USSD message.
+        */
+        void SendUssdCancel();
+        
+        /**
+        * Terminates USSD Session.
+        */
+        void SendReleaseSession();
+
+    private: // Functions from base classes
+        
+        /**
+        * From CActive. 
+        * Called when sending is cancelled.
+        */
+        void DoCancel();
+        
+        /**
+        * From CActive. 
+        * Called when send request is completed.
+        */
+        void RunL();
+
+    private:    // Data
+        
+        // Observer for send events.
+        MPhSrvUssdNetworkObserver& iObserver;
+
+        // The actual sending instance.
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        RMobileUssdMessaging& iUssdMessaging;
+
+        // References to phone interfaces.
+        MPhSrvPhoneInterface& iPhoneInterface;
+
+        // Message data storage.
+        HBufC8* iMsgData;
+
+        // Message data attributes.
+        HBufC8* iMsgAttribute;
+
+        // For cancelling the USSD session.
+        CPhSrvUssdSessionCancelWaiter* iSessionCancelWaiter;
+    };
+
+#endif // CPHSRVUSSDSENDHANDLER_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/ussd/cphsrvussdsessioncancelwaiter.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,65 @@
+/*
+* 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:  Ussd session cancel waiter.
+*
+*/
+
+
+
+#ifndef CPHSRVUSSDSESSIONCANCELWAITER_H
+#define CPHSRVUSSDSESSIONCANCELWAITER_H
+
+// CLASS DECLARATION
+/**
+*  For cancelling the USSD session.
+*
+*  @since Series60_2.6
+*/
+class CPhSrvUssdSessionCancelWaiter : public CActive
+    {
+    public: // Constructors and destructor
+
+        /**
+        * C++ constructor.
+        */
+        CPhSrvUssdSessionCancelWaiter() 
+            : CActive( EPriorityLow ),
+              iSSRequestPckg( iSSRequest )
+            { 
+            CActiveScheduler::Add( this );
+            }
+        
+        /**
+        * Destructor.
+        */
+        ~CPhSrvUssdSessionCancelWaiter() { Cancel();}
+
+    public: // Functions from base classes
+        void SetActive() { CActive::SetActive(); }
+        void RunL() {}
+        void DoCancel() {}
+    
+    public: //Data
+
+        // SendSSRequest information.
+        RMobilePhone::TMobilePhoneSendSSRequestV3     iSSRequest;
+
+        // Packaged version of iSSRequest.
+        RMobilePhone::TMobilePhoneSendSSRequestV3Pckg iSSRequestPckg;
+
+    };
+
+#endif // CPHSRVUSSDSESSIONCANCELWAITER_H
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/ussd/mphsrvussdmessagesentobserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Interface for subsessions to get send event.
+*
+*/
+
+
+#ifndef MPHSRVUSSDMESSAGESENTOBSERVER_H
+#define MPHSRVUSSDMESSAGESENTOBSERVER_H
+
+// CLASS DECLARATIONS
+
+/**
+*  USSD message send event observer.
+*
+*  @since 1.0
+*/
+class MPhSrvUssdMessageSentObserver
+    {
+    public: // New functions
+
+        /**
+        * Called by the USSD manager when it's sent a message.
+        * 
+        * @param aError Complete code.
+        */
+        virtual void UssdMessageSentObserverHandleResult( TInt aError ) = 0;
+    };
+
+#endif // MPHSRVUSSDMESSAGESENTOBSERVER_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/ussd/mphsrvussdnetworkobserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Abstract interface for observing network message events.
+*
+*/
+
+#ifndef MPHSRVUSSDNETWORKOBSERVER_H
+#define MPHSRVUSSDNETWORKOBSERVER_H
+
+
+// CLASS DECLARATION
+
+/**
+*  Abstract interface for observing network message events.
+*
+*  @since 1.0
+*/
+class MPhSrvUssdNetworkObserver
+    {
+    public: // New functions
+
+        /**
+        * Called when a message has been sent.
+        * 
+        * @param aError Complete code.
+        */
+        virtual void UssdNetworkObserverHandleSendEventL( TInt aError ) = 0;
+        
+        /**
+        * Called when a message has been received.
+        * 
+        * @param aMessage Received message.
+        * @param aIsRequest ETrue if is a request.
+        * @param aError Error code of the operation.
+        */
+        virtual void UssdNetworkObserverHandleReceivedEventL(
+            const TDes8& aMsgData, 
+            const RMobileUssdMessaging::TMobileUssdAttributesV1& aMsgAttributes,
+            TInt aError ) = 0;
+            
+       virtual void UssdNetworkObserverHandleNotifyNWReleaseL(
+            const RMobilePhone::TMobilePhoneSendSSRequestV3& aReturnResult, 
+            TInt aError ) = 0;
+    };
+
+#endif // MPHSRVUSSDNETWORKOBSERVER_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/inc/ussd/mphsrvussdreplytimerobserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Abstract class which is called back when the USSD reply timer
+*                expires.
+*
+*/
+
+
+#ifndef MPHSRVUSSDREPLYTIMEROBSERVER_H
+#define MPHSRVUSSDREPLYTIMEROBSERVER_H
+
+
+// CLASS DECLARATION
+
+/**
+*  Abstract class which is called back when the USSD reply timer expires.
+*
+*  @since 1.0
+*/
+class MPhSrvUssdReplyTimerObserver
+    {
+    public: // New functions
+
+        /**
+        * Handle a timer call-back.
+        * 
+        * @param aError Error code.
+        */
+        virtual void UssdReplyTimerObserverHandleExpiredL( TInt aError ) = 0;
+    };
+
+#endif // MPHSRVUSSDREPLYTIMEROBSERVER_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/rom/phoneserver.iby	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,30 @@
+/*
+* 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:  IBY file of PhoneServer
+*
+*/
+
+
+#ifndef __PhoneServer_IBY__
+#define __PhoneServer_IBY__
+
+file=ABI_DIR\BUILD_DIR\PhoneServer.exe                      PROGRAMS_DIR\PhoneServer.exe
+data=ZSYSTEM\install\PhoneServer_stub.sis           system\install\PhoneServer_stub.sis
+#ifndef DATAZ_
+  define DATAZ_ EPOCROOT##epoc32\data\Z
+#endif
+
+  data = ZPRIVATE\10000850\backup_registration.xml  PRIVATE\10000850\backup_registration.xml
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/commandhandler/commandhandler_aiw/cphsrvcomhandrequestmanager.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,376 @@
+/*
+* Copyright (c) 2003-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:  Command Handler Request Manager.
+*
+*/
+
+
+
+// INCLUDES
+#include "cphsrvcomhandrequestmanager.h" 
+#include "cphsrvcomhandrequest.h" 
+#include "cphsrvsubsessionbase.h" 
+#include "phsrvutils.h" 
+#include "cphsrvserver.h" 
+#include "mphsrvemergencynumbermanager.h" 
+
+
+// CONSTANTS
+
+// The size of the Notification manager storage.
+const TInt KPhSrvComHandManagerPendingCallGranularity = 4;
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::CPhSrvComHandRequestManager
+// 
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvComHandRequestManager::CPhSrvComHandRequestManager( 
+    CPhSrvServer& aServer )
+:   iServer( aServer )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::~CPhSrvComHandRequestManager
+// 
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvComHandRequestManager::~CPhSrvComHandRequestManager()
+    {
+    if ( iOutstandingComHandRequests )
+        {
+        iOutstandingComHandRequests->ResetAndDestroy();
+        iOutstandingComHandRequests->Close();
+
+        delete iOutstandingComHandRequests;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::ConstructL
+// 
+// Complete construction.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvComHandRequestManager::ConstructL()
+    {
+    iOutstandingComHandRequests = new ( ELeave ) RPointerArray< 
+        CPhSrvComHandRequest >( KPhSrvComHandManagerPendingCallGranularity );
+
+    CPhSrvComHandRequest* emergencyRequest = CPhSrvComHandRequest::NewL();
+    CleanupStack::PushL( emergencyRequest );
+    User::LeaveIfError( 
+        iOutstandingComHandRequests->Append( emergencyRequest ) );
+    CleanupStack::Pop(); // emergencyRequest
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::NegotiatorRequestL
+// 
+// Initiate a command handler request - called by the external command handler
+// interface.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvComHandRequestManager::NegotiatorRequestL( 
+    const RMessage2& aMessage, 
+    const TPhCltComHandCommandParameters& aParams, 
+    CPhSrvSubSessionBase& aSubSession )
+    {
+    // If we have no registered initiator then we can't perform the request.
+    if ( !iComHandInitiator )
+        {
+        User::Leave( KErrNotReady );
+        }
+
+    // If the request is DTMF stop, it is handled as emergency request.
+    TBool isDtmfCancel = 
+        ( 
+            ( aParams.iCommandHandlerCommand == EPhCltCommandVts ) &&
+            ( aParams.iDtmfAction == EPhCltDtmfStop ) 
+        );
+
+    // If the request is dial and the number is emergencynumber, it is
+    // handled as emergency request.
+    TBool isEmergencyCall = 
+        ( aParams.iCommandHandlerCommand == EPhCltCommandAtd );
+    
+    if( isEmergencyCall )
+        {
+        isEmergencyCall = iServer.EmergencyNumberManagerL().
+        EmergencyNumberManagerIsEmergencyNumberL(
+            ( TDes16& ) aParams.iTelNumber, 
+            EPhCltEmergencyNumberQueryModeNormal );
+        }
+
+    // Panic if this is not the only request from this subsession.
+    if ( RequestAlreadyExists( aSubSession ) )
+        {
+        // Cancel all ongoing requests first.
+        NegotiatorRequestCancel( aSubSession );
+
+        PhoneServerUtils::PanicClient( 
+            EPhoneServerPanicTooManyRequestsOngoing,
+            aMessage );
+        }
+
+    // Normal request handling, request is ok.
+    else
+        {
+        CPhSrvComHandRequest* temp = NULL;
+
+        // Emergency request handling.
+        if ( ( isDtmfCancel || isEmergencyCall ) && 
+             ( *iOutstandingComHandRequests )[0]->SubSessionHandle() == 0 )
+            {
+            ( *iOutstandingComHandRequests )[0]->UpdateEmergencyRequest( 
+                aMessage, 
+                aParams,
+                aSubSession.SubSessionUniqueHandle() );
+            temp = ( *iOutstandingComHandRequests )[0];
+            }
+        else
+            {
+            // Create pending request
+            CPhSrvComHandRequest* request = CPhSrvComHandRequest::NewLC( 
+                aMessage, 
+                aParams,
+                aSubSession.SubSessionUniqueHandle() );
+
+            User::LeaveIfError( 
+                iOutstandingComHandRequests->Append( request ) );
+            CleanupStack::Pop( request );
+            temp = request;
+            }
+
+        // Now see if the command handler notifier (initiator) is ready 
+        if ( iComHandInitiator->InitiatorIsReadyToPerformRequest() )
+            {
+            // Ask the call initiator to perform the request 
+            // (basically completes the phone app engine's outstanding 
+            // ComHand Notifier request).
+            iComHandInitiator->InitiatorMakeAsynchronousComHandRequest( 
+                aParams );
+
+            iActiveRequest = temp;
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::NegotiatorRequestCancel
+// 
+// Cancel a pending command handler request.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvComHandRequestManager::NegotiatorRequestCancel( 
+    CPhSrvSubSessionBase& aSubSession )
+    {
+    // Obtain the subsessions handle
+    const TInt handle = aSubSession.SubSessionUniqueHandle();
+
+    // Now look for any pending requests that match.
+    const TInt count = iOutstandingComHandRequests->Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        CPhSrvComHandRequest* entry = ( *iOutstandingComHandRequests )[i];
+        if ( entry->SubSessionHandle() == handle )
+            {
+            if ( entry == iActiveRequest )
+                {
+                // This request is active, so inform that it is deleted.
+                iActiveRequest = NULL;
+                }
+
+            // Found matching entry, so cancel it and clean up
+            if ( i == 0 ) // 0 stands for emergency request
+                {
+                entry->Cancel();
+                entry->ClearEmergencyRequest();
+                }
+            else
+                {
+                iOutstandingComHandRequests->Remove( i );
+                entry->Cancel();
+                delete entry;
+                }
+            }
+        }
+    UpdateQueue();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::SetNegotiatorReadyRequestL
+// 
+// Updates the negotiator so that it knows if the notifier
+// session is able to perform the request.
+// Does not leave.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvComHandRequestManager::SetNegotiatorReadyRequestL(
+    MPhSrvComHandInitiator& aInitiator )
+    {
+    // There mustn't already be a command handler initiator, or the existing 
+    // initiator must be the same as the new one (otherwise, panic).
+    __ASSERT_ALWAYS( !iComHandInitiator || &aInitiator == iComHandInitiator, 
+        PhoneServerUtils::Panic( 
+        EPhoneServerPanicExistingComHandInitiatorFault ) );
+
+    // Update our pointer
+    iComHandInitiator = &aInitiator;
+
+    UpdateQueue();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::SetNegotiatorReadyRequestCancel
+// 
+// Indicates that the initiator is no longer available.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvComHandRequestManager::SetNegotiatorReadyRequestCancel( 
+    MPhSrvComHandInitiator& aInitiator )
+    {
+    if ( iComHandInitiator && iComHandInitiator == &aInitiator )
+        {
+        iComHandInitiator = NULL;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::SetNegotiatorAttemptedRequestResponseValue
+// 
+// Handle a response from the phone app engine - this is the 
+// result of attempting to perform a command handler request 
+// (based upon a previous clients external command handler request).
+// -----------------------------------------------------------------------------
+//
+void CPhSrvComHandRequestManager::SetNegotiatorAttemptedRequestResponseValue( 
+    TPhCltPhoneResults aResult )
+    {
+    // Handle response event only if there is request that waits response.
+    if ( iActiveRequest )
+        {
+        // Get the first item in the list - this is the oldest, and has the
+        // details of the command handler request we had previously initiated.
+        CPhSrvComHandRequest* head = NULL;
+        if ( ( *iOutstandingComHandRequests )[0]->SubSessionHandle() != 0 )
+            {
+            head = ( *iOutstandingComHandRequests )[0];
+            }
+        else
+            {
+            head = ( *iOutstandingComHandRequests )[1];
+            }
+        // Complete the request so that the external command handler client 
+        // knows the result of the request attempt
+        head->InformOfComHandRequestAttemptResult( aResult );
+
+        // Delete the pending request (now that it's been processed) and tidy
+        // up
+        if ( ( *iOutstandingComHandRequests )[0]->SubSessionHandle() != 0 )
+            {
+            ( *iOutstandingComHandRequests )[0]->ClearEmergencyRequest();
+            }
+        else
+            {
+            iOutstandingComHandRequests->Remove( 1 );
+            delete head;
+            }
+
+        // Reset the iActiveRequest variable.
+        iActiveRequest = NULL;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::UpdateQueue
+// 
+// Update the request queue.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvComHandRequestManager::UpdateQueue()
+    {
+    // If we have no registered initiator then we do nothing here.
+    if ( iComHandInitiator )
+        {
+        // If we have more than one item in the queue, then we
+        // try and fire of the next item here.
+        if ( iComHandInitiator->InitiatorIsReadyToPerformRequest() && 
+            ( iOutstandingComHandRequests->Count() > 1 ||
+            ( *iOutstandingComHandRequests )[0]->SubSessionHandle() != 0 ) )
+            {
+            // Get the request at the top of the list (head of the queue)
+            CPhSrvComHandRequest* head = NULL;
+            if ( ( *iOutstandingComHandRequests )[0]->SubSessionHandle() != 0 )
+                {
+                head = ( *iOutstandingComHandRequests )[0];
+                }
+            else
+                {
+                head = ( *iOutstandingComHandRequests )[1];
+                }
+
+            iComHandInitiator->InitiatorMakeAsynchronousComHandRequest(
+                head->ComHandParameters() );
+
+            iActiveRequest = head;
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::RequestAlreadyExists
+// 
+// Check whether there already is request(s) for the subsession given as 
+// parameter.
+// -----------------------------------------------------------------------------
+//
+TBool CPhSrvComHandRequestManager::RequestAlreadyExists( 
+    CPhSrvSubSessionBase& aSubSession )
+    {
+    TBool isThereRequest = EFalse;
+
+    // Obtain the subsessions handle
+    const TInt handle = aSubSession.SubSessionUniqueHandle();
+
+    // Look for any pending requests that match the handle.
+    const TInt count = iOutstandingComHandRequests->Count();
+    TInt i = 0;
+    for( i = 0; i < count; i++ )
+        {
+        CPhSrvComHandRequest* entry = 
+            ( *iOutstandingComHandRequests )[i];
+        if ( entry->SubSessionHandle() == handle )
+            {
+            isThereRequest = ETrue;
+            }
+        }
+    return isThereRequest;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/commandhandler/commandhandler_aiw/cphsrvcomhandrequestmanagerstub.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2003-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:  Command Handler Request Manager Stub implementation.
+*
+*/
+
+
+
+// INCLUDES
+#include "cphsrvcomhandrequestmanager.h" 
+#include "cphsrvcomhandrequest.h" 
+#include "cphsrvsubsessionbase.h" 
+#include "phsrvutils.h" 
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::CPhSrvComHandRequestManager
+// 
+// -----------------------------------------------------------------------------
+//
+CPhSrvComHandRequestManager::CPhSrvComHandRequestManager(
+    CPhSrvServer& aServer )
+:   iServer( aServer )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::~CPhSrvComHandRequestManager
+// 
+// -----------------------------------------------------------------------------
+//
+CPhSrvComHandRequestManager::~CPhSrvComHandRequestManager()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::ConstructL
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvComHandRequestManager::ConstructL()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::NegotiatorRequestL
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvComHandRequestManager::NegotiatorRequestL( 
+    const RMessage2& /* aMessage */, 
+    const TPhCltComHandCommandParameters& /* aParams */, 
+    CPhSrvSubSessionBase& /* aSubSession */ )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::NegotiatorRequestCancel
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvComHandRequestManager::NegotiatorRequestCancel( 
+    CPhSrvSubSessionBase& /* aSubSession */ )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::SetNegotiatorReadyRequestL
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvComHandRequestManager::SetNegotiatorReadyRequestL(
+    MPhSrvComHandInitiator& /* aInitiator */ )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::SetNegotiatorReadyRequestCancel
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvComHandRequestManager::SetNegotiatorReadyRequestCancel( 
+    MPhSrvComHandInitiator& /* aInitiator */ )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::SetNegotiatorAttemptedRequestResponseValue
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvComHandRequestManager::SetNegotiatorAttemptedRequestResponseValue( 
+    TPhCltPhoneResults /* aResult */ )
+    {
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/commandhandler/commandhandler_noaiw/cphsrvcomhandrequestmanager.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,375 @@
+/*
+* Copyright (c) 2003-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:  Command Handler Request Manager.
+*
+*/
+
+
+
+// INCLUDES
+#include "cphsrvcomhandrequestmanager.h" 
+#include "cphsrvcomhandrequest.h" 
+#include "cphsrvsubsessionbase.h" 
+#include "phsrvutils.h" 
+#include "cphsrvserver.h" 
+#include "mphsrvemergencynumbermanager.h" 
+
+
+// CONSTANTS
+
+// The size of the Notification manager storage.
+const TInt KPhSrvComHandManagerPendingCallGranularity = 4;
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::CPhSrvComHandRequestManager
+// 
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvComHandRequestManager::CPhSrvComHandRequestManager( 
+    CPhSrvServer& aServer )
+:   iServer( aServer )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::~CPhSrvComHandRequestManager
+// 
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvComHandRequestManager::~CPhSrvComHandRequestManager()
+    {
+    if ( iOutstandingComHandRequests )
+        {
+        iOutstandingComHandRequests->ResetAndDestroy();
+        iOutstandingComHandRequests->Close();
+
+        delete iOutstandingComHandRequests;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::ConstructL
+// 
+// Complete construction.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvComHandRequestManager::ConstructL()
+    {
+    iOutstandingComHandRequests = new ( ELeave ) RPointerArray< 
+        CPhSrvComHandRequest >( KPhSrvComHandManagerPendingCallGranularity );
+
+    CPhSrvComHandRequest* emergencyRequest = CPhSrvComHandRequest::NewL();
+    CleanupStack::PushL( emergencyRequest );
+    User::LeaveIfError( 
+        iOutstandingComHandRequests->Append( emergencyRequest ) );
+    CleanupStack::Pop(); // emergencyRequest
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::NegotiatorRequestL
+// 
+// Initiate a command handler request - called by the external command handler
+// interface.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvComHandRequestManager::NegotiatorRequestL( 
+    const RMessage2& aMessage, 
+    const TPhCltComHandCommandParameters& aParams, 
+    CPhSrvSubSessionBase& aSubSession )
+    {
+    // If we have no registered initiator then we can't perform the request.
+    if ( !iComHandInitiator )
+        {
+        User::Leave( KErrNotReady );
+        }
+
+    // If the request is DTMF stop, it is handled as emergency request.
+    TBool isDtmfCancel = 
+        ( 
+            ( aParams.iCommandHandlerCommand == EPhCltCommandVts ) &&
+            ( aParams.iDtmfAction == EPhCltDtmfStop ) 
+        );
+
+    // If the request is dial and the number is emergencynumber, it is
+    // handled as emergency request.
+    TBool isEmergencyCall = 
+        ( aParams.iCommandHandlerCommand == EPhCltCommandAtd );
+    if( isEmergencyCall )
+        {
+        isEmergencyCall = iServer.EmergencyNumberManagerL().
+        EmergencyNumberManagerIsEmergencyNumberL(
+            ( TDes16& ) aParams.iDialData.iTelNumber, 
+            EPhCltEmergencyNumberQueryModeNormal );
+        }
+
+    // Panic if this is not the only request from this subsession.
+    if ( RequestAlreadyExists( aSubSession ) )
+        {
+        // Cancel all ongoing requests first.
+        NegotiatorRequestCancel( aSubSession );
+
+        PhoneServerUtils::PanicClient( 
+            EPhoneServerPanicTooManyRequestsOngoing,
+            aMessage );
+        }
+
+    // Normal request handling, request is ok.
+    else
+        {
+        CPhSrvComHandRequest* temp = NULL;
+
+        // Emergency request handling.
+        if ( ( isDtmfCancel || isEmergencyCall ) && 
+             ( *iOutstandingComHandRequests )[0]->SubSessionHandle() == 0 )
+            {
+            ( *iOutstandingComHandRequests )[0]->UpdateEmergencyRequest( 
+                aMessage, 
+                aParams,
+                aSubSession.SubSessionUniqueHandle() );
+            temp = ( *iOutstandingComHandRequests )[0];
+            }
+        else
+            {
+            // Create pending request
+            CPhSrvComHandRequest* request = CPhSrvComHandRequest::NewLC( 
+                aMessage, 
+                aParams,
+                aSubSession.SubSessionUniqueHandle() );
+
+            User::LeaveIfError( 
+                iOutstandingComHandRequests->Append( request ) );
+            CleanupStack::Pop( request );
+            temp = request;
+            }
+
+        // Now see if the command handler notifier (initiator) is ready 
+        if ( iComHandInitiator->InitiatorIsReadyToPerformRequest() )
+            {
+            // Ask the call initiator to perform the request 
+            // (basically completes the phone app engine's outstanding 
+            // ComHand Notifier request).
+            iComHandInitiator->InitiatorMakeAsynchronousComHandRequest( 
+                aParams );
+
+            iActiveRequest = temp;
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::NegotiatorRequestCancel
+// 
+// Cancel a pending command handler request.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvComHandRequestManager::NegotiatorRequestCancel( 
+    CPhSrvSubSessionBase& aSubSession )
+    {
+    // Obtain the subsessions handle
+    const TInt handle = aSubSession.SubSessionUniqueHandle();
+
+    // Now look for any pending requests that match.
+    const TInt count = iOutstandingComHandRequests->Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        CPhSrvComHandRequest* entry = ( *iOutstandingComHandRequests )[i];
+        if ( entry->SubSessionHandle() == handle )
+            {
+            if ( entry == iActiveRequest )
+                {
+                // This request is active, so inform that it is deleted.
+                iActiveRequest = NULL;
+                }
+
+            // Found matching entry, so cancel it and clean up
+            if ( i == 0 ) // 0 stands for emergency request
+                {
+                entry->Cancel();
+                entry->ClearEmergencyRequest();
+                }
+            else
+                {
+                iOutstandingComHandRequests->Remove( i );
+                entry->Cancel();
+                delete entry;
+                }
+            }
+        }
+    UpdateQueue();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::SetNegotiatorReadyRequestL
+// 
+// Updates the negotiator so that it knows if the notifier
+// session is able to perform the request.
+// Does not leave.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvComHandRequestManager::SetNegotiatorReadyRequestL(
+    MPhSrvComHandInitiator& aInitiator )
+    {
+    // There mustn't already be a command handler initiator, or the existing 
+    // initiator must be the same as the new one (otherwise, panic).
+    __ASSERT_ALWAYS( !iComHandInitiator || &aInitiator == iComHandInitiator, 
+        PhoneServerUtils::Panic( 
+        EPhoneServerPanicExistingComHandInitiatorFault ) );
+
+    // Update our pointer
+    iComHandInitiator = &aInitiator;
+
+    UpdateQueue();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::SetNegotiatorReadyRequestCancel
+// 
+// Indicates that the initiator is no longer available.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvComHandRequestManager::SetNegotiatorReadyRequestCancel( 
+    MPhSrvComHandInitiator& aInitiator )
+    {
+    if ( iComHandInitiator && iComHandInitiator == &aInitiator )
+        {
+        iComHandInitiator = NULL;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::SetNegotiatorAttemptedRequestResponseValue
+// 
+// Handle a response from the phone app engine - this is the 
+// result of attempting to perform a command handler request 
+// (based upon a previous clients external command handler request).
+// -----------------------------------------------------------------------------
+//
+void CPhSrvComHandRequestManager::SetNegotiatorAttemptedRequestResponseValue( 
+    TPhCltPhoneResults aResult )
+    {
+    // Handle response event only if there is request that waits response.
+    if ( iActiveRequest )
+        {
+        // Get the first item in the list - this is the oldest, and has the
+        // details of the command handler request we had previously initiated.
+        CPhSrvComHandRequest* head = NULL;
+        if ( ( *iOutstandingComHandRequests )[0]->SubSessionHandle() != 0 )
+            {
+            head = ( *iOutstandingComHandRequests )[0];
+            }
+        else
+            {
+            head = ( *iOutstandingComHandRequests )[1];
+            }
+        // Complete the request so that the external command handler client 
+        // knows the result of the request attempt
+        head->InformOfComHandRequestAttemptResult( aResult );
+
+        // Delete the pending request (now that it's been processed) and tidy
+        // up
+        if ( ( *iOutstandingComHandRequests )[0]->SubSessionHandle() != 0 )
+            {
+            ( *iOutstandingComHandRequests )[0]->ClearEmergencyRequest();
+            }
+        else
+            {
+            iOutstandingComHandRequests->Remove( 1 );
+            delete head;
+            }
+
+        // Reset the iActiveRequest variable.
+        iActiveRequest = NULL;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::UpdateQueue
+// 
+// Update the request queue.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvComHandRequestManager::UpdateQueue()
+    {
+    // If we have no registered initiator then we do nothing here.
+    if ( iComHandInitiator )
+        {
+        // If we have more than one item in the queue, then we
+        // try and fire of the next item here.
+        if ( iComHandInitiator->InitiatorIsReadyToPerformRequest() && 
+            ( iOutstandingComHandRequests->Count() > 1 ||
+            ( *iOutstandingComHandRequests )[0]->SubSessionHandle() != 0 ) )
+            {
+            // Get the request at the top of the list (head of the queue)
+            CPhSrvComHandRequest* head = NULL;
+            if ( ( *iOutstandingComHandRequests )[0]->SubSessionHandle() != 0 )
+                {
+                head = ( *iOutstandingComHandRequests )[0];
+                }
+            else
+                {
+                head = ( *iOutstandingComHandRequests )[1];
+                }
+
+            iComHandInitiator->InitiatorMakeAsynchronousComHandRequest(
+                head->ComHandParameters() );
+
+            iActiveRequest = head;
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::RequestAlreadyExists
+// 
+// Check whether there already is request(s) for the subsession given as 
+// parameter.
+// -----------------------------------------------------------------------------
+//
+TBool CPhSrvComHandRequestManager::RequestAlreadyExists( 
+    CPhSrvSubSessionBase& aSubSession )
+    {
+    TBool isThereRequest = EFalse;
+
+    // Obtain the subsessions handle
+    const TInt handle = aSubSession.SubSessionUniqueHandle();
+
+    // Look for any pending requests that match the handle.
+    const TInt count = iOutstandingComHandRequests->Count();
+    TInt i = 0;
+    for( i = 0; i < count; i++ )
+        {
+        CPhSrvComHandRequest* entry = 
+            ( *iOutstandingComHandRequests )[i];
+        if ( entry->SubSessionHandle() == handle )
+            {
+            isThereRequest = ETrue;
+            }
+        }
+    return isThereRequest;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/commandhandler/commandhandler_noaiw/cphsrvcomhandrequestmanagerstub.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2003-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:  Command Handler Request Manager Stub implementation.
+*
+*/
+
+
+
+// INCLUDES
+#include "cphsrvcomhandrequestmanager.h" 
+#include "cphsrvcomhandrequest.h" 
+#include "cphsrvsubsessionbase.h" 
+#include "phsrvutils.h" 
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::CPhSrvComHandRequestManager
+// 
+// -----------------------------------------------------------------------------
+//
+CPhSrvComHandRequestManager::CPhSrvComHandRequestManager(
+    CPhSrvServer& aServer )
+:   iServer( aServer )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::~CPhSrvComHandRequestManager
+// 
+// -----------------------------------------------------------------------------
+//
+CPhSrvComHandRequestManager::~CPhSrvComHandRequestManager()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::ConstructL
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvComHandRequestManager::ConstructL()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::NegotiatorRequestL
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvComHandRequestManager::NegotiatorRequestL( 
+    const RMessage2& /* aMessage */, 
+    const TPhCltComHandCommandParameters& /* aParams */, 
+    CPhSrvSubSessionBase& /* aSubSession */ )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::NegotiatorRequestCancel
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvComHandRequestManager::NegotiatorRequestCancel( 
+    CPhSrvSubSessionBase& /* aSubSession */ )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::SetNegotiatorReadyRequestL
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvComHandRequestManager::SetNegotiatorReadyRequestL(
+    MPhSrvComHandInitiator& /* aInitiator */ )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::SetNegotiatorReadyRequestCancel
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvComHandRequestManager::SetNegotiatorReadyRequestCancel( 
+    MPhSrvComHandInitiator& /* aInitiator */ )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequestManager::SetNegotiatorAttemptedRequestResponseValue
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvComHandRequestManager::SetNegotiatorAttemptedRequestResponseValue( 
+    TPhCltPhoneResults /* aResult */ )
+    {
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/commandhandler/cphsrvcomhandrequest.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,175 @@
+/*
+* Copyright (c) 2003-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:  Command Handler Request.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "cphsrvcomhandrequest.h" 
+#include "phsrvutils.h" 
+
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequest::CPhSrvComHandRequest
+// 
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvComHandRequest::CPhSrvComHandRequest( 
+    const RMessage2& aMessage, 
+    const TPhCltComHandCommandParameters& aParams, 
+    TInt aSubSessionHandle )
+:   iPendingRequestPointer( aMessage ), 
+    iComHandParams( aParams ), 
+    iSubSessionHandle( aSubSessionHandle )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequest::CPhSrvComHandRequest
+// 
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvComHandRequest::CPhSrvComHandRequest()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequest::NewLC
+// 
+// Static Symbian OS two-phase constructor. Return an instance
+// and leave it on the cleanup stack.
+// -----------------------------------------------------------------------------
+//
+CPhSrvComHandRequest* CPhSrvComHandRequest::NewLC( 
+    const RMessage2& aMessage, 
+    const TPhCltComHandCommandParameters& aParams, 
+    TInt aSubSessionHandle )
+    {
+    CPhSrvComHandRequest* self = new( ELeave ) CPhSrvComHandRequest( 
+        aMessage, 
+        aParams, 
+        aSubSessionHandle );
+    CleanupStack::PushL( self );
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequest::NewL
+// 
+// Static Symbian OS two-phase constructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvComHandRequest* CPhSrvComHandRequest::NewL()
+    {
+    CPhSrvComHandRequest* self = new( ELeave ) CPhSrvComHandRequest();
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequest::InformOfComHandRequestAttemptResult
+// 
+// Complete a client request which will indicate the result
+// of attempting to perform a request.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvComHandRequest::InformOfComHandRequestAttemptResult( 
+    TPhCltPhoneResults aResultOfAttemptingRequest )
+    {
+    // Complete the client's pending request, indicating 
+    // the result of the command handler request attempt.
+    iPendingRequestPointer.Complete( aResultOfAttemptingRequest );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequest::Cancel
+// 
+// Complete the client's request with KErrCancel.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvComHandRequest::Cancel()
+    {
+    iPendingRequestPointer.Complete( KErrCancel );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequest::SubSessionHandle
+// 
+// Return the handle of the subsession that initiated the
+// original command handler request.
+// -----------------------------------------------------------------------------
+//
+TInt CPhSrvComHandRequest::SubSessionHandle() const
+    {
+    return iSubSessionHandle;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequest::ComHandParameters
+// 
+// Returns the command handler parameters.
+// -----------------------------------------------------------------------------
+//
+const TPhCltComHandCommandParameters& 
+    CPhSrvComHandRequest::ComHandParameters() const
+    {
+    return iComHandParams;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequest::UpdateEmergencyRequest
+// 
+// Set new parameters to emergency request object.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvComHandRequest::UpdateEmergencyRequest( 
+    const RMessage2& aMessage, 
+    const TPhCltComHandCommandParameters& aParams, 
+    TInt aSubSessionHandle )
+    {
+    iPendingRequestPointer = aMessage;
+    iComHandParams = aParams;
+    iSubSessionHandle = aSubSessionHandle;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvComHandRequest::ClearEmergencyRequest
+// 
+// Empties Emergency request data.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvComHandRequest::ClearEmergencyRequest()
+    {
+    iSubSessionHandle = 0;
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/commandhandler/cphsrvsubsessioncommandhandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,398 @@
+/*
+* Copyright (c) 2003-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:  Sub Session Command handler.
+*                The stub version of this file can be found from file
+*                CPhSrvSubSessionCommandHandlerStub.cpp
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "cphsrvsubsessioncommandhandler.h" 
+#include    "cphsrvsession.h" 
+#include    "cphsrvserver.h" 
+#include    <phclttypes.h> 
+#include    "mphsrvcomhandnegotiators.h" 
+
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandler::CPhSrvSubSessionCommandHandler
+// 
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvSubSessionCommandHandler::CPhSrvSubSessionCommandHandler( 
+    CPhSrvSession& aSession )
+:   CPhSrvSubSessionBase( aSession, EPhSrvSubSessionTypeComHand )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandler::NewL
+// 
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvSubSessionBase* CPhSrvSubSessionCommandHandler::NewL(
+    CPhSrvSession& aSession )
+    {
+    CPhSrvSubSessionBase* self = 
+        new( ELeave ) CPhSrvSubSessionCommandHandler( aSession );
+    
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandler::PhSrvMessageDecoderCanProcessMessage
+// 
+// Framework function. Returns ETrue for the op codes that
+// this subsession can handle.
+// -----------------------------------------------------------------------------
+//
+TBool CPhSrvSubSessionCommandHandler::PhSrvMessageDecoderCanProcessMessage( 
+    TInt aFunction )
+    {
+    switch( aFunction )
+        {
+        case EPhoneServerComHandSubSessionOpen:
+        case EPhoneServerComHandSubSessionClose:
+        case EPhoneServerComHandSubSessionAtd:
+        case EPhoneServerComHandSubSessionAta:
+        case EPhoneServerComHandSubSessionChld:
+        case EPhoneServerComHandSubSessionChup:
+        case EPhoneServerComHandSubSessionVts:
+        case EPhoneServerComHandSubSessionCancel:
+        case EPhoneServerComHandSubSessionMuteMic:
+        case EPhoneServerComHandSubSessionMuteRingingTone:
+            return ETrue;
+            
+        default:
+            return EFalse;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandler::PhSrvMessageProcessorHandleMessageL
+// 
+// Framework function. Handle any op-codes here.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionCommandHandler::PhSrvMessageProcessorHandleMessageL( 
+    const RMessage2& aMessage )
+    {
+    TBool permissionStatus ( EFalse );
+    
+    // Check needed capabilities    
+    TBool hasCapNetworkControlAndServices( EFalse );
+    TBool hasCapNetworkServices( EFalse );
+    TBool hasCapWriteDeviceData( EFalse );
+    hasCapNetworkControlAndServices = aMessage.HasCapability( ECapabilityNetworkControl, 
+                                                              ECapabilityNetworkServices  );
+    hasCapNetworkServices = aMessage.HasCapability( ECapabilityNetworkServices );
+    hasCapWriteDeviceData = aMessage.HasCapability( ECapabilityWriteDeviceData );
+    
+    switch( aMessage.Function() )
+        {
+        case EPhoneServerComHandSubSessionClose:
+            CmdSubSessionClose( aMessage );
+            permissionStatus = ETrue;
+            break;
+
+        case EPhoneServerComHandSubSessionAtd:
+            if ( hasCapNetworkControlAndServices )
+                {        
+                CmdSubSessionComHandAtdL( aMessage );
+                permissionStatus = ETrue;
+                }
+            break;
+
+        case EPhoneServerComHandSubSessionAta:
+            if ( hasCapNetworkControlAndServices )
+                {        
+                CmdSubSessionComHandAtaL( aMessage );
+                permissionStatus = ETrue;
+                }
+            break;
+
+        case EPhoneServerComHandSubSessionChld:
+            if ( hasCapNetworkServices )
+                {
+                CmdSubSessionComHandChldL( aMessage );
+                permissionStatus = ETrue;
+                }    
+             break;
+
+        case EPhoneServerComHandSubSessionChup:
+            if ( hasCapNetworkServices )
+                {
+                CmdSubSessionComHandChupL( aMessage );
+                permissionStatus = ETrue;
+                }        
+             break;
+
+        case EPhoneServerComHandSubSessionVts:
+            if ( hasCapNetworkServices )
+                {
+                CmdSubSessionComHandVtsL( aMessage );
+                permissionStatus = ETrue;
+                }        
+            break;
+                  
+        case EPhoneServerComHandSubSessionCancel:
+                    
+            if ( IsCancelAllowed( aMessage ) )
+                {
+                CmdSubSessionComHandCancelL( aMessage );
+                permissionStatus = ETrue;
+                }
+            break;
+
+        case EPhoneServerComHandSubSessionMuteMic:
+            if ( hasCapWriteDeviceData )
+                {
+                CmdSubSessionComHandMuteMicL( aMessage );
+                permissionStatus = ETrue;
+                }        
+            break;
+        
+        case EPhoneServerComHandSubSessionMuteRingingTone:
+            if ( hasCapWriteDeviceData )
+                {
+                CmdSubSessionComHandMuteRingingToneL( aMessage );
+                permissionStatus = ETrue;
+                }        
+            break;
+
+        default:
+            PhoneSession().PanicClient(
+                aMessage,
+                EPhCltServerInitiatedPanicInvalidRequest );
+            break;
+        }
+     
+    // If caps are not ok
+    if( !permissionStatus )
+        {
+        aMessage.Complete( KErrPermissionDenied );
+        }        
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionIhf::CmdSubSessionClose
+// 
+// Close the sub-session.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionCommandHandler::CmdSubSessionClose( 
+    const RMessage2& aMessage )
+    {
+    PhoneSession().CloseSubSession( aMessage );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandler::CmdSubSessionComHandAtdL
+// 
+// Handle command handler client's Atd request.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionCommandHandler::CmdSubSessionComHandAtdL( 
+    const RMessage2& aMessage )
+    {
+    CmdSubSessionComHandForwardRequestL( aMessage );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandler::CmdSubSessionComHandAtaL
+// 
+// Handle command handler client's Ata request.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionCommandHandler::CmdSubSessionComHandAtaL( 
+    const RMessage2& aMessage )
+    {
+    CmdSubSessionComHandForwardRequestL( aMessage );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandler::CmdSubSessionComHandChldL
+// 
+// Handle command handler client's Chld request.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionCommandHandler::CmdSubSessionComHandChldL( 
+    const RMessage2& aMessage )
+    {
+    CmdSubSessionComHandForwardRequestL( aMessage );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandler::CmdSubSessionComHandChupL
+// 
+// Handle command handler client's Chup request.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionCommandHandler::CmdSubSessionComHandChupL( 
+    const RMessage2& aMessage )
+    {
+    CmdSubSessionComHandForwardRequestL( aMessage );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandler::CmdSubSessionComHandVtsL
+// 
+// Handle command handler client's Vts request.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionCommandHandler::CmdSubSessionComHandVtsL( 
+    const RMessage2& aMessage )
+    {
+    CmdSubSessionComHandForwardRequestL( aMessage );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandler::CmdSubSessionComHandCancelL
+// 
+// Handle command handler client's cancel request.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionCommandHandler::CmdSubSessionComHandCancelL( 
+    const RMessage2& aMessage )
+    {
+    // Ask the command handler negotiator to delete any pending request for 
+    // this subsession. It will panic the client if one can't be found.
+    MPhSrvComHandNegotiator& comHandNegotiator = 
+        PhoneSession().PhoneServer().ComHandNegotiatorL();
+
+    comHandNegotiator.NegotiatorRequestCancel( *this );
+    aMessage.Complete( KErrNone );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandler::CmdSubSessionComHandForwardRequestL
+// 
+// Setup an asynchronous request to handle external interface
+// command handler requests.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionCommandHandler::CmdSubSessionComHandForwardRequestL(
+    const RMessage2& aMessage )
+    {
+    // Read parameters from client's address space.
+    TPhCltComHandCommandParameters comHandParams;
+    TPckg< TPhCltComHandCommandParameters > 
+        pComHandParams( comHandParams );
+    Read(
+        aMessage,
+        0,
+        pComHandParams );
+
+    // Submit a new request to the command handler manager.
+    MPhSrvComHandNegotiator& comHandNegotiator = 
+        PhoneSession().PhoneServer().ComHandNegotiatorL();
+
+    comHandNegotiator.NegotiatorRequestL( aMessage, comHandParams, *this );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandler::CmdSubSessionComHandMuteMicL
+// 
+// Handle command handler client's mute mic request.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionCommandHandler::CmdSubSessionComHandMuteMicL( 
+    const RMessage2& aMessage )
+    {
+    CmdSubSessionComHandForwardRequestL( aMessage );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandler::CmdSubSessionComHandMuteRingingToneL
+// 
+// Handle command handler client's mute ringing tone request.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionCommandHandler::CmdSubSessionComHandMuteRingingToneL( 
+    const RMessage2& aMessage )
+    {
+    CmdSubSessionComHandForwardRequestL( aMessage );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandler::IsCancelAllowed
+// 
+// Handle cancel command capability check
+// -----------------------------------------------------------------------------
+//    
+TBool CPhSrvSubSessionCommandHandler::IsCancelAllowed(
+    const RMessage2& aMessage ) 
+    {
+    TBool permissionStatus ( EFalse );
+    
+    TBool hasCapNetworkControlAndServices( EFalse );
+    TBool hasCapNetworkServices( EFalse );
+    hasCapNetworkControlAndServices = aMessage.HasCapability( ECapabilityNetworkControl, 
+                                                              ECapabilityNetworkServices  );
+    hasCapNetworkServices = aMessage.HasCapability( ECapabilityNetworkServices );
+ 
+    
+    // Read parameters from client's address space.
+    TPhCltComHandCommandParameters comHandParams;
+    TPckg< TPhCltComHandCommandParameters > 
+        pComHandParams( comHandParams );
+    Read(
+        aMessage,
+        0,
+        pComHandParams );
+        
+    switch ( comHandParams.iCommandHandlerCommand )    
+        {
+        case EPhCltCommandAtd:
+        case EPhCltCommandAta:
+            if ( hasCapNetworkControlAndServices )
+                {
+                permissionStatus = ETrue;
+                }
+            break;
+        case EPhCltCommandChld:
+        case EPhCltCommandChup:
+        case EPhCltCommandVts:
+            if ( hasCapNetworkServices )
+                {
+                permissionStatus = ETrue;
+                }
+            break;
+        default:
+            break;
+        }
+    
+    return permissionStatus;
+    }    
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/commandhandler/cphsrvsubsessioncommandhandlernotify.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,281 @@
+/*
+* Copyright (c) 2003-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:  Sub Session Command handler notify.
+*                The stub version of this file can be found from file
+*                CPhSrvSubSessionCommandHandlerNotifyStub.cpp
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "cphsrvsubsessioncommandhandlernotify.h" 
+#include    "cphsrvsession.h" 
+#include    "cphsrvserver.h" 
+#include    <phclttypes.h> 
+#include    "mphsrvcomhandnegotiators.h" 
+
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandlerNotify::CPhSrvSubSessionCommandHandlerNotify
+// 
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvSubSessionCommandHandlerNotify::CPhSrvSubSessionCommandHandlerNotify( 
+    CPhSrvSession& aSession )
+:   CPhSrvSubSessionBase( aSession, EPhSrvSubSessionTypeComHandNotify )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandlerNotify::NewL
+// 
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvSubSessionBase* 
+    CPhSrvSubSessionCommandHandlerNotify::NewL(
+        CPhSrvSession& aSession )
+    {
+    // Just to make sure that the destructor does not leave.
+    aSession.PhoneServer().ComHandNegotiatorL();
+
+    CPhSrvSubSessionBase* self = 
+        new( ELeave ) CPhSrvSubSessionCommandHandlerNotify( aSession );
+    
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandlerNotify::~CPhSrvSubSessionCommandHandlerNotify
+// 
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvSubSessionCommandHandlerNotify::~CPhSrvSubSessionCommandHandlerNotify()
+    {
+    // Inform that we are not ready to process requests anymore.
+    if ( PhoneSession().PhoneServer().IsComHandNegotiator() )
+        {
+        PhoneSession().
+            PhoneServer().
+                ComHandNegotiator().
+                    SetNegotiatorReadyRequestCancel( *this );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandlerNotify::PhSrvMessageDecoderCanProcessMessage
+// 
+// Framework function. Returns ETrue for the op codes that
+// this subsession can handle.
+// -----------------------------------------------------------------------------
+//
+TBool 
+    CPhSrvSubSessionCommandHandlerNotify::PhSrvMessageDecoderCanProcessMessage(
+        TInt aFunction )
+    {
+    switch( aFunction )
+        {
+        case EPhoneServerComHandNotifySubSessionClose:
+        case EPhoneServerComHandNotifySubSessionComHandRequest:
+        case EPhoneServerComHandNotifySubSessionComHandRequestCancel:
+        case EPhoneServerComHandNotifySubSessionReportComHandResult:
+            return ETrue;
+            
+        default:
+            return EFalse;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandlerNotify::PhSrvMessageProcessorHandleMessageL
+// 
+// Framework function. Handle any op-codes here.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionCommandHandlerNotify::PhSrvMessageProcessorHandleMessageL(
+    const RMessage2& aMessage )
+    {
+    switch( aMessage.Function() )
+        {
+        case EPhoneServerComHandNotifySubSessionClose:
+            CmdSubSessionClose( aMessage );
+            break;
+
+        case EPhoneServerComHandNotifySubSessionComHandRequest:
+            CmdSubSessionComHandNotifyRequestL( aMessage );
+            break;
+
+        case EPhoneServerComHandNotifySubSessionComHandRequestCancel:
+            CmdSubSessionComHandNotifyRequestCancelL( aMessage );
+            break;
+
+        case EPhoneServerComHandNotifySubSessionReportComHandResult:
+            CmdSubSessionComHandNotifyReportL( aMessage );
+            break;
+            
+        default:
+            PhoneSession().PanicClient(
+                aMessage,
+                EPhCltServerInitiatedPanicInvalidRequest );
+            break;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandlerNotify::InitiatorMakeAsynchronousComHandRequest
+// 
+// Called by the command handler negotiator when it wants this object to 
+// initiate a command handler request (on behalf of the external interface).
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionCommandHandlerNotify::
+    InitiatorMakeAsynchronousComHandRequest( 
+    const TPhCltComHandCommandParameters& aParams )
+    {
+    // Package up the data to send
+    TPckgC< TPhCltComHandCommandParameters > 
+        comHandDetails( aParams );
+
+    // Write to command handler notifier's address space
+    PhoneSession().Write( 
+        iPendingComHandRequestPointer,
+        0,
+        comHandDetails );
+
+    // Indicate that the command handler notifier should try to perform the 
+    // request.
+    if ( !iPendingComHandRequestPointer.IsNull() )
+        {
+        iPendingComHandRequestPointer.Complete( KErrNone );
+        }
+    iHavePendingComHandRequestPointer = EFalse;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandlerNotify::InitiatorIsReadyToPerformRequest
+// 
+// Does this session have a pending request?
+// -----------------------------------------------------------------------------
+//
+TBool CPhSrvSubSessionCommandHandlerNotify::InitiatorIsReadyToPerformRequest() 
+    const
+    {
+    return iHavePendingComHandRequestPointer;
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandlerNotify::CmdSubSessionClose
+// 
+// Close the sub-session.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionCommandHandlerNotify::CmdSubSessionClose(
+    const RMessage2& aMessage )
+    {
+    PhoneSession().CloseSubSession( aMessage );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandlerNotify::CmdSubSessionComHandNotifyRequestL
+// 
+// Handle command handler notifier's request.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionCommandHandlerNotify::CmdSubSessionComHandNotifyRequestL( 
+    const RMessage2& aMessage )
+    {
+    // Update our pending request pointer if it's not already set
+    if  ( iHavePendingComHandRequestPointer )
+        {
+        PhoneSession().PanicClient(
+            aMessage,
+            EPhCltServerInitiatedPanicRequestAlreadyActive );
+        }
+    else
+        {
+        iPendingComHandRequestPointer = aMessage;
+        iHavePendingComHandRequestPointer = ETrue;
+
+        // The phone app engine is ready to process a command handler request.
+        // Tell the negotiator that we're ready to process any pending 
+        // requests.
+        MPhSrvComHandNegotiator& comHandNegotiator = 
+            PhoneSession().PhoneServer().ComHandNegotiatorL();
+        comHandNegotiator.SetNegotiatorReadyRequestL( *this );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandlerNotify::
+// CmdSubSessionComHandNotifyRequestCancelL
+// 
+// Handle command handler notifier's request cancel.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionCommandHandlerNotify::
+    CmdSubSessionComHandNotifyRequestCancelL( 
+        const RMessage2& aMessage )
+    {
+    if  ( iHavePendingComHandRequestPointer )
+        {
+        iPendingComHandRequestPointer.Complete( KErrCancel );
+        iHavePendingComHandRequestPointer = EFalse;
+        }
+
+    aMessage.Complete( KErrNone );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandlerNotify::CmdSubSessionComHandNotifyReportL
+// 
+// Tell the result of the request execution to the command handler client.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionCommandHandlerNotify::CmdSubSessionComHandNotifyReportL( 
+    const RMessage2& aMessage )
+    {
+    // Get result
+    const TPhCltPhoneResults result = 
+        static_cast< TPhCltPhoneResults >( aMessage.Int0() );
+
+    // Tell command handler negotiator of result
+    MPhSrvComHandNegotiator& comHandNegotiator = 
+        PhoneSession().PhoneServer().ComHandNegotiatorL();
+    comHandNegotiator.SetNegotiatorAttemptedRequestResponseValue( result );
+
+    // Complete the request
+    aMessage.Complete( KErrNone );
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/commandhandler/cphsrvsubsessioncommandhandlernotifystub.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,143 @@
+/*
+* Copyright (c) 2003-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:  Stub implementation for Sub Session Command handler notify.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "cphsrvsubsessionbase.h" 
+#include "cphsrvsession.h" 
+#include "cphsrvserver.h" 
+#include <phclttypes.h> 
+#include "mphsrvcomhandnegotiators.h" 
+#include "cphsrvsubsessioncommandhandlernotify.h" 
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandlerNotify::
+//     CPhSrvSubSessionCommandHandlerNotify
+// 
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvSubSessionCommandHandlerNotify::CPhSrvSubSessionCommandHandlerNotify( 
+    CPhSrvSession& aSession )
+:   CPhSrvSubSessionBase( aSession, EPhSrvSubSessionTypeComHandNotify )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandlerNotify::NewL
+// 
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvSubSessionBase* 
+CPhSrvSubSessionCommandHandlerNotify::NewL(
+    CPhSrvSession& aSession )
+    {
+    CPhSrvSubSessionBase* self = 
+        new( ELeave ) CPhSrvSubSessionCommandHandlerNotify( aSession );
+    
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandlerNotify::~CPhSrvSubSessionCommandHandlerNotify
+// 
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvSubSessionCommandHandlerNotify::~CPhSrvSubSessionCommandHandlerNotify()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandlerNotify::PhSrvMessageDecoderCanProcessMessage
+// 
+// Framework function. Returns ETrue for the op codes that
+// this subsession can handle.
+// -----------------------------------------------------------------------------
+//
+TBool
+CPhSrvSubSessionCommandHandlerNotify::PhSrvMessageDecoderCanProcessMessage(
+    TInt aFunction )
+    {
+    switch( aFunction )
+        {
+        case EPhoneServerComHandNotifySubSessionClose:
+        case EPhoneServerComHandNotifySubSessionComHandRequest:
+        case EPhoneServerComHandNotifySubSessionComHandRequestCancel:
+        case EPhoneServerComHandNotifySubSessionReportComHandResult:
+            return ETrue;
+            
+        default:
+            return EFalse;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandlerNotify::PhSrvMessageProcessorHandleMessageL
+// 
+// Framework function. Handle any op-codes here.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionCommandHandlerNotify::PhSrvMessageProcessorHandleMessageL(
+    const RMessage2& /* aMessage */ )
+    {
+    // Stub implementation, i.e. functionality not supported.
+    User::Leave( KErrNotSupported );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandlerNotify::InitiatorMakeAsynchronousComHandRequest
+// 
+// Called by the command handler negotiator when it wants this object to 
+// initiate a command handler request (on behalf of the external interface).
+// -----------------------------------------------------------------------------
+//
+void 
+CPhSrvSubSessionCommandHandlerNotify::InitiatorMakeAsynchronousComHandRequest(
+    const TPhCltComHandCommandParameters& /* aParams */ )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandlerNotify::InitiatorIsReadyToPerformRequest
+// 
+// Does this session have a pending request?
+// -----------------------------------------------------------------------------
+//
+TBool
+CPhSrvSubSessionCommandHandlerNotify::InitiatorIsReadyToPerformRequest() const
+    {
+    return EFalse;
+    }
+
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/commandhandler/cphsrvsubsessioncommandhandlerstub.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2003-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:  Sub implemetation for Sub Session Command handler.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "cphsrvsubsessionbase.h" 
+#include "cphsrvsession.h" 
+#include "cphsrvserver.h" 
+#include <phclttypes.h> 
+#include "mphsrvcomhandnegotiators.h" 
+#include "cphsrvsubsessioncommandhandler.h" 
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandler::CPhSrvSubSessionCommandHandler
+// 
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvSubSessionCommandHandler::CPhSrvSubSessionCommandHandler( 
+    CPhSrvSession& aSession )
+:   CPhSrvSubSessionBase( aSession, EPhSrvSubSessionTypeComHand )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandler::NewL
+// 
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvSubSessionBase* CPhSrvSubSessionCommandHandler::NewL(
+    CPhSrvSession& aSession )
+    {
+    CPhSrvSubSessionBase* self = 
+        new( ELeave ) CPhSrvSubSessionCommandHandler( aSession );
+    
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandler::PhSrvMessageDecoderCanProcessMessage
+// 
+// Framework function. Returns ETrue for the op codes that
+// this subsession can handle.
+// -----------------------------------------------------------------------------
+//
+TBool CPhSrvSubSessionCommandHandler::PhSrvMessageDecoderCanProcessMessage(
+    TInt aFunction )
+    {
+    switch( aFunction )
+        {
+        case EPhoneServerComHandSubSessionOpen:
+        case EPhoneServerComHandSubSessionClose:
+        case EPhoneServerComHandSubSessionAtd:
+        case EPhoneServerComHandSubSessionAta:
+        case EPhoneServerComHandSubSessionChld:
+        case EPhoneServerComHandSubSessionChup:
+        case EPhoneServerComHandSubSessionVts:
+        case EPhoneServerComHandSubSessionCancel:
+        case EPhoneServerComHandSubSessionMuteMic:
+        case EPhoneServerComHandSubSessionMuteRingingTone:
+            return ETrue;
+            
+        default:
+            return EFalse;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionCommandHandler::PhSrvMessageProcessorHandleMessageL
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionCommandHandler::PhSrvMessageProcessorHandleMessageL(
+    const RMessage2& /* aMessage */ )
+    {
+    // Stub implementation, i.e. functionality not supported.
+    User::Leave( KErrNotSupported );
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/imagehandler/cphsrvimagesaver.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,210 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image saver implementation
+*
+*/
+
+
+#include "cphsrvimagesaver.h"
+#include "mphsrvimagesaverobserver.h"
+#include <imageconversion.h>
+#include <f32file.h>
+#include <bitmaptransforms.h>
+
+// primary file name for VT image
+_LIT( KPhSrvPrimaryVtImageFileName, "vtstillimage1" );
+
+// file name used if primary file is in use while save occurs
+_LIT( KPhSrvAlternateVtImageFileName, "vtstillimage2" );
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// 1st constructor
+// ---------------------------------------------------------------------------
+//
+CPhSrvImageSaver* CPhSrvImageSaver::NewL( 
+        RFs& aFs,
+        const TFileName& aPrivatePath, 
+        MPhSrvImageSaverObserver& aObserver )
+    {
+    CPhSrvImageSaver* saver = new ( ELeave ) CPhSrvImageSaver( 
+        aFs, aPrivatePath, aObserver );
+    CleanupStack::PushL( saver );
+    saver->ConstructL();
+    CleanupStack::Pop();
+    return saver;
+    }
+
+// ---------------------------------------------------------------------------
+// destructor
+// ---------------------------------------------------------------------------
+//
+CPhSrvImageSaver::~CPhSrvImageSaver()
+    {
+    delete iImageDecoder;
+    delete iFileManager;
+    delete iScaler;
+    }
+
+// ---------------------------------------------------------------------------
+// Saves image
+// 1) decode from file
+// 2a) scale (for single frame images) and save to phone server private dir, or
+// 2b) multiframe image - copy file as is to phone server private directory
+// ---------------------------------------------------------------------------
+//
+void CPhSrvImageSaver::SaveImageL( const TDesC& aFileName )
+    {
+    if ( IsActive() )
+        {
+        User::Leave( KErrInUse );
+        }
+    iImageDecoder = CImageDecoder::FileNewL( iFs, aFileName );
+    const TInt frameCount = iImageDecoder->FrameCount();
+    if ( frameCount > 1 )
+        {
+        // decoder not needed because image is copied as is
+        delete iImageDecoder;
+        iImageDecoder = NULL;
+        CopyImageL( aFileName );
+        }
+    else if ( frameCount == 1 )
+        {
+        ScaleImageL();
+        }
+    else
+        {
+        // invalid image?
+        User::Leave( KErrCorrupt );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Copies the file
+// ---------------------------------------------------------------------------
+//
+void CPhSrvImageSaver::CopyImageL( const TDesC& aFileName )
+    {
+    TName targetFileName;
+    ConstructVtFileSaveName( aFileName, targetFileName );
+    iFileManager = CFileMan::NewL( iFs );
+    iFileManager->Copy( aFileName, targetFileName, 
+        CFileMan::EOverWrite, iStatus );    
+    }
+
+// ---------------------------------------------------------------------------
+// ScaleImageL
+// ---------------------------------------------------------------------------
+//
+void CPhSrvImageSaver::ScaleImageL()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Checks if primary file is in use.
+// ---------------------------------------------------------------------------
+//
+TInt CPhSrvImageSaver::IsPrimaryFileInUse( TBool& aIsInUse )
+    {
+    CDir* entries = NULL;
+    TInt res = iFs.GetDir( iPath, KEntryAttNormal, EDirsLast, entries );
+    if ( res == KErrNone && entries )
+        {
+        const TInt entryCount( entries->Count() );
+        for ( TInt index = 0; index < entryCount; index++ )
+            {
+            const TEntry& entry = ( *entries )[index];            
+            if ( entry.iName.Compare( KPhSrvPrimaryVtImageFileName() ) >= 0 )
+                {
+                // primary file name matches with directory entry (extension
+                // depends on file format)
+                res = iFs.IsFileOpen( entry.iName, aIsInUse );
+                index = entryCount; // break loop
+                }
+            }
+        }
+    delete entries;
+    return res;
+    }
+    
+// ---------------------------------------------------------------------------
+// Constructs target file name for VT still image. Alternate name is used if
+// file with primary name is open.
+// ---------------------------------------------------------------------------
+//
+TInt CPhSrvImageSaver::ConstructVtFileSaveName(
+    const TDesC& aSourceFileName, 
+    TName& aTargetFileName )
+    {
+    TBool inUse( EFalse );
+    TInt res( IsPrimaryFileInUse( inUse ) );
+    if ( res == KErrNone )
+        {
+        TParse sourceName;
+        sourceName.Set( aSourceFileName, NULL, NULL );
+        aTargetFileName = iPath;        
+        if ( inUse )
+            {
+            // primary file in use (open), use alternalte name
+            aTargetFileName.Append( KPhSrvAlternateVtImageFileName() );
+            }
+        else
+            {
+            aTargetFileName.Append( KPhSrvPrimaryVtImageFileName() );
+            }
+        aTargetFileName.Append( sourceName.Ext() );
+        }
+    return res;
+    }
+    
+// ---------------------------------------------------------------------------
+// CPhSrvImageSaver::RunL
+// ---------------------------------------------------------------------------
+//
+void CPhSrvImageSaver::RunL()
+    {
+    iObserver.ImageSaved( iStatus.Int() );
+    }
+    
+// ---------------------------------------------------------------------------
+// CPhSrvImageSaver::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CPhSrvImageSaver::DoCancel()
+    {
+    iObserver.ImageSaved( KErrCancel );
+    }
+    
+// ---------------------------------------------------------------------------
+// CPhSrvImageSaver::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CPhSrvImageSaver::ConstructL()
+    {
+    User::Leave( KErrNotSupported );
+    }
+    
+// ---------------------------------------------------------------------------
+// c++ constructor
+// ---------------------------------------------------------------------------
+//
+CPhSrvImageSaver::CPhSrvImageSaver( RFs& aFs, const TFileName& aPrivatePath,
+    MPhSrvImageSaverObserver& aObserver) 
+    : CActive( CActive::EPriorityStandard ), 
+    iFs( aFs ), 
+    iPath( aPrivatePath ),
+    iObserver( aObserver )
+    {
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/imagehandler/cphsrvsubsessionimagehandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,1103 @@
+/*
+* 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:  Sub Session image handler.
+*                Does image saving and loading.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "cphsrvsubsessionimagehandler.h" 
+#include    "cphsrvsession.h" 
+#include    "cphsrvserver.h" 
+#include    <e32property.h>
+#include    <phclttypes.h> 
+#include    "phsrvdebuginfo.h" 
+
+// CONSTANTS
+_LIT( KPhSrvImageDriveRom, "z:" );
+_LIT( KPhSrvVTImageName, "vtstillimage" );
+_LIT( KPhSrvVTDefaultImageName, "vtdefaultimage." );
+_LIT( KPhSrvImageSuffix, ".mbm" );
+_LIT( KPhSrvImageWildCard, "*" );
+_LIT( KPhSrvLogoMncMccSeparator, "_" );
+_LIT( KPhSrvLogoTypeIndicatorOTA, "OTA" );
+_LIT( KPhSrvLogoTypeIndicatorProg, "Prog" );
+_LIT( KPhSrvOperatorLogoPrefix, "Logo" );
+const TInt KPhSrvNameMaxLen = 1024;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionImageHandler::CPhSrvSubSessionImageHandler
+// 
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvSubSessionImageHandler::CPhSrvSubSessionImageHandler( 
+    CPhSrvSession& aSession )
+:   CPhSrvSubSessionBase( aSession, EPhSrvSubSessionTypeImageHandler )
+    {
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::Ctor" )
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionImageHandler::~CPhSrvSubSessionImageHandler
+// 
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvSubSessionImageHandler::~CPhSrvSubSessionImageHandler()
+    {
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::Dtor" )
+    iVTBitMaps.ResetAndDestroy();
+    iOperatorLogos.ResetAndDestroy();
+    PhoneSession().PhoneServer().DisconnectFBS();
+    iFs.Close();
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::Dtor>" )    
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionImageHandler::NewL
+// 
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvSubSessionBase* CPhSrvSubSessionImageHandler::NewL(
+    CPhSrvSession& aSession )
+    {
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::NewL" )    
+    CPhSrvSubSessionBase* self = 
+        new( ELeave ) CPhSrvSubSessionImageHandler( aSession );
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::NewL>" )        
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionImageHandler::ImageSaved
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionImageHandler::ImageSaved( TInt aResult )
+    {
+    iImageSaver = NULL;
+    // Message for save request
+    iSaveVtImageMessage.Complete( aResult );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionImageHandler::PhSrvMessageDecoderCanProcessMessage
+// 
+// Framework function. Returns ETrue for the op codes that
+// this subsession can handle.
+// -----------------------------------------------------------------------------
+//
+TBool CPhSrvSubSessionImageHandler::PhSrvMessageDecoderCanProcessMessage( 
+    TInt aFunction )
+    {
+    _DDPRINT( 4, "CPhSrvSubSessionImageHandler::CanProcess", aFunction )    
+    switch( aFunction )
+        {
+        case EPhoneServerImageHandlerSubSessionOpen:
+        case EPhoneServerImageHandlerSubSessionClose:
+        case EPhoneServerImageHandlerSubSessionSave:
+        case EPhoneServerImageHandlerSubSessionLoad:
+        case EPhoneServerImageHandlerSubSessionCommitLoad:
+        case EPhoneServerOpenVtImage:
+        // new saving scheme 
+        case EPhoneServerSaveVtImage:
+        case EPhoneServerSaveVtImageCancel:
+            return ETrue;
+            
+        default:
+            return EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionImageHandler::PhSrvMessageProcessorHandleMessageL
+// 
+// Framework function. Handle any op-codes here.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionImageHandler::PhSrvMessageProcessorHandleMessageL( 
+    const RMessage2& aMessage )
+    {
+    _DDPRINT( 4, "CPhSrvSubSessionImageHandler::Handle", 
+        aMessage.Function() )
+    TBool permissionStatus ( EFalse );
+    
+    // Check needed capabilities    
+    TBool hasCapWriteDeviceData( EFalse );
+    hasCapWriteDeviceData = aMessage.HasCapability( ECapabilityWriteDeviceData );
+    TBool hasCapReadDeviceData( EFalse );
+    hasCapReadDeviceData = aMessage.HasCapability( ECapabilityReadDeviceData );
+
+    switch( aMessage.Function() )
+        {
+        case EPhoneServerImageHandlerSubSessionClose:
+            CmdSubSessionClose( aMessage );
+            permissionStatus = ETrue;
+            break;
+
+        case EPhoneServerImageHandlerSubSessionSave:
+            if ( hasCapWriteDeviceData )
+                {        
+                CmdSubSessionSaveImagesL( aMessage );
+                permissionStatus = ETrue;
+                }
+            break;
+            
+        case EPhoneServerImageHandlerSubSessionCommitLoad:
+            if ( hasCapReadDeviceData )
+                {        
+                CmdSubSessionCommitLoadL( aMessage );
+                permissionStatus = ETrue;
+                }
+            break;
+            
+
+        case EPhoneServerImageHandlerSubSessionLoad:
+            if ( hasCapReadDeviceData )
+                {        
+                CmdSubSessionLoadImagesL( aMessage );
+                permissionStatus = ETrue;
+                }
+            break;
+        case EPhoneServerOpenVtImage:
+            if ( hasCapReadDeviceData )
+                {        
+                CmdSubSessionOpenDefaultVtImageL( aMessage );
+                permissionStatus = ETrue;
+                }
+            break;
+        case EPhoneServerSaveVtImage:
+            if ( hasCapWriteDeviceData )
+                {
+                CmdSubSessionSaveVtImageL( aMessage );
+                permissionStatus = ETrue;
+                }
+            break;
+        case EPhoneServerSaveVtImageCancel:            
+            if ( hasCapWriteDeviceData )
+                {
+                permissionStatus = ETrue;
+                if ( iImageSaver )
+                    {
+                    // saving in progress, cancel it.
+                    iImageSaver->Cancel();
+                    }
+                else
+                    {
+                    // nothing to cancel or too late cancellation 
+                    iSaveVtImageMessage.Complete( KErrNotReady );
+                    }
+                }
+            break;
+        default:
+            _DPRINT( 4, "CPhSrvSubSessionImageHandler::Handle: PANIC" )        
+            PhoneSession().PanicClient(
+                aMessage,
+                EPhCltServerInitiatedPanicInvalidRequest );
+            break;
+        }
+    
+    // If caps are not ok
+    if( !permissionStatus )
+        {
+        aMessage.Complete( KErrPermissionDenied );
+        }   
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::Handle>" )
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionImageHandler::CmdSubSessionClose
+// 
+// Close the sub-session.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionImageHandler::CmdSubSessionClose( 
+    const RMessage2& aMessage )
+    {
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::Close" )    
+    PhoneSession().CloseSubSession( aMessage );
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::Close>" )    
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionImageHandler::CmdSubSessionSaveImagesL
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionImageHandler::CmdSubSessionSaveImagesL( 
+    const RMessage2& aMessage )
+    {
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::Save" )    
+    TPhCltImageArray handles;
+    TPckg< TPhCltImageArray > pHandles( handles );
+    
+    Read( aMessage, 0, pHandles );
+
+    // Version check in here, if multiple possibilities.
+    switch( pHandles().iType )
+        {
+        case EPhCltTypeVTStill:
+            DoSaveVTImageL( handles );
+            break;
+        case EPhCltTypeOperatorLogo:
+            DoSaveOperatorLogoL( handles );
+            break;
+        default:
+            _DPRINT( 4, "CPhSrvSubSessionImageHandler::Save US" )        
+            User::Leave( KErrNotSupported );
+        }
+
+    // Leave is propagated into framework.
+    aMessage.Complete( KErrNone );
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::Save>" )    
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionImageHandler::CmdSubSessionLoadImagesL
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionImageHandler::CmdSubSessionLoadImagesL( 
+    const RMessage2& aMessage )
+    {
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::Load" )    
+    TPhCltImageArray handles;
+    TPckg< TPhCltImageArray > pHandles( handles );
+
+    Read( aMessage, 0, pHandles );
+
+    // Version check in here, if multiple possibilities.
+    switch( pHandles().iType )
+        {
+        case EPhCltTypeVTStill:
+        case EPhCltTypeVTDefault:
+            DoLoadVTImagesL( handles );
+            break;
+        case EPhCltTypeOperatorLogo:
+            DoLoadOperatorLogoL( handles );
+            break;
+        default:
+            _DPRINT( 4, "CPhSrvSubSessionImageHandler::Load US" )        
+            User::Leave( KErrNotSupported );
+        }
+    
+    Write( aMessage, 0, pHandles );
+    aMessage.Complete( KErrNone );
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::Load>" )    
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionImageHandler::CmdSubSessionOpenDefaultVtImageL
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionImageHandler::CmdSubSessionOpenDefaultVtImageL( 
+    const RMessage2& aMessage )
+    {
+    _DPRINT( 4, 
+        "CPhSrvSubSessionImageHandler::CmdSubSessionOpenDefaultVtImageL<" )
+    TBool defaultImage( ETrue );
+    TPckg< TBool > pckg( defaultImage );
+    Read( aMessage, 1, pckg );
+
+    // Currently only default still image uses file handle sharing. User
+    // defined image uses legacy scheme. If user defined image is attempted
+    // to open here, complete with error.
+    if ( !defaultImage )
+        {
+        User::Leave( KErrNotSupported );
+        }
+    
+    RFs fs;
+    RFile defaultVtImageFile;    
+    TFileName fileName;
+                                                     
+    // File extension may be any supported file type. Resolve which one is used.
+    User::LeaveIfError( ResolveDefaultVtImageFileName( fileName ) );    
+    
+    // Open separate session because ownwership of transferred file's
+    // session goes with the file (when file is closed by the client,
+    // related session is also closed)
+    User::LeaveIfError( fs.Connect() );
+    CleanupClosePushL( fs );
+     
+    User::LeaveIfError( defaultVtImageFile.Open( fs, fileName, EFileRead ) );
+    
+    // Transfer file handle to client by writing file handle value to
+    // message argument 0
+    User::LeaveIfError( 
+        defaultVtImageFile.TransferToClient( aMessage, 0 ) );    
+    defaultVtImageFile.Close(); // file handle duplicated for client
+    CleanupStack::PopAndDestroy(); // fs, can be closed, handle duplicated
+     
+    _DPRINT( 4, 
+        "CPhSrvSubSessionImageHandler::CmdSubSessionOpenDefaultVtImageL>" )
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionImageHandler::ResolveDefaultVtImageFileName
+// 
+// Resolves file name of default VT image. Extension cannot be known
+// in advance and directory entries must be read and parsed.
+// -----------------------------------------------------------------------------
+//
+TInt CPhSrvSubSessionImageHandler::ResolveDefaultVtImageFileName(
+    TDes& aFileName )
+    {
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::ResolveDefaultVtImageFileName<" )
+    CDir* entries = NULL;    
+    TFileName path = KPhSrvImageDriveRom();
+    
+    // read directory entries in the server private path
+    path.Append( iFilePath );    
+    TInt result = iFs.GetDir( path, KEntryAttNormal, EDirsLast, entries );
+    if ( result == KErrNone && entries )
+        {
+        const TInt entryCount( entries->Count() );
+        // go through entries and stop when VT image file is found
+        for ( TInt index = 0; index < entryCount; index++ )
+            {
+            const TEntry& entry = ( *entries )[index];  
+            if ( entry.iName.Find( KPhSrvVTDefaultImageName() ) > KErrNotFound )
+                {
+                aFileName = path;
+                aFileName.Append( entry.iName );
+                // fileName now contains full path
+                index = entryCount; // break loop
+                result = KErrNone;
+                }
+            }
+        }
+    delete entries;
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::ResolveDefaultVtImageFileName>" )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionImageHandler::CmdSubSessionSaveVtImageL
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionImageHandler::CmdSubSessionSaveVtImageL( 
+    const RMessage2& aMessage )
+    {
+    TFileName sourceFile;
+    TPckg<TFileName> pckg( sourceFile );
+    
+    Read( aMessage, 0, pckg );
+    CPhSrvImageSaver* saver = CPhSrvImageSaver::NewL( iFs, iFilePath, *this );
+    CleanupStack::PushL( saver );
+    saver->SaveImageL( sourceFile );
+    CleanupStack::Pop();
+    iImageSaver = saver;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionImageHandler::CmdSubSessionCommitLoadL
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionImageHandler::CmdSubSessionCommitLoadL( 
+    const RMessage2& aMessage )
+    {
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::Commit" )    
+    TPhCltImageArray handles;
+    TPckg< TPhCltImageArray > pHandles( handles );
+
+    Read( aMessage, 0, pHandles );
+    
+    switch ( pHandles().iType )
+        {
+        case EPhCltTypeVTStill:
+        case EPhCltTypeVTDefault:
+            DoCommitLoadVTL();
+            break;
+        case EPhCltTypeOperatorLogo:
+            DoCommitLoadLogo( handles );
+            break;
+        default:
+            _DPRINT( 4, "CPhSrvSubSessionImageHandler::Commit US" )        
+            User::Leave( KErrNotSupported );        
+        }
+    aMessage.Complete( KErrNone );
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::Commit" )    
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionImageHandler::DoCommitLoadVTL
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionImageHandler::DoCommitLoadVTL()
+    {
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::CommitVT" )    
+    iVTBitMaps.ResetAndDestroy(); 
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::CommitVT>" )        
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionImageHandler::DoCommitLoadLogo
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionImageHandler::DoCommitLoadLogo( TPhCltImageArray& aImages )
+    {
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::CommitLogo" )        
+    for ( TInt i = 0; i < iOperatorLogos.Count(); i ++ )
+        {
+        if ( aImages.iImages[ EPhCltExtCountryCodeIndex ] == 
+            iOperatorLogos[ i ]->iCountryCode && 
+            aImages.iImages[ EPhCltExtNetworkCodeIndex ] == 
+            iOperatorLogos[ i ]->iNetworkCode )
+            {
+            _DPRINT( 4, "CPhSrvSubSessionImageHandler::CommitLogo found" )                
+            delete iOperatorLogos[ i ];
+            iOperatorLogos.Remove( i );
+            break;
+            }
+        }
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::CommitLogo>" )            
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionImageHandler::DoSaveVTImage
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionImageHandler::DoSaveVTImageL( TPhCltImageArray& aImages )
+    {
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::SaveVT" )        
+    HBufC* hbuf = HBufC::NewLC(KPhSrvNameMaxLen);
+    TPtr buf = hbuf->Des();
+    for ( TInt i = 0; i < aImages.iImageCount; i++ )
+        {
+        buf.Zero();
+        buf.Append( iDriveName );
+        buf.Append( iFilePath );
+        buf.Append( KPhSrvVTImageName );
+        buf.AppendNum( i );
+        buf.Append( KPhSrvImageSuffix );
+        buf.ZeroTerminate();
+#ifdef __PHENG_DEBUG_INFO__
+        RDebug::Print( _L("CPhSrvSubSessionImageHandler::SaveVT: %S"), &buf );
+#endif
+        CFbsBitmap* bitMap = new ( ELeave ) CFbsBitmap();
+        CleanupStack::PushL( bitMap );
+        User::LeaveIfError( bitMap->Duplicate( aImages.iImages[ i ] ) );
+        User::LeaveIfError( bitMap->Save( buf ) );
+        CleanupStack::PopAndDestroy( bitMap );
+        }
+    CleanupStack::PopAndDestroy( hbuf );
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::SaveVT>" )        
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionImageHandler::DoLoadVTImagesL
+// 
+// Loads images.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionImageHandler::DoLoadVTImagesL( TPhCltImageArray& aImages )
+    {
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::LoadVT" )    
+    // Load the images from file.
+    const TBool loadDefaultImage = aImages.iType == EPhCltTypeVTDefault;    
+    DoReadVTImagesL( loadDefaultImage );
+    
+    // Copy handles.
+    aImages.iImageCount = iVTBitMaps.Count();
+    for ( TInt i = 0; i < aImages.iImageCount; i++ )
+        {
+        aImages.iImages[ i ] = iVTBitMaps[ i ]->Handle();
+        _DDPRINT( 4, 
+            "CPhSrvSubSessionImageHandler::LoadVT: ", aImages.iImages[ i ] )
+        }
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::LoadVT>" )        
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionImageHandler::DoReadVTImagesL
+// 
+// Loads images.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionImageHandler::DoReadVTImagesL( const TBool aDefaultImage )
+    {
+    _DDPRINT( 4, "CPhSrvSubSessionImageHandler::ReadVT is default=", aDefaultImage )     
+    iVTBitMaps.ResetAndDestroy();
+    
+    TPtrC path; // pointer to sub-string of searchPath containing drive+path
+    
+    // Search path = drive + path + file-name (with wildcard) + extension
+    HBufC* searchPath = ConstructVTImageSearchPathLC( 
+        aDefaultImage, path );
+
+#ifdef __PHENG_DEBUG_INFO__
+        TPtr ptr = searchPath->Des();  // temp pointer to avoid lvalue compile warning
+        RDebug::Print( _L( 
+            "CPhSrvSubSessionImageHandler::ReadVT: %S"), ( &ptr ));
+#endif    
+    RDir dir;
+    User::LeaveIfError( dir.Open( iFs, *searchPath, KEntryAttNormal ) );    
+    CleanupClosePushL( dir );
+    
+    TEntryArray entryArray;
+    TInt readResult = dir.Read( entryArray );
+    _DDPRINT( 4, "CPhSrvSubSessionImageHandler::ReadVT res: ", readResult )
+    HBufC* hbitmapName = HBufC::NewLC( KMaxFileName );
+    TPtr bitmapName = hbitmapName->Des();
+    
+    // If directory entry array read successfully...
+    while( ( readResult == KErrNone ) || ( readResult == KErrEof ) )
+        {
+        const TInt arrayLength = entryArray.Count();
+        _DDPRINT( 4, "CPhSrvSubSessionImageHandler::DoReadVTImagesL count: ", arrayLength )
+        // ...go through directory entries
+        for( TInt i = 0; i < arrayLength; i++ )
+            {
+            const TEntry& entry = entryArray[ i ];
+            const TDesC& name = entry.iName;
+            TBool load = EFalse;
+            // If client wanted default image, load it only
+            if ( aDefaultImage && 
+                 name.FindF( KPhSrvVTDefaultImageName ) == 0 )
+                {
+                /* Next two statements for stopping to process 
+                  directory entries */                       
+                i = arrayLength;
+                readResult = KErrEof;
+                load = ETrue;
+                }
+            // If client wanted still image, load it (or them)
+            else if ( !aDefaultImage &&
+                      name.FindF( KPhSrvVTImageName ) == 0 )
+                {
+                load = ETrue;
+                }
+            if ( load )
+                {
+                CFbsBitmap* bitmap = new ( ELeave ) CFbsBitmap();
+                CleanupStack::PushL( bitmap );
+                bitmapName = path;  // initialize the file path
+                bitmapName.Append( name );
+#ifdef __PHENG_DEBUG_INFO__
+                RDebug::Print( _L( 
+                    "CPhSrvSubSessionImageHandler::ReadVT BM: %S"), 
+                    &bitmapName );
+#endif    
+                User::LeaveIfError( bitmap->Load( bitmapName ) );
+                User::LeaveIfError( iVTBitMaps.Append( bitmap ) );
+                CleanupStack::Pop(); // bitmap
+                }
+            }
+        
+        if ( readResult == KErrEof )
+            {
+            _DPRINT( 4, "CPhSrvSubSessionImageHandler::ReadVT EOF" )            
+            break;            
+            }
+        readResult = dir.Read( entryArray );
+        }
+    CleanupStack::PopAndDestroy( 3 ); // hbitmapName, dir, search path
+    if( ( readResult != KErrNone ) && ( readResult != KErrEof ) )
+        {
+        _DDPRINT( 4, "CPhSrvSubSessionImageHandler::ReadVT Leave", readResult )                    
+        User::Leave( readResult );
+        }    
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::ReadVT>" )
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionImageHandler::DoSaveOperatorLogoL
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionImageHandler::DoSaveOperatorLogoL( TPhCltImageArray& aImages )
+    {
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::SaveLogo" )
+    // Check the values prior saving, 
+    // to check whether deletion is actually ongoing
+    const TPhCltCountryCode mcc = aImages.iImages[ EPhCltExtCountryCodeIndex ];
+    const TPhCltNetworkCode mnc= aImages.iImages[ EPhCltExtNetworkCodeIndex ];
+    const TInt handle = aImages.iImages[ EPhCltExtOperatorLogoIndex ];
+    const TPhCltExtOperatorLogoType logoType = 
+        ( TPhCltExtOperatorLogoType )aImages.iImages[ EPhCltExtLogoTypeIndex ];
+        
+    // Only OTA logos can be saved and deleted.
+    if ( logoType == EPhCltLogoTypeProgrammable )
+        {
+        _DPRINT( 4, "CPhSrvSubSessionImageHandler::SaveLogo PROG" )
+        User::Leave( KErrAccessDenied );
+        }
+
+    _DPRINT( 4, "PhSrvImageHandler::SaveLogo test delete " )        
+    // Check if this a delete command.
+    // If no logo deleted, then this is save command.
+    if ( !DeleteLogoL( mcc, mnc, logoType, handle ) )
+        {
+        _DPRINT( 4, "CPhSrvSubSessionImageHandler::SaveLogo Save" )
+        HBufC* hbuf = HBufC::NewLC(KPhSrvNameMaxLen);
+        TPtr buf = hbuf->Des();
+        ConstructLogoFileNameL( mcc, mnc, logoType, buf );
+        CFbsBitmap* bitMap = new ( ELeave ) CFbsBitmap();
+        CleanupStack::PushL( bitMap );
+        User::LeaveIfError( bitMap->Duplicate( 
+            aImages.iImages[ EPhCltExtOperatorLogoIndex ] ) );
+        User::LeaveIfError( bitMap->Save( buf ) );
+        CleanupStack::PopAndDestroy( 2, hbuf );   // hbuf, bitMap
+        NotifyListeners( // Error ignored.
+            mcc, mnc, TTelephonyOTALogoUpdate::EPSTelephonyLogoChanged );
+        // new P&S key update         
+        NotifyListeners( // Error ignored.
+            mcc, mnc, TTelOTALogoUpdate::EPSTelephonyLogoChanged );
+        }
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::SaveLogo>" )                
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionImageHandler::DoLoadOperatorLogoL
+// 
+// Loads images.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionImageHandler::
+    DoLoadOperatorLogoL( TPhCltImageArray& aImages )
+    {
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::LoadLogo" )            
+    // Construct the file path first.
+    HBufC* hbuf = HBufC::NewLC(KPhSrvNameMaxLen);
+    TPtr buf = hbuf->Des();
+    TInt err( KErrNone );
+    ConstructLogoFileNameL( aImages.iImages[ EPhCltExtCountryCodeIndex ], 
+        aImages.iImages[ EPhCltExtNetworkCodeIndex ], 
+        ( TPhCltExtOperatorLogoType ) aImages.iImages[ EPhCltExtLogoTypeIndex ],
+        buf );
+    
+    // Load the image.
+    CFbsBitmap* bitMap = new ( ELeave ) CFbsBitmap();
+    CleanupStack::PushL( bitMap );
+    err = bitMap->Load( buf );
+    if ( err == KErrPathNotFound )
+        {
+        err = KErrNotFound;
+        }
+    User::LeaveIfError( err );    
+    
+    CPhSrvOperatorLogoContainer* logoContainer = 
+        new (ELeave)CPhSrvOperatorLogoContainer( 
+        aImages.iImages[ EPhCltExtCountryCodeIndex ], 
+        aImages.iImages[ EPhCltExtNetworkCodeIndex ], 
+        ( TPhCltExtOperatorLogoType ) aImages.iImages[ EPhCltExtLogoTypeIndex ],
+        bitMap );
+    aImages.iImages[ EPhCltExtOperatorLogoIndex ] = bitMap->Handle();
+    aImages.iImageCount = 1;
+    CleanupStack::PushL(logoContainer);
+    iOperatorLogos.AppendL( logoContainer );
+    CleanupStack::Pop(logoContainer);
+    CleanupStack::Pop( bitMap );
+    CleanupStack::PopAndDestroy( hbuf );
+    
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::LoadLogo>" )            
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionImageHandler::MakeImageDirL
+// 
+// Creates directory structure.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionImageHandler::MakeImageDirL()
+    {
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::MakeDir" )    
+    TDriveNumber sysDrive;
+    User::LeaveIfError( BaflUtils::GetSystemDrive( sysDrive ) );
+    iDriveName.Format( _L("%c:"), sysDrive +'A' );
+    const TInt err( iFs.CreatePrivatePath( sysDrive ) );
+    if (  err != KErrAlreadyExists && err != KErrNone )
+        {
+        User::Leave( err );
+        }
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::MakeDir>" )            
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionImageHandler::ConstructVTImageSearchPathLC
+// 
+// Construct search path for VT image.
+// -----------------------------------------------------------------------------
+//
+HBufC* CPhSrvSubSessionImageHandler::ConstructVTImageSearchPathLC( 
+    const TBool aDefaultImage,
+    TPtrC& aPath ) const
+    {
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::ConstructVTImageSearchPathLC<" )
+    HBufC* hfilePath = HBufC::NewLC( KMaxFileName );
+    TPtr filePath = hfilePath->Des();
+
+    filePath = iFilePath; // = "\private\<phone server uid>\"
+
+    if ( aDefaultImage )
+        {
+        // = "z:\private\<phone server uid>\"
+        //    ==
+        filePath.Insert( 0, KPhSrvImageDriveRom );      
+        
+        aPath.Set( filePath );
+        
+        // = "z:\private\<phone server uid>\vtdefaultimage"
+        //                                  ==============
+        filePath.Append( KPhSrvVTDefaultImageName() );  
+        }
+    else
+        {
+        // = "c:\private\<phone server uid>\"
+        //    ==
+        filePath.Insert( 0, iDriveName );
+        
+        aPath.Set( filePath );
+        
+        // = "c:\private\<phone server uid>\vtstillimage"         
+        //                                  ============
+        filePath.Append( KPhSrvVTImageName() );
+        }        
+    // = "c:\private\<phone server uid>\<still|default>*"
+    //                                                 =
+    filePath.Append( KPhSrvImageWildCard() );           
+    
+    // = "c:\private\<phone server uid>\<still|default>*.mbm"
+    //                                                  ====
+    filePath.Append( KPhSrvImageSuffix() );             
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::ConstructVTImageSearchPathLC>" )
+    return hfilePath;
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionImageHandler::ConstructL
+// 
+// 2nd phase construction.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionImageHandler::ConstructL()
+    {
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::CtorL" )        
+    PhoneSession().PhoneServer().ConnectFBS();
+    User::LeaveIfError( iFs.Connect() );
+    User::LeaveIfError( iFs.ShareProtected() );
+    MakeImageDirL();
+    User::LeaveIfError( iFs.PrivatePath( iFilePath ) );
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::CtorL>" )  
+    }
+ 
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionImageHandler::DeleteLogoL
+// 
+// Checks if logo(s) should be deleted, and deletes them if needed.
+// -----------------------------------------------------------------------------
+//    
+TBool CPhSrvSubSessionImageHandler::DeleteLogoL( 
+    const TPhCltCountryCode aCountryCode, 
+    const TPhCltNetworkCode aNetworkCode,
+    const TPhCltExtOperatorLogoType aLogoType,
+    const TInt aFileHandle )
+    {
+    _DPRINT( 4, "PhSrvImageHandler::DeleteLogoL" )    
+    TBool deleted = EFalse;
+    
+    _DDPRINT( 4, "CPhSrvSubSessionImageHandler::DelLogo ", aCountryCode )      
+    _DDPRINT( 4, "CPhSrvSubSessionImageHandler::DelLogo ", aNetworkCode )      
+    _DDPRINT( 4, "CPhSrvSubSessionImageHandler::DelLogo ", aLogoType )      
+    _DDPRINT( 4, "CPhSrvSubSessionImageHandler::DelLogo ", aFileHandle )      
+    
+    // Check if all, one or none.
+    if ( aFileHandle == KPhCltDeleteOperatorLogo )
+        {
+        HBufC* hbuf = HBufC::NewLC(KPhSrvNameMaxLen);
+        TPtr buf = hbuf->Des();
+        if ( aCountryCode == KPhCltDeleteOperatorLogo && 
+            aNetworkCode == KPhCltDeleteOperatorLogo )
+            {
+            // Delete all logos.
+            TFindFile* finder = new(ELeave) TFindFile(iFs);
+            CleanupStack::PushL(finder);
+            
+            HBufC* hfilePath = HBufC::NewLC(KMaxFileName);
+            TPtr filePath = hfilePath->Des();
+            filePath = iDriveName;
+            filePath.Append( iFilePath );
+
+            buf.Append( KPhSrvOperatorLogoPrefix );
+            buf.Append( KPhSrvLogoMncMccSeparator );
+            buf.Append( KPhSrvImageWildCard );
+#ifdef __PHENG_DEBUG_INFO__
+    RDebug::Print( _L( 
+        "CPhSrvSubSessionImageHandler::DelLogo: %S"), &buf );
+#endif              
+            CDir* foundFiles = NULL;
+            const TInt err = finder->FindWildByDir( buf, filePath, foundFiles );
+            if ( err != KErrNone )
+                {
+                _DDPRINT( 4, "CPhSrvSubSessionImageHandler::DelLogo Leave", err )
+                delete foundFiles;
+                foundFiles = NULL;
+                User::Leave( err );
+                }
+            for ( TInt i = 0; i < foundFiles->Count(); i++ )
+                {
+                const TEntry& entry = foundFiles->operator[ ]( i );
+#ifdef __PHENG_DEBUG_INFO__
+    RDebug::Print( _L( 
+        "CPhSrvSubSessionImageHandler::DelLogo: rem %S"), &entry.iName );
+#endif                 
+                BaflUtils::DeleteFile( iFs, entry.iName );
+                }
+            delete foundFiles;
+            deleted = ETrue;
+            NotifyListeners( // Error ignored.
+                KPhCltDeleteOperatorLogo, KPhCltDeleteOperatorLogo, 
+                TTelephonyOTALogoUpdate::EPSTelephonyAllLogosDeleted );
+            // new P&S key update    
+            NotifyListeners( // Error ignored.
+                KPhCltDeleteOperatorLogo, KPhCltDeleteOperatorLogo, 
+                TTelOTALogoUpdate::EPSTelephonyAllLogosDeleted );                
+             
+            CleanupStack::PopAndDestroy( 2, hfilePath );    // finder, hfilePath
+            }
+        else
+            {
+            // Delete specified logo.
+            ConstructLogoFileNameL( 
+                aCountryCode, aNetworkCode, aLogoType, buf );
+            BaflUtils::DeleteFile( iFs, buf );
+            deleted = ETrue;
+            NotifyListeners( aCountryCode, aNetworkCode, 
+                TTelephonyOTALogoUpdate::EPSTelephonyLogoDeleted );
+            NotifyListeners( // Error ignored.
+                KPhCltDeleteOperatorLogo, KPhCltDeleteOperatorLogo, 
+                TTelOTALogoUpdate::EPSTelephonyAllLogosDeleted );                
+            }
+            
+        CleanupStack::PopAndDestroy( hbuf );
+        }
+    _DDPRINT( 4, "CPhSrvSubSessionImageHandler::DelLogo>", deleted )              
+    return deleted;
+    }
+   
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionImageHandler::ConstructLogoFileNameL
+// 
+// Creates operator logo file name.
+// -----------------------------------------------------------------------------
+//     
+void CPhSrvSubSessionImageHandler::ConstructLogoFileNameL(
+    const TPhCltCountryCode aCountryCode, 
+    const TPhCltNetworkCode aNetworkCode,
+    const TPhCltExtOperatorLogoType aLogoType,
+    TDes& aFileName )    
+    {
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::LogoName")    
+    aFileName.Zero();
+    if ( aLogoType == EPhCltLogoTypeOTA )
+        {
+        aFileName.Append( iDriveName );  
+        }
+    else
+        {
+        aFileName.Append( KPhSrvImageDriveRom );
+        }
+    aFileName.Append( iFilePath );
+    aFileName.Append( KPhSrvOperatorLogoPrefix );
+    aFileName.Append( KPhSrvLogoMncMccSeparator );        
+    aFileName.AppendNum( aCountryCode );
+    aFileName.Append( KPhSrvLogoMncMccSeparator );
+    aFileName.AppendNum( aNetworkCode );
+    aFileName.Append( KPhSrvLogoMncMccSeparator );
+    AppendLogoTypeAsTextL( aLogoType, aFileName );
+    aFileName.Append( KPhSrvImageSuffix );
+#ifdef __PHENG_DEBUG_INFO__
+    RDebug::Print( _L( 
+        "CPhSrvSubSessionImageHandler::LogoName: %S"), &aFileName );
+#endif    
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionImageHandler::AppendLogoTypeAsTextL
+// 
+// Appends logo type to buffer.
+// -----------------------------------------------------------------------------
+//     
+void CPhSrvSubSessionImageHandler::
+    AppendLogoTypeAsTextL( 
+    const TPhCltExtOperatorLogoType aLogoType, TDes& aType )
+    {
+    _DDPRINT( 4, "CPhSrvSubSessionImageHandler::LogoType: ", aLogoType )        
+    switch ( aLogoType )
+        {
+        case EPhCltLogoTypeOTA:
+            aType.Append( KPhSrvLogoTypeIndicatorOTA );
+            break;
+        case EPhCltLogoTypeProgrammable:
+            aType.Append( KPhSrvLogoTypeIndicatorProg );
+            break;
+        default:
+            User::Leave( KErrNotSupported );
+            break;
+        }
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::LogoType>" )
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionImageHandler::NotifyListeners
+// 
+// Updates publish & subscribe information with event happened.
+// -----------------------------------------------------------------------------
+//     
+TInt CPhSrvSubSessionImageHandler::
+    NotifyListeners( const TPhCltCountryCode aCountryCode, 
+    const TPhCltNetworkCode aNetworkCode,
+    const TTelephonyOTALogoUpdate::TPSOperatorLogoUpdateEvent aEvent )  
+    {
+    TInt err( KErrNone );
+    _DDPRINT( 4, "CPhSrvSubSessionImageHandler::Notify ", aCountryCode ) 
+    _DDPRINT( 4, "CPhSrvSubSessionImageHandler::Notify ", aNetworkCode )
+    _DDPRINT( 4, "CPhSrvSubSessionImageHandler::Notify ", aEvent )
+    // If not exist define key
+    if ( !iPropertyDefined )
+        {
+        err = RProperty::Define(  KPSUidPhoneClientServerInformation, 
+            KTelOperatorLogoUpdated, RProperty::EByteArray, ECapability_None, ECapabilityWriteDeviceData);
+
+        _DDPRINT( 4, "CPhSrvSubSessionImageHandler::Notify defined: ", err )
+        if ( err == KErrAlreadyExists )
+            {
+            // No error.
+            err = KErrNone;
+            }
+        }
+
+    // Set event
+    if ( err == KErrNone )
+        {
+        TTelephonyOTALogoUpdate update;
+        TTelephonyOTALogoUpdate::TOTALogoUpdatePckg logoUpdate( update );
+        logoUpdate().iEvent = aEvent;
+        logoUpdate().iMCC = aCountryCode;
+        logoUpdate().iMNC = aNetworkCode;
+        iPropertyDefined = ETrue;        
+        err = RProperty::Set( 
+            KPSUidPhoneClientServerInformation, KTelOperatorLogoUpdated, logoUpdate );
+        }
+    _DDPRINT( 4, "CPhSrvSubSessionImageHandler::Notify> ", err )
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionImageHandler::NotifyListeners
+// 
+// Updates publish & subscribe information with event happened.
+// New P&S key used.
+// -----------------------------------------------------------------------------
+//     
+TInt CPhSrvSubSessionImageHandler::
+    NotifyListeners( const TPhCltCountryCode aCountryCode, 
+    const TPhCltNetworkCode aNetworkCode,
+    const TTelOTALogoUpdate::TPSOperatorLogoUpdateEvent aEvent )  
+    {
+    TInt err( KErrNone );
+    _DDPRINT( 4, "CPhSrvSubSessionImageHandler::Notify ", aCountryCode ) 
+    _DDPRINT( 4, "CPhSrvSubSessionImageHandler::Notify ", aNetworkCode )
+    _DDPRINT( 4, "CPhSrvSubSessionImageHandler::Notify ", aEvent )
+    // If not exist define key
+    if ( !iPropertyDefined )
+        {
+        err = RProperty::Define(  KPSUidPhoneClientServerInformation, 
+            KTelOperatorLogoUpdated, RProperty::EByteArray, ECapability_None, ECapabilityWriteDeviceData);
+
+        _DDPRINT( 4, "CPhSrvSubSessionImageHandler::Notify defined: ", err )
+        if ( err == KErrAlreadyExists )
+            {
+            // No error.
+            err = KErrNone;
+            }
+        }
+
+    // Set event
+    if ( err == KErrNone )
+        {
+        TTelOTALogoUpdate update;
+        TTelOTALogoUpdate::TOTALogoUpdatePckg logoUpdate( update );
+        logoUpdate().iEvent = aEvent;
+        logoUpdate().iMCC = aCountryCode;
+        logoUpdate().iMNC = aNetworkCode;
+        iPropertyDefined = ETrue;      
+        err = RProperty::Set( 
+            KPSUidPhoneClientServerInformation, KTelOperatorLogoUpdated, logoUpdate );  
+        }
+    _DDPRINT( 4, "CPhSrvSubSessionImageHandler::Notify> ", err )
+    return err;
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhSrvOperatorLogoContainer::CPhSrvOperatorLogoContainer
+// 
+// Constructor.
+// -----------------------------------------------------------------------------
+//   
+CPhSrvSubSessionImageHandler::
+    CPhSrvOperatorLogoContainer::CPhSrvOperatorLogoContainer(
+    const TPhCltCountryCode aCountryCode, 
+    const TPhCltNetworkCode aNetworkCode,
+    const TPhCltExtOperatorLogoType aLogoType, 
+    CFbsBitmap* aBitmap ) :
+    iBitmap( aBitmap ), iCountryCode( aCountryCode ), 
+    iNetworkCode( aNetworkCode ), iLogoType( aLogoType )
+    {
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::Container::Ctor" )    
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhSrvOperatorLogoContainer::~CPhSrvOperatorLogoContainer
+// 
+// Destructor.
+// -----------------------------------------------------------------------------
+//   
+CPhSrvSubSessionImageHandler::
+    CPhSrvOperatorLogoContainer::~CPhSrvOperatorLogoContainer( ) 
+    {
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::Container::Dtor" )        
+    delete iBitmap;
+    iBitmap = NULL;
+    _DPRINT( 4, "CPhSrvSubSessionImageHandler::Container::Dtor>" )        
+    }    
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/messenger/cphsrvmessengerobject.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,453 @@
+/*
+* 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:  Messenger Object.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "cphsrvmessengerobject.h" 
+#include "cphsrvsubsessionbase.h" 
+#include "cphsrvsession.h" // Phone server session. 
+#include "phsrvdebuginfo.h" 
+
+
+// CONSTANTS
+
+// Null ID.
+const TUint KPhSrvNullId = 0;
+
+// The minimum Default message size.
+const TInt KPhSrvMinDefSize = 1;
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvMessengerObject::CPhSrvMessengerObject
+// 
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvMessengerObject::CPhSrvMessengerObject( 
+    CPhSrvSubSessionBase& aSubSession )
+:   iSubSession( aSubSession )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvMessengerObject::~CPhSrvMessengerObject
+// 
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvMessengerObject::~CPhSrvMessengerObject()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvMessengerObject::ConstructL
+// 
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvMessengerObject::ConstructL(
+    const TPhCltMessengerParameters& aParameters )
+    {
+    TInt size = aParameters.iDefaultMessageSize;
+    if( size < KPhSrvMinDefSize )
+        {
+        // Default message size must be at least KPhSrvMinDefSize.
+        User::Leave( KErrArgument );
+        }
+
+    iParameters.iCategoryUid = aParameters.iCategoryUid;
+    iParameters.iDefaultMessageSize = size;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvMessengerObject::NewLC
+// 
+// Static Symbian OS two-phase constructor. Return an instance
+// and leave it on the cleanup stack.
+// -----------------------------------------------------------------------------
+//
+CPhSrvMessengerObject* CPhSrvMessengerObject::NewLC(  
+    CPhSrvSubSessionBase& aSubSession,
+    const TPhCltMessengerParameters& aParameters )
+    {
+    CPhSrvMessengerObject* self = new( ELeave ) CPhSrvMessengerObject( 
+        aSubSession );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL( aParameters );
+
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvMessengerObject::InformOfMessengerRequest
+// 
+// Complete a client request which will indicate the result
+// of attempting to perform a request.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvMessengerObject::InformOfMessengerRequest( 
+    const TPhCltPhoneResults aResultOfAttemptingRequest,
+    const TPhCltMessengerCommand aRequest )
+    {
+    // Complete the client's pending request, indicating 
+    // the result of the messenger request attempt.
+    if ( aRequest == EPhCltMesCommandSend )
+        {
+        // Send command.
+        if ( iParameters.iSendDataValid )
+            {
+            iParameters.iSendStatus.Complete( aResultOfAttemptingRequest );
+            iParameters.iSendDataValid = EFalse;
+            }
+        }
+    else if ( aRequest == EPhCltMesCommandReceive )
+        {
+        // Receive command.
+        if ( iParameters.iReceiveDataValid )
+            {
+            iParameters.iReceiveMessage.Complete( aResultOfAttemptingRequest );
+            iParameters.iReceiveDataValid = EFalse;
+            }
+        }
+    else
+        {
+        // Should never happen!
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvMessengerObject::SubSessionHandle
+// 
+// Return the handle of the subsession that initiated the
+// original messenger request.
+// -----------------------------------------------------------------------------
+//
+TInt CPhSrvMessengerObject::SubSessionHandle() const
+    {
+    return iSubSession.SubSessionUniqueHandle();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvMessengerObject::SetActive
+// 
+// Set the request active.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvMessengerObject::SetActive( 
+    const TPhCltMessengerParameters& aParameters,
+    const RMessage2& aMessage,
+    const TUint aSentDataId )
+    {
+    TPhCltMessengerCommand request = aParameters.iMessengerCommand;
+
+    switch( request )
+        {
+        case EPhCltMesCommandSend:
+            {
+            // Set the Send data parameters.
+            iParameters.iSendStatus = aMessage;
+            iParameters.iSendDataValid = ETrue;
+            iParameters.iSentDataId = aSentDataId;
+            iParameters.iSendPayloadLength = aParameters.iSendPayloadLength;
+            break;
+            }
+        case EPhCltMesCommandReceive:
+            {
+            // Set the Receive parameters.
+            iParameters.iReceiveMessage = aMessage;
+
+            iParameters.iReceiveBufferMaxSize = 
+                aParameters.iReceiveBufferMaxSize;
+
+            iParameters.iReceiveDataValid = ETrue;
+
+            // Receive called, so Skip can not be active.
+            iParameters.iSkipNextMessage = EFalse;
+            iParameters.iSkippedSentDataId = KPhSrvNullId;
+            break;
+            }
+        case EPhCltMesCommandSkip:
+            {
+            iParameters.iSkipNextMessage = ETrue;
+            break;
+            }
+
+        default:
+            // Should never happen!
+            break;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvMessengerObject::IsRequestActive
+// 
+// Check if there is already active request.
+// -----------------------------------------------------------------------------
+//
+TBool CPhSrvMessengerObject::IsRequestActive( 
+    const TPhCltMessengerCommand aRequest ) const
+    {
+    TBool isRequestActive = EFalse;
+
+    switch( aRequest )
+        {
+        case EPhCltMesCommandSend:
+            {
+            isRequestActive = iParameters.iSendDataValid;
+            break;
+            }
+        case EPhCltMesCommandReceive:
+            {
+            isRequestActive = iParameters.iReceiveDataValid;
+            break;
+            }
+        case EPhCltMesCommandSkip:
+            {
+            isRequestActive = iParameters.iSkipNextMessage;
+            break;
+            }
+
+        default:
+            // Should never happen!
+            break;
+        }
+    return isRequestActive;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvMessengerObject::IsReadyToReceive
+// 
+// Check whether this object is ready to receive or not.
+// If Receive is active but the length of the buffer 
+// -----------------------------------------------------------------------------
+//
+TBool CPhSrvMessengerObject::IsReadyToReceive( 
+    const TDesC8& aSentMessage,
+    const TUint aSentDataId )
+    {
+    TBool ret = EFalse;
+    const TInt sendDataLength = aSentMessage.Length();
+
+    ret = IsMessageSkipped( aSentDataId );
+
+      // If the message is not skipped, handle it here.
+    if ( !ret )
+        {
+        // If receive data is valid, then we can be ready to receive.
+        if( iParameters.iReceiveDataValid )
+            {
+            // If the sent message does not fit to receive buffer, then complete
+            // Receive to indicate that bigger buffer is needed.
+            if ( sendDataLength > 
+                 iParameters.iReceiveBufferMaxSize )
+                {
+                CompleteReceive( aSentMessage, aSentDataId );
+                }
+            else
+                {
+                // Object can receive the sent message.
+                ret = ETrue;
+                }
+            }
+        }
+    return ret;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvMessengerObject::CompleteReceive
+// 
+// Complete the receive request.
+// -----------------------------------------------------------------------------
+//
+TInt CPhSrvMessengerObject::CompleteReceive(
+    const TDesC8& aSentMessage,
+    const TUint aSentDataId )
+    {
+    _DPRINT( 4, "PhSrv.MesObj.CompleteReceive START" );   // debug print
+
+    TBool ret = IsMessageSkipped( aSentDataId );
+    TInt err = KErrNotReady;
+
+    // If message is skipped, then we do not complete the request.
+    if( ret )
+        {
+        err = KErrNone;
+        }
+
+    // If err is not KErrNone, then receive is handled.
+    if ( err != KErrNone )
+        {
+        // If request is not active, then it can not be completed, and 
+        // something has gone wrong. However, recover (do nothing).
+        if ( iParameters.iReceiveDataValid )
+            {
+            // Receive request active, it is handled.
+
+    _DPRINT( 4, "PhSrv.MesObj.CompleteReceive WRITE1" );   // debug print
+
+            const TInt recBufMaxSize = 
+                iParameters.iReceiveBufferMaxSize;
+
+            // Write the whole sent message or the beginnig of it to client data
+            // area, i.e ensure that receive message buffer is not overflowed.
+            iSubSession.Write(
+                iParameters.iReceiveMessage,
+                1, 
+                aSentMessage.Left( recBufMaxSize ) );
+
+            TInt length = aSentMessage.Length();
+            TPckgC < TInt > intPckg( length );
+
+    _DPRINT( 4, "PhSrv.MesObj.CompleteReceive WRITE2" );   // debug print
+
+            // Write the length information to user side.
+            iSubSession.Write(
+                iParameters.iReceiveMessage,
+                2, 
+                intPckg );
+
+            // If whole sent message was written to receive buffer, then
+            // completion was successful.
+            if ( length <= recBufMaxSize )
+                {
+                err = KErrNone;
+                }
+            else
+                {
+                // The receive was not completed fully.
+                iParameters.iSkippedSentDataId = aSentDataId;
+                }
+
+    _DPRINT( 4, "PhSrv.MesObj.CompleteReceive COMPLETE" );   // debug print
+
+            // Complete the receive request.
+            if ( !iParameters.iReceiveMessage.IsNull() )
+                {
+                iParameters.iReceiveMessage.Complete( KErrNone );
+                }
+            iParameters.iReceiveDataValid = EFalse;
+            }
+        }
+
+    _DPRINT( 4, "PhSrv.MesObj.CompleteReceive END" );   // debug print
+
+    return err;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvMessengerObject::GetSendDataLength
+// 
+// Get the Send data.
+// -----------------------------------------------------------------------------
+//
+TInt CPhSrvMessengerObject::GetSendDataLength()
+    {
+    return iParameters.iSendPayloadLength;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvMessengerObject::GetSendData
+// 
+// Get the Send data.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvMessengerObject::GetSendData( TDes8& aDes ) const
+    {
+    // Read the Send data information from user side.
+    // Do not leave, but will panic if pointer not valid descriptor.
+    iSubSession.Read(
+        iParameters.iSendStatus,
+        1,
+        aDes );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvMessengerObject::GetUid
+// 
+// Get the Uid.
+// -----------------------------------------------------------------------------
+//
+const TUid& CPhSrvMessengerObject::GetUid() const
+    {
+    return iParameters.iCategoryUid;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvMessengerObject::SentDataId
+// 
+// Get the sent data ID.
+// -----------------------------------------------------------------------------
+//
+TUint CPhSrvMessengerObject::SentDataId()
+    {
+    return iParameters.iSentDataId;
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvMessengerObject::IsMessageSkipped
+// 
+// Return information whether the message is skipped or not.
+// -----------------------------------------------------------------------------
+//
+TBool CPhSrvMessengerObject::IsMessageSkipped(
+    const TUint aSentDataId )
+    {
+    TBool ret = EFalse; // By default message is not skipped.
+
+    // If Skip is active, then everything is OK.
+    if ( iParameters.iSkipNextMessage )
+        {
+        // If the sent data is the same as that it was earlier, then it is 
+        // skipped. If the sent message is not the same, then it is not skipped.
+        if ( iParameters.iSkippedSentDataId == aSentDataId )
+            {
+            // This message is skipped.
+            ret = ETrue;
+            }
+        else
+            {
+            // This message is not skipped.
+            iParameters.iSkipNextMessage = EFalse;
+            iParameters.iSkippedSentDataId = KPhSrvNullId; // Set to not valid.
+            }
+        }
+    return ret;
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/messenger/cphsrvmessengerrequestmanager.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,671 @@
+/*
+* 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:  Messenger Request Manager.
+*                The stub version of this file can be found from file
+*                CPhSrvMessengerRequestManagerStub.cpp
+*
+*/
+
+
+
+// INCLUDES
+#include "cphsrvmessengerrequestmanager.h" 
+#include "cphsrvmessengerobject.h" 
+#include "cphsrvsubsessionbase.h" 
+#include "phsrvutils.h" 
+#include "phsrvmessengertypes.h" 
+#include "phsrvdebuginfo.h" 
+
+
+// CONSTANTS
+
+// The default size of the Messenger object storage.
+const TInt KPhSrvMessengerObjectGranularity = 4;
+
+// The size of the Sent message's storage.
+const TInt KPhSrvMessengerPendingSendRequestGranularity 
+    = KPhSrvMessengerObjectGranularity;
+
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhSrvMessengerRequestManager::CPhSrvMessengerRequestManager
+// 
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvMessengerRequestManager::CPhSrvMessengerRequestManager( 
+    CPhSrvServer& aServer )
+:   iServer( aServer ),
+    iSentDataIdGenerator( 1 ), // Is never 0.
+    iSendProcessOngoing( EFalse )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvMessengerRequestManager::~CPhSrvMessengerRequestManager
+// 
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvMessengerRequestManager::~CPhSrvMessengerRequestManager()
+    {
+    delete iDefaultSizeBuffer;
+
+    RMessengerArray* array = SendChain();
+    if ( array )
+        {
+        // Objects not deleted, because they are not owned.
+        array->Reset();
+        array->Close();
+        delete array;
+        }
+
+    array = MessengerArray();
+    if ( array )
+        {
+        array->ResetAndDestroy();
+        array->Close();
+
+        delete array;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvMessengerRequestManager::ConstructL
+// 
+// Complete construction.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvMessengerRequestManager::ConstructL()
+    {
+    iDefaultSizeBuffer = HBufC8::NewMaxL( KPhCltDefMesSize );
+
+    // Space for messenger objects (clients)
+    iMessengerObjects = new ( ELeave ) RPointerArray< 
+        CPhSrvMessengerObject >( KPhSrvMessengerObjectGranularity );
+
+    // Space for the Send queue.
+    iSendChain = new ( ELeave ) RPointerArray< CPhSrvMessengerObject >( 
+        KPhSrvMessengerPendingSendRequestGranularity );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvMessengerRequestManager::NegotiatorRequest
+// 
+// Initiate a messenger request - called by the external messenger interface.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvMessengerRequestManager::NegotiatorRequest( 
+    CPhSrvSubSessionBase& aSubSession,
+    const TPhCltMessengerParameters& aParameters,
+    const RMessage2& aMessage )
+    {
+    _DPRINT( 4, "PhSrv.MRM.NegotiatorRequest START" );   // debug print
+
+    // Panic if this is not the only request from this subsession.
+    if ( RequestAlreadyExists( 
+             aSubSession, 
+             aParameters,
+             aMessage ) )
+        {
+    _DPRINT( 4, "PhSrv.MRM.NegotiatorRequest PANIC" );   // debug print
+
+        // First delete all data related to this object.
+        NegotiatorRequestDelete( aSubSession );
+
+        PhoneServerUtils::PanicClient( 
+            EPhoneServerPanicTooManyRequestsOngoing,
+            aMessage );
+        }
+    else
+        {
+    _DPRINT( 4, "PhSrv.MRM.NegotiatorRequest HANDLE" );   // debug print
+
+        // Request was set successfully, so handle it.
+        TPhCltMessengerCommand command = aParameters.iMessengerCommand;
+
+        // Update the messenger chain.
+        UpdateMessengerChain( iRequestObject, command );
+
+        // Clear the request object.
+        iRequestObject = NULL;
+
+        // Complete Skip request.
+        if ( command == EPhCltMesCommandSkip )
+            {
+            aMessage.Complete( KErrNone );
+            }
+        }
+
+    _DPRINT( 4, "PhSrv.MRM.NegotiatorRequest END" );   // debug print
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvMessengerRequestManager::NegotiatorRequestCancel
+// 
+// Cancel a messenger request handling.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvMessengerRequestManager::NegotiatorRequestCancel( 
+    CPhSrvSubSessionBase& aSubSession,
+    const TPhCltMessengerCommand aRequestType )
+    {
+    _DPRINT( 4, "PhSrv.MRM.NegotiatorRequestCancel START" );   // debug print
+
+    RMessengerArray* messengerObjects = MessengerArray();
+
+    if ( aRequestType == EPhCltMesCommandSend ||
+         aRequestType == EPhCltMesCommandReceive )
+        {
+        // Obtain the subsession's handle
+        const TInt handle = aSubSession.SubSessionUniqueHandle();
+
+        // Now look for any object that match.
+        const TInt count = messengerObjects->Count();
+        for( TInt i = 0; i < count; i++ )
+            {
+            CPhSrvMessengerObject* entry = ( *messengerObjects )[i];
+            if ( entry->SubSessionHandle() == handle )
+                {
+                // Found matching entry, so cancel it's request.
+                entry->InformOfMessengerRequest( KErrCancel, aRequestType );
+
+
+                TPhCltMessengerCommand request = aRequestType;
+                if ( aRequestType == EPhCltMesCommandSend )
+                    {
+                    // Send request is canceled.
+                    request = EPhCltMesCommandCancelSend;
+                    }
+                else
+                    {
+                    // Receive request is canceled.
+                    request = EPhCltMesCommandCancelReceive;
+                    }
+
+                // Update the messenger chain.
+                UpdateMessengerChain( entry, request );
+                }
+            }
+        }
+    _DPRINT( 4, "PhSrv.MRM.NegotiatorRequestCancel STOP" );   // debug print
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvMessengerRequestManager::NegotiatorRequestConstructL
+// 
+// Reserve all space needed for the subsession given as parameter.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvMessengerRequestManager::NegotiatorRequestConstructL( 
+    CPhSrvSubSessionBase& aSubSession,
+    const TPhCltMessengerParameters& aParameters,
+    const RMessage2& aMessage )
+    {
+    _DPRINT( 4, "PhSrv.MRM.NegotiatorRequestConstructL START" ); // debug print
+
+    // Create pending request
+    CPhSrvMessengerObject* object = CPhSrvMessengerObject::NewLC(
+        aSubSession,
+        aParameters );
+
+    RMessengerArray* sendArray = SendChain();
+    RMessengerArray* messengerObjects = MessengerArray();
+
+    /////////////////////////////////////////////////////////////////
+    // First try that there is enough space in send array.
+    /////////////////////////////////////////////////////////////////
+    const CPhSrvMessengerObject* entry = NULL;
+    TInt err = KErrNone;
+    // The number of existing messenger objects + the new one.
+    const TInt count = ( messengerObjects->Count() + 1 );
+
+    TInt i = 0;
+    for ( i = 0; ( i < count ) && ( err == KErrNone ); i++ )
+        {
+        // If Append failed, there is not enough memory and err != KErrNone.
+        err = sendArray->Append( entry );
+        }
+
+    // Remove now the added objects -> Buffer remains reserved for them.
+    const TInt sendChainCount = ( sendArray->Count() - 1 );
+    for( i = sendChainCount; i >= 0; i-- )
+        {
+        if( ( * sendArray )[i] == NULL )
+            {
+            // This object was added, so remove it.
+            sendArray->Remove( i );
+            }
+        }
+
+    // Leave if addition to send chain were not successful.
+    User::LeaveIfError( err );
+
+    _DPRINT( 4, "PhSrv.MRM.NegotiatorRequestConstructL MIDDLE" ); // debug print
+
+    /////////////////////////////////////////////////////////////////
+    // There was enough space in send array, so next try to append the 
+    // object to the object array.
+    /////////////////////////////////////////////////////////////////
+    User::LeaveIfError( 
+        messengerObjects->Append( object ) );
+    CleanupStack::Pop( object );
+
+    aMessage.Complete( KErrNone );
+
+    _DPRINT( 4, "PhSrv.MRM.NegotiatorRequestConstructL STOP" );  // debug print
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvMessengerRequestManager::NegotiatorRequestDelete
+// 
+// Delete all space reserved for the subsession given as parameter.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvMessengerRequestManager::NegotiatorRequestDelete( 
+    CPhSrvSubSessionBase& aSubSession )
+    {
+    _DPRINT( 4, "PhSrv.MRM.NegotiatorRequestDelete START" );   // debug print
+
+    // Obtain the subsessions handle
+    const TInt handle = aSubSession.SubSessionUniqueHandle();
+
+    RMessengerArray* messengerObjects = MessengerArray();
+
+    // Now look for any object that match.
+    TInt count = messengerObjects->Count() - 1;
+    for( TInt i = count; i >= 0; i-- )
+        {
+        CPhSrvMessengerObject* entry = ( *messengerObjects )[i];
+        if ( entry->SubSessionHandle() == handle )
+            {
+            // Found matching entry, so cancel it and clean up.
+
+            // This object is not in handled objects anymore.
+            // This means also that objects receive is also canceled.
+            messengerObjects->Remove( i );
+
+            // Update the messenger chain, cancel Send.
+            UpdateMessengerChain( entry, EPhCltMesCommandCancelSend );
+
+            // Send and receive were canceled, so this entry can be destroyed.
+            delete entry;
+            }
+        }
+    _DPRINT( 4, "PhSrv.MRM.NegotiatorRequestDelete STOP" );   // debug print
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvMessengerRequestManager::UpdateMessengerChain
+// 
+// Update the request objects.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvMessengerRequestManager::UpdateMessengerChain(
+    CPhSrvMessengerObject* aEntry,
+    TPhCltMessengerCommand aCommand )
+    {
+    _DPRINT( 4, "PhSrv.MRM.Negotiator.Update START" );   // debug print
+
+    TInt err = KErrNone;
+    RMessengerArray* sendArray = SendChain();
+
+
+    if ( aEntry )
+        {
+        switch ( aCommand )
+            {
+            case EPhCltMesCommandSend:
+                {
+                // If this is new request, append it to send queue.
+                if( sendArray->Find( aEntry ) == KErrNotFound )
+                    {
+                    err = sendArray->Append( aEntry );
+                    if ( err )
+                        {
+                        // Should never happen because of space pre-reservation
+                        // in construction phase. However, recover.
+
+                        // If Append did not succeed, inform Sender of failure.
+                        aEntry->InformOfMessengerRequest( 
+                            err,
+                            EPhCltMesCommandSend );
+                        }
+                    }
+
+                // If Append was not performed or if it was successful.
+                if ( !err )
+                    {
+                    // Handle all Send requests that exist.
+                    HandleAllSendRequests( aEntry, sendArray );
+                    }
+                break;
+                }
+            case EPhCltMesCommandReceive:
+            case EPhCltMesCommandSkip:
+            case EPhCltMesCommandCancelReceive:
+                {
+                // Handle all Send requests that exist.
+                HandleAllSendRequests( NULL, sendArray );
+                break;
+                }
+
+            case EPhCltMesCommandCancelSend:
+                {
+                // Remove this Send object from chain.
+                // Pending Receive requests not completed.
+                TInt location = sendArray->Find( aEntry );
+                if ( location >= 0 )
+                    {
+                    // If this is the first object in Send chain, then
+                    // Send request processing is canceled.
+                    if( aEntry == ( *sendArray )[0] )
+                        {
+                        iSendProcessOngoing = EFalse;
+                        }
+                    sendArray->Remove( location );
+                    }
+
+                // Handle all other Send requests that exist.
+                HandleAllSendRequests( NULL, sendArray );
+                break;
+                }
+
+            default:
+                // Should never happen!
+                break;
+            }
+        }
+    _DPRINT( 4, "PhSrv.MRM.Negotiator.Update STOP" );   // debug print
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvMessengerRequestManager::HandleAllSendRequests
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvMessengerRequestManager::HandleAllSendRequests(
+    CPhSrvMessengerObject* aEntry,
+    RMessengerArray* aSendArray )
+    {
+    CPhSrvMessengerObject* entry = aEntry;
+
+    // If aEntry is NULL, try to set it as valid object.
+    if ( !entry )
+        {
+        if ( aSendArray->Count() )
+            {
+            entry = ( *aSendArray )[0]; // Take the first object in send chain.
+            }
+        }
+
+    // Handle all Send requests that exists.
+    while ( HandleSendRequest( entry, aSendArray ) )
+        {
+        entry = NULL;
+        if ( aSendArray->Count() )
+            {
+            entry = ( *aSendArray )[0]; // Take the first object in send chain.
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvMessengerRequestManager::HandleSendRequest
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+TBool CPhSrvMessengerRequestManager::HandleSendRequest( 
+    CPhSrvMessengerObject* aEntry,
+    RMessengerArray* aSendArray )
+    {
+    TBool ret = EFalse;
+    RMessengerArray* messengerObjects = MessengerArray();
+
+
+    // Handling is done only if there is Send request and 
+    // aEntry is valid object.
+    if( aSendArray->Count() && aEntry )
+        {
+        if ( aEntry == ( *aSendArray )[0] )
+            {
+            // This was the first Send operation so complete Receives.
+
+            // Some pre-work needs to be done if this Send has not been 
+            // handled before.
+            if( !iSendProcessOngoing )
+                {
+                // Now this Send request process is ongoing.
+                iSendProcessOngoing = ETrue;
+
+                const TInt sentDataLength = aEntry->GetSendDataLength();
+
+                if ( sentDataLength > 
+                     iDefaultSizeBuffer->Des().MaxLength() )
+                    {
+                    // The sent data is longer than the default buffer.
+                    // We need to try reserve bigger buffer. If this does not
+                    // succeed, then only the current size buffer is used in 
+                    // sending.
+
+                    HBufC8* variableSizeBuffer = NULL;
+                    variableSizeBuffer = HBufC8::New( sentDataLength );
+                    if ( variableSizeBuffer != NULL )
+                        {
+                        // Reservation was successful, so use reserved buffer
+                        // as a new default buffer. 
+                        // But first delete the old buffer.
+                        if( iDefaultSizeBuffer )
+                            {
+                            delete iDefaultSizeBuffer;
+                            iDefaultSizeBuffer = NULL;
+                            }
+                        iDefaultSizeBuffer = variableSizeBuffer;
+                        }
+                    }
+                // Read the sent message.
+                TPtr8 ptr = iDefaultSizeBuffer->Des();
+                aEntry->GetSendData( ptr );
+                }
+
+
+            const TDesC8& sendData = *iDefaultSizeBuffer;
+            const TUid& senderUid = aEntry->GetUid();
+            const TUint sentDataId = aEntry->SentDataId();
+
+            TBool completeSend = ETrue;
+            TInt interested = 0;
+
+            TInt count = messengerObjects->Count();
+
+            ////////////////////////////////////////////////////////
+            // Check that all the objects are ready to receive.
+            ////////////////////////////////////////////////////////
+            for( TInt i = 0; i < count; i++ )
+                {
+                CPhSrvMessengerObject* entry = ( *messengerObjects )[i];
+
+                // Check only other objects.
+                if ( aEntry->SubSessionHandle() != entry->SubSessionHandle() )
+                    {
+                    // We need to care only of those objects that want to
+                    // listen messages same type as the sent was.
+                    if( senderUid == entry->GetUid() )
+                        {
+                        // This object wants to receive this sent message.
+                        interested++;
+
+                        if ( !entry->IsReadyToReceive( sendData, sentDataId ) )
+                            {
+                            // The object was not ready to receive, so Send can 
+                            // not be completed yet.
+                            completeSend = EFalse;
+                            }
+                        }
+                    }
+                }
+
+
+            ////////////////////////////////////////////////////////
+            // If all objects were ready to receive, complete them.
+            // If there were no objects interested of the sent message,
+            // do nothing.
+            ////////////////////////////////////////////////////////
+            if ( completeSend && interested )
+                {
+                for( TInt i = 0; i < count; i++ )
+                    {
+                    CPhSrvMessengerObject* entry = ( *messengerObjects )[i];
+
+                    // Complete only other's Receive requests.
+                    if ( aEntry->SubSessionHandle() != 
+                         entry->SubSessionHandle() )
+                        {
+                        // We complete only those object's receives that have
+                        // the same category UID as the sent was.
+                        if( senderUid == entry->GetUid() )
+                            {
+                            TInt err = entry->CompleteReceive( 
+                                sendData,
+                                sentDataId );
+                            if( err )
+                                {
+                                // This should never fail because pre-check was
+                                // successful. However, you can try to recover.
+                                }
+                            }
+                        }
+                    }
+                // All receives were compeled, so complete Send.
+                aEntry->InformOfMessengerRequest( 
+                    KErrNone,
+                    EPhCltMesCommandSend );
+                // Remove the object whose Send was handled from chain.
+                aSendArray->Remove( 0 );
+
+                // The send process was completed.
+                iSendProcessOngoing = EFalse;
+
+                // Send was fully handled.
+                ret = ETrue;
+                }
+            }
+        }
+    return ret;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvMessengerRequestManager::RequestAlreadyExists
+// 
+// Check whether there already is request(s) for the subsession given as 
+// parameter. If not, then sets it active.
+// -----------------------------------------------------------------------------
+//
+TBool CPhSrvMessengerRequestManager::RequestAlreadyExists( 
+    const CPhSrvSubSessionBase& aSubSession,
+    const TPhCltMessengerParameters& aParameters,
+    const RMessage2& aMessage )
+    {
+    TBool isThereRequest = EFalse;
+    const TPhCltMessengerCommand command = aParameters.iMessengerCommand;
+
+    // Check is only done for Send and Receive and Skip.
+    if ( command == EPhCltMesCommandSend ||
+         command == EPhCltMesCommandReceive ||
+         command == EPhCltMesCommandSkip )
+        {
+        // Obtain the subsessions handle
+        const TInt handle = aSubSession.SubSessionUniqueHandle();
+
+        RMessengerArray* messengerObjects = MessengerArray();
+
+        // Look for any pending requests that match the handle.
+        TInt i = 0;
+        for( i = 0; i < messengerObjects->Count(); i++ )
+            {
+            CPhSrvMessengerObject* entry = ( *messengerObjects )[i];
+            if ( entry->SubSessionHandle() == handle )
+                {
+                isThereRequest = entry->IsRequestActive( command );
+                if ( !isThereRequest )
+                    {
+                    TUint sentDataId = 0;
+                    if( command == EPhCltMesCommandSend )
+                        {
+                        // This was sent command, so set ID for it.
+                        sentDataId = iSentDataIdGenerator;
+                        // New Id for next sent message, must never be 0!
+                        iSentDataIdGenerator++;
+                        if( !iSentDataIdGenerator )
+                            {
+                            // Value was 0, so set to 1.
+                            iSentDataIdGenerator++;
+                            }
+                        }
+                    // Request was not active, so set it active.
+                    entry->SetActive( aParameters, aMessage, sentDataId );
+                    }
+
+                // Set the object who initiated this request.
+                iRequestObject = entry;
+                break;
+                }
+            }
+        }
+    return isThereRequest;
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvMessengerRequestManager::MessengerArray
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+RMessengerArray* CPhSrvMessengerRequestManager::MessengerArray()
+    {
+    return iMessengerObjects;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvMessengerRequestManager::SendChain
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+RMessengerArray* CPhSrvMessengerRequestManager::SendChain()
+    {
+    return iSendChain;
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/messenger/cphsrvmessengerrequestmanagerstub.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,121 @@
+/*
+* 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:  Stub version of CPhSrvMessengerRequestManager.cpp
+*
+*/
+
+
+
+// INCLUDES
+#include "cphsrvmessengerrequestmanager.h" 
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhSrvMessengerRequestManager::CPhSrvMessengerRequestManager
+// 
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvMessengerRequestManager::CPhSrvMessengerRequestManager( 
+    CPhSrvServer& aServer )
+:   iServer( aServer )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvMessengerRequestManager::~CPhSrvMessengerRequestManager
+// 
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvMessengerRequestManager::~CPhSrvMessengerRequestManager()
+    {
+    // Stub.
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvMessengerRequestManager::ConstructL
+// 
+// Complete construction.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvMessengerRequestManager::ConstructL()
+    {
+    // Stub.
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvMessengerRequestManager::NegotiatorRequest
+// 
+// Initiate a messenger request - called by the external messenger interface.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvMessengerRequestManager::NegotiatorRequest( 
+    CPhSrvSubSessionBase& /*aSubSession*/,
+    const TPhCltMessengerParameters& /*aParameters*/,
+    const RMessage2& /*aMessage*/ )
+    {
+    // Stub.
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvMessengerRequestManager::NegotiatorRequestCancel
+// 
+// Cancel a messenger request handling.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvMessengerRequestManager::NegotiatorRequestCancel( 
+    CPhSrvSubSessionBase& /*aSubSession*/,
+    const TPhCltMessengerCommand /*aRequestType*/ )
+    {
+    // Stub.
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvMessengerRequestManager::NegotiatorRequestConstructL
+// 
+// Reserve all space needed for the subsession given as parameter.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvMessengerRequestManager::NegotiatorRequestConstructL( 
+    CPhSrvSubSessionBase& /*aSubSession*/,
+    const TPhCltMessengerParameters& /*aParameters*/,
+    const RMessage2& /*aMessage*/ )
+    {
+    // Stub.
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvMessengerRequestManager::NegotiatorRequestDelete
+// 
+// Delete all space reserved for the subsession given as parameter.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvMessengerRequestManager::NegotiatorRequestDelete( 
+    CPhSrvSubSessionBase& /*aSubSession*/ )
+    {
+    // Stub.
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/messenger/cphsrvsubsessionmessenger.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,404 @@
+/*
+* Copyright (c) 2004-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:  Sub Session Messenger.
+*                The stub version of this file can be found from file
+*                CPhSrvSubSessionMessengerStub.cpp
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "cphsrvsubsessionmessenger.h" 
+#include    "cphsrvsession.h" 
+#include    "cphsrvserver.h" 
+#include    <phclttypes.h> 
+#include    "mphsrvmessengernegotiators.h" 
+#include    "phsrvmessengertypes.h" 
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionMessenger::CPhSrvSubSessionMessenger
+// 
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvSubSessionMessenger::CPhSrvSubSessionMessenger( 
+    CPhSrvSession& aSession )
+:   CPhSrvSubSessionBase( aSession, EPhSrvSubSessionTypeMessenger )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionMessenger::~CPhSrvSubSessionMessenger
+// 
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvSubSessionMessenger::~CPhSrvSubSessionMessenger()
+    {
+    Clean();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionMessenger::NewL
+// 
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvSubSessionBase* CPhSrvSubSessionMessenger::NewL(
+    CPhSrvSession& aSession )
+    {
+    // Just to make sure that the negotiator will exist.
+    aSession.PhoneServer().MessengerNegotiatorL();
+
+    CPhSrvSubSessionBase* self = 
+        new( ELeave ) CPhSrvSubSessionMessenger( aSession );
+    
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionMessenger::PhSrvMessageDecoderCanProcessMessage
+// 
+// Framework function. Returns ETrue for the op codes that
+// this subsession can handle.
+// -----------------------------------------------------------------------------
+//
+TBool CPhSrvSubSessionMessenger::PhSrvMessageDecoderCanProcessMessage( 
+    TInt aFunction )
+    {
+    switch( aFunction )
+        {
+        case EPhoneServerMessengerSubSessionOpen:
+        case EPhoneServerMessengerSubSessionClose:
+        case EPhoneServerMessengerSubSessionConstruct:
+        case EPhoneServerMessengerSubSessionReceive:
+        case EPhoneServerMessengerSubSessionSend:
+        case EPhoneServerMessengerSubSessionSkip:
+        case EPhoneServerMessengerSubSessionCancel:
+            return ETrue;
+            
+        default:
+            return EFalse;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionMessenger::PhSrvMessageProcessorHandleMessageL
+// 
+// Framework function. Handle any op-codes here.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionMessenger::PhSrvMessageProcessorHandleMessageL( 
+    const RMessage2& aMessage )
+    {
+    TBool permissionStatus ( EFalse );
+     
+    // Check needed capabilities    
+    TBool hasCapWriteDeviceData( EFalse );                  
+    hasCapWriteDeviceData = aMessage.HasCapability( ECapabilityWriteDeviceData );            
+
+    switch( aMessage.Function() )
+        {
+        case EPhoneServerMessengerSubSessionClose:
+            CmdSubSessionClose( aMessage );
+            permissionStatus = ETrue;
+            break;
+
+        case EPhoneServerMessengerSubSessionConstruct:
+            CmdSubSessionMessengerConstructL( aMessage );
+            permissionStatus = ETrue;
+            break;
+
+        case EPhoneServerMessengerSubSessionReceive:
+            if ( hasCapWriteDeviceData )
+                {  
+                CmdSubSessionMessengerReceive( aMessage );
+                permissionStatus = ETrue;
+                }
+            break;
+        case EPhoneServerMessengerSubSessionSend:
+            if ( hasCapWriteDeviceData )
+                {  
+                CmdSubSessionMessengerSend( aMessage );
+                permissionStatus = ETrue;
+                }
+            break;
+        case EPhoneServerMessengerSubSessionSkip:
+            if ( hasCapWriteDeviceData )
+                {  
+                CmdSubSessionMessengerSkip( aMessage );
+                permissionStatus = ETrue;
+                }
+            break;
+        case EPhoneServerMessengerSubSessionCancel:
+            if ( hasCapWriteDeviceData )
+                {  
+                CmdSubSessionMessengerCancel( aMessage );
+                permissionStatus = ETrue;
+                }
+            break;
+
+        default:
+            PhoneSession().PanicClient(
+                aMessage,
+                EPhCltServerInitiatedPanicInvalidRequest );
+            break;
+        }
+        
+    // If caps are not ok
+    if ( !permissionStatus )
+        {        
+        aMessage.Complete( KErrPermissionDenied );
+        }         
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionMessenger::CmdSubSessionClose
+// 
+// Close the sub-session.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionMessenger::CmdSubSessionClose( 
+    const RMessage2& aMessage )
+    {
+    Clean();
+
+    PhoneSession().CloseSubSession( aMessage );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionMessenger::CmdSubSessionMessengerConstructL
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionMessenger::CmdSubSessionMessengerConstructL( 
+    const RMessage2& aMessage )
+    {
+    TPhCltMessengerParameters parameters;
+
+    // Check the Construct parameters.
+    TPckg< TPhCltMessengerParameters > recParPckg( 
+        parameters );
+    Read(
+        aMessage,
+        0,
+        recParPckg );
+
+    // Ask the messenger negotiator to reserve all needed space
+    // for this subsession.
+    MPhSrvMessengerNegotiator& messengerNegotiator = GetMessengerNegotiator();
+
+    messengerNegotiator.NegotiatorRequestConstructL( 
+        *this,
+        parameters,
+        aMessage );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionMessenger::CmdSubSessionMessengerReceive
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionMessenger::CmdSubSessionMessengerReceive( 
+    const RMessage2& aMessage )
+    {
+
+    TPhCltMessengerParameters parameters;
+
+    // Check the Receive parameters.
+    TPckg< TPhCltMessengerParameters > recParPckg( 
+        parameters );
+    Read(
+        aMessage,
+        0,
+        recParPckg );
+
+    // This is Receive request.
+    parameters.iMessengerCommand = EPhCltMesCommandReceive;
+
+    // Ask the messenger negotiator to handle this request.
+    ForwardRequest( 
+        *this,
+        parameters,
+        aMessage );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionMessenger::CmdSubSessionMessengerSend
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionMessenger::CmdSubSessionMessengerSend( 
+    const RMessage2& aMessage )
+    {
+    TPhCltMessengerParameters parameters;
+
+    // Check the Send parameters.
+    TPckg< TPhCltMessengerParameters > sendParPckg( 
+        parameters );
+    Read(
+        aMessage,
+        0,
+        sendParPckg );
+
+    // This is Send request.
+    parameters.iMessengerCommand = EPhCltMesCommandSend;
+
+    // Ask the messenger negotiator to handle this request.
+    ForwardRequest( 
+        *this,
+        parameters,
+        aMessage );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionMessenger::CmdSubSessionMessengerSkip
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionMessenger::CmdSubSessionMessengerSkip( 
+    const RMessage2& aMessage )
+    {
+    TPhCltMessengerParameters parameters;
+
+    // This is Skip request.
+    parameters.iMessengerCommand = EPhCltMesCommandSkip;
+
+    // Ask the messenger negotiator to handle this request.
+    ForwardRequest( 
+        *this,
+        parameters,
+        aMessage );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionMessenger::CmdSubSessionMessengerCancel
+// 
+// Handle command handler client's cancel request.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionMessenger::CmdSubSessionMessengerCancel( 
+    const RMessage2& aMessage )
+    {
+    TInt returnValue = KErrArgument;
+
+    TPhCltMessengerParameters parameters;
+
+    // Check the Cancel parameters.
+    TPckg< TPhCltMessengerParameters > recParPckg( 
+        parameters );
+    Read(
+        aMessage,
+        0,
+        recParPckg );
+
+    TPhCltMessengerRequest request = parameters.iCancelRequest;
+
+
+    TPhCltMessengerCommand mesCommand = EPhCltMesCommandUnknown;
+    if ( request == EPhCltMesRequestReceive)
+        {
+        mesCommand = EPhCltMesCommandReceive;
+        }
+    else if ( request == EPhCltMesRequestSend )
+        {
+        mesCommand = EPhCltMesCommandSend;
+        }
+
+    // Perform cancel only if that was valid request.
+    if ( mesCommand != EPhCltMesCommandUnknown )
+        {
+        // Ask the messenger negotiator to cancel the pending request
+        // for this subsession.
+        MPhSrvMessengerNegotiator& messengerNegotiator = 
+            GetMessengerNegotiator();
+
+        messengerNegotiator.NegotiatorRequestCancel( *this, mesCommand );
+
+        returnValue = KErrNone;
+        }
+    aMessage.Complete( returnValue );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionMessenger::GetMessengerNegotiator
+// 
+// Return the messenger negotiator.
+// -----------------------------------------------------------------------------
+//
+MPhSrvMessengerNegotiator& CPhSrvSubSessionMessenger::GetMessengerNegotiator()
+    {
+    // Messenger negotiator created already in NewL.
+    return PhoneSession().PhoneServer().MessengerNegotiator();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionMessenger::ForwardRequest
+// 
+// Forward request to negotiator.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionMessenger::ForwardRequest(
+    CPhSrvSubSessionBase& aSubSession,
+    const TPhCltMessengerParameters& aParameters,
+    const RMessage2& aMessage )
+    {
+    // Ask the messenger negotiator to handle this request.
+    MPhSrvMessengerNegotiator& messengerNegotiator = GetMessengerNegotiator();
+
+    messengerNegotiator.NegotiatorRequest( 
+        aSubSession,
+        aParameters,
+        aMessage );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionMessenger::Clean
+// 
+// Clean the negotiator side.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionMessenger::Clean()
+    {
+    // Ask the messenger negotiator to release all reserved space
+    // for this subsession.
+    MPhSrvMessengerNegotiator& messengerNegotiator = GetMessengerNegotiator();
+
+    messengerNegotiator.NegotiatorRequestDelete( *this );
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/messenger/cphsrvsubsessionmessengerstub.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,108 @@
+/*
+* 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:  Sub Session Messenger.
+*                The stub version of CPhSrvSubSessionMessenger.cpp
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "cphsrvsubsessionmessenger.h" 
+#include "phcltclientserver.h" 
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionMessenger::CPhSrvSubSessionMessenger
+// 
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvSubSessionMessenger::CPhSrvSubSessionMessenger( 
+    CPhSrvSession& aSession )
+:   CPhSrvSubSessionBase( aSession, EPhSrvSubSessionTypeMessenger )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionMessenger::~CPhSrvSubSessionMessenger
+// 
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvSubSessionMessenger::~CPhSrvSubSessionMessenger()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionMessenger::NewL
+// 
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvSubSessionBase* CPhSrvSubSessionMessenger::NewL(
+    CPhSrvSession& /*aSession*/ )
+    {
+    // Stub version, so not supported.
+    User::Leave( KErrNotSupported );
+
+    return NULL;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionMessenger::PhSrvMessageDecoderCanProcessMessage
+// 
+// Framework function. Returns ETrue for the op codes that
+// this subsession can handle.
+// -----------------------------------------------------------------------------
+//
+TBool CPhSrvSubSessionMessenger::PhSrvMessageDecoderCanProcessMessage( 
+    TInt aFunction )
+    {
+    switch( aFunction )
+        {
+        case EPhoneServerMessengerSubSessionOpen:
+        case EPhoneServerMessengerSubSessionClose:
+        case EPhoneServerMessengerSubSessionConstruct:
+        case EPhoneServerMessengerSubSessionReceive:
+        case EPhoneServerMessengerSubSessionSend:
+        case EPhoneServerMessengerSubSessionSkip:
+        case EPhoneServerMessengerSubSessionCancel:
+            return ETrue;
+            
+        default:
+            return EFalse;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionMessenger::PhSrvMessageProcessorHandleMessageL
+// 
+// Framework function. Handle any op-codes here.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionMessenger::PhSrvMessageProcessorHandleMessageL( 
+    const RMessage2& /*aMessage*/ )
+    {
+    // Stub implementation, i.e. functionality not supported.
+    User::Leave( KErrNotSupported );
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/resources/phoneserver.hrh	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  PhoneServer resource header file. 
+*                Contains common definitions for menu id:s.
+*
+*/
+
+
+#ifndef PHONESERVER_HRH
+#define PHONESERVER_HRH
+
+// The menu commands.
+enum TDlgMenuCommand
+    {
+    ENoteWithNoImage,    // Note without image is shown.
+    EWaitNote,           // Wait note is shown.
+    ESoftKeyOK           // Softkey OK is shown.
+    };
+
+#endif // PHONESERVER_HRH
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/resources/phoneserver.rss	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 the Phone Server.
+*
+*/
+
+
+//  RESOURCE IDENTIFIER
+NAME PHSV
+
+//  INCLUDES
+#include <eikon.rh>
+#include <avkon.rh>
+#include <avkon.hrh>
+#include <avkon.rsg>
+#include <avkon.loc>
+
+#include <phoneserver.loc>
+
+
+//  RESOURCE DEFINITIONS 
+
+// ---------------------------------------------------------
+//
+//    RSS_SIGNATURE
+//    Signature.
+//
+// ---------------------------------------------------------
+//
+RESOURCE RSS_SIGNATURE { }
+
+
+// ---------------------------------------------------------
+//
+//    TBUF
+//    Name of the buffer.
+//
+// ---------------------------------------------------------
+//
+RESOURCE TBUF { buf="ussdserver"; }
+
+
+// ---------------------------------------------------------
+//
+//    r_phsrv_ussd_mesquery_message
+//    Contains USSD message query text.
+//
+// ---------------------------------------------------------
+//
+RESOURCE LBUF r_phsrv_ussd_mesquery_message
+    {
+    txt = qtn_ussd_mesquery_message;
+    }
+
+// ---------------------------------------------------------
+//
+//    r_phsrv_text_done
+//    Contains done text.
+//
+// ---------------------------------------------------------
+//
+RESOURCE LBUF r_phsrv_text_done
+    {
+    txt = text_done;
+    }
+
+
+// ---------------------------------------------------------
+//
+//    r_phsrv_ihf_activated_confirmation_note_text
+//    IHF activation note text.
+//
+// ---------------------------------------------------------
+//
+RESOURCE LBUF r_phsrv_ihf_activated_confirmation_note_text
+    {
+    txt = qtn_hf_conf_activate;
+    }
+
+// ---------------------------------------------------------
+//
+//    r_phone_ihf_deactivated_confirmation_note_text
+//    IHF deactivation note text.
+//
+// ---------------------------------------------------------
+//
+RESOURCE LBUF r_phsrv_ihf_deactivated_confirmation_note_text
+    {
+    txt = qtn_hf_conf_earpiece;
+    }
+
+// ---------------------------------------------------------
+//
+//    r_phsrv_text_unread
+//    Contains notify unread text.
+//
+// ---------------------------------------------------------
+//
+RESOURCE LBUF r_phsrv_text_unread
+    {
+    txt = qtn_ss_unread_ussd_msgs_query;
+    }
+           
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/standard/cphsrvemergencynumbermanager.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,139 @@
+/*
+* 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:  Emergency Number Manager.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "cphsrvemergencynumbermanager.h" 
+#include "mphsrvphoneinterface.h" 
+#include "phsrvdebuginfo.h" 
+#include <cemergencynumberpolicy.h> 
+
+// CONSTANTS
+_LIT(KPhSrvDosEnPolicyLibName, "dosenpolicy.dll");  // DOS emergency number policy
+_LIT(KPhSrvSosEnPolicyLibName, "sosenpolicy.dll");  // SOS emergency number policy
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhSrvEmergencyNumberManager::CPhSrvEmergencyNumberManager()
+// 
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+CPhSrvEmergencyNumberManager::CPhSrvEmergencyNumberManager(
+    MPhSrvPhoneInterface& aPhone ) : iPhone( aPhone )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvEmergencyNumberManager::~CPhSrvEmergencyNumberManager()
+// 
+// C++ destructor
+// -----------------------------------------------------------------------------
+//
+CPhSrvEmergencyNumberManager::~CPhSrvEmergencyNumberManager()
+    {
+    delete iEmergencyNumberPolicy;    
+    iEnPolicyLib.Close();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvEmergencyNumberManager::ConstructL()
+// 
+// Symbian OS 2nd phase constructor
+// -----------------------------------------------------------------------------
+//
+void CPhSrvEmergencyNumberManager::ConstructL( TBool aIsDosEnPolicy )
+    {
+    if ( aIsDosEnPolicy )
+        {
+        // Dynamically load Dos emergency DLL.
+        User::LeaveIfError( iEnPolicyLib.Load( KPhSrvDosEnPolicyLibName ) );
+        }
+    else
+        {
+        // Dynamically load Sos emergency DLL.
+        User::LeaveIfError( iEnPolicyLib.Load( KPhSrvSosEnPolicyLibName ) );
+        }
+
+    if ( iEnPolicyLib.Type()[1] != KEnPolicyUid )
+        {
+        iEnPolicyLib.Close();
+        User::Leave( KErrNotFound );
+        }
+
+    TLibraryFunction entry=iEnPolicyLib.Lookup(1);
+    CEmergencyNumberPolicy* enPolicy = ( CEmergencyNumberPolicy* ) entry();    
+    CleanupStack::PushL( enPolicy );
+    enPolicy->ConstructL( iPhone.PhSrvETelServer() );
+    CleanupStack::Pop();
+
+    iEmergencyNumberPolicy = enPolicy;
+
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvEmergencyNumberManager::EmergencyNumberManagerIsEmergencyNumberL()
+// 
+// Enquire as to whether the specified number would result
+// in an emergency call being placed.
+//
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+/*****************************************************
+*   Series 60 Customer / DOS
+*   Needs customer DOS implementation
+*****************************************************/
+TBool CPhSrvEmergencyNumberManager::EmergencyNumberManagerIsEmergencyNumberL(
+    TDes& aNumber, 
+    TPhCltEmergencyNumberQueryMode aMode 
+    )
+    {
+    _DPRINT( 4, "PSrv.EN.IsEmergency.begin" );   // debug print
+
+    // check length of number, it must be between 1..6
+    if ( aNumber.Length() < 1 )
+        {
+        // Empty. No further checking needed.
+        return EFalse;
+        }
+    
+    TBool isEmergencyNumber = EFalse;
+    TInt err = 
+        iEmergencyNumberPolicy->IsEmergencyNumber ( 
+                            static_cast< TPhCltTelephoneNumber& >(aNumber),
+                            aMode, 
+                            isEmergencyNumber );
+
+    if ( err != KErrNone )
+        {
+        // error in checking
+        isEmergencyNumber = EFalse;
+        }
+
+    return isEmergencyNumber;
+    }
+
+// End of File.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/standard/cphsrvphonecontroller.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,169 @@
+/*
+* 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:  Phone Controller.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "cphsrvphonecontroller.h" 
+#include <mmtsy_names.h>
+
+
+// CONSTANTS
+#define KPhSrvTsyName KMmTsyModuleName
+
+const TInt KPhSrvTSYNameMaxLength( 80 );
+const TInt KPhSrvETelRetryCount = 7;
+const TInt KPhSrvETelRetryTimeout = 100000; // us
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhSrvPhoneController::~CPhSrvPhoneController
+// 
+// C++ destructor
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+CPhSrvPhoneController::~CPhSrvPhoneController()
+    {
+    iCustomPhone.Close();
+    iMobilePhone.Close();
+    iETelServer.Close();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvPhoneController::ConstructL
+// 
+// Symbian OS 2nd phase constructor
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+void CPhSrvPhoneController::ConstructL()
+    {
+    TInt err = KErrNone; 
+    TInt phones = 0; // no phones.
+
+
+    // Retry ETel connection if needed:
+    for ( TInt a = 0 ; a < KPhSrvETelRetryCount ; a++ )
+        {
+        err = iETelServer.Connect();
+        if ( err == KErrNone )
+            {
+            break;
+            }
+        User::After( KPhSrvETelRetryTimeout );
+        }
+    User::LeaveIfError( err );
+
+    err = iETelServer.LoadPhoneModule(KPhSrvTsyName);
+    if ( err != KErrNone && err != KErrAlreadyExists )
+        {
+        User::Leave( err );
+        }
+
+    RTelServer::TPhoneInfo info;
+    TBuf< KPhSrvTSYNameMaxLength > tsyName;
+    iETelServer.EnumeratePhones( phones );
+
+    TInt i = 0; // index starts from zero.
+    for (; i < phones ; i++ )
+        {
+        err = iETelServer.GetPhoneInfo( i, info );
+        User::LeaveIfError( err );
+
+        err = iETelServer.GetTsyName( i, tsyName );
+        User::LeaveIfError( err );
+
+        if ( !tsyName.CompareF( KPhSrvTsyName ) )
+            {
+            break;
+            }
+        }
+
+    if ( i == phones )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    User::LeaveIfError( 
+        iETelServer.SetExtendedErrorGranularity( RTelServer::EErrorExtended ) );
+
+    User::LeaveIfError( iMobilePhone.Open( iETelServer , info.iName ) );
+
+    User::LeaveIfError( iCustomPhone.Open( iMobilePhone ) );
+
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvPhoneController::PhSrvETelServer
+// 
+// Access the ETel session.
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+RTelServer& CPhSrvPhoneController::PhSrvETelServer()
+    {
+    return iETelServer;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvPhoneController::PhSrvMobilePhone
+// 
+// Access the GSM phone subsession.
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+RMobilePhone& CPhSrvPhoneController::PhSrvMobilePhone()
+    {
+    return iMobilePhone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvPhoneController::PhSrvCustomPhone
+// 
+// Access the custom phone subsession.
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+RMmCustomAPI& CPhSrvPhoneController::PhSrvCustomPhone()
+    {
+    return iCustomPhone;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/standard/cphsrvresourcemanager.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,93 @@
+/*
+* 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:  Resource Manager.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "cphsrvresourcemanager.h" 
+#include "phcltclientserver.h" 
+#include <bautils.h>
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhSrvResourceManager::CPhSrvResourceManager
+// 
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+CPhSrvResourceManager::CPhSrvResourceManager( RFs& aFsSession )
+:   iFsSession(aFsSession)
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvResourceManager::~CPhSrvResourceManager
+// 
+// C++ destructor
+// -----------------------------------------------------------------------------
+//
+CPhSrvResourceManager::~CPhSrvResourceManager()
+    {
+    iResourceFile.Close();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvResourceManager::ConstructL
+// 
+// Symbian OS 2nd phase constructor
+// -----------------------------------------------------------------------------
+//
+void CPhSrvResourceManager::ConstructL()
+    {
+    TFileName resourceFile( KPhCltServerZDrive );
+    resourceFile.Append( KDC_RESOURCE_FILES_DIR );
+    resourceFile.Append( KPhClientAndServerResourceFileName );
+    resourceFile.Append( KPhClientAndServerResourceFileExtensionNoWild );
+    resourceFile.ZeroTerminate();
+
+    BaflUtils::NearestLanguageFile( iFsSession, resourceFile );
+    iResourceFile.OpenL( iFsSession, resourceFile );
+    iResourceFile.ConfirmSignatureL( KPhSrvMagicResourceFileSignature );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvResourceManager::ReadResourceLC
+// 
+// Read resource text
+// -----------------------------------------------------------------------------
+//
+HBufC* CPhSrvResourceManager::ReadResourceLC( TUint aResourceId )
+    {
+    HBufC8* resourceBuffer = iResourceFile.AllocReadLC( aResourceId );
+
+    TResourceReader reader;
+    reader.SetBuffer( resourceBuffer );
+
+    HBufC* ret = reader.ReadHBufCL();
+    CleanupStack::PopAndDestroy( resourceBuffer );
+
+    CleanupStack::PushL( ret );
+    return ret;
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/standard/cphsrvscheduler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* 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:  Scheduler.
+*
+*/
+
+
+// INCLUDE FILES
+#include "cphsrvscheduler.h" 
+#include "phsrvutils.h" 
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhSrvScheduler::CPhSrvScheduler
+// 
+// C++ Constructor
+// -----------------------------------------------------------------------------
+//
+CPhSrvScheduler::CPhSrvScheduler()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvScheduler::Error
+// 
+// Panic the server.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvScheduler::Error( TInt /*aError*/ ) const
+    {
+    PhoneServerUtils::Panic( EPhoneServerPanicSchedulerError );
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/standard/cphsrvserver.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,681 @@
+/*
+* 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:  Server.
+*
+*/
+
+
+// INCLUDE FILES
+#include "cphsrvserver.h" 
+#include "cphsrvsession.h" 
+#include "cphsrvscheduler.h" 
+#include "cphsrvussdmanager.h" 
+#include "cphsrvresourcemanager.h" 
+#include "cphsrvphonecontroller.h" 
+#include "cphsrvcallrequestmanager.h" 
+#include "cphsrvemergencyrequestmanager.h" 
+#include "cphsrvemergencynumbermanager.h" 
+
+#include "phsrvutils.h" 
+#include "kphsrvconfigure.h" // debugprints ON/OFF 
+#include "phsrvdebuginfo.h" 
+
+#include "mphsrvcomhandnegotiators.h" 
+#include "cphsrvcomhandrequestmanager.h" 
+#include "mphsrvmessengernegotiators.h" 
+#include "cphsrvmessengerrequestmanager.h" 
+#include <featmgr.h>
+
+
+
+// CONSTANTS
+const TInt KPhSrvServerPriority = 100;  // phone server priority
+
+
+// The create function enumerations.
+enum 
+    {
+    ECreateIdle,             // Create idle.
+    ECreateEmergencyNegotiator, // Create Emergency Call negotiator
+    ECreateCallNegotiator,   // Create Call Negotiator.
+    ECreateUssdManager,      // Create USSD Manager.
+    ECreatePhoneInterface,   // Create Phone Interface.
+    ECreateEmergencyNumber,  // Create Emergency Number Manager.
+    ECreateComHandManager,   // Create command handler manager.
+    ECreateMessengerManager  // Create Messenger manager.
+    };
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhSrvServer::New
+// 
+// Create and start a new server.
+// -----------------------------------------------------------------------------
+//
+CPhSrvServer* CPhSrvServer::NewL()
+    {
+    // Create
+    CPhSrvServer* self = new ( ELeave ) CPhSrvServer( KPhSrvServerPriority );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvServer::CPhSrvServer
+// 
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+CPhSrvServer::CPhSrvServer( TInt  aPriority )
+    : CServer2( aPriority ),
+    iFBSConnections( 0 )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvServer::CPhSrvServer
+// 
+// C++ Destructor
+// -----------------------------------------------------------------------------
+//
+CPhSrvServer::~CPhSrvServer()
+    {
+    CompleteCreateAll( KErrCancel );
+
+    delete iCreateAll;
+    delete iObjectConIx;
+    delete iUssdManager;
+    delete iEmergencyNumberManager;
+    delete iResourceFileManager;
+    delete iCallRequestManager;
+    delete iPhoneController;
+    delete iComHandRequestManager;
+    delete iMessengerRequestManager;
+
+    iFsSession.Close();
+    DisconnectFBS( ETrue );
+
+
+    // Frees the TLS! Must be done after FeatureManager is used.
+    FeatureManager::UnInitializeLib();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvServer::ConstructL
+// 
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvServer::ConstructL()
+    {
+    // Sets up TLS, must be done before FeatureManager is used.
+    FeatureManager::InitializeLibL();
+
+
+    // Start server
+    TInt ret = Start( PHONE_SERVER_NAME );
+    __ASSERT_ALWAYS( ret == KErrNone || ret == KErrAlreadyExists, 
+        PhoneServerUtils::Panic( EPhoneServerPanicCouldNotStartServer ) );
+    User::LeaveIfError( ret );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvServer::NewSessionL
+// 
+// Create a new session.
+// -----------------------------------------------------------------------------
+//
+CSession2* CPhSrvServer::NewSessionL( 
+    const TVersion& aVersion,
+    const RMessage2& /*aMessage*/ ) const 
+    {
+    // Check the right version
+    TVersion v( KPhoneServerMajorVersionNumber,
+                KPhoneServerMinorVersionNumber,
+                KPhoneServerBuildVersionNumber );
+
+    if( !User::QueryVersionSupported( v, aVersion ) )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    // Create a new session
+    CSession2* session = CPhSrvSession::NewL( 
+        *const_cast< CPhSrvServer* >( this ) );
+
+    return session;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvServer::CreateAllL
+// -----------------------------------------------------------------------------
+//
+void CPhSrvServer::CreateAllL( CPhSrvSession& aSession )
+    {
+    if ( !iCreateAll )
+        {
+        iCreateAll = CIdle::NewL( CActive::EPriorityStandard );
+        }
+
+    User::LeaveIfError( iCreateAllArray.Append( &aSession ) );
+
+    if ( !iCreateAll->IsActive() )
+        {
+        iCreateAllStep = ECreateIdle;
+        iCreateAllError = KErrNone;
+
+        iCreateAll->Start( TCallBack( DoCreateAllStepL, this ) );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvServer::CancelCreateAll
+// -----------------------------------------------------------------------------
+//
+void CPhSrvServer::CancelCreateAll( CPhSrvSession& aSession )
+    {
+    TInt pos = iCreateAllArray.Find( &aSession );
+    if ( pos != KErrNotFound )
+        {
+        iCreateAllArray.Remove( pos );
+        aSession.CompleteCreateAll( KErrCancel );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvServer::NewContainerL
+// 
+// Create a new object container for session.
+// -----------------------------------------------------------------------------
+//
+CObjectCon* CPhSrvServer::NewContainerL() const
+    {
+    if ( !iObjectConIx )
+        {
+        iObjectConIx = CObjectConIx::NewL();
+        }
+
+    return iObjectConIx->CreateL();
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvServer::RemoveContainer
+// 
+// Remove object container.
+// -----------------------------------------------------------------------------
+//
+void  CPhSrvServer::RemoveContainer( CObjectCon* aCon )
+    {
+    iObjectConIx->Remove( aCon );
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhSrvServer::CallNegotiatorL
+// 
+// Access the call negotiator
+// -----------------------------------------------------------------------------
+//
+MPhSrvNegotiatorCall& CPhSrvServer::CallNegotiatorL()
+    {
+    if ( !iCallRequestManager )
+        {
+        CPhSrvCallRequestManager* self = 
+            new (ELeave) CPhSrvCallRequestManager();
+        CleanupStack::PushL( self );
+        self->ConstructL();
+        CleanupStack::Pop( self );
+
+        iCallRequestManager = self;
+        }
+    
+    return *iCallRequestManager;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvServer::CallNegotiator
+// 
+// Access the call negotiator
+// -----------------------------------------------------------------------------
+//
+MPhSrvNegotiatorCall& CPhSrvServer::CallNegotiator() const
+    {
+    __ASSERT_DEBUG( IsCallNegotiator(), 
+        PhoneServerUtils::Panic( EPhoneServerPanicNoCallInitiatorFault ) );
+    return *iCallRequestManager;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvServer::EmergencyCallNegotiatorL
+// 
+// Access the emergency call negotiator
+// -----------------------------------------------------------------------------
+//
+MPhSrvEmergencyNegotiatorCall& CPhSrvServer::EmergencyCallNegotiatorL()
+    {
+    if ( !iEmergencyRequestManager )
+        {
+        CPhSrvEmergencyRequestManager* self = 
+            new (ELeave) CPhSrvEmergencyRequestManager();
+        CleanupStack::PushL( self );
+        self->ConstructL();
+        CleanupStack::Pop( self );
+
+        iEmergencyRequestManager = self;
+        }
+    
+    return *iEmergencyRequestManager;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvServer::EmergencyCallNegotiatorL
+// 
+// Access the emergency call negotiator
+// -----------------------------------------------------------------------------
+//
+MPhSrvEmergencyNegotiatorCall& CPhSrvServer::EmergencyCallNegotiator() const
+    {
+    __ASSERT_DEBUG( IsCallNegotiator(), 
+        PhoneServerUtils::Panic( EPhoneServerPanicMissingEmerNegotiator ) );
+    return *iEmergencyRequestManager;
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhSrvServer::IsEmergencyCallNegotiator
+// -----------------------------------------------------------------------------
+//
+TBool CPhSrvServer::IsEmergencyCallNegotiator() const
+    {
+    return ( iEmergencyRequestManager != NULL );
+    }
+  
+// -----------------------------------------------------------------------------
+// CPhSrvServer::UssdManagerL
+// -----------------------------------------------------------------------------
+//
+CPhSrvUssdManager& CPhSrvServer::UssdManagerL()
+    {
+    if ( !iUssdManager )
+        {
+        CPhSrvUssdManager* self = 
+            new ( ELeave ) CPhSrvUssdManager( 
+                FsSessionL(), 
+                ResourceManagerL()
+               );
+
+        CleanupStack::PushL( self );
+        self->ConstructL( PhoneInterfaceL() );
+        CleanupStack::Pop( self );
+
+        iUssdManager = self;
+        }
+   
+    return *iUssdManager;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvServer::PhoneInterfaceL
+// -----------------------------------------------------------------------------
+//
+MPhSrvPhoneInterface& CPhSrvServer::PhoneInterfaceL()
+    {
+    if ( !iPhoneController )
+        {
+        CPhSrvPhoneController* self = 
+            new( ELeave ) CPhSrvPhoneController();
+        CleanupStack::PushL( self );
+        self->ConstructL();
+        CleanupStack::Pop( self );
+
+        iPhoneController = self;
+        }
+
+    return *iPhoneController;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvServer::EmergencyNumberManagerL
+// -----------------------------------------------------------------------------
+//
+MPhSrvEmergencyNumberManager& CPhSrvServer::EmergencyNumberManagerL()
+    {
+    if ( !iEmergencyNumberManager )
+        {
+        PhoneInterfaceL(); // if succeeds iPhoneController ok after this
+        
+        CPhSrvEmergencyNumberManager* self =
+            new ( ELeave ) CPhSrvEmergencyNumberManager( *iPhoneController );
+
+        TBool isDosEnPolicy = 
+            FeatureManager::FeatureSupported( KFeatureIdEnPolicyDos );            
+        CleanupStack::PushL( self );
+        self->ConstructL( isDosEnPolicy );
+        CleanupStack::Pop( self );
+
+        iEmergencyNumberManager = self;    
+        }
+    
+    return *iEmergencyNumberManager;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvServer::IsCallNegotiator
+// -----------------------------------------------------------------------------
+//
+TBool CPhSrvServer::IsCallNegotiator() const
+    {
+    return ( iCallRequestManager != NULL );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvServer::IsUssdManager
+// -----------------------------------------------------------------------------
+//
+TBool CPhSrvServer::IsUssdManager() const
+    {
+    return ( iUssdManager != NULL );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvServer::ComHandNegotiatorL
+// 
+// Access the command handler negotiator.
+// -----------------------------------------------------------------------------
+//
+MPhSrvComHandNegotiator& CPhSrvServer::ComHandNegotiatorL()
+    {
+    if ( !iComHandRequestManager )
+        {
+        CPhSrvComHandRequestManager* self = 
+            new ( ELeave ) CPhSrvComHandRequestManager( *this );
+        CleanupStack::PushL( self );
+        self->ConstructL();
+        CleanupStack::Pop( self );
+
+        iComHandRequestManager = self;
+        }
+    
+    return *iComHandRequestManager;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvServer::ComHandNegotiatorL
+// 
+// Access the command handler negotiator.
+// -----------------------------------------------------------------------------
+//
+MPhSrvComHandNegotiator& CPhSrvServer::ComHandNegotiator() const
+    {
+    __ASSERT_DEBUG( IsComHandNegotiator(), 
+            PhoneServerUtils::Panic( EPhoneServerPanicMissingComInitiator ) );
+    return *iComHandRequestManager;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvServer::IsComHandNegotiator
+// -----------------------------------------------------------------------------
+//
+TBool CPhSrvServer::IsComHandNegotiator() const
+    {
+    return ( iComHandRequestManager != NULL );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvServer::MessengerNegotiatorL
+// 
+// Access the Messenger negotiator.
+// -----------------------------------------------------------------------------
+//
+MPhSrvMessengerNegotiator& CPhSrvServer::MessengerNegotiatorL()
+    {
+    if ( !iMessengerRequestManager )
+        {
+        CPhSrvMessengerRequestManager* self = 
+            new ( ELeave ) CPhSrvMessengerRequestManager( *this );
+        CleanupStack::PushL( self );
+        self->ConstructL();
+        CleanupStack::Pop( self );
+
+        iMessengerRequestManager = self;
+        }
+    
+    return *iMessengerRequestManager;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvServer::MessengerNegotiator
+// 
+// Access the Messenger negotiator.
+// -----------------------------------------------------------------------------
+//
+MPhSrvMessengerNegotiator& CPhSrvServer::MessengerNegotiator() const
+    {
+    __ASSERT_DEBUG( IsMessengerNegotiator(), 
+        PhoneServerUtils::Panic( EPhoneServerPanicMissingMessNegotiator ) );
+    return *iMessengerRequestManager;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvServer::IsMessengerNegotiator
+// -----------------------------------------------------------------------------
+//
+TBool CPhSrvServer::IsMessengerNegotiator() const
+    {
+    return ( iMessengerRequestManager != NULL );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvServer::FsSessionL
+// -----------------------------------------------------------------------------
+//
+RFs& CPhSrvServer::FsSessionL()
+    {
+    if ( !iFsSession.Handle() )
+        {
+        User::LeaveIfError( iFsSession.Connect() );
+        }
+
+    return iFsSession;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvServer::ResourceManagerL
+// -----------------------------------------------------------------------------
+//
+CPhSrvResourceManager& CPhSrvServer::ResourceManagerL()
+    {
+    if ( !iResourceFileManager )
+        {
+        CPhSrvResourceManager* self = 
+            new ( ELeave ) CPhSrvResourceManager( FsSessionL() );
+        CleanupStack::PushL( self );
+        self->ConstructL();
+        CleanupStack::Pop( self );
+
+        iResourceFileManager = self;
+        }
+    
+    return *iResourceFileManager;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvServer::CreateAllStepL
+// -----------------------------------------------------------------------------
+//
+TInt CPhSrvServer::CreateAllStepL()
+    {
+    TInt old = iCreateAllStep;
+    TRAPD( err, PerformNextStepL() );
+    if ( old == iCreateAllStep )
+        {
+        iCreateAllStep = ECreateIdle;
+        err = KErrGeneral;
+        }
+
+    iCreateAllError = Min( iCreateAllError, err );
+    
+    if ( iCreateAllStep == ECreateIdle )
+        {
+        CompleteCreateAll( iCreateAllError );
+        return 0; // To stop idle
+        }
+    
+    return 1; // To continue idle processing
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvServer::PerformNextStepL
+// -----------------------------------------------------------------------------
+//
+void CPhSrvServer::PerformNextStepL()
+    {
+    switch ( iCreateAllStep )
+        {
+        case  ECreateEmergencyNegotiator:
+            iCreateAllStep = ECreateCallNegotiator;
+            EmergencyCallNegotiatorL();
+            break;
+            
+        case ECreateCallNegotiator:
+            iCreateAllStep = ECreateUssdManager;
+            CallNegotiatorL();
+            break;
+
+        case ECreateUssdManager:
+            iCreateAllStep = ECreatePhoneInterface;
+            UssdManagerL();
+            break;
+
+        case ECreatePhoneInterface:
+            iCreateAllStep = ECreateEmergencyNumber;
+            PhoneInterfaceL();
+            break;
+
+        case ECreateEmergencyNumber:
+            iCreateAllStep = ECreateComHandManager;
+            EmergencyNumberManagerL();
+            break;
+
+        case ECreateComHandManager:
+            iCreateAllStep = ECreateMessengerManager;
+            ComHandNegotiatorL();
+            break;
+
+        case ECreateMessengerManager:
+            iCreateAllStep = ECreateIdle;
+            // Create messenger negotiator only if needed.
+            if ( FeatureManager::FeatureSupported( 
+                KFeatureIdCsVideoTelephony ) )
+                {
+                MessengerNegotiatorL();
+                }
+            break;
+
+        case ECreateIdle:
+        default:
+            iCreateAllStep = ECreateEmergencyNegotiator;            
+            break;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvServer::CompleteCreateAll
+// -----------------------------------------------------------------------------
+//
+void CPhSrvServer::CompleteCreateAll( TInt aError )
+    {
+    TInt count = iCreateAllArray.Count();
+    TInt index;
+
+    for ( index = 0; index < count; index++ )
+        {
+        iCreateAllArray[ index ]->CompleteCreateAll( aError );
+        }
+
+    iCreateAllArray.Close();
+    
+    delete iCreateAll; 
+    iCreateAll = NULL;
+
+    iCreateAllError = KErrNone;
+    iCreateAllStep = ECreateIdle;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvServer::DoCreateAllStepL
+// -----------------------------------------------------------------------------
+//
+TInt CPhSrvServer::DoCreateAllStepL( TAny* aAny )
+    {
+    return static_cast< CPhSrvServer* >( aAny )->CreateAllStepL();
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvServer::ConnectFBS
+// -----------------------------------------------------------------------------
+//
+TInt CPhSrvServer::ConnectFBS()
+    {
+    TInt err( KErrNone );
+    if ( iFBSConnections == 0 )
+        {
+        err = RFbsSession::Connect();
+        }
+
+    if ( err == KErrNone )
+        {
+        iFBSConnections++;
+        }
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvServer::DisconnectFBS
+// -----------------------------------------------------------------------------
+//
+void CPhSrvServer::DisconnectFBS( TBool aForce )
+    {
+    iFBSConnections--;
+    if ( iFBSConnections == 0 || aForce )
+        {
+        RFbsSession::Disconnect();
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/standard/cphsrvsession.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,417 @@
+/*
+* 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:  Session.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "cphsrvserver.h" 
+#include "cphsrvsession.h" 
+#include "cphsrvsubsessionbase.h" 
+#include "phsrvsubsessionfactory.h" 
+#include "phcltclientserver.h" 
+
+// CONSTANTS
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhSrvSession::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvSession* CPhSrvSession::NewL( CPhSrvServer& aServer )   
+    {
+    CPhSrvSession* self = new ( ELeave ) CPhSrvSession();
+    CleanupStack::PushL( self );
+    self->ConstructL( aServer );
+    CleanupStack::Pop();
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSession::CPhSrvSession
+// C++ constructor can NOT contain any code, that might leave.
+// -----------------------------------------------------------------------------
+//
+CPhSrvSession::CPhSrvSession() 
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSession::~CPhSrvSession
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvSession::~CPhSrvSession()
+    {
+    if ( iServer )
+        {
+        iServer->CancelCreateAll( *this );
+        }
+
+    delete iObjectIx;
+   
+   if ( iContainer )
+        {
+        iServer->RemoveContainer( iContainer );
+        iContainer = NULL;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSession::ServiceL
+// 
+// Calls DispatchMessageL under trap harness.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSession::ServiceL( const RMessage2& aMessage )  
+    {
+    TRAPD( err, ProcessRequestL( aMessage ) );
+    if ( err != KErrNone )
+        {
+        aMessage.Complete( err );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSession::ProcessRequestL
+// 
+// Checks the function specified by the client message
+// and depending on the type, performs an appropriate action.
+//
+// If the function is one of the "special" factory sub-session
+// creation op-codes, then this session will process it.
+//
+// If the function is a generic subsession function, then the
+// subsession which can handle this function is identified by
+// it's unique handle, and it is asked to process the request.
+//
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSession::ProcessRequestL( const RMessage2& aMessage )
+    {
+    if ( HandleCommandL( aMessage ) )
+        {
+        return;
+        }
+
+    const TInt function = aMessage.Function();
+    const TUint32 sid = aMessage.SecureId().iId;
+    
+    // Is this a message that results in a new subsession?
+    if  ( PhSrvSubSessionFactory::PhSrvSubSessionFactoryIsCreationFunction( 
+          function ) )
+        {
+        if ( !PhSrvSubSessionFactory::PhSrvSubSessionFactoryIsCreationAllowed(
+            function,
+            sid ) )
+            {
+            aMessage.Complete( KErrPermissionDenied );
+            }
+        else
+            {
+            // Need to create a new subsession
+            CPhSrvSubSessionBase* subSession = 
+                PhSrvSubSessionFactory::PhSrvSubSessionFactoryCreateLC( 
+                    function, 
+                    *this );
+
+            // Add to container (takes ownership)
+            iContainer->AddL( subSession );
+            if (function != EPhoneServerImageHandlerSubSessionOpen )
+                {
+                CleanupStack::Pop( subSession );    
+                }
+            // Get a handle for the object
+            const TInt handle = iObjectIx->AddL( subSession );
+
+            // Inform client of the handle its been allocated
+            TPckg<TInt> handlePckg( handle );
+            Write( 
+                aMessage,
+                3,
+                handlePckg );
+
+            if ( !aMessage.IsNull() )
+                {
+                // Complete the message
+                aMessage.Complete( KErrNone );
+                }
+             }    
+         }
+    else
+        {
+        // Find an appropriate object and pass the message to it
+        // for processing...
+        const TInt handle = aMessage.Int3();
+
+        // Fetch the sub-session by its handle
+        CObject* object = iObjectIx->At( handle );
+        if ( !object )
+            {
+            PanicClient(
+                aMessage,
+                EPhCltServerInitiatedPanicInvalidHandle );
+            }
+
+        // We can cast the object to a subsession instance, since that's
+        // all we store in the object container
+        CPhSrvSubSessionBase* subSession = 
+            static_cast< CPhSrvSubSessionBase* >( object );
+        
+        if ( subSession )
+            {
+            // Check that the subsession can handle this request
+            if ( !subSession->PhSrvMessageDecoderCanProcessMessage( function ) )
+                {
+                PanicClient(
+                    aMessage,
+                    EPhCltServerInitiatedPanicInvalidHandle );
+                }
+            else
+                {
+                // Get it to process this request
+                subSession->PhSrvMessageProcessorHandleMessageL( aMessage );
+                }
+            }            
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSession::SubSessionCount
+// 
+// Return the number of subsessions
+// -----------------------------------------------------------------------------
+//
+TInt CPhSrvSession::SubSessionCount() const
+    {
+    return iContainer->Count();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSession::SubSessionA
+// 
+// Return a subsession from an index
+// -----------------------------------------------------------------------------
+//
+CPhSrvSubSessionBase& CPhSrvSession::SubSessionAt( TInt aIndex ) const
+    {
+    return *static_cast< CPhSrvSubSessionBase* >( ( *iContainer )[ aIndex ] );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSession::CloseSubsession
+// 
+// Remove object from object index
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSession::CloseSubSession( const RMessage2& aMessage )
+    {
+    TInt handle = aMessage.Int3();
+
+    CObject* obj = iObjectIx->At( handle );  
+    __ASSERT_ALWAYS( obj, 
+        PanicClient(
+            aMessage,
+            EPhCltServerInitiatedPanicInvalidHandle ) );
+    iObjectIx->Remove( handle );
+
+    if ( !aMessage.IsNull() )
+        {
+        aMessage.Complete( KErrNone );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSession::PanicClient
+// 
+// Panic the client's thread
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSession::PanicClient(
+    const RMessage2& aMessage,
+    TPhCltServerInitiatedPanic aPanic ) const    
+    {
+    if ( !aMessage.IsNull() )
+        {
+        _LIT( KPhServerPanicCategory, "PhSrvServer" );
+        aMessage.Panic( KPhServerPanicCategory, aPanic );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSession::ConstructL
+// 
+// Symbian OS 2nd phase constructor
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSession::ConstructL( CPhSrvServer& aServer )
+    {
+    iContainer = aServer.NewContainerL();
+    iObjectIx = CObjectIx::NewL();   
+    
+    iServer = &aServer;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSession::SubSessionUniqueHandle
+// 
+// Return the unique handle for the specified subsession
+// -----------------------------------------------------------------------------
+//
+TInt CPhSrvSession::SubSessionUniqueHandle( 
+    const CPhSrvSubSessionBase& aSubSession ) const
+    {
+    // Ensure that the handle really is unique.
+    // return iObjectIx->At( &aSubSession ); is unique only in same session.
+    return reinterpret_cast<TInt>( &aSubSession );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSession::PhoneServer
+// 
+// Returns the Phone Server
+// -----------------------------------------------------------------------------
+//
+CPhSrvServer& CPhSrvSession::PhoneServer() const
+    {
+    return *static_cast< CPhSrvServer* >( const_cast< CServer2* >( Server() ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSession::Write
+// 
+// Write to the client address space. Panic client upon error
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSession::Write( 
+    const RMessage2& aMessage,
+    TInt aLocation,
+    const TDesC8& aDes,
+    TInt aOffset )
+    {
+    TInt ret = aMessage.Write( aLocation, aDes, aOffset );
+    if ( ret != KErrNone )
+        {
+        PanicClient( 
+            aMessage,
+            EPhCltServerInitiatedPanicBadDescriptor );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSession::Read
+// 
+// Read from the client address space. Panic client upon error
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSession::Read(
+    const RMessage2& aMessage,
+    TInt aLocation,
+    TDes8& aDes,
+    TInt aOffset )
+    {
+    TInt ret = aMessage.Read( aLocation, aDes, aOffset );
+    if ( ret != KErrNone )
+        {
+        PanicClient( 
+            aMessage,
+            EPhCltServerInitiatedPanicBadDescriptor );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSession::Read
+// 
+// Read from the client address space. Panic client upon error
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSession::Read(
+    const RMessage2& aMessage,
+    TInt aLocation,
+    TDes& aDes,
+    TInt aOffset )
+    {
+    TInt ret = aMessage.Read( aLocation, aDes, aOffset );
+    if ( ret != KErrNone )
+        {
+        PanicClient( 
+            aMessage,
+            EPhCltServerInitiatedPanicBadDescriptor );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSession::CompleteCreateAll
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSession::CompleteCreateAll( TInt aError )
+    {
+    if ( iCreateAll )
+        {
+        iCreateAll = EFalse;
+        iCreateAllMsg.Complete( aError );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSession::HandleCommandL
+// -----------------------------------------------------------------------------
+//
+TBool CPhSrvSession::HandleCommandL( const RMessage2& aMessage )
+    {
+    TBool result = EFalse;
+
+    switch ( aMessage.Function() )
+        {
+        case EPhoneCreateAll:
+            result = ETrue;
+            
+            iServer->CancelCreateAll( *this );
+            iServer->CreateAllL( *this );
+            
+            iCreateAll = ETrue;
+            iCreateAllMsg = aMessage;
+            break;
+        
+        default:
+            break;
+        }
+
+    return result;
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/standard/cphsrvsubsessionbase.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,131 @@
+/*
+* 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:  Sub Session Base.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "cphsrvsubsessionbase.h" 
+#include "cphsrvsession.h" 
+#include "cphsrvsubsessionnotifier.h" 
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionBase::CPhSrvSubSessionBase
+// 
+// C++ Constructor
+// -----------------------------------------------------------------------------
+//
+CPhSrvSubSessionBase::CPhSrvSubSessionBase( 
+    CPhSrvSession& aSession, 
+    TPhSrvSubSessionType aType )
+:   iSession(aSession), 
+    iSubSessionType(aType)
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionBase::PhoneSession
+// 
+// Access a non-constant phone session
+// -----------------------------------------------------------------------------
+//
+CPhSrvSession& CPhSrvSubSessionBase::PhoneSession()
+    {
+    return iSession;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionBase::PhoneSession
+// 
+// Access the session
+// -----------------------------------------------------------------------------
+//
+const CPhSrvSession& CPhSrvSubSessionBase::PhoneSession() const
+    {
+    return iSession;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionBase::SubSessionUniqueHandle
+// 
+// Return the unique handle for this subsession
+// -----------------------------------------------------------------------------
+//
+TInt CPhSrvSubSessionBase::SubSessionUniqueHandle() const
+    {
+    return PhoneSession().SubSessionUniqueHandle( *this );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionBase::Type
+// 
+// The type of the subsession
+// -----------------------------------------------------------------------------
+//
+CPhSrvSubSessionBase::TPhSrvSubSessionType CPhSrvSubSessionBase::Type() const
+    {
+    return iSubSessionType;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionBase::Write
+// 
+// Write to client address space
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionBase::Write( 
+    const RMessage2& aMessage,
+    TInt aLocation,
+    const TDesC8& aDes,
+    TInt aOffset )
+    {
+    PhoneSession().Write( 
+        aMessage,
+        aLocation,
+        aDes,
+        aOffset );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionBase::Read
+// 
+// Read from client address space
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionBase::Read(
+    const RMessage2& aMessage,
+    TInt aLocation,
+    TDes8& aDes,
+    TInt aOffset )
+    {
+    PhoneSession().Read(
+        aMessage,
+        aLocation,
+        aDes,
+        aOffset );
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/standard/cphsrvsubsessionussd.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,380 @@
+/*
+* 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:  Sub Session Ussd.
+*
+*/
+
+
+// INCLUDE FILES
+#include "cphsrvsubsessionussd.h" 
+
+#include    <etelmm.h>            // ETel
+
+#include "phsrvutils.h" 
+#include "cphsrvsession.h" 
+#include "cphsrvserver.h" 
+
+#include "cphsrvussdmanager.h" 
+
+#include <phclttypes.h> 
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionUssd::CPhSrvSubSessionUssd
+// 
+// C++ Constructor
+// -----------------------------------------------------------------------------
+//
+CPhSrvSubSessionUssd::CPhSrvSubSessionUssd( CPhSrvSession& aSession )
+:    CPhSrvSubSessionBase( aSession, EPhSrvSubSessionTypeUssd )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionUssd::PhSrvMessageDecoderCanProcessMessage
+// 
+// Framework function. Returns ETrue for the op codes that
+// this subsession can handle.
+// -----------------------------------------------------------------------------
+//
+TBool CPhSrvSubSessionUssd::PhSrvMessageDecoderCanProcessMessage( 
+    TInt aFunction )
+    {
+    switch( aFunction )
+        {
+        case EPhoneServerUSSDSubSessionClose:
+        case EPhoneServerUSSDSubSessionSendMessage:
+        case EPhoneServerUSSDSubSessionSendMessageCancel:
+        case EPhoneServerUSSDSubSessionStartEditing:
+        case EPhoneServerUSSDSubSessionAppStarting:
+        case EPhoneServerUSSDSubSessionAppTerminating:
+        case EPhoneServerUSSDSubSessionAppToForeground:
+        case EPhoneServerUSSDSubSessionAppToBackground:
+        case EPhoneServerUSSDSubSessionStartSAT:
+        case EPhoneServerUSSDSubSessionStopSAT:
+            return ETrue;
+            
+        default:
+            return EFalse;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionUssd::PhSrvMessageProcessorHandleMessageL
+// 
+// Framework function. Handle any op-codes here.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionUssd::PhSrvMessageProcessorHandleMessageL( 
+    const RMessage2& aMessage )
+    {
+    TBool permissionStatus ( EFalse );
+    
+    // Check needed capabilities    
+    TBool hasCapNetworkControlAndServices ( EFalse );
+    TBool hasCapWriteDeviceData ( EFalse );
+    hasCapNetworkControlAndServices = aMessage.HasCapability( ECapabilityNetworkControl, 
+                                                              ECapabilityNetworkServices );
+    hasCapWriteDeviceData = aMessage.HasCapability( ECapabilityWriteDeviceData );
+    // Check Security ID     
+    TBool hasUssdSID = ( aMessage.SecureId().iId == KUssdSecureId.iUid ) ? ETrue : EFalse; 
+    TBool hasSatSID  = ( aMessage.SecureId().iId == KSatSecureId.iUid ) ? ETrue : EFalse; 
+
+    switch( aMessage.Function() )
+        {
+        case EPhoneServerUSSDSubSessionClose:
+            CmdSubSessionCloseL( aMessage );
+            permissionStatus = ETrue;
+            break;
+        case EPhoneServerUSSDSubSessionSendMessage:
+            if ( hasCapNetworkControlAndServices && hasCapWriteDeviceData  )
+                {
+                CmdSubSessionSendMessageL( aMessage );
+                permissionStatus = ETrue;
+                }
+            break;
+        case EPhoneServerUSSDSubSessionSendMessageCancel:
+            if ( hasCapNetworkControlAndServices && hasCapWriteDeviceData )
+                {        
+                CmdSubSessionSendMessageCancelL( aMessage );
+                permissionStatus = ETrue;
+                }
+            break;
+        case EPhoneServerUSSDSubSessionStartEditing:
+            CmdSubSessionStartEditingL( aMessage );
+            permissionStatus = ETrue;
+            break;
+        case EPhoneServerUSSDSubSessionAppStarting:
+            if ( hasUssdSID )
+                {
+                CmdSubSessionAppStartingL( aMessage );
+                permissionStatus = ETrue;
+                }
+            break;
+        case EPhoneServerUSSDSubSessionAppTerminating:
+            if ( hasUssdSID )
+                {
+                CmdSubSessionAppTerminatingL( aMessage );
+                permissionStatus = ETrue;               
+                }
+            break;
+        case EPhoneServerUSSDSubSessionAppToForeground:
+            if ( hasUssdSID )
+                {
+                CmdSubSessionAppToForegroundL( aMessage );
+                permissionStatus = ETrue;
+                }
+             break;
+        case EPhoneServerUSSDSubSessionAppToBackground:
+            if ( hasUssdSID )
+                {
+                CmdSubSessionAppToBackgroundL( aMessage );
+                permissionStatus = ETrue;                
+                }
+             break;   
+        case EPhoneServerUSSDSubSessionStartSAT:
+            if ( hasSatSID )
+                {
+                CmdSubSessionStartSATL( aMessage );
+                permissionStatus = ETrue;    
+                }
+             break;
+        case EPhoneServerUSSDSubSessionStopSAT:
+            if ( hasSatSID )
+                {
+                CmdSubSessionStopSATL( aMessage );
+                permissionStatus = ETrue;                
+                }
+            break;
+            
+        default:
+            PhoneSession().PanicClient(
+                aMessage,
+                EPhCltServerInitiatedPanicInvalidRequest );
+            break;
+        }
+
+    // If caps are not ok 
+    if( !permissionStatus )
+        {
+        aMessage.Complete( KErrPermissionDenied );
+        }            
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionUssd::UssdMessageSentObserverHandleResult
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionUssd::UssdMessageSentObserverHandleResult( TInt aError )
+    {
+    __ASSERT_DEBUG( iHavePendingSendMessagePointer, 
+        PhoneServerUtils::Panic( EPhoneServerPanicNoPendingSendRequestFault ) );
+    
+    // Notify observer
+    if ( iHavePendingSendMessagePointer )
+        {
+        if ( !iPendingSendMessagePointer.IsNull() )
+            {
+            iPendingSendMessagePointer.Complete( aError );
+            }
+        iHavePendingSendMessagePointer = EFalse;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionUssd::CmdSubSessionCloseL
+// 
+// Close the sub-session
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionUssd::CmdSubSessionCloseL( const RMessage2& aMessage )
+    {
+    PhoneSession().CloseSubSession( aMessage );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionUssd::CmdSubSessionSendMessageL
+// 
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+void CPhSrvSubSessionUssd::CmdSubSessionSendMessageL( 
+    const RMessage2& aMessage )
+    {
+    if (iHavePendingSendMessagePointer)
+        {
+        PhoneSession().PanicClient(
+            aMessage,
+            EPhCltServerInitiatedPanicRequestAlreadyActive );
+        }
+    else
+        {
+        // Get text buffer, 0 buffer, 1 length, 2 attributes
+        HBufC8* message = HBufC8::NewLC( aMessage.Int1() );
+        TPtr8 pMessage(message->Des());
+        PhoneSession().Read(
+            aMessage,
+            0,
+            pMessage );
+
+        RMobileUssdMessaging::TMobileUssdAttributesV1* attributes = 
+            new ( ELeave ) RMobileUssdMessaging::TMobileUssdAttributesV1;
+        CleanupStack::PushL( attributes );
+        RMobileUssdMessaging::TMobileUssdAttributesV1Pckg 
+            pAttributes( *attributes );
+        PhoneSession().Read(
+            aMessage,
+            2,
+            pAttributes );
+     
+        // Try and send the message
+        PhoneSession().PhoneServer().UssdManagerL().SendUssdL( 
+            *message, 
+            *attributes, 
+            *this );
+        CleanupStack::PopAndDestroy(2); // attributes, message
+        
+        iHavePendingSendMessagePointer = ETrue;
+        iPendingSendMessagePointer = aMessage;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionUssd::CmdSubSessionSendMessageCancelL
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionUssd::CmdSubSessionSendMessageCancelL( 
+    const RMessage2& aMessage )
+    {
+    // Cancel Send
+    PhoneSession().PhoneServer().UssdManagerL().SendUssdCancel();
+
+    // Complete old request
+    if ( iHavePendingSendMessagePointer )
+        {
+        if ( !iPendingSendMessagePointer.IsNull() )
+            {
+            iPendingSendMessagePointer.Complete( KErrCancel );
+            }
+        iHavePendingSendMessagePointer = EFalse;
+        }
+    aMessage.Complete( KErrNone );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionUssd::CmdSubSessionStartEditingL
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionUssd::CmdSubSessionStartEditingL( 
+    const RMessage2& aMessage )
+    {
+
+    PhoneSession().PhoneServer().UssdManagerL().RequestStartEditingL();
+    aMessage.Complete( KErrNone );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionUssd::CmdSubSessionAppStartingL
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionUssd::CmdSubSessionAppStartingL( 
+    const RMessage2& aMessage )
+    {
+    PhoneSession().PhoneServer().UssdManagerL().InformUssdApplicationStarting();
+    aMessage.Complete( KErrNone );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionUssd::CmdSubSessionAppTerminatingL
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionUssd::CmdSubSessionAppTerminatingL( 
+    const RMessage2& aMessage )
+    {
+    PhoneSession().PhoneServer().UssdManagerL(
+        ).InformUssdApplicationTerminatingL( aMessage );
+
+    // Complete the message.
+    aMessage.Complete( KErrNone );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionUssd::CmdSubSessionAppToForegroundL
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionUssd::CmdSubSessionAppToForegroundL( 
+    const RMessage2& aMessage )
+    {
+    TInt ret = PhoneSession().PhoneServer().UssdManagerL(
+        ).InformUssdApplicationToForeground();
+    aMessage.Complete( ret );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionUssd::CmdSubSessionAppToBackgroundL
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionUssd::CmdSubSessionAppToBackgroundL( 
+    const RMessage2& aMessage )
+    {    
+    PhoneSession().PhoneServer().UssdManagerL(
+        ).InformUssdApplicationToBackground();
+    aMessage.Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionUssd::CmdSubSessionStartSATL
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionUssd::CmdSubSessionStartSATL( const RMessage2& aMessage )
+    {
+    PhoneSession().PhoneServer().UssdManagerL().InformStartSAT( aMessage );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionUssd::CmdSubSessionStartSATL
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionUssd::CmdSubSessionStopSATL( const RMessage2& aMessage )
+    {
+    PhoneSession().PhoneServer().UssdManagerL().InformStopSAT();
+    aMessage.Complete( KErrNone );
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/standard/phsrvdebuginfo.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,185 @@
+/*
+* Copyright (c) 2002-2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Debug information implementation.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include    <e32std.h>                  // tls
+#include    <e32svr.h>                  // rdebug
+#include    <f32file.h>                 // file and FS
+#include    <utf.h>                     // converter
+#include    "phsrvdebuginfo.h" // this 
+#include    "kphsrvconfigure.h" // defines 
+
+
+// Initialize
+#ifdef __PHSRV_DEBUG_INFO__
+
+// CONSTANTS
+// max length with number and extension is 25!
+_LIT( KPhSrvDebugFileName, "C:\\PhSrvDebug");
+_LIT( KPhSrvDebugFileExt, ".txt" );
+const TInt KPhSrvDebugFileNameLength( 25 );
+
+#ifdef __PHSRV_DEBUG_WRITE_LOG__
+_LIT( KPhSrvDebugEOF, "\n" );
+#endif // _PHSRV_DEBUG_WRITE_LOG__
+
+
+
+
+//----------------------------------------------------------------------------
+// PhSrvDebugInfo::Print
+//----------------------------------------------------------------------------
+//
+void PhSrvDebugInfo::Print(TInt/* aArea*/,const TDesC& aText )
+{
+    
+
+
+            // LOG TO FILE
+#ifdef __PHSRV_DEBUG_WRITE_LOG__
+
+            TBuf8<128> toFile;
+            CnvUtfConverter::ConvertFromUnicodeToUtf8( toFile, aText.Left(126) );
+            toFile.Append( KPhSrvDebugEOF );
+            
+            PhSrvDebugInfo::CPhSrvDebugData* data = NULL;
+    if( !data )
+        {
+        data = CreateData();
+        }
+    if( data )
+        {
+        data->CreateFile();           
+        data->WriteFile( toFile );
+        }
+#endif  // __PHSRV_DEBUG_WRITE_LOG__
+#ifdef __PHSRV_PRINT_DEBUG_INFO__
+            RDebug::Print( aText );
+#endif // __PHSRV_PRINT_DEBUG_INFO__
+          //  }   
+      //  }
+    }
+
+
+//----------------------------------------------------------------------------
+// PhSrvDebugInfo::CreateDataL
+//----------------------------------------------------------------------------
+//
+PhSrvDebugInfo::CPhSrvDebugData* PhSrvDebugInfo::CreateData()
+    {
+    PhSrvDebugInfo::CPhSrvDebugData* data = 
+        new PhSrvDebugInfo::CPhSrvDebugData();
+
+    return data;
+    }
+
+
+//----------------------------------------------------------------------------
+// PhSrvDebugInfo::CPhSrvDebugData::~CPhSrvDebugData
+//----------------------------------------------------------------------------
+//
+PhSrvDebugInfo::CPhSrvDebugData::~CPhSrvDebugData()
+    {
+    ReleaseFile();
+    }
+
+
+//----------------------------------------------------------------------------
+// PhSrvDebugInfo::CPhSrvDebugData::CreateFileL
+//----------------------------------------------------------------------------
+//
+void PhSrvDebugInfo::CPhSrvDebugData::CreateFile()
+    {
+    if ( !IsFile() )
+        {
+        if ( !iFs ) 
+            iFs = new RFs();
+        if ( !iFs )
+            return;
+        if ( iFs->Connect() != KErrNone )
+            return;
+
+        TBuf<KPhSrvDebugFileNameLength> name;
+        TInt err = KErrGeneral;
+        TInt i = 0;
+            
+        if ( !iFile )
+            {
+            name.Zero();
+            name.Append( KPhSrvDebugFileName );
+            name.AppendNum( i );
+            name.Append( KPhSrvDebugFileExt );
+            
+            iFile = new RFile();
+            if ( !iFile )
+                return;
+            err = iFile->Create( *iFs, name, 
+                EFileStreamText|EFileWrite|EFileShareAny );
+            }
+
+       if( err != KErrNone )
+            {
+            err = iFile->Open( *iFs, name, 
+            EFileStreamText|EFileWrite|EFileShareAny );
+            }
+                    
+        }
+    }
+
+
+void PhSrvDebugInfo::CPhSrvDebugData::ReleaseFile()
+    {
+    if ( iFile )
+        {
+        iFile->Close();
+        delete iFile;
+        iFile = NULL;
+        }
+    if ( iFs )
+        {
+        iFs->Close();
+        delete iFs;
+        iFs = NULL;
+        }
+    }
+
+
+TBool PhSrvDebugInfo::CPhSrvDebugData::IsFile() const
+    {
+    return ( iFile != NULL );
+    }
+
+
+void PhSrvDebugInfo::CPhSrvDebugData::WriteFile(const TDesC8& aDes)
+    {
+    if ( IsFile() )
+        {
+        TInt place =0 ;
+        iFile->Seek( ESeekEnd,place );
+        iFile->Write( place, aDes );
+        iFile->Flush();
+        }
+    }
+
+
+#endif
+
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/standard/phsrvstartup.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,114 @@
+/*
+* 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:  Start Up functionality of Phone Server.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "phsrvstartup.h" 
+#include "cphsrvscheduler.h" 
+#include "cphsrvserver.h" 
+#include "phsrvutils.h" 
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// PhoneServerStartUpUtils::CreateAndRunServerL
+// 
+// Creates a server instance, active scheduler, etc, and
+// starts the server going by starting the active scheduler.
+// -----------------------------------------------------------------------------
+//
+void PhoneServerStartUpUtils::CreateAndRunServerL()
+    {
+    CPhSrvScheduler* scheduler = new( ELeave ) CPhSrvScheduler();
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    // Create the server
+    CPhSrvServer* server = CPhSrvServer::NewL();
+    CleanupStack::PushL( server );
+
+    // Attempt to rename the thread - it isn't critial if this fails
+#ifdef _DEBUG
+    TInt err = 
+#endif // _DEBUG
+
+    User::RenameThread( KPhServerThreadName );
+
+    __ASSERT_DEBUG( err == KErrNone, 
+        PhoneServerUtils::Panic(EPhoneServerPanicCouldNotRenameServerThread ) );
+
+    // Now that the server has been started okay, we can signal the
+    // client so that they can attempt to connect.
+
+    RProcess::Rendezvous( KErrNone );
+
+    // The final step in the chain is to start the active scheduler
+    // which will allow the server to be fully operational and enable
+    // request processing.
+    CActiveScheduler::Start();
+
+    // Cleanup the server and scheduler
+    // Check also that the last poped item was scheduler.
+    CleanupStack::PopAndDestroy( 2, scheduler );
+    }
+
+
+// -----------------------------------------------------------------------------
+// PhoneServerStartUpUtils::PrepareServerEnvironment
+// 
+// Creates a cleanup stack trap harness and attemps to run
+// the server.
+// -----------------------------------------------------------------------------
+//
+TInt PhoneServerStartUpUtils::PrepareServerEnvironment()
+    {
+    TInt err = KErrNoMemory;
+
+    CTrapCleanup* cleanup = CTrapCleanup::New();
+    if ( cleanup )
+        {
+        TRAP( err, CreateAndRunServerL() );
+        }
+    delete cleanup;
+
+    return err;
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// E32Main (MARM ONLY - RUNNING SERVER IN THREAD INSIDE PROCESS)
+// 
+// Satisfies EPOCEXE build criteria. Called by Kernel when
+// a new process is created, and is used to start the server going.
+// -----------------------------------------------------------------------------
+//
+GLDEF_C TInt E32Main()
+    {
+    TInt err;
+
+    err = PhoneServerStartUpUtils::PrepareServerEnvironment();
+
+    return err;
+    }
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/standard/phsrvsubsessionfactory.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,151 @@
+/*
+* 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:  Sub Session Factory.
+*
+*/
+
+
+
+
+// INCLUDES
+#include "phcltclientserver.h" 
+
+#include "phsrvsubsessionfactory.h" 
+#include "cphsrvsubsessionnotifier.h" 
+#include "cphsrvsubsessionextcall.h" 
+#include "cphsrvsubsessionussd.h" 
+#include "cphsrvsubsessionemergencynum.h" 
+#include "cphsrvsubsessioncommandhandler.h" 
+#include "cphsrvsubsessionmessenger.h" 
+#include "cphsrvsubsessionimagehandler.h" 
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// PhSrvSubSessionFactory::PhSrvSubSessionFactoryIsCreationFunction
+// 
+// A processing function that allows certain IPC op-codes
+// to be intercepted and processed by the session rather than
+// a subsession. This function returns ETrue if it is one of
+// these special IPC op codes.
+// -----------------------------------------------------------------------------
+//
+TBool PhSrvSubSessionFactory::PhSrvSubSessionFactoryIsCreationFunction( 
+    TInt aFunction )
+    {
+    switch( aFunction )
+        {
+        case EPhoneServerExtCallSubSessionOpen:
+        case EPhoneServerNotifySubSessionOpen:
+        case EPhoneServerUSSDSubSessionOpen:
+        case EPhoneServerEmergencyNumberSubSessionOpen:
+        case EPhoneServerComHandSubSessionOpen:
+        case EPhoneServerMessengerSubSessionOpen:
+        case EPhoneServerImageHandlerSubSessionOpen:
+            return ETrue;
+
+        default:
+            return EFalse;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// PhSrvSubSessionFactory::PhSrvSubSessionFactoryCreateLC
+// 
+// Creates a new instance of a subsession based upon the
+// IPC op code specified.
+// -----------------------------------------------------------------------------
+//
+CPhSrvSubSessionBase* PhSrvSubSessionFactory::PhSrvSubSessionFactoryCreateLC( 
+    TInt aFunction, 
+    CPhSrvSession& aSession )
+    {
+    CPhSrvSubSessionBase* subSession = NULL;
+
+    switch( aFunction )
+        {
+        case EPhoneServerExtCallSubSessionOpen:
+            subSession = new( ELeave ) CPhSrvSubSessionExtCall( aSession );
+            break;
+        case EPhoneServerNotifySubSessionOpen:
+            subSession = new( ELeave ) CPhSrvSubSessionNotifier( aSession );
+            break;
+        case EPhoneServerUSSDSubSessionOpen:
+            subSession = new( ELeave ) CPhSrvSubSessionUssd( aSession );
+            break;
+        case EPhoneServerEmergencyNumberSubSessionOpen:
+            subSession = new( ELeave ) CPhSrvSubSessionEmergencyNum( aSession );
+            break;
+        case EPhoneServerComHandSubSessionOpen:
+            subSession = 
+                CPhSrvSubSessionCommandHandler::NewL( aSession );
+            break;
+        case EPhoneServerMessengerSubSessionOpen:
+            subSession = 
+                CPhSrvSubSessionMessenger::NewL( aSession );
+            break;
+
+        case EPhoneServerImageHandlerSubSessionOpen:
+            subSession = CPhSrvSubSessionImageHandler::NewL( aSession );
+            break;
+        default:
+            break;
+        }
+
+    // Complete construction
+    if ( aFunction != EPhoneServerImageHandlerSubSessionOpen )
+        {
+        CleanupStack::PushL( subSession );        
+        }
+    subSession->ConstructL();
+    return subSession;
+    }
+
+// -----------------------------------------------------------------------------
+// PhSrvSubSessionFactory::PhSrvSubSessionFactoryIsCreationAllowed
+// 
+// This function returns ETrue if Creation a new instance of a subsession based upon 
+// the IPC op code specified is allowed for the Secure ID of the process which 
+// sent this message.
+// -----------------------------------------------------------------------------
+//
+TBool PhSrvSubSessionFactory::PhSrvSubSessionFactoryIsCreationAllowed( 
+    TInt aFunction,
+    TUint32 aSID )
+    {
+    switch( aFunction )
+        {
+        case EPhoneServerNotifySubSessionOpen:
+        case EPhoneServerComHandNotifySubSessionOpen:
+            if ( aSID == KPhoneSecureId.iUid 
+#if defined(__WINSCW__)
+                            // To enable module testing using EUnit
+                                || aSID == KEunitExeRunnerId.iUid 
+#endif // __WINSCW__
+                                )
+                {       
+                return ETrue;   
+                }
+            else
+                {
+                return EFalse;
+                }
+        default:
+            return ETrue;
+        }
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/standard/phsrvutils.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* 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:  Contains utility functions for Phone Server.
+*
+*/
+
+
+// INCLUDES
+#include <e32base.h>
+#include "phsrvutils.h" 
+
+
+// CONSTANTS
+_LIT( KPhoneServerPanicCategory, "PhSrvFault" );
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// PhoneServerUtils::Panic
+// 
+// Panic the server.
+// -----------------------------------------------------------------------------
+//
+void PhoneServerUtils::Panic( TPhoneServerPanic aPanic ) 
+    {
+    User::Panic( KPhoneServerPanicCategory, aPanic );
+    }
+
+
+// -----------------------------------------------------------------------------
+// PhoneServerUtils::PanicClient
+// 
+// Panic the client using server.
+// -----------------------------------------------------------------------------
+//
+void PhoneServerUtils::PanicClient( 
+    TPhoneServerPanic aPanic,
+    const RMessage2& aMessage ) 
+    {
+    aMessage.Panic(
+        KPhoneServerPanicCategory,
+        aPanic );
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/standard/standard_aiw/cphcltdialdata.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* 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:  Ext Phone Dial Data.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <cphcltdialdata.h>
+#include "cphcltextphonedialdata.h" // For correct default values 
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CPhCltDialData::CPhCltDialData
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPhCltDialData::CPhCltDialData():
+    iTelNumber( KNullDesC ),
+    iCallType( EPhCltVoice ),
+    iName( KNullDesC ), 
+    iWindowGroup( KPhCltGoToIdle ), 
+    iRedial( KPhCltRedialDefault ), 
+    iSubAddress( KNullDesC ),
+    iShowNumber( ETrue ), 
+    iAllowMatch( KPhCltDefaultAllowMatch ),
+    iSATCall( EFalse ),
+    iEndOtherCalls( EFalse ),
+    iBearer( KNullDesC8 ),
+    iSendKey( EFalse ),
+    iReturnToNumberEntryOnFailure( KPhCltDefaultNumberEntry ), 
+    iInitCall ( EFalse ), 
+    iFlags( CPhCltExtPhoneDialData::EPhCltCallFlagsDefault ),
+    iServiceId( NULL )
+    { 
+    iRedialMaximumDuration = 0;
+    }
+
+
+// Destructor
+CPhCltDialData::~CPhCltDialData()
+    {  
+    delete iContactLink;
+    iContactLink = NULL;
+    delete iUUI; 
+    iUUI = NULL;
+    }
+
+void CPhCltDialData::ConstructL()
+    {
+    iContactLink = KNullDesC8().AllocL();
+    iUUI = KNullDesC().AllocL();
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/standard/standard_aiw/cphcltextphonedialdata.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,748 @@
+/*
+* 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:  Ext Phone Dial Data.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <cphcltextphonedialdata.h> 
+#include <cphcltdialdata.h>
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CPhCltExtPhoneDialData::CPhCltExtPhoneDialData
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPhCltExtPhoneDialData::CPhCltExtPhoneDialData(): CPhCltDialData()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// 
+// Symbian OS constructor
+// 
+// ---------------------------------------------------------------------------
+//
+void CPhCltExtPhoneDialData::ConstructL()
+    {
+    CPhCltDialData::ConstructL();
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// Symbian OS constructor  
+// Initialises the member data from package.
+//
+// ---------------------------------------------------------------------------
+//
+void CPhCltExtPhoneDialData::ConstructL(
+    const TDesC8& aPackage ) 
+    {
+    RDesReadStream stream( aPackage );
+    CleanupClosePushL( stream );
+    
+    stream >> iTelNumber;
+    iCallType = static_cast<TPhCltCallType>( stream.ReadInt32L() );
+    stream >> iName;
+    iWindowGroup = stream.ReadInt32L();
+    iRedial = stream.ReadInt32L();
+    iRedialMaximumDuration = stream.ReadInt32L();
+    ReadDescriptorFromStreamL( stream, iContactLink );
+    stream >> iSubAddress;
+    iShowNumber = stream.ReadInt32L();
+    iAllowMatch = stream.ReadInt32L();
+    iSATCall = stream.ReadInt32L(); 
+    iEndOtherCalls = stream.ReadInt32L();
+    stream >> iBearer;
+    iSendKey = stream.ReadInt32L();
+    iReturnToNumberEntryOnFailure = stream.ReadInt32L();
+    iInitCall = stream.ReadInt32L();
+    iFlags = stream.ReadUint32L();
+    iServiceId = stream.ReadUint32L();
+    ReadDescriptorFromStreamL( stream, iUUI );
+    CleanupStack::PopAndDestroy( 1 ); // stream;
+    }
+// -----------------------------------------------------------------------------
+// CPhCltExtPhoneDialData::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CPhCltExtPhoneDialData* CPhCltExtPhoneDialData::NewL()
+    {
+    CPhCltExtPhoneDialData* self = CPhCltExtPhoneDialData::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhCltExtPhoneDialData::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CPhCltExtPhoneDialData* CPhCltExtPhoneDialData::NewLC(  )
+    {
+    CPhCltExtPhoneDialData* self = new( ELeave ) CPhCltExtPhoneDialData;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// First phase constructor
+// Initialises the member data from package.
+// 
+// --------------------------------------------------------------------------- 
+//    
+EXPORT_C CPhCltExtPhoneDialData* CPhCltExtPhoneDialData::NewL( 
+    const TDesC8& aPackage )
+    {
+    CPhCltExtPhoneDialData* self = CPhCltExtPhoneDialData::NewLC( aPackage );
+    CleanupStack::Pop( self );
+    return self;
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// First phase constructor
+// Initialises the member data from package.
+// 
+// --------------------------------------------------------------------------- 
+//
+EXPORT_C CPhCltExtPhoneDialData* CPhCltExtPhoneDialData::NewLC(
+    const TDesC8& aPackage )
+    {
+    CPhCltExtPhoneDialData* self = new( ELeave ) CPhCltExtPhoneDialData;
+    CleanupStack::PushL( self );
+    self->ConstructL( aPackage );
+    return self;
+    }
+
+// Destructor
+EXPORT_C CPhCltExtPhoneDialData::~CPhCltExtPhoneDialData()
+    {
+    }
+   
+
+
+
+ // Access - Setters  
+ 
+// ---------------------------------------------------------------------------
+// Sets allow match.
+// ---------------------------------------------------------------------------
+//   
+void CPhCltExtPhoneDialData::SetAllowMatch( TBool aAllowMatch ) 
+    {
+    iAllowMatch = aAllowMatch;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets bearer.
+// ---------------------------------------------------------------------------
+void CPhCltExtPhoneDialData::SetBearerL ( 
+const TPhCltBearerCapability& aBearer )
+    {
+    iBearer = aBearer;
+    }
+    
+// ---------------------------------------------------------------------------
+// Sets call type.
+// ---------------------------------------------------------------------------
+//   
+void CPhCltExtPhoneDialData::SetCallType( TPhCltCallType aCallType ) 
+    {
+    iCallType = aCallType;
+    }
+ 
+// ---------------------------------------------------------------------------
+// Sets used contact link.
+// ---------------------------------------------------------------------------
+//
+void CPhCltExtPhoneDialData::SetContactLinkL( const TDesC8& aContactLink ) 
+    {
+    CopyDescriptorToMemberDescriptorL( aContactLink, iContactLink );
+    }
+
+// ---------------------------------------------------------------------------
+// Sets end other calls.
+// ---------------------------------------------------------------------------
+//
+void CPhCltExtPhoneDialData::SetEndOtherCalls( TBool aEndCalls ) 
+    {
+    iEndOtherCalls = aEndCalls ;
+    }
+ 
+ // ---------------------------------------------------------------------------
+// Set initiate call.
+// ---------------------------------------------------------------------------
+//    
+void CPhCltExtPhoneDialData::SetInitiateCall( TBool aInitCall )
+    {
+    iInitCall = aInitCall;
+    } 
+// ---------------------------------------------------------------------------
+// Set name.
+// ---------------------------------------------------------------------------
+//    
+void CPhCltExtPhoneDialData::SetNameL( const TPhCltNameBuffer& aName ) 
+    {
+    iName = aName;
+    }
+    
+// ---------------------------------------------------------------------------
+// Sets phone number.
+// ---------------------------------------------------------------------------
+//
+void CPhCltExtPhoneDialData::SetTelephoneNumber(
+    const TPhCltTelephoneNumber& aNumber ) 
+    {
+    iTelNumber = aNumber;
+    }
+  
+// ---------------------------------------------------------------------------
+// Sets redial value.
+// ---------------------------------------------------------------------------
+//    
+void CPhCltExtPhoneDialData::SetRedial( TInt aRedial ) 
+    {
+    iRedial = aRedial;
+    }
+    
+// ---------------------------------------------------------------------------
+// Sets redial max duration time.
+// ---------------------------------------------------------------------------
+//
+void CPhCltExtPhoneDialData::SetRedialMaximumDuration( 
+    TTimeIntervalSeconds aMaximumRedialDuration ) 
+    {
+    iRedialMaximumDuration = aMaximumRedialDuration;
+    }
+  
+// ---------------------------------------------------------------------------
+// Sets SAT call.
+// ---------------------------------------------------------------------------
+//
+void CPhCltExtPhoneDialData::SetSATCall( TBool aIsSATCall ) 
+    {
+    iSATCall = aIsSATCall;
+    }
+
+// -----------------------------------------------------------------------------
+// SetSendKeyPressed
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+void CPhCltExtPhoneDialData::SetSendKeyPressed( TBool aSendKey )
+    {
+    iSendKey = aSendKey;
+    }
+
+// ---------------------------------------------------------------------------
+// Set show number.
+// ---------------------------------------------------------------------------
+//    
+void CPhCltExtPhoneDialData::SetShowNumber( TBool aShowNumber ) 
+    {
+    iShowNumber = aShowNumber;
+    } 
+    
+// ---------------------------------------------------------------------------
+// Sets SubAddress for SAT call.
+// ---------------------------------------------------------------------------
+void CPhCltExtPhoneDialData::SetSubAddressL( 
+    const TPhCltSubAddress& aSubAddress )
+    {
+    iSubAddress = aSubAddress;
+    }
+    
+// ---------------------------------------------------------------------------
+// Sets window group.
+// ---------------------------------------------------------------------------
+//    
+void CPhCltExtPhoneDialData::SetWindowGroup( TInt aWindowGroup ) 
+    {
+    iWindowGroup = aWindowGroup;
+    }
+  
+// ---------------------------------------------------------------------------
+// Sets window group.
+// ---------------------------------------------------------------------------
+//
+void CPhCltExtPhoneDialData::SetUUIL( const TDesC& aUUI )
+    {
+    CopyDescriptorToMemberDescriptorL( aUUI, iUUI );
+    }
+
+// Access - Getters 
+
+// ---------------------------------------------------------------------------
+// Return allow match.
+// ---------------------------------------------------------------------------
+//   
+TBool CPhCltExtPhoneDialData::AllowMatch() const 
+    {
+    return iAllowMatch;
+    }
+    
+// ---------------------------------------------------------------------------
+// Returns bearer.
+// ---------------------------------------------------------------------------
+//
+const TPhCltBearerCapability& CPhCltExtPhoneDialData::Bearer() const
+    {
+    return iBearer;
+    }
+    
+// ---------------------------------------------------------------------------
+// Returns call type.
+// ---------------------------------------------------------------------------
+//    
+TPhCltCallType  CPhCltExtPhoneDialData::CallType() const 
+    {
+    return iCallType;
+    }
+
+// ---------------------------------------------------------------------------
+// Return contact link.
+// ---------------------------------------------------------------------------
+//    
+const TDesC8& CPhCltExtPhoneDialData::ContactLink() const 
+    {
+    return *iContactLink;
+    } 
+     
+// ---------------------------------------------------------------------------
+// Returns end other calls value.
+// ---------------------------------------------------------------------------
+//
+TBool CPhCltExtPhoneDialData::EndOtherCalls() const
+    {
+    return iEndOtherCalls;
+    }
+    
+// ---------------------------------------------------------------------------
+// Returns initiate call.
+// ---------------------------------------------------------------------------
+//
+TBool CPhCltExtPhoneDialData::InitiateCall() const 
+    {
+    return iInitCall;
+    } 
+    
+// ---------------------------------------------------------------------------
+// Returns name.
+// ---------------------------------------------------------------------------
+//
+const TPhCltNameBuffer& CPhCltExtPhoneDialData::Name() const 
+    {
+    return iName;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns phone number.
+// ---------------------------------------------------------------------------
+//    
+const TPhCltTelephoneNumber& CPhCltExtPhoneDialData::TelephoneNumber() const 
+    {
+    return iTelNumber;    
+    }
+
+// ---------------------------------------------------------------------------
+// Return redial value.
+// ---------------------------------------------------------------------------
+//    
+TInt CPhCltExtPhoneDialData::Redial() const 
+    {
+    return iRedial;
+    }
+// ---------------------------------------------------------------------------
+// Returns redial max duration.
+// ---------------------------------------------------------------------------
+//
+const TTimeIntervalSeconds CPhCltExtPhoneDialData::RedialMaximumDuration() const
+    {
+    return iRedialMaximumDuration;
+    }   
+
+// ---------------------------------------------------------------------------
+// Returns SAT call value.
+// ---------------------------------------------------------------------------
+//
+TBool CPhCltExtPhoneDialData::SATCall() const
+    {
+    return iSATCall;    
+    }
+    
+ // -----------------------------------------------------------------------------
+// SendKeyPressed
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+TBool CPhCltExtPhoneDialData::SendKeyPressed() const
+    {
+    return iSendKey;
+    }
+        
+// ---------------------------------------------------------------------------
+// Returns show number.
+// ---------------------------------------------------------------------------
+//   
+TBool CPhCltExtPhoneDialData::ShowNumber() const 
+    {
+    return iShowNumber;
+    }
+    
+// ---------------------------------------------------------------------------
+// Returns subaddress.
+// ---------------------------------------------------------------------------
+//   
+const TPhCltSubAddress& CPhCltExtPhoneDialData::SubAddress() const
+    {
+    return iSubAddress;
+    }
+    
+// ---------------------------------------------------------------------------
+// Return window group.
+// ---------------------------------------------------------------------------
+//    
+TInt CPhCltExtPhoneDialData::WindowGroup() const
+    {
+    return iWindowGroup;
+    }
+    
+// ---------------------------------------------------------------------------
+// Return user to user information
+// ---------------------------------------------------------------------------
+//      
+const TDesC& CPhCltExtPhoneDialData::UUI() const 
+    {
+    return *iUUI;
+    }
+ 
+ // Other member functions   
+
+// ---------------------------------------------------------------------------
+// Calculates the size of descriptor in package. Note that to retreave 
+// a descriptor from stream in ConstructL we need to know the size of a
+// descriptor in order to allocate right size descriptor. This is the reason
+// for adding sizeof( int ) to descriptor length.
+// ---------------------------------------------------------------------------
+// 
+TInt CPhCltExtPhoneDialData::CalculateDescriptorSize( const TDesC& aDescriptor ) const 
+    {
+    // sizeof( TInt ) is for the length of a descriptor.
+    return sizeof( TInt ) + aDescriptor.Length() * 2; // unicode takes 2 bytes.
+    }
+    
+// ---------------------------------------------------------------------------
+// Calculates the size of descriptor in package. Note that to retreave 
+// a descriptor from stream in ConstructL we need to know the size of a
+// descriptor in order to allocate right size descriptor. This is the reason
+// for adding sizeof( int ) to descriptor length.
+// ---------------------------------------------------------------------------
+// 
+TInt CPhCltExtPhoneDialData::CalculateDescriptorSize( const TDesC8& aDescriptor ) const 
+    {
+    // sizeof( TInt ) is for the length of a descriptor in stream
+    return sizeof( TInt ) + aDescriptor.Length();
+    }   
+    
+// ---------------------------------------------------------------------------
+// Calculates the size of all member data.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CPhCltExtPhoneDialData::CalculatePackageSize() const
+    {
+    TInt packageSize = 0;
+    packageSize += CalculateDescriptorSize( iTelNumber );
+    packageSize += sizeof( iCallType );
+    packageSize += CalculateDescriptorSize( iName );
+    packageSize += sizeof( iWindowGroup );
+    packageSize += sizeof( iRedial );
+    packageSize+=sizeof( iRedialMaximumDuration.Int() );
+    if ( iContactLink )
+        {
+        packageSize += CalculateDescriptorSize( *iContactLink );
+        }
+    packageSize += CalculateDescriptorSize( iSubAddress );
+    packageSize += sizeof( iShowNumber);
+    packageSize += sizeof( iAllowMatch );
+    packageSize += sizeof( iSATCall );
+    packageSize += sizeof( iEndOtherCalls );
+    packageSize += CalculateDescriptorSize( iBearer );
+    packageSize += sizeof (iSendKey );
+    packageSize += sizeof( iReturnToNumberEntryOnFailure);
+    packageSize += sizeof (iInitCall );
+    packageSize += sizeof( iFlags );
+    packageSize += sizeof( iServiceId );    
+    packageSize += CalculateDescriptorSize( *iUUI );
+    return packageSize;
+    }
+    
+// ---------------------------------------------------------------------------
+// Checks that descriptorLength is not longer than maximum allowed descriptor
+// length.
+// ---------------------------------------------------------------------------
+//   
+void CPhCltExtPhoneDialData::CheckDescriptorMaxLengthL( 
+    TInt aDescriptorLength, TInt aMaxAllowedDescriptorLength ) const
+    {
+    if( aDescriptorLength > aMaxAllowedDescriptorLength )
+        {
+        User::Leave( KErrArgument );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Copies aSource descriptor to aMemberDescriptor. This quarantees that member
+// descriptor will be valid even if the allocation fails.
+// ---------------------------------------------------------------------------
+//   
+void CPhCltExtPhoneDialData::CopyDescriptorToMemberDescriptorL( 
+    const TDesC& aSource, 
+    HBufC*& aMemberDescriptor )
+    {
+    HBufC* temp = aSource.AllocL();
+    delete aMemberDescriptor;
+    aMemberDescriptor = temp;
+    }
+
+// ---------------------------------------------------------------------------
+// Copies aSource descriptor to aMemberDescriptor. This quarantees that member
+// descriptor will be valid even if the allocation fails.
+// ---------------------------------------------------------------------------
+//       
+void CPhCltExtPhoneDialData::CopyDescriptorToMemberDescriptorL( 
+    const TDesC8& aSource, 
+    HBufC8*& aMemberDescriptor )
+    {
+    HBufC8* temp = aSource.AllocL();
+    delete aMemberDescriptor;
+    aMemberDescriptor = temp;
+    }
+              
+  
+// ---------------------------------------------------------------------------
+// Reads descriptor from stream.
+// ---------------------------------------------------------------------------
+//  
+void CPhCltExtPhoneDialData::ReadDescriptorFromStreamL( 
+    RDesReadStream& aStream,
+    HBufC8*& aDescriptor 
+    )
+    {
+    const TInt descLength( aStream.ReadInt32L() );
+    if ( aDescriptor )
+        {
+        delete aDescriptor;
+        }
+    // Not to cleanupstack, aDescriptor is member variable
+    aDescriptor = HBufC8::NewL( descLength ); 
+    TPtr8 ptr = aDescriptor->Des();
+    aStream.ReadL( ptr, descLength );
+    }    
+    
+// ---------------------------------------------------------------------------
+// Reads descriptor from stream.
+// ---------------------------------------------------------------------------
+//  
+void CPhCltExtPhoneDialData::ReadDescriptorFromStreamL( 
+    RDesReadStream& aStream, 
+    HBufC*& aDescriptor )
+    {
+   const TInt descLength( aStream.ReadInt32L() );
+    if ( aDescriptor )
+        {
+        delete aDescriptor;
+        }
+    // Not to cleanupstack, aDescriptor will be member variable
+    aDescriptor = HBufC::NewL( descLength ); 
+    TPtr16 ptr = aDescriptor->Des();
+    aStream.ReadL( ptr, descLength );
+    }
+
+// ---------------------------------------------------------------------------
+// Writes descriptor to stream.
+// ---------------------------------------------------------------------------
+//  
+void CPhCltExtPhoneDialData::WriteDescriptorToStreamL( 
+    RDesWriteStream& aStream, 
+    const TDesC8& aDescriptor ) 
+    {
+    aStream.WriteInt32L( aDescriptor.Length() );
+    aStream.WriteL( aDescriptor );
+    }
+    
+// ---------------------------------------------------------------------------
+// Writes descriptor to stream.
+// ---------------------------------------------------------------------------
+//  
+void CPhCltExtPhoneDialData::WriteDescriptorToStreamL( 
+    RDesWriteStream& aStream, 
+    const TDesC& aDescriptor ) 
+    {
+    aStream.WriteInt32L( aDescriptor.Length() );
+    aStream.WriteL( aDescriptor );
+    }
+
+// ---------------------------------------------------------------------------
+// Packs the member data to descriptor. Ownershipd of returned descriptor
+// is given for caller.
+// ---------------------------------------------------------------------------
+//  
+EXPORT_C HBufC8* CPhCltExtPhoneDialData::PackLC() 
+    {
+    HBufC8* package = HBufC8::NewLC( CalculatePackageSize() );
+    
+    TPtr8 des = package->Des();
+    RDesWriteStream stream( des );
+    
+    CleanupClosePushL( stream );
+
+    stream << iTelNumber;     
+    stream.WriteInt32L( iCallType );       
+    stream << iName;
+    stream.WriteInt32L( iWindowGroup );
+    stream.WriteInt32L( iRedial );
+    stream.WriteInt32L( iRedialMaximumDuration.Int() );
+    if ( iContactLink )
+        {
+        WriteDescriptorToStreamL( stream, *iContactLink );
+        }
+    stream << iSubAddress;
+    stream.WriteInt32L( iShowNumber );
+    stream.WriteInt32L( iAllowMatch );
+    stream.WriteInt32L( iSATCall);
+    stream.WriteInt32L( iEndOtherCalls );
+    stream << iBearer;
+    stream.WriteInt32L( iSendKey );
+    stream.WriteInt32L( iReturnToNumberEntryOnFailure );
+    stream.WriteInt32L( iInitCall );
+    
+    
+    iFlags = EPhCltCallFlagsDefault;
+
+    if ( iShowNumber )
+        {
+        iFlags |= EPhCltCallFlagsAllowNumberShowing;
+        }
+
+    if ( iAllowMatch )
+        {
+        iFlags |= 
+            EPhCltCallFlagsAllowPersonalDirectoryMatching;
+        }
+    if ( iEndOtherCalls )
+        {
+           iFlags |= EPhCltCallFlagsEndBeforeDial;
+        }
+
+    if ( iSATCall )
+        {
+        iFlags |= EPhCltCallFlagsSAT;
+        }
+
+    if ( ( iCallType == EPhCltVideo ) || ( iCallType == EPhCltForcedVideo  ) )
+        {
+        iFlags |= EPhCltCallFlagsVideoCall;
+        }
+
+    if ( iCallType == EPhCltCallVoIP   )
+        {
+        iFlags |= EPhCltCallFlagsVoIPCall;
+        }
+      
+      if ( iSendKey )
+        {
+        iFlags |= EPhCltCallFlagsSendKey;
+        }
+
+    stream.WriteUint32L( iFlags );
+    stream.WriteUint32L( iServiceId );    
+    WriteDescriptorToStreamL( stream, *iUUI );
+    stream.CommitL();
+    
+    CleanupStack::PopAndDestroy( 1 ); // stream
+    
+    return package;   
+    
+      }    
+
+// -----------------------------------------------------------------------------
+// CPhCltExtPhoneDialData::SetServiceId
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CPhCltExtPhoneDialData::SetServiceId( TUint32 aServiceId )
+    {
+    iServiceId = aServiceId; 
+    }    
+
+// -----------------------------------------------------------------------------
+// CPhCltExtPhoneDialData::ServiceId
+// 
+// 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint32 CPhCltExtPhoneDialData::ServiceId() const
+    {
+    return iServiceId;
+    }
+    
+// ---------------------------------------------------------------------------
+// Sets dial data values using given package
+//
+// ---------------------------------------------------------------------------
+//
+void CPhCltExtPhoneDialData::SetParamsL(
+    const TDesC8& aPackage ) 
+    {
+    RDesReadStream stream( aPackage );
+    CleanupClosePushL( stream );
+    
+    stream >> iTelNumber;
+    iCallType = static_cast<TPhCltCallType>( stream.ReadInt32L() );
+    stream >> iName;
+    iWindowGroup = stream.ReadInt32L();
+    iRedial = stream.ReadInt32L();
+    iRedialMaximumDuration = stream.ReadInt32L();
+    ReadDescriptorFromStreamL( stream, iContactLink );
+    stream >> iSubAddress;
+    iShowNumber = stream.ReadInt32L();
+    iAllowMatch = stream.ReadInt32L();
+    iSATCall = stream.ReadInt32L(); 
+    iEndOtherCalls = stream.ReadInt32L();
+    stream >> iBearer;
+    iSendKey = stream.ReadInt32L();
+    iReturnToNumberEntryOnFailure = stream.ReadInt32L();
+    iInitCall = stream.ReadInt32L();
+    iFlags = stream.ReadUint32L();
+    iServiceId = stream.ReadUint32L();
+    ReadDescriptorFromStreamL( stream, iUUI );
+
+    CleanupStack::PopAndDestroy( 1 ); // stream;
+    }
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/standard/standard_aiw/cphsrvcallrequest.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,185 @@
+/*
+* 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:  Call Request.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "cphsrvcallrequest.h" 
+#include "phsrvutils.h" 
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvNotificationManager::CPhSrvCallRequest
+// 
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+CPhSrvCallRequest::CPhSrvCallRequest( 
+    const RMessage2& aMessage, 
+    CPhCltExtPhoneDialData& aArguments,
+    TInt aSubSessionHandle )
+    : iPendingRequestPointer( aMessage ),      
+    iSubSessionHandle( aSubSessionHandle )
+    {
+    iCallArguments = &aArguments;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvNotificationManager::CPhSrvCallRequest
+// 
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+CPhSrvCallRequest::CPhSrvCallRequest()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvNotificationManager::NewLC
+// 
+// Static Symbian OS two-phase constructor. Return an instance
+// and leave it on the cleanup stack.
+// -----------------------------------------------------------------------------
+//
+CPhSrvCallRequest* CPhSrvCallRequest::NewLC( 
+    const RMessage2& aMessage, 
+    CPhCltExtPhoneDialData& aArguments,
+    TInt aSubSessionHandle )
+    {
+    CPhSrvCallRequest* self = new( ELeave ) CPhSrvCallRequest( 
+        aMessage, 
+        aArguments, 
+        aSubSessionHandle );
+        CleanupStack::PushL( self );
+    
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvNotificationManager::NewL
+// 
+// Static Symbian OS two-phase constructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvCallRequest* CPhSrvCallRequest::NewL()
+    {
+    CPhSrvCallRequest* self = new( ELeave ) CPhSrvCallRequest();
+    
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvNotificationManager::InformOfCallAttemptResult
+// 
+// Complete a client request which will indicate the result
+// of attempting to dial a number.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvCallRequest::InformOfCallAttemptResult( 
+    TPhCltPhoneResults aResultOfAttemptingCall )
+    {
+    // Complete the client's pending request, indicating 
+    // the result of the attempt.
+    iPendingRequestPointer.Complete( aResultOfAttemptingCall );
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvNotificationManager::Cancel
+// 
+// Complete the client's request with KErrCancel
+// -----------------------------------------------------------------------------
+//
+void CPhSrvCallRequest::Cancel()
+    {
+    iPendingRequestPointer.Complete( KErrCancel );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvNotificationManager::SubSessionHandle
+// 
+// Return the handle of the subsession that initiated the
+// original dial request.
+// -----------------------------------------------------------------------------
+//
+TInt CPhSrvCallRequest::SubSessionHandle() const
+    {
+    return iSubSessionHandle;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvNotificationManager::CallArguments
+// 
+// Returns the call arguments
+// -----------------------------------------------------------------------------
+//
+CPhCltExtPhoneDialData& CPhSrvCallRequest::CallArguments() const
+    {
+    return *iCallArguments;
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvNotificationManager::UpdateEmercgencyCall
+// 
+// Set new parameter to emergency object.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvCallRequest::UpdateEmercgencyCall(
+    const RMessage2& aMessage, 
+    CPhCltExtPhoneDialData& aArguments, 
+    TInt aSubSessionHandle)
+    {
+  
+    __ASSERT_ALWAYS(  aArguments.TelephoneNumber() == KPhSrvUsedEmergencyCallNumber, 
+        PhoneServerUtils::Panic( 
+            EPhoneServerPanicEmergencyCallRequestFailure ) );
+            
+    iPendingRequestPointer = aMessage;
+    iCallArguments = &aArguments;
+    iSubSessionHandle = aSubSessionHandle;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvNotificationManager::ClearEmergencyCall
+// 
+// Emtpies Emergency call data
+// -----------------------------------------------------------------------------
+//
+void CPhSrvCallRequest::ClearEmergencyCall()
+    {
+    if ( iSubSessionHandle == 0 )
+        {
+        return;
+        }
+    __ASSERT_ALWAYS(  
+        iCallArguments->TelephoneNumber() == KPhSrvUsedEmergencyCallNumber, 
+        PhoneServerUtils::Panic( 
+            EPhoneServerPanicEmergencyCallRequestFailure ) );
+    iSubSessionHandle = 0;
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/standard/standard_aiw/cphsrvcallrequestmanager.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,291 @@
+/*
+* 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:  Call Request Manager.
+*
+*/
+
+
+
+// INCLUDES
+#include "cphsrvcallrequestmanager.h" 
+#include "cphsrvcallrequest.h" 
+#include "cphsrvsubsessionbase.h" 
+#include "phsrvutils.h" 
+
+
+// CONSTANTS
+
+// The size of the Notification manager storage.
+const TInt KPhSrvNotificationManagerPendingCallGranularity = 4;
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhSrvCallRequestManager::CPhSrvCallRequestManager
+// 
+// C++ constructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvCallRequestManager::CPhSrvCallRequestManager()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvCallRequestManager::~CPhSrvCallRequestManager
+// 
+// C++ destructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvCallRequestManager::~CPhSrvCallRequestManager()
+    {
+    if ( iOutstandingRequestsCall )
+        {
+        iOutstandingRequestsCall->ResetAndDestroy();
+        iOutstandingRequestsCall->Close();
+        }
+    delete iOutstandingRequestsCall;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvCallRequestManager::ConstructL
+// 
+// Complete construction.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvCallRequestManager::ConstructL()
+    {
+    iOutstandingRequestsCall = new ( ELeave ) RPointerArray< 
+        CPhSrvCallRequest >( KPhSrvNotificationManagerPendingCallGranularity );
+
+    CPhSrvCallRequest* emergencyCallRequest = CPhSrvCallRequest::NewL();
+    CleanupStack::PushL( emergencyCallRequest );
+    User::LeaveIfError( 
+        iOutstandingRequestsCall->Append( emergencyCallRequest ) );
+    CleanupStack::Pop(); // emergencyCallRequest
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvCallRequestManager::NegotiatorDialL
+// 
+// Initiate a dial request - called by the external call
+// interface.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvCallRequestManager::NegotiatorDialL( 
+    const RMessage2& aMessage, 
+    CPhCltExtPhoneDialData& aArgs,
+    CPhSrvSubSessionBase& aSubSession )
+    {
+    // If we have no registered initiator then we can't make a call.
+    if ( !iCallInitiator )
+        {
+        User::Leave( KErrNotReady );
+        }
+    
+    if (  aArgs.TelephoneNumber() == KPhSrvUsedEmergencyCallNumber && 
+         ( *iOutstandingRequestsCall )[0]->SubSessionHandle() == 0 )
+        {
+        ( *iOutstandingRequestsCall )[0]->UpdateEmercgencyCall( 
+            aMessage, 
+           aArgs,
+            aSubSession.SubSessionUniqueHandle() );         
+        }
+    else
+        {
+        // Create pending request
+        CPhSrvCallRequest* request = CPhSrvCallRequest::NewLC( 
+            aMessage, 
+            aArgs,
+            aSubSession.SubSessionUniqueHandle() );
+
+        User::LeaveIfError( iOutstandingRequestsCall->Append( request ) );
+        CleanupStack::Pop( request );
+        }
+
+    // Now see if the call notifier (initiator) is ready 
+    if ( iCallInitiator->InitiatorIsReadyToMakeCall() )
+        {
+        // Ask the call initiator to make the call (basically completes the
+        //phone app engine's outstanding call notifier request).
+        iCallInitiator->InitiatorMakeAsynchronousCallL( aArgs );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvCallRequestManager::NegotiatorDialCancel
+// 
+// Cancel a pending dial request.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvCallRequestManager::NegotiatorDialCancelL( 
+    CPhSrvSubSessionBase& aSubSession )
+    {
+    // Obtain the subsessions handle
+    const TInt handle = aSubSession.SubSessionUniqueHandle();
+
+    // Now look for any pending requests that match.
+    const TInt count = iOutstandingRequestsCall->Count();
+    for( TInt i = 0; i < count; i++ )
+        {
+        CPhSrvCallRequest* entry = ( *iOutstandingRequestsCall )[i];
+        if ( entry->SubSessionHandle() == handle )
+            {
+            // Found matching entry, so cancel it and clean up
+            if ( i == 0 ) // 0 stands for emergency call
+                {
+                entry->Cancel();
+                entry->ClearEmergencyCall();
+                }
+            else
+                {
+                iOutstandingRequestsCall->Remove( i );
+                entry->Cancel();
+                delete entry;
+                }
+
+            // If we have more than one item in the queue, then we
+            // try and fire of the next item here.
+            if ( iCallInitiator->InitiatorIsReadyToMakeCall() && 
+                 ( iOutstandingRequestsCall->Count() > 1 ||
+                 ( *iOutstandingRequestsCall )[0]->SubSessionHandle() != 0 ) )
+                {
+                // Get the call at the top of the list (head of the queue)
+                CPhSrvCallRequest* head = NULL;
+                if ( ( *iOutstandingRequestsCall )[0]->SubSessionHandle() != 0 )
+                    {
+                    head = ( *iOutstandingRequestsCall )[0];
+                    }
+                else
+                    {
+                    head = ( *iOutstandingRequestsCall )[1];
+                    }
+
+
+                iCallInitiator->InitiatorMakeAsynchronousCallL( 
+                    head->CallArguments() );
+                }
+
+            return;
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvCallRequestManager::SetNegotiatorReadyCall
+// 
+// Updates the negotiator so that it knows if the notifier
+// session is able to make a call.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvCallRequestManager::SetNegotiatorReadyCallL(
+    MPhSrvInitiatorCall& aInitiator )
+    {
+    // There mustn't already be a call initiator, or the existing call
+    // initiator must be the same as the new one (otherwise, panic).
+    __ASSERT_ALWAYS( !iCallInitiator || &aInitiator == iCallInitiator, 
+        PhoneServerUtils::Panic( 
+        EPhoneServerPanicExistingCallInitiatorFault ) );
+
+    // Update our pointer
+    iCallInitiator = &aInitiator;
+
+    // If we have more than one item in the queue, then we
+    // try and fire of the next item here.
+    if ( iCallInitiator->InitiatorIsReadyToMakeCall() && 
+         ( iOutstandingRequestsCall->Count() > 1 ||
+           ( *iOutstandingRequestsCall )[0]->SubSessionHandle() != 0 ) )
+        {
+        // Get the call at the top of the list (head of the queue)
+        CPhSrvCallRequest* head = NULL;
+        if ( ( *iOutstandingRequestsCall )[0]->SubSessionHandle() != 0 )
+            {
+            head = ( *iOutstandingRequestsCall )[0];
+            }
+        else
+            {
+            head = ( *iOutstandingRequestsCall )[1];
+            }
+
+        iCallInitiator->InitiatorMakeAsynchronousCallL(
+            head->CallArguments() );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvCallRequestManager::SetNegotiatorReadyCallCancel
+// 
+// Indicates that the initiator is no longer available
+// -----------------------------------------------------------------------------
+//
+void CPhSrvCallRequestManager::SetNegotiatorReadyCallCancel( 
+    MPhSrvInitiatorCall& aInitiator )
+    {
+    if ( iCallInitiator && iCallInitiator == &aInitiator )
+        {
+        iCallInitiator = NULL;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvCallRequestManager::SetNegotiatorAttemptedCallResponseValue
+// 
+// Handle a response from the phone app engine - this is the 
+// result of attempting to make a call (based upon a previous
+// clients external call request)
+// -----------------------------------------------------------------------------
+//
+void CPhSrvCallRequestManager::SetNegotiatorAttemptedCallResponseValue( 
+    TPhCltPhoneResults aResult )
+    {
+    if ( iOutstandingRequestsCall->Count() > 1 ||
+         ( *iOutstandingRequestsCall )[0]->SubSessionHandle() != 0 )
+        {
+        // Get the first item in the list - this is the oldest, and has the
+        // details of the call we had previously initiated.
+        CPhSrvCallRequest* head = NULL;
+        if ( ( *iOutstandingRequestsCall )[0]->SubSessionHandle() != 0 )
+            {
+            head = ( *iOutstandingRequestsCall )[0];
+            }
+        else
+            {
+            head = ( *iOutstandingRequestsCall )[1];
+            }
+        // Complete the request so that the external call client knows the
+        // result of the call attempt
+        head->InformOfCallAttemptResult( aResult );
+
+        // Delete the pending request (now that it's been processed) and tidy
+        // up
+        if ( ( *iOutstandingRequestsCall )[0]->SubSessionHandle() != 0 )
+            {
+            ( *iOutstandingRequestsCall )[0]->ClearEmergencyCall();
+            }
+        else
+            {
+            iOutstandingRequestsCall->Remove( 1 );
+            delete head;
+            }
+        }
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/standard/standard_aiw/cphsrvemergencyrequestmanager.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,201 @@
+/*
+* 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:  Call Request Manager.
+*
+*/
+
+
+
+// INCLUDES
+#include "cphsrvemergencyrequestmanager.h" 
+#include "cphsrvsubsessionbase.h" 
+#include "phsrvutils.h" 
+
+
+// CONSTANTS
+
+// The size of the Notification manager storage.
+//const TInt KPhSrvNotificationManagerPendingCallGranularity = 4;
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhSrvEmergencyRequestManager::CPhSrvEmergencyRequestManager
+// 
+// C++ constructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvEmergencyRequestManager::CPhSrvEmergencyRequestManager()
+    : iIsRequestPending( EFalse )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvEmergencyRequestManager::~CPhSrvEmergencyRequestManager
+// 
+// C++ destructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvEmergencyRequestManager::~CPhSrvEmergencyRequestManager()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvEmergencyRequestManager::ConstructL
+// 
+// Complete construction.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvEmergencyRequestManager::ConstructL()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvEmergencyRequestManager::EmergencyDialL
+// 
+// Initiate a dial request - called by the external call
+// interface. Checks if emergency initiator is ready and sets request pending if 
+// emergency initiator hasn't been registered yet 
+// -----------------------------------------------------------------------------
+//
+void CPhSrvEmergencyRequestManager::EmergencyDialL( 
+    const RMessage2& aMessage )
+    {
+    // If we have no registered initiator then we can't make a call.
+    if ( !iEmergencyInitiator )
+        {
+        if( iIsRequestPending )
+            {
+            User::Leave( KErrAlreadyExists );
+            }
+        else
+            {
+            iPendingRequest = aMessage;
+            iIsRequestPending = ETrue;
+            }
+        }
+    else
+        {
+        DoMakeEmergencyDial( aMessage );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvEmergencyRequestManager::DoMakeEmergencyDial
+// 
+// Do the actual emergency dial request for emergency initiator.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvEmergencyRequestManager::DoMakeEmergencyDial( const RMessage2& aMessage )
+    {
+    iPendingRequestPointer= aMessage;
+    
+    // Clear pending request status 
+    iIsRequestPending = EFalse;
+    
+    // Now see if the call notifier (initiator) is ready 
+    if ( iEmergencyInitiator ->InitiatorIsReadyToMakeEmergencyCall() )
+        {
+        // Ask the call initiator to make the call (basically completes the
+        //phone app engine's outstanding call notifier request).
+        iEmergencyInitiator ->InitiatorMakeEmergencyCall( aMessage );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvEmergencyRequestManager::EmergencyDialCancel
+// 
+// Cancel a pending dial request.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvEmergencyRequestManager::EmergencyDialCancel()
+    {
+    // Clear pending request status 
+    iIsRequestPending = EFalse;
+    
+    if ( !iPendingRequestPointer.IsNull() )
+        {
+        iPendingRequestPointer.Complete( KErrCancel );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvEmergencyRequestManager::SetNegotiatorReadyCall
+// 
+// Updates the negotiator so that it knows if the notifier
+// session is able to make a call.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvEmergencyRequestManager::SetNegotiatorReadyCall(
+    MPhSrvEmergencyCall& aInitiator )
+    {
+    // There mustn't already be a call initiator, or the existing call
+    // initiator must be the same as the new one (otherwise, panic).
+    __ASSERT_ALWAYS( !iEmergencyInitiator || &aInitiator == iEmergencyInitiator, 
+        PhoneServerUtils::Panic( 
+        EPhoneServerPanicExistingCallInitiatorFault ) );
+
+    // Update our pointer
+    iEmergencyInitiator  = &aInitiator;
+    
+    if( iIsRequestPending )
+        {
+        DoMakeEmergencyDial( iPendingRequest );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvEmergencyRequestManager::SetNegotiatorReadyCallCancel
+// 
+// Indicates that the initiator is no longer available
+// -----------------------------------------------------------------------------
+//
+void CPhSrvEmergencyRequestManager::SetNegotiatorReadyCallCancel( 
+    MPhSrvEmergencyCall& aInitiator )
+    {
+    if ( iEmergencyInitiator && iEmergencyInitiator == &aInitiator )
+        {
+        iEmergencyInitiator = NULL;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvEmergencyRequestManager::SetNegotiatorAttemptedCallResponseValue
+// 
+// Handle a response from the phone app engine - this is the 
+// result of attempting to make a call (based upon a previous
+// clients external call request)
+// -----------------------------------------------------------------------------
+//
+void CPhSrvEmergencyRequestManager::SetNegotiatorAttemptedCallResponseValue( 
+    TPhCltPhoneResults aResult )
+    {
+    if ( !iPendingRequestPointer.IsNull() )
+        {
+        iPendingRequestPointer.Complete( aResult );
+        }
+    }
+
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/standard/standard_aiw/cphsrvsubsessionemergencynum.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -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:  Sub Session Emergency Num.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "cphsrvsubsessionemergencynum.h" 
+#include <s32mem.h>
+#include <phclttypes.h> 
+#include "cphsrvsession.h" 
+#include "cphsrvserver.h" 
+#include "mphsrvphoneinterface.h" 
+#include "mphsrvemergencynumbermanager.h" 
+#include "mphsrvemergencynegotiators.h" 
+#include "phsrvdebuginfo.h" 
+
+// CONSTANTS
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionEmergencyNum::CPhSrvSubSessionEmergencyNum
+// 
+// C++ Constructor
+// -----------------------------------------------------------------------------
+//
+CPhSrvSubSessionEmergencyNum::CPhSrvSubSessionEmergencyNum( 
+    CPhSrvSession& aSession )
+:   CPhSrvSubSessionBase( aSession, EPhSrvSubSessionTypeEmergencyNumber )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionEmergencyNum::ConstructL
+// 
+// Symbian OS 2nd phase constructor
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionEmergencyNum::ConstructL()
+    {
+    CPhSrvSubSessionBase::ConstructL();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionEmergencyNum::PhSrvMessageDecoderCanProcessMessage
+// 
+// Framework function. Returns ETrue for the op codes that
+// this subsession can handle.
+// -----------------------------------------------------------------------------
+//
+TBool CPhSrvSubSessionEmergencyNum::PhSrvMessageDecoderCanProcessMessage( 
+    TInt aFunction )
+    {
+    switch(aFunction)
+        {
+        case EPhoneServerEmergencyNumberSubSessionClose:
+        case EPhoneServerEmergencyNumberSubSessionIsEmergencyNumber:
+        case EPhoneServerEmergencyNumberSubsessionEmergencyDial:
+        case EPhoneServerEmergencyNumberSubsessionEmergencyDialCancel:
+            return ETrue;
+
+        default:
+            return EFalse;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionEmergencyNum::PhSrvMessageProcessorHandleMessageL
+// 
+// Framework function. Handle any op-codes here.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionEmergencyNum::PhSrvMessageProcessorHandleMessageL( 
+    const RMessage2& aMessage )
+    {
+    TBool permissionStatus ( EFalse );
+     
+    // Check needed capabilities
+    TBool hasCapNetworkControlAndServices ( EFalse );
+    hasCapNetworkControlAndServices = aMessage.HasCapability( ECapabilityNetworkControl,
+                                                              ECapabilityNetworkServices );
+    switch( aMessage.Function() )
+        {
+    case EPhoneServerEmergencyNumberSubSessionClose:
+        CmdSubSessionCloseL( aMessage );
+        permissionStatus = ETrue;
+        break;
+    case EPhoneServerEmergencyNumberSubSessionIsEmergencyNumber:
+        CmdSubSessionIsEmergencyNumberL( aMessage );
+        permissionStatus = ETrue;
+        break;
+    case EPhoneServerEmergencyNumberSubsessionEmergencyDial:
+        if ( hasCapNetworkControlAndServices )
+            {
+            CmdSubSessionDialEmergencyCallL( aMessage );
+            permissionStatus = ETrue;
+            }
+        break;
+     case EPhoneServerEmergencyNumberSubsessionEmergencyDialCancel:
+        if ( hasCapNetworkControlAndServices )
+            {
+            CmdSubSessionDialEmergencyCallCancelL( aMessage );
+            permissionStatus = ETrue;
+            }
+        break;
+
+    default:
+        PhoneSession().PanicClient(
+            aMessage,
+            EPhCltServerInitiatedPanicInvalidRequest );
+        break;
+        }
+        
+    // If caps are not ok
+    if( !permissionStatus )
+        {
+        aMessage.Complete( KErrPermissionDenied );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionEmergencyNum::CmdSubSessionCloseL
+// 
+// Close the sub-session
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionEmergencyNum::CmdSubSessionCloseL( 
+    const RMessage2& aMessage )
+    {
+    PhoneSession().CloseSubSession( aMessage );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionEmergencyNum::CmdSubSessionIsEmergencyNumberL
+// 
+// Check if the specified number is an emergency number
+//
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionEmergencyNum::CmdSubSessionIsEmergencyNumberL( 
+    const RMessage2& aMessage )
+    {
+    _DPRINT( 4, "PhSrv.CPhSrvSubSessionEmergencyNum:Start");  
+    // Read from client-side
+    TPhCltTelephoneNumber number;
+    TPckg< TPhCltTelephoneNumber > pNumber( number );    
+    Read(
+        aMessage,
+        0,
+        pNumber );
+
+    const TPhCltEmergencyNumberQueryMode mode = 
+        static_cast< TPhCltEmergencyNumberQueryMode >( aMessage.Int2() );
+
+    // Is this an emergency number?
+    const TBool isEmergencyNumber = 
+        PhoneSession().PhoneServer().EmergencyNumberManagerL().
+            EmergencyNumberManagerIsEmergencyNumberL( number, mode );
+    const TPckg< TBool > pIsEmergencyNumber( isEmergencyNumber );
+    
+    // Write back to client    
+    if ( mode == EPhCltEmergencyNumberQueryModeAdvanced && isEmergencyNumber ||
+        mode == EPhCltEmergencyNumberQueryModeNormalWriteback && isEmergencyNumber )
+        {        
+        TPckg< TPhCltTelephoneNumber > pNumber2( number );    
+        Write(
+            aMessage,
+            0,
+            pNumber2          // write emergency number back.
+             );
+        }    
+
+    Write(
+        aMessage,
+        1,              // write emergency number check result back.
+        pIsEmergencyNumber );
+
+    aMessage.Complete( KErrNone );
+_DPRINT( 4, "PhSrv.CPhSrvSubSessionEmergencyNum.End" );       // debug print
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionEmergencyNum::CmdSubSessionDialEmergencyCall
+// 
+// Initiates emergency call
+//
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionEmergencyNum::CmdSubSessionDialEmergencyCallL( 
+    const RMessage2& aMessage )
+    {
+    _DPRINT( 4, "PhSrv.CPhSrvSubSessionEmergencyNum.DialEM" );       // debug print
+    // Submit a new request to the call manager
+    MPhSrvEmergencyNegotiatorCall& callNegotiator = 
+        PhoneSession().PhoneServer().EmergencyCallNegotiatorL();
+    callNegotiator.EmergencyDialL( aMessage );
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionEmergencyNum::CmdSubSessionDialEmergencyCallCancelL
+// 
+// Cancel emergency call
+//
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionEmergencyNum::CmdSubSessionDialEmergencyCallCancelL( 
+    const RMessage2& aMessage )
+    {
+    _DPRINT( 4, "PhSrv.CPhSrvSubSessionEmergencyNum.EMCancel" );       // debug print
+    // Submit a new request to the call manager
+    MPhSrvEmergencyNegotiatorCall& callNegotiator = 
+        PhoneSession().PhoneServer().EmergencyCallNegotiatorL();
+    callNegotiator.EmergencyDialCancel();
+    aMessage.Complete( KErrNone );
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/standard/standard_aiw/cphsrvsubsessionextcall.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,236 @@
+/*
+* 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:  Sub Session Ext Call.
+*
+*/
+
+
+// INCLUDE FILES
+#include "cphsrvsubsessionextcall.h" 
+#include "cphsrvsession.h" 
+#include "cphsrvserver.h" 
+#include "mphsrvobjectnegotiators.h" 
+
+// Hash mark
+_LIT( KPhoneHash, "#" );
+
+// dtmf chars
+_LIT( KPhoneDtmfNumberChars, "pw" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionExtCall::CPhSrvSubSessionExtCall
+// 
+// C++ Constructor
+// -----------------------------------------------------------------------------
+//
+CPhSrvSubSessionExtCall::CPhSrvSubSessionExtCall(CPhSrvSession& aSession)
+:    CPhSrvSubSessionBase(aSession, EPhSrvSubSessionTypeExternalCall)
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionExtCall::PhSrvMessageDecoderCanProcessMessage
+// 
+// Framework function. Returns ETrue for the op codes that
+// this subsession can handle.
+// -----------------------------------------------------------------------------
+//
+TBool CPhSrvSubSessionExtCall::PhSrvMessageDecoderCanProcessMessage( 
+    TInt aFunction )
+    {
+    switch( aFunction )
+        {
+        case EPhoneServerExtCallSubSessionClose:
+        case EPhoneServerExtCallSubSessionMakeCall:
+        case EPhoneServerExtCallSubSessionMakeCallCancel:
+            return ETrue;
+
+        default:
+            return EFalse;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionEmergencyNum::PhSrvMessageProcessorHandleMessageL
+// 
+// Framework function. Handle any op-codes here.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionExtCall::PhSrvMessageProcessorHandleMessageL( 
+    const RMessage2& aMessage )
+    {
+    TBool permissionStatus ( EFalse );
+    TBool dtmfNumber( EFalse ); //contains 'p' or 'w'  
+    TBool isSSUssd( EFalse ); //is USSD/SS string
+    TBool hasUssdSSCaps( EFalse ); //has USSD/SS string correct capabilities
+     
+    TBool hasCapNetworkServices( EFalse );
+    TBool hasCapNetworkControlAndServices( EFalse );
+    TBool hasCapWriteAndReadDeviceData ( EFalse );
+    // Capabilities needed if NOT USSD/SS string                                                         
+    hasCapNetworkServices = aMessage.HasCapability( ECapabilityNetworkServices );                                                                                                                   
+      
+    switch( aMessage.Function() )
+        {
+        case EPhoneServerExtCallSubSessionClose:
+            CmdSubSessionCloseL( aMessage );
+            permissionStatus = ETrue;
+            break;
+        case EPhoneServerExtCallSubSessionMakeCall:
+            CreateCallArgsL( aMessage );
+            // Checks if telephone number contains dtmf string
+            dtmfNumber = IsDtmfPhoneNumber( iCallArgs->TelephoneNumber());
+            if ( !dtmfNumber )
+                {
+                // Checks if telephone number is USSD/SS string
+                isSSUssd = ( iCallArgs->TelephoneNumber().Right( KPhoneHash().Length() ) == KPhoneHash );
+                if ( isSSUssd )
+                    { 
+                    // Capabilities needed if USSD/SS string
+                    hasCapNetworkControlAndServices = aMessage.HasCapability( ECapabilityNetworkControl, 
+                                                              ECapabilityNetworkServices );
+                    hasCapWriteAndReadDeviceData = aMessage.HasCapability( ECapabilityReadDeviceData, ECapabilityWriteDeviceData );
+                    hasUssdSSCaps =  hasCapNetworkControlAndServices && hasCapWriteAndReadDeviceData;
+                    }   
+                }
+           if ( ( hasCapNetworkServices && !isSSUssd ) ||  hasUssdSSCaps )
+                {
+                CmdSubSessionMakeCallL( aMessage );
+                permissionStatus = ETrue;
+                }
+            break;
+        case EPhoneServerExtCallSubSessionMakeCallCancel:
+            if ( hasCapNetworkServices )
+                {
+                CmdSubSessionMakeCallCancelL( aMessage );
+                permissionStatus = ETrue;
+                }
+            break;
+
+        default:
+            PhoneSession().PanicClient( 
+                aMessage,
+                EPhCltServerInitiatedPanicInvalidRequest );
+            break;
+        }
+
+    // If caps are not ok 
+     if( !permissionStatus )
+        {
+        aMessage.Complete( KErrPermissionDenied );    
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionExtCall::CmdSubSessionCloseL
+// 
+// Close the sub-session
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionExtCall::CmdSubSessionCloseL( const RMessage2& aMessage )
+    {
+    delete iCallArgs;
+    iCallArgs =NULL;
+    PhoneSession().CloseSubSession( aMessage );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionExtCall::CmdSubSessionMakeCallL
+// 
+// Setup an asynchronous request to handle external interface
+// call requests.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionExtCall::CmdSubSessionMakeCallL( 
+    const RMessage2& aMessage )
+    {               
+
+    // Submit a new request to the call manager
+    MPhSrvNegotiatorCall& callNegotiator = PhoneSession().PhoneServer(
+        ).CallNegotiatorL();
+    callNegotiator.NegotiatorDialL( aMessage, *iCallArgs, *this );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionExtCall::CmdSubSessionMakeCallCancelL
+// 
+// Cancel an outstanding request to handle call initiations.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionExtCall::CmdSubSessionMakeCallCancelL( 
+    const RMessage2& aMessage )
+    {
+    // Ask the negotiator to delete any pending call request for this 
+    // subsession. It will panic the client if one can't be found.
+    MPhSrvNegotiatorCall& callNegotiator = PhoneSession().PhoneServer(
+        ).CallNegotiatorL();
+
+    callNegotiator.NegotiatorDialCancelL( *this );
+    aMessage.Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionExtCall::CreateCallArgs
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionExtCall::CreateCallArgsL( const RMessage2& aMessage )
+    {
+    HBufC8* package = HBufC8::NewLC( aMessage.Int1() ); 
+    TPtr8 calldata( package->Des() );
+    PhoneSession().Read(
+            aMessage,
+            0,
+            calldata );
+                                             
+    iCallArgs = CPhCltExtPhoneDialData::NewL( *package );
+    CleanupStack::PopAndDestroy( package );
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionExtCall::IsDtmfPhoneNumber
+// -----------------------------------------------------------------------------
+//
+TBool CPhSrvSubSessionExtCall::IsDtmfPhoneNumber(
+        const TDesC& aString )
+    {
+    
+
+    // String must contain 'p' or 'w'.
+    TBool must = EFalse;
+
+        {
+        TPtrC chs( KPhoneDtmfNumberChars );
+        const TInt length = chs.Length();
+        TInt index;
+
+        for ( index = 0; index < length; index++ )
+            {
+            if ( aString.Locate( chs[ index ] ) != KErrNotFound )
+                {
+                must = ETrue;
+                break;
+                }
+            }
+        }
+
+    return must; 
+    }
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/standard/standard_aiw/cphsrvsubsessionnotifier.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,623 @@
+/*
+* 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:  Sub Session Notifier.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <phclttypes.h> 
+#include "cphsrvsubsessionnotifier.h" 
+#include "cphsrvsession.h" 
+#include "cphsrvserver.h" 
+#include "mphsrvemergencynegotiators.h" 
+#include "mphsrvobjectnegotiators.h" 
+#include "mphsrvcomhandnegotiators.h" 
+
+// CONSTANTS
+// None.
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionNotifier::CPhSrvSubSessionNotifier
+// 
+// C++ Constructor
+// -----------------------------------------------------------------------------
+//
+CPhSrvSubSessionNotifier::CPhSrvSubSessionNotifier( CPhSrvSession& aSession )
+    :   CPhSrvSubSessionBase( aSession, EPhSrvSubSessionTypeCallNotifier ),
+        iTelNumberPckg( iTelNumber )
+    {
+    
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionNotifier::~CPhSrvSubSessionNotifier
+// 
+// C++ Destructor
+// -----------------------------------------------------------------------------
+//
+CPhSrvSubSessionNotifier::~CPhSrvSubSessionNotifier()
+    {
+    if ( PhoneSession().PhoneServer().IsCallNegotiator() )
+        {
+        PhoneSession().
+            PhoneServer().
+                CallNegotiator().
+                    SetNegotiatorReadyCallCancel( *this ); 
+        }   
+    if ( PhoneSession().PhoneServer().IsEmergencyCallNegotiator() )
+        {
+        PhoneSession().
+            PhoneServer().
+                EmergencyCallNegotiator().
+                    SetNegotiatorReadyCallCancel( *this );
+        }
+    if ( PhoneSession().PhoneServer().IsComHandNegotiator() )
+        {
+        PhoneSession().
+            PhoneServer().
+                ComHandNegotiator().
+                    SetNegotiatorReadyRequestCancel( *this );
+        
+        }
+    delete iDialData;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionNotifier::ConstructL
+// 
+// Symbian OS 2nd phase constructor
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+void CPhSrvSubSessionNotifier::ConstructL()
+    {
+    CPhSrvSubSessionBase::ConstructL();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionNotifier::PhSrvMessageDecoderCanProcessMessage
+// 
+// Framework function. Returns ETrue for the op codes that
+// this subsession can handle.
+// -----------------------------------------------------------------------------
+//
+TBool CPhSrvSubSessionNotifier::PhSrvMessageDecoderCanProcessMessage(
+        TInt aFunction )
+    {
+    switch( aFunction )
+        {
+        case EPhoneServerNotifySubSessionClose:
+        case EPhoneServerNotifySubSessionNotifyCallRequest:
+        case EPhoneServerNotifySubSessionNotifyCallRequestCancel:
+        case EPhoneServerNotifySubSessionReportCallResult:
+        case EPhoneServerNotifySubSessionDialData:
+
+        case EPhoneServerNotifyEmergencySubSessionNotifyCallRequest:
+        case EPhoneServerNotifyEmergencySubSessionNotifyCallRequestCancel:
+        case EPhoneServerNotifyEmergencySubSessionReportCallResult:
+
+        case EPhoneServerComHandNotifySubSessionComHandRequest:
+        case EPhoneServerComHandNotifySubSessionComHandRequestCancel:
+        case EPhoneServerComHandNotifySubSessionReportComHandResult:
+
+            return ETrue;
+
+        default:
+            return EFalse;
+        }   
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionNotifier::PhSrvMessageProcessorHandleMessageL
+// 
+// Framework function. Handle any op-codes here.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionNotifier::PhSrvMessageProcessorHandleMessageL(
+    const RMessage2& aMessage )
+    {
+    switch( aMessage.Function() )
+        {
+        case EPhoneServerNotifySubSessionClose:
+            CmdSubSessionCloseL( aMessage );
+            break;
+        case EPhoneServerNotifySubSessionNotifyCallRequest:
+            CmdSubSessionNotifyCallRequestL( aMessage );
+            break;
+        case EPhoneServerNotifySubSessionNotifyCallRequestCancel:
+            CmdSubSessionNotifyCallRequestCancelL( aMessage );
+            break;
+        case EPhoneServerNotifySubSessionReportCallResult:
+            CmdSubSessionReportCallResultL( aMessage );
+            break;
+        case EPhoneServerNotifySubSessionDialData:
+            CmdSubSessionDialDataL( aMessage );
+            break;
+        case EPhoneServerNotifyEmergencySubSessionNotifyCallRequest:
+            CmdSubSessionNotifyEmergencyL( aMessage );
+            break;
+        case EPhoneServerNotifyEmergencySubSessionNotifyCallRequestCancel:
+            CmdSubSessionNotifyEmergencyCancel( aMessage );
+            break;
+        case EPhoneServerNotifyEmergencySubSessionReportCallResult:
+            CmdSubSessionReportEmergencyCallResultL( aMessage );
+            break;  
+        case EPhoneServerComHandNotifySubSessionComHandRequest:
+            CmdSubSessionComHandNotifyRequestL( aMessage );
+            break;
+        case EPhoneServerComHandNotifySubSessionComHandRequestCancel:
+            CmdSubSessionComHandNotifyRequestCancelL( aMessage );
+            break;
+        case EPhoneServerComHandNotifySubSessionReportComHandResult:
+            CmdSubSessionComHandNotifyReportL( aMessage );
+            break;             
+        default:
+            PhoneSession().PanicClient(
+                aMessage,
+                EPhCltServerInitiatedPanicInvalidRequest );
+            break;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionNotifier::InitiatorMakeAsynchronousCall
+// 
+// Called by the phone call negotiator when it wants this
+// object to initiate a call (on behalf of the external
+// interface).
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionNotifier::InitiatorMakeAsynchronousCallL(
+      CPhCltExtPhoneDialData& aArgs )
+    {
+    // data length to send
+    const TInt dataLength = aArgs.CalculatePackageSize();
+    
+    const TPckg< TInt > pDataLength( dataLength );
+    //save dial data  
+    CmdSubSessionCloneDialDataL( aArgs );
+
+    PhoneSession().Write(
+    iPendingDialRequestPointer,
+    0,
+    pDataLength );   
+
+    // Indicate that the phone notifier should try and make the call.
+    if ( !iPendingDialRequestPointer.IsNull() )
+        {
+        iPendingDialRequestPointer.Complete( KErrNone );
+        }
+    iHavePendingDialRequestPointer = EFalse;
+    
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionNotifier::InitiatorIsReadyToMakeCall
+// 
+// Does this session have a pending request?
+// -----------------------------------------------------------------------------
+//
+TBool CPhSrvSubSessionNotifier::InitiatorIsReadyToMakeCall() const
+    {
+    return iHavePendingDialRequestPointer;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionNotifier::CmdSubSessionCloseL
+// 
+// Close the sub-session
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionNotifier::CmdSubSessionCloseL(
+    const RMessage2& aMessage )
+    {
+    PhoneSession().CloseSubSession( aMessage );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionNotifier::CmdSubSessionNotifyCallRequestL
+// 
+// Setup an asynchronous request to handle external interface
+// call requests.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionNotifier::CmdSubSessionNotifyCallRequestL(
+    const RMessage2& aMessage )
+    {
+    // Update our pending request pointer if it's not already set
+    if  ( iHavePendingDialRequestPointer )
+        {
+        PhoneSession().PanicClient(
+            aMessage,
+            EPhCltServerInitiatedPanicRequestAlreadyActive );
+        }
+    else
+        {
+        iPendingDialRequestPointer = aMessage;
+        iHavePendingDialRequestPointer = ETrue;
+
+        // The phone app engine is ready to process a call request. 
+        // Tell the negotiator that we're ready to process any pending 
+        // requests.
+        MPhSrvNegotiatorCall& callNegotiator = 
+            PhoneSession().PhoneServer().CallNegotiatorL();
+        callNegotiator.SetNegotiatorReadyCallL( *this );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionNotifier::CmdSubSessionNotifyCallRequestCancelL
+// 
+// Cancel an outstanding request to handle call initiations.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionNotifier::CmdSubSessionNotifyCallRequestCancelL(
+    const RMessage2& aMessage )
+    {
+    if  ( !iHavePendingDialRequestPointer )
+        {
+        PhoneSession().PanicClient(
+            aMessage,
+            EPhCltServerInitiatedPanicRequestNotActive );
+        }
+    else
+        {
+        if ( !iPendingDialRequestPointer.IsNull() )
+            {
+            iPendingDialRequestPointer.Complete( KErrCancel );
+            }
+        iHavePendingDialRequestPointer = EFalse;
+        }
+
+    aMessage.Complete( KErrNone );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionNotifier::CmdSubSessionReportCallResultL
+// 
+// Tell the external call interface client the result of 
+// dialing a call.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionNotifier::CmdSubSessionReportCallResultL(
+    const RMessage2& aMessage )
+    {
+    // Get result
+    const TPhCltPhoneResults result = 
+        static_cast< TPhCltPhoneResults >( aMessage.Int0() );
+
+    // Tell call negotiator of result
+    MPhSrvNegotiatorCall& callNegotiator = 
+        PhoneSession().PhoneServer().CallNegotiatorL();
+    callNegotiator.SetNegotiatorAttemptedCallResponseValue( result );
+
+    // Complete the request
+    aMessage.Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionNotifier::CmdSubSessionCloneDialData
+// 
+// Clones call arguments to object
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionNotifier::CmdSubSessionCloneDialDataL(
+ CPhCltExtPhoneDialData& aArgs )
+    {
+    iDialData = CPhCltExtPhoneDialData::NewL();
+    iDialData->SetTelephoneNumber( aArgs.TelephoneNumber() );
+    iDialData->SetCallType( aArgs.CallType() );
+    iDialData->SetNameL( aArgs.Name() );
+    iDialData->SetWindowGroup( aArgs.WindowGroup() );
+    iDialData->SetRedial( aArgs.Redial() );
+    iDialData->SetRedialMaximumDuration( aArgs.RedialMaximumDuration() );
+    iDialData->SetContactLinkL( aArgs.ContactLink() );
+    iDialData->SetSubAddressL( aArgs.SubAddress() );
+    iDialData->SetShowNumber( aArgs.ShowNumber() );
+    iDialData->SetAllowMatch( aArgs.AllowMatch() );
+    iDialData->SetSATCall( aArgs.SATCall() );
+    iDialData->SetEndOtherCalls( aArgs.EndOtherCalls() );
+    iDialData->SetBearerL( aArgs.Bearer() );
+    iDialData->SetSendKeyPressed( aArgs.SendKeyPressed() );
+    iDialData->SetInitiateCall( aArgs.InitiateCall() );
+    iDialData->SetServiceId( aArgs.ServiceId() );
+    iDialData->SetUUIL( aArgs.UUI() );
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionNotifier::CmdSubSessionDialDataL
+// 
+// Tell the external call interface client the result of 
+// dialing a call.
+// -----------------------------------------------------------------------------
+//  
+void CPhSrvSubSessionNotifier::CmdSubSessionDialDataL ( 
+    const RMessage2& aMessage )
+    {
+    HBufC8* package = NULL;
+    package = iDialData->PackLC();
+    if ( package )
+        {
+        PhoneSession().Write(
+        aMessage,
+        0,
+       *package );
+        aMessage.Complete( KErrNone );   
+        CleanupStack::PopAndDestroy( package );
+        }
+    delete iDialData;
+    iDialData = NULL;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionNotifier::InitiatorMakeAsynchronousCall
+// 
+// Called by the phone call negotiator when it wants this
+// object to initiate a call (on behalf of the external
+// interface).
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionNotifier::InitiatorMakeEmergencyCall( const RMessage2& aMessage )
+    {
+    
+    // Write to phone notifier's address space
+    PhoneSession().Read(
+        aMessage,
+        0,
+         iTelNumberPckg );
+    
+    PhoneSession().Write(
+        iPendingEmergencyRequestPointer,
+        0,
+        iTelNumberPckg );
+        
+    // Indicate that the phone notifier should try and make the call.
+    if ( !iPendingEmergencyRequestPointer.IsNull() )
+        {
+        iPendingEmergencyRequestPointer.Complete( KErrNone );
+        }
+    iHavePendingEmergencyRequestPointer = EFalse;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionNotifier::InitiatorIsReadyToMakeCall
+// 
+// Does this session have a pending request?
+// -----------------------------------------------------------------------------
+//
+TBool CPhSrvSubSessionNotifier::InitiatorIsReadyToMakeEmergencyCall() const
+    {
+    return iHavePendingEmergencyRequestPointer;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionNotifier::CmdSubSessionNotifyCallRequestL
+// 
+// Setup an asynchronous request to handle external interface
+// call requests.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionNotifier::CmdSubSessionNotifyEmergencyL(
+    const RMessage2& aMessage )
+    {
+    // Update our pending request pointer if it's not already set
+    if  ( iHavePendingEmergencyRequestPointer )
+        {
+        PhoneSession().PanicClient(
+            aMessage,
+            EPhCltServerInitiatedPanicRequestAlreadyActive );
+        }
+    else
+        {
+        iPendingEmergencyRequestPointer = aMessage;
+        iHavePendingEmergencyRequestPointer = ETrue;
+
+        // The phone app engine is ready to process a call request. 
+        // Tell the negotiator that we're ready to process any pending 
+        // requests.
+        MPhSrvEmergencyNegotiatorCall& emergencyNegotiator = 
+            PhoneSession().PhoneServer().EmergencyCallNegotiatorL();
+        emergencyNegotiator.SetNegotiatorReadyCall( *this );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionNotifier::CmdSubSessionNotifyCallRequestCancelL
+// 
+// Cancel an outstanding request to handle call initiations.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionNotifier::CmdSubSessionNotifyEmergencyCancel(
+    const RMessage2& aMessage )
+    {
+    if  ( !iHavePendingEmergencyRequestPointer )
+        {
+        PhoneSession().PanicClient(
+            aMessage,
+            EPhCltServerInitiatedPanicRequestNotActive );
+        }
+    else
+        {
+        if ( !iPendingEmergencyRequestPointer.IsNull() )
+            {
+            iPendingEmergencyRequestPointer.Complete( KErrCancel );
+            }
+        iHavePendingEmergencyRequestPointer = EFalse;
+        }
+
+    aMessage.Complete( KErrNone );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionNotifier::CmdSubSessionReportEmergencyCallResultL
+// 
+// Tell the external call interface client the result of 
+// dialing a call.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionNotifier::CmdSubSessionReportEmergencyCallResultL(
+    const RMessage2& aMessage )
+    {
+    // Get result
+    const TPhCltPhoneResults result = 
+        static_cast< TPhCltPhoneResults >( aMessage.Int0() );
+
+    // Tell call negotiator of result
+    MPhSrvEmergencyNegotiatorCall& emergencyNegotiator = 
+        PhoneSession().PhoneServer().EmergencyCallNegotiatorL();
+    emergencyNegotiator.SetNegotiatorAttemptedCallResponseValue( result );
+
+    // Complete the request
+    aMessage.Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionNotifier::InitiatorMakeAsynchronousComHandRequest
+// 
+// Called by the command handler negotiator when it wants this object to 
+// initiate a command handler request (on behalf of the external interface).
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionNotifier::
+    InitiatorMakeAsynchronousComHandRequest( 
+    const TPhCltComHandCommandParameters& aParams )
+    {
+    // Package up the data to send
+    TPckgC< TPhCltComHandCommandParameters > 
+        comHandDetails( aParams );
+
+    // Write to command handler notifier's address space
+    PhoneSession().Write( 
+        iPendingComHandRequestPointer,
+        0,
+        comHandDetails );
+
+    // Indicate that the command handler notifier should try to perform the 
+    // request.
+    if ( !iPendingComHandRequestPointer.IsNull() )
+        {
+        iPendingComHandRequestPointer.Complete( KErrNone );
+        }
+    iHavePendingComHandRequestPointer = EFalse;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionNotifier::InitiatorIsReadyToPerformRequest
+// 
+// Does this session have a pending request?
+// -----------------------------------------------------------------------------
+//
+TBool CPhSrvSubSessionNotifier::InitiatorIsReadyToPerformRequest() 
+    const
+    {
+    return iHavePendingComHandRequestPointer;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionNotifier::CmdSubSessionComHandNotifyRequestL
+// 
+// Handle command handler notifier's request.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionNotifier::CmdSubSessionComHandNotifyRequestL( 
+    const RMessage2& aMessage )
+    {
+    // Update our pending request pointer if it's not already set
+    if  ( iHavePendingComHandRequestPointer )
+        {
+        PhoneSession().PanicClient(
+            aMessage,
+            EPhCltServerInitiatedPanicRequestAlreadyActive );
+        }
+    else
+        {
+        iPendingComHandRequestPointer = aMessage;
+        iHavePendingComHandRequestPointer = ETrue;
+
+        // The phone app engine is ready to process a command handler request.
+        // Tell the negotiator that we're ready to process any pending 
+        // requests.
+        MPhSrvComHandNegotiator& comHandNegotiator = 
+            PhoneSession().PhoneServer().ComHandNegotiatorL();
+        comHandNegotiator.SetNegotiatorReadyRequestL( *this );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionNotifier::
+// CmdSubSessionComHandNotifyRequestCancelL
+// 
+// Handle command handler notifier's request cancel.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionNotifier::
+    CmdSubSessionComHandNotifyRequestCancelL( 
+        const RMessage2& aMessage )
+    {
+    if  ( iHavePendingComHandRequestPointer )
+        {
+        iPendingComHandRequestPointer.Complete( KErrCancel );
+        iHavePendingComHandRequestPointer = EFalse;
+        }
+
+    aMessage.Complete( KErrNone );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvSubSessionNotifier::CmdSubSessionComHandNotifyReportL
+// 
+// Tell the result of the request execution to the command handler client.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvSubSessionNotifier::CmdSubSessionComHandNotifyReportL( 
+    const RMessage2& aMessage )
+    {
+    // Get result
+    const TPhCltPhoneResults result = 
+        static_cast< TPhCltPhoneResults >( aMessage.Int0() );
+
+    // Tell command handler negotiator of result
+    MPhSrvComHandNegotiator& comHandNegotiator = 
+        PhoneSession().PhoneServer().ComHandNegotiatorL();
+    comHandNegotiator.SetNegotiatorAttemptedRequestResponseValue( result );
+
+    // Complete the request
+    aMessage.Complete( KErrNone );
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/ussd/cphsrvussdmanager.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,2189 @@
+/*
+* 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:  USSD Manager.
+*
+*/
+
+// INCLUDE FILES
+#include "cphsrvussdmanager.h" 
+#include "phsrvutils.h" 
+#include "cphsrvussdsendhandler.h" 
+#include "cphsrvussdreceivehandler.h" 
+#include "cphsrvussdnotifynwrelease.h" 
+#include "cphsrvresourcemanager.h" 
+#include "cphsrvussdreplytimer.h" 
+#include "mphsrvussdmessagesentobserver.h" 
+#include "mphsrvphoneinterface.h" 
+#include "cphsrvussdsessioncancelwaiter.h" 
+
+#include <apacmdln.h>
+#include <apgtask.h>
+#include <bautils.h>
+#include <textresolver.h>
+#include <charconv.h>
+#include <gsmuelem.h>
+#include <exterror.h>
+#include <rmmcustomapi.h>
+
+#include <w32std.h>
+#include <apgcli.h>
+#include <cphcltussd.h> 
+#include <hbtextresolversymbian.h>
+#include <phoneserver.rsg> 
+#include "phsrvdebuginfo.h" 
+#include <e32property.h>
+#include <centralrepository.h>
+#include <coreapplicationuisdomainpskeys.h>
+
+
+// CONSTANTS
+const TInt KPhSrvDefaultValue = 0x00000000;
+// See SharedDataKeysVariant.h or NcnListInternalPSKeys.h
+// const TInt KPhSrvUssdNoTone = 0; 
+// const TInt KPhSrvUssdTimeOutObserverGranularity = 2;
+// const TInt KPhSrvUssdSentMessageObserverGranularity = 2;
+// See KUssdSecureId in phcltclientserver.h
+//const TInt KPhSrvUssdAppUID = 0x10005955; 
+
+const TInt KPhSrvUssdMessageQueryInterval = 500000; // 0.5 sec
+//const TInt KPhSrvUssdNoteExitPeriod = 500000; // 0.5 sec
+//
+const TUint KPhSrvUssdDefaultDCS = 0x0f;                        // 00001111
+
+const TUint KPhSrvUssdDcsAlphabetDefaultPrecededLanguage = 0x10;// 00010000
+const TUint KPhSrvUssdDcsAlphabetDefaultPrecededLanguageSkipChars3 = 3;
+const TUint KPhSrvUssdDcsAlphabetDefaultPrecededLanguageSkipChars2 = 2;
+const TUint KPhSrvUssdDcsAlphabetDefaultPrecededLanguageStartBit = 5;
+
+const TUint KPhSrvUssdDcsAlphabetUCS2PrecededLanguage = 0x11;   // 00010001
+const TUint KPhSrvUssdDcsAlphabetUCS2PrecededLanguageSkipChars = 2;
+
+const TUint KPhSrvUssdDcsGeneralInformationMask = 0xc0;         // 11000000
+const TUint KPhSrvUssdDcsGeneralInformation = 0x40;             // 01xxxxxx
+const TUint KPhSrvUssdDcsGeneralInformationCompressed = 0x20;   // xx1xxxxx
+const TUint KPhSrvUssdDcsGeneralInformationSimMask = 0x13;      // 00010011
+const TUint KPhSrvUssdDcsGeneralInformationSim = 0x12;          // xxx1xx10
+const TUint KPhSrvUssdDcsGeneralInformationAlphabetMask = 0x0c; // 00001100
+const TUint KPhSrvUssdDcsGeneralInformationAlphabet8Bit = 0x04; // xxxx01xx
+const TUint KPhSrvUssdDcsGeneralInformationAlphabetUCS2 = 0x08; // xxxx10xx
+
+const TUint KPhSrvUssdDcsMessageHandlingAlphabetMask = 0xf4;    // 11110100
+const TUint KPhSrvUssdDcsMessageHandlingAlphabet8Bit = 0xf4;    // 1111x1xx
+const TInt KPhrUssdNotifyArraySize = 1;
+
+// Refers to HbPopup::NoDismiss = 0
+const TInt KPhSrvUssdPopupDismissPolicy = 0; 
+// The time out only for testing, from CPhSrvUssdReplyTimer.cpp
+const TUint KPhSrvUssdTimeout = 300000000;
+
+// Use QT style localization
+_LIT(KUssdLocFilename, "ussd_");
+_LIT(KCommonLocFilename, "common_");
+_LIT(KLocPath, "z:\\resource\\qt\\translations");
+_LIT(KUssdReply, "txt_ussd_button_reply"); // Reply
+_LIT(KUssdExit, "txt_ussd_button_exit"); // Exit
+_LIT(KUssdNext, "txt_ussd_button_next"); //Next
+_LIT(KUssdYes, "txt_common_button_yes"); // Yes
+_LIT(KUssdNo, "txt_common_button_no"); // No
+_LIT(KUssdTitle, "txt_ussd_title_message"); // Message
+_LIT(KUssdDone, "txt_ussd_dpopinfo_done"); // Done
+_LIT(KUssdConfirm, "txt_ussd_info_there_are_still_unread_notifications");
+
+// MACROS
+
+#define _DPRINT_FLAGS() \
+    _DDPRINT( 4, "PhSrv.FLAGS.MsgTypeReply ", iMsgTypeReply ); \
+    _DDPRINT( 4, "PhSrv.FLAGS.NwReleased   ", iNetworkReleased ); \
+    _DDPRINT( 4, "PhSrv.FLAGS.SendingAck   ", iSendingAck ); \
+    _DDPRINT( 4, "PhSrv.FLAGS.AcksToBeSent ", iAcksToBeSent ); \
+    _DDPRINT( 4, "PhSrv.FLAGS.iSendRelease ", iSendRelease ); \
+    _DDPRINT( 4, "PhSrv.FLAGS.iClearArray  ", iClearArray ); \
+    _DDPRINT( 4, "PhSrv.FLAGS.iLaunchGMQ   ", iLaunchGMQ ); \
+    _DDPRINT( 4, "PhSrv.FLAGS.NotifyCount  ", NotifyCount() ); \
+    _DDPRINT( 4, "PhSrv.FLAGS.iShowDone    ", iShowDone ); 
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// CLASS DECLARATION
+
+#ifndef TPHSRVUSSDALPHABETPACKER_H
+#define TPHSRVUSSDALPHABETPACKER_H
+
+// CONSTANTS
+const TUint8 KPhSrvUssdCarriageReturn = 0x0d;
+
+/**
+*  Packs and unpacks data encoded in an Ussd alphabet.
+*
+*  @since 1.0
+*/
+class TPhSrvUssdAlphabetPacker
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Constructor.
+        *
+        * @param aAlphabet The alphabet that is used.
+        * @param aIsBinary Is the data binary, that will be converted.
+        * @param aStartBit The start bit for conversion.
+        */
+        TPhSrvUssdAlphabetPacker(
+            TSmsDataCodingScheme::TSmsAlphabet aAlphabet,
+            TBool aIsBinary,
+            TInt aStartBit );
+
+
+    public: // New functions
+
+        /**
+        * Unpacks 7-bit buffer to 8-bit buffer.
+        *
+        * @param aIn Descriptor where the 7-bit buffer is.
+        * @param aOut 8-bit buffer to set the result.
+        * @param aNumUDUnits Buffer length.
+        * @return Length of the result buffer.
+        */
+        TInt UnpackL(
+            const TDesC8& aIn,
+            TDes8& aOut,
+            TInt aNumUDUnits );
+
+        /**
+        * Unpacks 7-bit buffer to 8-bit and converts to unicode.
+        *
+        * @param aCharacterSetConverter Does the converting.
+        * @param aFs File server session.
+        * @param aIn Packed 7-bit buffer.
+        * @param aOut Unicode buffer.
+        * @param aNumUDUnits Number of charahters.
+        * @return Number of used octets in 8-bit buffer.
+        */
+        TInt UnpackAndConvertL(
+            CCnvCharacterSetConverter& aCharacterSetConverter,
+            RFs& aFs,
+            const TDesC8& aIn,
+            TDes& aOut,
+            TInt aNumUDUnits );
+
+        /**
+        * Counts the needed octet amout.
+        *
+        * @param aNumUDUnits Number of source characters.
+        * @return Octets needed.
+        */
+        TInt PackedOctetsRequiredL( TInt aNumUDUnits ) const;
+
+
+    private:
+
+        // Private helper methods
+        TInt ElementSizeInBitsL() const;
+
+
+    private:    // Data
+
+        // The used coding alphabet.
+        TSmsDataCodingScheme::TSmsAlphabet iAlphabet;
+
+        // Is the packed data binary.
+        TBool iIsBinary;
+
+        // The start bit for packing.
+        TInt iStartBit;
+    };
+
+#endif // TPHSRVUSSDALPHABETPACKER_H
+
+
+// -----------------------------------------------------------------------------
+// TPhSrvUssdAlphabetPacker::TPhSrvUssdAlphabetPacker
+// Constructor.
+//
+// -----------------------------------------------------------------------------
+//
+TPhSrvUssdAlphabetPacker::TPhSrvUssdAlphabetPacker(
+    TSmsDataCodingScheme::TSmsAlphabet aAlphabet,
+    TBool aIsBinary,
+    TInt aStartBit)
+    : iAlphabet( aAlphabet ),iIsBinary( aIsBinary ),iStartBit( aStartBit )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhSrvUssdAlphabetPacker::UnpackL
+// Unpacks user data units from aIn and appends to aOut.
+//
+// -----------------------------------------------------------------------------
+//
+TInt TPhSrvUssdAlphabetPacker::UnpackL(
+    const TDesC8& aIn,
+    TDes8& aOut,
+    TInt aNumUDUnits )
+    {
+    TInt length = aNumUDUnits;
+    // Ensure we've got enough  output buffer
+    if ( aOut.Length() + length > aOut.MaxLength() )
+        {
+        User::Leave(KErrCorrupt);
+        }
+
+    TInt elementSizeInBits = ElementSizeInBitsL();
+    if ( elementSizeInBits == 8 ) // 8-bit data?
+        {
+        aOut.Append( aIn );
+        }
+    else if ( elementSizeInBits == 7 ) // need unpacking from 7-bit data
+        {
+        // Get raw pointers and do unpacking
+        TUint8* outPtr = ( TUint8* )aOut.Ptr() + aOut.Length();
+        const TUint8* inPtr = aIn.Ptr();
+
+        for ( TInt i = 0; i < length; i++ )
+            {
+            TInt from = ( *inPtr >> iStartBit ) & 0x7F; // Take seven bits
+            if ( iStartBit )
+                {
+                inPtr++;
+                // Take more from next byte
+                from |= ( *inPtr << ( 8 - iStartBit ) ) & 0x7F;
+                }
+            outPtr[i] = ( TUint8 ) from;
+            iStartBit = ( iStartBit + 7 ) % 8; // roll: 0,1,2,...,6,7,0,1,2...
+            }
+
+        // The last character will be ignored if message ends
+        // on an octet bounday with CR.
+        if ( outPtr[ length-1 ] == KPhSrvUssdCarriageReturn && iStartBit == 0 )
+            {
+            length--;
+            }
+        aOut.SetLength( aOut.Length() + length );
+        }
+    else
+        {
+        __ASSERT_DEBUG(EFalse,
+            PhoneServerUtils::Panic( EPhoneServerPanicModeLogicFault ) );
+        }
+    return length;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhSrvUssdAlphabetPacker::UnpackAndConvertL
+// Unpacks the converts the input data, aIn, and appends to aOut
+//
+// -----------------------------------------------------------------------------
+//
+TInt TPhSrvUssdAlphabetPacker::UnpackAndConvertL(
+    CCnvCharacterSetConverter& aCharacterSetConverter,
+    RFs& aFs,
+    const TDesC8& aIn,
+    TDes& aOut,
+    TInt aNumUDUnits )
+    {
+
+    // Unpack first
+    HBufC8* unpackedBuffer = HBufC8::NewLC( aNumUDUnits );
+    TPtr8 unpackedBufferPtr( unpackedBuffer->Des() );
+    UnpackL( aIn, unpackedBufferPtr,aNumUDUnits );
+
+    // Convert
+    CSmsAlphabetConverter* converter =
+        CSmsAlphabetConverter::NewLC(
+            aCharacterSetConverter, aFs, iAlphabet, iIsBinary );
+
+    TPtrC convertedPtr = converter->ConvertToNativeL( *unpackedBuffer );
+    if ( convertedPtr.Length() > ( aOut.MaxLength() - aOut.Length() ) )
+        {
+        User::Leave( KErrCorrupt );
+        }
+    // Cleanup and return
+    aOut.Append( convertedPtr );
+    CleanupStack::PopAndDestroy( 2 );    // unpackedBuffer, converter
+    return aNumUDUnits;
+    }
+
+
+// -----------------------------------------------------------------------------
+// TPhSrvUssdAlphabetPacker::PackedOctetsRequiredL
+// Returns the number of octets needed to pack the specified number of
+//
+// -----------------------------------------------------------------------------
+//
+TInt TPhSrvUssdAlphabetPacker::PackedOctetsRequiredL( TInt aNumUDUnits ) const
+
+    {
+    TInt octetsRequired = 0;
+    TInt elementSizeInBits = ElementSizeInBitsL();
+    if ( elementSizeInBits == 8 )
+        {
+        octetsRequired=aNumUDUnits;
+        }
+    else
+        {
+        octetsRequired =
+            ( iStartBit+aNumUDUnits * elementSizeInBits + 7 ) / 8;  // Rounds up
+        }
+    return octetsRequired;
+    }
+
+// -----------------------------------------------------------------------------
+// TPhSrvUssdAlphabetPacker::ElementSizeInBitsL
+// Returns the size in bits of a UDL element for the alphabet.  Leaves if
+// invalid data coding scheme.
+// -----------------------------------------------------------------------------
+//
+TInt TPhSrvUssdAlphabetPacker::ElementSizeInBitsL() const
+    {
+    if (iIsBinary)
+        return 8;
+    switch ( iAlphabet )
+        {
+        case TSmsDataCodingScheme::ESmsAlphabet7Bit:
+            {
+            return 7;
+            }
+        case TSmsDataCodingScheme::ESmsAlphabet8Bit:
+        case TSmsDataCodingScheme::ESmsAlphabetUCS2:
+            {
+            return 8;
+            }
+        default:
+            {
+            User::Leave(KErrGsmSMSDataCodingSchemeNotSupported);
+            return 8;
+            }
+        }
+    }
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::CPhSrvUssdManager
+//
+// Constructor
+//
+// -----------------------------------------------------------------------------
+//
+CPhSrvUssdManager::CPhSrvUssdManager(
+    RFs& aFsSession,
+    CPhSrvResourceManager& aResourceManager
+    )
+    :CActive( EPriorityLow ),
+     iFsSession( aFsSession ),
+     iResourceManager( aResourceManager ),
+     iDeviceDialog( NULL ),
+     iDCS ( KPhCltDcsUnknown ),
+     iReturnResultPckg ( iReturnResult ),
+     iTextBuffer ( NULL )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::~CPhSrvUssdManager
+//
+// Destructor
+//
+// -----------------------------------------------------------------------------
+//
+CPhSrvUssdManager::~CPhSrvUssdManager()
+    {
+    _DPRINT( 4, "PhSrv.~CPhSrvUssdManager.start" );
+
+
+    delete iUssdSendHandler;
+    iUssdSendHandler = NULL;
+
+    delete iUssdReceiveHandler;
+    iUssdReceiveHandler = NULL;
+
+    delete iUssdNotifyNWRelease;
+    iUssdNotifyNWRelease = NULL;
+
+    Cancel();
+
+    iTimer.Close();
+    
+    delete iTextBuffer;
+    iTextBuffer = NULL;
+    
+    delete iDeviceDialog;
+    iDeviceDialog = NULL;
+
+    if ( iNotifyArray )
+        {
+        iNotifyArray->Reset();
+        }
+    delete iNotifyArray;
+    if ( iUssdReplyTimer )
+        {
+        iUssdReplyTimer->Stop();
+        }
+    delete iUssdReplyTimer;
+    iUssdReplyTimer = NULL;
+
+    iFsSession.Close();
+
+    iMobileUssdMessaging.Close();
+    
+    delete iMoAckCallback;
+
+    _DPRINT( 4, "PhSrv.~CPhSrvUssdManager.end" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::ConstructL
+//
+// Symbian OS 2nd phase constructor
+//
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdManager::ConstructL( MPhSrvPhoneInterface& aPhoneInterface )
+    {
+    _DPRINT( 4, "PhSrv.ConstructL.Start" );
+    const TBool textResolver = HbTextResolverSymbian::Init( 
+        KUssdLocFilename, KLocPath );
+    _DDPRINT( 4, "PhSrv.ConstructL.ussd loc:", textResolver );
+    User::LeaveIfError( iTimer.CreateLocal() );
+
+    User::LeaveIfError( iMobileUssdMessaging.Open( aPhoneInterface.PhSrvMobilePhone() ) );
+
+    // Check support
+    RMobileUssdMessaging::TMobileUssdCapsV1 caps;
+    RMobileUssdMessaging::TMobileUssdCapsV1Pckg pckgCaps( caps );
+    User::LeaveIfError( iMobileUssdMessaging.GetCaps( pckgCaps ) );
+
+    if ( !( ( caps.iUssdTypes & RMobileUssdMessaging::KCapsMTUssd ) == 0 &&
+        ( caps.iUssdFormat & RMobileUssdMessaging::KCapsPackedString ) == 0 ) )
+        {
+        _DPRINT( 4, "PhSrv.CPhSrvUssdManager::ConstructL" );
+        iUssdReceiveHandler = new( ELeave ) CPhSrvUssdReceiveHandler(
+            *this,
+            iMobileUssdMessaging );
+        iUssdReceiveHandler->ConstructL();
+
+        iUssdNotifyNWRelease = new( ELeave )  CPhSrvUssdNotifyNWRelease(
+            *this,
+            iMobileUssdMessaging );
+
+        iUssdNotifyNWRelease->ConstructL();
+        }
+
+    iPhoneInterface = &aPhoneInterface;
+
+    SendHandlerL();
+    
+    iMoAckCallback = new (ELeave) CAsyncCallBack( TCallBack( MoAckCallback, this ), CActive::EPriorityIdle );
+
+    iVariantReadOnlyValues = KPhSrvDefaultValue;
+
+    User::LeaveIfError( GetTelephonyVariantData() );
+
+    _DDPRINT( 4, "PhSrv.ConstructL.iSatCanceled ", iSatCanceled );
+    _DDPRINT( 4, "PhSrv.ConstructL.iShowDone ", iShowDone );
+    iNotifyArray = new( ELeave ) CDesCArrayFlat( KPhrUssdNotifyArraySize );
+    _DPRINT( 4, "PhSrv.ConstructL.End" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::SendHandlerL
+//
+// The send handler.
+//
+// -----------------------------------------------------------------------------
+//
+CPhSrvUssdSendHandler& CPhSrvUssdManager::SendHandlerL()
+    {
+    // If SendHandler is not created, first check that MO Ussd
+    // is supported by the TSY.
+    _DPRINT( 4, "PhSrv.SendHandlerL.Start" );
+    if ( iUssdSendHandler == NULL )
+        {
+        _DPRINT( 4, "PhSrv.SendHandlerL.iUssdSendHandler.NULL" );
+        RMobileUssdMessaging::TMobileUssdCapsV1 caps;
+        RMobileUssdMessaging::TMobileUssdCapsV1Pckg pckgCaps( caps );
+        User::LeaveIfError( iMobileUssdMessaging.GetCaps( pckgCaps ) );
+        _DPRINT( 4, "PhSrv.SendHandlerL.iMobileUssdMessaging.GetCaps" );
+
+        if ( ( caps.iUssdTypes & RMobileUssdMessaging::KCapsMOUssd ) == 0 ||
+            ( caps.iUssdFormat & RMobileUssdMessaging::KCapsPackedString )
+            == 0 )
+            {
+            _DPRINT( 4, "PhSrv.SendHandlerL.KErrNotSupported" );
+            User::Leave( KErrNotSupported );
+            }
+
+        iUssdSendHandler =
+            new( ELeave ) CPhSrvUssdSendHandler(
+                *this,
+                iMobileUssdMessaging,
+                *iPhoneInterface );
+        }
+    _DPRINT( 4, "PhSrv.SendHandlerL.End" );
+    return *iUssdSendHandler;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::SendUssdL
+//
+// Send the USSD message.
+//
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdManager::SendUssdL(
+    const TDesC8& aMsgData,
+    RMobileUssdMessaging::TMobileUssdAttributesV1& aMsgAttribute,
+    MPhSrvUssdMessageSentObserver& aObserver )
+    {
+    _DPRINT( 4, "PhSrv.SendUssdL.Start ######" );
+    _DPRINT_FLAGS();
+    
+    if ( iObserver && iNetworkReleased ) 
+        {
+        // Network has been released but the previous send request is still alive.
+        // Cancel the pervious send operation, complete the old request with error
+        // and clean up the pointer.
+        _DPRINT( 4, "PhSrv.SendUssdL.Error.Complete.Existing" );
+        if ( iUssdSendHandler ) 
+            {
+            iUssdSendHandler->Cancel();
+            }
+        iObserver->UssdMessageSentObserverHandleResult( KErrSessionClosed );
+        iObserver = NULL;
+        }
+    
+    if ( iObserver || iSendingAck )
+        {
+        _DPRINT( 4, "PhSrv.SendUssdL.KErrInUse" );
+        // Other client is using the service.
+        User::Leave( KErrInUse );
+        }
+
+    // Check that message type is set
+    if( ( aMsgAttribute.iFlags & RMobileUssdMessaging::KUssdMessageType )
+        == 0 )
+        _DPRINT( 4, "PhSrv.SendUssdL.KUssdMessageType.0" );
+        {
+        // Mesasge type not set -> Set it.
+        aMsgAttribute.iFlags |= RMobileUssdMessaging::KUssdMessageType;
+        if ( NetworkWaitingForAnAnswer() )
+            {
+            // Network is waiting for an answer
+            _DPRINT( 4, "PhSrv.SendUssdL.EUssdMOReply" );   // debug print
+            aMsgAttribute.iType = RMobileUssdMessaging::EUssdMOReply;
+            }
+        else
+            {
+            _DPRINT( 4, "PhSrv.SendUssdL.EUssdMORequest" );  // debug print
+            aMsgAttribute.iType = RMobileUssdMessaging::EUssdMORequest;
+            }
+        }
+        
+    RMobileUssdMessaging::TMobileUssdAttributesV1Pckg attribs( aMsgAttribute );
+    iShowDone = ETrue;
+    _DPRINT( 4, "PhSrv.SendUssdL.iShowDone.ETrue" );
+    _DPRINT( 4, "PhSrv.SendUssdL.Send" );
+    SendHandlerL().SendUssdL( aMsgData , attribs );
+    iObserver = &aObserver;
+    // Not closing nor closed anymore
+    iNetworkReleased = EFalse;
+    iSendRelease = EFalse;
+    iClearArray = EFalse;
+    
+    // Reply timer can be killed here... Receive event might come right after this
+    // which will setup the timer again if needed.
+    if ( NetworkWaitingForAnAnswer() )
+        {
+        _DPRINT( 4, "PhSrv.SendUssdCancel.TimerStop" );   // debug print
+        iUssdReplyTimer->Stop();
+        }
+    _DPRINT( 4, "PhSrv.SendUssdL.End" );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::NetworkWaitingForAnAnswer
+// -----------------------------------------------------------------------------
+//
+TBool CPhSrvUssdManager::NetworkWaitingForAnAnswer() 
+    {
+    return iUssdReplyTimer && iUssdReplyTimer->IsTimerActive();
+    }
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::SendUssdCancel
+//
+// Cancel the USSD sending.
+//
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdManager::SendUssdCancel()
+    {
+    _DPRINT( 4, "PhSrv.SendUssdCancel.Start #######" );
+
+    // Ack sending should not be canceled unless it's about terminating
+    // the whole session
+    _DPRINT_FLAGS();
+    if ( !iSendingAck || iSendRelease ) 
+        {
+        _DPRINT( 4, "PhSrv.SendUssdCancel.DoingCancel" );
+        iUssdSendHandler->SendUssdCancel();
+        }
+
+    if ( iHavePendingSatMessagePointer )
+        {
+        _DPRINT( 4, "PhSrv.SendUssdCancel.SatCancel" );
+        iSatCanceled = ETrue;
+        }
+    iObserver = NULL;
+    
+    SetActiveIfPendingNotificationsExist();
+    _DPRINT( 4, "PhSrv.SendUssdCancel.End" );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::SetActiveIfPendingNotificationsExist
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdManager::SetActiveIfPendingNotificationsExist()
+    {
+    if ( !IsActive() && NotifyCount() > 0 )
+        {
+        _DPRINT( 4, "PhSrv.AcrtivateIf.NotActiveSelf" );
+        iLaunchGMQ = ETrue;
+        iNotifyMessage = ETrue;
+        _DPRINT( 4, "PhSrv.SendUssdCancel.iNotifyMessage.ETrue" );
+        iTimer.After( iStatus , KPhSrvUssdMessageQueryInterval );
+        SetActive();
+        _DPRINT_FLAGS();
+        _DDPRINT( 4, "PhSrv.AcrtivateIf.SetActive ", iStatus.Int() );
+        }
+    }
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::UssdNetworkObserverHandleSendEventL
+//
+//
+//
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdManager::UssdNetworkObserverHandleSendEventL( TInt aError )
+    {
+    // debug print
+    _DDPRINT(
+        4,
+        "PhSrv.UssdNetworkObserverHandleSendEventL.Start: ##### ",
+        aError );
+
+    // complete SAT if needed
+    if ( aError < KErrNone )
+        {
+ 
+        _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleSendEventL.CompleteSat" );
+        CompleteSatL( NULL, aError );
+        }
+
+    if ( iObserver )
+        {
+ 
+        _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleSendEventL.Observer" );
+
+        iObserver->UssdMessageSentObserverHandleResult( aError );
+        iObserver = NULL;
+        }
+    
+    iSendingAck = EFalse;
+    
+    AsyncProcessMoAcks();
+    
+    // debug print
+    _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleSendEventL.End" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::UssdAppTaskExists
+//
+//
+//
+// -----------------------------------------------------------------------------
+//
+TBool CPhSrvUssdManager::UssdAppTaskExistsL()
+{   
+    TBool ret = EFalse;
+    RWsSession wsSession;
+    User::LeaveIfError(wsSession.Connect());
+    _DPRINT( 4, "PhSrv.UssdAppTaskExists.wsSession.Connect" );
+    CleanupClosePushL(wsSession);
+    TApaTaskList tasklist(wsSession);
+    TApaTask task = tasklist.FindApp( KUssdSecureId );
+    ret = task.Exists();
+
+    CleanupStack::PopAndDestroy();
+    return ret;
+}
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::UssdNetworkObserverHandleReceivedEventL
+//
+//
+//
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdManager::UssdNetworkObserverHandleReceivedEventL(
+    const TDes8& aMsgData,
+    const RMobileUssdMessaging::TMobileUssdAttributesV1& aMsgAttributes,
+    TInt aError )
+    {
+    _DDPRINT(
+        4,
+        "PhSrv.UssdNetworkObserverHandleReceivedEventL.Start: ### ",
+        aError );
+    _DPRINT_FLAGS();
+    if ( aError != KErrNone )
+        {
+        TurnLightsOn(); //Ensure lights on
+ 
+        _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleReceivedEventL.ShErNote" );
+        ShowErrorNoteL( aError );
+        }
+    else if ( iSendRelease )
+        {
+        // Ignore if sendrelease is to be done. If the message was
+        _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleReceivedEventL.SendRelease.Ignore" );
+        }
+    else
+        {
+        UssdHandleReceivedEventL( aMsgData, aMsgAttributes );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::UssdHandleReceivedEventL
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdManager::UssdHandleReceivedEventL(
+    const TDes8& aMsgData,
+    const RMobileUssdMessaging::TMobileUssdAttributesV1& aMsgAttributes )
+    {
+    // This always is either ongoing transaction or starting a new based
+    // on incoming message, mark transaction to be open.
+    iNetworkReleased = EFalse;
+        
+    // 2. Complete Send with some positive value.
+    if ( iObserver )
+        {
+ 
+        _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.Observer" );
+        UssdNetworkObserverHandleSendEventL( 1 ); // some positive value
+        }
+    
+    if ( aMsgAttributes.iFlags&RMobileUssdMessaging::KUssdMessageType &&
+         aMsgAttributes.iType == RMobileUssdMessaging::EUssdMTRequest )
+        {
+        // 3. Stop old reply timer and start new one if needed.
+        RestartReplyTimerL();
+        _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleReceivedEventL.Timer.Stop" );
+        _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleReceivedEventL.Timer.New" );
+        }
+    _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.Decode" );
+    TUint8 dcs = KPhSrvUssdDefaultDCS;
+    if(aMsgAttributes.iFlags & RMobileUssdMessaging::KUssdMessageDcs)
+        {
+        dcs = aMsgAttributes.iDcs;
+        }
+    iDecodedMessage.Zero();
+    iReceivedMessage.Zero();
+    DecodeL(aMsgData, iDecodedMessage, dcs);
+    if(iDecodedMessage.Length() > 0)
+        {
+        iReceivedMessage = iDecodedMessage;
+        }
+    // 5. Show note.
+    // debug print
+    _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.Note" );
+    if ( !( aMsgAttributes.iFlags & RMobileUssdMessaging::KUssdMessageType ) ||
+            aMsgAttributes.iType != RMobileUssdMessaging::EUssdMTRequest )
+        {
+        if ( !ShowNotesL() )
+            {
+     
+            _DPRINT( 4,
+                "PhSrv.UssdHandleReceivedEventL.SAtReturn" );
+            return;
+            }
+        }
+
+    // empty string is handled as ok message
+    if ( !iDecodedMessage.Length() )
+        {
+        TurnLightsOn(); //Ensure lights on
+ 
+        _DPRINT( 4,
+            "PhSrv.UssdHandleReceivedEventL.EmptyString" );
+        
+        ShowDoneNoteL();
+
+ 
+        _DPRINT( 4,
+            "PhSrv.UssdHandleReceivedEventL.EmptyString.OK" );
+        }
+    else
+        {
+        _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.String" );
+        iNotifyMessage = ( aMsgAttributes.iType == RMobileUssdMessaging::EUssdMTNotify );
+        _DDPRINT( 4, "PhSrv.UssdHandleReceivedEventL.iNotifyMessage: ", iNotifyMessage );
+        _DDPRINT( 4, "PhSrv.UssdNOHREventL.iNotifyMessage: ", iNotifyMessage );
+        iMsgTypeReply = ( aMsgAttributes.iType == RMobileUssdMessaging::EUssdMTReply );
+        _DDPRINT( 4, "PhSrv.UssdHandleReceivedEventL.iMsgTypeReply: ", iMsgTypeReply );
+        
+        if ( iNotifyMessage ) 
+            {
+            // need to send an MO ack
+            iAcksToBeSent ++;
+            }
+        
+        if ( !iDeviceDialog  ){
+            iDeviceDialog = CHbDeviceMessageBoxSymbian::NewL(
+                CHbDeviceMessageBoxSymbian::EInformation );
+            iDeviceDialog->SetObserver( this );
+            iDeviceDialog->SetTimeout( KPhSrvUssdTimeout );
+            iDeviceDialog->SetDismissPolicy ( KPhSrvUssdPopupDismissPolicy );
+            
+            // Show left key with empty string accoring to ui concept
+            iDeviceDialog->SetButton( 
+                CHbDeviceMessageBoxSymbian::EAcceptButton, EFalse );
+            // Show Exit Key always
+            iDeviceDialog->SetButton( 
+                CHbDeviceMessageBoxSymbian::ERejectButton, ETrue );
+            iDeviceDialog->SetButtonTextL(
+                CHbDeviceMessageBoxSymbian::ERejectButton, 
+                LoadDefaultString( KUssdExit ) );
+            _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.Exit" );             
+        }
+      
+        if ( iNotifyMessage || iMsgTypeReply )
+            {
+            //This is for reply message in notifyarray
+            iNotifyMessage = ETrue;
+            _DDPRINT( 4, "PhSrv.UssdHandleReceivedEventL.iNotifyMessage: ", iNotifyMessage );
+
+            //Notify added to array
+            iNotifyArray->AppendL( iReceivedMessage );
+
+            _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.AppendL" );
+            UpdateNotifyMessageL();
+
+            if ( !iSendRelease && NotifyCount() <= 1 )
+                {
+                _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.!SendRelease.Cancel" );
+                Cancel();
+                }
+            }
+        else
+            {
+            // New message deletes old message, i.e. Cancel existing query.
+            Cancel();
+            _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.NewAnswerable" );
+            }
+
+        // Remove Reply key
+        if( !( aMsgAttributes.iFlags & RMobileUssdMessaging::KUssdMessageType )
+             || aMsgAttributes.iType != RMobileUssdMessaging::EUssdMTRequest )
+            {
+            // Remove Answer key
+            iDeviceDialog->SetButton( 
+                CHbDeviceMessageBoxSymbian::EAcceptButton, EFalse );
+            _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.NoAnswer" ); 
+            }
+        // Show Reply key
+        else
+            {
+            iDeviceDialog->SetButton( 
+                CHbDeviceMessageBoxSymbian::EAcceptButton, ETrue );              
+            iDeviceDialog->SetButtonTextL(
+                CHbDeviceMessageBoxSymbian::EAcceptButton, 
+                LoadDefaultString( KUssdReply ) ); 
+            _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.WithAnswer" ); 
+            }
+
+ 
+        _DPRINT( 4,
+            "PhSrv.UssdHandleReceivedEventL.String.Middle" );
+
+        // Play the USSD tone if needed. Logically should be in RunL, but here
+        // to give better balancing with voice and visible message.
+        // <-- QT PHONE START-->
+        /*
+        if ( IsTelephonyFeatureSupported( KTelephonyLVFlagUssdTone ) )
+            {
+            _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.PlayTone" );
+            PlayUssdTone();
+            }
+        */
+            // <-- QT PHONE END-->
+        // Launch the new message query
+        if ( !IsActive() )
+            {
+            iLaunchGMQ = ETrue;
+            iTimer.After( iStatus , KPhSrvUssdMessageQueryInterval );
+            SetActive();
+            }
+        AsyncProcessMoAcks();
+        }
+    _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.Editor" );
+    if( aMsgAttributes.iType == RMobileUssdMessaging::EUssdMTRequest && UssdAppTaskExistsL() )
+        {
+        iEmptyEditor = ETrue;
+        }
+    _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.End" );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::RestartReplyTimerL
+//
+//
+//
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdManager::RestartReplyTimerL()
+    {
+    if ( iUssdReplyTimer )
+        {
+        _DPRINT( 4, "PhSrv.RestartReplyTimerL.Stop" );
+        iUssdReplyTimer->Stop();
+        }
+
+    if ( !iUssdReplyTimer )
+        {
+        _DPRINT( 4, "PhSrv.RestartReplyTimerL.New" );
+        iUssdReplyTimer = CPhSrvUssdReplyTimer::NewL( *this );
+        }
+    
+    _DPRINT( 4, "PhSrv.RestartReplyTimerL.Start" );
+    iUssdReplyTimer->Start();
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::UssdNetworkObserverHandleNotifyNWReleaseL
+//
+//
+//
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdManager::UssdNetworkObserverHandleNotifyNWReleaseL(
+const RMobilePhone::TMobilePhoneSendSSRequestV3 & aReturnResult,
+TInt aError )
+    {
+    _DDPRINT( 4, "PhSrv.UssdNotifyNWRelease ##### ", aError ); // debug print
+    _DPRINT_FLAGS();
+    TBool showNotes = ShowNotesL();
+    iNetworkReleased = ETrue;
+    iSendingAck = EFalse;
+    iSendRelease = EFalse;
+    iAcksToBeSent = 0;
+    
+    if ( iHavePendingSatMessagePointer )
+        {
+        iReturnResult = aReturnResult;
+        if ( !iSatCanceled )
+            {
+            CompleteSatL(&iReceivedMessage, aError );
+            _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleNotifyNWReleaseL.CompleteSat" );
+            }
+        }
+    if ( iUssdReplyTimer && iUssdReplyTimer->IsTimerActive() )
+        {
+        _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleNotifyNWReleaseL.Timer.Stop" );
+        iUssdReplyTimer->Stop();
+        Cancel();
+        CheckArray();
+        }
+    if ( showNotes && iShowDone )
+        {
+        ShowDoneNoteL();
+        }
+    if ( iUssdSendHandler && iSendingAck ) 
+        {
+        // if we are sending ack, it can be canceled.
+        iUssdSendHandler->Cancel();
+        }
+    
+    iSatCanceled = EFalse;
+    _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleNotifyNWReleaseL.iSatCanceled.EFalse" );
+    iShowDone = EFalse;
+    _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleNotifyNWReleaseL.Ending" );
+    _DPRINT_FLAGS();
+    _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleNotifyNWReleaseL.End" );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::ShowDoneNoteL
+//
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdManager::ShowDoneNoteL()
+    {
+    _DDPRINT( 4, "PhSrv.ShowDoneNoteL.iShowDone", iShowDone );
+    // Show global confirmation note "Done"
+    CHbDeviceMessageBoxSymbian::InformationL(
+        LoadDefaultString( KUssdDone ) );
+    iShowDone = EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::ShowErrorNoteL
+//
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdManager::ShowErrorNoteL( TInt aError )
+    {
+    _DDPRINT( 4, "PhSrv.ShowErrorNoteL.Start ", aError );
+    if ( aError == KErrCancel )
+        {
+        _DPRINT( 4, "PhSrv.ShowErrorNoteL.Return" );
+        return;
+        }
+
+    // Show specific error message
+    CTextResolver* textResolver = CTextResolver::NewLC();
+    HBufC* buffer = textResolver->ResolveErrorString( aError ).AllocLC();
+
+    CHbDeviceMessageBoxSymbian::InformationL( buffer ->Des() );
+
+    CleanupStack::PopAndDestroy( buffer ); 
+    CleanupStack::PopAndDestroy( textResolver ); 
+    
+    
+    _DPRINT( 4, "PhSrv.ShowErrorNoteL.End" );
+    return;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::DecodeL
+//
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdManager::DecodeL(
+    const TDesC8& aSrc,
+    TDes& aDes ,
+    TUint8 aDcs )
+    {
+    _DPRINT( 4, "PhSrv.DecodeL.Start" );
+    aDes.Zero();
+    CCnvCharacterSetConverter* charConv = CCnvCharacterSetConverter::NewLC();
+
+    iDCS = KPhCltDcsUnknown; // default
+
+    // Check DCS
+    TSmsDataCodingScheme::TSmsAlphabet alphabet =
+        TSmsDataCodingScheme::ESmsAlphabet7Bit; // default
+    TUint cutChars = 0;
+    TUint startBit = 0;
+
+    // Codes from GSM 03.38
+    if ( aDcs == KPhSrvUssdDcsAlphabetDefaultPrecededLanguage )
+        {
+        FindFirstCarriageReturnL( aSrc , cutChars , startBit );
+        }
+    else if ( aDcs == KPhSrvUssdDcsAlphabetUCS2PrecededLanguage )
+        {
+        alphabet = TSmsDataCodingScheme::ESmsAlphabetUCS2;
+        cutChars = KPhSrvUssdDcsAlphabetUCS2PrecededLanguageSkipChars;
+        }
+    else if ( (aDcs&KPhSrvUssdDcsGeneralInformationMask)  ==
+            KPhSrvUssdDcsGeneralInformation ) // General data coding information
+        {
+        //Is text compressed?
+        if ( aDcs & KPhSrvUssdDcsGeneralInformationCompressed )
+            {
+            _DPRINT( 4, "PhSrv.DecodeL.KErrNotSupported" );
+            User::Leave( KErrNotSupported );
+            }
+        // Is SIM specific message
+        else if ( ( aDcs & KPhSrvUssdDcsGeneralInformationSimMask )
+                   == KPhSrvUssdDcsGeneralInformationSim )
+            {
+            _DPRINT( 4, "PhSrv.DecodeL.KErrAbort" );
+            User::Leave( KErrAbort ); // Do not show any messages
+            }
+        // 8 bit data?
+        else if ( ( aDcs&KPhSrvUssdDcsGeneralInformationAlphabetMask ) ==
+                   KPhSrvUssdDcsGeneralInformationAlphabet8Bit )
+            {
+            alphabet = TSmsDataCodingScheme::ESmsAlphabet8Bit;
+            }
+        // UCS2 bit data?
+        else if ( ( aDcs&KPhSrvUssdDcsGeneralInformationAlphabetMask ) ==
+                   KPhSrvUssdDcsGeneralInformationAlphabetUCS2 )
+            {
+            alphabet = TSmsDataCodingScheme::ESmsAlphabetUCS2;
+            }
+        }
+    // Data coding/message handling
+    else if ( ( aDcs & KPhSrvUssdDcsMessageHandlingAlphabetMask )
+               == KPhSrvUssdDcsMessageHandlingAlphabet8Bit )
+        {
+        alphabet = TSmsDataCodingScheme::ESmsAlphabet8Bit;
+        }
+
+    TPhSrvUssdAlphabetPacker* packer =
+        new ( ELeave ) TPhSrvUssdAlphabetPacker( alphabet , EFalse, startBit );
+    CleanupStack::PushL( packer );
+
+    if ( alphabet == TSmsDataCodingScheme::ESmsAlphabet7Bit )
+        {
+        TInt numberOfElem = ( ( aSrc.Length() - cutChars ) * 8 - startBit ) / 7;
+        packer->UnpackAndConvertL(
+            *charConv ,
+            iFsSession ,
+            aSrc.Right( aSrc.Length() - cutChars ),
+            aDes ,
+            numberOfElem );
+
+        // DCS was 7-bit data.
+        iDCS = KPhCltDcs7Bit;
+        }
+    else // ESmsAlphabet8Bit || ESmsAlphabetUCS2
+        {
+        CSmsAlphabetConverter* converter =
+            CSmsAlphabetConverter::NewLC(
+                *charConv , iFsSession,alphabet,EFalse );
+
+        aDes = converter->ConvertToNativeL(
+            aSrc.Right( aSrc.Length() - cutChars ) );
+        CleanupStack::PopAndDestroy( converter );
+
+        if( alphabet == TSmsDataCodingScheme::ESmsAlphabet8Bit )
+            {
+            // DCS was 8-bit data.
+            iDCS = KPhCltDcs8Bit;
+            }
+        else if( alphabet == TSmsDataCodingScheme::ESmsAlphabetUCS2 )
+            {
+            // DCS was UCS2 data.
+            iDCS = KPhCltDcsUcs2;
+            }
+        // If DCS not 8-bit or UCS2, then EPhCltDcsUnknown is returned.
+        }
+
+    //
+    CleanupStack::PopAndDestroy(2); // packer, charConv
+    _DPRINT( 4, "PhSrv.DecodeL.End" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::FindFirstCarriageReturnL
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdManager::FindFirstCarriageReturnL(
+    const TDesC8& aBuffer ,
+    TUint& aSkipChars ,
+    TUint& aStartBit )
+    {
+    _DPRINT( 4, "PhSrv.FindFirstCarriageReturnL.Start" );
+    if ( aBuffer.Length() < 3 )
+        {
+        _DPRINT( 4, "PhSrv.FindFirstCarriageReturnL.KErrUnderflow" );
+        User::Leave( KErrUnderflow );
+        }
+
+    aSkipChars = 0;
+    aStartBit = 0;
+
+    // Try out two different cases:
+    // 1. Find CR from thrid byte
+    // 2. Find CR from second byte, starting from bit 6
+
+    // 1.:
+    if ( aBuffer[2] == KPhSrvUssdCarriageReturn )
+        {
+        aSkipChars = KPhSrvUssdDcsAlphabetDefaultPrecededLanguageSkipChars3;
+        aStartBit = 0;
+        _DPRINT( 4, "PhSrv.FindFirstCarriageReturnL.ThirdByte.Return" );
+        return;
+        }
+
+    // 2.:
+    // First put the pieces together and then compare
+    // Take last 2 bits from the second byte:
+    TUint result1 = aBuffer[1];
+    result1 = result1 >> 6;
+
+    // Take first 5 bits from the third byte:
+    TUint result2 = aBuffer[2];
+    result2 = result2 & 0x1f; // bits 0-4.
+    result2 = result2 << 2; // move to bits 2-6.
+
+    TUint result = result1 + result2; // 0000 00xx + 0xxx xx00
+    if ( result == KPhSrvUssdCarriageReturn )
+        {
+        aSkipChars = KPhSrvUssdDcsAlphabetDefaultPrecededLanguageSkipChars2;
+        aStartBit = KPhSrvUssdDcsAlphabetDefaultPrecededLanguageStartBit;
+        _DPRINT( 4, "PhSrv.FindFirstCarriageReturnL.SecondByte.Return" );
+        return;
+        }
+
+    // Is was not case 1. or 2. so we are not supporting sort of string.
+    User::Leave( KErrNotSupported );
+    _DPRINT( 4, "PhSrv.FindFirstCarriageReturnL.KErrNotSupported" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::UssdReplyTimerObserverHandleExpired
+//
+//
+//
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdManager::UssdReplyTimerObserverHandleExpiredL( TInt aError )
+    {
+    _DDPRINT( 4, "PhSrv.ReplyTimer.Start.aError ", aError );     // debug print
+    delete iUssdReplyTimer;
+    iUssdReplyTimer = NULL;
+
+    if ( aError == KErrNone &&
+         IsActive() &&
+         iDeviceDialog ) 
+        {
+        Cancel();
+        // Terminates USSD session.
+        _DPRINT( 4, "PhSrv.ReplyTimer.SendRelease" );     // debug print
+        if ( iNotifyArray ) 
+            {
+            iNotifyArray->Reset();
+            }
+        TryCloseSession();
+        }
+    _DPRINT( 4, "PhSrv.ReplyTimer.End" );     // debug print
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::MessageBoxClosed
+// -----------------------------------------------------------------------------
+//       
+void CPhSrvUssdManager::MessageBoxClosed(
+    const CHbDeviceMessageBoxSymbian* aMessageBox,
+    CHbDeviceMessageBoxSymbian::TButtonId aButton)
+    {
+    _DPRINT( 4, "PhSrv.MsgClose.Start" );
+    // ussd device dialog observer callback function
+    TPtrC leftBtn = aMessageBox->ButtonText( 
+        CHbDeviceMessageBoxSymbian::EAcceptButton );
+    TPtrC rightBtn = aMessageBox->ButtonText( 
+        CHbDeviceMessageBoxSymbian::ERejectButton );    
+
+    TInt err = KErrNone;
+    // Click Yes on Confirmation note (Yes, No) 
+    if ( !leftBtn.Compare( 
+          LoadDefaultString( KUssdYes ) ) && 
+          ( CHbDeviceMessageBoxSymbian::EAcceptButton == aButton ) )
+        {
+        _DPRINT( 4, "PhSrv.MsgClose.SK.Yes" );
+        iClearArray = EFalse;
+        iNotifyArray->Reset();
+        TryCloseSession();
+        }
+    // Click "No" on Confirmation note (Yes, No) 
+    else if ( !rightBtn.Compare( 
+               LoadDefaultString( KUssdNo ) ) && 
+              ( CHbDeviceMessageBoxSymbian::ERejectButton == aButton ) )
+        {
+        _DPRINT( 4, "PhSrv.MsgClose.SK.No" );
+        iClearArray = EFalse;
+        iNotifyMessage = ETrue; // for removing the yes/no query
+        CheckArray();
+        TryCloseSession();
+        }
+    // Click "Next" on Notification note (Next, Exit) 
+    else if ( !leftBtn.Compare( 
+               LoadDefaultString( KUssdNext ) ) && 
+               ( CHbDeviceMessageBoxSymbian::EAcceptButton == aButton ) )
+        {
+        _DPRINT( 4, "PhSrv.MsgClose.SK.Next" ); 
+        CheckArray();
+        TryCloseSession();
+        }
+    // Click "Exit" on Notification note (Next, Exit or only Exit) 
+    else if ( !rightBtn.Compare( 
+               LoadDefaultString( KUssdExit ) ) && 
+               ( CHbDeviceMessageBoxSymbian::ERejectButton == aButton ) )
+        {
+        TRAP( err, ClearArrayL() );
+        _DDPRINT( 4, "PhSrv.MsgClose.SK.Clear.%d", err );
+        TryCloseSession();
+        _DPRINT( 4, "PhSrv.MsgClose.SK.Exit" ); 
+        }
+    // Click "Reply" on Message note (Reply, Exit) 
+    else if ( !leftBtn.Compare( 
+               LoadDefaultString( KUssdReply ) ) && 
+               ( CHbDeviceMessageBoxSymbian::EAcceptButton == aButton ) )
+        {
+        // Answer
+        iStartEditor = ETrue;
+        iShowDone = EFalse;
+        // Start the USSD editor now.
+        TRAP( err, RequestStartEditingL() );
+        _DDPRINT( 4, "PhSrv.MsgClose.RequestStartEditingL.%d", err );
+        }    
+    else 
+        {
+        _DPRINT( 4, "PhSrv.MsgClose.SK.Default" ); 
+        }
+  
+    _DPRINT( 4, "PhSrv.MsgClose.End" ); 
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::RunL
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdManager::RunL()
+    {
+    _DPRINT( 4, "PhSrv.RunL.Start" );    
+
+    ProcessMoAcksL();
+    
+    if ( iLaunchGMQ )
+        {
+        LaunchGlobalMessageQueryL();
+        // Do not launch Global Message Query next time.
+        iLaunchGMQ = EFalse;
+        _DPRINT( 4, "PhSrv.iLaunchGMQ.EFalse" );
+        }
+    else
+        {
+        iStartEditor = EFalse;
+        // update device dialog
+        _DPRINT( 4, "PhSrv.RunL.End" );     // debug print
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::LaunchGlobalMessageQueryL
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdManager::LaunchGlobalMessageQueryL()
+    {
+    _DPRINT( 4, "PhSrv.LGMQ.start" );
+    _DPRINT_FLAGS();
+
+    if ( iNotifyMessage )
+        {
+        _DDPRINT( 4, "PhSrv.LGMQ.NotifyMessage", iNotifyMessage );
+        iNotifyMessage = ETrue;
+        TInt count = NotifyCount();
+        //check softkey in avkon.rss 
+        if ( count > 1 )
+            {
+            // Next, Exit
+            iDeviceDialog->SetButton(
+                CHbDeviceMessageBoxSymbian::EAcceptButton, ETrue );            
+            iDeviceDialog->SetButtonTextL(
+                CHbDeviceMessageBoxSymbian::EAcceptButton, 
+                LoadDefaultString( KUssdNext ) );
+            iDeviceDialog->SetButton(
+                CHbDeviceMessageBoxSymbian::ERejectButton, ETrue );    
+            iDeviceDialog->SetButtonTextL(
+                CHbDeviceMessageBoxSymbian::ERejectButton, 
+                LoadDefaultString( KUssdExit ) );  
+            _DPRINT( 4, "PhSrv.LGMQ.Next&Exit" );
+            }
+        else
+            {
+            // Only Exit
+            iDeviceDialog->SetButton(
+                CHbDeviceMessageBoxSymbian::EAcceptButton, EFalse ); 
+            iDeviceDialog->SetButton(
+                CHbDeviceMessageBoxSymbian::ERejectButton, ETrue );               
+            iDeviceDialog->SetButtonTextL(
+                CHbDeviceMessageBoxSymbian::ERejectButton, 
+                LoadDefaultString( KUssdExit ) );   
+            _DPRINT( 4, "PhSrv.LGMQ.onlyExit" );
+            }
+        if ( iClearArray )
+            {
+            HbTextResolverSymbian::Init( KCommonLocFilename, KLocPath );
+            _DPRINT( 4, "PhSrv.LGMQ.use common loc file" );
+            // Yes, No
+            iDeviceDialog->SetButton(
+                CHbDeviceMessageBoxSymbian::EAcceptButton, ETrue );               
+            iDeviceDialog->SetButtonTextL(
+                CHbDeviceMessageBoxSymbian::EAcceptButton, 
+                LoadDefaultString( KUssdYes ) );
+            iDeviceDialog->SetButton(
+                CHbDeviceMessageBoxSymbian::ERejectButton, ETrue );              
+            iDeviceDialog->SetButtonTextL(
+                CHbDeviceMessageBoxSymbian::ERejectButton, 
+                LoadDefaultString( KUssdNo ) );  
+            _DPRINT( 4, "PhSrv.LGMQ.Yes&No" );
+            HbTextResolverSymbian::Init( KUssdLocFilename, KLocPath );
+            _DPRINT( 4, "PhSrv.LGMQ.back up to use ussd loc file" );
+            }
+        iReceivedMessage.Zero();
+        iReceivedMessage = (*iNotifyArray)[0];
+        }
+    TurnLightsOn(); //Ensure lights on
+
+    _DPRINT( 4, "PhSrv.LGMQ.ShMsgQuery" ); // debug print
+    // Launch Global MessageQuery as requested.
+    // Dialog not support header text, this code is only 
+    // for testing, not final solution.
+    TInt receiveLength = iReceivedMessage.Length();
+    _DDPRINT( 4, "PhSrv.LGMQ.ShMsgQuery.MsgLength", receiveLength ); 
+    
+    TInt titleLength = LoadDefaultString( KUssdTitle ).Length();
+    _DDPRINT( 4, "PhSrv.LGMQ.ShMsgQuery.TilteLength", titleLength );
+    
+    TInt length = receiveLength + titleLength;
+    _DDPRINT( 4, "PhSrv.LGMQ.ShMsgQuery.TotalLength", length );    
+        
+    HBufC* titleAndText = HBufC::NewLC( length );
+    titleAndText->Des().Append( LoadDefaultString( KUssdTitle ) );
+    titleAndText->Des().Append( iReceivedMessage );
+    iDeviceDialog->SetTextL( titleAndText->Des() );
+    CleanupStack::Pop( titleAndText );
+    
+    iDeviceDialog->Close();
+    iDeviceDialog->ShowL();
+    iShowDone = EFalse;
+   
+    // Do nothing else in RunL this time.
+    _DPRINT( 4, "PhSrv.LGMQ.ShMsgQuery.ret" ); // debug print
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::ProcessMoAcksL()
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdManager::ProcessMoAcksL()
+    {
+    //Acknowledgment is sent if notify message
+    if ( iNotifyMessage && iAcksToBeSent )
+        {
+        _DPRINT( 4, "PhSrv.LGMQ.SendMoAcknowledgementL, start" );
+        _DPRINT_FLAGS();
+        if ( iUssdSendHandler && !iUssdSendHandler->IsActive() &&
+             !iNetworkReleased && !iSendRelease && !iSendingAck )
+            {
+            _DPRINT( 4, "PhSrv.LGMQ.MoAckNeededToBeSent" );
+            SendMoAcknowledgementL();
+            iAcksToBeSent--;
+            iSendingAck = ETrue;
+            }
+        _DPRINT( 4, "PhSrv.LGMQ.SendMoAcknowledgementL, end" );
+        }
+    }
+ 
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::AsyncProcessMoAcks()
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdManager::AsyncProcessMoAcks()
+    {
+    if ( iMoAckCallback ) 
+        {
+        iMoAckCallback->CallBack();
+        _DPRINT( 4, "PhSrv.LGMQ.AsyncProcessMoAcksL, queued" );
+        }
+    }
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::MoAckCallback()
+// -----------------------------------------------------------------------------
+//
+TInt CPhSrvUssdManager::MoAckCallback( TAny *aUssdManager )
+    {
+    _DPRINT( 4, "PhSrv.MoAckCallback.start" );
+    if ( aUssdManager )
+        {
+        CPhSrvUssdManager* manager = static_cast<CPhSrvUssdManager*>( aUssdManager );
+        TRAP_IGNORE( manager->ProcessMoAcksL() );
+        }
+    _DPRINT( 4, "PhSrv.MoAckCallback.end" );
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::TryCloseSession()
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdManager::TryCloseSession() 
+    {
+    // Dismiss, cancel the session.
+    _DPRINT( 4, "PhSrv.CheckAndCloseSession.close" );  // debug print
+       
+    iShowDone = EFalse;
+    iEmptyEditor = EFalse;
+    
+    // If the notification array is empty, close the session.
+    if ( NotifyCount() == 0 && !iNetworkReleased )
+        {
+        CloseSession();
+        }
+    }
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::CloseSession()
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdManager::CloseSession()
+    {
+    iSendRelease = ETrue;
+    iClearArray = EFalse;
+    iAcksToBeSent = 0;
+    _DPRINT( 4, "PhSrv.CheckAndCloseSession.canceling" ); 
+    SendUssdCancel();
+    Cancel();
+        
+    // Terminates USSD session.
+    if ( !iNetworkReleased ) 
+        {
+        iUssdSendHandler->SendReleaseSession();
+        }
+    if ( iUssdReplyTimer )
+        {
+        _DPRINT( 4, "PhSrv.CheckAndCloseSession.Timer.Stop" );
+        iUssdReplyTimer->Stop();
+        }
+    }
+ 
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::CheckArray()
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdManager::CheckArray()
+    {
+    _DPRINT( 4, "PhSrv.CheckArray.Start" );     // debug print
+    if (iNotifyArray  && NotifyCount() > 0)
+        {
+        if  ( !iNotifyMessage && !iClearArray )
+            {
+            iLaunchGMQ = ETrue;
+            iNotifyMessage = ETrue;
+            _DPRINT( 4, "PhSrv.CheckArray.iNotifyMessage.ETrue" );
+            iTimer.After( iStatus , KPhSrvUssdMessageQueryInterval );
+            _DDPRINT( 4, "PhSrv.CheckArray.SetActive.NoNotifyMessage ", iStatus.Int() );
+            SetActive();
+            }
+        else if( NotifyCount() > 1 )
+            {
+            ( iNotifyArray )->Delete( 0 );
+            ( iNotifyArray )->Compress();
+            iLaunchGMQ = ETrue;
+            iNotifyMessage = ETrue;
+            _DPRINT( 4, "PhSrv.CheckArray.iNotifyMessage.ETrue" );
+            iTimer.After( iStatus , KPhSrvUssdMessageQueryInterval );
+            _DDPRINT( 4, "PhSrv.CheckArray.SetActive.NotifyCount>1 ", iStatus.Int() );
+            SetActive();
+            }
+        else
+            {
+            iNotifyArray->Reset();
+            iNotifyMessage = EFalse;
+            _DPRINT( 4, "PhSrv.CheckArray.iNotifyMessage.EFalse" );
+            }
+        }
+    _DPRINT_FLAGS();
+    _DPRINT( 4, "PhSrv.CheckArray.End" );     // debug print
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::ClearArray()
+// -----------------------------------------------------------------------------
+//
+  void CPhSrvUssdManager::ClearArrayL()
+    {
+    _DPRINT( 4, "PhSrv.ClearArrayL.Start" );     // debug print
+    if (iNotifyArray && NotifyCount() > 0)
+        {
+        if (iNotifyMessage && NotifyCount()== 1 )
+            {
+            iNotifyArray->Reset();
+            }
+        else
+            {
+            iReceivedMessage.Zero();
+            iReceivedMessage.Append( 
+                LoadDefaultString( KUssdConfirm ) );
+            iNotifyArray->InsertL( 0, iReceivedMessage );
+            iLaunchGMQ = ETrue;
+            iNotifyMessage = ETrue;
+            _DPRINT( 4, "PhSrv.ClearArrayL.iNotifyMessage.ETrue" );
+            iClearArray = ETrue;
+            iTimer.After( iStatus , KPhSrvUssdMessageQueryInterval );
+            _DDPRINT( 4, "PhSrv.ClearArrayL.iTimer ", iStatus.Int() );
+            SetActive();
+            }
+        }
+    _DPRINT_FLAGS();
+    _DPRINT( 4, "PhSrv.ClearArrayL.End" );     // debug print
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::NotifyCount()
+// -----------------------------------------------------------------------------
+//
+TInt CPhSrvUssdManager:: NotifyCount()
+{
+    TInt count = iNotifyArray->Count();
+    _DDPRINT( 4, "PhSrv.NotifyCount:", count );     // debug print
+    return count;
+}
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::UpdateNotifyMessageL()
+// -----------------------------------------------------------------------------
+//
+  void CPhSrvUssdManager:: UpdateNotifyMessageL()
+    {
+    _DDPRINT( 4, "PhSrv.UpdateNotifyMessageL.Start, clear: ", iClearArray );     // debug print
+
+    // Show left softkey - "Next"
+    if (NotifyCount() > 1 && !iClearArray )
+        {
+        _DPRINT( 4, "PhSrv.UpdateNotifyMessageL" );     // debug print
+        iDeviceDialog->SetButton( 
+            CHbDeviceMessageBoxSymbian::EAcceptButton, ETrue ); 
+        iDeviceDialog->SetButtonTextL(
+            CHbDeviceMessageBoxSymbian::EAcceptButton, 
+            LoadDefaultString( KUssdNext ) );
+        }
+    // Remove left softkey
+    else
+        {
+        iDeviceDialog->SetButton( 
+                    CHbDeviceMessageBoxSymbian::EAcceptButton, EFalse );         
+        }
+    iDeviceDialog->UpdateL();        
+    
+    _DPRINT( 4, "PhSrv.UpdateNotifyMessageL.End" );     // debug print
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdManager::DoCancel()
+    {
+    _DPRINT( 4, "PhSrv.DoCancel.Start" ); // debug print
+    iTimer.Cancel();
+    iLaunchGMQ = EFalse;
+    if ( iDeviceDialog )
+        {
+        _DPRINT( 4, "PhSrv.DoCancel" ); // debug print
+        iDeviceDialog->Close();
+        delete iDeviceDialog;
+        iDeviceDialog = NULL;
+        }
+    _DPRINT( 4, "PhSrv.DoCancel.End" ); // debug print
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::RunError
+//
+// Because the RunL can leave, this function exists.
+// In case of error, just returning KErrNone is OK.
+// -----------------------------------------------------------------------------
+//
+TInt CPhSrvUssdManager::RunError( TInt /*aError*/ )
+    {
+    _DPRINT( 4, "PhSrv.RunError.Start" );     // debug print
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::RequestStartEditingL
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdManager::RequestStartEditingL()
+    {
+    _DPRINT( 4, "PhSrv.UssdM.RequestStartEditingL.start" ); // debug print
+
+    RWsSession wsSession;
+    User::LeaveIfError( wsSession.Connect() );
+    _DPRINT( 4, "PhSrv.RequestStartEditingL.wsSession.connect" );     // debug print
+    CleanupClosePushL( wsSession );
+
+    // Find the task with name
+    TApaTaskList tasklist( wsSession );
+    TApaTask task = tasklist.FindApp( KUssdSecureId );
+
+    // If task exists, bring it to foreground
+    if ( task.Exists() )
+        {
+        _DPRINT( 4, "PhSrv.UssdM.RequestStartEditingL.task.BringToForeground" );
+        task.BringToForeground();
+        }
+    else
+        {
+        // Start new app
+        RApaLsSession apaLsSession;
+        User::LeaveIfError( apaLsSession.Connect() );
+        _DPRINT( 4, "PhSrv.RequestStartEditingL.apaLsSession.connect" );     // debug print
+        CleanupClosePushL( apaLsSession );
+
+        TApaAppInfo appInfo;
+        
+        TInt err = apaLsSession.GetAppInfo( appInfo, KUssdSecureId );
+        _DDPRINT( 4, "PhSrv.RequestStartEditingL.GetAppInfo ", err );     // debug print
+        
+        if ( err == KErrNone )
+            {
+        #ifndef SYMBIAN_SUPPORT_UI_FRAMEWORKS_V1
+            CApaCommandLine* apaCommandLine = CApaCommandLine::NewLC();
+            apaCommandLine->SetExecutableNameL( appInfo.iFullName );
+        #else // SYMBIAN_SUPPORT_UI_FRAMEWORKS_V1
+            CApaCommandLine* apaCommandLine =
+                CApaCommandLine::NewLC( appInfo.iFullName );
+        #endif // SYMBIAN_SUPPORT_UI_FRAMEWORKS_V1
+
+            TThreadId id( static_cast<TInt64>( 0 ) );
+            err = apaLsSession.StartApp( *apaCommandLine, id );
+            _DDPRINT( 4, "PhSrv.RequestStartEditingL.ThreadId ", id ); 
+            CleanupStack::PopAndDestroy( apaCommandLine );
+            }
+        CleanupStack::PopAndDestroy( &apaLsSession ); // apaLsSession
+        
+        // bring the ussd editor to foreground, only for testing
+        TApaTaskList tasklist( wsSession );
+        TApaTask task = tasklist.FindApp( KUssdSecureId );
+        if ( task.Exists() )
+            {
+            _DPRINT( 4, "PhSrv.UssdM.RequestStartEditingL.task.BringToForeground" );
+            task.BringToForeground();
+            }
+        // bring the ussd editor to foreground, only for testing
+        }
+    CleanupStack::PopAndDestroy(); // wsSession
+
+    _DPRINT( 4, "PhSrv.UssdM.RequestStartEditingL.end" ); // debug print
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::InformUssdApplicationStarting
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdManager::InformUssdApplicationStarting()
+    {
+    _DPRINT( 4, "PhSrv.UssdM.InfUssdAppStarting.start" ); // debug print
+    if ( iUssdReplyTimer )
+        {
+        _DPRINT( 4, "PhSrv.InformUssdApplicationStarting.iUssdReplyTimer" );
+        if ( iUssdReplyTimer->IsTimerActive() )
+            {
+            _DPRINT( 4, "PhSrv.InformUssdApplicationStarting.iUssdReplyTimer.active" );
+            iUssdReplyTimer->Pause();
+            }
+        }
+    _DPRINT( 4, "PhSrv.UssdM.InfUssdAppStarting.end" ); // debug print
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::InformUssdApplicationTerminatingL
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdManager::InformUssdApplicationTerminatingL(
+    const RMessage2& aMessage )
+    {
+    _DPRINT( 4, "PhSrv.UssdM.InfUssdAppTerminatingL.start" ); // debug print
+    if ( iUssdReplyTimer )
+        {
+        if ( iUssdReplyTimer->IsTimerActive() )
+            {
+     
+            _DPRINT( 4, "PhSrv.UssdM.InfUssdAppTerminatingL.timer" );
+
+            // Read the information what is the reason
+            // for application termination.
+            TPhCltUssdAppExitReason exitReason = EPhCltExitReasonUnknown;
+            TPckg< TPhCltUssdAppExitReason > exitReasonPckg( exitReason );
+            aMessage.ReadL(
+                0,
+                exitReasonPckg );
+
+     
+            _DPRINT( 4, "PhSrv.UssdM.InfUssdAppTerminatingL.timer2" );
+
+            // If reason was the completion of send operation, the USSD
+            // session is not canceled, otherwise it is canceled.
+            if ( exitReason != EPhCltSendCompleted )
+                {
+         
+                _DPRINT( 4, "PhSrv.UssdM.InfUssdAppTerminatingL.SendRelease" );
+                CloseSession();
+                }
+            }
+        }
+    _DPRINT( 4, "PhSrv.UssdM.InfUssdAppTerminatingL.end" ); // debug print
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::InformUssdApplicationToForeground
+// -----------------------------------------------------------------------------
+//
+TInt CPhSrvUssdManager::InformUssdApplicationToForeground()
+    {
+    _DPRINT( 4, "PhSrv.UssdM.InfUssdAppToForeground.start" ); // debug print
+
+    // Do the same actions as in InformUssdApplicationStarting,
+    // that is why it is called.
+    InformUssdApplicationStarting();
+
+    if ( iEmptyEditor )
+        {
+        _DPRINT( 4, "PhSrv.UssdM.InfUssdAppToForeground.empty" ); // debug print
+        iEmptyEditor = EFalse;
+        return 1; // some positive number
+        }
+    _DPRINT( 4, "PhSrv.UssdM.InfUssdAppToForeground.end" ); // debug print
+    return KErrNone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::InformUssdApplicationToBackground
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdManager::InformUssdApplicationToBackground()
+    {
+    _DPRINT( 4, "PhSrv.UssdM.InfUssdAppToBackground.start" ); // debug print
+    if ( iUssdReplyTimer )
+        {
+        _DPRINT( 4, "PhSrv.UssdM.InfUssdAppToBackground.timer" ); // debug print
+        if ( iUssdReplyTimer->IsTimerActive() )
+            {
+            _DPRINT( 4, "PhSrv.UssdM.InfUssdAppToBackground.timer.Active" ); // debug print
+            iUssdReplyTimer->Continue();
+            }
+        }
+    _DPRINT( 4, "PhSrv.UssdM.InfUssdAppToBackground.end" ); // debug print
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::InformStartSAT
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdManager::InformStartSAT( const RMessage2& aSatMessage )
+    {
+    _DPRINT( 4, "PhSrv.InformStartSAT.Start" );    // debug print
+
+    if ( iHavePendingSatMessagePointer )
+        {
+        _DPRINT( 4, "PhSrv.InformStartSAT.Complete.InUse" ); // debug print
+        aSatMessage.Complete( KErrInUse );
+        }
+    else
+        {
+        _DPRINT( 4, "PhSrv.InformStartSAT.Set" );    
+
+        // There was not pending SAT message
+        iHavePendingSatMessagePointer = ETrue;
+        _DDPRINT( 4, "PhSrv.UssdM.InformStartSAT.PendingSatPointer ", iHavePendingSatMessagePointer );
+        iPendingSatMessagePointer = aSatMessage;
+        }
+
+    _DPRINT( 4, "PhSrv.InformStartSAT.End" );   // debug print
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::InformStopSAT
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdManager::InformStopSAT()
+    {
+    _DPRINT( 4, "PhSrv.InformStopSAT.Start" );        
+
+    // Do the actions only if there is pending SAT message.
+    if ( iHavePendingSatMessagePointer )
+        {
+        _DPRINT( 4, "PhSrv.InformStopSAT.Complete.Cancel" ); // debug print
+        if ( !iPendingSatMessagePointer.IsNull() )
+            {
+            iPendingSatMessagePointer.Complete( KErrCancel );
+            _DPRINT( 4, "PhSrv.InformStopSAT.Complete.KErrCancel" );
+            }
+        iHavePendingSatMessagePointer = EFalse;
+        }
+    _DPRINT( 4, "PhSrv.InformStopSAT.End" );          
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::ShowNotes
+// -----------------------------------------------------------------------------
+//
+
+
+TBool CPhSrvUssdManager::ShowNotesL()
+{
+_DPRINT( 4, "PhSrv.ShowNotesL.Start" );
+
+if ( !iHavePendingSatMessagePointer )
+    {
+    if ( iSatCanceled )
+        {
+        _DPRINT( 4, "PhSrv.ShowNotesL, EFalse" );  // debug print
+        return EFalse;
+        }
+    else
+        {
+        _DPRINT( 4, "PhSrv.ShowNotesL, ETrue" );  // debug print
+        return ETrue;
+        }
+    }
+// Read the information whether the notes are shown or not.
+    TUint notesShown = 0;
+    TPckg< TUint > noShPckg( notesShown );
+    iPendingSatMessagePointer.ReadL(
+        0,
+        noShPckg );
+
+    TBool showNotes = EFalse;
+    _DPRINT( 4, "PhSrv.ShowNotes Sat= EFalse" );    // debug print
+    if ( notesShown == KPhCltShowNotes )
+        {
+        _DPRINT( 4, "PhSrv.ShowNotes Sat= ETrue" ); // debug print
+        showNotes = ETrue;
+        }
+    _DPRINT( 4, "PhSrv.ShowNotesL.End" );
+    return showNotes;
+}
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::CompleteSatL
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdManager::CompleteSatL(
+    TDesC* aReceiveString,
+    TInt aError )
+    {
+    _DPRINT( 4, "PhSrv.CompleteSatL.Start" );         
+    if ( aReceiveString )
+        {
+        if ( aReceiveString->Length() )
+            {
+            _DPRINT( 4, "PhSrv.CompleteSatL.recString.>0" ); // debug print
+            // copy the received string to client side.
+            if ( iPendingSatMessagePointer.Int1() < aReceiveString->Length() )
+                {
+         
+                _DPRINT( 4, "PhSrv.CompleteSatL.recString.LengthError" );
+                if ( !iPendingSatMessagePointer.IsNull() )
+                    {
+                    iPendingSatMessagePointer.Complete( KErrOverflow );
+                    _DPRINT( 4, "PhSrv.CompleteSatLComplete.KErrOverFlow" );
+                    }
+                iHavePendingSatMessagePointer = EFalse;
+                }
+            else
+                {
+            _DPRINT( 4, "PhSrv.CompleteSatL.recString.Write" );  // debug print
+            iPendingSatMessagePointer.WriteL(
+                2,
+                *aReceiveString );
+
+            _DPRINT( 4, "PhSrv.CompleteSatL.recString.Write2" ); // debug print
+            TPckg< TUint > dcsPackage( iDCS );
+            iPendingSatMessagePointer.WriteL(
+                0,
+                dcsPackage );
+            }
+        }
+        }
+    _DPRINT( 4, "PhSrv.CompleteSatL.Middle" );    
+    if ( !iPendingSatMessagePointer.IsNull() )
+        {
+        if ( aReceiveString && !iSatCanceled )
+            {
+            _DDPRINT( 4, "PhSrv.CompleteSatL.Complete.", iReturnResult.iOpCode  );   // debug print
+            iPendingSatMessagePointer.Complete( iReturnResult.iOpCode ); // Some positive value
+            }
+        else
+            {
+            _DPRINT( 4, "PhSrv.CompleteSatL.Complete.aError" ); // debug print
+            iPendingSatMessagePointer.Complete( aError );
+            }
+        }
+
+    iHavePendingSatMessagePointer = EFalse;
+
+    _DPRINT( 4, "PhSrv.CompleteSatL.End" );    
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::IsTelephonyFeatureSupported
+//
+// -----------------------------------------------------------------------------
+//
+TBool CPhSrvUssdManager::IsTelephonyFeatureSupported(
+    const TInt aFeatureId )
+    {
+    return ( aFeatureId & iVariantReadOnlyValues );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::PlayUssdTone
+//
+// -----------------------------------------------------------------------------
+//
+TInt CPhSrvUssdManager::PlayUssdTone()
+    {
+    _DPRINT( 4, "PhSrv.UssdM.PlayTone.start" );    
+
+    TInt err = KErrNone;
+// <-- QT PHONE  START-->
+//    RProperty::Define( KPSUidNcnList, KNcnPlayAlertTone, RProperty::EInt, ECapability_None , ECapabilityWriteDeviceData );
+//    RProperty::Set( KPSUidNcnList, KNcnPlayAlertTone, KPhSrvUssdTone );
+// <-- QT PHONE END-->
+
+    // debug print
+    _DDPRINT(
+        4,
+        "PhSrv.UssdM.PlayTone.end",
+        err );
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::GetTelephonyVariantData
+//
+// -----------------------------------------------------------------------------
+//
+TInt CPhSrvUssdManager::GetTelephonyVariantData()
+    {
+    _DPRINT( 4, "PhSrv.UssdM.GetTelephonyVariantData.Start" );
+    TInt err = KErrNone;
+// <-- QT PHONE START-->
+/*
+    // Variation data should be unchangable during run-time,
+    // therefore, if once succesfully read, later reads are
+    // not allowed.
+    if ( iVariantReadOnlyValues == KPhSrvDefaultValue )
+        {
+        CRepository* cenRepSession = NULL;
+        TRAP ( err ,
+               cenRepSession = CRepository::NewL( KCRUidTelVariation ) );
+        if ( err == KErrNone )
+            {
+            err = cenRepSession->Get( KTelVariationFlags,
+                                   iVariantReadOnlyValues );
+            }
+        delete cenRepSession;
+        }
+
+    _DDPRINT( 4, "PhSrv.UssdM.variant", iVariantReadOnlyValues ); // debug print
+    _DPRINT( 4, "PhSrv.UssdM.GetTelephonyVariantData.End" );
+    */
+// <-- QT PHONE END-->
+    return err;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::SendMoAcknowledgementL
+//
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdManager::SendMoAcknowledgementL()
+    {
+    _DPRINT( 4, "PhSrv.SendMoAckL.Start" );    
+
+    // Acknowledge MT USSD message.
+    RMobileUssdMessaging::TMobileUssdAttributesV1 msgAttribs;
+    msgAttribs.iFlags =
+        RMobileUssdMessaging::KUssdMessageType +
+        RMobileUssdMessaging::KUssdDataFormat  +
+        RMobileUssdMessaging::KUssdMessageDcs;
+
+    msgAttribs.iType   = RMobileUssdMessaging::EUssdMOAcknowledgement;
+    _DDPRINT( 4, "PhSrv.SendMoAckL.msgAttribs.iType ", msgAttribs.iType );
+    msgAttribs.iFormat = RMobileUssdMessaging::EFormatUnspecified;
+    _DDPRINT( 4, "PhSrv.SendMoAckL.msgAttribs.iFormat ", msgAttribs.iFormat );
+    msgAttribs.iDcs    = KPhSrvUssdDefaultDCS;
+
+    RMobileUssdMessaging::TMobileUssdAttributesV1Pckg attribs = msgAttribs;
+    SendHandlerL().SendUssdL( KNullDesC8() , attribs );
+
+    _DPRINT( 4, "PhSrv.SendMoAckL.End" );    
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::TurnLightsOn
+//
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdManager::TurnLightsOn()
+    {
+    _DPRINT( 4, "PhSrv.TurnLightsOn.Start" );    
+
+
+     // Change the bit on and off. SysAp will detect that
+     // the lights should be switched on for the specified time.
+     //
+     RProperty::Set(KPSUidCoreApplicationUIs, KLightsControl, ELightsOn);
+     TInt err = RProperty::Set(KPSUidCoreApplicationUIs, KLightsControl, ELightsOff);
+
+     if ( err != KErrNone )
+         {
+         _DDPRINT( 4,"PhSrv.TurnLightsOn.Error: ",err );// debug print
+         }
+
+    _DPRINT( 4, "PhSrv.TurnLightsOn.End" );    
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdManager::LoadDefaultString
+// -----------------------------------------------------------------------------
+//
+const TPtrC CPhSrvUssdManager::LoadDefaultString( const TDesC& aText )
+    {
+    _DPRINT( 4, "PhSrv.LoadDefaultString.Start" );
+    
+    if ( iTextBuffer )
+        {
+        delete iTextBuffer;
+        iTextBuffer = NULL;
+        _DPRINT( 4, "PhSrv.LoadDefaultString.Clear" );
+        }
+    TInt err = KErrNone;
+    TPtrC ptr( aText );
+    if ( ptr.Length() )
+        {
+        TRAP( err, iTextBuffer = HbTextResolverSymbian::LoadL( ptr ) );
+        _DDPRINT( 4, "PhSrv.LoadDefaultString.LoadL.%d", err );
+        if ( iTextBuffer )
+            {
+            ptr.Set( iTextBuffer->Des() );   
+            _DPRINT( 4, "PhSrv.LoadDefaultString.Set" );
+            }
+        }    
+    _DPRINT( 4, "PhSrv.LoadDefaultString.End" );
+    return ptr;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/ussd/cphsrvussdnotifynwrelease.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,158 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Ussd Handler Receive.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "cphsrvussdnotifynwrelease.h" 
+#include "mphsrvussdnetworkobserver.h" 
+#include "phsrvdebuginfo.h" 
+
+// CONSTANTS
+const TInt KPhSrvUssdReceiverPriority = CActive::EPriorityLow + 2;
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdNotifyNWRelease::CPhSrvUssdNotifyNWRelease
+// 
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+CPhSrvUssdNotifyNWRelease::CPhSrvUssdNotifyNWRelease(
+    MPhSrvUssdNetworkObserver& aObserver,
+    RMobileUssdMessaging& aUssdMessaging)
+    :    CActive(KPhSrvUssdReceiverPriority), 
+      
+         iObserver( aObserver ),
+         iUssdMessaging( aUssdMessaging ),
+         iReturnResultPckg ( iReturnResult )
+         
+    {
+    CActiveScheduler::Add( this );
+    
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdNotifyNWRelease::~CPhSrvUssdNotifyNWRelease
+// 
+// C++ Destructor
+// -----------------------------------------------------------------------------
+//
+CPhSrvUssdNotifyNWRelease::~CPhSrvUssdNotifyNWRelease()
+    {
+    Cancel();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdNotifyNWRelease::ConstructL
+// 
+// Symbian OS 2nd phase constructor
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdNotifyNWRelease::ConstructL()
+    {
+    // Start notify a client of a MT USSD release message to the mobile device
+    NotifyNetworkRelease();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdNotifyNWRelease::StartReceiving
+// 
+// Start receiving a message
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+TInt CPhSrvUssdNotifyNWRelease::NotifyNetworkRelease()
+    {
+    if ( IsActive() )
+        {
+        return KErrInUse;
+        } 
+    _DPRINT( 4, "PhSrv.NotifyNetworkRelease" );
+    iUssdMessaging.NotifyNetworkRelease( iStatus, iReturnResultPckg );
+    SetActive();
+    return KErrNone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdNotifyNWRelease::RunL
+// 
+// Called when a message is received
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdNotifyNWRelease::RunL()
+    {
+    TInt error = iStatus.Int();
+    if ( error == KErrCancel )
+        {
+        return;
+        }
+    _DPRINT( 4, "PhSrv.NotifyNetworkRelease:RunL" );
+    iObserver.UssdNetworkObserverHandleNotifyNWReleaseL( 
+        iReturnResult,
+        error ); 
+    NotifyNetworkRelease();      
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdNotifyNWRelease::DoCancel
+// 
+// Cancel a pending request
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+void CPhSrvUssdNotifyNWRelease::DoCancel()
+    {
+    iUssdMessaging.CancelAsyncRequest( EMobileUssdMessagingNotifyNetworkRelease );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdNotifyNWRelease::RunError
+// 
+// Called when RunL leaves
+// -----------------------------------------------------------------------------
+//
+TInt CPhSrvUssdNotifyNWRelease::RunError( TInt aError )
+    {
+    
+    TRAP_IGNORE( iObserver.UssdNetworkObserverHandleNotifyNWReleaseL( 
+         iReturnResult, aError ) );
+        
+    return KErrNone;
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/ussd/cphsrvussdreceivehandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,169 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Ussd Handler Receive.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "cphsrvussdreceivehandler.h" 
+#include "mphsrvussdnetworkobserver.h" 
+
+
+// CONSTANTS
+const TInt KPhSrvUssdReceiverPriority = CActive::EPriorityLow + 2;
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdReceiveHandler::CPhSrvUssdReceiveHandler
+// 
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+CPhSrvUssdReceiveHandler::CPhSrvUssdReceiveHandler(
+    MPhSrvUssdNetworkObserver& aObserver,
+    RMobileUssdMessaging& aUssdMessaging)
+    :    CActive(KPhSrvUssdReceiverPriority), 
+         iAutoReceive( ETrue ), // the value is hardcoded here.
+         iObserver( aObserver ),
+         iUssdMessaging( aUssdMessaging ),
+         iMsgAttributesPckg( iMsgAttributes )
+    {
+    CActiveScheduler::Add( this );
+    iMsgData.Zero();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdReceiveHandler::~CPhSrvUssdReceiveHandler
+// 
+// C++ Destructor
+// -----------------------------------------------------------------------------
+//
+CPhSrvUssdReceiveHandler::~CPhSrvUssdReceiveHandler()
+    {
+    Cancel();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdReceiveHandler::ConstructL
+// 
+// Symbian OS 2nd phase constructor
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdReceiveHandler::ConstructL()
+    {
+    // Start receiving automatically if wanted.
+    if ( iAutoReceive )
+        {
+        User::LeaveIfError( StartReceiving() );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdReceiveHandler::StartReceiving
+// 
+// Start receiving a message
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+TInt CPhSrvUssdReceiveHandler::StartReceiving()
+    {
+    if ( IsActive() )
+        {
+        return KErrInUse;
+        } 
+
+    iUssdMessaging.ReceiveMessage( iStatus, iMsgData , iMsgAttributesPckg );
+    SetActive();
+    return KErrNone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdReceiveHandler::RunL
+// 
+// Called when a message is received
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdReceiveHandler::RunL()
+    {
+    TInt error = iStatus.Int();
+    if ( error == KErrCancel )
+        {
+        return;
+        }
+    iObserver.UssdNetworkObserverHandleReceivedEventL( 
+        iMsgData, 
+        iMsgAttributes, 
+        error );
+    
+    if ( iAutoReceive && error != KErrCancel && error != KErrNotSupported )
+        {
+        StartReceiving();
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdReceiveHandler::DoCancel
+// 
+// Cancel a pending request
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+void CPhSrvUssdReceiveHandler::DoCancel()
+    {
+    iUssdMessaging.CancelAsyncRequest( EMobileUssdMessagingReceiveMessage );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdReceiveHandler::RunError
+// 
+// Called when RunL leaves
+// -----------------------------------------------------------------------------
+//
+TInt CPhSrvUssdReceiveHandler::RunError( TInt aError )
+    {
+    // Shows an error note.
+    TRAP_IGNORE(  iObserver.UssdNetworkObserverHandleReceivedEventL( 
+        iMsgData, iMsgAttributes , aError ) );
+    
+    if ( iAutoReceive )
+        {
+        StartReceiving();
+        }
+    
+    return KErrNone;
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/ussd/cphsrvussdreplytimer.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,196 @@
+/*
+* 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:  USSD Reply Timer.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "cphsrvussdreplytimer.h" 
+#include "mphsrvussdreplytimerobserver.h" 
+
+
+// CONSTANTS
+const TUint KPhSrvUssdReplyTimerInterval = 300000000; // 5 min
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdReplyTimer::CPhSrvUssdReplyTimer
+//
+// Constructor
+//
+// -----------------------------------------------------------------------------
+//
+CPhSrvUssdReplyTimer::CPhSrvUssdReplyTimer( 
+    MPhSrvUssdReplyTimerObserver& aObserver )
+:   CTimer( CActive::EPriorityStandard ), 
+    iObserver( aObserver )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdReplyTimer::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPhSrvUssdReplyTimer* CPhSrvUssdReplyTimer::NewL( 
+    MPhSrvUssdReplyTimerObserver& aObserver )
+    {
+    CPhSrvUssdReplyTimer* self = 
+        new( ELeave ) CPhSrvUssdReplyTimer( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(); // self
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdReplyTimer::~CPhSrvUssdReplyTimer
+//
+// Destructor
+//
+// -----------------------------------------------------------------------------
+//
+CPhSrvUssdReplyTimer::~CPhSrvUssdReplyTimer()
+    {
+    Cancel();
+    iTimer.Close();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdReplyTimer::ConstructL
+//
+// Symbian OS second phase constructor
+//
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdReplyTimer::ConstructL()
+    {
+    CTimer::ConstructL();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdReplyTimer::IsTimerActive
+// -----------------------------------------------------------------------------
+//
+TBool CPhSrvUssdReplyTimer::IsTimerActive() const
+    {
+    return iTimeLeft.Int() != 0;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdReplyTimer::Start
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdReplyTimer::Start()
+    {
+    Cancel();
+    iTimeLeft = KPhSrvUssdReplyTimerInterval;
+    iLastStartTime.UniversalTime();
+    After( iTimeLeft );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdReplyTimer::Pause
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdReplyTimer::Pause()
+    {
+    if ( !IsActive() )
+        {
+        return;
+        }
+    Cancel();
+    iTimeLeft = KPhSrvUssdReplyTimerInterval;           
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdReplyTimer::Continue
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdReplyTimer::Continue()
+    {
+    if ( IsActive() )
+        {
+        return;
+        }
+    
+    if ( iTimeLeft.Int() <= 0 )
+        {
+        iTimeLeft = 0;
+        TRAP_IGNORE(  iObserver.UssdReplyTimerObserverHandleExpiredL( KErrNone ) );
+        return;
+        }
+    
+    iLastStartTime.UniversalTime();
+    After( iTimeLeft );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdReplyTimer::Stop
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdReplyTimer::Stop()
+    {
+    Cancel();
+    iTimeLeft = 0;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdReplyTimer::RunL
+//
+// Called when the timer expires. Notify observer
+//
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdReplyTimer::RunL()
+    {
+    // Called only when status is KErrNone, since when the system
+    // time is changed, timers may be completed with KErrAbort.
+    iTimeLeft = 0;
+    if ( iStatus.Int() == KErrNone )
+        {
+        iObserver.UssdReplyTimerObserverHandleExpiredL( KErrNone );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdReplyTimer::RunError
+//
+// Called when RunL leaves. 
+// The RunL can leave in observer side, then it is ok to just return KErrNone.
+//
+// -----------------------------------------------------------------------------
+//
+TInt CPhSrvUssdReplyTimer::RunError( TInt /*aError*/ )
+    {
+    return KErrNone;
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneclientserver/phoneserver/src/ussd/cphsrvussdsendhandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,206 @@
+/*
+* 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:  Ussd Handler Send.
+*
+*/
+
+
+// INCLUDE FILES
+#include "cphsrvussdsendhandler.h" 
+#include "mphsrvussdnetworkobserver.h" 
+#include "mphsrvphoneinterface.h" 
+#include "cphsrvussdsessioncancelwaiter.h" 
+#include "phsrvdebuginfo.h" //debug prints 
+
+#include <gsmuelem.h>
+#include <f32file.h>
+#include <rmmcustomapi.h>
+
+//CONSTANTS
+const TInt KPhSrvUssdSenderPriority = CActive::EPriorityLow + 1;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdSendHandler::CPhSrvUssdSendHandler
+//
+// Constructor
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+CPhSrvUssdSendHandler::CPhSrvUssdSendHandler(
+    MPhSrvUssdNetworkObserver& aObserver,
+    RMobileUssdMessaging& aUssdMessaging,
+    MPhSrvPhoneInterface& aPhoneInterface )
+    :    CActive( KPhSrvUssdSenderPriority ),
+         iObserver( aObserver ),
+         iUssdMessaging( aUssdMessaging ),
+         iPhoneInterface( aPhoneInterface )
+    {
+    CActiveScheduler::Add( this );
+
+    // R&D SOLUTION ->
+    iSessionCancelWaiter = new CPhSrvUssdSessionCancelWaiter;
+    __ASSERT_ALWAYS( iSessionCancelWaiter, User::Invariant() );
+    // <-
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdSendHandler::~CPhSrvUssdSendHandler
+//
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CPhSrvUssdSendHandler::~CPhSrvUssdSendHandler()
+    {
+    _DPRINT( 4, "PhSrv.Sendhandler.Destructor.Start" );           // debug print
+    Cancel();
+
+    // R&D solution ->
+    if ( iSessionCancelWaiter )
+        {
+        if ( iSessionCancelWaiter->IsActive() )
+            {
+            _DPRINT( 4, "PhSrv.Sendhandler.Destructor.IsActive.SendRelease" );
+            iUssdMessaging.CancelAsyncRequest( EMobileUssdMessagingSendRelease );
+            }
+        delete iSessionCancelWaiter;
+        iSessionCancelWaiter = NULL;
+        }
+    // <-
+
+    delete iMsgData;
+    iMsgData = NULL;
+
+    delete iMsgAttribute;
+    iMsgAttribute = NULL;
+     _DPRINT( 4, "PhSrv.Sendhandler.Destructor.End" );           // debug print
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdSendHandler::SendUssdL
+//
+// Send the USSD data.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdSendHandler::SendUssdL(
+            const TDesC8& aMsgData,
+            const TDesC8& aMsgAttribute )
+    {
+    _DPRINT( 4, "PhSrv.Sendhandler.SendUssd.Start" );           // debug print
+    // R&D SOLUTION ->
+    
+    // If cancel is going on, don't try to send anything.
+    if ( IsActive() || iSessionCancelWaiter->IsActive() )
+        {
+        _DPRINT( 4, "PhSrv.Sendhandler.SendUssd.KErrInUse" );    // debug print
+        User::Leave( KErrInUse );
+        }
+    // <-
+
+    delete iMsgData;
+    iMsgData = NULL;
+    iMsgData = aMsgData.AllocL();
+
+    delete iMsgAttribute;
+    iMsgAttribute = NULL;
+    iMsgAttribute = aMsgAttribute.AllocL();
+    iUssdMessaging.SendMessage( iStatus , *iMsgData , *iMsgAttribute );
+    SetActive();
+    _DPRINT( 4, "PhSrv.Sendhandler.SendUssd.End" );           // debug print
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdSendHandler::SendUssdCancel
+//
+// Cancel USSD sending.
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+void CPhSrvUssdSendHandler::SendUssdCancel()
+    {
+    _DPRINT( 4, "PhSrv.Sendhandler.SendUssdCancel.Start" );         // debug print
+    Cancel();
+     _DPRINT( 4, "PhSrv.Sendhandler.SendUssdCancel.End" );           // debug print
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdSendHandler::DoCancel
+//
+// Cancel request.
+// -----------------------------------------------------------------------------
+//
+/*****************************************************
+*   Series 60 Customer / ETel
+*   Series 60  ETel API
+*****************************************************/
+void CPhSrvUssdSendHandler::DoCancel()
+    {
+    _DDPRINT( 4, "PhSrv.Sendhandler.DoCancel.Start", iStatus.Int() );           // debug print
+
+    iUssdMessaging.CancelAsyncRequest( EMobileUssdMessagingSendMessage );
+    delete iMsgData;
+    iMsgData = NULL;
+    delete iMsgAttribute;
+    iMsgAttribute = NULL;
+    _DDPRINT( 4, "PhSrv.Sendhandler.DoCancel.End", iStatus.Int() );           // debug print
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdSendHandler::RunL
+//
+// When iStatusRequest is changed.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdSendHandler::RunL()
+    {
+    _DDPRINT( 4, "PhSrv.SendHandler.RunL.Start", iStatus.Int() );
+    iObserver.UssdNetworkObserverHandleSendEventL( iStatus.Int() );
+    _DPRINT( 4, "PhSrv.Sendhandler.RunL.End" );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhSrvUssdSendHandler::SendReleaseSession
+//
+// Terminates Ussd session.
+// -----------------------------------------------------------------------------
+//
+void CPhSrvUssdSendHandler::SendReleaseSession()
+    {
+    _DPRINT( 4, "PhSrv.Sendhandler.SendReleaseSession.Start" );         // debug print
+    if ( !iSessionCancelWaiter->IsActive() )
+        {
+        _DPRINT( 4, "PhSrv.Sendhandler.SendReleaseSession" );           // debug print
+        iUssdMessaging.SendRelease(
+            iSessionCancelWaiter->iStatus,
+            iSessionCancelWaiter->iSSRequestPckg );
+        _DPRINT( 4, "PhSrv.Sendhandler.SendReleaseSession2" ); 
+        iSessionCancelWaiter->SetActive();
+        _DDPRINT( 4, "PhSrv.Sendhandler.SRS.iUssdMessaging", iStatus.Int() );
+        }
+    _DPRINT( 4, "PhSrv.Sendhandler.SendReleaseSession.End" );           // debug print
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonecmdhandler/phonecmdhnlr/bwins/phonecmdhandleru.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,5 @@
+EXPORTS
+	??1CPhoneHandler@@UAE@XZ @ 1 NONAME ; CPhoneHandler::~CPhoneHandler(void)
+	?NewL@CPhoneHandler@@SAPAV1@XZ @ 2 NONAME ; class CPhoneHandler * CPhoneHandler::NewL(void)
+	?NewL@CPhoneHandler@@SAPAV1@AAVCRemConInterfaceSelector@@@Z @ 3 NONAME ; class CPhoneHandler * CPhoneHandler::NewL(class CRemConInterfaceSelector &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonecmdhandler/phonecmdhnlr/group/phonecmdhandler.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* 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:  Project specification file for PhoneCmdHandler module.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET          phonecmdhandler.dll
+TARGETTYPE      DLL
+UID             0x1000008d 0x10205046
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+SOURCEPATH      ../src
+
+SOURCE      phonehandler.cpp 
+SOURCE      phonehandlercontrol.cpp 
+SOURCE      phonehandleractive.cpp 
+SOURCE      phonehandlercallbase.cpp 
+SOURCE      phonehandleranswercall.cpp 
+SOURCE      phonehandlerendcall.cpp 
+SOURCE      phonehandlerdialcall.cpp 
+SOURCE      phonehandlervoicedial.cpp 
+SOURCE      phonehandlerredial.cpp 
+SOURCE      phonehandlermultipartycall.cpp 
+SOURCE      phonehandlerdtmf.cpp 
+SOURCE      phonehandlerresponse.cpp 
+SOURCE      phonehandlercallstate.cpp 
+
+USERINCLUDE     ../inc 
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY     euser.lib
+LIBRARY     remconinterfacebase.lib
+LIBRARY     remconextensionapi.lib
+LIBRARY     phoneclient.lib
+LIBRARY     logcli.lib
+LIBRARY     efsrv.lib
+// <-- QT PHONE START -->
+//LIBRARY       pbkeng.lib
+// <-- QT PHONE END -->
+
+MACRO       API_TRACE_FLAG
+MACRO       COMPONENT_TRACE_FLAG
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonecmdhandler/phonecmdhnlr/inc/phonehandleractive.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,121 @@
+/*
+* 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:  Declaration of CPhoneHandlerActive class.
+*
+*/
+
+
+#ifndef CPHONEHANDLERACTIVE_H
+#define CPHONEHANDLERACTIVE_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class MPhoneHandlerObserver;
+
+// CLASS DECLARATION
+
+/**
+*  Active object used to call asynchronous requests.
+*
+*  @lib PhoneCmdHandler
+*  @since S60 3.1
+*/
+NONSHARABLE_CLASS( CPhoneHandlerActive ) : public CActive
+    {
+    public: // Constructors and destructor
+    
+        /**
+        * Two-phased constructor.
+        */
+        static CPhoneHandlerActive* NewL( MPhoneHandlerObserver& aObserver );
+    
+        /**
+        * Destructor.
+        */
+        ~CPhoneHandlerActive();
+    
+    public: // New functions
+    
+        /**
+        * From CActive. Indicates that the active object has issued a request 
+        * and that it is now outstanding.  
+        * @since S60 3.1
+        * @return 
+        */
+        void SetActive();
+        
+    public: // Functions from base classes
+        
+    protected:  // New functions
+    
+    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.
+        */
+        CPhoneHandlerActive( MPhoneHandlerObserver& aObserver );
+    
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+    
+    public:     // Data
+    
+    protected:  // Data
+    
+    private:    // Data
+        
+        // Notifies caller of an asynchronous request when request has been 
+        // completed.  
+        MPhoneHandlerObserver& iObserver;
+        
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+    };
+
+#endif // CPHONEHANDLERACTIVE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonecmdhandler/phonecmdhnlr/inc/phonehandleranswercall.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,135 @@
+/*
+* 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: Declaration of CPhoneHandlerAnswerCall class.
+*
+*/
+
+
+#ifndef CPHONEHANDLERANSWERCALL_H
+#define CPHONEHANDLERANSWERCALL_H
+
+//  INCLUDES
+#include "phonehandlercallbase.h" 
+#include <RemConExtensionApi.h> 
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CPhoneHandlerControl;
+
+// CLASS DECLARATION
+
+/**
+*  Handles answer call key press.
+*
+*  @lib PhoneCmdHandler
+*  @since S60 3.1
+*/
+NONSHARABLE_CLASS( CPhoneHandlerAnswerCall ) : public CPhoneHandlerCallBase
+                                               
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CPhoneHandlerAnswerCall* NewL( 
+                CPhoneHandlerControl& aControl,
+                TRemConExtCallHandlingApiOperationId aOperation
+                    = ERemConExtAnswerCall );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CPhoneHandlerAnswerCall();
+
+    public: // New functions
+    
+    public: // Functions from base classes
+
+        /**
+        * From MPhoneHandlerService. Starts processing service.
+        * @since S60 3.1
+        * @return void
+        */
+        void Process();
+        
+        /**
+        * From MPhoneHandlerService. Deletes service.
+        * @since S60 3.1
+        * @return void
+        */
+        void Delete();
+        
+        /**
+        * From MPhoneHandlerObserver. Notifies when asynchronous request has 
+        * been completed.
+        * @since S60 3.1
+        * @param aError request error code
+        * @return void
+        */
+        void RequestCompleted( const TInt aError );
+                
+    protected:  // New functions
+            
+    protected:  // Functions from base classes
+        
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CPhoneHandlerAnswerCall( 
+                CPhoneHandlerControl& aControl, 
+                TRemConExtCallHandlingApiOperationId aOperation );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+    
+    public:     // Data
+    
+    protected:  // Data
+    
+    private:    // Data
+            
+        // reference to control
+        CPhoneHandlerControl& iControl;
+        
+        // RemConExtensionApi command which initiates answer call in BT case 
+        // is either ERemConExtAnswerCall or ERemConExtAnswerEnd.
+        // RemConExtensionApi command which initiates end call in wired case 
+        // is ERemConExtAnswerEnd.
+        // iOperation is used to give response to exact RemConExtensionApi
+        // command.
+        TRemConExtCallHandlingApiOperationId iOperation;
+    
+    public:     // Friend classes
+   
+    protected:  // Friend classes
+   
+    private:    // Friend classes
+   
+    };
+
+#endif      // CPHONEHANDLERANSWERCALL_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonecmdhandler/phonecmdhnlr/inc/phonehandlercallbase.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,179 @@
+/*
+* 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: Declaration of CPhoneHandlerCallBase class.
+*
+*/
+
+
+#ifndef CPHONEHANDLERCALLBASE
+#define CPHONEHANDLERCALLBASE
+
+//  INCLUDES
+#include "phonehandlerservice.h" 
+#include "phonehandlerobserver.h" 
+#include <e32base.h>
+#include <rphcltserver.h> 
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+class CPhoneHandlerActive;
+class CPhCltCommandHandler;
+
+/**
+*  Base class for services.
+*
+*  @lib PhoneCmdHandler
+*  @since S60 3.1
+*/
+NONSHARABLE_CLASS( CPhoneHandlerCallBase ) : public CBase,
+                                             public MPhoneHandlerService, 
+                                             public MPhoneHandlerObserver
+    {
+    protected:  // Constructors and destructor
+        
+        /**
+        * C++ default constructor.
+        */
+        CPhoneHandlerCallBase();
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CPhoneHandlerCallBase();
+
+    public: // New functions
+    
+    public: // Functions from base classes
+    
+        /**
+        * From MPhoneHandlerService. Starts to process an asynchronous request.
+        * @since Series 60 3.1
+        * @param 
+        * @return 
+        */
+        virtual void Process() = 0;
+    
+        /**
+        * From MPhoneHandlerService. Deletes service object.
+        * @since Series 60 3.1
+        * @param 
+        * @return 
+        */
+        virtual void Delete() = 0;
+    
+        /**
+        * From MPhoneHandlerObserver. Notifies when asynchronous request has
+        * been completed.
+        * @since S60 3.1
+        * @param aError Result code of request processing.
+        * @return void
+        */
+        virtual void RequestCompleted( const TInt aError ) = 0;
+            
+    protected:  // New functions
+        
+        /**
+        * Initializes service that executes call handling key presses.
+        * @since S60 3.1
+        * @param void
+        * @return void
+        */
+        void LoadServiceL();
+        
+        /**
+        * Increments state parameter of service.
+        * @since S60 3.1
+        * @param void
+        * @return void
+        */
+        void NextState();
+        
+        /**
+        * Called when service isn't running (e.g. when it's completed).
+        * @since S60 3.1
+        * @param void
+        * @return void
+        */
+        void IdleState();
+        
+        /**
+        * Returns an active object's TRequestStatus for asynchronous calls.
+        * @since S60 3.1
+        * @param void
+        * @return void
+        */
+        TRequestStatus& GetStatus();
+        
+        /**
+        * Activates an active object for asynchronous calls.
+        * @since S60 3.1
+        * @param void
+        * @return void
+        */
+        void Activate();    
+        
+    protected:  // Functions from base classes
+    
+    private:
+
+    public:     // Data
+           
+    protected:  // Data
+       
+        // call handling service states 
+        enum TPhoneHandlerServiceState
+        {
+        EPhoneHandlerStateIdle      = 0,
+        EPhoneHandlerState1         = 1,           
+        EPhoneHandlerState2         = 2,
+        EPhoneHandlerState3         = 3
+        };
+        
+        // stores service state
+        TPhoneHandlerServiceState iState;
+        
+        // pointer to API providing call handling services
+        CPhCltCommandHandler* iCommandHandler; // owned
+
+    private:    // Data
+                        
+        // Provides a handle to a dynamically loadable DLL.
+        RLibrary iLibrary;
+         
+        // Client side remote class of phone server session 
+        RPhCltServer iServer; 
+        
+        // active object for asynchronous requests
+        CPhoneHandlerActive* iActive; // owned
+                
+    public:     // Friend classes
+        
+    protected:  // Friend classes
+        
+    private:    // Friend classes
+    
+    };
+
+#endif      // CPHONEHANDLERCALLBASE   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonecmdhandler/phonecmdhnlr/inc/phonehandlercallstate.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,117 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Declaration of CPhoneHandlerCallState class.
+*
+*
+*/
+
+
+#ifndef CPHONEHANDLERCALLSTATE_H
+#define CPHONEHANDLERCALLSTATE_H
+
+// INCLUDES
+#include <e32base.h>
+#include <e32property.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CPhoneHandlerControl;
+
+// CLASS DECLARATION
+
+/**
+*  Active object that listens to S60 call states.
+*
+*  @lib RemConAsy
+*  @since S60 3.1
+*/
+NONSHARABLE_CLASS( CPhoneHandlerCallState ) : public CActive
+    {
+    public: // Constructors and destructor
+    
+        /**
+        * Two-phased constructor.
+        */
+        static CPhoneHandlerCallState* NewL( CPhoneHandlerControl& aControl );
+    
+        /**
+        * Destructor.
+        */
+        ~CPhoneHandlerCallState();
+    
+    public: // New functions
+                
+    public: // Functions from base classes
+        
+    protected:  // New functions
+    
+    protected:  // Functions from base classes
+    
+        /**
+        * From CActive. Handles S60 start up state change event.
+        */
+        void RunL();
+    
+        /**
+        * From CActive. Implements cancellation of an outstanding Subscibe() 
+        * request.
+        */
+        void DoCancel();
+    
+    private:
+        
+        /**
+        * C++ default constructor.
+        */
+        CPhoneHandlerCallState( CPhoneHandlerControl& aControl );
+    
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+        
+        /**
+        * Starts to listen change in S60 start up state.
+        **/
+        void Subscribe();
+    
+    public:     // Data
+    
+    protected:  // Data
+    
+    private:    // Data
+    
+        // Publish and Subscribe handle used to listen changes in call states 
+        RProperty iProperty;
+                        
+        // reference to control
+        CPhoneHandlerControl& iControl;
+        
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+    };
+
+#endif // CPHONEHANDLERCALLSTATE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonecmdhandler/phonecmdhnlr/inc/phonehandlercontrol.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,277 @@
+/*
+* 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: Declaration of CPhoneHandlerControl class.
+*
+*/
+
+
+#ifndef CPHONEHANDLERCONTROL_H
+#define CPHONEHANDLERCONTROL_H
+
+//  INCLUDES
+#include "phonehandlerservice.h" 
+#include <RemConExtensionApi.h> 
+#include <RemConCallHandlingTargetObserver.h> 
+#include <e32base.h>
+#include <phclttypes.h> 
+#include <e32property.h> 
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+class CRemConInterfaceSelector;
+class CRemConCallHandlingTarget;
+class CPhoneHandlerResponse;
+class CPhoneHandlerCallState;
+
+/**
+* Receives call handling related key presses from accessories and executes 
+* them.
+*
+*  @lib PhoneCmdHandler
+*  @since S60 3.1
+*/
+NONSHARABLE_CLASS( CPhoneHandlerControl ) : public CBase,
+                                            public MRemConCallHandlingTargetObserver
+    {
+    public:  // Constructors and destructor
+    
+        /**
+        * Two-phased constructor.
+        */
+        static CPhoneHandlerControl* NewL( 
+            CRemConInterfaceSelector* aIfSelector = NULL );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CPhoneHandlerControl();
+
+    public: // New functions
+    
+        /**
+        * Returns phone number for dial or speed dial.
+        * @since S60 3.1
+        * @param void
+        * @return TPhCltTelephoneNumber phone number
+        */
+        const TPhCltTelephoneNumber& TelephoneNumber() const;
+        
+        /**
+        * Returns voice dial status for voice dial.
+        * @since S60 3.1
+        * @param void
+        * @return TBool status
+        */
+        const TBool& VoiceDialStatus() const;
+        
+        /**
+        * Returns CHLD command for multiparty call.
+        * @since S60 3.1
+        * @param void
+        * @return TInt CHLD command
+        */
+        const TInt& ChldCommand() const;
+        
+        /**
+        * Returns CHLD call number for multiparty call.
+        * @since S60 3.1
+        * @param void
+        * @return TInt CHLD command number
+        */
+        const TInt& ChldCallNumber() const;
+        
+        /**
+        * Returns DTMF tone to be sent.
+        * @since S60 3.1
+        * @param void
+        * @return TChar DTMF tone
+        */
+        const TChar& Tone() const;
+        
+        /**
+        * Returns reference to API used to communicate with accessory who 
+        * initiated key press.
+        * @since S60 3.1
+        * @param void
+        * @return CRemConCallHandlingTarget& reference to API
+        */  
+        CRemConCallHandlingTarget& CommandInitiator() const;
+        
+        /**
+        * Informs the latest call state.
+        * @since S60 3.1
+        * @param aState Call state from KTelephonyCallState P&S key
+        * @return void
+        */
+        void NotifyCallState( const TInt aState );
+
+        /**
+        * Get iSwitchCall flag, if this flag is ETrue, it means
+        * "Send" key in remote target is pressed in multiparty call,
+        * otherwise EFalse
+        * @since S60 3.1
+        * @return TBool
+        */
+        TBool SwitchCall();
+
+                    
+    public: // Functions from base classes
+                
+    protected:  // New functions
+        
+    protected:  // Functions from base classes
+    
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CPhoneHandlerControl();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL( CRemConInterfaceSelector* aIfSelector = NULL );
+                
+        /**
+        * From MRemConCallHandlingTargetObserver. Answer an incoming phone call.
+        */
+        virtual void AnswerCall();
+
+        /**
+        * From MRemConCallHandlingTargetObserver. End an incoming/ongoing 
+        * phone call.
+        */
+        virtual void EndCall();
+    
+        /**
+        * From MRemConCallHandlingTargetObserver. Answer an incoming phone call, 
+        * or end an ongoing call according to call status. 
+        */
+        virtual void AnswerEndCall();
+        
+        /**
+        * From MRemConCallHandlingTargetObserver. Make a voice call.
+        */
+        virtual void VoiceDial( const TBool aActivate );
+    
+        /**
+        * From MRemConCallHandlingTargetObserver. Redial last phone call.
+        */
+        virtual void LastNumberRedial();
+    
+        /**
+        * From MRemConCallHandlingTargetObserver. Dial a phone call.
+        */
+        virtual void DialCall( const TDesC8& aTelNumber );
+    
+        /**
+        * From MRemConCallHandlingTargetObserver. Make multiparty call.
+        */
+        virtual void MultipartyCalling( const TDesC8& aData );
+    
+        /**
+        * Generates DTMF signal.
+        */
+        virtual void GenerateDTMF( const TChar aChar );
+    
+        /**
+        * From MRemConCallHandlingTargetObserver. Make a speed dial call.
+        */
+        virtual void SpeedDial( const TInt aIndex );
+        
+        /**
+        * Starts processing service corresponding to key press.
+        */
+        void StartProcessing( 
+            const TRemConExtCallHandlingApiOperationId aOperation );
+        
+        /**
+        * Creates service.
+        */
+        MPhoneHandlerService* CreateServiceL( 
+            const TRemConExtCallHandlingApiOperationId aOperation );
+        
+        /**
+        * Returns call status.
+        */
+        void CallStatusL( RPhone::TLineInfo& aLineInfo );
+        
+                
+    private:    // Data
+        
+        // Provides e.g. service to listen accessory key presses.
+        CRemConInterfaceSelector* iInterfaceSelector;   // owned
+        
+        //  API notifying PhoneCmdHandler about call handling key presses.
+        CRemConCallHandlingTarget* iTarget; // owned
+                
+        // Phone number for dial call/speed dial.
+        TPhCltTelephoneNumber iTelNumber;
+        
+        // Voice recognition status
+        TBool iActivate;
+        
+        // Multiparty call command
+        TInt iChldCommand;
+        
+        // Multiparty call number
+        TInt iChldCallNumber;
+        
+        // Type of DTMF tone
+        TChar iChar;
+        
+        //  Speed dial index.
+        TInt iIndex;
+                
+        // Sends responses to RemCon FW
+        CPhoneHandlerResponse* iResponse;
+        
+        // Interface to P&S key that returns call state
+        RProperty iProperty;
+        
+        // Previous call state
+        TInt iPrevState;
+        
+        // Number of active calls
+        // Used to determine whether there's a multicall case when call state
+        TInt iActiveCalls;
+        
+        // switch phonecall by press "Send" key
+        TBool iSwitchCall;
+        
+        // Listens to phone call state changes.
+        CPhoneHandlerCallState* iCallStateObserver;
+        
+                    
+    public:     // Friend classes
+    
+    protected:  // Friend classes
+    
+    private:    // Friend classes
+    
+    };
+
+#endif      // CPHONEHANDLERCONTROL_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonecmdhandler/phonecmdhnlr/inc/phonehandlerdebug.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,258 @@
+/*
+* 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:  Macro definitions for tracing and debugging purposes.
+*
+*/
+
+
+#ifndef PHONECMDHANDLER_DEBUG_H
+#define PHONECMDHANDLER_DEBUG_H
+
+#ifdef _DEBUG
+
+// INCLUDES
+#include <e32svr.h>
+
+// CONSTANTS
+_LIT( KComponent, "[PHONECMDHANDLER]" );
+_LIT( KThisFile,  "[PHONECMDHANDLER] - Trace this file: %s, line: %d, compiled: %s %s" );
+_LIT( KAssertion, "[PHONECMDHANDLER] - Assertion failed: File: %s, line: %d, compiled: %s %s" );
+_LIT( KPanic,     "[PHONECMDHANDLER] - Panic occurred: File: %s, line: %d, compiled: %s %s" );
+_LIT( KMystic,    "[PHONECMDHANDLER] - Mystic failure: File: %s, line: %d, compiled: %s %s" );
+_LIT8( KDATE, __DATE__ );
+_LIT8( KTIME, __TIME__ );
+
+const TInt KTraceMaxSize = 256;
+
+// DATA TYPES
+enum TTraceType
+    {
+    ETraceInit,
+    ETraceAssert,
+    ETracePanic
+    };
+
+// INLINE FUNCTIONS
+
+    // -----------------------------------------------------------------------------
+    // ThisFileFunc
+    // -----------------------------------------------------------------------------
+    inline void ThisFileFunc( const TDesC8& aFile,
+                              TInt aLine,
+                              TTraceType aType = ETraceInit )
+        {
+        HBufC* fileBuf = HBufC::New( aFile.Length() + 1 );
+        HBufC* dateBuf = HBufC::New( 32 );
+        HBufC* timeBuf = HBufC::New( 32 );
+
+        if ( fileBuf != NULL && dateBuf != NULL && timeBuf != NULL )
+            {
+            fileBuf->Des().Copy( aFile );
+            timeBuf->Des().Copy( KTIME );
+            dateBuf->Des().Copy( KDATE );
+
+            if ( aType == ETraceInit )
+                {
+                RDebug::Print( KThisFile,
+                               fileBuf->Des().PtrZ(),
+                               aLine,
+                               dateBuf->Des().PtrZ(),
+                               timeBuf->Des().PtrZ() );
+                }
+
+            else if ( aType == ETraceAssert )
+                {
+                RDebug::Print( KAssertion,
+                               fileBuf->Des().PtrZ(),
+                               aLine,
+                               dateBuf->Des().PtrZ(),
+                               timeBuf->Des().PtrZ() );
+                }
+
+            else if ( aType == ETracePanic )
+                {
+                RDebug::Print( KPanic,
+                               fileBuf->Des().PtrZ(),
+                               aLine,
+                               dateBuf->Des().PtrZ(),
+                               timeBuf->Des().PtrZ() );
+                }
+
+            else
+                {
+                RDebug::Print( KMystic,
+                               fileBuf->Des().PtrZ(),
+                               aLine,
+                               dateBuf->Des().PtrZ(),
+                               timeBuf->Des().PtrZ() );
+                }
+            }
+
+        else
+            {
+            RDebug::Print( _L( "Assertion and memory allocation failed!" ) );
+            }
+
+        delete fileBuf;
+        delete dateBuf;
+        delete timeBuf;
+        }
+
+    // -----------------------------------------------------------------------------
+    // TraceAssertFunc
+    // -----------------------------------------------------------------------------
+    inline void TraceAssertFunc( const TDesC8& aFile, TInt aLine )
+        {
+        ThisFileFunc( aFile, aLine, ETraceAssert );
+        }
+
+    // -----------------------------------------------------------------------------
+    // TracePanicFunc
+    // -----------------------------------------------------------------------------
+    inline void TracePanicFunc( const TDesC8& aFile, TInt aLine )
+        {
+        ThisFileFunc( aFile, aLine, ETracePanic );
+        User::Panic( KComponent, KErrGeneral );
+        }
+
+// MACROS
+    #define PANIC_IF_FALSE( a ) if ( !( a ) )\
+            TracePanicFunc( TPtrC8( ( TText8* ) __FILE__), __LINE__ )
+
+    #define PANIC_IF_TRUE( a ) if ( ( a ) )\
+            TracePanicFunc( TPtrC8( ( TText8* ) __FILE__), __LINE__ )
+
+    #define PANIC_ALWAYS\
+            TracePanicFunc( TPtrC8( ( TText8* ) __FILE__), __LINE__ )
+
+    // -----------------------------------------------------------------------------
+    // COMPONENT_TRACE_FLAG
+    // -----------------------------------------------------------------------------
+    #ifdef COMPONENT_TRACE_FLAG
+
+        #define COMPONENT_TRACE_THIS_FILE\
+            ThisFileFunc( TPtrC8( ( TText8* ) __FILE__), __LINE__ )
+
+        #define COM_TRACE_( AAA ) do\
+            { _LIT( logStr, AAA ); RDebug::Print( logStr ); } while ( 0 )
+
+        #define COM_TRACE_1( AAA, BBB ) do\
+             { _LIT( logStr, AAA ); RDebug::Print( logStr, BBB ); } while ( 0 )
+
+        #define COM_TRACE_2( AAA, BBB, CCC ) do\
+             { _LIT( logStr, AAA ); RDebug::Print( logStr, BBB, CCC ); } while ( 0 )
+
+        #define COM_TRACE_3( AAA, BBB, CCC, DDD ) do\
+             { _LIT( logStr, AAA ); RDebug::Print( logStr, BBB, CCC, DDD ); } while ( 0 )
+
+        #define COM_TRACE_4( AAA, BBB, CCC, DDD, EEE ) do\
+             { _LIT( logStr, AAA ); RDebug::Print( logStr, BBB, CCC, DDD, EEE ); } while ( 0 )
+
+        #define COM_TRACE_RAW_( AAA ) do\
+            { RDebug::RawPrint( AAA ); } while ( 0 )
+            
+        #define COM_TRACE_RAW_1( AAA, BBB ) do\
+             { _LIT( logStr, AAA ); TBuf<KTraceMaxSize> buffer; buffer.Append( logStr ); buffer.Append( BBB );\
+             RDebug::RawPrint( buffer ); } while ( 0 )
+        
+    #else
+
+        #define COMPONENT_TRACE_THIS_FILE
+
+        #define COM_TRACE_( AAA )
+        #define COM_TRACE_1( AAA, BBB )
+        #define COM_TRACE_2( AAA, BBB, CCC )
+        #define COM_TRACE_3( AAA, BBB, CCC, DDD )
+        #define COM_TRACE_4( AAA, BBB, CCC, DDD, EEE )
+        #define COM_TRACE_RAW_( AAA )
+        #define COM_TRACE_RAW_1( AAA, BBB )
+
+    #endif // COMPONENT_TRACE_FLAG
+
+    #define TRACE_ASSERT( a ) if ( !( a ) )\
+            TraceAssertFunc( TPtrC8( ( TText8* ) __FILE__), __LINE__ )
+
+    #define TRACE_ASSERT_RETURN( a ) if ( !( ( a ) == KErrNone ) )\
+            TraceAssertFunc( TPtrC8( ( TText8* ) __FILE__), __LINE__ )
+
+    #define TRACE_ASSERT_ALWAYS\
+            TraceAssertFunc( TPtrC8( ( TText8* ) __FILE__ ), __LINE__ )
+
+    // -----------------------------------------------------------------------------
+    // API_TRACE_FLAG
+    // -----------------------------------------------------------------------------
+    #ifdef API_TRACE_FLAG
+
+        #define API_TRACE_( AAA ) do\
+            { _LIT( logStr, AAA ); RDebug::Print( logStr ); } while ( 0 )
+
+        #define API_TRACE_1( AAA, BBB ) do\
+             { _LIT( logStr, AAA ); RDebug::Print( logStr, BBB ); } while ( 0 )
+
+        #define API_TRACE_2( AAA, BBB, CCC ) do\
+             { _LIT( logStr, AAA ); RDebug::Print( logStr, BBB, CCC ); } while ( 0 )
+
+        #define API_TRACE_3( AAA, BBB, CCC, DDD ) do\
+             { _LIT( logStr, AAA ); RDebug::Print( logStr, BBB, CCC, DDD ); } while ( 0 )
+
+        #define API_TRACE_4( AAA, BBB, CCC, DDD, EEE ) do\
+             { _LIT( logStr, AAA ); RDebug::Print( logStr, BBB, CCC, DDD, EEE ); } while ( 0 )
+             
+        #define API_TRACE_RAW_1( AAA, BBB ) do\
+             { _LIT( logStr, AAA ); TBuf<KTraceMaxSize> buffer; buffer.Append( logStr ); buffer.Append( BBB );\
+             RDebug::RawPrint( buffer ); } while ( 0 )
+
+    #else
+
+        #define API_TRACE_( AAA )
+        #define API_TRACE_1( AAA, BBB )
+        #define API_TRACE_2( AAA, BBB, CCC )
+        #define API_TRACE_3( AAA, BBB, CCC, DDD )
+        #define API_TRACE_4( AAA, BBB, CCC, DDD, EEE )
+        #define API_TRACE_RAW_1( AAA, BBB )
+
+    #endif // API_TRACE_FLAG
+
+#else // _DEBUG
+
+    #define TRACE_ASSERT( a )
+    #define TRACE_ASSERT_RETURN( a ) a
+    #define TRACE_ASSERT_ALWAYS
+
+    #define COM_TRACE_( AAA )
+    #define COM_TRACE_1( AAA, BBB )
+    #define COM_TRACE_2( AAA, BBB, CCC )
+    #define COM_TRACE_3( AAA, BBB, CCC, DDD )
+    #define COM_TRACE_4( AAA, BBB, CCC, DDD, EEE )
+    #define COM_TRACE_RAW_( AAA )
+    #define COM_TRACE_RAW_1( AAA, BBB )
+
+    #define API_TRACE_( AAA )
+    #define API_TRACE_1( AAA, BBB )
+    #define API_TRACE_2( AAA, BBB, CCC )
+    #define API_TRACE_3( AAA, BBB, CCC, DDD )
+    #define API_TRACE_4( AAA, BBB, CCC, DDD, EEE )
+    #define API_TRACE_RAW_1( AAA, BBB )
+
+    #define COMPONENT_TRACE_THIS_FILE
+
+    #define PANIC_IF_FALSE( a )
+    #define PANIC_IF_TRUE( a )
+    #define PANIC_ALWAYS
+
+#endif // _DEBUG
+
+#endif // PHONECMDHANDLER_DEBUG_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonecmdhandler/phonecmdhnlr/inc/phonehandlerdialcall.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,134 @@
+/*
+* 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: Declaration of CPhoneHandlerDialCall class.
+*
+*/
+
+
+
+#ifndef CPHONEHANDLERDIALCALL_H
+#define CPHONEHANDLERDIALCALL_H
+
+//  INCLUDES
+#include "phonehandlercallbase.h" 
+#include <RemConExtensionApi.h> 
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CPhoneHandlerControl;
+
+// CLASS DECLARATION
+
+/**
+*  Handles dial and speed dial key presses. 
+*
+*  @lib PhoneCmdHandler
+*  @since S60 3.1
+*/
+NONSHARABLE_CLASS( CPhoneHandlerDialCall ) : public CPhoneHandlerCallBase
+                                             
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CPhoneHandlerDialCall* NewL(
+                CPhoneHandlerControl& aControl, 
+                TRemConExtCallHandlingApiOperationId aOperation
+                    = ERemConExtDialCall );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CPhoneHandlerDialCall();
+
+    public: // New functions
+    
+    public: // Functions from base classes
+
+         /**
+        * From MPhoneHandlerService. Starts processing service.
+        * @since S60 3.1
+        * @return void
+        */
+        void Process();
+        
+        /**
+        * From MPhoneHandlerService. Deletes service.
+        * @since S60 3.1
+        * @return void
+        */
+        void Delete();
+        
+        /**
+        * From MPhoneHandlerObserver. Notifies when asynchronous request has 
+        * been completed.
+        * @since S60 3.1
+        * @param aError request error code
+        * @return void
+        */
+        void RequestCompleted( const TInt aError );
+            
+    protected:  // New functions
+    
+    protected:  // Functions from base classes
+          
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CPhoneHandlerDialCall(      
+            CPhoneHandlerControl& aControl, 
+            TRemConExtCallHandlingApiOperationId aOperation );
+       
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+    
+    public:     // Data
+    
+    protected:  // Data
+    
+    private:    // Data
+        
+        // reference to control
+        CPhoneHandlerControl& iControl;
+        
+        // RemConExtensionApi commands which can initiate dial call are 
+        // ERemConExtDialCall and ERemConExtSpeedDial.
+        // iOperation is used to give response to exact RemConExtensionApi
+        // command.
+        TRemConExtCallHandlingApiOperationId iOperation;
+        
+    public:     // Friend classes
+    
+    protected:  // Friend classes
+    
+    private:    // Friend classes
+    
+    };
+
+#endif      // CPHONEHANDLERDIALCALL_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonecmdhandler/phonecmdhnlr/inc/phonehandlerdtmf.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,132 @@
+/*
+* 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: Declaration of CPhoneHandlerDTMF class.
+*
+*/
+
+
+
+#ifndef CPHONEHANDLERDTMF_H
+#define CPHONEHANDLERDTMF_H
+
+//  INCLUDES
+#include "phonehandlercallbase.h" 
+#include <RemConExtensionApi.h> 
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CPhoneHandlerControl;
+
+// CLASS DECLARATION
+
+/**
+*  Handles DTMF tone. 
+*
+*  @lib PhoneCmdHandler
+*  @since S60 3.1
+*/
+NONSHARABLE_CLASS( CPhoneHandlerDTMF ) : public CPhoneHandlerCallBase
+                                         
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CPhoneHandlerDTMF* NewL(  
+            CPhoneHandlerControl& aControl,
+            TRemConExtCallHandlingApiOperationId aOperation 
+                = ERemConExtGenerateDTMF
+            );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CPhoneHandlerDTMF();
+
+    public: // New functions
+    
+    public: // Functions from base classes
+
+        /**
+        * From MPhoneHandlerService. Starts processing service.
+        * @since S60 3.1
+        * @return void
+        */
+        void Process();
+        
+        /**
+        * From MPhoneHandlerService. Deletes service.
+        * @since S60 3.1
+        * @return void
+        */
+        void Delete();
+        
+        /**
+        * From MPhoneHandlerObserver. Notifies when asynchronous request has 
+        * been completed.
+        * @since S60 3.1
+        * @param aError request error code
+        * @return void
+        */
+        void RequestCompleted( const TInt aError );
+            
+    protected:  // New functions
+    
+    protected:  // Functions from base classes
+    
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CPhoneHandlerDTMF( CPhoneHandlerControl& aControl,
+                           TRemConExtCallHandlingApiOperationId aOperation );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    public:     // Data
+       
+    protected:  // Data
+       
+    private:    // Data
+            
+        // reference to control
+        CPhoneHandlerControl& iControl;
+        
+        // iOperation is used to give response to exact RemConExtensionApi
+        // command
+        TRemConExtCallHandlingApiOperationId iOperation;
+
+    public:     // Friend classes
+        
+    protected:  // Friend classes
+        
+    private:    // Friend classes
+    
+    };
+
+#endif      // CPHONEHANDLERDTMF_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonecmdhandler/phonecmdhnlr/inc/phonehandlerendcall.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,135 @@
+/*
+* 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: Declaration of CPhoneHandlerEndCall class.
+*
+*/
+
+
+#ifndef CPHONEHANDLERENDCALL_H
+#define CPHONEHANDLERENDCALL_H
+
+//  INCLUDES
+#include "phonehandlercallbase.h" 
+#include <RemConExtensionApi.h> 
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CPhoneHandlerControl;
+
+// CLASS DECLARATION
+
+/**
+*  Handles end call and reject call key presses.
+*
+*  @lib PhoneCmdHandler
+*  @since S60 3.1
+*/
+NONSHARABLE_CLASS( CPhoneHandlerEndCall ) : public CPhoneHandlerCallBase
+                                            
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CPhoneHandlerEndCall* NewL( 
+                        CPhoneHandlerControl& aControl,
+                        TRemConExtCallHandlingApiOperationId aOperation
+                            = ERemConExtEndCall );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CPhoneHandlerEndCall();
+
+    public: // New functions
+    
+    public: // Functions from base classes
+
+        /**
+        * From MPhoneHandlerService. Starts processing service.
+        * @since S60 3.1
+        * @return void
+        */
+        void Process();
+        
+        /**
+        * From MPhoneHandlerService. Deletes service.
+        * @since S60 3.1
+        * @return void
+        */
+        void Delete();
+        
+        /**
+        * From MPhoneHandlerObserver. Notifies when asynchronous request has 
+        * been completed.
+        * @since S60 3.1
+        * @param aError request error code
+        * @return void
+        */
+        void RequestCompleted( const TInt aError );
+            
+    protected:  // New functions
+    
+    protected:  // Functions from base classes
+        
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CPhoneHandlerEndCall( 
+                CPhoneHandlerControl& aControl, 
+                TRemConExtCallHandlingApiOperationId aOperation );
+        
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+        
+    public:     // Data
+          
+    protected:  // Data
+      
+    private:    // Data
+                
+        // reference to control
+        CPhoneHandlerControl& iControl;
+        
+        // RemConExtensionApi command which initiates end call in BT case 
+        // is either ERemConExtEndCall or ERemConExtAnswerEnd.
+        // RemConExtensionApi command which initiates end call in wired case 
+        // is ERemConExtAnswerEnd.
+        // iOperation is used to give response to exact RemConExtensionApi
+        // command.
+        TRemConExtCallHandlingApiOperationId iOperation;
+        
+    public:     // Friend classes
+    
+    protected:  // Friend classes
+    
+    private:    // Friend classes
+    
+    };
+
+#endif      // CPHONEHANDLERENDCALL_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonecmdhandler/phonecmdhnlr/inc/phonehandlermultipartycall.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,132 @@
+/*
+* 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: Declaration of CPhoneHandlerMultipartyCall class.
+*
+*/
+
+
+#ifndef CPHONEHANDLERMULTIPARTYCALL_H
+#define CPHONEHANDLERMULTIPARTYCALL_H
+
+//  INCLUDES
+#include "phonehandlercallbase.h" 
+#include <RemConExtensionApi.h> 
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CPhoneHandlerControl;
+
+// CLASS DECLARATION
+
+/**
+*  Handles multiparty call key press.
+*
+*  @lib PhoneCmdHandler
+*  @since S60 3.1
+*/
+NONSHARABLE_CLASS( CPhoneHandlerMultipartyCall ) : public CPhoneHandlerCallBase
+                                                   
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CPhoneHandlerMultipartyCall* NewL( 
+            CPhoneHandlerControl& aControl,
+            TRemConExtCallHandlingApiOperationId aOperation 
+                = ERemConExt3WaysCalling
+            );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CPhoneHandlerMultipartyCall();
+
+    public: // New functions
+    
+    public: // Functions from base classes
+
+        /**
+        * From MPhoneHandlerService. Starts processing service.
+        * @since S60 3.1
+        * @return void
+        */
+        void Process();
+        
+        /**
+        * From MPhoneHandlerService. Deletes service.
+        * @since S60 3.1
+        * @return void
+        */
+        void Delete();
+        
+        /**
+        * From MPhoneHandlerObserver. Notifies when asynchronous request has 
+        * been completed.
+        * @since S60 3.1
+        * @param aError request error code
+        * @return void
+        */
+        void RequestCompleted( const TInt aError );
+            
+    protected:  // New functions
+    
+    protected:  // Functions from base classes
+        
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CPhoneHandlerMultipartyCall( 
+                CPhoneHandlerControl& aControl,
+                TRemConExtCallHandlingApiOperationId aOperation );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    public:     // Data
+      
+    protected:  // Data
+      
+    private:    // Data
+            
+        // reference to control
+        CPhoneHandlerControl& iControl;
+        
+        // iOperation is used to give response to exact RemConExtensionApi
+        // command
+        TRemConExtCallHandlingApiOperationId iOperation;
+     
+    public:     // Friend classes
+    
+    protected:  // Friend classes
+    
+    private:    // Friend classes
+    
+    };
+
+#endif      // CPHONEHANDLERMULTIPARTYCALL_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonecmdhandler/phonecmdhnlr/inc/phonehandlerobserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,87 @@
+/*
+* 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: Declaration of MPhoneHandlerObserver interface.
+*
+*/
+
+
+#ifndef MPHONEHANDLEROBSERVER_H
+#define MPHONEHANDLEROBSERVER_H
+
+// INCLUDES
+#include <e32def.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+*  Interface used to notify PhoneCmdHandler objects about completed 
+*  asynchronous request. 
+*
+*  @lib PhoneCmdHandler
+*  @since S60 3.1
+*/
+class MPhoneHandlerObserver
+    {
+    public:  // Constructors and destructor
+        
+
+    public: // New functions
+        
+        /**
+        * Asynchronous request has been completed.
+        * @since S60 3.1
+        * @param aError Result code of request processing.
+        * @return void
+        */
+        virtual void RequestCompleted( const TInt aError ) = 0;
+    
+    public: // Functions from base classes
+
+        
+    protected:  // New functions
+        
+
+    protected:  // Functions from base classes
+        
+
+    private:
+
+
+    public:     // Data
+    
+    protected:  // Data
+
+    private:    // Data
+         
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+
+    };
+
+#endif  //MPHONEHANDLEROBSERVER_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonecmdhandler/phonecmdhnlr/inc/phonehandlerredial.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,145 @@
+/*
+* 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: Declaration of CPhoneHandlerLastNumberRedial class.
+*
+*/
+
+
+
+#ifndef CPHONEHANDLERLASTNUMBERREDIAL_H
+#define CPHONEHANDLERLASTNUMBERREDIAL_H
+
+//  INCLUDES
+#include "phonehandlercallbase.h" 
+#include <RemConExtensionApi.h> 
+#include <f32file.h>        
+#include <logcli.h>
+#include <logview.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+class CPhoneHandlerControl;
+
+/**
+*  Handles last number redial key press.
+*
+*  @lib PhoneCmdHandler
+*  @since S60 3.1
+*/
+NONSHARABLE_CLASS( CPhoneHandlerLastNumberRedial ) : public CPhoneHandlerCallBase
+                                                     
+    {
+    public: // Constructors and destructor         
+    
+        /**
+        * Two-phased constructor.
+        */
+        static CPhoneHandlerLastNumberRedial* 
+            NewL( CPhoneHandlerControl& aControl,
+                  TRemConExtCallHandlingApiOperationId aOperation 
+                    = ERemConExtLastNumberRedial );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CPhoneHandlerLastNumberRedial();
+        
+    public: // New functions
+    
+    public: // Functions from base classes
+    
+        /**
+        * From MPhoneHandlerService. Starts processing service.
+        * @since S60 3.1
+        * @return void
+        */
+        void Process();
+        
+        /**
+        * From MPhoneHandlerService. Deletes service.
+        * @since S60 3.1
+        * @return void
+        */
+        void Delete();
+        
+        /**
+        * From MPhoneHandlerObserver. Notifies when asynchronous request has 
+        * been completed.
+        * @since S60 3.1
+        * @param aError request error code
+        * @return void
+        */
+        void RequestCompleted( const TInt aError );
+    
+    protected:  // New functions
+    
+    protected:  // Functions from base classes
+
+    private:
+    
+        /**
+        * C++ default constructor.
+        */
+        CPhoneHandlerLastNumberRedial( 
+            CPhoneHandlerControl& aControl,
+            TRemConExtCallHandlingApiOperationId aOperation );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+    
+    public:     // Data
+    
+    protected:  // Data
+    
+    private:    // Data
+            
+        // A handle to a file server session.
+        RFs iFsSession;
+
+        // Log Engine implementation
+        CLogClient* iLogClientPtr; // owned
+
+        // A view on a recent event list.
+        CLogViewRecent* iLogViewRecentPtr; // owned
+                
+        // reference to control
+        CPhoneHandlerControl& iControl;
+        
+        // iOperation is used to give response to exact RemConExtensionApi
+        // command
+        TRemConExtCallHandlingApiOperationId iOperation;
+        
+    public:     // Friend classes
+    
+    protected:  // Friend classes
+    
+    private:    // Friend classes
+         
+    };
+
+
+#endif  // CPHONEHANDLERLASTNUMBERREDIAL_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonecmdhandler/phonecmdhnlr/inc/phonehandlerresponse.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,147 @@
+/*
+* 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: Declaration of CPhoneHandlerResponse class.
+*
+*/
+
+
+#ifndef CPHONEHANDLERRESPONSE_H
+#define CPHONEHANDLERRESPONSE_H
+
+//  INCLUDES
+#include "phonehandlerservice.h" 
+#include "phonehandlerobserver.h" 
+#include <RemConExtensionApi.h> 
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CPhoneHandlerControl;
+class CPhoneHandlerActive;
+
+// CLASS DECLARATION
+
+/**
+*  Handles answer call key press.
+*
+*  @lib PhoneCmdHandler
+*  @since S60 3.1
+*/
+NONSHARABLE_CLASS( CPhoneHandlerResponse ) : public CBase,
+                                             public MPhoneHandlerService,
+                                             public MPhoneHandlerObserver
+                                               
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CPhoneHandlerResponse* NewL( CPhoneHandlerControl& aControl );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CPhoneHandlerResponse();
+
+    public: // New functions
+    
+        /**
+        * Sets response message. This method has to be called before Process() 
+        * is called.
+        * @since S60 3.1
+        * @param aOperation operation to which response is sent
+        * @param aError Symbian OS error code
+        * @return void
+        */
+        void SetResponse( TRemConExtCallHandlingApiOperationId aOperation, 
+                          TInt aError );
+                
+    public: // Functions from base classes
+        
+        /**
+        * From MPhoneHandlerService. Sends response to RemCon FW.
+        * @since S60 3.1
+        * @return void
+        */
+        void Process();
+        
+        /**
+        * From MPhoneHandlerService. Deletes service.
+        * @since S60 3.1
+        * @return void
+        */
+        void Delete();
+        
+        /**
+        * From MPhoneHandlerObserver. Notifies when asynchronous request has 
+        * been completed.
+        * @since S60 3.1
+        * @param aError request error code
+        * @return void
+        */
+        void RequestCompleted( const TInt aError );
+                    
+    protected:  // New functions
+            
+    protected:  // Functions from base classes
+        
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CPhoneHandlerResponse( CPhoneHandlerControl& aControl );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+    
+    public:     // Data
+    
+    protected:  // Data
+    
+    private:    // Data
+    
+        // active object for asynchronous requests
+        CPhoneHandlerActive* iActive;
+        
+        // reference to control
+        CPhoneHandlerControl& iControl;
+        
+        // iOperation is used to give response to exact RemConExtensionApi
+        // command
+        TRemConExtCallHandlingApiOperationId iOperation;
+        
+        // Response code
+        TInt iError;
+    
+    public:     // Friend classes
+   
+    protected:  // Friend classes
+   
+    private:    // Friend classes
+   
+    };
+
+#endif      // CPHONEHANDLERRESPONSE_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonecmdhandler/phonecmdhnlr/inc/phonehandlerservice.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,90 @@
+/*
+* 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: Declaration of MPhoneHandlerService interface.
+*
+*/
+
+
+#ifndef MPHONEHANDLERSERVICE_H
+#define MPHONEHANDLERSERVICE_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+*  Interface to control objects that perform call handling key presses. 
+*
+*  @lib PhoneCmdHandler
+*  @since S60 3.1
+*/
+class MPhoneHandlerService 
+    {
+    public:  // Constructors and destructor
+    
+    public: // New functions
+        
+        /**
+        * Starts to process an asynchronous request.
+        * @since Series 60 3.1
+        * @param 
+        * @return 
+        */
+        virtual void Process() = 0;
+    
+        /**
+        * Deletes service object.
+        * @since Series 60 3.1
+        * @param 
+        * @return 
+        */
+        virtual void Delete() = 0;
+        
+    public: // Functions from base classes
+        
+    protected:  // New functions
+        
+    protected:  // Functions from base classes
+        
+    private:
+
+    public:     // Data
+    
+    protected:  // Data
+
+    private:    // Data
+
+    public:     // Friend classes
+
+    protected:  // Friend classes
+    
+    private:    // Friend classes
+    
+    };
+
+#endif      // MPHONEHANDLERSERVICE_H   
+            
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonecmdhandler/phonecmdhnlr/inc/phonehandlervoicedial.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,135 @@
+/*
+* 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: Declaration of CPhoneHandlerVoiceDial class.
+*
+*/
+
+
+#ifndef CPHONEHANDLERVOICEDIAL_H
+#define CPHONEHANDLERVOICEDIAL_H
+
+//  INCLUDES
+#include "phonehandlercallbase.h" 
+#include <RemConExtensionApi.h> 
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CPhoneHandlerControl;
+
+// CLASS DECLARATION
+
+/**
+*  Handles dial and speed dial key presses.
+*
+*  @lib PhoneCmdHandler
+*  @since S60 3.1
+*/
+NONSHARABLE_CLASS( CPhoneHandlerVoiceDial ) : public CPhoneHandlerCallBase
+                                              
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CPhoneHandlerVoiceDial* NewL( 
+                            CPhoneHandlerControl& aControl,
+                            TRemConExtCallHandlingApiOperationId aOperation = 
+                                ERemConExtVoiceDial );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CPhoneHandlerVoiceDial();
+
+    public: // New functions
+    
+    public: // Functions from base classes
+
+        /**
+        * From MPhoneHandlerService. Starts processing service.
+        * @since S60 3.1
+        * @return void
+        */
+        void Process();
+        
+        /**
+        * From MPhoneHandlerService. Deletes service.
+        * @since S60 3.1
+        * @return void
+        */
+        void Delete();
+        
+        /**
+        * From MPhoneHandlerObserver. Notifies when asynchronous request has 
+        * been completed.
+        * @since S60 3.1
+        * @param aError request error code
+        * @return void
+        */
+        void RequestCompleted( const TInt aError );
+            
+    protected:  // New functions
+    
+    protected:  // Functions from base classes
+        
+    
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CPhoneHandlerVoiceDial( 
+                            CPhoneHandlerControl& aControl,
+                            TRemConExtCallHandlingApiOperationId aOperation );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+    
+    public:     // Data
+    
+    protected:  // Data
+    
+    private:    // Data
+            
+        // reference to control
+        CPhoneHandlerControl& iControl;
+        
+        // Command which initiates voice call in BT case is ERemConExtVoiceDial.
+        // Command which initiates voice call in wired case is
+        // ERemConExtEndCall.
+        // iOperation is used to give response to exact RemConExtensionApi
+        // command
+        TRemConExtCallHandlingApiOperationId iOperation;
+        
+    public:     // Friend classes
+    
+    protected:  // Friend classes
+    
+    private:    // Friend classes
+    
+    };
+
+#endif      // CPHONEHANDLERVOICEDIAL_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonecmdhandler/phonecmdhnlr/src/phonehandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,108 @@
+/*
+* 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:  Provides interface for client to load PhoneCmdHandler.
+*
+*/
+
+
+// INCLUDE FILES
+#include "phonehandlercontrol.h" 
+#include "phonehandlerdebug.h" 
+#include "PhoneHandler.h" 
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneHandler::CPhoneHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPhoneHandler::CPhoneHandler()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandler::ConstructL( CRemConInterfaceSelector* aIfSelector )
+    {
+    COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandler::ConstructL() *aIfSelector=%d", aIfSelector );
+        
+    iControl = CPhoneHandlerControl::NewL( aIfSelector );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CPhoneHandler* CPhoneHandler::NewL()
+    {
+    CPhoneHandler* self = new ( ELeave ) CPhoneHandler();
+    
+    CleanupStack::PushL( self );
+    self->ConstructL( NULL );
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhoneHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//    
+EXPORT_C CPhoneHandler* CPhoneHandler::NewL( 
+                            CRemConInterfaceSelector& aIfSelector )
+    {
+    CPhoneHandler* self = new ( ELeave ) CPhoneHandler();
+    
+    CleanupStack::PushL( self );
+    self->ConstructL( &aIfSelector );
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// Destructor
+EXPORT_C CPhoneHandler::~CPhoneHandler()
+    {
+    delete iControl;
+    }
+
+// ======================== OTHER EXPORTED FUNCTIONS ===========================
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonecmdhandler/phonecmdhnlr/src/phonehandleractive.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,125 @@
+/*
+* 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:  Active object used to call asynchronous requests. 
+*
+*/
+
+
+// INCLUDE FILES
+#include "phonehandleractive.h" 
+#include "phonehandlerobserver.h" 
+#include "phonehandlerdebug.h" 
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+ 
+CPhoneHandlerActive* CPhoneHandlerActive::NewL( MPhoneHandlerObserver& aObserver )
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerActive::NewL() start" );
+    CPhoneHandlerActive* self = new(ELeave) CPhoneHandlerActive( aObserver );
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerActive::NewL() end" );
+    return self;
+    }
+
+CPhoneHandlerActive::~CPhoneHandlerActive()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerActive::~CPhoneHandlerActive() start" );
+    
+    Cancel();
+    
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerActive::~CPhoneHandlerActive() end" );
+    }
+
+CPhoneHandlerActive::CPhoneHandlerActive( MPhoneHandlerObserver& aObserver )
+:   CActive(CActive::EPriorityStandard),
+    iObserver(aObserver)
+    {
+    CActiveScheduler::Add(this);
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerActive::SetActive()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerActive::SetActive()
+    {
+    CActive::SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerActive::RunL()
+// Informs caller of an asynchronous request that it has been completed.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerActive::RunL()
+    {
+    COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerActive::RunL() iStatus.Int()=%d", iStatus.Int() );
+    
+    TInt error( iStatus.Int() );
+    iStatus =  KErrNone;
+    iObserver.RequestCompleted( error );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerActive::RunError
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CPhoneHandlerActive::RunError( TInt aError )
+    {
+    COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerActive::RunError(%d)", aError );
+
+    // Avoid Panic in CActiveScheduler
+    aError = KErrNone;
+
+    COM_TRACE_( "[AccFW:PHONECMDHANDLER] CPhoneHandlerActive::RunError() - return KErrNone" );
+            
+    return aError; 
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerActive::DoCancel
+// No need to cancel an asynchronous request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerActive::DoCancel()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerActive::DoCancel() start" );
+        
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerActive::DoCancel() end" );
+    }
+
+//
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonecmdhandler/phonecmdhnlr/src/phonehandleranswercall.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,171 @@
+/*
+* 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:  Handles answer call key press. 
+*
+*/
+
+
+// INCLUDE FILES
+#include    "phonehandleranswercall.h" 
+#include    "phonehandlercontrol.h" 
+#include    "phonehandlerdebug.h" 
+#include    <RemConCallHandlingTarget.h> 
+
+#include    <cphcltcommandhandler.h> 
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerAnswerCall::CPhoneHandlerAnswerCall
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPhoneHandlerAnswerCall::CPhoneHandlerAnswerCall( 
+                            CPhoneHandlerControl& aControl, 
+                            TRemConExtCallHandlingApiOperationId aOperation )
+: iControl( aControl ),
+  iOperation( aOperation )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerAnswerCall::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerAnswerCall::ConstructL()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerAnswerCall::ConstructL() start" );
+        
+    LoadServiceL();
+    
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerAnswerCall::ConstructL() end" );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerAnswerCall::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPhoneHandlerAnswerCall* CPhoneHandlerAnswerCall::NewL( 
+                            CPhoneHandlerControl& aControl, 
+                            TRemConExtCallHandlingApiOperationId aOperation )
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerAnswerCall::NewL() start" );
+        
+    CPhoneHandlerAnswerCall* self = new( ELeave ) CPhoneHandlerAnswerCall( 
+                                                    aControl, 
+                                                    aOperation );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerAnswerCall::NewL() end" );
+    
+    return self;
+    }
+
+// Destructor
+CPhoneHandlerAnswerCall::~CPhoneHandlerAnswerCall()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerAnswerCall::~CPhoneHandlerAnswerCall()" );
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerAnswerCall::Process
+// Starts to process service.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerAnswerCall::Process()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerAnswerCall::Process()" );
+        
+    iCommandHandler->Ata( GetStatus() );
+    Activate();     
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerAnswerCall::Delete
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerAnswerCall::Delete()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerAnswerCall::Delete()" );
+        
+    delete this;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerAnswerCall::RequestCompleted
+// Handler for completed asynchronous calls.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerAnswerCall::RequestCompleted( const TInt aError )
+    {
+    COM_TRACE_2( "[PHONECMDHANDLER] CPhoneHandlerAnswerCall::RequestCompleted() aError=%d, iState=%d", aError, iState );
+        
+    switch( iState )
+        {
+        case EPhoneHandlerState1:
+            {
+            NextState();
+            iControl.CommandInitiator().SendResponse( GetStatus(), 
+                                                      iOperation,
+                                                      aError );
+            Activate();
+            break;
+            }
+            
+        case EPhoneHandlerState2:
+            {
+            IdleState();
+            delete this; 
+            break;
+            }
+            
+        default:
+            {
+            COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerAnswerCall::RequestCompleted() Unspecified state" );
+            break;
+            }
+        };
+    }
+    
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonecmdhandler/phonecmdhnlr/src/phonehandlercallbase.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,152 @@
+/*
+* 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:  Base class for services. 
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "phonehandlercallbase.h" 
+#include "phonehandleractive.h" 
+#include "phonehandlerdebug.h" 
+
+#include <cphcltcommandhandler.h> 
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerCallBase::CPhoneHandlerCallBase
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPhoneHandlerCallBase::CPhoneHandlerCallBase()
+    : iState( EPhoneHandlerState1 )
+    {
+    }
+
+// Destructor
+CPhoneHandlerCallBase::~CPhoneHandlerCallBase()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerCallBase::~CPhoneHandlerCallBase()" );
+            
+    iServer.Close();
+    delete iCommandHandler;
+    delete iActive;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerCallBase::LoadServiceL
+// Initializes API that is used to request call handling related services.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerCallBase::LoadServiceL()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerCallBase::LoadServiceL() start" );
+    
+    
+    
+    iCommandHandler = CPhCltCommandHandler::NewL();
+    
+    User::LeaveIfError( iServer.Connect() ); // create session
+    
+    // Create active object
+    iActive = CPhoneHandlerActive::NewL( *this );
+    
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerCallBase::LoadServiceL() end" );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerCallBase::NextState
+// Increments state used to control service.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerCallBase::NextState()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerCallBase::NextState() start" );
+        
+    TInt temp = static_cast<TInt>( iState );
+    ++temp;
+    iState = static_cast<TPhoneHandlerServiceState>( temp );
+    
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerCallBase::NextState() end" );
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhoneHandlerCallBase::IdleState
+// Sets a specific state when service has been completed.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerCallBase::IdleState()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerCallBase::IdleState() start" );
+    
+    iState = EPhoneHandlerStateIdle;
+    
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerCallBase::IdleState() end" );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerCallBase::GetStatus
+// Returns active object's TRequestStatus for asynchronous calls.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TRequestStatus& CPhoneHandlerCallBase::GetStatus()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerCallBase::GetStatus() start" );
+    
+    return iActive->iStatus;
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhoneHandlerCallBase::Activate
+// Activates an active object for asynchronous calls.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+void CPhoneHandlerCallBase::Activate()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerCallBase::Activate() start" );
+    
+    iActive->SetActive();                       
+        
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerCallBase::Activate() end" );
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonecmdhandler/phonecmdhnlr/src/phonehandlercallstate.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,155 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Listens to call state changes and informs control. 
+*
+*/
+
+
+// INCLUDE FILES
+#include "phonehandlercallstate.h" 
+#include "phonehandlercontrol.h" 
+#include "phonehandlerdebug.h" 
+#include <ctsydomainpskeys.h>
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerCallState::CPhoneHandlerCallState
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPhoneHandlerCallState::CPhoneHandlerCallState( CPhoneHandlerControl& aControl )
+:   CActive(CActive::EPriorityStandard),
+    iControl( aControl )
+    {
+    CActiveScheduler::Add(this);
+    } 
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerCallState::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerCallState::ConstructL()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerCallState::ConstructL() start" );
+    
+    // Allows CPhoneHandlerCallState to start to listen S60 call states.
+    User::LeaveIfError( 
+        iProperty.Attach( KPSUidCtsyCallInformation, KCTsyCallState ) );
+        
+    Subscribe();
+    
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerCallState::ConstructL() end" );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerCallState::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CPhoneHandlerCallState* CPhoneHandlerCallState::NewL( CPhoneHandlerControl& aControl )
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerCallState::NewL()" );
+    
+    CPhoneHandlerCallState* self = new(ELeave) CPhoneHandlerCallState( aControl );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    
+    return self;
+    }
+
+// Destructor
+CPhoneHandlerCallState::~CPhoneHandlerCallState()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerCallState::~CPhoneHandlerCallState() start" );
+    
+    Cancel();
+    iProperty.Cancel();
+    iProperty.Close();
+    
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerCallState::~CPhoneHandlerCallState() end" );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerCallState::RunL()
+// Informs caller of an asynchronous request that it has been completed.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerCallState::RunL()
+    {
+    COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerCallState::RunL() - return code = %d", iStatus.Int() );
+        
+    TInt state( 0 );
+    iProperty.Get( state );
+    
+    COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerCallState - KTelephonyCallState = %d", state );
+        
+    if( iStatus.Int() == KErrNone )
+        {
+        iControl.NotifyCallState( state );
+        }
+        
+    Subscribe();
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerCallState::DoCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerCallState::DoCancel()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerCallState::DoCancel()" );
+    
+    iProperty.Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerCallState::Subscribe
+// Start to listen changes in call state.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerCallState::Subscribe()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerCallState::Subscribe()" );
+    
+    iProperty.Subscribe( iStatus );
+    SetActive();
+    }
+
+//
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonecmdhandler/phonecmdhnlr/src/phonehandlercontrol.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,715 @@
+/*
+* 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:  Receives call handling related key presses from accessories and 
+*                executes them. 
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "phonehandlercontrol.h" 
+#include "phonehandlerservice.h" 
+#include "phonehandleranswercall.h" 
+#include "phonehandlerendcall.h" 
+#include "phonehandlerdialcall.h" 
+#include "phonehandlervoicedial.h" 
+#include "phonehandlerredial.h" 
+#include "phonehandlermultipartycall.h" 
+#include "phonehandlerdtmf.h" 
+#include "phonehandleractive.h" 
+#include "phonehandlerresponse.h" 
+#include "phonehandlercallstate.h" 
+#include "phonehandlerdebug.h" 
+#include <remconinterfaceselector.h>
+#include <RemConCallHandlingTarget.h> 
+#include <ctsydomainpskeys.h>
+
+#if 0
+#include <voiceuidomainpskeys.h> 
+#endif
+
+#include <connect/sbdefs.h>
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+const TInt KMultipartyCallMinParam = 1;
+const TInt KMultipartyCallMaxParam = 2;
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerControl::CPhoneHandlerControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPhoneHandlerControl::CPhoneHandlerControl()
+    : iPrevState( EPSCTsyCallStateNone )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerControl::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerControl::ConstructL( CRemConInterfaceSelector* aIfSelector )
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::ConstructL() start" );
+        
+    if( !aIfSelector )
+        {
+        COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::ConstructL() Create connection to RemCon." );
+            
+        // Target connection to RemCon FW hasn't been done.
+        iInterfaceSelector = CRemConInterfaceSelector::NewL();
+        iTarget = CRemConCallHandlingTarget::NewL( *iInterfaceSelector, *this );
+        iInterfaceSelector->OpenTargetL();
+        }
+    else
+        {
+        COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::ConstructL() Don't create connection to RemCon." );
+                
+        // Connection to RemCon FW as target has already been done in a process.
+        iTarget = CRemConCallHandlingTarget::NewL( *aIfSelector, *this );
+        }
+        
+    iResponse = CPhoneHandlerResponse::NewL( *this );
+    iCallStateObserver = CPhoneHandlerCallState::NewL( *this );
+            
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::ConstructL() end" );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerControl::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPhoneHandlerControl* CPhoneHandlerControl::NewL( 
+                                    CRemConInterfaceSelector* aIfSelector )
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NewL() start" );
+    
+    CPhoneHandlerControl* self = new ( ELeave ) CPhoneHandlerControl();
+    
+    CleanupStack::PushL( self );
+    self->ConstructL( aIfSelector );
+    CleanupStack::Pop( self );
+    
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NewL() end" );
+    
+    return self;
+    }
+
+// Destructor
+CPhoneHandlerControl::~CPhoneHandlerControl()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::~CPhoneHandlerControl() start" );
+    
+    if( iInterfaceSelector )
+        {
+        delete iInterfaceSelector;
+        }
+    
+    if( iResponse )
+        {
+        iResponse->Delete();
+        }
+        
+    if( iCallStateObserver )
+        {
+        delete iCallStateObserver;
+        }
+            
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::~CPhoneHandlerControl() end" );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerControl::TelephoneNumber
+// Provides phone number for service.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+const TPhCltTelephoneNumber& 
+    CPhoneHandlerControl::TelephoneNumber() const
+    {
+    return iTelNumber;
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhoneHandlerControl::VoiceDialStatus
+// Provides voice dial status for service.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+const TBool& 
+    CPhoneHandlerControl::VoiceDialStatus() const
+    {
+    return iActivate;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerControl::ChldCommand
+// Provides CHLD command for service.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+const TInt& 
+    CPhoneHandlerControl::ChldCommand() const
+    {
+    return iChldCommand;
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhoneHandlerControl::ChldCallNumber
+// Provides CHLD call number for service.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+const TInt& 
+    CPhoneHandlerControl::ChldCallNumber() const
+    {
+    return iChldCallNumber;
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhoneHandlerControl::Tone
+// Provides DTMF tone for service.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+const TChar& 
+    CPhoneHandlerControl::Tone() const
+    {
+    return iChar;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerControl::CommandInitiator
+// Provides API that service uses to send reponse to command.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CRemConCallHandlingTarget& 
+    CPhoneHandlerControl::CommandInitiator() const
+    {
+    return *iTarget;
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhoneHandlerControl::NotifyCallState
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerControl::NotifyCallState( const TInt aState )
+    {
+    COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState() aState=%d", aState );
+    
+    if( aState == EPSCTsyCallStateConnected && iPrevState != EPSCTsyCallStateHold )
+        {
+        COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState(): iActiveCalls++" );
+        
+        iActiveCalls++;
+        }
+    else if( aState == EPSCTsyCallStateDisconnecting && 
+            ( iPrevState == EPSCTsyCallStateConnected || iPrevState == EPSCTsyCallStateHold ))
+        {
+        COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState(): iActiveCalls--" );
+        
+        iActiveCalls--;
+        }
+    else if( aState == EPSCTsyCallStateNone )
+        {
+        COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState(): iActiveCalls = 0" );
+        iActiveCalls = 0;
+        }
+        
+    iPrevState = aState;
+    COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState() iActiveCalls=%d", iActiveCalls );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerControl::AnswerCall
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerControl::AnswerCall()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::AnswerCall() start" );
+    
+    StartProcessing( ERemConExtAnswerCall );
+    
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::AnswerCall() end" );
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhoneHandlerControl::EndCall
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerControl::EndCall()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::EndCall() start" );
+    
+    StartProcessing( ERemConExtEndCall );
+            
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::EndCall() end" );
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhoneHandlerControl::AnswerEndCall
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerControl::AnswerEndCall()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::AnswerEndCall() start" );
+    
+    StartProcessing( ERemConExtAnswerEnd );
+           
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::AnswerEndCall() end" );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerControl::VoiceDial
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+#if 0 // SCB CR EHSA-7APJWF: SIND subscribes to RemCon directly 
+void CPhoneHandlerControl::VoiceDial( const TBool aActivate )
+    {
+    COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::VoiceDial() aActivate=%d", aActivate );
+
+    TInt callState( EPSCTsyCallStateUninitialized );
+    iProperty.Get( KPSUidCtsyCallInformation, KCTsyCallState, callState ); 
+
+    COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() call state = %d", callState );
+
+    if( callState == EPSCTsyCallStateUninitialized ||
+        callState == EPSCTsyCallStateNone )
+        {
+        TInt voiceUiState( KVoiceUiIsClose );
+        iProperty.Get( KPSUidVoiceUiAccMonitor, KVoiceUiOpenKey, voiceUiState ); 
+
+        if( voiceUiState == KVoiceUiIsOpen )
+            {
+            COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::VoiceDial() voice UI is open!" );
+            iProperty.Set( KPSUidVoiceUiAccMonitor , KVoiceUiAccessoryEvent, ERemConExtVoiceDial );
+            iResponse->SetResponse( ERemConExtVoiceDial, KErrNone );
+            iResponse->Process();
+            }
+        else
+            {
+            iActivate = aActivate;
+            StartProcessing( ERemConExtVoiceDial );
+            }
+        }
+    else
+        {
+        iResponse->SetResponse( ERemConExtVoiceDial, KErrNone );
+        iResponse->Process();
+        }
+
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::VoiceDial() end" );
+    }
+#else   
+void CPhoneHandlerControl::VoiceDial( const TBool /*aActivate*/ )
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::VoiceDial()" );
+
+    iResponse->SetResponse( ERemConExtVoiceDial, KErrNone );
+    iResponse->Process();
+
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::VoiceDial() end" );
+    }
+#endif
+// -----------------------------------------------------------------------------
+// CPhoneHandlerControl::LastNumberRedial
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerControl::LastNumberRedial( )
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::LastNumberRedial() start" );
+    
+    StartProcessing( ERemConExtLastNumberRedial );
+    
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::LastNumberRedial() end" );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerControl::DialCall
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerControl::DialCall( const TDesC8& aTelNumber )
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::DialCall() start" );
+    
+    // Check aTelNumber range    
+    if( KPhCltTelephoneNumberLength < aTelNumber.Length() )
+        {
+        COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::DialCall() number value=%d too long", aTelNumber.Size() );
+        iResponse->SetResponse( ERemConExtDialCall, KErrArgument );
+        iResponse->Process();
+        return; 
+        }
+    
+    iTelNumber.Copy( aTelNumber );
+                    
+    StartProcessing( ERemConExtDialCall );
+    
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::DialCall() end" );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerControl::MultipartyCalling
+// Method supports multiparty call handling according to BT handsfree profile 
+// (HFP) 1.5. BT HFP 1.5 defines contents of aData parameter as follows: 0, 1, 
+// 1<idx>, 2, 2<idx>, 3 and 4, where: 
+//
+// 0 = Releases all held calls or sets User Determined User Busy (UDUB) for 
+// a waiting call. 
+// 1 = Releases all active calls (if any exist) and accepts the other 
+// (held or waiting) call. 
+// 1<idx> = Releases specified active call only (<idx> = digit from 1 to 9. 
+// Command is e.g. "11" ). 
+// 2 = Places all active calls (if any exist) on hold and accepts the other 
+// (held or waiting) call. 
+// 2<idx> = Request private consultation mode with specified call (<idx> = 
+// from 1 to 9. Command is e.g. "21" ). 
+// (Place all calls on hold EXCEPT the call indicated by <idx>.) 
+// 3 = Adds a held call to the conversation. 
+// 4 = Connects the two calls and disconnects the subscriber from both calls 
+// (Explicit Call Transfer). Support for this value and its associated 
+// functionality is optional for the HF. 
+// 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerControl::MultipartyCalling( const TDesC8& aData )
+    {
+    TBool error( EFalse );
+    iChldCommand = 0;
+    iChldCallNumber = 0;
+    TBuf8< KRemConExtParamMaxLength > buf( aData );
+    buf.Trim();
+    TInt length = buf.Length();
+    
+    // Check invalid number of characters
+    if ( length < KMultipartyCallMinParam || length > KMultipartyCallMaxParam )
+        {
+        error = ETrue;
+        }
+    else
+        {
+        TLex8 param;
+        // Set command  
+        param.Assign( buf.Mid( 0, 1 ) );
+        if( param.Val( iChldCommand ) != KErrNone )
+            {
+            error = ETrue;
+            }
+        else if ( length == KMultipartyCallMaxParam )
+            {
+            // Set call number
+            param.Assign( buf.Mid(1) );
+            if( param.Val( iChldCallNumber ) != KErrNone )
+                {
+                error = ETrue;
+                }
+            }
+        }
+
+    if( error )
+        {
+        // Invalid command 
+        iResponse->SetResponse( ERemConExt3WaysCalling, KErrArgument );
+        iResponse->Process();
+        return; 
+        }
+        
+    COM_TRACE_2( "[PHONECMDHANDLER] CPhoneHandlerControl::MultipartyCalling() iChldCommand=%d, iChldCallNumber=%d", iChldCommand, iChldCallNumber );
+        
+    StartProcessing( ERemConExt3WaysCalling );
+    
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::MultipartyCalling() end" );
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhoneHandlerControl::GenerateDTMF
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerControl::GenerateDTMF( const TChar aChar )
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::GenerateDTMF() start" );
+    
+    iChar = aChar;
+    
+    StartProcessing( ERemConExtGenerateDTMF );
+    
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::GenerateDTMF() end" );
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhoneHandlerControl::SpeedDial
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerControl::SpeedDial( const TInt /*aIndex*/ )
+    {    
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::SpeedDial() - Not Supported" );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerControl::StartProcessing
+// Creates an object that executes call handling command received from 
+// accessory.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerControl::StartProcessing( 
+    const TRemConExtCallHandlingApiOperationId aOperation )
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::StartProcessing() start" );
+            
+    // Create a service
+    MPhoneHandlerService* service = NULL;
+    TInt error( KErrNone );
+    TRAP( error, service = CreateServiceL( aOperation ) ); 
+        
+    COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() returned %d", error );
+        
+    if( error )
+        {
+        COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::StartProcessing(): service wasn't created succesfully." );
+        
+        // An error happened. Delete service, if it exists.
+        if( service )
+            {
+            service->Delete();
+            service = NULL;
+            }
+        
+        iResponse->SetResponse( aOperation, error );
+        iResponse->Process();
+        return;
+        }
+    else
+        {
+        // start service
+        service->Process(); 
+        iSwitchCall = EFalse;
+        }
+            
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::StartProcessing() end" );
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhoneHandlerControl::CreateServiceL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+MPhoneHandlerService* CPhoneHandlerControl::
+    CreateServiceL( const TRemConExtCallHandlingApiOperationId aOperation )
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() start" );
+      
+    MPhoneHandlerService* pService = NULL;
+
+    switch( aOperation )
+        {
+        case ERemConExtAnswerCall:
+            {
+            COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtAnswerCall command" );
+            COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - iActiveCalls is %d", iActiveCalls );
+
+            /*          
+            if( iActiveCalls > 0 )
+                {
+                // Multiparty call
+                iSwitchCall = ETrue;
+                pService = CPhoneHandlerMultipartyCall::NewL( *this );
+                }
+            else
+                {
+                // non-multiparty call
+                pService = CPhoneHandlerAnswerCall::NewL( *this );
+                }
+            */
+            pService = CPhoneHandlerAnswerCall::NewL( *this );
+
+            break;  
+            }
+            
+        case ERemConExtEndCall:
+            {
+            COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtEndCall command" );
+            
+            pService = CPhoneHandlerEndCall::NewL( *this );
+            
+            break;  
+            }
+            
+        case ERemConExtAnswerEnd:
+            {
+            COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtAnswerEnd command" );
+                        
+            TInt callState( EPSCTsyCallStateUninitialized );
+            iProperty.Get( KPSUidCtsyCallInformation, KCTsyCallState, callState ); 
+            
+            COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() call state = %d", callState );
+               
+            if( callState != EPSCTsyCallStateUninitialized &&
+                callState != EPSCTsyCallStateNone && 
+                callState != EPSCTsyCallStateDisconnecting )
+                {
+                if( callState == EPSCTsyCallStateAlerting ||
+                    callState == EPSCTsyCallStateDialling ||
+                    callState == EPSCTsyCallStateAnswering ||
+                    callState == EPSCTsyCallStateConnected ||
+                    callState == EPSCTsyCallStateHold )
+                    {
+                    pService = CPhoneHandlerEndCall::NewL( *this, 
+                                                       aOperation );
+                    }
+                // callState == EPSTelephonyCallStateRinging
+                else
+                    {
+                    COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() iActiveCalls = %d", iActiveCalls );
+                    if( iActiveCalls > 0 )
+                        {
+                        // multicall case : End call that has existed longer.
+                        // (From UI viewpoint ringing call is in waiting state.)
+                        pService = CPhoneHandlerEndCall::NewL( *this, 
+                                                       aOperation );
+                        if( callState == EPSCTsyCallStateRinging )
+                            {
+                            // In multiparty case the telephony key is not
+                            // updated. The call amount is updated manually.
+                            iActiveCalls--;
+                            }
+                        }
+                    else
+                        {
+                        pService = CPhoneHandlerAnswerCall::NewL( 
+                                        *this, 
+                                        aOperation );
+                        }
+                    }
+                }
+            else
+                {
+                // Send / end button was pressed when there were not 
+                // any calls active. Response has to be sent back to accessory
+                // at least for following reasons:
+                
+                // 1. RemCon FW releases message related memory only when response
+                // is sent back to accessory.
+                
+                // 2. BT accessory key press producing ERemConExtAnswerEnd 
+                // operation has some other meaning than answer/end call 
+                // and it's processed by proper client. However, there 
+                // might be a situation where proper client isn't active 
+                // and can't process command. In any case RemCon/BT accessory
+                // requires response to command. That's why PhoneCmdHandler 
+                // sends reponse to command. 
+                                
+                iResponse->SetResponse( aOperation, KErrNone );
+                pService = iResponse;
+                }
+            break;
+            } 
+            
+        case ERemConExtDialCall:
+            {
+            COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtDialCall command" );
+                        
+            pService = CPhoneHandlerDialCall::NewL( *this );
+            break;  
+            }
+            
+        case ERemConExtVoiceDial:
+            {
+            COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtVoiceDial command" );
+                        
+            pService = CPhoneHandlerVoiceDial::NewL( *this );
+            break;  
+            }
+            
+        case ERemConExtLastNumberRedial:
+            {
+            COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtLastNumberRedial command" );
+                        
+            pService = CPhoneHandlerLastNumberRedial::NewL( *this );
+            break;  
+            }
+            
+        case ERemConExt3WaysCalling:
+            {
+            COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExt3WaysCalling command" );
+                        
+            pService = CPhoneHandlerMultipartyCall::NewL( *this );
+            break;  
+            }
+            
+        case ERemConExtGenerateDTMF:
+            {
+            COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtGenerateDTMF command" );
+                        
+            pService = CPhoneHandlerDTMF::NewL( *this );
+            break;  
+            }
+                    
+        default:
+            {
+            COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() Unspecified state" );
+            break;
+            }
+        };
+        
+    COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() end, %d", pService );
+    return pService;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerControl::SwitchCall
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneHandlerControl::SwitchCall()
+    {
+    return iSwitchCall;
+    }   
+// ======================== OTHER EXPORTED FUNCTIONS ===========================
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonecmdhandler/phonecmdhnlr/src/phonehandlerdialcall.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,173 @@
+/*
+* 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:  Handles dial and speed dial key presses. 
+*
+*/
+
+
+// INCLUDE FILES
+#include    "phonehandlerdialcall.h" 
+#include    "phonehandlercontrol.h" 
+#include    "phonehandlerdebug.h" 
+
+#include    <cphcltcommandhandler.h> 
+#include    <phclttypes.h> 
+#include    <RemConCallHandlingTarget.h> 
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerDialCall::CPhoneHandlerDialCall
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPhoneHandlerDialCall::CPhoneHandlerDialCall( 
+                            CPhoneHandlerControl& aControl,
+                            TRemConExtCallHandlingApiOperationId aOperation )
+: iControl( aControl ),
+  iOperation( aOperation )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerDialCall::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerDialCall::ConstructL()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerDialCall::ConstructL() start" );
+        
+    LoadServiceL();
+    
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerDialCall::ConstructL() end" );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerDialCall::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPhoneHandlerDialCall* CPhoneHandlerDialCall::NewL( 
+                            CPhoneHandlerControl& aControl,
+                            TRemConExtCallHandlingApiOperationId aOperation )
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerDialCall::NewL()" );
+        
+    CPhoneHandlerDialCall* self = new( ELeave ) CPhoneHandlerDialCall( 
+                                                    aControl, 
+                                                    aOperation );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+    
+// Destructor
+CPhoneHandlerDialCall::~CPhoneHandlerDialCall()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerDialCall::~CPhoneHandlerDialCall()" );
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerDialCall::Process
+// Starts to process service.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerDialCall::Process()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerDialCall::Process()" );
+    
+    COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerDialCall::Process() telephone number is %S", &(iControl.TelephoneNumber() ) );
+    iCommandHandler->Atd( GetStatus(), iControl.TelephoneNumber() ); 
+            
+    Activate();                         
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerDialCall::Delete
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerDialCall::Delete()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerDialCall::Delete()" );
+        
+    delete this;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerDialCall::RequestCompleted
+// Handler for completed asynchronous calls.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerDialCall::RequestCompleted( const TInt aError )
+    {
+    COM_TRACE_2( "[PHONECMDHANDLER] CPhoneHandlerDialCall::RequestCompleted() aError=%d, iState=%d", aError, iState );
+        
+    switch( iState )
+        {
+        case EPhoneHandlerState1:
+            {
+            NextState();
+            iControl.CommandInitiator().SendResponse( GetStatus(), 
+                                                      iOperation,
+                                                      aError );
+            Activate();
+            break;
+            }
+            
+        case EPhoneHandlerState2:
+            {
+            IdleState();
+            delete this; 
+            break;
+            }
+            
+        default:
+            {
+            COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerDialCall::AsynchronousRequestCompleted() Unspecified state" );
+            break;
+            }
+        };
+    }
+    
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonecmdhandler/phonecmdhnlr/src/phonehandlerdtmf.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,172 @@
+/*
+* 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:  Handles DTMF tone. 
+*
+*/
+
+
+// INCLUDE FILES
+#include    "phonehandlerdtmf.h" 
+#include    "phonehandlercontrol.h" 
+#include    "phonehandlerdebug.h" 
+#include    <RemConCallHandlingTarget.h> 
+
+#include    <cphcltcommandhandler.h> 
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerDTMF::CPhoneHandlerDTMF
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPhoneHandlerDTMF::CPhoneHandlerDTMF( 
+                            CPhoneHandlerControl& aControl,
+                            TRemConExtCallHandlingApiOperationId aOperation )
+: iControl( aControl ), 
+  iOperation( aOperation )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerDTMF::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerDTMF::ConstructL()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerDTMF::ConstructL() start" );
+        
+    LoadServiceL();
+    
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerDTMF::ConstructL() end" );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerDTMF::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPhoneHandlerDTMF* CPhoneHandlerDTMF::NewL(  
+            CPhoneHandlerControl& aControl,
+            TRemConExtCallHandlingApiOperationId aOperation )
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerDTMF::NewL()" );
+        
+    CPhoneHandlerDTMF* self = new( ELeave ) CPhoneHandlerDTMF( aControl, 
+                                                               aOperation );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+    
+// Destructor
+CPhoneHandlerDTMF::~CPhoneHandlerDTMF()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerDTMF::~CPhoneHandlerDTMF()" );
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerDTMF::Process
+// Starts to process service.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerDTMF::Process()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerDTMF::Process()" );
+        
+    iCommandHandler->Vts( GetStatus(), 
+                          iControl.Tone(), 
+                          EPhCltDtmfNotUsed );
+    Activate(); 
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerDTMF::Delete
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerDTMF::Delete()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerDTMF::Delete()" );
+        
+    delete this;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerDTMF::RequestCompleted
+// Handler for completed asynchronous calls.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerDTMF::RequestCompleted( const TInt aError )
+    {
+    COM_TRACE_2( "[PHONECMDHANDLER] CPhoneHandlerDTMF::RequestCompleted() aError=%d, iState=%d", aError, iState );
+        
+    switch( iState )
+        {
+        case EPhoneHandlerState1:
+            {
+            NextState();
+            iControl.CommandInitiator().SendResponse( GetStatus(), 
+                                                      iOperation,
+                                                      aError );
+            Activate();
+            break;
+            }
+            
+        case EPhoneHandlerState2:
+            {
+            IdleState();
+            delete this;
+            break;
+            }
+            
+        default:
+            {
+            COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerDTMF::RequestCompleted() Unspecified state" );
+            break;
+            }
+        };
+    }
+    
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonecmdhandler/phonecmdhnlr/src/phonehandlerendcall.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,170 @@
+/*
+* 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:  Handles end call and reject call key presses. 
+*
+*/
+
+
+// INCLUDE FILES
+#include    "phonehandlerendcall.h" 
+#include    "phonehandlercontrol.h" 
+#include    "phonehandlerdebug.h" 
+#include    <RemConCallHandlingTarget.h> 
+
+#include    <cphcltcommandhandler.h> 
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerEndCall::CPhoneHandlerEndCall
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPhoneHandlerEndCall::CPhoneHandlerEndCall(  
+                            CPhoneHandlerControl& aControl, 
+                            TRemConExtCallHandlingApiOperationId aOperation )
+: iControl( aControl ),
+  iOperation( aOperation )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerEndCall::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerEndCall::ConstructL()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerEndCall::ConstructL() start" );
+        
+    LoadServiceL();
+    
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerEndCall::ConstructL() end" );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerEndCall::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPhoneHandlerEndCall* CPhoneHandlerEndCall::NewL( 
+                        CPhoneHandlerControl& aControl,
+                        TRemConExtCallHandlingApiOperationId aOperation )
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerEndCall::NewL()" );
+        
+    CPhoneHandlerEndCall* self = new( ELeave ) CPhoneHandlerEndCall( 
+                                                    aControl,
+                                                    aOperation );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+    
+// Destructor
+CPhoneHandlerEndCall::~CPhoneHandlerEndCall()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerEndCall::~CPhoneHandlerEndCall()" );
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerEndCall::Process
+// Starts to process service.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerEndCall::Process()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerEndCall::Process()" );
+    
+    iCommandHandler->Chup( GetStatus() );    
+    Activate();                         
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerEndCall::Delete
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerEndCall::Delete()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerEndCall::Delete()" );
+        
+    delete this;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerEndCall::RequestCompleted
+// Handler for completed asynchronous calls.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerEndCall::RequestCompleted( const TInt aError )
+    {
+    COM_TRACE_2( "[PHONECMDHANDLER] CPhoneHandlerEndCall::RequestCompleted() aError=%d, iState=%d", aError, iState );
+        
+    switch( iState )
+        {
+        case EPhoneHandlerState1:
+            {
+            NextState();
+            iControl.CommandInitiator().SendResponse( GetStatus(), 
+                                                      iOperation,
+                                                      aError );
+            Activate();
+            break;
+            }
+            
+        case EPhoneHandlerState2:
+            {
+            IdleState();
+            delete this;  
+            break;
+            }
+            
+        default:
+            {
+            COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerEndCall::RequestCompleted() Unspecified state" );
+            break;
+            }
+        };
+    }
+    
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonecmdhandler/phonecmdhnlr/src/phonehandlermultipartycall.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,185 @@
+/*
+* 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:  Handles multiparty call key press. 
+*
+*/
+
+
+// INCLUDE FILES
+#include    "phonehandlermultipartycall.h" 
+#include    "phonehandlercontrol.h" 
+#include    "phonehandlerdebug.h" 
+#include    <RemConCallHandlingTarget.h> 
+#include    <cphcltcommandhandler.h> 
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerMultipartyCall::CPhoneHandlerMultipartyCall
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPhoneHandlerMultipartyCall::CPhoneHandlerMultipartyCall(
+                            CPhoneHandlerControl& aControl,
+                            TRemConExtCallHandlingApiOperationId aOperation )
+: iControl( aControl ), 
+  iOperation( aOperation )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerMultipartyCall::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerMultipartyCall::ConstructL()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerMultipartyCall::ConstructL() start" );
+        
+    LoadServiceL();
+    
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerMultipartyCall::ConstructL() end" );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerMultipartyCall::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPhoneHandlerMultipartyCall* CPhoneHandlerMultipartyCall::NewL( 
+            CPhoneHandlerControl& aControl,
+            TRemConExtCallHandlingApiOperationId aOperation )
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerMultipartyCall::NewL()" );
+        
+    CPhoneHandlerMultipartyCall* self = 
+        new( ELeave ) CPhoneHandlerMultipartyCall( aControl, aOperation );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+    
+// Destructor
+CPhoneHandlerMultipartyCall::~CPhoneHandlerMultipartyCall()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerMultipartyCall::~CPhoneHandlerMultipartyCall()" );
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerMultipartyCall::Process
+// Starts to process service.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerMultipartyCall::Process()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerMultipartyCall::Process()" );
+    
+    /*
+    if( iControl.SwitchCall() )
+        {
+        iCommandHandler->Chld( GetStatus(), EPhCltChldTwo, 0 ); 
+        }
+    else
+        { */
+        // get command
+        TInt command = const_cast<TInt&>( iControl.ChldCommand() );
+
+        // get number
+        TInt number = const_cast<TInt&>( iControl.ChldCallNumber() );
+        
+        iCommandHandler->Chld( GetStatus(),
+                               static_cast<TPhCltChldCommand>( command ),
+                               number ); 
+        //}
+        
+    Activate();     
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerMultipartyCall::Delete
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerMultipartyCall::Delete()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerMultipartyCall::Delete()" );
+        
+    delete this;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerMultipartyCall::RequestCompleted
+// Handler for completed asynchronous calls.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerMultipartyCall::RequestCompleted( const TInt aError )
+    {
+    COM_TRACE_2( "[PHONECMDHANDLER] CPhoneHandlerMultipartyCall::RequestCompleted() aError=%d, iState=%d", aError, iState );
+        
+    switch( iState )
+        {
+        case EPhoneHandlerState1:
+            {
+            NextState();
+            iControl.CommandInitiator().SendResponse( GetStatus(), 
+                                                      iOperation,
+                                                      aError );
+            Activate();
+            break;
+            }
+            
+        case EPhoneHandlerState2:
+            {
+            IdleState();
+            delete this;
+            break;
+            }
+            
+        default:
+            {
+            COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerMultipartyCall::RequestCompleted() Unspecified state" );
+            break;
+            }
+        };
+    }
+    
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonecmdhandler/phonecmdhnlr/src/phonehandlerredial.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,201 @@
+/*
+* 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:  Handles last number redial key press. 
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "phonehandlerredial.h" 
+#include "phonehandlercontrol.h" 
+#include "phonehandlerdebug.h" 
+#include <RemConCallHandlingTarget.h> 
+#include <cphcltcommandhandler.h> 
+#include <phclttypes.h> 
+
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <logfilterandeventconstants.hrh>
+#endif
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerLastNumberRedial::CPhoneHandlerLastNumberRedial
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPhoneHandlerLastNumberRedial::CPhoneHandlerLastNumberRedial(
+                            CPhoneHandlerControl& aControl,
+                            TRemConExtCallHandlingApiOperationId aOperation )
+: iControl( aControl ), 
+  iOperation( aOperation )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerLastNumberRedial::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerLastNumberRedial::ConstructL()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerLastNumberRedial::ConstructL() start" );
+    
+    User::LeaveIfError(iFsSession.Connect());
+
+    iLogClientPtr = CLogClient::NewL(iFsSession);
+    iLogViewRecentPtr = CLogViewRecent::NewL(*iLogClientPtr);
+    LoadServiceL();
+    
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerLastNumberRedial::ConstructL() end" );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerLastNumberRedial::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPhoneHandlerLastNumberRedial* CPhoneHandlerLastNumberRedial::NewL( 
+    CPhoneHandlerControl& aControl,
+    TRemConExtCallHandlingApiOperationId aOperation )
+    {
+    CPhoneHandlerLastNumberRedial* self = 
+        new (ELeave) CPhoneHandlerLastNumberRedial( aControl, aOperation );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// Destructor
+CPhoneHandlerLastNumberRedial::~CPhoneHandlerLastNumberRedial()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerLastNumberRedial::CPhoneHandlerLastNumberRedial() start" );
+    
+    delete iLogViewRecentPtr;
+    delete iLogClientPtr;
+    iFsSession.Close();
+    
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerLastNumberRedial::CPhoneHandlerLastNumberRedial() end" );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerLastNumberRedial::Process
+// Starts to process service.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerLastNumberRedial::Process()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerLastNumberRedial::Process() start" );
+    
+    TBool ret = EFalse;
+        
+    TRAPD( err, ret = iLogViewRecentPtr->
+        SetRecentListL( KLogRecentOutgoingCalls, GetStatus() ) ); 
+    if( KErrNone == err && ret )
+        {
+        COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerLastNumberRedial::Process() There is last redial number" );
+        Activate();
+        }
+    else
+        {
+        if( err != KErrNone )
+            {
+            COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerLastNumberRedial::Process() failed err=%d", err );
+            RequestCompleted( err ); 
+            }
+        else
+            {
+            COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerLastNumberRedial::Process() failed err=%d", KErrNotFound );
+            RequestCompleted( KErrNotFound ); 
+            }
+        }
+        
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerLastNumberRedial::Process() end" );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerLastNumberRedial::Delete
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerLastNumberRedial::Delete()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerLastNumberRedial::Delete()" );
+        
+    delete this;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerLastNumberRedial::RequestCompleted
+// Handler for completed asynchronous calls.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerLastNumberRedial::RequestCompleted( const TInt aError )
+    {
+    COM_TRACE_2( "[PHONECMDHANDLER] CPhoneHandlerLastNumberRedial::RequestCompleted() aError=%d, iState=%d", aError, iState );
+    
+    if( KErrNone != aError )
+        {
+        // cancel process and return an error code
+        iState = EPhoneHandlerState2;
+        }
+    
+    switch( iState )
+        {
+        case EPhoneHandlerState1:
+            {
+            NextState();
+            
+            const TDesC& number = iLogViewRecentPtr->Event().Number();
+            COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerLastNumberRedial::RequestCompleted() phone number is %S", &number );
+            // make a call with last dialed phone number
+            iCommandHandler->Atd( GetStatus(), number );
+
+            Activate(); 
+            break;
+            }
+        
+        case EPhoneHandlerState2:
+            {
+            NextState();
+            iControl.CommandInitiator().SendResponse( GetStatus(), 
+                                                      iOperation,
+                                                      aError );
+            Activate();
+            break;
+            }
+            
+        case EPhoneHandlerState3:
+            {
+            IdleState();
+            delete this; 
+            break;
+            }
+                
+        default:
+            {
+            COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerLastNumberRedial::RequestCompleted() Unspecified state" );
+            break;
+            }
+        };
+        
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerLastNumberRedial::RequestCompleted() end" );
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonecmdhandler/phonecmdhnlr/src/phonehandlerresponse.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,164 @@
+/*
+* 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:  Sends responses to RemCon FW.  
+*
+*/
+
+
+// INCLUDE FILES
+#include    "phonehandlerresponse.h" 
+#include    "phonehandlercontrol.h" 
+#include    "phonehandleractive.h" 
+#include    "phonehandlerdebug.h" 
+#include    <RemConCallHandlingTarget.h> 
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerResponse::CPhoneHandlerResponse
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPhoneHandlerResponse::CPhoneHandlerResponse( CPhoneHandlerControl& aControl )
+: iControl( aControl )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerResponse::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerResponse::ConstructL()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerResponse::ConstructL() start" );
+        
+    iActive = CPhoneHandlerActive::NewL( *this );
+    
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerResponse::ConstructL() end" );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerResponse::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPhoneHandlerResponse* CPhoneHandlerResponse::NewL( 
+        CPhoneHandlerControl& aControl )
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerResponse::NewL() start" );
+        
+    CPhoneHandlerResponse* self = 
+        new( ELeave ) CPhoneHandlerResponse( aControl );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerResponse::NewL() end" );
+    
+    return self;
+    }
+
+// Destructor
+CPhoneHandlerResponse::~CPhoneHandlerResponse()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerResponse::~CPhoneHandlerResponse()" );
+    
+    delete iActive;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerResponse::SendResponse
+// Sends response to RemCon FW.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerResponse::SetResponse( 
+            TRemConExtCallHandlingApiOperationId aOperation, TInt aError )
+    {
+    COM_TRACE_2( "[PHONECMDHANDLER] CPhoneHandlerResponse::Process(aOperation=%d,aError=%d)",aOperation, aError );
+    
+    iOperation = aOperation;
+    iError = aError;
+    }
+        
+// -----------------------------------------------------------------------------
+// CPhoneHandlerResponse::SendResponse
+// Sends response to RemCon FW.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerResponse::Process()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerResponse::Process()" );
+    
+    iControl.CommandInitiator().SendResponse( iActive->iStatus, 
+                                              iOperation,
+                                              iError );
+    iActive->SetActive();                       
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerLastNumberRedial::Delete
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerResponse::Delete()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerResponse::Delete()" );
+        
+    delete this;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerResponse::RequestCompleted
+// Handler for completed asynchronous calls.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerResponse::RequestCompleted( const TInt aError )
+    {
+    COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerResponse::RequestCompleted() aError=%d", aError );
+    
+    (void)aError; // avoid warning in WINSCW urel build
+    
+    // Think about adding value to TRemConExtCallHandlingApiOperationId 
+    // in RemConExtensionApi.h like "ERemConExtNoCallHandlingOperation".
+    // In this method iOperation should be set to that value.
+    iError = KErrNone;
+    }
+    
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonecmdhandler/phonecmdhnlr/src/phonehandlervoicedial.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,173 @@
+/*
+* 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:  Handles dial and speed dial key presses. 
+*
+*/
+
+
+// INCLUDE FILES
+#include    "phonehandlervoicedial.h" 
+#include    "phonehandlercontrol.h" 
+#include    "phonehandlerdebug.h" 
+#include    <RemConCallHandlingTarget.h> 
+#include    <cphcltcommandhandler.h> 
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerVoiceDial::CPhoneHandlerVoiceDial
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CPhoneHandlerVoiceDial::CPhoneHandlerVoiceDial( 
+                            CPhoneHandlerControl& aControl,
+                            TRemConExtCallHandlingApiOperationId aOperation )
+: iControl( aControl ), 
+  iOperation( aOperation )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerVoiceDial::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerVoiceDial::ConstructL()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerVoiceDial::ConstructL() start" );
+        
+    LoadServiceL();
+    
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerVoiceDial::ConstructL() end" );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerVoiceDial::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPhoneHandlerVoiceDial* CPhoneHandlerVoiceDial::NewL( 
+                            CPhoneHandlerControl& aControl, 
+                            TRemConExtCallHandlingApiOperationId aOperation )
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerVoiceDial::NewL() start" );
+        
+    CPhoneHandlerVoiceDial* self = new( ELeave ) CPhoneHandlerVoiceDial( 
+                                                    aControl, 
+                                                    aOperation );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerVoiceDial::NewL() end" );
+        
+    return self;
+    }
+
+    
+// Destructor
+CPhoneHandlerVoiceDial::~CPhoneHandlerVoiceDial()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerVoiceDial::~CPhoneHandlerVoiceDial()" );
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerVoiceDial::Process
+// Starts to process service.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerVoiceDial::Process()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerVoiceDial::Process()" );
+
+#if 0 // removed due to SCB CR PMEO-7JRFAX      
+    iCommandHandler->Bvra( GetStatus(), iControl.VoiceDialStatus() ); 
+#endif // #if 0     
+    Activate(); 
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerVoiceDial::Delete
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerVoiceDial::Delete()
+    {
+    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerVoiceDial::Delete()" );
+        
+    delete this;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneHandlerVoiceDial::RequestCompleted
+// Handler for completed asynchronous calls.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CPhoneHandlerVoiceDial::RequestCompleted( const TInt aError )
+    {
+    COM_TRACE_2( "[PHONECMDHANDLER] CPhoneHandlerVoiceDial::RequestCompleted() aError=%d, iState=%d", aError, iState );
+        
+    switch( iState )
+        {
+        case EPhoneHandlerState1:
+            {
+            NextState();
+            iControl.CommandInitiator().SendResponse( GetStatus(), 
+                                                      iOperation,
+                                                      aError );
+            Activate();
+            break;
+            }
+            
+        case EPhoneHandlerState2:
+            {
+            IdleState();
+            delete this; 
+            break;
+            }
+            
+        default:
+            {
+            COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerVoiceDial::RequestCompleted() Unspecified state" );
+            break;
+            }
+        };
+    }
+    
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File  
--- a/phonesrv.pro	Tue Jul 06 14:53:02 2010 +0300
+++ b/phonesrv.pro	Wed Jul 21 18:26:52 2010 +0300
@@ -11,7 +11,7 @@
 #
 # Contributors:
 # 
-# Description: Project file for building phonesrv components
+# Description: Project file for building phonesrv components 
 #
 #
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/cbs_mcn_client_api/inc/cbsmcncommon.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,76 @@
+/*
+* 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 file contains definitions for CBS MCN Clients.
+*
+*/
+
+
+
+#ifndef CBSMCNCOMMON_H
+#define CBSMCNCOMMON_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <s32std.h>
+
+// CONSTANTS
+
+// DATA TYPES  
+
+// MCN message max size
+const TInt KCbsMcnFullMsgSize = 1320;
+// MCN topic number max size
+const TInt KCbsTopicNumberPageSize = 5; 
+
+// Network in which current message was received in.
+enum TCbsNetworkMode
+    {
+    ECbsNetworkGsm,
+    ECbsNetworkWcdma,
+    ECbsNetworkNotDefined
+    };
+    
+    
+// Class for MCN messages over IPC
+class TCbsMcnMessage
+    {
+public:
+    TCbsMcnMessage() :  iBuffer( NULL ), 
+                        iBuffer8( NULL ), 
+                        iTopicNumber( 0 ),
+                        iNetworkMode( ECbsNetworkNotDefined ) {};
+
+public: // Data
+    // Buffer for the Mcn message.
+    TBuf<KCbsMcnFullMsgSize> iBuffer;
+
+    // 8-bit Buffer for MCN/Livecast messages
+    TBuf8<KCbsMcnFullMsgSize> iBuffer8;
+       
+    //Buffer for the Topic number of the Mcn message.
+    //TBuf<KCbsTopicNumberPageSize> iTopicNumber;
+    TUint iTopicNumber;
+
+    // Network in which current message was received
+    TCbsNetworkMode iNetworkMode;
+    };
+
+// Livecast topic range
+const TUint KCbsLivecastTopicMin = 40960;
+const TUint KCbsLivecastTopicMax = 45055;
+
+#endif      // CBSMCNCOMMON_H   
+            
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/cbs_mcn_client_api/inc/cbsmcnpanic.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CbsMcnPanic class.
+*
+*/
+
+
+#ifndef __CBSMCNPANIC_H
+#define __CBSMCNPANIC_H
+
+//  CONSTANTS  
+
+enum TCbsMcnPanics
+	{
+	EMcnObserverNull,
+	EMcnObserversNull,
+    EMcnNotConnected
+	};
+
+//  FUNCTION PROTOTYPES  
+
+GLDEF_C void CbsMcnPanic( TInt aPanic );
+
+#endif // __CBSMCNPANIC_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/cbs_mcn_client_api/inc/ccbsmcnlistener.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,99 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCbsMcnListener class.
+*
+*/
+
+
+#ifndef CCBSMCNLISTENER_H
+#define CCBSMCNLISTENER_H
+
+//  INCLUDES
+#include <e32base.h>    // CActive
+#include <cbsmcncommon.h>
+
+//  FORWARD DECLARATIONS
+class CMcn;
+class RCbsMcnSession;
+
+//  CLASS DECLARATION
+
+/**
+*   Listens for incoming MCN messages. Functionality is based on basic
+*   active object implementation.
+*/
+class CCbsMcnListener 
+    : public CActive
+    {
+public:             // New functions
+    /**
+    * Creates a new Mcn listener.
+    * @return A new CCbsMcnListener instance.
+    */
+    static CCbsMcnListener* NewL( CMcn& aMcn, RCbsMcnSession& aSession );
+    
+    /**
+    * Destructor.
+    */
+    ~CCbsMcnListener();
+
+private:             // From CActive
+
+    /**
+    * This method is called when an Mcn message is received.
+    * The message is stored in the buffer.
+    */
+    void RunL();
+
+    /**
+    * Cancels the outstanding Mcn request.
+    */
+    void DoCancel();
+
+private:
+    /**
+        Constructor.
+    */
+    CCbsMcnListener( CMcn& aMcn, RCbsMcnSession& aSession );
+
+    /**
+    * 2nd-phase constructor.
+    */
+    void ConstructL();
+
+    /**
+    * Receive an Mcn message from network.
+    */
+    void Receive();
+
+private:            // Data
+
+    // The Mcn client to use for reception.
+    CMcn& iMcn;
+
+    // Session to the Mcn client.
+    RCbsMcnSession& iSession;
+
+    // MCN message for IPC
+    TCbsMcnMessage iMcnMessage;
+
+    // Package for MCN message
+    TPckg<TCbsMcnMessage> iMcnPckg;
+    };
+
+#endif      // CCBSMCNLISTENER_H
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/cbs_mcn_client_api/inc/cmcn.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,225 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 Cmcn class.
+*    
+*                This header file presents an API which allows a client to
+*                subscribe a number of CB topics from CbsServer. The client
+*                receives a notification, if a message belonging to a subscribed
+*                topic is received.
+*
+*/
+
+
+
+#ifndef CMCN_H
+#define CMCN_H
+
+// INCLUDES
+#include "e32base.h"
+#include <rcbsmcnsession.h>
+
+// CONSTANTS
+// Maximum length of a MCN message.
+const TInt KCbsMcnMessageMaxLength = 93;
+
+// DATA TYPES  
+typedef TBuf< KCbsMcnMessageMaxLength > TMcnMessage;
+
+// FORWARD DECLARATIONS
+class MCbsMcnObserver;
+class CCbsMcnListener;
+class RCbsMcnSession;
+class CMcnTopicArray;
+
+// CLASS DECLARATION
+
+/**
+*   Client must first connect to the server and then register 
+*   a MCbsMcnObserver-derived class to receive notifications
+*   when MCN messages are received from the network.
+*
+*   Registration to CbsServer is not required to retrieve
+*   the current cell info message.
+*    
+*   In the example below, the client has implemented the class MCbsMcnObserver
+*   in class CCbsMcnObserver. First, the client establishes a session
+*   with CbsServer. The subscribed topics are specified with a CMcnTopicArray
+*   instance. 
+*
+*   Example:
+*
+*   // Establish the session.
+*   CMcn* session = CMcn::NewL();
+*   CleanupStack::PushL( session );
+*
+*   // Specify topics with CMcnTopicArray.
+*   CMcnTopicArray* topics = CMcnTopicArray::NewL();
+*   topics->AddCbTopicL( 50 );      // District info (cell info)
+*   topics->AddCbTopicL( 0 );       // CB index messages
+*
+*   // Register. Parameter observer is an instance of CCbsMcnObserver.
+*   session->RegisterL( observer, topics );
+*   delete topics;
+*
+*   // Get current MCN state.
+*   TMcnMessage mcnInfo;
+*   TInt result( session->GetCellInfo( mcnInfo ) );
+*   if ( result != KErrNone )
+*       {
+*       // mcnInfo contains the current MCN message.
+*       }
+*   
+*   // Observer's CellInfoChanged() gets called if MCN state changes.
+*   // Note that the active scheduler must be running here.
+*
+*   // Terminate session.
+*   session->Unregister( observer );
+*   CleanupStack::PopAndDestroy(); // session, gets closed when deleted
+*
+*/
+class CMcn 
+    : public CBase
+    {
+public:             // New functions
+    /**
+    *   Instantiates new CMcn object and establishes a session with
+    *   CBS server. 
+    *   
+    *   If connecting to CBS server fails, the function leaves with 
+    *   the leave code of RSessionBase::CreateSession().
+    *
+    *   Active scheduler has to be installed prior to calling this function.
+    *
+    *   @return                     A new instance of CMcn
+    */
+    IMPORT_C static CMcn* NewL();
+
+    /**
+    *   Destructor. Also closes CbsServer session.
+    */
+    IMPORT_C ~CMcn();
+
+    /**
+    *   Registers an observer to CBS server. The observer is notified when
+    *   a MCN message is received from the network.
+    *   The caller is also required to provide an array containing numbers
+    *   of subscribed topics.
+    *
+    *   Parameter aArray may contain topic number entry duplicates.
+    *   Topics may be in any order.
+    *
+    *   Leave codes indicate an error accessing EPOC Telephony Sever.
+    *   In this case, the leave code is the same returned by EPOC Telephony Sever.
+    *
+    *   @param  aObserver           Observer implemented by the client
+    *   @param  aArray              List of relayed topics
+    */
+    IMPORT_C void RegisterL( MCbsMcnObserver* aObserver, 
+        const CMcnTopicArray& aArray );
+
+    /**
+    *   Unregisters a previously registered MCN observer clearing
+    *   any topic subscriptions of this client in CBS server.
+    *
+    *   Panics if the observer specified was not registered.
+    *
+    *   @param  aObserver           Observer implemented by the client
+    */
+    IMPORT_C void Unregister( MCbsMcnObserver* aObserver );
+
+    /**
+    *   Retrieves the current MCN message (Cell Info, topic 050) from CBS 
+    *   server. A new MCN message always overwrites the previous one in CBS
+    *   server, no buffering is done. Note that this function may be
+    *   only used to retrieve cell info messages.
+    *
+    *   Return codes:
+    *   KErrNone        aMcnMessage contains the current, valid MCN message.
+    *   KErrNotFound    CbsServer has not yet received a MCN message.
+    *                   Content of aMcnMessage must be ignored.
+    *
+    *   @param  aMcnMessage         Returns the current MCN message.
+    *   @return                     Result code
+    */
+    IMPORT_C TInt GetCellInfo( TDes& aMcnMessage ) const;
+
+private:    // new functions
+    /**
+    *   Default constructor.
+    */
+    CMcn();
+
+    /**
+    *   2nd-phase constructor
+    */
+    void ConstructL();    
+
+    /** 
+    *   Relays aMcnMessage to the registered observers.
+    *   Used by a friend class CCbsMcnListener instance
+    *
+    *   @param  aMcnMessage         Received CB message from CbsServer    
+    */    
+    void RelayMessage( TCbsMcnMessage& aMcnMessage );    
+
+private:    // friend classes
+    /// Allows use of RelayMessageL().
+    friend class CCbsMcnListener;
+
+private:    // prohibited functions and operators 
+    /// Copy constructor.
+    CMcn( const CMcn& );
+
+    /// Assignment operator
+    CMcn& operator=( const CMcn& );
+
+private:  // Data
+    /**
+    *   Own: Active object responsible for responding to server-initiated
+    *   notification indicating that a message has arrived from
+    *   the CbsServer.
+    */
+    CCbsMcnListener* iMcnListener;
+
+    /// Own: Dynamic array containing the registered observers.
+    CArrayPtrFlat< MCbsMcnObserver >* iObservers;
+
+    /// CbsServer session object.
+    RCbsMcnSession iSession;
+
+public:
+
+    /**
+    *   Retrieves the current info message (e.g. HomeZone, topic 221) from CBS 
+    *   server. A new info message always overwrites the previous one in CBS
+    *   server, no buffering is done. Note that this function may be
+    *   only used to retrieve cell info messages.
+    *
+    *   Return codes:
+    *   KErrNone        aInfoMessage contains the current, valid info message.
+    *   KErrNotFound    CbsServer has not yet received a info message.
+    *                   Content of aInfoMessage must be ignored.
+    *
+    *   @param  aInfoMessage    Returns the current info message.
+    *   @param  aTopicNumber    Number of the topic
+    *   @return                 Result code
+    */
+    IMPORT_C TInt GetInfoMessage( TDes& aInfoMessage, TInt aTopicNumber ) const;
+    };
+
+#endif // CMCN_H
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/cbs_mcn_client_api/inc/cmcntopicarray.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,107 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CMcnTopicArray class.
+*
+*                CMcnTopicArray represents a list containing the numbers of CB topics which
+*                a MCN client to CbsServer has subscribed.
+*
+*/
+
+
+
+#ifndef CMCNTOPICARRAY_H
+#define CMCNTOPICARRAY_H
+
+//  INCLUDES
+
+#include "e32base.h"
+
+//  CLASS DECLARATION
+
+/**
+*      CMcnTopicArray represents a list containing the numbers of CB topics which
+*      a MCN client to CbsServer has subscribed.
+*/
+class CMcnTopicArray 
+    : public CBase
+    {
+public:     // New functions
+
+    /**
+    *   Returns a new instance of CMcnTopicArray, initially empty.
+    */
+    IMPORT_C static CMcnTopicArray* NewL();
+
+    /** 
+    *   Destructor. 
+    */
+    ~CMcnTopicArray();
+
+    /**
+    *   Adds a single CB topic to the topic list.
+    *   Leaves with KErrArgument if the topic number is not in
+    *   valid range. In this implementation, all values
+    *   are accepted.
+    *
+    *   Leave reasons:
+    *       KErrArgument, aTopicNumber not in valid range..
+    *       KErrNoMemory, Out-of-memory occured.
+    *
+    *   @param aTopicNumber Number of subscribed CB topic.
+    */
+    IMPORT_C void AddCbTopicL( TUint16 aTopicNumber );
+
+    /**
+    *   Returns the number of topic entries in parameter aEntries.
+    *   
+    *   @param aEntries  The number of topic entires
+    */
+    void EnumerateEntries( TUint& aEntries ) const;
+
+    /**
+    *   Returns the number of topic in aTopicNumber corresponding to the index
+    *   given in aIndex.
+    *
+    *   @param aIndex   Index of the topic number.
+    *   @param aTopicNumber   Topic number corresponding to the given index. 
+    */
+    IMPORT_C void GetTopicNumber( const TUint& aIndex, TUint& aTopicNumber ) const;
+
+private:
+    /// Prohibited copy constructor (not implemented).
+    CMcnTopicArray( const CMcnTopicArray& aArray );
+
+    /// Prohibited assignment operator (not implemented).
+    CMcnTopicArray& operator=( const CMcnTopicArray& aArray );
+
+    /**
+    *   Default constructor.
+    */
+    CMcnTopicArray();
+
+    /**
+    *   2nd-phase constructor.
+    */
+    void ConstructL();
+
+private:    // data
+    /// Own: contains the list of subscribed topics.
+    CArrayFixFlat< TUint >* iTopicList;
+    };
+
+#endif      // __CMCNTOPICARRAY_H
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/cbs_mcn_client_api/inc/mcbsmcnobserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 MCbsMcnObserver class.
+*
+*                MCbsMcnObserver is a mix-in class, which must be implemented
+*                by a MCN client class. 
+*
+*                The sole method of this interface gets called when the MCN state
+*                changes. This occurs when a MCN message is received from network
+*                and the cell information relayed by the message differs from 
+*                the previous cell information.
+*
+*/
+
+
+
+#ifndef MCBSMCNOBSERVER_H
+#define MCBSMCNOBSERVER_H
+
+// FORWARD DECLARATIONS
+class TCbsMcnMessage;
+
+//  CLASS DECLARATION
+
+/**
+*   An interface class for MCN observers.
+*
+*   A class on the client side is required to derive from this class
+*   and register itself to an instance of CMcn.
+*/
+class MCbsMcnObserver
+    {
+public:             // New functions
+
+    /**
+    *   This method is called when a message of a subscribed topic 
+    *   is received from the network.
+    *
+    *   @param  aMcnMessage         MCN message received from the network.
+    *   @return                     Result code
+    */
+    virtual TInt CellInfoChanged( const TCbsMcnMessage& aMcnMessage ) = 0;    
+    
+    /**
+    *   Virtual destructor.
+    */
+    virtual ~MCbsMcnObserver() {};
+
+    };
+
+#endif      // __MCBSMCNOBSERVER_H
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/cbs_mcn_client_api/inc/rcbsmcnsession.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,159 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 RCbsMcnSession class.
+*
+*                Represents a MCN session to CBS Server. 
+*                A client can register to the session to be informed of 
+*                arrival of a new MCN message. Registering object must
+*                implement interface MCbsMcnObserver.
+*   
+*                This session class is responsible for opening the MCN session
+*                and querying the current cell information message from CbsServer.
+*                Other MCN requests are processed by the subsession class 
+*                RMcnSubSession.
+*
+*/
+
+
+
+#ifndef RCBSMCNSESSION_H
+#define RCBSMCNSESSION_H
+
+//  INCLUDES
+
+#include <e32std.h>
+#include <e32base.h>    // CArrayPtrFlat
+#include <rmcnsubsession.h>
+
+//  FORWARD DECLARATIONS
+
+class MCbsMcnObserver;
+class CCbsMcnListener;
+class CMcnTopicArray;
+
+//  CLASS DECLARATION
+
+/**
+*   This class represents a MCN session to the CBS server.
+*/
+class RCbsMcnSession 
+    : public RSessionBase
+    {
+public:             // New functions
+    /**
+    *   Constructor
+    */
+    RCbsMcnSession();
+
+    /**
+    *   Destructor
+    */
+    ~RCbsMcnSession();
+
+    /**
+    *   Retrieves the current MCN message from CBS server.
+    *   An arriving MCN message always overwrites the previous one in CBS
+    *   server, no buffering is done.
+    *
+    *   @param  aMcnMessage         Returns the current MCN message.
+    *   @return                     Result code from server.
+    */
+    TInt GetCellInfo( TDes& aMcnMessage ) const;
+
+    /**
+    *   Retrieves the current info message from CBS server.
+    *   
+    *   @param  aMessage        Returns the current info message from the
+    *                           specified topic.
+    *   @param  aTopicNumber    Number of the topic that the msg belongs to.
+    *   @return                 Result code from server.
+    */
+    TInt GetInfoMessage( TDes& aMessage, const TInt aTopicNumber ) const;
+
+    /**
+    *   Request next subscribed MCN message to be delivered to this session.
+    *   Passed to the subsession object.
+    *
+    *   The delivered message will be copied into aBuffer.
+    *
+    *   @param  aStatus             Request status, indicates the result of 
+    *                               the operation.
+    *   @param  aMcnPckg            MCN message package, 
+    *                               includes msg and parameters
+    */ 
+    void ReadMcnMessage( TRequestStatus& aStatus, TPckg<TCbsMcnMessage>& aMcnPckg ); 
+    
+    /**
+    *   Cancels an outstanding request. Passed to the subsession object.
+    *
+    *   @return                     Result code from server.
+    */
+    TInt ReadMcnMessageCancel();
+
+    /**
+    *   Subscribes topics given in aArray. Passed to the subsession object.
+    *
+    *   For leave reasons, see RMcnSubSession.
+    *
+    *   @param  aArray              Subscribed topics.
+    */
+    void RegisterL( const CMcnTopicArray& aArray );
+
+    /**
+    *   Clears all topic subscriptions of this session in CbsServer.
+    *
+    *   Leaves if server reports an error.
+    */
+    void ClearSubscriptionsL();
+
+public:             // From RSessionBase
+    /**
+    *   Establishes a connection with CbsServer.
+    *
+    *   @return                     Result code indicating the success of 
+    *                               operation.
+    */
+    TInt Connect();
+
+    /**
+    *   Closes the connection with CbsServer.
+    */
+    void Close();
+
+    /**
+    *   Returns version information of this dll.
+    */
+    TVersion Version() const;
+
+private:            // Prohibited operators and methods
+    /// Assignment operator.
+    RCbsMcnSession& operator=( const RCbsMcnSession& );
+
+    /// Copy constructor.
+    RCbsMcnSession( const RCbsMcnSession& );
+
+private:            // Data
+    /// Represents MCN subsession
+    RMcnSubSession iSubSession;
+
+    /// ETrue, if a connection has been established. 
+    TBool iConnected;
+
+    };
+
+#endif      // __RCBSMCNSESSION_H
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/cbs_mcn_client_api/inc/rmcnsubsession.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 RMcnSubSession class.
+*
+*                Client-side MCN Subsession. Responsible for specifying topics
+*                to route and posting a routing request at CbsServer.
+*
+*/
+
+
+#ifndef RMCNSUBSESSION_H
+#define RMCNSUBSESSION_H
+
+// INCLUDES
+#include "cbsmcncommon.h"
+
+//  FORWARD DECLARATIONS
+class CMcnTopicArray;
+class RCbsMcnSession;
+
+//  CLASS DECLARATION
+
+/**
+*   This class represents a MCN session with CBS server.
+*/
+class RMcnSubSession 
+    : public RSubSessionBase
+    {
+public:             // New functions
+    /**
+    *   Constructor.
+    */
+    RMcnSubSession();
+
+    /**
+    *   Destructor.
+    */
+    ~RMcnSubSession();
+
+    /**
+    *   Creates a MCN subsession to CbsServer. 
+    *
+    *   @param  aMcnSession    Open MCN session
+    *   @return                Result code
+    */
+    TInt Open( RCbsMcnSession& aMcnSession );
+    
+    /**
+    *   Closes the subsession.
+    *
+    *   @return  Result code
+    */
+    TInt Close();
+    
+    /**
+    *   Request next subscribed MCN message to be delivered to this session.
+    *
+    *   The delivered message will be copied into aBuffer.
+    *
+    *   @param  aStatus             Request status, indicates the result of 
+    *                               the operation.
+    *   @param  aMcnPckg            MCN message package, 
+    *                               includes msg and parameters
+    */    
+    void ReadMcnMessage( TRequestStatus& aStatus, TPckg<TCbsMcnMessage>& aMcnPckg );     
+
+    /**
+    *   Cancels an outstanding request.
+    *
+    *   @return   Result code from server.
+    */
+    TInt ReadMcnMessageCancel();
+
+    /**
+    *   Subscribes topics given in aArray.
+    *
+    *   Leave reasons:
+    *   KErrNoMemory    Client- or server-side out-of-memory.
+    *   Others          Leave occured while accessing EPOC Telephony Sever.
+    *                   In this case, the leave reason from EPOC Telephony Sever
+    *                   is returned here.
+    *
+    *   @param  aArray   Subscribed topics.
+    */
+    void RegisterL( const CMcnTopicArray& aArray );
+
+    /**
+    *   Clears topic subscriptions of this session in CbsServer
+    *   
+    *   Leaves if server reports any error.
+    */  
+    void ClearSubscriptionsL();
+
+private:            // Prohibited operators and methods
+    /// Assignment operator.
+    RMcnSubSession& operator=( const RMcnSubSession& );
+    
+    /// Copy constructor.
+    RMcnSubSession( const RMcnSubSession& );
+
+private:            // Data
+    /// ETrue, if a connection has been established. 
+    TBool iConnected;
+    };
+
+#endif      // RMCNSubSession_H
+            
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/dial_utils_api/inc/dialutils.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,89 @@
+/*
+* 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:  API for DialUtils usage.
+*
+*/
+
+
+#ifndef DIALUTILS_H
+#define DIALUTILS_H
+
+
+//  INCLUDES
+#include <e32base.h>
+
+
+// CLASS DECLARATION
+
+/**
+*  The API for DialUtils usage.
+*
+*  @lib DialUtils.lib
+*  @since 2.6
+*/
+class CDialUtilsApi 
+:   public CBase
+    {
+    public: // New functions
+
+        /**
+        * Check and if needed modify the given phone number according to
+        * current configuration and location. Currently supports:
+        * 1) Japan prefix modifications.
+        * 
+        * @param aPhoneNumber The phone number to be checked and modified.
+        * @return - KErrNone if successful,
+        *         - KErrOverflow if the aPhoneNumber is too short for the 
+        *           combined original phone number + prefix number,
+        *         - Symbian error code otherwise.
+        *         In error case the aPhoneNumber is untouched.
+        */
+        virtual TInt CheckNumber( HBufC& aPhoneNumber ) = 0;
+    };
+
+
+
+/**
+*  Interface for DialUtils creation.
+*
+*  @lib DialUtils.lib
+*  @since 2.6
+*/
+class CDialUtilsFactory
+:   public CBase
+    {
+    public:
+
+        /**
+        * Creates DialUtils.
+        * CDialUtilsFactory instance is deleted even in leave case.
+        * 
+        * @return CDialUtilsApi implementation. NULL if not supported.
+        *         Ownership transferred.
+        */
+        virtual CDialUtilsApi* CDialUtilsApiLD() = 0;
+
+    };
+
+/**
+* Only exported function. This is in index 1 in the lookup table.
+* Call this function to create CDialUtilsFactory instance.
+* 
+* IMPORT_C CDialUtilsFactory* CreateDialUtilsFactoryL();
+*/ 
+
+
+#endif   // DIALUTILS_H
+
+// End of File
--- a/phonesrv_plat/dialpad_api/inc/dialpad.h	Tue Jul 06 14:53:02 2010 +0300
+++ b/phonesrv_plat/dialpad_api/inc/dialpad.h	Wed Jul 21 18:26:52 2010 +0300
@@ -64,6 +64,8 @@
     void paint(QPainter* painter,
                const QStyleOptionGraphicsItem* option,
                QWidget* widget);
+
+    void changeEvent(QEvent *event);
                
     void showEvent(QShowEvent *event);
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/network_handling_engine_api/inc/cnwsession.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* 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:  Interface class for Networkhandling
+*
+*/
+
+
+#ifndef CNWSESSION_H
+#define CNWSESSION_H
+
+//  INCLUDES
+#include "nwhandlingengine.h" 
+
+
+// CLASS DECLARATION
+/**
+*  Interface class for Networkhandling
+*  
+*
+*  @lib networkhandling.lib
+*  @since Series 60_2.8
+*/
+class CNWSession : public CBase
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Destructor.
+        */
+        IMPORT_C virtual ~CNWSession();
+
+
+    protected:
+
+        /**
+        * C++ default constructor.
+        */
+        CNWSession();
+
+    };
+
+#endif    // CNWSession_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/network_handling_engine_api/inc/networkhandlingproxy.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This file contains the header file of the class NetworkHandlingProxy.
+*
+*/
+
+
+#ifndef NETWORKHANDLINGPROXY_H
+#define NETWORKHANDLINGPROXY_H
+
+//  INCLUDES
+#include "nwhandlingengine.h" 
+
+
+// FORWARD DECLARATIONS
+class CNWSession;
+class MNWMessageObserver;
+
+    
+        /**
+        *  Creates protocol specific Network handling.
+        *  @param 
+        *  @param 
+        *  @return networkHandling: Instance of the NetworkHandling
+        */
+        IMPORT_C CNWSession* CreateL( MNWMessageObserver& aMessage,
+                                     TNWInfo& aTNWInfo );
+
+
+
+#endif      // NetworkHandlingProxy_H  
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/network_handling_engine_api/inc/nwhandlingengine.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,297 @@
+/*
+* 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:  This file defines the interface of the Network Handling
+*
+*/
+
+
+
+#ifndef NWHandlingEngine_H
+#define NWHandlingEngine_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <rmmcustomapi.h> 
+#include <etelpckt.h> // for RPacketService::TDynamicCapsFlags
+
+
+// CONSTANTS
+// Max length of network country code.
+const TInt KNWCountryCodeLength = 4; // This value is defined in multimode etel definition document.
+// Max length of network identity code.
+const TInt KNWIdentityLength = 8; // This value is defined in multimode etel definition document.
+// Max length of network display alpha tag
+const TInt KNWDisplayTagLength = 30;   // New EtelMM API defition describe this value to be 32, but etelmm.h contains value 30. 
+// Max length of network short name.
+const TInt KNWShortNameLength = 10; // New EtelMM API defition describe this value to be 8, but etelmm.h contains value 10. 
+// Max length of network long name.
+const TInt KNWLongNameLength = 20; // New EtelMM API defition describe this value to be 16, but etelmm.h contains value 20. 
+// Max length of service provider name.
+const TInt KNWServiceProviderNameLength = 16;
+// Max length of network provider name.
+const TInt KNWProviderNameLength = 25;
+// Max length of MCN name.
+const TInt KNWMCNNameLength = 20;
+// Max length of VIAG text tag
+const TInt KNWViagTextTagLength = 13;
+// Max length of PLMN field
+const TInt KNWPLMNFieldLength = 251;
+
+
+// DATA TYPES
+// MCN name
+typedef TBuf<KNWMCNNameLength> TNWMCNName;
+// Viag text tag
+typedef TBuf<KNWViagTextTagLength> TNWViagTextTag;
+// MCC in GSM and TDMA
+typedef TBuf<KNWCountryCodeLength> TNWCountryCode;
+// MNC in GSM and SID in TDMA
+typedef TBuf<KNWIdentityLength> TNWIdentity;
+// Network Alpha-tag
+typedef TBuf<KNWDisplayTagLength> TNWDisplayTag;
+// The short name of the network operator
+typedef TBuf<KNWShortNameLength> TNWShortName;
+// The long name of the network operator
+typedef TBuf<KNWLongNameLength> TNWLongName;
+// Service provider name
+typedef TBuf<KNWServiceProviderNameLength> TNWServiceProviderName;
+// The PLMN Field
+typedef TBuf<KNWPLMNFieldLength> TNWPLMNField;
+// Network provider name
+typedef TBuf<KNWProviderNameLength> TNWProviderName;
+// The Programmable Operator Name type.
+typedef RMmCustomAPI::TOperatorNameInfo TNWOperatorNameInfo;
+// Display of the registered PLMN. 
+typedef TUint32 TNWDisplayRequirementsFlags;
+
+
+enum TNWRegistrationStatus
+    {
+    ENWRegistrationUnknown,
+    ENWNotRegisteredNoService,
+    ENWNotRegisteredEmergencyOnly,
+    ENWNotRegisteredSearching,
+    ENWRegisteredBusy,
+    ENWRegisteredOnHomeNetwork,
+    ENWRegistrationDenied,
+    ENWRegisteredRoaming
+    };
+
+enum TNWMode
+    {
+    ENWModeUnknown,
+    ENWModeUnregistered,
+    ENWModeGsm,
+    ENWModeAmps,
+    ENWModeCdma95,
+    ENWModeCdma2000,
+    ENWModeWcdma,
+    ENWModeTdcdma
+    };
+
+enum TNWStatus
+    {
+    ENWStatusUnknown,
+    ENWStatusAvailable,
+    ENWStatusCurrent,
+    ENWStatusForbidden
+    };
+
+enum TNWDisplayRequirements
+    {
+    ENWDisplayPLMNNotRequired = 0x00000001,
+    ENWDisplayPLMNRequired = 0x00000002,
+    ENWDisplaySPNRequired = 0x00000004,
+    ENWDisplaySPNNotRequired = 0x00000008
+    };
+
+enum TNWViagIndicatorType //enum for viag indicator type
+    {
+    ENWViagIndicatorTypeNone,
+    ENWViagIndicatorTypeHomeZone,
+    ENWViagIndicatorTypeCityZone
+    };
+
+enum TNWMCNIndicatorType //enum for mcn indicator type
+    {
+    ENWMCNIndicatorTypeNone,
+    ENWMCNIndicatorTypeActive
+    };
+
+// CDMA enumerations for TNWInfo
+enum TNWNoServiceMode
+    {
+    ENWNotRegisteredOutOfRange,
+    ENWNotRegisteredPowerSaveMode
+    };
+
+// CDMA enumerations for TNWInfo
+enum TNWVoicePrivacyStatus
+    {
+    ENWVoicePrivacyStatusOff,
+    ENWVoicePrivacyStatusOn,
+    ENWVoicePrivacyStatusUnknown
+    };
+
+enum TNWRead
+    {
+    ESPNEFRead,
+    ENPNEFRead,
+    EProgEFRead,
+    EViagEFRead,
+    EFullFileChange
+    };
+
+#ifdef RD_PHONE_NG
+enum TNWNetworkSelectionSetting
+    {
+    ENWNetworkSelectionUnknown,
+    ENWNetworkSelectionAutomatic,
+    ENWNetworkSelectionManual
+    };    
+#endif // RD_PHONE_RG
+// CLASS DECLARATION
+
+//Network info definition
+struct TNWInfo
+    {
+    TNWRegistrationStatus iRegistrationStatus;              // Network registration status
+    TNWMode iNetworkMode;                                   // Mode of the network
+    TNWStatus iStatus;                                      // Status of the Network
+    TNWCountryCode iCountryCode;                            // MCC in GSM and TDMA 
+    TNWIdentity iNetworkId;                                 // MNC in GSM and SID in TDMA
+    TNWDisplayTag iDisplayTag;                              // Network Alpha-tag
+    TNWShortName iShortName;                                // The short name of the operator
+    TNWLongName iLongName;                                  // The long name of the operator
+    TNWViagIndicatorType iViagIndicatorType;                // Zone indicator type
+    TNWViagTextTag iViagTextTag;                            // Viag text tag
+    TNWMCNIndicatorType iMCNIndicatorType;                  // MCN indicator type
+    TNWMCNName iMCNName;                                    // MCN name
+    TNWServiceProviderName iSPName;                         // Service provider name
+    TNWDisplayRequirementsFlags iServiceProviderNameDisplayReq; // Service provider name display required
+    TNWProviderName iNPName;                                // Network provider name
+    TNWOperatorNameInfo iOperatorNameInfo;                  // Operator name
+    TNWNoServiceMode iNoServerMode;                         // 
+    TNWVoicePrivacyStatus iVoicePrivacyStatus;              // Voice Privacy Status
+    TNWPLMNField iPLMNField;                                // Contains a number of PLMN network names coded as TLV objects
+#ifdef RD_PHONE_NG
+    TNWNetworkSelectionSetting iSelectionSetting;           // Contains a network selection setting manual/automatic etc.
+#endif // RD_PHONE_NG
+    RPacketService::TDynamicCapsFlags iDynamicCapsFlags;    // Dynamic packet data capabilities 
+                                                            // (used to hide alpha tag when CS registration is unsuccessful)
+    };
+
+// CLASS DECLARATION
+
+/**
+*  Offers message interface from network handling to client
+*  
+*  @lib networkhandling.lib
+*  @since Series 60_2.8
+*/
+class MNWMessageObserver
+    {
+    public:
+
+        enum TNWMessages
+            {
+            // COMMON NETWORK MESSAGES                      0 - 99
+
+            // Message will be sent when current network information changed
+            ENWMessageNetworkInfoChange,
+            // Message will be sent when network mode changed (e.g.Gsm to Wcdma )
+            ENWMessageNetworkModeChange,
+            // Message will be sent when network registration status changed
+            ENWMessageNetworkRegistrationStatusChange,
+            // Message will be sent when programmable operator name changed
+            ENWMessageProgrammableOperatorInfoChange,
+            // Message will be sent when network provider changed
+            ENWMessageNetworkProviderNameChange,
+            // Message will be sent when service provider changed
+            ENWMessageServiceProviderNameChange,
+            // Message will be sent when NW starts update Operator Name Info
+            ENWMessageProgrammableOperatorInfoUpdating,
+            // Message will be sent when NW starts update Network Service Provider Name
+            ENWMessageNetworkProviderNameUpdating,
+            // Message will be sent when NW starts update Service Provider Name
+            ENWMessageServiceProviderNameUpdating,
+            // Message will be sent when allow refresh is called.
+            ENWMessageAllowRefresh,
+            // Message will be sent when networkSelection setting changed
+#ifdef RD_PHONE_NG
+            ENWMessageNetworkSelectionSettingChange,
+#endif // RD_PHONE_NG
+
+            // GSM SPECIFIC MESSAGES                        100 - 199
+
+            // Message will be sent when cell re-selection occured
+            ENWMessageNetworkCellReselection              = 100,
+            // Message will be sent when network connection failured
+            ENWMessageNetworkConnectionFailure,
+            // Message will be sent when MCN CBS message was reveived
+            ENWMessageCurrentCellInfoMessage,
+            // Message will be sent when Viag CBS message was reveived
+            // and completely handled.
+            ENWMessageCurrentHomeZoneMessage,
+            // Message will be sent when cell info display changed
+            ENWMessageNetworkIndicatorChange, 
+            // Message will be sent when dynamic packet data capabilities change
+            // (Used to hide alpha tag when CS registration is unsuccessful)
+            ENWMessageDynamicCapsChange,
+
+            // CDMA SPECIFIC MESSAGES                       200 - 299
+
+            ENWMessageNetworkEmergencyMode                = 200,
+            ENWMessageVoicePrivacyStatusChange,
+            ENWMessageStartSystemSearchRequestCompleteOk,
+            ENWMessageStartSystemSearchRequestCompleteFail,
+            ENWMessageStopProtocolStackRequestCompleteOk,
+            ENWMessageStopProtocolStackRequestCompleteFail
+
+           };
+
+        enum TNWOperation
+            {
+            ENWNone,
+            // Fetching Service Provider Name
+            ENWGetServiceProviderName,
+            // Fetching Network Provider Name
+            ENWGetNetworkProviderName,
+            // Fetching Programmable Operator Name
+            ENWGetProgrammableOperatorName,
+            // Notifying network registration status change
+            ENWNotifyNetworkRegistrationStatusChange
+            };
+
+        /**
+        * Offers message interface to the client
+        * @param aMessage 
+        * This methods execute time must be short,since code 
+        * starting to run from RunL.
+        */
+        virtual void HandleNetworkMessage( const TNWMessages aMessage ) = 0;
+
+        /**
+        * Offers error message interface to the client
+        * @param aOperation operation which failed
+        * @param aErrorCode returned Symbian OS error code
+        * 
+        */
+        virtual void HandleNetworkError( const TNWOperation aOperation, TInt aErrorCode ) = 0;
+    };
+
+
+#endif      // NWHandlingEngine_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_client_api/inc/phclttypes.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,73 @@
+/*
+* 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:  Types used in PhoneClient.
+*
+*/
+
+
+#ifndef PHCLTTYPES_H
+#define PHCLTTYPES_H
+
+
+
+// INCLUDES
+#include <e32base.h>
+#ifdef SYMBIAN_OLD_EXPORT_LOCATION // Include should be removed when flag disabled from builds
+#include <cntdef.h>
+#endif
+#include <etelmm.h>
+
+#include <data_caging_path_literals.hrh>
+
+// CONSTANTS
+
+// Lengths of various strings.
+const TInt KPhCltTelephoneNumberLength = 100;  // Telephony number length.
+const TInt KPhCltNameBufferLength = 50;       // The name length.
+const TInt KPhCltSubAddressLength = 21;       // The subaddress length, see
+                                              // ITU-T I.330 and 3GPP TS 11.14.
+const TInt KPhCltBearerLength = 14;           // The bearer length.
+const TInt KPhCltUUILength = 129;             // Max user to user info length
+
+/**
+* Call type.
+*/
+enum TPhCltCallType
+    {
+    EPhCltVoice       = 0, // Voice call.
+    EPhCltVideo       = 1, // Video call.
+    EPhCltForcedVideo = 2,  // Forced video call.
+    EPhCltCallVoIP    = 3 // Internet call
+    };
+
+
+// Type for telephone number.
+typedef TBuf< KPhCltTelephoneNumberLength > TPhCltTelephoneNumber;
+
+// Type for name.
+typedef TBuf< KPhCltNameBufferLength > TPhCltNameBuffer;
+
+
+// Type for result of call.
+typedef TInt TPhCltPhoneResults;
+
+// Type for calling party subaddress.
+typedef TBuf< KPhCltSubAddressLength > TPhCltSubAddress;
+
+// Type for bearer capability.
+typedef TBuf8< KPhCltBearerLength > TPhCltBearerCapability;
+
+#endif      // PHCLTTYPES_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_client_api/inc/rphcltserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,128 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  It is the client side remote class of phone server session.
+*
+*/
+
+
+#ifndef RPHCLTSERVER_H
+#define RPHCLTSERVER_H
+
+
+//  INCLUDES
+#include <e32std.h>
+#include    <phclttypes.h> 
+
+// CONSTANTS
+// A version must be specified when creating a session with the server
+// These are the version numbers for PhoneServer.
+const TUint KPhoneServerMajorVersionNumber = 0;
+const TUint KPhoneServerMinorVersionNumber = 1;
+const TUint KPhoneServerBuildVersionNumber = 1;
+
+// Default amount of message slots.
+const TInt KPhCltDefaultMessageSlots = 4;
+
+// DATA TYPES
+
+// PhoneClient panic codes visible to the user.
+enum TPhCltClientSidePanics
+    {
+    EPhCltClientSidePanicNullHandle = 0, // Handle was NULL
+    //
+    EPhCltClientSidePanicLast            // Keep as last enum value.
+    };
+
+
+// CLASS DECLARATION
+
+/**
+*  It is the client side remote class of phone server session.
+*
+*  @lib phoneclient.lib
+*  @since 1.0
+*/
+class RPhCltServer : public RSessionBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * C++ constructor.
+        */
+        IMPORT_C RPhCltServer();
+       
+    public:  // New functions
+
+        /**
+        * Returns the version of the API.
+        *
+        * @return Returns the version encapsulated in TVersion object.
+        */
+        TVersion Version() const;
+
+        /**
+        * Creates connection to the server.
+        * 
+        * @param aMessageSlots It tells the amount of message slots to be used
+        *                      for the connection.
+        * @return Returns error code.
+        */
+        IMPORT_C TInt Connect( TInt aMessageSlots = KPhCltDefaultMessageSlots );
+
+        /**
+        * Creates all submodules in Phone Server side.
+        *
+        * @param aStatus It is used to notify the completion of the request. 
+        *                Then it indicates the success/failure of the operation.
+        * @return error code.
+        */
+        IMPORT_C void CreateAll( TRequestStatus& aStatus );
+
+
+    private: // Panic
+
+        // Panic types to be used in this class.
+        enum TPhCltPanicTypes
+            {
+            // Connection failed.
+            EPhCltPanicServerConnectionFailed = 0,
+            // Server was not found in starting phase.
+            EPhCltPanicServerUnexpectedServerNotFound,
+            // Server startup error.
+            EPhCltPanicServerStartupObservationResultedInError,
+            //
+            EPhCltPanicLast  // Keep as last value.
+            };
+        
+        // Panic function.
+        static void Panic( TPhCltPanicTypes aPanic );
+
+
+    private: // Internal methods
+
+        // Starts the Phone Server.
+        TInt StartServer();
+
+    private:
+   
+        // By default, prohibit copy constructor
+        RPhCltServer( const RPhCltServer& );
+        // Prohibit assigment operator
+        RPhCltServer& operator= ( const RPhCltServer& );
+
+    };
+
+#endif      // RPHCLTSERVER_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_client_command_handler_api/inc/cphcltcommandhandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,290 @@
+/*
+* Copyright (c) 2003-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:  API for PhoneClient Command Handler.
+*
+*/
+
+
+#ifndef CPHCLTCOMMANDHANDLER_H
+#define CPHCLTCOMMANDHANDLER_H
+
+
+//  INCLUDES
+#include <e32base.h>
+#include <phclttypes.h> 
+
+
+// FORWARD DECLARATIONS
+class RPhCltServer;
+
+/**
+* Commands.
+*
+* EPhCltCommandAtd      Dial command.
+* 
+* EPhCltCommandAta      Answer command.
+* 
+* EPhCltCommandChld     Call hold and multiparty handling command.
+* 
+* EPhCltCommandChup     Hangup command.
+* 
+* EPhCltCommandVts      DTMF sending (start and stop) command.
+* 
+* EPhCltCommandBvra     Bluetooth Voice Recognition Activation command.
+* 
+* EPhCltCommandMuteMic          Microphone mute command.
+* 
+* EPhCltCommandMuteRingingTone  Ringing tone mute command.
+*/
+enum TPhCltComHandCommand
+    {
+    EPhCltCommandAtd  = 0,
+    EPhCltCommandAta  = 1,
+    EPhCltCommandChld = 2,
+    EPhCltCommandChup = 3,
+    EPhCltCommandVts  = 4,
+    EPhCltCommandBvra    = 5,
+    EPhCltCommandMuteMic = 6,
+    EPhCltCommandMuteRingingTone = 7
+    };
+    
+    
+/**
+* CHLD commands.
+*
+* EPhCltChldZero   
+*      Release held calls or set UDUB for a waiting call.
+* 
+* EPhCltChldOne
+*      Release all active calls and accept other (held or waiting) call.
+* 
+* EPhCltChldTwo 
+*      Place all active calls on hold and accept the other 
+*      (held or waiting) call.
+* 
+* EPhCltChldThree
+*      Add a held call to the conversation.
+* 
+* EPhCltChldFour
+*      Connect the two calls and disconnect the subscriber from both 
+*      calls (Explicit call transfer).
+*/
+enum TPhCltChldCommand
+    {
+    EPhCltChldZero  = 0,
+    EPhCltChldOne   = 1,
+    EPhCltChldTwo   = 2,
+    EPhCltChldThree = 3,
+    EPhCltChldFour  = 4,
+    };
+    
+/** 
+* Type of DTMF tone. 
+* One tone, i.e. one character.
+*/
+typedef TChar TPhCltDtmfTone;
+
+
+/**
+* DTMF actions.
+*
+* EPhCltDtmfNotUsed  
+*      Play DTMF tone default time. In this case 
+*      DTMF sending need not be stoped by the client.
+* 
+* EPhCltDtmfStart
+*      Start Dtmf sending. Remember to always stop it with EPhCltDtmfStop.
+* 
+* EPhCltDtmfStop
+*      Stop DTMF sending that was started with EPhCltDtmfStart.
+* 
+*/
+enum TPhCltDtmfAction
+    {
+    EPhCltDtmfNotUsed = 0,
+    EPhCltDtmfStart   = 1,
+    EPhCltDtmfStop    = 2
+    };
+    
+
+/*
+* The CommandHandler command parameters defined as in one class.
+* The handler of received command handler commads must first check the
+* performed command, and then read the appropriate parameters.
+*/
+class TPhCltComHandCommandParameters
+    {
+    public:    // Data  
+
+        // The command handler command to be performed.
+        TPhCltComHandCommand                iCommandHandlerCommand;
+
+        // Dial command parameter.
+        TPhCltTelephoneNumber               iTelNumber;
+        
+        // Chld command parameter.
+        TPhCltChldCommand                   iChldCommand;
+        // Chld command parameter.
+        TUint                               iChldCallNumber;
+
+        // Vts command parameter.
+        TPhCltDtmfTone                      iDtmfTone;
+        // Vts command parameter.
+        TPhCltDtmfAction                    iDtmfAction;
+
+        // Bvra command parameter.
+        TBool                               iBvraActivation;
+
+        // Mic Mute command parameter.
+        TBool                               iMute;
+        
+    };
+
+
+
+// CLASS DECLARATION
+
+/**
+*  Interface for Command Handler requests.
+*  At most one asynchronous request can be ongoing at the same time!
+*
+*  @lib PhoneClient.lib
+*  @since 3.2
+*/
+class CPhCltCommandHandler : public CBase
+    {
+    
+    
+    public:  // Constructors    
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CPhCltCommandHandler* NewL();
+        
+        
+    public: // New functions
+
+        /**
+        * Dial. Only voice call is supported.
+        *
+        * @param aStatus The status updated when function call is completed.
+        *                KErrNone if successful, Symbian error code otherwise.
+        * @param aTelephoneNumber The dial information.
+        */
+        IMPORT_C virtual void Atd(
+            TRequestStatus& aStatus, 
+            const TPhCltTelephoneNumber& aTelephoneNumber ) = 0;
+
+        /**
+        * Answer the call. 
+        * Does not need response according to specification.
+        *  
+        * @param aStatus The status updated when function call is completed.
+        *                KErrNone if successful, Symbian error code otherwise.
+        *                KErrNotReady if there is no call to be answered.
+        */
+        IMPORT_C virtual void Ata(
+            TRequestStatus& aStatus ) = 0;
+
+
+        /**
+        * Call hold and multiparty handling.
+        * 
+        * @param aStatus The status updated when function call is completed.
+        *                KErrNone if successful, Symbian error code otherwise.
+        * @param aChldCommand The command to be performed.
+        * @param aCallNumber The call number where the command specified in
+        *                    aChldCommand is targeted. 
+        *                    Not used currently.
+        */
+        IMPORT_C virtual void Chld(
+            TRequestStatus& aStatus, 
+            const TPhCltChldCommand aChldCommand,
+            const TUint aCallNumber ) = 0;
+
+
+        /**
+        * Hang up current call.
+        * Does not need response according to specification.
+        *  
+        * @param aStatus The status updated when function call is completed.
+        *                KErrNone if successful, Symbian error code otherwise.
+        */
+        IMPORT_C virtual void Chup(
+            TRequestStatus& aStatus ) = 0;
+
+
+        /**
+        * DTMF sending, starting and stopping in same function. 
+        * Does not need response according to specification.
+        *
+        * @param aStatus The status updated when function call is completed.
+        *                KErrNone if successful, Symbian error code otherwise.
+        * @param aDtmfTone The DTMF tone to be sent.
+        * @param aActivation Desired DTMF action.
+        */
+        IMPORT_C virtual void Vts(
+            TRequestStatus& aStatus, 
+            const TPhCltDtmfTone aDtmfTone,
+            const TPhCltDtmfAction aAction ) = 0;
+
+
+        /**
+        * Cancel the ongoing asynchronous request.
+        *
+        * @param aReqToCancel The request to be canceled.
+        */
+        IMPORT_C virtual void CancelAsyncRequest( 
+            const TPhCltComHandCommand aReqToCancel ) = 0;
+
+
+        /**
+        * Mute microphone
+        *
+        * @since 2.8
+        * @param aStatus The status updated when function call is completed.
+        *                KErrNone if successful, Symbian error code otherwise.
+        * @param aMute ETrue if Microphone Mute is se on.
+        */
+        IMPORT_C virtual void MuteMicrophone( 
+            TRequestStatus& aStatus,
+            const TBool aMute ) = 0;
+
+
+        /**
+        * Mute RingingTone
+        *
+        * @since 2.8
+        * @param aStatus The status updated when function call is completed.
+        *                KErrNone if successful, Symbian error code otherwise.
+        */
+        IMPORT_C virtual void MuteRingingTone( 
+            TRequestStatus& aStatus ) = 0;
+            
+    protected:
+
+        /**
+        * C++ constructor.
+        */
+        CPhCltCommandHandler();
+            
+    };
+
+
+
+
+
+#endif      // CPHCLTCOMMANDHANDLER_H 
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_client_emergency_call_api/inc/cphcltemergencycall.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,180 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Client side access to emergency number information
+*
+*/
+
+
+#ifndef CPHCLTEMERGENCYCALL_H
+#define CPHCLTEMERGENCYCALL_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class MPhCltEmergencyCallObserver;
+
+// CONSTANTS
+const TInt KPhCltEmergencyNumberSize = 100;
+
+// DATA TYPES
+typedef TBuf< KPhCltEmergencyNumberSize > TPhCltEmergencyNumber;
+
+// CLASS DECLARATION
+/**
+*   Phone Client Emergency Call Api for emergency number query
+*   and emergency dialing.
+*
+*   Example:
+*
+*   // Creates an instance of the class
+*   CPhCltEmergencyCall* emergencyCall = CPhCltEmergencyCall::NewL( this );
+*
+*   CleanupStack::PushL( emergencyCall );
+*   TPhCltEmergencyNumber emNumber;
+*
+*   // Number contains DTMF code
+*   _LIT( KTestNumber, "112p123" );
+*   emNumber.Copy( KTestNumber );
+*   TBool isEmergency( EFalse );  
+*   
+*   // Check if this number is considered as an emergency number
+*   TInt error = emergencyCall->IsEmergencyPhoneNumber( emNumber, isEmergency );
+*
+*   // Dial
+*   if ( isEmergency && !error )
+*       {
+*       emergencyCall->DialEmergencyCallL( emNumber );
+*       }
+*
+*   // Deletes emergencyCall
+*   CleanupStack::PopAndDestroy( emergencyCall );     
+*
+*
+*   @lib phoneclient.lib
+*   @since SeriesS60_3.2
+*/
+class CPhCltEmergencyCall : public CActive
+    {
+    public:  // Constructors and destructor
+ 
+        /**
+        * Create an instance that implements the interface.
+        *
+        * @param aObserver It is the observer for the instance.
+        * @return Returns the created instance.
+        */
+        IMPORT_C static CPhCltEmergencyCall* NewL( 
+            MPhCltEmergencyCallObserver* aObserver );
+
+    public: // New functions    
+        
+       /**
+        * Returns information whether the number specified was an emergency number.
+        * 
+        * @param aNumber Number to be queried. aNumber might contain prefix (SS code)
+        *                and/or postfix (DTMF part).  
+        *                The aNumber parameter should be a buffer and the 
+        *                clients are provided with a typedef called 
+        *                TPhCltEmergencyNumber.
+        *
+        * @param aIsEmergencyNumber If ETrue, then the aNumber 
+        *                           parameter included emergency number.
+        * @return Returns error code of the success of the operation.
+        */
+        IMPORT_C virtual TInt IsEmergencyPhoneNumber(
+            const TDesC& aNumber, 
+            TBool& aIsEmergencyNumber ) = 0;
+
+        /**
+        * Method can be used to check if the number specified contains 
+        * a valid emergency number in the end of the number.
+        * 
+        * @param aNumber Number to be queried, matched emergency number 
+        *                is returned in this parameter.
+        *                The aNumber parameter should be a buffer and the 
+        *                clients are provided with a typedef called 
+        *                TPhCltTelephoneNumber.
+        *             
+        * @param aIsEmergencyNumber If ETrue, then the aNumber parameter 
+        *                           was emergency number. 
+        * @return Returns error code of the success of the operation.
+        */
+        IMPORT_C virtual TInt FindEmergencyPhoneNumber(
+            TDes& aNumber, 
+            TBool& aIsEmergencyNumber ) = 0;
+
+        /**
+        * Initiates an emergency call.
+        *
+        * @param aNumber Emergency number to be dialed.
+        *                The aNumber parameter should be a buffer and the 
+        *                clients are provided with a typedef called 
+        *                TPhCltEmergencyNumber. 
+        *
+        *                If the aNumber parameter supplies an "empty" buffer 
+        *                the call is created either dialing the default emergency 
+        *                phone number or use the SET UP EMERGENCY request  
+        *                that does not contain a  dialling number.
+        *
+        *                Leaves with KErrArgument, if parameter aNumber was
+        *                not an emergency number.
+        *
+        * @pre IsActive() returns EFalse, otherwise leaves with KErrInUse.
+        */
+        virtual void DialEmergencyCallL( const TDesC& aNumber ) = 0;
+        
+        /**
+        * Returns information whether the number specified was an emergency 
+        * number and also returns the plain emergency number.
+        * 
+        * @param aNumber Number to be queried.aNumber might contain prefix (SS code)
+        *                and/or postfix (DTMF part).
+        *                The aNumber parameter should be a buffer and the 
+        *                clients are provided with a typedef called 
+        *                TPhCltEmergencyNumber. 
+        *
+        * @param aMatchedEmergencyNumber Matched emergencynumber without prefix or 
+        *                postfix is returned in this parameter. The aMatchedEmergencyNumber 
+        *                parameter should be a buffer and the clients are
+        *                provided with atypedef called TPhCltEmergencyNumber.
+        * 
+        * @param aIsEmergencyNumber If ETrue, then the aNumber 
+        *                           parameter included emergency number.
+        *
+        * @return Returns error code of the success of the operation.
+        */
+        IMPORT_C virtual TInt IsEmergencyPhoneNumber(
+            const TDesC& aNumber,
+            TDes& aMatchedEmergencyNumber, 
+            TBool& aIsEmergencyNumber ) = 0;                    
+
+    protected:
+
+        /**
+        * C++ constructor.
+        */
+        CPhCltEmergencyCall( MPhCltEmergencyCallObserver* aObserver );
+
+
+    protected: // Data
+        
+        // Observer to handle events.
+        MPhCltEmergencyCallObserver* iObserver;
+
+    };
+
+#endif      // CPHCLTEMERGENCYCALL_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_client_emergency_call_api/inc/mphcltemergencycallobserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Declaration of MPhCltEmergencyCallObserver class.
+*
+*/
+
+
+#ifndef MPHCLTEMERGENCYCALLOBSERVER_H   
+#define MPHCLTEMERGENCYCALLOBSERVER_H   
+
+//  INCLUDES
+#include <e32std.h>
+
+// CLASS DECLARATION
+
+/**
+*  Defines the interface for the observers of the CPhCltEmergencyCall.
+*
+*  @lib phoneclient.lib
+*  @since 1.0
+*/
+class MPhCltEmergencyCallObserver
+    {          
+    public:  // New functions   
+        
+        /**
+        * It is called whenever client's dial request is completed.
+        *
+        * @param aStatus error code of the success of the operation.
+        */       
+        virtual void HandleEmergencyDialL( const TInt aStatus ) = 0;
+        
+    };
+
+#endif      // MPHCLTEMERGENCYCALLOBSERVER_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_client_emergency_call_api/tsrc/BWINS/it_emergencycalltestsu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_client_emergency_call_api/tsrc/EABI/it_emergencycalltestsu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z16CreateTestSuiteLv @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_client_image_handler_api/inc/cphcltbaseimageparams.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,239 @@
+/*
+* Copyright (c) 2004-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:  Parameter class definitions.
+*
+*/
+
+
+#ifndef CPHCLTBASEPARAMS_H
+#define CPHCLTBASEPARAMS_H
+
+#include    <cphcltimageparams.h> 
+#include    <e32std.h>
+#include    <e32base.h>
+
+/**
+* Logo types
+*
+* @since Series60 3.0
+*
+* EPhCltLogoTypeOTA - OTA operator logo
+* EPhCltLogoTypeProgrammable - programmable operator logo
+*/
+enum TPhCltExtOperatorLogoType
+    {
+    EPhCltLogoTypeOTA,
+    EPhCltLogoTypeProgrammable
+    };
+       
+ // Country code type definition.
+typedef TInt TPhCltCountryCode;
+
+// Network code type definition.
+typedef TInt TPhCltNetworkCode;
+
+// Constant to be used when deleting operator logo(s).
+const TInt KPhCltDeleteOperatorLogo = 0;
+
+struct TTelephonyOTALogoUpdate
+    {
+    /**
+    * EPSTelephonyLogoChanged - Logo was added or replaced
+    * EPSTelephonyLogoDeleted - Logo was deleted
+    */
+    enum TPSOperatorLogoUpdateEvent
+        {
+        EPSTelephonyLogoChanged,
+        EPSTelephonyLogoDeleted,
+        EPSTelephonyAllLogosDeleted
+        };
+    
+    // Event type
+    TPSOperatorLogoUpdateEvent iEvent;
+
+    /**
+    * Country code associated to logo, N/A if event
+    * is EPSTelephonyAllLogosDeleted
+    */ 
+    TPhCltCountryCode iMCC;
+
+    /**
+    * Network code associated to logo, N/A if event
+    * is EPSTelephonyAllLogosDeleted
+    */ 
+    TPhCltNetworkCode iMNC;
+
+    typedef TPckg<TTelephonyOTALogoUpdate> TOTALogoUpdatePckg;
+    };
+
+// CLASS DECLARATION
+/**
+*  Parameter storage class.
+*
+*  @lib PhoneClient.lib
+*  @since Series60 3.2
+*/
+NONSHARABLE_CLASS( CPhCltBaseImageParams ) 
+: public CPhCltImageParams
+    {
+    public:
+        /**
+         * Returns class type.
+         * @return type number;
+         */
+        virtual TPhCltImageType Type() const;
+
+        /**
+         * Adds an image.
+         * @param aHandle handle to an image.
+         */
+        virtual void AddImageL( TInt aHandle );
+
+        /**
+        * Assignment operator
+        * @param aParamClass parameter class.
+        * @return 'deep' copied parameter class.
+        */
+        virtual CPhCltBaseImageParams& operator=( 
+            const CPhCltBaseImageParams& aParamClass );
+
+        /**
+         * Gets an image.
+         * @param aIndex index of the image to get.
+         * @return image handle
+         */
+        virtual TInt GetImageL( const TInt aIndex ) const;
+
+        /**
+         * Gets image count.
+         * @return image count
+         */
+        virtual TInt Count() const;
+
+        /**
+        * Get all the images
+        * @return package buffered image struct
+        */
+        virtual TPckgBuf< TPhCltImageArray >& Images();
+
+    protected:
+        /**
+         * Cleans class content.
+         */
+        void Clean();
+
+    public: // Constructor and destructor.
+        /**
+         * Destructor.
+         */
+        virtual ~CPhCltBaseImageParams();
+
+    protected:
+
+        /**
+         * Constructor.
+         */
+        CPhCltBaseImageParams( const TPhCltImageType aType  );
+
+    public: // Data.
+        TPckgBuf< TPhCltImageArray > iImages;
+    };
+
+// CLASS DECLARATION
+/**
+*  Parameter storage class.
+*
+*  @lib PhoneClient.lib
+*  @since Series60 3.2
+*/
+NONSHARABLE_CLASS( CPhCltExtVTImageParams ) : public CPhCltBaseImageParams
+    {
+    public: // Constructor and destructor.
+        /**
+         * Destructor.
+         */
+        ~CPhCltExtVTImageParams();
+
+        /**
+         * Symbian 2 phase constructor.
+         */
+        static CPhCltExtVTImageParams* NewL( const TPhCltImageType aType );
+
+    private:
+
+        /**
+         * Constructor.
+         */
+        CPhCltExtVTImageParams( const TPhCltImageType aType );
+    };
+
+// CLASS DECLARATION
+/**
+*  Parameter storage class.
+*
+*  @lib PhoneClient.lib
+*  @since Series60 3.2
+*/
+NONSHARABLE_CLASS( CPhCltExtOperatorLogoParams ) 
+: public CPhCltBaseImageParams
+    {
+    public: // Constructor and destructor.
+        /**
+         * Destructor.
+         */
+        ~CPhCltExtOperatorLogoParams();
+
+        /**
+         * Symbian 2 phase constructor.
+         */
+        static CPhCltExtOperatorLogoParams* NewL( );
+        
+    public: // New functions.
+        
+        /**
+        * @see CPhCltImageParams::operator=.
+        */
+        CPhCltBaseImageParams& operator=( 
+            const CPhCltBaseImageParams& aParamClass );
+            
+        /**
+        * @see CPhCltImageParams::AddImageL.
+        * NOTE: when deleting, set image to KPhCltDeleteOperatorLogo
+        * @see CPhCltExtOperatorLogoParams::SetCodesL
+        */
+        void AddImageL( TInt aHandle );
+        
+        /**
+        * Sets country and network code for operator logo.
+        * @param aCountryCode country code
+        * @param aNetworkCode network code
+        * @param aLogoType OTA/programmable logo
+        * NOTE: delete all: set codes to KPhCltDeleteOperatorLogo
+        */        
+        virtual void SetCodesL( 
+            const TPhCltCountryCode aCountryCode, 
+            const TPhCltNetworkCode aNetworkCode,
+            const TPhCltExtOperatorLogoType aLogoType );
+        
+    private:
+
+        /**
+         * Constructor.
+         */
+        CPhCltExtOperatorLogoParams();
+    };
+
+#endif // CPHCLTBASEPARAMS_H
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_client_image_handler_api/inc/cphcltimagehandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 2004-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:  Image storing and loading interface.
+*
+*/
+
+
+#ifndef CPHCLTIMAGEHANDLER_H
+#define CPHCLTIMAGEHANDLER_H
+
+#include <e32base.h>
+#include "cphcltimageparams.h" 
+
+// FORWARD DECLARATIONS
+class RPhCltServer;
+class CPhCltImageParams;
+class RFile;
+
+/**
+* Interface for image saving callback.
+*/
+class MPhCltImageObserver
+    {
+public:
+    /**
+    * Callback for image saving.
+    * @param aResult KErrNone if image saving succeeded, or a Symbian OS
+    *        error code in failure.
+    */
+    virtual void HandleImageSaveCompleteL( TInt aResult ) = 0;
+    };
+    
+/**
+*  Interface used in image storing to PhoneServer.
+*
+*  @lib PhoneClient.lib
+*  @since S60 v3.2
+*/
+class CPhCltImageHandler : public CBase
+    {
+    
+    public:  // Constructors 
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CPhCltImageHandler* NewL();
+        
+    public: // New functions
+
+        /**
+        * Save image(s)
+        * @param aParam parameters passed 
+        * @return KErrNone if successful, Symbian error code otherwise.
+        * NOTE: can be used to delete operator logos,
+        * @see CPhCltExtOperatorLogoParams::SetCodesL
+        * @see CPhCltExtOperatorLogoParams::AddImageL        
+        */
+        virtual TInt SaveImages( CPhCltImageParams& aParams ) = 0;
+            
+        /**
+        * Load image(s)
+        * @param aParam parameters in return passed 
+        * @return KErrNone if successful, Symbian error code otherwise.
+        */
+        virtual TInt LoadImages( CPhCltImageParams*& aParams ) = 0;
+
+        /**
+        * Creates image parameter class.
+        * @param aType type of the implementation class.
+        * @return CPhCltBaseImageParams implementation class. 
+        *         NULL if not supported.
+        *         Ownership transferred.
+        */
+        IMPORT_C virtual CPhCltImageParams* 
+            CPhCltBaseImageParamsL( const TPhCltImageType aType ) = 0; 
+        
+        
+        /**
+        * Saves user defined video call still image file. This makes copy
+        * of original file to secure place.
+        * @param aObserver callback for notifying result of the operation
+        * @param aImagePath full path to image to be saved
+        * @since S60 v5.0
+        */
+        virtual void SaveVtImageL( MPhCltImageObserver& aObserver,
+            const TDesC& aImagePath ) = 0;
+                        
+        /**
+        * Cancels pending image saving. This may be no-op from saving point
+        * of view (image is actually saved) but resets internal state to such
+        * that no operation is pending.
+        * @since S60 v5.0
+        */
+        virtual void CancelSaveVtImage() = 0;
+        
+        /**
+         * Opens user defined video call still image file.
+         * @param aFile file handle that shall to point to image file
+         *        Client should close the file after use.
+         * @return KErrNone if successful, Symbian error code otherwise.
+         * @since S60 v5.0
+         */
+        virtual TInt OpenVtImage( RFile& aFile ) = 0;
+                
+       /**
+        * Opens predefined (read-only) video call still image file.
+        * @param aFile file handle that shall point to image file.
+        *        Client should close the file after use.
+        * @return KErrNone if successful, Symbian error code otherwise.
+        * @since S60 v5.0
+        */
+        virtual TInt OpenDefaultVtImage( RFile& aFile ) = 0;
+
+      protected:
+                               
+        /**
+        * C++ constructor.
+        */
+       CPhCltImageHandler();
+    };
+
+
+#endif      // CPHCLTIMAGEHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_client_image_handler_api/inc/cphcltimageparams.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,105 @@
+/*
+* Copyright (c) 2004-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:  Parameter class definitions.
+*
+*/
+
+
+#ifndef CPHCLTIMAGEPARAMS_H
+#define CPHCLTIMAGEPARAMS_H
+
+#include    <e32std.h>
+#include    <e32base.h>
+
+
+// Number of images in max.
+const TInt KPhCltImagesArrayLen = 10; 
+
+
+/**
+* Enumerates image type.
+* 
+* @since 3.0.
+* 
+* EPhCltVersionNotSet - not set version nbr.
+* EPhCltVersionVTStill - Video telephony still image.
+* EPhCltVersionOperatorLogo - Operator logo.
+* EPhCltTypeVTDefault - Video telephony default image when
+*                       VT still image is not in use.
+*/
+enum TPhCltImageType
+    {
+    EPhCltTypeNotSet         = 0,
+    EPhCltTypeVTStill        = 1,
+    EPhCltTypeOperatorLogo   = 2,
+    EPhCltTypeVTDefault      = 3
+    };
+    
+    
+/**
+* Image handler uses TPhCltImageArray.
+* Identification is done according to the version number, and handled
+* accordingly.
+*/
+struct TPhCltImageArray
+    {
+    TInt iImages[KPhCltImagesArrayLen];
+    TInt iImageCount; 
+    TPhCltImageType iType;
+    };
+
+
+// CLASS DECLARATION
+/**
+*  Parameter storage class.
+*
+*  @lib PhoneClient.lib
+*  @since Series60 3.2
+*/
+class CPhCltImageParams : public CBase
+    {
+    public:
+        /**
+         * Returns class type.
+         * @return type number;
+         */
+        IMPORT_C virtual TPhCltImageType Type() const = 0;
+
+        /**
+         * Adds an image.
+         * @param aHandle handle to an image.
+         */
+        virtual void AddImageL( TInt aHandle ) = 0;
+
+        /**
+         * Gets an image.
+         * @param aIndex index of the image to get.
+         * @return image handle
+         */
+        IMPORT_C virtual TInt GetImageL( const TInt aIndex ) const = 0;
+
+        /**
+         * Gets image count.
+         * @return image count
+         */
+        IMPORT_C virtual TInt Count() const = 0;
+
+        /**
+        * Get all the images
+        * @return package buffered image struct
+        */
+        virtual TPckgBuf< TPhCltImageArray >& Images() = 0;
+    };
+
+#endif // CPHCLTIMAGEPARAMS_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_client_messenger_api/inc/cphcltmessenger.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,225 @@
+/*
+* 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:  Messenger interface: provides two-way communication between 
+*                two or more clients.
+*
+*/
+
+
+#ifndef CPhCltMessenger_H
+#define CPhCltMessenger_H
+#include <etelmm.h>
+
+// FORWARD DECLARATIONS
+class RPhCltServer;
+
+// The default Messenger data size.
+const TInt KPhCltDefMesSize = 64;
+
+
+/**
+* Enumerates asynchronous messenger requests.
+* 
+* @since 2.6.
+* 
+* EPhCltMesRequestReceive - request corresponding to the Receive method.
+* EPhCltMesRequestSend - request corresponding to the Send method.
+*/
+enum TPhCltMessengerRequest
+    {
+    EPhCltMesRequestReceive = 1,
+    EPhCltMesRequestSend = 2
+    };
+    
+    
+
+
+/**
+* Messenger Negotiator commands.
+*
+* EPhCltMesCommandUnknown       The command was unknown.
+* 
+* EPhCltMesCommandSend          The Send command.
+* EPhCltMesCommandReceive       The Receive command.
+* EPhCltMesCommandSkip          The Skip command.
+* 
+* EPhCltMesConstruct            The Construct command.
+* EPhCltMesCommandDelete        The Delete command.
+*
+* EPhCltMesCommandCancelSend    Send request canceled.
+* EPhCltMesCommandCancelReceive Receive request canceled.
+*/
+enum TPhCltMessengerCommand
+    {
+    EPhCltMesCommandUnknown       = 0,
+
+    EPhCltMesCommandReceive       = 1,
+    EPhCltMesCommandSend          = 2,
+    EPhCltMesCommandSkip          = 3,
+
+    EPhCltMesCommandConstruct     = 4,
+    EPhCltMesCommandDelete        = 5,
+
+    EPhCltMesCommandCancelSend    = 6,
+    EPhCltMesCommandCancelReceive = 7
+    };
+    
+/**
+* The parameter storage class used in PhoneClient and PhoneServer
+* data transfer.
+* 
+* @since 2.6.
+*/
+class TPhCltMessengerParameters
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Constructor.
+        */
+        inline TPhCltMessengerParameters() :
+            iMessengerCommand( EPhCltMesCommandUnknown ), 
+            iDefaultMessageSize( 0 ),
+            iReceiveMessageSizePtr( NULL ),
+            iReceiveBufferMaxSize( 0 ),
+            iSendPayloadLength( 0 ),
+            iCancelRequest( EPhCltMesRequestReceive )
+            {
+            }
+
+    public:    // Data
+
+        // The Messenger Negotiator command.
+        TPhCltMessengerCommand  iMessengerCommand;
+
+        // The message types that are listened.
+        TUid                    iCategoryUid;
+
+        // The default message size.
+        TInt                    iDefaultMessageSize;
+
+        // The pointer to the descriptor that contains the 
+        // received message size TInt.
+        TAny*                   iReceiveMessageSizePtr;
+
+        // The maximum size of the receive buffer.
+        TInt                    iReceiveBufferMaxSize;
+
+        // The length of the Send data.
+        TInt                    iSendPayloadLength;
+
+        // The canceled command.
+        TPhCltMessengerRequest  iCancelRequest;
+    };
+
+/**
+*  Messenger interface: provides two-way communication between 
+*  two or more clients. 
+*  Meant for Phone and Video Telephony application information transfer.
+*
+*  @lib PhoneClient.lib
+*  @since 3.2 
+*/
+class CPhCltMessenger : public CBase
+    {
+    
+    public:  // Constructors  
+      
+        /**
+        * Two-phased constructor.
+        *
+        * @param aCategoryUid Category of messages to be sent or received.
+        *                     Note that there can be many kinds of message uids
+        *                     below one category uid.
+        * @param aDefaultMessageSize The default size of the messages to be sent
+        *                            or received in bytes. Can be bigger than 
+        *                            KPhCltDefMesSize, but then functionality
+        *                            is not guaranteed.
+        */
+        IMPORT_C static CPhCltMessenger* NewL( const TUid& aCategoryUid,
+            const TInt& aDefaultMessageSize );
+        
+    public: // New functions
+
+        /**
+        * Receives next message. No memory is allocated during the operation of
+        * this method.
+        * 
+        * @param aStatus This request will be completed once message has been 
+        *                received.
+        * @param aMessageSize Tells the size of the received message. If bigger
+        *        than the size of the aMessagePayload, then only the beginning 
+        *        of the received message is copied to aMessagePayload. This
+        *        means that either Receive must be called with bigger buffer to 
+        *        receive full message or Skip must be called to indicate that
+        *        the full message is not needed.
+        *                     
+        * @param aMessagePayload Storage to the message to be received. The 
+        *                        format of the message is determined by the 
+        *                        category Uid used in Open method.
+        *                        .
+        */ 
+        IMPORT_C virtual void Receive(
+            TRequestStatus& aStatus,
+            TInt& aMessageSize,
+            TDes8& aMessagePayload ) = 0;
+
+
+        /**
+        * Sends message. This is completed only after message has been
+        * delivered to all receivers of the same category.
+        * No memory is allocated during the operation of this method.
+        * 
+        * @param aStatus This request will be completed once message has been 
+        *                sent.
+        * @param aMessagePayload The sent message.The format of the message is 
+        *                determined by the category Uid used in Open method.
+        */
+        IMPORT_C virtual void Send(
+            TRequestStatus& aStatus,
+            const TDesC8& aMessagePayload ) = 0;
+
+
+        /**
+        * Cancel request. This method should only be called in destruction 
+        * to make sure that messages are not missed.
+        * 
+        * @param aRequest request to be canceled.
+        */
+        IMPORT_C virtual void CancelRequest( 
+            const TPhCltMessengerRequest& aRequest ) = 0;
+
+
+        /**
+        * Skip one (i.e. next) message. This method should be called only if 
+        * Receive completion indicates that there is not enough space in 
+        * aMessagePayload.
+        * Of course, you should attempt to recover, i.e. try to call Receive 
+        * with big enough aMessagePayload buffer before calling this method.
+        */
+        virtual void Skip() = 0;
+        
+    protected:
+
+        /**
+        * C++ constructor.
+        */
+        CPhCltMessenger();
+
+    };
+
+
+#endif      // CPhCltMessenger_H 
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_client_notify_api/inc/cphcltcallnotify.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,169 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CPhCltCallNotify observer getting notifications about call requests
+*                from Phone Server.
+*
+*/
+
+#ifndef CPHCLTCALLNOTIFY_H
+#define CPHCLTCALLNOTIFY_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <phclttypes.h> 
+
+
+//  FORWARD DECLARATIONS
+class RPhCltServer;
+class CPhCltDialData;
+class MPhCltDialRequestObserver;
+class MPhCltDialEmergencyRequestObserver;
+class CPhCltExtPhoneDialData;
+class RPhCltCallNotify;
+class MPhCltComHandRequestObserver;
+class CPhCltDialRequestMonitor;
+class CPhCltDialEmergencyRequestMonitor;
+class CPhCltComHandRequestMonitor;
+
+
+// CLASS DECLARATION
+
+/**
+*  CCallNotify observer getting notifications about call requests
+*  from Phone Server.
+*
+*  @lib phoneclient.lib
+*  @since 1.0
+*/
+class CPhCltCallNotify : public CBase
+    {
+    public: // Constructors and destructors.
+
+        
+        IMPORT_C static CPhCltCallNotify* NewL();
+        
+        /**
+        * Destructor.
+        */
+        IMPORT_C virtual ~CPhCltCallNotify();
+        
+    public: // New functions
+
+        /**
+        * Open subsession to server.
+        * 
+        * @param aServer Pre-opened server session.
+        * @return Symbian OS error code of the success of the opening.
+        */
+        IMPORT_C TInt Open( RPhCltServer& aServer );
+
+        /**
+        * Close subsession.
+        */
+        IMPORT_C void Close();
+    
+        /**
+        * Notify dial requests through given observer.
+        * @param aObserver dial request observer
+        */
+        IMPORT_C void NotifyDialRequest( 
+            MPhCltDialRequestObserver* aObserver );
+
+        /**
+        * Cancel pending call attempt notification.
+        */
+        IMPORT_C void CancelNotifyDialRequest();
+        
+        /**
+        * Respond to client request to make a call
+        *
+        * @param aResultCode Result of the response.
+        */
+        IMPORT_C TInt RespondClient( const TInt aResultCode );
+        
+        /**
+        * Notifies when a emergency call request arrives.
+        *
+        * @param aStatus Status to be changed when call request have arrived.
+        */        
+        IMPORT_C void NotifyEmergencyCall( 
+            MPhCltDialEmergencyRequestObserver* aObserver, 
+            TDesC& aEmergencyNumber );
+
+        /**
+        * Cancel pending emergency call attempt notification.
+        */
+        IMPORT_C void CancelNotifyEmergencyCall() const;
+
+        /**
+        * Respond to client request to make emergency call
+        *
+        * @param aResultCode Result of the response.
+        */
+        IMPORT_C TInt RespondEmergencyToClient( const TInt aResultCode );
+        
+        /**
+        * Notifies when a Command handler request arrives.
+        *
+        * @param aStatus Status to be changed when command handler request
+        *                has arrived.
+        * @param aCommandArgs Command argument storage place. 
+        *                     That is, packaged version of class 
+        *                     TPhCltComHandCommandParameters.
+        */
+        IMPORT_C void NotifyComHandCommand( 
+            MPhCltComHandRequestObserver* aObserver, 
+            TDes8& aCommandArgs );
+    
+        /**
+        * Cancel pending command handler request notification.
+        */
+        IMPORT_C void CancelNotifyComHandCommand() const;
+    
+        /**
+        * Respond to client's command handler request.
+        *
+        * @param aResultCode Result of the response 
+        *        (previous function execution).
+        * @return KErrNone if respond succeeded, otherwise Symbian error code.
+        */
+        IMPORT_C TInt RespondComHandClient( const TInt aResultCode );
+
+    
+    private:
+    
+        /*
+        * Constructor.
+        */
+        CPhCltCallNotify();
+        
+        /**
+        * Memory allocations in ConstructL.
+        */
+        void ConstructL();
+        
+    private:
+        
+        //RClass instance
+        RPhCltCallNotify* iCallNotify;
+               
+        CPhCltDialRequestMonitor* iDialMonitor;
+        CPhCltDialEmergencyRequestMonitor* iDialEmergencyMonitor;
+        CPhCltComHandRequestMonitor* iComHandMonitor;
+    };
+
+
+#endif    // CPHCLTCALLNOTIFY_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_client_server_information_api/inc/phoneclientserverdomainpskeys.h	Wed Jul 21 18:26:52 2010 +0300
@@ -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:  Phone Client-Server Domain Publish and Subscribe keys.
+*
+*/
+
+
+#ifndef PHONECLIENTSERVERDOMAINPSKEYS_H
+#define PHONECLIENTSERVERDOMAINPSKEYS_H
+
+#include <e32std.h>
+
+// CONSTANTS
+
+/******************************************************************************
+* Phone Client Server Information API
+******************************************************************************/
+const TUid KPSUidPhoneClientServerInformation = {0x102029AA}; 
+
+/**
+* Indication about operator logo change. 
+* @see TTelOTALogoUpdate in phoneclientserverdomainpstypes.h
+* @type RProperty::EByteArray
+*/
+
+const TUint32 KTelOperatorLogoUpdated = 0x00000001; 
+
+#endif   // PHONECLIENTSERVERDOMAINPSKEYS_H
+
+// End of file
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_client_server_information_api/inc/phoneclientserverdomainpstypes.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* 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:  Data types passed through Publish and Subscribe
+*
+*/
+
+
+#ifndef PHONECLIENTSERVERDOMAINPSTYPES_H
+#define PHONECLIENTSERVERDOMAINPSTYPES_H
+
+/**
+* Details how OTA operator logo has changed.
+* Data is used as key value with KTelOperatorLogoUpdated.
+* Note: Size of the data must not exceed RProperty::KMaxPropertySize.
+*/
+struct TTelOTALogoUpdate 
+    {
+    /**
+    * EPSTelephonyLogoChanged - Logo was added or replaced
+    * EPSTelephonyLogoDeleted - Logo was deleted
+    */
+    enum TPSOperatorLogoUpdateEvent
+        {
+        EPSTelephonyLogoChanged,
+        EPSTelephonyLogoDeleted,
+        EPSTelephonyAllLogosDeleted
+        };
+    
+    // Event type
+    TPSOperatorLogoUpdateEvent iEvent;
+
+    /**
+    * Country code associated to logo, N/A if event
+    * is EPSTelephonyAllLogosDeleted
+    */ 
+    TPhCltCountryCode iMCC;
+
+    /**
+    * Network code associated to logo, N/A if event
+    * is EPSTelephonyAllLogosDeleted
+    */ 
+    TPhCltNetworkCode iMNC;
+
+    typedef TPckg<TTelOTALogoUpdate> TOTALogoUpdatePckg;
+    };
+    
+#endif    // PHONECLIENTSERVERDOMAINPSTYPES_H
+
+// End of file
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_client_ussd_api/inc/cphcltussd.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,126 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Interface for sending messages.
+*
+*/
+
+
+#ifndef CPHCLTUSSD_H
+#define CPHCLTUSSD_H
+
+//  INCLUDES
+#include <e32base.h>
+
+
+// FORWARD DECLARATIONS
+// CLASS DECLARATION
+
+/**
+* USSD application Exit reason.
+*/
+enum TPhCltUssdAppExitReason
+    {
+    EPhCltUserExit,          // User exited the application.
+    EPhCltSendCompleted,     // Send operation was completed.
+    EPhCltExitReasonUnknown  // Exit reason is unknown.
+    };
+
+// The next four values are for SAT dcs.
+const TUint KPhCltDcs7Bit    = 101; // 7-bit dcs.
+const TUint KPhCltDcs8Bit    = 102; // 8-bit dcs.
+const TUint KPhCltDcsUcs2    = 103; // UCS2 dcs.
+const TUint KPhCltDcsUnknown = 104; // Unknown dcs.
+
+// The notes are shown in SAT session.
+const TUint KPhCltShowNotes = 1000;
+
+/**
+*  Interface for sending messages.
+*
+*  @lib phoneclient.lib
+*  @since 1.0
+*/
+class CPhCltUssd : 
+    public CBase
+    
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        *
+        * @param aShowNotes If ETrue, notes are shown.
+        * @return Pointer to created CPhCltUssd instance.
+        */
+        IMPORT_C static CPhCltUssd* NewL( TBool aShowNotes = ETrue );
+
+    public: // New functions
+
+        /**
+        * Send Ussd string to network with default DCS.
+        *
+        * @param aMsgData Unicode string to be sent.
+        * @return Error code.
+        */
+        virtual TInt SendUssd( const TDesC& aMsgData ) = 0;
+
+        /**
+        * Send Ussd buffer to network with default DCS.
+        *
+        * @param aMsgData 7-bit buffer to be sent.
+        * @return Error code.
+        */
+        virtual TInt SendUssd( const TDesC8& aMsgData ) = 0;
+
+        /**
+        * Send Ussd buffer to network with given DCS.
+        *
+        * @param aMsgData 7-bit buffer to be sent.
+        * @param iSendDcs Specifies DCS and the send type.
+        * @return Error code.
+        */
+        IMPORT_C virtual TInt SendUssd( 
+            const TDesC8& aMsgData, 
+            const TUint8 iSendDcs ) = 0;
+
+        /**
+        * Cancels outstanding Send request.
+        */
+        virtual void SendUssdCancel() = 0;
+               
+        /**
+        * Set data coding scheme
+        * 
+        * @param aDCS data coding scheme value
+        */
+        virtual void SetDCS( TUint8 aDCS ) = 0;
+        
+        /**
+        * Starts editor. Creates own window server session.
+        *
+        * @return Error code.
+        */
+        IMPORT_C virtual TInt StartUssdEditor() const = 0;
+    
+    protected:    
+        /**
+        * C++ constructor.
+        */
+        CPhCltUssd();
+        
+    };
+
+#endif // CPHCLTUSSD_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_client_ussd_internal_api/inc/cphcltussdint.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,101 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 Ui information
+*
+*/
+
+
+#ifndef CPHCLTUSSDINT_H
+#define CPHCLTUSSDINT_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <cphcltussd.h> 
+
+// FORWARD DECLARATIONS
+// CLASS DECLARATION
+
+
+/**
+*  Interface for sending messages.
+*
+*  @lib phoneclient.lib
+*  @since 1.0
+*/
+class CPhCltUssdInt : 
+    public CPhCltUssd
+    
+    {
+    public:  // Constructors and destructor
+        
+        
+       // CPhCltUssdInt();
+        
+       /**
+        * Two-phased constructor.
+        *
+        * @param aShowNotes If ETrue, notes are shown.
+        * @return Pointer to created CPhCltUssd instance.
+        */
+        IMPORT_C static CPhCltUssdInt* NewL( TBool aShowNotes = ETrue );
+        
+               
+       protected:  
+        //--------------------- From app ------------------------------
+
+        /**
+        * UI informs that it is been created
+        * 
+        * @return Error code.
+        */
+        virtual TInt AppStarting() = 0;
+
+        /**
+        * UI informs that it is terminating.
+        *
+        * @param aExitReason The reason why the application was terminated.
+        * @return Error code.
+        */
+        IMPORT_C virtual TInt AppTerminating( 
+            TPhCltUssdAppExitReason aExitReason ) = 0;
+
+        /**
+        * UI informs that it is brougth to foreground.
+        *
+        * @return Should the editor be emptied?
+        */
+        virtual TBool AppToForeground() = 0;
+
+        /**
+        * UI informs that it is gone background.
+        *
+        * @return Error code.
+        */
+        virtual TInt AppToBackground() = 0;
+         
+        /**
+        * C++ constructor.
+        */
+        CPhCltUssdInt();
+        
+     protected:
+
+        // CUssdComms can call the protected functions mentioned above.
+        friend class CUssdComms;
+        
+    };
+
+#endif //  CPHCLTUSSDINT_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_client_ussd_internal_api/inc/cphcltussdsatclient.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,148 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Ussd client for SAT usage.
+*
+*/
+
+
+#ifndef CPHCLTUSSDSATCLIENT_H
+#define CPHCLTUSSDSATCLIENT_H
+
+
+//  INCLUDES
+#include <e32base.h>
+
+
+// FORWARD DECLARATIONS
+class CPhCltUssdSatActive;
+class CPhCltUssdImp;
+
+
+// CLASS DECLARATION
+
+/**
+*  Ussd client for SAT Server.
+*
+*  @lib phoneclient.lib
+*  @since 1.0
+*/
+class CPhCltUssdSatClient :public CBase
+    {
+    public:
+
+    /**
+    * Values to tell the used DCS in SAT message received from network.
+    */
+    enum TPhCltDcs
+        {
+        EPhCltDcs7Bit = 1,   // DCS was 7bit.
+        EPhCltDcs8Bit,       // DCS wass 8bit.
+        EPhCltDcsUCS2,       // DCS was UCS2.
+        EPhCltDcsUnknown     // DCS was unknown.
+        };
+
+
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        * 
+        * @param aShowNotes Show notes on first and last message?
+        * @return Pointer to created CPhCltUssdSatClient instance.
+        */
+        IMPORT_C static CPhCltUssdSatClient* NewL( TBool aShowNotes );
+        
+        /**
+        * Destructor.
+        */
+        IMPORT_C virtual ~CPhCltUssdSatClient();
+        
+
+    public: // New functions
+        
+        /**
+        * Start Ussd session from SAT.
+        * 
+        * @param aSendMessage The string which is sent to network.
+        * @param iSendDcs Specifies DCS and the send type.
+        * @param aReceiveMessage Here is copied the return message.
+        * @param aSendCompletedFirst ETrue if send is completed before receive.
+        * @param aReceivedDcs The used DCS in message sent by network.
+        * @return Error code. KErrNone no errors
+        *                     KErrInUse send is already active.
+        *                     Others from the network or from connection.
+        */
+        IMPORT_C TInt SendSatMessage( 
+            const TDesC& aSendMessage, 
+            const TUint8 iSendDcs,
+            TDes& aReceiveMessage,
+            TBool& aSendCompletedFirst,
+            TUint8& aReceivedDcs 
+            );
+
+        /**
+        * Cancels outstanding Send request.
+        */
+        IMPORT_C void SendSatMessageCancel();
+
+
+    private:
+        
+        /**
+        * C++ default constructor.
+        */
+        CPhCltUssdSatClient();
+        
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL( TBool aShowNotes );
+
+        /**
+        * Decodes the dcs received from Phone Server. Puts the result to
+        * parameter aReceivedDcs.
+        */
+        void DecodeDcs( TUint8& aReceivedDcs );
+
+
+    private:    // Data
+
+        // Storage place for note show information.
+        TBool                iShowNotes;
+
+        // Storage for SAT error code.
+        TInt                 iSatError;
+
+        // Storage for received message.
+        TPtrC                iReceiveMessage;
+
+        // Send completion information.
+        TBool*               iSendCompletedFirst;
+        
+        // Helper class, private
+        CPhCltUssdSatActive* iSatActive;
+
+
+        // USSD wrapper class.
+        CPhCltUssdImp*          iUssdWrapper;
+
+        // This variable has two purposes:
+        // 1) Client -> Server: Tells whether to show the notes or not.
+        // 2) Server -> Client: Tells the used dcs in received message.
+        TUint                iShowNotesAndDcs;
+    };
+
+#endif      // CPHCLTUSSDSATCLIENT_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_client_utility_api/inc/phcltutils.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  It provides functionality to check if character is valid and 
+*                remove invalid characters.
+*
+*/
+
+
+#ifndef PHCLTUTILS_H
+#define PHCLTUTILS_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// CLASS DECLARATION
+
+/**
+*  It contains utility methods.
+*
+*  This class can be used to remove illegal characters from descriptors
+*  before dialing. However, it shouldn't be done before you have ensured
+*  that string is acceptable by application specific grammar.
+*  
+*  Thus, you should process as follows:
+*       1. Check that string is acceptable. (application specific)
+*       2. If not, stop. Otherwise continue.
+*       3. Convert to string acceptable by phoneclient -
+*          typically, you just have to remove invalid characters.
+*       4. Do whatever you wish with the string, e.g. dial.
+*
+*  @lib phoneclient.lib
+*  @since 1.0
+*/
+class PhCltUtils
+    {
+    public:  // New functions
+
+        /**
+        * Checks if character is acceptable.
+        *
+        * @param aChar character.
+        * @return ETrue iff characters is ok.
+        */
+        IMPORT_C static TBool IsValidChar( TChar aChar );
+
+        /**
+        * Removes all illegal characters from descriptor.
+        *
+        * @param aString string from which those characters are removed.
+        */
+        IMPORT_C static void RemoveInvalidChars( TDes& aString );
+
+        /**
+        * Removes SIP prefixses and domain part from descriptor.
+        *
+        * @since 3.0
+        * @param aString string from which those characters are removed.
+        */        
+        IMPORT_C static void RemoveURIPrefixdAndDomainChars( TDes& aString );
+    };
+        
+#endif      // PHCLTUTILS_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_settings_api/inc/mpsetcallbarring.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*      MPsetCallBarring defines interface to get and set call barring
+*      setting in the network.                                        
+*
+*
+*/
+
+
+#ifndef MPSETCALLBARRING_H
+#define MPSETCALLBARRING_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <nwdefs.h>
+
+//  FORWARD DECLARATIONS
+class MPsetBarringObserver;
+
+//  CLASS DEFINITIONS 
+/**
+*  MPsetCallBarring class is virtual class for call barring.
+*  @lib phonesettings.lib
+*  @since 1.0
+*/
+class MPsetCallBarring
+    { 
+    public:        
+
+        /**
+        * Sets barring status to the network.
+        *
+        * @param aBarring New status of barring.
+        * @param aBsc List of basic service groups.
+        */
+        virtual void SetBarringL( const TCallBarringSetting& aBarring, 
+            TBasicServiceGroups aBsc ) = 0;
+
+        /**
+        * Checks the barring status from network
+        *
+        * @param aGroup Service group concerned.
+        * @param aMode Barring program mode.
+        */
+        virtual void GetBarringStatusL( const TServiceGroup aGroup, 
+            const TBarringProgram aMode ) = 0;
+
+        /**
+        * Cancels the pending request.
+        *
+        * @return Returns error code
+        */
+        virtual TInt CancelCurrentRequest()=0;
+    };
+#endif //MPSETCALLBARRING_H
+//End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_settings_api/inc/mpsetcalldiverting.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 class is virtual abstract class for setting/cancelling and
+*       inquiring divert(s).
+*
+*
+*/
+
+
+#ifndef     MPSETCALLDIVERTING_H
+#define     MPSETCALLDIVERTING_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <nwdefs.h>
+
+//  CLASS DEFINITIONS 
+/**
+*  MPsetCallDiverting class is virtual class for Diverting.
+*  @lib phonesettings.lib
+*  @since 1.0
+*/
+class   MPsetCallDiverting
+    {
+    public:
+
+        /**
+        * Sets diverting to the network.
+        *
+        * @param aDivert New divert settings.
+        * @param aBsc List of basic service groups .
+        * @param aVmbx Divert to voice mailbox number.
+        */
+        virtual void SetDivertingL( const TCallDivertSetting& aDivert, 
+            TBasicServiceGroups aBsc, TBool aVmbx ) = 0;        
+          
+        /**
+        * Checks the diverting status from network.
+        *
+        * @param aServiceGroup Service group indication.
+        * @param aCondition Diverting conditions.
+        * @param aBsc List of basic service groups.
+        */
+        virtual void GetDivertingStatusL( const TServiceGroup aServiceGroup, 
+            const TCallDivertingCondition aCondition, 
+            TBasicServiceGroups aBsc ) = 0;
+          
+        /**
+        * Cancels current request.
+        *
+        * @return Returns error code.
+        */
+        virtual TInt CancelCurrentRequest() = 0;
+
+    };
+
+#endif      //  MPSETCALLDIVERTING_H
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_settings_api/inc/mpsetcallwaiting.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*         MPsetCallWaiting defines interface to get and set call waiting setting
+*         in the network. All the methods are asynchronous. Observer handles
+*         completion.
+*
+*
+*/
+
+
+#ifndef     MPSETCALLWAITING_H
+#define     MPSETCALLWAITING_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <nwdefs.h>
+
+//  FORWARD DECLARATIONS
+class MPsetCallWaitingObserver;
+
+//  CLASS DEFINITIONS 
+/**
+*  MPsetCallWaiting class is virtual class for Call Waiting.
+*  @lib phonesettings.lib
+*  @since 1.0
+*/
+class   MPsetCallWaiting
+    {
+    public:
+
+        // Call waiting action
+        enum TSetCallWaiting
+            {
+            EActivateCallWaiting,
+            EDeactivateCallWaiting
+            };
+
+        // Call waiting status
+        enum TGetCallWaitingStatus
+            {
+            EStatusActive,
+            EStatusDisabled,            
+            EStatusNotAvailable,
+            EStatusNotProvisioned,
+            EStatusUnknown
+            };
+
+    public:         
+
+        /**
+        * Sets call waiting to the network.
+        *
+        * @param aSetting New settings for the Call Waiting.
+        * @param aBsc Basic service group concerned.
+        */
+        virtual void SetCallWaitingL( 
+            MPsetCallWaiting::TSetCallWaiting aSetting, 
+            TBasicServiceGroups aBsc ) = 0;
+
+        /**
+        * Checks the call waiting status from network.
+        */
+        virtual void GetCallWaitingStatusL()=0;
+
+        /**
+        * Cancels the call waiting-request process.
+        */
+        virtual TInt CancelProcess()=0;
+    };
+
+#endif // MPSETCALLWAITING_H
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_settings_api/inc/mpsetcli.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*    MPsetCli defines interface to get and set CLI settings from the network.
+*
+*
+*/
+
+
+#ifndef     MPSETCLI_H
+#define     MPSETCLI_H
+
+// INCLUDES
+#include <e32base.h>
+
+// CLASS DEFINITIONS 
+/**
+*  MPsetCli class is virtual class for CLI.
+*  @lib phonesettings.lib
+*  @since 1.0
+*/
+class   MPsetCli
+    {
+    public:
+
+        /**
+        * Shows COLP (Connected Line Identification Presentation) mode.
+        */
+        virtual void GetColpModeL() = 0;
+
+        /**
+        * Shows CLIP (Calling Line Identification Presentation) mode.
+        */
+        virtual void GetClipModeL() = 0;
+        
+        /**
+        * Shows CLIR (Calling Line Identification Restriction) mode.
+        */
+        virtual void GetClirModeL() = 0;
+
+        /**
+        * Shows COLR (Connected Line Identification Restriction) mode.
+        */
+        virtual void GetColrModeL() = 0;
+
+        /**
+        * Shows CNAP (Calling Number Presentation) mode.
+        * 
+        */
+        virtual void GetCnapL() = 0;
+
+        /**
+        * Cancels any (and all) request(s).
+        */
+        virtual void CancelAll() = 0;
+    };
+#endif // MPSETCLI_H
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_settings_api/inc/mpsetnetworkmode.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* 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: 
+*       MPsetNetworkMode defines interface to get network mode information.
+*       MPsetNetworkInfoObserver is used to handle completion of function 
+*       calls of this class. All the methods are asynchronous.    
+*       Observer handles completion                                           
+*
+*
+*/
+
+
+#ifndef     MPSETNETWORKMODE_H
+#define     MPSETNETWORKMODE_H
+
+//  INCLUDES
+#include <e32base.h>
+
+//  CLASS DEFINITIONS 
+/**
+*  MPsetNetworkMode class is virtual class for system network mode.
+*  @lib phonesettings.lib
+*  @since 2.6
+*/
+class   MPsetNetworkMode
+    {
+    public:
+
+        /**
+        * Returns the Network Mode list (GSM/UMTS/DualMode).
+        * @since 2.6
+        */
+        //virtual void GetNetworkModeSelectionList() = 0;        
+
+        /**
+        * Returns the currently selected Network Mode (GSM/UMTS/DualMode).
+        *
+        * @since 2.6
+        */
+        virtual void GetCurrentNetworkModeSelectionL() = 0;
+
+        /**
+        * Sets the Network Mode to TSY side (GSM/UMTS/DualMode).
+        *
+        * @param aNetworkMode currently selected network mode.
+        * @since 2.6
+        */
+        virtual void SetNetworkModeSelectionL( TUint32& aNetworkMode ) = 0;
+
+
+    };
+
+#endif // MPSETNETWORKMODE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_settings_api/inc/mpsetnetworkselect.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,156 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*       MPsetNetworkSelect defines interface to get network information and  
+*       select network. MPsetNetworkInfoObserver is used to handle completion 
+*       of function calls of this class. All the methods are asynchronous.    
+*       Observer handles completion                                           
+*
+*
+*/
+
+
+#ifndef     MPSETNETWORKSELECT_H
+#define     MPSETNETWORKSELECT_H
+
+//  INCLUDES
+#include <e32base.h>
+
+//  FORWARD DECLARATIONS
+class MPsetNetworkInfoObserver;
+
+//  CLASS DEFINITIONS 
+/**
+*  MPsetNetworkSelect class is virtual class for network selection.
+*  @lib phonesettings.lib
+*  @since 1.0
+*/
+class   MPsetNetworkSelect
+    {
+    public:
+
+        //Length of codes (MNC and MCC)
+        enum
+            {
+            EPSetNetMcc = 4,
+            EPSetNetMnc = 8
+            };
+
+        //TNetworkId contains network ID and country ID
+        struct TNetworkId
+            {
+            TBuf<EPSetNetMcc> iCountryCode;
+            TBuf<EPSetNetMnc> iNetworkCode;
+            };
+
+        //Length of network names
+        enum
+            {
+            ENetShortNameSize = 20,
+            ENetLongNameSize = 30
+            };
+
+        //Network selection mode
+        enum TSelectMode
+            {
+            ENetSelectModeAutomatic,
+            ENetSelectModeManual
+            };
+
+        //Status of network
+        enum TNetworkStatus
+            {
+            ENetStatUnknown,
+            ENetStatAvailable,
+            ENetStatCurrent,
+            ENetStatForbidden
+            };
+        //Network access type
+        enum TNetworkAccess
+            {
+            ENetNetworkGSM,
+            ENetNetworkWCDMA,
+            ENetNetworkGSMandWCDMA
+            };
+
+        //Information about network
+        struct TNetworkInfo
+            {
+            TNetworkId iId;
+            TNetworkStatus iStatus;
+            TSelectMode iMode;
+            TNetworkAccess iAccess;
+            TBuf<ENetShortNameSize> iShortName;
+            TBuf<ENetLongNameSize> iLongName;
+            };        
+
+        //Current status of the network
+        enum TCurrentNetworkStatus
+            {
+            ENotRegisteredNotSearching,
+            ERegisteredOnHomeNetwork,
+            ENotRegisteredSearching,
+            ERegistrationDenied,
+            EUnknown,
+            ERegisteredRoaming
+            };
+
+        //Current information about the network
+        struct TCurrentNetworkInfo
+            {
+            TCurrentNetworkStatus iStatus;
+            TUint iLocationAreaCode;
+            TUint iCellId;
+            };
+
+    public:
+  
+        /**
+        * Puts network retrieve results into array.
+        *
+        */
+        virtual void GetAvailableNetworksL() = 0; 
+          
+        /**
+        * Returns current network information.
+        *
+        * @param aInfo Current network information
+        * @return Returns error code.
+        */
+        virtual TInt GetCurrentNetworkInfo( 
+            MPsetNetworkSelect::TCurrentNetworkInfo& aInfo ) = 0;
+          
+        /**
+        * Returns current network selection mode.
+        *
+        * @param aMode Network selection mode
+        * @return Returns error code.
+        */
+        virtual TInt GetNetworkSelectMode( TSelectMode& aMode) = 0;
+          
+        /**
+        * Sets network, also for selecting automatic/manual mode.
+        *
+        * @param aInfo Network information
+        */
+        virtual void SelectNetworkL( const TNetworkInfo& aInfo ) = 0;
+          
+        /**
+        * CancelProcess-function, cancels the requests.
+        */
+        virtual void CancelProcess() = 0;
+    };
+
+#endif // MPSETNETWORKSELECT_H
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_settings_api/inc/psetcallbarring.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,226 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 barring class. Sets and gets call barring setting.
+*
+*
+*/
+
+
+#ifndef     PSETCALLBARRING_H
+#define     PSETCALLBARRING_H
+
+// INCLUDES
+#include "mpsetbarringobs.h" 
+#include "mpsetcallbarring.h" 
+#include "msssettingsobserver.h" 
+#include "nwdefs.h"             
+#include <mmretrieve.h>
+#include <etelmm.h>
+
+// FORWARD DECLARATIONS
+class MPsetRequestObserver;
+class RSSSettings;
+
+// CLASS DEFINITIONS
+/**
+*  CPsetCallBarring class is call barring SS handler. 
+*  @lib phonesettings.lib
+*  @since 1.0
+*/
+class CPsetCallBarring : public CActive,
+                         public MPsetCallBarring,
+                         public MSSSettingsObserver
+    {
+    public:
+
+        // The type of request.
+        enum TPSetBarringRequest
+            {
+            EPSetRequestNone,
+            EPSetRequestChangeBarring,
+            EPSetRequestGetStatus,
+            EPSetRequestChangeBarringPwd,
+            EPSetRequestChangeCommonPwd
+            };
+
+        /**
+        * Symbian OS 2-phase Constructor.
+        *
+        * @param aObserver Observer for call barring.
+        * @param aPhone Provides client access to mobile phone 
+        *               functionality provided by TSY.
+        * @return Created CPsetCallBarring object.
+        */
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        static CPsetCallBarring* NewL( MPsetBarringObserver& aObserver, 
+            RMobilePhone& aPhone );
+
+        /**
+        * Destructor.
+        */
+        IMPORT_C ~CPsetCallBarring();
+
+    public: //methods from base classes
+
+        /**
+        * @see MPsetCallBarring::SetBarringL().
+        */
+        IMPORT_C void SetBarringL( const TCallBarringSetting& aBarring, 
+            TBasicServiceGroups aBsc );
+
+        /**
+        * @see MPsetCallBarring::GetBarringStatusL().
+        */      
+        IMPORT_C void GetBarringStatusL( const TServiceGroup aGroup, 
+            const TBarringProgram aMode ); 
+
+        /**
+        * @see MPsetCallBarring::CancelCurrentRequest().
+        */
+        IMPORT_C TInt CancelCurrentRequest();
+        
+        /**
+        * @see MSSSettingsObserver::PhoneSettingChanged().
+        */
+        void PhoneSettingChanged( TSSSettingsSetting aSetting, TInt aNewValue );     
+
+    public: //new
+
+        /**
+        * DEPRECATED - calls the method below.
+        */
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        IMPORT_C void ChangePasswordL(
+            RMobilePhone::TMobilePhonePasswordChangeV2& aPwds,
+            TBool aIsBarringPassword );
+
+        /**
+        * Request to change ss password.
+        * @param aPwds Passwords (old, new, verified new) 
+        *              needed for the operation.
+        * @since 2.0
+        */
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        IMPORT_C void ChangePasswordL( 
+            RMobilePhone::TMobilePhonePasswordChangeV2& aPwds );
+        
+        /** 
+        * Sets request observer.
+        *
+        * @param aObs Where the request completion should be informed to.
+        */        
+        IMPORT_C void SetRequestObserver( MPsetRequestObserver* aObs );
+
+    private:    // constructors
+
+        void ConstructL( MPsetBarringObserver& aObserver );
+
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        CPsetCallBarring( RMobilePhone& aPhone );
+
+    private:
+    
+        void ValidateBsc( TBasicServiceGroups& aBsc );
+
+        void SetObserver( MPsetBarringObserver& aObserver );
+
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        RMobilePhone::TMobilePhoneCBCondition SetBarringProgram ( 
+            TBarringProgram aMode );
+
+        static void DoHandleLeave( TAny* aAny );
+
+        void CleanupLeavePushL();
+
+        void HandleLeave();
+
+        void StartRequestingL( const TInt& aRequest );
+
+        TBool GetPlurality();
+
+        void RequestCompleted( const TInt& aError );
+
+        //Empties member variables.
+        void ClearParams();
+
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        RMobilePhone::TMobilePhoneServiceAction SetBarringAction( 
+            const TBarringSetting& aSetting );
+
+
+        void HandleInquiryResultL();
+
+        void SetRequestStatus( TPSetBarringRequest aStatus );
+
+    private: //from base class CActive
+
+        void DoCancel();
+
+        void RunL(); 
+
+    private:
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        // Provides client access to mobile line functionality provided by TSY.
+        RMobileLine* iLine;
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        // Provides client access to mobile phone functionality provided by TSY.
+        RMobilePhone& iPhone;
+        // Barring observer, handles results.
+        MPsetBarringObserver* iObserver;
+        // Currently active request
+        TPSetBarringRequest iCurrentReq;
+        // Barring settings
+        TCallBarringSetting iChangeSetting;
+        // Request handler
+        MPsetRequestObserver* iReqObserver;
+        // Retrieves the Call Barring status list from the phone.
+        CRetrieveMobilePhoneCBList* iCbStatusInterrogator;
+        //Barring parameters
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/    
+        RMobilePhone::TMobilePhoneCBChangeV1 iBarringParameters;
+        // Value of Alternative Line Selection setting
+        TSSSettingsAlsValue iAls;
+        // SsSettings pointer, accesses supplementary services on SIM
+        RSSSettings* iSsSettings;
+    };
+#endif      
+//  PSETCALLBARRING_H      
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_settings_api/inc/psetcalldiverting.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,228 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 diverting class. Sets and gets call diverting status. 
+*
+*
+*/
+
+
+#ifndef     PSETCALLDIVERTING_H
+#define     PSETCALLDIVERTING_H
+
+//  INCLUDES           
+#include <mmretrieve.h>
+#include "nwdefs.h"             
+#include "psetconstants.h" 
+#include "mpsetcalldiverting.h" 
+
+//  FORWARD DECLARATIONS
+class CDesC16ArrayFlat;
+class MPsetDivertObserver;
+class MPsetRequestObserver;
+class RVmbxNumber;
+class CRepository;
+class TCallDivertNotifySetting;
+class MPSetCallDiverting;
+class CPSetCallDivertingFactory;
+class MCallDiverting;
+
+enum TSelectedLine
+    {
+    EPrimaryLine,       // ALS is supported by ME & SIM and Line 1 (Primary Line) is the current line
+    EAuxiliaryLine,     // ALS is supported by ME & SIM and Line 2 (Auxiliary Line) is the current line
+    EUnknownLine,       // ALS is supported by ME & SIM but TSY can not determine line selection
+    ENotSupportedLine   // ALS is not supported either by ME or SIM or both.
+    };
+
+//  CLASS DECLARATION  
+/**
+*  CPsetCallDiverting class is call diverting SS handler. 
+*  @lib phonesettings.lib
+*  @since 1.0
+*/
+class   CPsetCallDiverting : public CBase,
+                             public MPsetCallDiverting
+    {
+    public: // constructor & destructor
+
+        /**
+        * Symbian OS 2-phase Constructor.
+        *
+        * @param aObserver Call divert observer.
+        * @param aPhone Provides client access to 
+        *               mobile phone functionality provided by TSY.
+        * @return Created CPsetCallDiverting object.
+        */
+        IMPORT_C static CPsetCallDiverting* NewL( 
+            MPsetDivertObserver& aObserver, 
+            RMobilePhone& aPhone);
+        
+        /* 
+        * Destructor.
+        */
+        IMPORT_C ~CPsetCallDiverting();
+                
+    public: // From base class.
+
+        /**
+        * @see MPsetCallDiverting::SetDivertingL().
+        */
+        IMPORT_C void SetDivertingL( const TCallDivertSetting& aDivert, 
+            TBasicServiceGroups aBsc, TBool aVmbx = EFalse ); 
+
+        /**
+        * @see MPsetCallDiverting::GetDivertingStatusL().
+        */ 
+        IMPORT_C void GetDivertingStatusL( const TServiceGroup aServiceGroup, 
+            const TCallDivertingCondition aCondition, 
+            TBasicServiceGroups aBsc );
+        
+        /**
+        * @see MPsetCallDiverting::CancelCurrentRequest().
+        */ 
+        IMPORT_C TInt CancelCurrentRequest(); 
+    
+    public: //new
+
+        /**
+        *  Gets the default time for CF No Reply.
+        *  No error checking for return values which should be
+        *  5-30, in steps of 5.
+        *
+        * @return Returns the current timer value.
+        */
+        IMPORT_C TInt GetTimerValueL();    
+    
+        /**
+        *  Sets the default time for CF No Reply.
+        *  No error checking to parameters, which should be on range 5-30,
+        *  using steps of 5.
+        *
+        *  @param aIndex New value for timer.
+        *  @return Returns error code.
+        */
+        IMPORT_C TInt SetTimerValueL( const TInt& aIndex );    
+        
+        /**
+        * The default (last forwarded-to) numbers can be retrieved 
+        * through this method. 
+        *
+        * @param aDefNumbers Read default numbers from shared data.
+        * @return Returns error code or amount of numbers read.
+        */
+        IMPORT_C TInt GetDefaultNumbersL( CDesC16ArrayFlat& aDefNumbers );            
+
+        /**
+        * Sets new default number to the default numbers list, 
+        * erases the oldest one automatically, if three numbers already in the
+        * shared data.
+        *
+        * @param aNumber New number to be added.
+        * @return Returns error code.
+        */
+        IMPORT_C TInt SetNewDefaultNumberL( TDes& aNumber );    
+
+        /**
+        * Swaps the most recently used number to first in shared data file.
+        *
+        * @param  aLocation Used number's location (1-3) in shared data.
+        */
+        IMPORT_C void SwapDefaultNumberL( const TInt& aLocation );
+
+        /**
+        * Saves last used data number to shared data.
+        *
+        * @param  aNumber Number used for data call forwarding.
+        * @return Returns error code.
+        */
+        IMPORT_C TInt SetUsedDataNumberL( TTelNumber& aNumber );
+
+        /**
+        * Saves last used fax number to shared data.
+        *
+        * @param  aNumber Number used for data fax forwarding.
+        * @return Returns error code.
+        */
+        IMPORT_C TInt SetUsedFaxNumberL( TTelNumber& aNumber );
+
+        /**
+        * Gets the phone number used for fax call forwarding.
+        *
+        * @return Number used for data call forwarding.
+        */
+        IMPORT_C HBufC* GetUsedFaxNumberLC();
+
+        /**
+        * Gets the phone number used for data call forwarding.
+        *
+        * @return Number used for data call forwarding.
+        */
+        IMPORT_C HBufC* GetUsedDataNumberLC();
+
+        /** 
+        * Sets request observer.
+        *
+        * @param aObs Where the request completion should be informed to.
+        */        
+        IMPORT_C void SetRequestObserver( MPsetRequestObserver* aObs );
+
+        /** 
+        * Queries for voice mail box number. If number is undefined, number 
+        * entry pops up.
+        * @since 2.0
+        * 
+        * @param aTelNumber Vmbx number.
+        */        
+        IMPORT_C void VoiceMailQueryL( TDes& aTelNumber );
+        
+        /** 
+        * Queries for video mailbox number. If number is undefined, number 
+        * entry pops up.
+        * @since 3.1
+        * 
+        * @param aTelNumber Video mailbox number.
+        */         
+        IMPORT_C void VideoMailQueryL( TDes& aTelNumber );
+
+    private: //new
+        
+        TInt OpenVideoMailboxLC( TDes& aTelNumber, RVmbxNumber& aVmbx );
+        
+    private: // constructors
+              
+        void ConstructL( MPsetDivertObserver& aObserver );
+        
+        CPsetCallDiverting( RMobilePhone& aPhone );
+               
+    private: //member data
+        
+        // Observer for Call divert requests
+        MPsetDivertObserver* iObserver;
+        
+        // Provides client access to mobile phone functionality provided by TSY.
+        RMobilePhone& iPhone;
+        
+        // Request observer
+        MPsetRequestObserver* iReqObserver;
+
+        // Central repository.
+        CRepository* iRepository;
+        
+        // Call Divert implementation.
+        MCallDiverting* iDivert;
+     };
+
+#endif      //  PSETCALLDIVERTING_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_settings_api/inc/psetcallwaiting.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,174 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CPsetCallWaiting is call waiting SS setting abstraction.
+*
+*
+*/
+
+
+#ifndef     PSETCALLWAITING_H
+#define     PSETCALLWAITING_H
+
+// INCLUDES
+#include <etelmm.h>
+#include <mmretrieve.h>
+#include "msssettingsobserver.h" 
+#include "nwdefs.h"
+#include "mpsetcallwaiting.h" 
+#include "mpsetcallwaitingobs.h" 
+#include "psetconstants.h" 
+ 
+
+// FORWARD DECLARATIONS
+class MAdvGsmLineCallWaitingMode;
+class MPsetRequestObserver;
+
+
+// CLASS DECLARATION
+/**
+*  CPsetCallWaiting class is call waiting SS handler. 
+*  @lib phonesettings.lib
+*  @since 1.0
+*/
+class CPsetCallWaiting :    public CActive, 
+                            public MPsetCallWaiting,
+                            public MSSSettingsObserver
+    {
+    public: // constructor & destructor
+
+        /**
+        * Symbian OS 2-phase Constructor.
+        *
+        * @param aPhone Provides client access to 
+        *               mobile phone functionality provided by TSY.
+        * @param aObserver Call Waiting observer.
+        * @return Created CPsetCallWaiting object.
+        */
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        IMPORT_C static CPsetCallWaiting* NewL( RMobilePhone& aPhone, 
+            MPsetCallWaitingObserver& aObserver );
+      
+        /**
+        * Destructor.
+        */
+        IMPORT_C ~CPsetCallWaiting();
+
+    public: // from base class MPsetCallWaiting
+
+        /**
+        * @see MPsetCallWaiting::SetCallWaitingL().
+        */
+        IMPORT_C void SetCallWaitingL( 
+            TSetCallWaiting aSetting,
+            TBasicServiceGroups aBsc );
+
+        /**
+        * @see MPsetCallWaiting::GetCallWaitingStatusL(). 
+        */
+        IMPORT_C void GetCallWaitingStatusL();
+
+
+        /**
+        * @see MPsetCallWaiting::CancelProcess().
+        */
+        IMPORT_C TInt CancelProcess();
+
+    public: //new
+
+        /**
+        * Sets request observer.
+        *
+        * @param aObs Where the request completion should be informed to.
+        */
+        IMPORT_C void SetRequestObserver( MPsetRequestObserver* aObs );
+        
+        /**
+        * @see MSSSettingsObserver::PhoneSettingChanged().
+        */
+        void PhoneSettingChanged( TSSSettingsSetting aSetting, TInt aNewValue );     
+
+    private: // from base class CActive
+
+        void RunL();
+
+        void DoCancel();
+
+    private: //new
+
+        //Service requests for call waiting.
+        enum TPSetServiceRequest 
+            {
+            EPSetServiceRequestNone,
+            EPSetServiceRequestGetCallWaitingStatus,
+            EPSetServiceRequestSetCallWaiting
+            };
+
+        void SetPsuiObserver( MPsetCallWaitingObserver& aObserver );
+
+        void CleanupLeavePushL();
+
+        void HandleLeave();
+        
+        static void DoHandleLeave( TAny* aAny );
+
+        void RequestCompleted( const TInt& aError );
+
+        void SetRequestStatus( TPSetServiceRequest aStatus );
+        
+        void ValidateBsc( TBasicServiceGroups& aBsc );
+
+    private:    // constructors
+    
+        void ConstructL( MPsetCallWaitingObserver& aObserver );
+        
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        CPsetCallWaiting( RMobilePhone& aPhone ); 
+ 
+    private:        
+
+        //Request observer
+        MPsetRequestObserver* iReqObserver;        
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        //Provides client access to mobile phone functionality provided by TSY.
+        RMobilePhone& iPhone;
+        //Call waiting observer, shows notes associated with call waiting.
+        MPsetCallWaitingObserver* iObserver;
+        //Currently active request
+        TPSetServiceRequest iServiceRequest;
+        //Call waiting action type
+        MPsetCallWaiting::TSetCallWaiting iSetValue;
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        //Retrieves the Call Waiting status list from the phone.
+        CRetrieveMobilePhoneCWList* iCwInterrogator;     
+        // Value of Alternative Line Selection setting
+        TSSSettingsAlsValue iAls;
+        // SsSettings pointer, accesses supplementary services on SIM
+        RSSSettings* iSsSettings;
+        // For run time variation.
+        TBool iCallWaitingDistinquishEnabled;
+    };
+#endif // PSETCALLWAITING_H
+// end of file
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_settings_api/inc/psetcli.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,181 @@
+/*
+* 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:  CPsetCli is calling line identification restriction SS
+*                setting abstraction. 
+*
+*
+*/
+
+
+#ifndef     PSETCLIR_H
+#define     PSETCLIR_H
+
+// INCLUDES
+#include <etelmm.h>
+#include "mpsetcliobserver.h" 
+#include "mpsetcli.h" 
+
+
+// FORWARD DECLARATIONS
+class MPsetRequestObserver;
+
+
+// CLASS DECLARATION
+/**
+*  CPsetCli class is calling line identification restriction SS handler. 
+*  @lib phonesettings.lib
+*  @since 1.0
+*/
+class   CPsetCli :  public CActive, 
+                    public MPsetCli
+    {
+    public: // constructor & destructor
+
+        // CLIR's current value
+        enum TPsetClirSetting
+            {
+            EPsetClirPreset = -1,
+            EPsetClirActive = 1, 
+            EPsetClirInactive = 0
+            };
+
+        /**
+        * Symbian OS 2-phase constructor.
+        * 
+        * @param aPhone Provides client access to 
+        *               mobile phone functionality provided by TSY.
+        * @param aObserver Observer for CLI.
+        * @return Created CPsetCli object.
+        */
+        IMPORT_C static CPsetCli* NewL( RMobilePhone& aPhone, 
+            MPsetCliObserver& aObserver );
+
+        /** 
+        * Destructor.
+        */ 
+        IMPORT_C ~CPsetCli();
+
+    public: //from base classes
+
+        /**
+        * @see MPsetCli::GetColpModeL
+        * Can leave, but due to inheritance not an L-function.
+        */
+        IMPORT_C void GetColpModeL();
+
+        /**
+        * @see MPsetCli::GetClipModeL
+        * Can leave, but due to inheritance not an L-function.
+        */
+        IMPORT_C void GetClipModeL();
+       
+        /**
+        * @see MPsetCli::GetClirModeL
+        * Can leave, but due to inheritance not an L-function.
+        */
+        IMPORT_C void GetClirModeL();
+
+        /**
+        * @see MPsetCli::GetColrModeL
+        * Can leave, but due to inheritance not an L-function.
+        */
+        IMPORT_C void GetColrModeL();
+
+        /**
+        * @see MPsetCli::CancelAll
+        * Can leave, but due to inheritance not an L-function.
+        */
+        IMPORT_C void CancelAll();        
+        
+        /*
+        * @see MPsetCli::GetCnapL
+        * @since Series60_1.2
+        */
+        IMPORT_C void GetCnapL();
+
+    public: //new
+
+        /*
+        * Sets request observer.
+        *
+        * @param aObs Where the request completion should be informed to.
+        */
+        IMPORT_C void SetRequestObserver( MPsetRequestObserver* aObs );
+
+    private: //constructor
+
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        CPsetCli( RMobilePhone& aPhone );
+
+    private: //from base class CActive
+        
+        void RunL();
+
+        void DoCancel();
+
+    private: //new
+
+        void SetObserver( MPsetCliObserver& aObserver );
+
+        void CleanupLeavePushL();
+
+        void HandleLeave();
+
+        static void DoHandleLeave( TAny* aAny );
+
+        void RequestCompleted( const TInt& aError );
+
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        //Issues requests.
+        void IssueRequestL( RMobilePhone::TMobilePhoneIdService aService );
+
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        //Set request status.
+        void SetRequestStatus( RMobilePhone::TMobilePhoneIdService aStatus );
+
+    private: //Member data
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        //Provides client access to mobile phone functionality provided by TSY.
+        RMobilePhone& iPhone;
+        //Observer for CPsetCli.
+        MPsetCliObserver* iObserver;
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        //Current request for CPsetCli.
+        RMobilePhone::TMobilePhoneIdService iRequestedService;
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        //The result of inquiry.
+        RMobilePhone::TMobilePhoneIdServiceStatus iServiceStatus;
+        //Request observer.
+        MPsetRequestObserver* iReqObserver;
+    };
+#endif // __PSETCLIR_H
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_settings_api/inc/psetconstants.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Various Constants
+*
+*
+*/
+
+
+#ifndef     PSETCONSTANTS_H
+#define     PSETCONSTANTS_H
+
+//Common
+const TUid KPSetUidPset = { 0x100058E3 };
+const TInt KPSetUnusedValue = 255; //unknown basic service group
+const TInt KPSetNumberOfBsc = 13;
+const TInt KPsetRequestAlreadySet = -1;
+const TInt KPsetPhoneNumberLength = 100;
+typedef TBuf<KPsetPhoneNumberLength> TTelNumber;
+
+//Divert object
+const TInt KPSetDefaultNumberMax = 3;
+const TInt KPSetDefaultDelayTimeValue = 0;
+const TInt KPSetFirstDefNumber = 1;
+const TInt KPSetSecondDefNumber = 2;
+const TInt KPSetThirdDefNumber = 3;
+const TInt KPsetDelayTimeDivider = 5;
+const TInt KPsetDefaultTimerValue = 30;
+const TInt KPsetMatchingChars = 7;
+_LIT( KPSetAsterisk, "*" );
+
+//Barring
+const TInt KPsetPwdLength = 10;
+typedef TBuf<KPsetPwdLength> TBarringPassword; 
+
+// Network object
+const TInt KPSetNetworkInfoArrayGranularity = 10;
+
+// Service codes for setting passwords
+const TInt KPsetAllSSServices = 0;
+const TInt KPsetBarringService = 330;
+
+//ETEL connection
+const TInt KPSetRetryCount = 7;
+const TInt KPSetRetryTimeout = 100000; 
+const TInt KPSetNoLinesAvailable = -1;
+
+#endif //PSETCONSTANTS_H
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_settings_api/inc/psetcontainer.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,148 @@
+/*
+* 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: 
+*      CPsetContainer is the general access class for phonesettings.
+*      Container must exists as long as other objects are used.          
+*
+*
+*/
+
+
+#ifndef     PSETCONTAINER_H
+#define     PSETCONTAINER_H
+
+//  INCLUDES
+#include <psetcallwaiting.h> 
+#include <psetcalldiverting.h> 
+#include <psetcallbarring.h> 
+#include <psetcli.h> 
+#include <psetnetwork.h> 
+#include <psetrefreshhandler.h> 
+
+
+// FORWARD DECLARATIONS
+class CPSetRefreshHandlerImpl;
+
+
+// CLASS DECLARATION
+/**
+*  CPsetContainer class is the general access class for phonesettings.
+*  @lib phonesettings.lib
+*  @since 1.0
+*/
+class CPsetContainer : public CBase
+    {
+    public: //constructor & destructor
+
+        /* Symbian OS 2-phase Constructor. */
+        IMPORT_C static CPsetContainer* NewL();
+
+        /* Destructor */
+        IMPORT_C ~CPsetContainer();
+
+    public:
+        /**
+        * Creates CPsetCallWaiting-object.
+        *
+        * @param aObserver Observer to CPsetCallWaiting class.
+        * @return returns CPsetCallWaiting-pointer
+        */
+        IMPORT_C CPsetCallWaiting* CreateCWObjectL( 
+            MPsetCallWaitingObserver& aObserver );
+        
+        /**
+        * Creates CPsetCallDiverting-object.
+        * 
+        * @param  aObserver Observer to CPsetCallDiverting class.
+        * @return returns CPsetCallDiverting-pointer
+        */
+        IMPORT_C CPsetCallDiverting* CreateCFObjectL( 
+            MPsetDivertObserver& aObserver );
+
+        /**
+        * Creates CPsetClir-object.
+        * 
+        * @param aObserver Observer to CPsetCli class.
+        * @return returns CPsetClir-pointer
+        */
+        IMPORT_C CPsetCli* CreateCliObjectL( MPsetCliObserver& aObserver );
+        
+        /**
+        * Creates CPsetCallBarring-object.
+        *
+        * @param aObserver Observer to CPsetCallBarring class.
+        * @return returns CPsetCallBarring-pointer
+        */
+        IMPORT_C CPsetCallBarring* CreateCBObjectL( 
+            MPsetBarringObserver& aObserver);
+         
+        /**
+        * Creates CPsetNetwork-object.
+        * 
+        * @param aObserver Observer to CPsetNetwork class.
+        * @return Returns CPsetNetwork-pointer.
+        */
+        IMPORT_C CPsetNetwork* CreateNetworkObjectL(
+            MPsetNetworkInfoObserver& aObserver );
+
+        /**
+        * Creates refresh handler object.
+        * 
+        * @since 2.8.
+        * @return Return Refresh handler pointer.
+        */
+        IMPORT_C CPSetRefreshHandler* CreateRefreshHandlerL();
+
+        /**
+        * Creates CPsetNetwork-object.
+        * 
+        * @param aObserver Observer to CPsetNetwork class.
+        * @return Returns CPsetNetwork-pointer.
+        */
+        IMPORT_C CPsetNetwork* CreateNetworkModeObjectL(
+            MPsetNetworkModeObserver& aModeObserver );
+
+
+    private: //constructors
+
+        void ConstructL();
+
+    private: //new
+
+        TInt ConnectServer();
+
+    private:
+        //Provides client access to mobile phone functionality provided by TSY.
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        RMobilePhone iPhone;
+        //ETEL telephony server.
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        RTelServer   iServer;
+        //Provides client access to mobile line functionality provided by TSY.
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        RMobileLine  iLine;
+    };
+
+#endif // PSETCONTAINER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_settings_api/inc/psetcsp.h	Wed Jul 21 18:26:52 2010 +0300
@@ -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: 
+*      Customer Service Profile wrapper layer for SsSettings. 
+*      PsetCustomerServiceProfile is a class that access CSP through
+*      SSsettings. It is in Phone Settings to provide easier access 
+*      to CSP values. Whole class should only be used if CSP is supported.                                                         
+*
+*
+*/
+
+
+#ifndef     PSETCSP_H
+#define     PSETCSP_H
+
+// INCLUDES
+#include <e32base.h>
+#include <rcustomerserviceprofilecache.h> 
+
+// CLASS DECLARATION
+/**
+*  CPsetCustomerServiceProfile class is a wrapper for Ss Settings.
+*  @lib phonesettings.lib
+*  @since 1.0
+*/
+class CPsetCustomerServiceProfile : public CBase
+    {
+
+    public: // constructor & destructor
+
+        /** 
+        * Symbian OS 2-phase Constructor. 
+        * @return CPsetCustomerServiceProfile object.
+        */
+        IMPORT_C static CPsetCustomerServiceProfile* NewL();    
+
+        /**
+        * Destructor 
+        */
+        IMPORT_C ~CPsetCustomerServiceProfile();
+
+    public: // New functions
+
+        /**
+        * Checks if Call Waiting is to be supported 
+        * @param aSupport Feature supported.
+        * @return Error code or KErrNone.
+        */
+        IMPORT_C TInt IsCWSupported( TBool& aSupport );
+
+        /**
+        * Checks if Call Barring is to be supported .
+        * @param aSupport Feature supported.
+        * @return Error code or KErrNone.
+        */
+        IMPORT_C TInt IsCBSupported( TBool& aSupport );
+
+        /**
+        * Checks if Call Forwarding is to be supported.
+        * @param aSupport Feature supported.
+        * @return Error code or KErrNone.
+        */
+        IMPORT_C TInt IsCFSupported( TBool& aSupport );
+
+        /**
+        * Checks if Alternate Line is to be supported.
+        * @param aSupport Feature supported.
+        * @return Error code or KErrNone.
+        */
+        IMPORT_C TInt IsALSSupported( TBool& aSupport );
+
+        /**
+        * Opens Customer Service Profile from SIM.
+        * @return Error code or KErrNone.
+        */
+        IMPORT_C TInt OpenCSProfileL();
+
+        /**
+        * Checks if Manual Network Selection is to be supported.
+        * @since 1.2
+        * @param aSupport Feature supported.
+        * @return Error code or KErrNone.
+        */
+        IMPORT_C TInt IsNetworkSelectionSupported( TBool& aSupport );
+
+
+    public: // New functions
+
+        /**
+        * Checks if Call Waiting is to be supported in parameter. 
+        * @since 2.8
+        * @param aContainer The parameter to be checked.
+        * @return ETrue if supported, otherwise EFalse.
+        */
+        TBool CheckIfCWSupported(
+            const RMobilePhone::TCspCallCompletion aContainer ) const;
+
+        /**
+        * Checks if Call Barring is to be supported in parameter.
+        * @since 2.8
+        * @param aContainer The parameter to be checked.
+        * @return ETrue if supported, otherwise EFalse.
+        */
+        TBool CheckIfCBSupported(
+            const RMobilePhone::TCspCallRestriction aContainer ) const;
+
+        /**
+        * Checks if Call Forwarding is to be supported in parameter.
+        * @since 2.8
+        * @param aContainer The parameter to be checked.
+        * @return ETrue if supported, otherwise EFalse.
+        */
+        TBool CheckIfCFSupported(
+            const RMobilePhone::TCspCallOffering aContainer ) const;
+
+        /**
+        * Checks if Alternate Line is to be supported in parameter.
+        * @since 2.8
+        * @param aContainer The parameter to be checked.
+        * @return ETrue if supported, otherwise EFalse.
+        */
+        TBool CheckIfAlsSupported(
+            const RMobilePhone::TCspCPHSTeleservices aContainer ) const;
+
+        /**
+        * Checks if Manual Network Selection is supported in parameter.
+        * @since 2.8
+        * @param aContainer The parameter to be checked.
+        * @return ETrue if supported, otherwise EFalse.
+        */
+        TBool CheckIfNetworkSelectionSupported(
+            const RMobilePhone::TCspValueAdded aContainer ) const;
+
+    private:
+
+        /**
+        * Checks if the first parameter supports the feature mentioned in the
+        * second parameter.
+        * @since 2.8
+        * @param aContainer The parameter to be checked.
+        * @param aFeature The feature to be checked.
+        * @return ETrue if supported, otherwise EFalse.
+        */
+        TBool IsSupported(
+            const TInt aContainer,
+            const TInt aFeature ) const;
+
+
+    private: // Member data
+
+        // SsSettings' csp cache.
+        RCustomerServiceProfileCache* iCsp;
+    };
+#endif //PSETCSP_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_settings_api/inc/psetnetwork.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,247 @@
+/*
+* 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:  CPsetNetwork selects network and gets network information.
+*
+*
+*/
+
+
+#ifndef     PSETNETWORK_H
+#define     PSETNETWORK_H
+
+//  INCLUDES
+#include "mpsetnetworkselect.h" 
+#include "mpsetnetworkinfoobs.h" 
+#include "mpsetnetworkmodeobs.h" 
+#include "mpsetnetworkmode.h" 
+#include <etelmm.h>
+#include <rmmcustomapi.h> 
+
+// FORWARD DECLARATIONS
+class CPsetSAObserver;
+class CRetrieveMobilePhoneDetectedNetworks;
+class RMmCustomAPI;
+
+// CLASS DECLARATION
+/**
+*  CPsetNetwork class is used to handle network change requests.
+*  @lib phonesettings.lib
+*  @since 1.0
+*/
+class   CPsetNetwork :  public CActive, 
+                        public MPsetNetworkSelect,
+                        public MPsetNetworkMode
+    {
+    public: // constructor & destructor
+
+        /**
+        * Symbian OS 2-phase constructor.
+        * 
+        * @param aPhone TSY's phone object.
+        * @param aObserver Reference to network observer.
+        * @return Returns the CPsetNetwork-object
+        */
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        IMPORT_C static CPsetNetwork* NewL( RMobilePhone& aPhone, 
+            MPsetNetworkInfoObserver& aObserver );
+
+        /**
+        * Symbian OS 2-phase constructor.
+        * 
+        * @param aPhone TSY's phone object.
+        * @param aObserver Reference to network observer.
+        * @return Returns the CPsetNetwork-object
+        */
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        IMPORT_C static CPsetNetwork* NewL( RMobilePhone& aPhone, 
+            MPsetNetworkModeObserver& aObserver );
+
+
+        /* Destructor */
+        IMPORT_C ~CPsetNetwork();
+
+    public: // from base class MNetworkSelect
+
+        /**
+        * @see MNetworkSelect::GetAvailableNetworksL
+        */
+        IMPORT_C void GetAvailableNetworksL();
+
+        /**
+        * @see MNetworkSelect::GetCurrentNetworkInfo
+        */
+        IMPORT_C TInt GetCurrentNetworkInfo( 
+            TCurrentNetworkInfo& aInfo );
+
+        /**
+        * @see MNetworkSelect::GetNetworkSelectMode
+        */
+        IMPORT_C TInt GetNetworkSelectMode( TSelectMode& aMode );
+
+        /**
+        * @see MNetworkSelect::SelectNetworkL
+        */
+        IMPORT_C void SelectNetworkL( const TNetworkInfo& aInfo );
+
+        /**
+        * @see MNetworkSelect::CancelProcess
+        */
+        IMPORT_C void CancelProcess();
+
+    public: // From base class MPsetNetworkMode
+        
+        /**
+        * @see MPsetNetworkMode::SetNetworkModeSelectionL
+        * @since 2.6
+        */
+        IMPORT_C void SetNetworkModeSelectionL( TUint32& aNetworkMode );
+
+        /**
+        * @see MPsetNetworkMode::GetCurrentNetworkModeSelectionL
+        * @since 2.6
+        */
+        IMPORT_C void GetCurrentNetworkModeSelectionL();
+
+    public: //new
+
+        /**
+        * Checks if there is a call going on.
+        *
+        * @return Returns a non-zero if there is a call active, or error.
+        */
+        IMPORT_C TInt IsCallActive();
+
+        /**
+        * Checks if there is a gprs connection active.
+        * @return KErrNone, or error code.
+        */
+        IMPORT_C TInt IsGPRSConnected();
+
+        /* 
+        * Calls ETEL to start reseting the network.
+        * @return Error code, or KErrNone.
+        */
+        IMPORT_C TInt ResetNetworkSearch();
+
+        /* 
+        * Sets observer (Observer starts to listen again if reset).
+        * @param aObserver Value to set into observer.
+        */
+        IMPORT_C void SetNetSAObserver( MPsetNetworkInfoObserver& aObserver );
+
+        /* 
+        * Sets Network mode observer
+        * @param aObserver Value to set into Network mode observer.
+        */
+        IMPORT_C void SetNetworkModeObserver( MPsetNetworkModeObserver& 
+                                              aObserver );
+
+    private: // from base class CActive
+
+        void RunL();
+
+        void DoCancel();
+
+    private: // constructors
+
+        void ConstructL( MPsetNetworkInfoObserver& aObserver );
+
+        // this is required for the net container to create a pointer
+        void ConstructL( MPsetNetworkModeObserver& aObserver );
+
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        CPsetNetwork( RMobilePhone& aPhone );        
+
+    private: //new
+
+        void GetRegistrationStatusL();
+
+        void HideRequestNoteL();
+
+        void CleanupLeavePushL();
+
+        void HandleLeave();
+
+        static void DoHandleLeave( TAny* aAny );
+
+        void ClearParams();
+
+    private:
+        //Latest network settings information
+        TNetworkInfo iTempNetInfo;        
+        //Provides client access to mobile phone functionality provided by TSY.
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        RMobilePhone& iPhone;
+        //Currently active request.
+        MPsetNetworkInfoObserver::TServiceRequest iServiceRequest;
+        //Observer
+        CPsetSAObserver* iSAObserver;
+        //Network information observer
+        MPsetNetworkInfoObserver* iObserver;       
+        //Fetched network information (names, IDs)
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        CRetrieveMobilePhoneDetectedNetworks* iNetworkRetrieve;
+        //Current registartion status
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        RMobilePhone::TMobilePhoneRegistrationStatus iRegStatus;
+
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        //Selected network information
+        RMobilePhone::TMobilePhoneNetworkManualSelection iNwInfo;
+
+        //
+        // Network Mode related variables
+        //
+        //Network mode observer
+        MPsetNetworkModeObserver* iNetworkModeObserver;
+
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/
+        // Custom phone.
+        RMmCustomAPI iCustomPhone;
+        
+        //Currently active request.
+        MPsetNetworkModeObserver::TServiceRequest iModeRequest;
+
+        //Current Network Mode
+        TUint32 iNetworkModeCaps;
+
+        //Currently active observer, for assert handling
+        TInt iActiveObserver;
+    };
+#endif // PSETNETWORK_H
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_settings_api/inc/psetrefreshhandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,94 @@
+/*
+* 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:  The Refresh handler to inform refresses.
+*
+*/
+
+
+
+#ifndef PSETREFRESHHANDLER_H
+#define PSETREFRESHHANDLER_H
+
+
+//  INCLUDES
+#include <msssettingsrefreshobserver.h> 
+#include <msatrefreshobserver.h> 
+
+
+// DATA TYPES
+
+// Changed CSP settings.
+enum TPSetChangedCspSetting
+    {
+    EPSetNoChangedSetting = 0x0000, // No setting was changed in refresh.
+    EPSetCW               = 0x0001, // Call Waiting setting was changed.
+    EPSetCB               = 0x0002, // Call Barring was changed.
+    EPSetCF               = 0x0004, // Call Forwarding setting was changed.
+    EPSetALS              = 0x0008, // Alternate Line setting was changed.
+    EPSetNetSelSup        = 0x0010, // Manual Network Selection setting 
+                                    // was changed.
+    };
+
+
+// CLASS DECLARATION
+
+/**
+*  The Refresh handler to inform refresses.
+*
+*  @lib PhoneSettings.lib
+*  @since 2.8
+*/
+class CPSetRefreshHandler :
+    public CBase
+    {
+    public: // New functions
+
+        /**
+        * Start the waiting for refresh events.
+        * 
+        * @param aObserver The observer to handle refresh events.
+        * @param aObservedFile The file change to be observed.
+        * @param aObservedRefreshType The refresh type(s) to be observed.
+        */
+        virtual void NotifyFileChangeL(
+            MSSSettingsRefreshObserver& aObserver,
+            TSatElementaryFiles aObservedFile,
+            TSatRefreshType aObservedRefreshType ) = 0;
+
+        /**
+        * Cancel the notification started in NotifyFileChangeL.
+        * 
+        * @param aObserver The observer whose notify to be canceled.
+        * @param aObservedFile The file change to be canceled.
+        * @param aObservedRefreshType The refresh type to be canceled.
+        */
+        virtual void CancelNotify() = 0;
+
+        /**
+        * Get the changed CSP information after Refresh.
+        * 
+        * @param aChangedCspSettings The changed CSP settings, 
+        *                     TPSetChangedCspSetting values combined.
+        * @param aNewValues The new values of changed CSP settings, 
+        *                   TPSetChangedCspSetting values combined.
+        * @return Error code. KErrNone if successful.
+        */
+        virtual TInt ChangedCspSettings( 
+            TPSetChangedCspSetting& aChangedCspSettings,
+            TPSetChangedCspSetting& aNewValues ) = 0;
+    };
+
+#endif      // PSETREFRESHHANDLER_H 
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_settings_api/inc/psetsaobserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,295 @@
+/*
+* 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:  CPsetSAObserver handles all the queries to observer.
+*
+*
+*/
+
+
+#ifndef     PSETSAOBSERVER_H
+#define     PSETSAOBSERVER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <e32property.h> 
+#include <psetcalldiverting.h>
+#include <PSVariables.h>
+#include <ctsydomaincrkeys.h>
+
+// FORWARD DECLARATIONS
+class MPsetNetworkInfoObserver;
+class MPsetDivertObserver;
+class CPSetSubscriberIdCheck;
+
+//  CONSTANTS  
+const TInt KCodeUnspecified(-1);
+
+// CLASS DECLARATION
+
+/**
+*  Class is used to create params for NotifyDivertChange method.
+*
+*  @lib phonesettings.dll
+*  @since 3.2
+*/
+class TCallDivertNotifySetting
+    {
+    public: // new    
+    
+        void Initialize()
+            {
+            iPreviousCfStatus = KCFIndicatorUnknown;
+            iCfActivated = EFalse;
+            iVmbxDivert = EFalse;
+            iBasicServiceCode = KCodeUnspecified;
+            }
+            
+    public: //member data
+    
+        // Current status of divert. Note: GetCurrentDivertStatus returns
+        // current status.
+        TUnconditionalCFStatus iPreviousCfStatus;
+   
+        // ETrue if activating divert and EFalse if deactivating.
+        TBool iCfActivated;
+        
+        // True if voice mailbox divert, otherwise false.
+        TBool iVmbxDivert;
+        
+        // BasicServiceCode related to divert operation, see nwDefs.h
+        // for more information. 
+        TInt iBasicServiceCode;
+    };
+
+/**
+*  Class is used to exchange information to/from observer.
+*
+*  @lib phonesettings.dll
+*  @since 1.0
+*/
+class CPsetSAObserver : public CActive
+    {
+    public: // constructor & destructor
+
+        /**
+        * First phase constructor.
+        * 
+        * @return Returns the CPsetSAObserver-object
+        */
+        IMPORT_C static CPsetSAObserver* NewL();
+
+        /* Destructor */
+        IMPORT_C ~CPsetSAObserver();
+
+    public:
+
+        //Current call status.
+        enum TPSetCallStatus
+            {
+            EPSetNoCallsActive = 0,
+            EPSetCallActive
+            };
+
+        /**
+        * Queries if there is an active call.
+        *
+        * @return call status (active or not)
+        */
+        IMPORT_C TInt IsCallActive();
+
+
+        //GPRS connection status.
+        enum TPSetGPRSConnectionStatus
+            {
+            EPSetGPRSNotConnected = 0,
+            EPSetGPRSConnectionActive
+            };
+
+        /**
+        * Queries if there is an active gprs connection.
+        *
+        * @return gprs connection status (active or not)
+        */
+        IMPORT_C TInt IsGPRSConnected();
+
+        /**
+        * Sets Network observer object.
+        *
+        * @param aObserver Reference to network observer.
+        */
+        IMPORT_C void SetNetObserver( MPsetNetworkInfoObserver& aObserver );
+               
+        /**
+        * Notifies of Divert changes. If the activator is not sure of the
+        * settings, CPsetSAObserver tries to deduce correct state.
+        *
+        * @param aAlsStatus Currently used line.
+        * @param aDivertNotify set of divert params, see TCallDivertNotifySetting above.
+        * @param aActivatorUncertain Call divert requester does not know for certain
+        *        all the values.
+        */
+        IMPORT_C void NotifyDivertChange( TSelectedLine aAlsStatus,
+            TCallDivertNotifySetting& aDivertNotify, const TInt& aActivatorUncertain );
+        
+        /**
+        * Returns whether there are active diverts and on what line.
+        *
+        * @param aStatus TCallForwardingStatus info.
+        * @return KErrNone if successful else system wide error code if 
+        * get fails.
+        */
+        IMPORT_C TInt GetCurrentDivertStatus( TUnconditionalCFStatus& aStatus );
+
+    private: // from CActive
+
+        void RunL();
+
+        void DoCancel();
+
+    private: //new
+    
+        /**
+        * Handles divert indicator cases when ALS if OFF.
+        */
+        void HandleNoAlsIndicators( TCallDivertNotifySetting& aDivertNotify,
+            const TInt& aActivatorUncertain );
+          
+        /**
+        * Handles divert indicator cases when ALS on and
+        * ALS line 1 active.
+        */  
+        void HandlePrimaryLineIndicators( TCallDivertNotifySetting& aDivertNotify );
+
+        /**
+        * Handles divert indicator cases when ALS on and
+        * ALS line 2 active.
+        */
+        void HandleSecondaryLineIndicators( TCallDivertNotifySetting& aDivertNotify );
+        
+        /**
+        * Set correct indicator value when divert activated 
+        * to voicemail (no ALS).
+        */
+        void HandleVoiceMailBoxDivertActivation( 
+            TUnconditionalCFStatus& aStatus,
+            const TInt aBsc  );
+        
+        /**
+        * Set correct indicator value when diverted to some
+        * other number than voicemail (no ALS).
+        */   
+        void HandleDivertActivation( 
+            TUnconditionalCFStatus& aStatus,
+            const TInt aBsc  );
+        
+        /**
+        * Set correct indicator value when deactivation
+        * done (no ALS).
+        */        
+        void HandleDivertDeactivation( 
+            TUnconditionalCFStatus& aStatus,
+            const TInt aBsc  );
+        
+        /**
+        * Set correct indicator value when Primary line 
+        * activation done.
+        */
+        void HandlePrimaryLineDivertActivation( 
+            TUnconditionalCFStatus& aStatus,
+            const TInt aBsc  );
+        
+        /**
+        * Set correct indicator value when Primary line 
+        * deactivation done.
+        */
+        void HandlePrimaryLineDivertDeactivation( 
+            TUnconditionalCFStatus& aStatus,
+            const TInt aBsc  );
+        
+        /**
+        * Set correct indicator value when Secondary line 
+        * activation done.
+        */
+        void HandleSecondaryLineDivertActivation( 
+            TUnconditionalCFStatus& aStatus,
+            const TInt aBsc  );
+        
+        /**
+        * Set correct indicator value when Secondary line 
+        * deactivation done.
+        */
+        void HandleSecondaryLineDivertDeactivation( 
+            TUnconditionalCFStatus& aStatus,
+            const TInt aBsc  );
+        
+        /**
+        * Set correct indicator value when Primary line 
+        * activation done.
+        */
+        void HandlePrimaryLineDualDivertActivation( 
+            TUnconditionalCFStatus& aStatus,
+            const TInt aBsc  );
+        
+        /**
+        * Set correct indicator value when Primary line 
+        * deactivation done.
+        */
+        void HandlePrimaryLineDualDivertDeactivation( 
+            TUnconditionalCFStatus& aStatus,
+            const TInt aBsc  );
+                
+        /**
+        * Set correct indicator value when Secondary line 
+        * activation done.
+        */
+        void HandleSecondaryLineDualDivertActivation( 
+            TUnconditionalCFStatus& aStatus,
+            const TInt aBsc  );
+        
+        /**
+        * Set correct indicator value when Secondary line 
+        * deactivation done.
+        */
+        void HandleSecondaryLineDualDivertDeactivation( 
+            TUnconditionalCFStatus& aStatus,
+            const TInt aBsc  );
+        
+        /**
+        * Starts to listen to call alerting or call ringing events.
+        */
+        void NotifyCallStartedL();
+        
+        /**
+        * Checks KTelephonyLVFlagDivertDualAffect status.
+        */
+        TBool IsDivertDualAffectFeatureEnabledL();
+
+    private: // constructors
+
+        void ConstructL();
+
+        CPsetSAObserver();
+
+    private: //member data
+
+        //Observer for network related SS.
+        MPsetNetworkInfoObserver*   iNetObserver;
+        
+        // The Notify interface to Publish And Subscribe.
+        RProperty                   iNotifyProperty;
+        
+        CRepository* iRepository;
+    }; 
+#endif // PSETSAOBSERVER_H
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_settings_notes_ui_api/inc/psuibarringobs.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 2002,2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Shows notes related to Call Barrings operations.
+*
+*/
+
+
+#ifndef CPSUIBARRINGOBS_H
+#define CPSUIBARRINGOBS_H
+
+// INCLUDES
+#include <mpsetbarringobs.h> 
+#include "psuiconstants.h" 
+
+// FORWARD DECLARATION
+class MPsetCallBarring;
+class CPsuiResourceLoader;
+class CPsuiContainer;
+
+// CLASS DECLARATION
+
+/**
+*  CPsuiBarringObs class implements MPsetBarringObserver.
+*  @lib psui.lib
+*  @since 1.0
+*/
+class CPsuiBarringObs : public CBase, 
+                        public MPsetBarringObserver
+    {
+    public: // Constructor
+
+        /**
+        * Symbian OS two phased constructor. 
+        *
+        * @param aContainer Reference to container object
+        * @return Returns CPsuiBarringObs-pointer
+        */
+        IMPORT_C static CPsuiBarringObs* NewL( CPsuiContainer& aContainer );
+        
+    public: // Functions from base classes
+
+        /**
+        * From MPsetBarringObserver, handles barring mode changed notes.
+        *
+        * @param aType Type of barring program
+        * @param aStatus Status of the barring program
+        * @param aPlural Several barrings affected or not
+        */
+        void HandleBarringModeChangedL( 
+            TBarringProgram aType,
+            TBarringStatus aStatus, 
+            TBool aPlural );
+
+        /**
+        * From MPsetBarringObserver, handles barring mode status notes.
+        *
+        * @param aBsc List of basic service groups
+        * @param aStatus Status of the barring program
+        */
+        void HandleBarringModeStatusL( TUint8 aBsc[KPSUIMaxBscNumber], 
+            TBarringStatus aStatus );
+        
+        /**
+        * From MPsetBarringObserver, handles errors for call barring requests.
+        *
+        * @param aReason Reason for error
+        */
+        void HandleBarringErrorL( TInt aReason );
+
+        /**
+        * From MPsetBarringObserver, handles requesting notes.
+        *
+        * @param aOngoing If ETrue, there is an active request
+        * @param aInterrupted If ETrue, means that notemaster should be 
+        *                     immediately deleted.
+        */
+        void HandleCBRequestingL( TBool aOngoing, 
+            TBool aInterrupted = EFalse );
+
+        /**
+        * From MPsetBarringObserver, defines reference to requesting object.
+        *
+        * @param aBarringEngine Reference to the Phone Settings
+        */
+        void SetEngineContact( MPsetCallBarring* aBarringEngine );
+
+        /**
+        * From MPsetBarringObserver, handles notes relating to call barring
+        * password  change requests.
+        *
+        * @param aSuccess If ETrue, password change request was successful
+        */
+        void CbPasswordChangedL( TBool aSuccess );
+    
+    private: // new
+
+        void SetContainer( CPsuiContainer& aContainer );
+
+    private: // member variables
+
+        // Container object
+        CPsuiContainer* iContainer;
+    };
+#endif //CPSUIBARRINGOBS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_settings_notes_ui_api/inc/psuicliobserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2002,2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CPsuiCliObserver class is responsible for handling notes 
+*                related to CLIR, CLIP, COLR, COLP and CNAP.
+*
+*/
+
+
+#ifndef CPSUICLIOBSERVER_H
+#define CPSUICLIOBSERVER_H
+
+// INCLUDES            
+#include <mpsetcliobserver.h> 
+#include "psuiconstants.h" 
+
+// FORWARD DECLARATION
+class CPsuiResourceLoader;
+class CPsuiContainer;
+
+// CLASS DECLARATION
+
+/**
+*  CPsuiCliObserver class is responsible for handling notes related
+*  to CLIR, CLIP, COLR, COLP and CNAP.
+*  @lib psui.lib
+*  @since 1.0
+*/
+class CPsuiCliObserver : public CBase, 
+                         public MPsetCliObserver 
+    {
+    public: // Constructor
+
+        /**
+        * Symbian OS two-phased constructor.
+        *
+        * @param aContainer Reference to container
+        * @return Returns CPsuiCliObserver pointer
+        */
+        IMPORT_C static CPsuiCliObserver* NewL( CPsuiContainer& aContainer );
+        
+    public: 
+
+        /**
+        * From MPsetCliObserver, handles calling identity notes.
+        *
+        * @param aType Type of call identity information
+        */
+        void CliInformationL( TPsuiCli aType );
+
+        /**
+        * From MPsetCliObserver, handles requesting notes.
+        *
+        * @param aOngoing If ETrue, there is an active request
+        * @param aInterrupted If ETrue, means that notemaster should be 
+        *                     immediately deleted.
+        */
+        void HandleCliRequestingL( TBool aOngoing, 
+            TBool aInterrupted = EFalse );
+
+        /**
+        * From MPsetCliObserver, defines reference to requesting object.
+        *
+        * @param aEngine Reference to the Phone Settings
+        */
+        void SetEngineContact( MPsetCli* aEngine );
+
+        /**
+        * From MPsetCliObserver.
+        * DEPRECATED.
+        */
+        void HandleCliStatusL( 
+            TUint8[] /*aBsc[KPSUIMaxBscNumber]*/, 
+            TPsuiCli /*aMode*/ ) {}
+
+        /**
+        * This method shows CNAP status.
+        * @since 1.2
+        *
+        * @param aStatus Status of CNAP
+        *
+        */
+        void HandleCnapStatusL( TInt aStatus );
+
+        /**
+        * Handles errors.
+        * @since 2.0
+        *
+        * @param aError error code.
+        *
+        */
+        void HandleCliErrorL( TInt aError );
+
+        /**
+        * Destructor
+        * @since 2.0
+        */
+        ~CPsuiCliObserver();
+        
+    private: // new
+
+        void SetContainer( CPsuiContainer& aContainer );
+
+    private: // member variables
+
+        //container object
+        CPsuiContainer* iContainer;
+    };
+
+
+#endif //CPSUICLIOBSERVER_H
+
+
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_settings_notes_ui_api/inc/psuiconstants.h	Wed Jul 21 18:26:52 2010 +0300
@@ -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:  Constant values for the Phone Setting UI Notes
+*
+*/
+
+#ifndef CPSUICONSTANTS_H
+#define CPSUICONSTANTS_H
+ 
+const TInt KPSUIMaxBscNumber = 13;     //max. number of basic service groups
+const TInt KPSUIMaxPSUIItemLength = 32;//max. length of text in PSUI note
+// Status of Calling Identity.
+enum TPsuiCli
+    {
+    EPsuiClirOn = 1,
+    EPsuiClirOff,
+    EPsuiClipOn,
+    EPsuiClipOff,
+    EPsuiColrOn,
+    EPsuiColrOff,
+    EPsuiColpOn,
+    EPsuiColpOff,
+    EPsuiCliUnknown
+    };
+
+#endif //CPSUICONSTANTS_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_settings_notes_ui_api/inc/psuicontainer.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,104 @@
+/*
+* 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:  
+*   CPsuiContainer class is responsible for loading/unloading
+*    the resources to be used by this dll. It is also
+*    the correct way to construct observers, since
+*    it gives the pointer to the resources in the
+*    construction process.
+*
+*/
+
+
+#ifndef CPSUICONTAINER_H
+#define CPSUICONTAINER_H
+
+// INCLUDES
+#include <psuiwaitingobs.h> 
+#include <psuidivertobs.h> 
+#include <psuibarringobs.h> 
+#include <psuicliobserver.h> 
+
+// FORWARD DECLARATIONS
+class CPsuiResourceLoader;
+
+// CLASS DECLARATION
+
+/**
+*  CPsuiContainer class is responsible for loading/unloading the resources to
+*  be used by this dll. It is also the correct way to construct observers, 
+*  ince it gives the pointer to the resources in the construction process.
+*  @lib psui.lib
+*  @since 1.0
+*/
+class CPsuiContainer : public CBase
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Symbian OS two-phased constructor.
+        *
+        * @return Returns CPsuiContainer-pointer.
+        */
+        IMPORT_C static CPsuiContainer* NewL();
+        
+        /**
+        * Destructor 
+        */
+        ~CPsuiContainer();
+
+    public:
+
+        /**
+        * Creates Call Waiting observer.
+        * 
+        * @return Returns CreateCWObsL pointer.
+        */
+        IMPORT_C CPsuiWaitingObs* CreateCWObsL();
+
+        /**
+        * Creates Call Forwarding observer.
+        * 
+        * @return Returns CreateCFObsL pointer.
+        */
+        IMPORT_C CPsuiDivertObs* CreateCFObsL();
+
+        /**
+        * Creates Call Barring observer.
+        * 
+        * @return Returns CreateCBObsL pointer.
+        */
+        IMPORT_C CPsuiBarringObs* CreateCBObsL();
+
+        /**
+        * Creates Calling Identity observer.
+        * 
+        * @return Returns CreateCliObsL pointer.
+        */
+        IMPORT_C CPsuiCliObserver* CreateCliObsL();
+
+
+    private: // private constructor
+
+        void ConstructL();
+
+    private: // member variables
+
+        //reference to class' resource loader
+        CPsuiResourceLoader* iAppEngineResourceLoader;
+        
+    };
+
+
+#endif //CPSUICONTAINER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_settings_notes_ui_api/inc/psuidivertobs.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,111 @@
+/*
+* Copyright (c) 2002,2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Shows notes and lists for Divert supplementary service
+*
+*/
+
+
+#ifndef CPSUIDIVERTOBS_H
+#define CPSUIDIVERTOBS_H
+
+// INCLUDES
+#include <mpsetdivertobs.h> 
+#include "psuiconstants.h" 
+
+// FORWARD DECLARATION
+class MPsetCallDiverting;
+class CPsuiResourceLoader;
+class CPsuiContainer;
+class CMobilePhoneCFList;
+
+// CLASS DECLARATION
+
+/**
+*  CPsuiDivertObs class implements the MPsetDivertObserver observer.
+*  @lib psui.lib
+*  @since 1.0
+*/
+class CPsuiDivertObs :  public CBase, 
+public MPsetDivertObserver
+    {
+    public: // Constructor
+        
+        /**
+        * Symbian OS two-phased constructor.
+        *
+        * @param aContainer Reference to container
+        * @return Returns pointer to this-object.
+        */
+        IMPORT_C static CPsuiDivertObs* NewL( CPsuiContainer& aContainer );
+                
+    public: // Functions from base classes
+        
+        /**
+        * From MPsetDivertObserver, handles diverting changed.
+        *
+        * @param aSetting Call forwarding settings
+        * @param aPlural Indicates that operation affected several basic 
+        *                service groups
+        */
+        void HandleDivertingChangedL( 
+            const TCallDivertSetting& aSetting, TBool aPlural );
+        
+        /**
+        * From MPsetDivertObserver, handles diverting status.
+        *
+        * @param aSetting Call forwarding settings
+        * @param aPlural - DEPRECATED
+        */
+        /*****************************************************
+        *    Series 60 Customer / ETel
+        *    Series 60  ETel API
+        *****************************************************/ 
+        void HandleDivertingStatusL( 
+            CMobilePhoneCFList& aSetting, 
+            TBool aPlural );
+        
+        /**
+        * From MPsetDivertObserver, handles diverting error.
+        *
+        * @param aReason Reason for error
+        */
+        void HandleDivertingErrorL( TInt aReason );
+        
+        /**
+        * From MPsetDivertObserver, handles requesting notes.
+        *
+        * @param aTrue If ETrue, there is an active request
+        * @param aInterrupted If ETrue, means that notemaster should be 
+        *                     immediately deleted
+        */
+        void HandleCFRequestingL( TBool aTrue, TBool aInterrupted = EFalse );
+        
+        /**
+        * From MPsetDivertObserver, defines reference to requesting object.
+        *
+        * @param aDivertEngine Reference to the Phone Settings
+        */
+        void SetEngineContact( MPsetCallDiverting* aDivertEngine );
+        
+    private: // new
+        
+        void SetContainer( CPsuiContainer& aContainer );
+        
+        
+    private: // member variables
+        
+        // Container object
+        CPsuiContainer* iContainer;
+    };
+#endif //CPSUIDIVERTOBS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_settings_notes_ui_api/inc/psuiwaitingobs.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,114 @@
+/*
+* Copyright (c) 2002,2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*   CPsuiWaitingObs class implements the virtual methods of 
+*   MPsetCallWaitingObserver. Commands are redirected to CPsuiNoteMaster,
+*   which is responsible for actually showing the notes.
+*
+*/
+
+
+#ifndef CPSUIWAITINGOBS_H
+#define CPSUIWAITINGOBS_H
+
+// INCLUDES
+#include <mpsetcallwaitingobs.h> 
+#include "psuiconstants.h" 
+
+// FORWARD DECLARATION
+class CPsuiResourceLoader;
+class CPsuiContainer;
+class PSetCallWaiting;
+class AknStaticNoteDialog;
+
+// CLASS DECLARATION
+
+/**
+*  CPsuiWaitingObs class implements the virtual methods of 
+*  MPsetCallWaitingObserver. Commands are redirected to CPsuiNoteMaster,
+*  which is responsible for actually showing the notes.
+*  @lib psui.lib
+*  @since 1.0
+*/
+class CPsuiWaitingObs : public CBase, 
+                        public MPsetCallWaitingObserver
+    {
+    public: // Constructor
+
+        /**
+        * Symbian OS two-phased constructor.
+        *
+        * @param aContainer Container object
+        * @return CPsuiWaitingObs pointer
+        */
+        IMPORT_C static CPsuiWaitingObs* NewL( CPsuiContainer& aContainer );
+
+    public: // Functions from base classes
+
+        /**
+        * From MPsetCallWaitingObserver, handles status notes
+        *
+        * @param aStatus Status of call waiting
+        * @param aBsc List of basic service groups
+        */
+        void HandleCallWaitingGetStatusL( 
+            const MPsetCallWaiting::TGetCallWaitingStatus aStatus, 
+            TUint8 aBsc[KPSUIMaxBscNumber] );
+        
+        /**
+        * From MPsetCallWaitingObserver, handles call waiting change notes
+        *
+        * @param aSetting Call waiting request type (activation/cancellation)
+        * @param aResult DEPRECATED
+        */
+        void HandleCallWaitingChangedL( 
+            const MPsetCallWaiting::TSetCallWaiting aSetting, 
+            const TInt aResult );
+    
+        /**
+        * From MPsetCallWaitingObserver, handles requesting notes.
+        *
+        * @param  aOngoing If ETrue, there is an active request
+        * @param aInterrupted If ETrue, means that notemaster should be 
+        *                     immediately deleted.
+        */
+        void HandleCWRequestingL( 
+            TBool aOngoing, 
+            TBool aInterrupted = EFalse );
+
+        /**
+        * From MPsetCallWaitingObserver, handles call waiting errors.
+        *
+        * @param aReason Reason for error
+        */
+        void HandleCWErrorL( TInt aReason );
+        
+        /**
+        * From MPsetCallWaitingObserver, defines reference to requesting object.
+        *
+        * @param aEngineContact Reference to the Phone Settings
+        */
+        void SetEngineContact( MPsetCallWaiting& aEngineContact );
+
+    private: //private constructor
+        
+        void ConstructL( CPsuiContainer& aContainer );
+
+    private: // member variables
+
+        // Container object
+        CPsuiContainer* iContainer;
+        TBool iCallWaitingDistinguishEnabled;
+    };
+#endif // CPSUIWAITINGOBS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_settings_observer_api/inc/mpsetbarringobs.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*      MPsetBarringObserver class defines protocol for reporting
+*      barring events to barring observer.     
+*
+*
+*/
+
+
+#ifndef     MPSETBARRINGOBS_H
+#define     MPSETBARRINGOBS_H
+
+//  INCLUDES
+#include "nwdefs.h"
+#include "mpsetcallbarring.h" 
+
+//  CLASS DEFINITIONS 
+/**
+*  MPsetBarringObserver class is virtual class for call barring observers.
+*  @lib phonesettings.lib
+*  @since 1.0
+*/
+class MPsetBarringObserver
+    {
+    public:      
+
+        /**
+        * Handles mode changed notes.
+        *
+        * @param aType Type of barring program.
+        * @param aStatus Status of the barring program.
+        * @param aPlural Plural notes should be used.
+        */
+        virtual void HandleBarringModeChangedL( TBarringProgram aType, 
+              TBarringStatus aStatus, TBool aPlural ) = 0;        
+        
+         /**
+        * Handles barring mode inquiry notes.
+        *
+        * @param aType Type of barring program.
+        * @param aStatus Status of the barring program.
+        */
+        virtual void HandleBarringModeStatusL( TUint8 aBsc[KPSetNumberOfBsc], 
+                    TBarringStatus aStatus ) = 0;
+        
+        /**
+        * Handles errors in call barring requests.
+        *
+        * @param aReason Reason for error.
+        */
+        virtual void HandleBarringErrorL( TInt aReason ) = 0;
+
+        /**
+        * Handles requesting notes.
+        *
+        * @param aTrue Is there a request going on.
+        * @param aInterrupted Request needs to be immediately cancelled.
+        */
+        virtual void HandleCBRequestingL( TBool aTrue, 
+            TBool aInterrupted ) = 0; 
+        
+        /**
+        * Sets pointer so that message is passed succesfully
+        * from requester to observer.
+        *
+        * @param aBarringEngine Source of events to observer.
+        */
+        virtual void SetEngineContact( MPsetCallBarring* aBarringEngine ) = 0;
+
+        /**
+        * Handles notes relating to cb password change requests.
+        *
+        * @param aSuccess Result of teh change request.
+        */
+        virtual void CbPasswordChangedL( TBool aSuccess ) = 0;
+
+    };
+#endif      //  MPSETBARRINGOBS_H
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_settings_observer_api/inc/mpsetcallwaitingobs.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*       MPsetCallWaitingObserver abstract call waiting observer class.
+*
+*
+*/
+
+
+#ifndef     MPSETCALLWAITINGOBS_H
+#define     MPSETCALLWAITINGOBS_H
+
+// INCLUDES
+#include <mpsetcallwaiting.h> 
+
+//  CLASS DEFINITIONS 
+class   MPsetCallWaitingObserver
+    {
+    public:
+
+        /**
+        * Handles notes when requesting Call Waiting status.
+        *
+        * @param aStatus Query result.
+        * @param aBsc is List of active groups.
+        */
+        virtual void HandleCallWaitingGetStatusL( 
+            const MPsetCallWaiting::TGetCallWaitingStatus aStatus, 
+            TUint8 aBsc[KPSetNumberOfBsc] ) = 0;
+        
+        /**
+        * Handles notes when Call Waiting has been changed.
+        *
+        * @param aSetting Changed setting.
+        * @param aResult Result of the action.
+        */
+        virtual void HandleCallWaitingChangedL( 
+            const MPsetCallWaiting::TSetCallWaiting aSetting, 
+            const TInt aResult ) = 0;
+
+        /**
+        * Handles requesting notes.
+        *
+        * @param aStarted Is there a request going on.
+        * @param aInterrupted Request needs to be immediately cancelled.
+        */
+        virtual void HandleCWRequestingL( TBool aOngoing, 
+            TBool aInterrupted ) = 0; 
+        /**
+        * Handles errors in call waiting requests.
+        *
+        * @param aReason Reason for the error.
+        */
+        virtual void HandleCWErrorL( TInt aReason ) = 0;
+
+        /**
+        * Sets pointer so that message is passed succesfully
+        * from requester to observer.
+        *
+        * @param aEngineContact Source of events to observer.
+        */
+        virtual void SetEngineContact( MPsetCallWaiting& aEngineContact ) = 0;
+
+    };
+
+#endif // MPSETCALLWAITINGOBS_H
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_settings_observer_api/inc/mpsetcliobserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 class handles actions for CLI events. 
+*
+*
+*/
+
+
+#ifndef     MPSETCLIOBSERVER_H
+#define     MPSETCLIOBSERVER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <psuiconstants.h> 
+#include "psetconstants.h" 
+#include "mpsetcli.h" 
+
+//  CLASS DEFINITIONS 
+/**
+*  MPsetCliObserver class is virtual class for CLI observers.
+*  @lib phonesettings.lib
+*  @since 1.0
+*/
+class   MPsetCliObserver
+    {
+    public:
+
+        /**
+        * Sets pointer so that message is passed succesfully
+        * from requester to observer.
+        *
+        * @param aEngine Source of events to observer.
+        */
+        virtual void SetEngineContact( MPsetCli* aEngine ) = 0;
+
+        /**
+        * Handles requesting notes.
+        *
+        * @param aOngoing Is request already going on.
+        * @param aInterrupted Request needs to be immediately cancelled.
+        */
+        virtual void HandleCliRequestingL( TBool aOngoing, 
+            TBool aInterrupted ) = 0; 
+
+        /**
+        * Handles notes for changing any of CLI features.
+        *
+        * @param aType Type of the CLI affected.
+        */
+        virtual void CliInformationL( TPsuiCli aType ) = 0;
+
+        /**
+        * Checks the CLI status from network.
+        *
+        * @param aBsc List of basic service groups.
+        * @param aMode Which CLI feature was inquiried for.
+        */
+        virtual void HandleCliStatusL( TUint8 aBsc[KPSetNumberOfBsc], TPsuiCli aMode ) = 0;
+
+        /**
+        * Checks the CNAP status from network.
+        * @since 1.2
+        *
+        * @param aStatus CNAP status.
+        */        
+        virtual void HandleCnapStatusL( TInt aStatus ) =  0;
+
+        /**
+        * Handles errors.
+        * @since 2.0
+        *
+        * @param aError error code.
+        */
+        virtual void HandleCliErrorL( TInt aError ) = 0;
+    };
+#endif // MPSETCLIOBSERVER_H
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_settings_observer_api/inc/mpsetdivertobs.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*       MPsetDivertObserver class defines protocol for reporting diverting events.
+*
+*
+*/
+
+
+#ifndef     MPSETDIVERTOBS_H
+#define     MPSETDIVERTOBS_H
+
+//  INCLUDES
+#include <etelmm.h>
+#include "nwdefs.h"
+#include "mpsetcalldiverting.h" 
+
+//  FORWARD DECLARATIONS
+class CMobilePhoneCFList;
+
+//  CLASS DEFINITIONS 
+/**
+*  MPsetDivertObserver class is virtual class for Divert observers.
+*  @lib phonesettings.lib
+*  @since 1.0
+*/
+class   MPsetDivertObserver
+    {
+    public:
+
+        /**
+        * Handles showing notes, when diverts change.
+        *
+        * @param aSetting Setting which was changed.
+        * @param aPlural Plural notes to be used.
+        */
+        virtual void HandleDivertingChangedL( 
+            const TCallDivertSetting& aSetting, TBool aPlural ) = 0;
+ 
+        /**
+        * Handles showing of status inquiry notes.
+        *
+        * @param aBsc List of basic services.
+        * @param aSetting Divert setting which was queried.
+        * @param aPlural Plural notes to be used.
+        */
+
+        virtual void HandleDivertingStatusL( CMobilePhoneCFList& aSetting, 
+            TBool aPlural ) = 0;
+
+        /**
+        * Handles showing of error notes.
+        *
+        * @param aReason Reason for diverting error.
+        */
+        virtual void HandleDivertingErrorL( TInt aReason ) = 0;
+        
+        /**
+        * Handles requesting notes.
+        *
+        * @param aOngoing Is there a request going on.
+        * @param aInterrupted Request needs to immediately cancelled.
+        */
+        virtual void HandleCFRequestingL( TBool aOngoing, 
+            TBool aInterrupted ) = 0;
+
+        /**
+        * Sets pointer so that message is passed succesfully
+        * from requester to observer.
+        *
+        * @param aDivertEngine Source for the events to observer.
+        */
+        virtual void SetEngineContact( MPsetCallDiverting* aDivertEngine ) = 0;
+    };
+#endif // MPSETDIVERTOBS_H
+//End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_settings_observer_api/inc/mpsetnetworkinfoobs.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 completions of network info and change requests.
+*
+*
+*/
+
+
+#ifndef     MPSETNETWORKINFOOBS_H
+#define     MPSETNETWORKINFOOBS_H
+
+//  INCLUDES
+#include "mpsetnetworkselect.h" 
+#include <etelmm.h>
+
+//  DATA TYPES  
+typedef CArrayFixFlat<MPsetNetworkSelect::TNetworkInfo> CNetworkInfoArray;
+
+//  CLASS DEFINITIONS 
+/**
+*  MPsetNetworkInfoObserver class is virtual class for network information
+*  observers.
+*  @lib phonesettings.lib
+*  @since 1.0
+*/
+class   MPsetNetworkInfoObserver
+    {
+    public:            
+        /**
+        * Shows notes when network information received.
+        *
+        * @param aInfoArray Network information. Receiver owns the array.
+        * @param aResult Result of action.
+        */
+        virtual void HandleNetworkInfoReceivedL( 
+            const CNetworkInfoArray* aInfoArray, const TInt aResult ) = 0;
+        
+        /**
+        * Shows notes when requested for current network information.
+        *
+        * @param aCurrentInfo Current network information.
+        * @param aResult Result of action.
+        */
+        virtual void HandleCurrentNetworkInfoL( 
+            const MPsetNetworkSelect::TCurrentNetworkInfo& aCurrentInfo, 
+            const TInt aResult ) = 0;
+        
+        /**
+        *  DEPRECATED.
+        */
+        virtual void HandleNetworkChangedL( 
+            const MPsetNetworkSelect::TNetworkInfo& aCurrentInfo,
+            const MPsetNetworkSelect::TCurrentNetworkStatus aStatus, 
+            const TInt aResult ) = 0;    
+
+        /**
+        * Shows notes when network change has been approved.
+        *
+        * @param aCurrentInfo Current network information.
+        * @param aStatus Current network status.
+        * @param aResult Result of action.
+        */
+        virtual void HandleNetworkChangedL( 
+            const MPsetNetworkSelect::TNetworkInfo& aCurrentInfo,
+            const RMobilePhone::TMobilePhoneRegistrationStatus& aStatus, 
+            const TInt aResult ) = 0;    
+
+        //Service requests for MPsetNetworkInfoObserver
+        enum TServiceRequest {
+            EServiceRequestNone,
+            EServiceRequestEnumerateNetworks,
+            EServiceRequestGetNetworkInfo,
+            EServiceRequestGetCurrentNetworkInfo,
+            EServiceRequestGetNetworkSearchMode,
+            EServiceRequestSetNetwork,
+            EServiceRequestSetNetworkMode,
+            EServiceRequestSetNetworkAutomatic
+            };
+
+        /**
+        * Searches for networks that have coverage.
+        *
+        * @param aRequest Type of request that is being handled.
+        */
+        virtual void HandleSearchingNetworksL( TServiceRequest aRequest ) = 0;
+
+        /**
+        * Handles user request to register to specific network.
+        *
+        * @param aOngoing Is there an ongoing request.
+        */
+        virtual void HandleRequestingSelectedNetworkL( TBool aOngoing ) = 0;
+
+        /**
+        * Handles notes when call is active.
+        */
+        virtual void HandleCallActivatedL() = 0;
+
+        /**
+        * Handles errors.
+        * 
+        * @param aRequest current request.
+        * @param aError error code.
+        */
+        virtual void HandleNetworkErrorL( const MPsetNetworkInfoObserver::TServiceRequest aRequest,
+            const TInt aError ) = 0;
+    };
+
+#endif // MPSETNETWORKINFOOBS_H
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_settings_observer_api/inc/mpsetnetworkmodeobs.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,69 @@
+/*
+* 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: 
+*      Observes completions of network mode and change requests.
+*
+*
+*/
+
+
+#ifndef     MPSETNETWORKMODEOBS_H
+#define     MPSETNETWORKMODEOBS_H
+
+//  CLASS DEFINITIONS 
+/**
+*  MPsetNetworkModeObserver class is virtual class for network mode observers.
+*  @lib phonesettings.lib
+*  @since 2.6
+*/
+class   MPsetNetworkModeObserver
+    {
+    public:
+                
+        //Service requests for MPsetNetworkModeObserver
+        enum TServiceRequest {            
+            EServiceRequestNone,
+            EServiceRequestSetSelectedNetworkMode,
+            EServiceRequestGetCurrentNetworkMode
+            //EServiceRequestGetSupportedNetworkModes
+            };        
+
+        /**
+        * Handles Network system mode list fetching from CustomAPI.
+        * Handles Network system mode setting to CustomAPI.
+        * Handles current network system mode fetching from CustomAPI.
+        * 
+        * @param aRequest one of the TServiceRequest values
+        * @param aNetworkModeCaps current/list of supported network mode(s).
+        * @since 2.6
+        */
+        virtual void HandleNetworkSystemModeEventsL( 
+            const MPsetNetworkModeObserver::TServiceRequest aRequest,
+            const TUint32 aNetworkModeCaps ) = 0;
+
+        /**
+        * Handles errors.
+        *
+        * @param aRequest current request.
+        * @param aError error code.
+        */
+        virtual void HandleNetworkErrorL(
+            const MPsetNetworkModeObserver::TServiceRequest aRequest,
+            const TInt aError ) = 0;
+        
+    };
+
+#endif // MPSETNETWORKMODEOBS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/phone_settings_observer_api/inc/mpsetrequestobs.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*      MPsetRequestObserver is abstract request completion observer class
+*
+*
+*/
+
+
+#ifndef     MPSETREQUESTOBS_H
+#define     MPSETREQUESTOBS_H
+
+//  CLASS DEFINITIONS 
+class   MPsetRequestObserver
+    {
+    public:
+        /**
+        * Informs the receiver that request has been completed.
+        */
+        virtual void RequestComplete() = 0;
+
+        /**
+        * Informs the receiver that request state has changed.
+        * @param new status, or when finished KErrNone or error code.
+        */
+        virtual void RequestStatusChanged( TInt aNewStatus ) = 0;
+    };
+#endif // MPSETREQUESTOBS_H
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/sat_client_api/inc/rsatsession.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* 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:  Common session for accessing SatServer services.
+*
+*/
+
+#ifndef RSATSESSION_H
+#define RSATSESSION_H
+
+#include <e32std.h>
+#include <e32base.h>
+
+/**
+ * Definitions of SAT API versions.
+ */ 
+#define SIM_ATK_SERVICE_API_V1
+
+/**
+* Handles the connection to SatServer. This class
+* is used with the sub-sessions.
+*
+* @lib SatClient
+* @since Series60 2.6
+*/
+class RSatSession : public RSessionBase
+    {
+
+    public: // New functions
+
+        /**
+        * C++ default constructor.
+        */
+        IMPORT_C RSatSession();
+
+        /**
+        * Opens session to SatServer
+        */
+        IMPORT_C void ConnectL();
+
+        /**
+        * The client API version.
+        */
+        IMPORT_C TVersion Version() const;
+
+    private:
+
+        /**
+        * Prohibit copy constructor if not deriving from CBase.
+        */
+        RSatSession( const RSatSession& );
+
+        /**
+        * Prohibit assigment operator if not deriving from CBase.
+        */
+        RSatSession& operator=( const RSatSession& );
+
+    };
+
+#endif      // RSATSESSION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/sat_configuration_api/inc/satdomainpskeys.h	Wed Jul 21 18:26:52 2010 +0300
@@ -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:  SATEngine Subsystem PubSub uid and keys declaration.
+*
+*/
+
+
+#ifndef SATDOMAINPSKEYS_H
+#define SATDOMAINPSKEYS_H
+
+// CONSTANTS
+
+// SAT Configuration API
+// Uid :
+const TUid  KPSUidSatServer = { 0x101F79FC };
+
+/**
+ * Time between language selection notification and reboot.
+ *
+ * Default value: N/A
+ */
+const TUint32 KSatLanguageSelectionTimeBeforeReboot( 0x00000008 );
+
+#endif      // SATDOMAINPSKEYS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/sat_refresh_api/inc/msatrefreshobserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,232 @@
+/*
+* 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:  Observer for refresh events.
+*
+*/
+
+
+
+#ifndef MSATREFRESHOBSERVER_H
+#define MSATREFRESHOBSERVER_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <etelsat.h>
+
+// DATA TYPES
+enum TSatElementaryFiles
+    {
+    KUnknownEf          = RSat::KUnknownEf,     // Unknown EF type
+    KDirEf              = RSat::KDirEf,         // Application directory EF
+    KElpEf              = RSat::KElpEf,         // Extended Language Preference
+                                                // EF
+    KArrEf              = RSat::KArrEf,         // Access Rule Reference EF at
+                                                // the MF level.
+    KImgEf              = RSat::KImgEf,         // Image EF
+    KPscEf              = RSat::KPscEf,         // Phonebook synchronisation
+                                                // counter EF
+    KCcEf               = RSat::KCcEf,          // Change counter EF
+    KPuidEf             = RSat::KPuidEf,        // Previous unique identifier
+                                                // EF
+    KPbr                = RSat::KPbr,           // Phonebook reference file EF
+    KSllEf              = RSat::KSllEf,         // SoLSA LSA List EF
+    KInvScan            = RSat::KInvScan,       // Investigation File EF
+    KImpiEf             = RSat::KImpiEf,        // IMS private user identity EF
+    KImpuEf             = RSat::KImpuEf,        // IMS public user identity EF
+    KDomainEf           = RSat::KDomainEf,      // Home Network Domain Name EF
+    KLpEf               = RSat::KLpEf,          // Language Preference EF
+    KArradEf            = RSat::KArradEf,       // Access rule reference (under
+                                                // ADFUSIM and DFTELECOM) EF
+    KImsiEf             = RSat::KImsiEf,        // IMSI EF
+    KCsp1Ef             = RSat::KCsp1Ef,        // CSP 1 EF (7F20/21 6F15)
+    KDckEf              = RSat::KDckEf,         // De-personalization Control
+                                                // Keys EF
+    KPlmnSelEf          = RSat::KPlmnSelEf,     // PLMN Selection EF
+    KHplmnEf            = RSat::KHplmnEf,       // Home PLMN EF
+    KCnlEf              = RSat::KCnlEf,         // Co-operative Network List EF
+    KAcmMaxEf           = RSat::KAcmMaxEf,      // ACM max value EF
+    KSstEf              = RSat::KSstEf,         // SIM Service Table EF
+    KAcmEf              = RSat::KAcmEf,         // Accumulated Call Meter EF
+    KAdnEf              = RSat::KAdnEf,         // Abbreviated Dialling Numbers
+                                                // EF
+    KFdnEf              = RSat::KFdnEf,         // Fixed Diallind Numbers EF
+    KSmsEf              = RSat::KSmsEf,         // Short Messages EF
+    KCcpEf              = RSat::KCcpEf,         // Capability Configuration
+                                                // Parameters EF
+    KGid1Ef             = RSat::KGid1Ef,        // Group Identifier Level 1 EF
+    KGid2Ef             = RSat::KGid2Ef,        // Group Identifier Level 2 EF
+    KMsisdnEf           = RSat::KMsisdnEf,      // MS ISDN EF
+    KPuctEf             = RSat::KPuctEf,        // Price per Unit and Currency
+                                                // Table EF
+    KSmspEf             = RSat::KSmspEf,        // SMS Parameters EF
+    KSmssEf             = RSat::KSmssEf,        // SMS Status EF
+    KLndEf              = RSat::KLndEf,         // Last Number Dialled EF
+    KCbmiEf             = RSat::KCbmiEf,        // Cell Broadcast Message
+                                                // Identifier
+    KSpnEf              = RSat::KSpnEf,         // Service Provider Name EF
+    KSmsrEf             = RSat::KSmsrEf,        // SMS reports EF
+    KCbmidEf            = RSat::KCbmidEf,       // CBMI for Data Download EF
+    KSdnEf              = RSat::KSdnEf,         // Service Dialling Numbers EF
+    KExt1Ef             = RSat::KExt1Ef,        // Extension 1 EF
+    KExt2Ef             = RSat::KExt2Ef,        // Extension 2 EF
+    KExt3Ef             = RSat::KExt3Ef,        // Extension 3 EF
+    KBdnEf              = RSat::KBdnEf,         // Barred Dialling Numbers EF
+    KExt5Ef             = RSat::KExt5Ef,        // Extension 5 EF
+    KCcp2Ef             = RSat::KCcp2Ef,        // Capability configuration
+                                                // parameters 2 EF
+    KCbmirEf            = RSat::KCbmirEf,       // CBMI Range Selection EF
+    KNiaEf              = RSat::KNiaEf,         // Network's Indication of
+                                                // Alerting EF
+    KLociGprsEf         = RSat::KLociGprsEf,    // GPRS Location Information EF
+    KSumeEf             = RSat::KSumeEf,        // SetUpMenu Elements EF
+    KExt4Ef             = RSat::KExt4Ef,        // Extension 4 EF
+    KEstEf              = RSat::KEstEf,         // Enabled services table EF
+    KAclEf              = RSat::KAclEf,         // Access point name control
+                                                // list EF
+    KCmiEf              = RSat::KCmiEf,         // Comparison method
+                                                // information EF
+    KStartHfnEf         = RSat::KStartHfnEf,    // Initialisation value for
+                                                // Hyperframe number EF
+    KThresholdEf        = RSat::KThresholdEf,   // Maximum value of START EF
+    KOPlmnwAcTEf        = RSat::KOPlmnwAcTEf,   // Operator controlled PLMN
+                                                // selector with Access
+                                                // Technology EF
+    KHPlmnwAcTEf        = RSat::KHPlmnwAcTEf,   // HPLMN selector with Access
+                                                // Technology EF
+    KRplmnActEf         = RSat::KRplmnActEf,    // RPLMN Last used Access
+                                                // Technology EF
+    KPsLociEf           = RSat::KPsLociEf,      // Packet switched location
+                                                // information EF
+    KAccEf              = RSat::KAccEf,         // Access Control Class EF
+    KFPlmnEf            = RSat::KFPlmnEf,       // Forbidden PLMN EF
+    KIciEf              = RSat::KIciEf,         // Incoming call information EF
+    KOciEf              = RSat::KOciEf,         // Outgoing call information EF
+    KIctEf              = RSat::KIctEf,         // Incoming call timer EF
+    KOctEf              = RSat::KOctEf,         // Outgoing call timer EF
+    KCsp2Ef             = RSat::KCsp2Ef,        // CSP 2 EF (7F40 6F98)
+    KAdEf               = RSat::KAdEf,          // Administrative Data EF
+    KPhaseEf            = RSat::KPhaseEf,       // Phase Identification EF
+    KVcgsEf             = RSat::KVcgsEf,        // Voice Group Call Service EF
+    KVgcssEf            = RSat::KVgcssEf,       // Voice Group Call Service
+                                                // Status EF
+    KVbsEf              = RSat::KVbsEf,         // Voice Broadcast Service EF
+    KVbssEf             = RSat::KVbssEf,        // Voice Broadcast Service
+                                                // Status EF
+    KeMlppEf            = RSat::KeMlppEf,       // enhanced Multi Level
+                                                // Pre-emption and Priority EF
+    KAaemef             = RSat::KAaemef,        // Automatic Answer for eMLLP
+                                                // Service EF
+    KEccEf              = RSat::KEccEf,         // Emergency Call Codes EF
+    KGmsi               = RSat::KGmsi,          // Group Identity EF
+    KHiddenKeyEf        = RSat::KHiddenKeyEf,   // Key for hidden phone book
+                                                // entries EF
+    KPnnEf              = RSat::KPnnEf,         // PLMN Network Name EF
+    KOplEf              = RSat::KOplEf,         // Operator Network List EF
+    KMbdnEf             = RSat::KMbdnEf,        // Mailbox Dialling Numbers EF
+    KExt6Ef             = RSat::KExt6Ef,        // Extension 6 EF
+    KMbiEf              = RSat::KMbiEf,         // Mailbox Identifier EF
+    KMwisEf             = RSat::KMwisEf,        // Message Waiting Indication
+                                                // Status EF
+    KCfisEf             = RSat::KCfisEf,        // Call Forwarding Indication
+                                                // Status EF
+    KExt7Ef             = RSat::KExt7Ef,        // Extension 7 EF
+    KSpdiEf             = RSat::KSpdiEf,        // Service provider display
+                                                // information EF
+    KMmsnEF             = RSat::KMmsnEF,        // MMS notification EF
+    KExt8Ef             = RSat::KExt8Ef,        // Extension 8 EF
+    KMmsicpEf           = RSat::KMmsicpEf,      // MMS issuer connectivity
+                                                // parameters EF
+    KMmsupEf            = RSat::KMmsupEf,       // MMS user preferences EF
+    KMmsucpEf           = RSat::KMmsucpEf,      // MMS user connectivity
+    KNiaRel5Ef          = RSat::KNiaRel5Ef,     // Network's Indication of Alerting EF (from Rel 5 onwards)
+                                                // parameters EF
+    KCspEf              = 0xffff                // CSP (Not yet defined in ETel
+                                                // SAT API)
+    };
+
+typedef TBuf16<242> TSatRefreshFiles;
+
+// Refresh types.
+enum TSatRefreshType
+    {
+    ERefreshTypeNotSet,
+    ESimInitFullFileChangeNotification,
+    EFileChangeNotification,
+    ESimInitFileChangeNotification,
+    ESimInit,
+    ESimReset,
+    EUsimApplicationReset,
+    E3GSessionReset
+    };
+
+// CLASS DECLARATION
+
+/**
+*  Observer for refresh events. Client must not call any RSatRefresh
+*  methods from the observer methods.
+*
+*  @lib SatClient
+*  @since 2.6
+*/
+class MSatRefreshObserver
+    {
+    protected:
+
+        /**
+        * C++ constructor.
+        */
+        MSatRefreshObserver() {};
+
+        /**
+        * Destructor.
+        */
+        virtual ~MSatRefreshObserver() {};
+
+    public: // New functions
+
+        /**
+        * Refresh query. Client should determine whether it allow the
+        * refresh to happen.
+        * @since 2.6
+        * @param aType Refresh type.
+        * @param aFiles Elementary files which are to be changed.
+        * May be zero length.
+        * @return ETrue to allow refresh, EFalse to decline refresh.
+        */
+        virtual TBool AllowRefresh(
+            TSatRefreshType aType, const TSatRefreshFiles& aFiles ) = 0;
+
+         /**
+        * Notification of refresh.
+        * @since 2.6
+        * @param aType Type of refresh which has happened.
+        * @param aFiles List of elementary files which has been changed.
+        * May be zero length.
+        */
+        virtual void Refresh(
+            TSatRefreshType aType, const TSatRefreshFiles& aFiles ) = 0;
+
+    private:
+
+        // Prohibit copy constructor if not deriving from CBase.
+        MSatRefreshObserver( const MSatRefreshObserver& );
+
+        // Prohibit assigment operator if not deriving from CBase.
+        MSatRefreshObserver& operator=( const MSatRefreshObserver& );
+
+    };
+
+#endif      // MSATREFRESHOBSERVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/sat_refresh_api/inc/rsatrefresh.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,153 @@
+/*
+* 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:  API for getting refresh notifications.
+*
+*/
+
+
+
+#ifndef RSATREFRESH_H
+#define RSATREFRESH_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <etelsat.h>
+#include <msatrefreshobserver.h>
+
+// FORWARD DECLARATIONS
+class RSatSession;
+class CSatAllowRefreshMonitor;
+class CSatRefreshMonitor;
+
+// CLASS DECLARATION
+
+/**
+*  Sub-session for getting refresh notifies.
+*
+*  @lib SatClient.lib
+*  @since Series 60 2.6
+*/
+class RSatRefresh : public RSubSessionBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        * @param aObserver Observer, which is notified about
+        * refresh.
+        */
+        IMPORT_C RSatRefresh( MSatRefreshObserver& aObserver );
+
+    public: // New functions
+
+        /**
+        * Opens the sub-session.
+        * @param aSession Opens the sub-session.
+        */
+        IMPORT_C void OpenL( const RSatSession& aSession );
+
+        /**
+        * Closes the sub-session. Cancels
+        * the notification if active.
+        */
+        IMPORT_C void Close();
+
+        /**
+        * Starts the waiting for refresh events.
+        */
+        IMPORT_C void NotifyFileChangeL();
+
+        /**
+        * Starts the waiting for refresh events.
+        * @param aObservedFiles List of files to be observed for refresh.
+        */
+        IMPORT_C void NotifyFileChangeL(
+            const TSatRefreshFiles& aObservedFiles );
+
+        /**
+        * Indicates client's refresh actions complete.
+        * @param aAdditionEFRead Client has read additional file(s) from those
+        *                        implicitly defined by refresh.
+        */
+        IMPORT_C void RefreshEFRead( TBool aAdditionEFRead ) const;
+
+        /**
+        * Cancels the notification.
+        */
+        IMPORT_C void Cancel() const;
+
+        /**
+        * Gets the notification of refresh query.
+        * @param aType Refresh type.
+        * @param aChangingFiles List of files to be changed if any.
+        * @param aStatus Request status.
+        */
+        void NotifyAllowRefresh(
+            TPckg<TSatRefreshType>& aType,
+            TPckg<TSatRefreshFiles>& aChangingFiles,
+            TRequestStatus& aStatus ) const;
+
+        /**
+        * Sends response for refresh quary.
+        * @param aAllow ETrue, refresh is allowed, EFalse refresh not allowed.
+        */
+        void AllowRefreshL( TBool aAllow ) const;
+
+        /**
+        * Cancels the notification.
+        * @param aStatus Request status.
+        */
+        void CancelNotifyAllowRefresh( TInt aError = KErrNone ) const;
+
+        /**
+        * Gets the notification of refresh.
+        * @param aType Refresh type.
+        * @param aFiles List of changed files if any.
+        * @param aStatus Request status.
+        */
+        void NotifyRefresh(
+            TPckg<TSatRefreshType>& aType,
+            TPckg<TSatRefreshFiles>& aFiles,
+            TRequestStatus& aStatus ) const;
+
+        /**
+        * Cancels the notification.
+        */
+        void CancelNotifyRefresh() const;
+
+    private:
+
+        // Prohibit copy constructor if not deriving from CBase.
+        RSatRefresh( const RSatRefresh& );
+
+        // Prohibit assigment operator if not deriving from CBase.
+        RSatRefresh& operator=( const RSatRefresh& );
+
+    private:
+
+        // Observer of refresh events.
+        MSatRefreshObserver& iObserver;
+
+        // Active object to monitor refresh query.
+        CSatAllowRefreshMonitor* iAllowMonitor;
+
+        // Active object to monitor refresh.
+        CSatRefreshMonitor* iRefreshMonitor;
+
+        //lint -e{1510} Desstruction of objects has been taken care
+    };
+
+#endif      // RSATREFRESH_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/ss_settings_api/inc/msssettingsobserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Interface for getting observer events.
+*
+*/
+
+
+#ifndef MSSSETTINGSOBSERVER_H
+#define MSSSETTINGSOBSERVER_H
+
+//  INCLUDES
+#include <rsssettings.h> 
+
+// CLASS DECLARATION
+
+/**
+* It's the observer interface for some phone related settings.
+* @lib sssettings.lib
+* @since 1.0
+*/
+class MSSSettingsObserver
+    {
+    public: // New functions
+        /*
+        * Observer functoin 
+        * @param aSetting Current setting
+        * @param aNewValue New value for the setting
+        */
+        virtual void PhoneSettingChanged( 
+            TSSSettingsSetting aSetting, 
+            TInt aNewValue ) = 0;
+    };
+
+#endif //MSSSETTINGSOBSERVER_H 
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/ss_settings_api/inc/msssettingsrefreshobserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,71 @@
+/*
+* 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:  Observer to listen refresh events
+*
+*/
+
+
+
+#ifndef MSSSETTINGSREFRESHOBSERVER_H
+#define MSSSETTINGSREFRESHOBSERVER_H
+
+
+//  INCLUDES
+#include <e32std.h>
+#include <etelsat.h>
+#include <msatrefreshobserver.h> 
+
+
+// DATA TYPES
+
+// CLASS DECLARATION
+
+/**
+*  Observer to listen refresh events
+*
+*  @lib SSSettings.lib
+*  @since 2.8
+*/
+class MSSSettingsRefreshObserver 
+    {
+    public: // New functions
+        
+        /**
+        * Refresh query. Client should determine whether it allow the
+        * refresh to happen.
+        * 
+        * @param aType  Refresh type.
+        * @param aFiles Elementary files which are to be changed. 
+        *               May be zero length. 
+        * @return ETrue to allow refresh, EFalse to decline refresh.
+        */
+        virtual TBool AllowRefresh(
+            const TSatRefreshType aType,
+            const TSatElementaryFiles aFiles ) = 0;
+
+        /**
+        * Notification of refresh.
+        * 
+        * @param aType Type of refresh which has happened.
+        * @param aFiles List of elementary files which have been changed.
+        *               May be zero length.
+        */
+        virtual void Refresh(
+            const TSatRefreshType aType,
+            const TSatElementaryFiles aFiles ) = 0;
+    };
+
+#endif      // MSSSETTINGSREFRESHOBSERVER_H  
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/ss_settings_api/inc/rcustomerserviceprofilecache.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,193 @@
+/*
+* 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:  Customer service profile cache
+*
+*/
+
+
+#ifndef RCUSTOMERSERVICEPROFILECACHE_H
+#define RCUSTOMERSERVICEPROFILECACHE_H
+
+//  INCLUDES
+#include <etelmm.h>
+#include <e32property.h>           // RProperty.
+
+
+// FORWARD DECLARATIONS
+class RProperty;
+
+// CLASS DECLARATION
+
+/**
+* Customer service profile cache
+* @since    1.0
+* @lib      SsSettings.lib
+*/
+class RCustomerServiceProfileCache
+    {
+    public: // Constructor and destructor
+        IMPORT_C RCustomerServiceProfileCache();
+        IMPORT_C ~RCustomerServiceProfileCache();
+
+    public: // New functions
+        //Settings categories
+        enum TSsGroups
+            {
+            ESsCspGroup1, // contains Call Offering, Call Restriction,
+                          // Call Completion and Teleservices
+            ESsCspGroup2  // contains Value Added Services
+            };
+
+        /**
+        * Opens connections. Must be done before fetching any items.
+        * @return Error code.
+        */
+        IMPORT_C TInt Open();
+
+        /**
+        * Closes connections.
+        */
+        IMPORT_C void Close();
+
+        /**
+        * Get call completion flags from CSP.
+        * @param aParams Call completion parameters.
+        * @return Error code.
+        */
+        IMPORT_C TInt CspCallCompletion( 
+            RMobilePhone::TCspCallCompletion& aParams );
+
+        /**
+        * Get call offering flags from CSP.
+        * @param aParams Call offering parameters.
+        * @return Error code.
+        */
+        IMPORT_C TInt CspCallOffering( 
+            RMobilePhone::TCspCallOffering& aParams );
+
+        /**
+        * Get call restriction flags from CSP.
+        * @param aParams Call restriction parameters.
+        * @return Error code.
+        */
+        IMPORT_C TInt CspCallRestriction( 
+            RMobilePhone::TCspCallRestriction& aParams );
+
+        /**
+        * Get CPHS tele services flags from CSP.
+        * @param aParams Tele services parameters.
+        * @return Error code.
+        */
+        IMPORT_C TInt CspCPHSTeleservices( 
+            RMobilePhone::TCspCPHSTeleservices& aParams );
+
+        /**
+        * Handles refresh.
+        * @return Error code.
+        */
+        IMPORT_C TInt HandleRefresh();
+
+        /**
+        * Get value added services flags from CSP.
+        * @since 1.2.
+        * @param aParams Value added services parameters.
+        * @return Error code.
+        */
+        IMPORT_C TInt CspCPHSValueAddedServices(
+            RMobilePhone::TCspValueAdded& aParams );
+        
+        /**
+        * Get tele services flags from CSP.
+        * @since 2.8.
+        * @param aParams Tele services parameters.
+        * @return Error code.
+        */
+        IMPORT_C TInt CspTeleServices(
+            RMobilePhone::TCspTeleservices& aParams );
+
+        /**
+        * Get the changed CSP information after Refresh.
+        * @since 2.8.
+        * @param aChangedCsps The changed CSP fields, 
+        *                     type RMobilePhone::TMobilePhoneCspFileV1Pckg.
+        * @param aNewValues The new values of CSP fields, 
+        *                   type RMobilePhone::TMobilePhoneCspFileV1Pckg.
+        * @return Error code.  KErrNone if successful.
+        */
+        IMPORT_C TInt ChangedCspTable( 
+            TDes8& aChangedCsps,
+            TDes8& aNewValues );
+
+    private:
+
+        // Opens connections
+        void DoOpenL();
+
+        // Gets the values
+        TInt DoGetValues( TInt& aValue, TSsGroups aGroup );
+
+        // Reset the iOldCspFile.
+        void DoResetOldCspFile();
+
+        // Define and set the Publish and subscribe value.
+        TInt DefineAndSetValue(
+            TUid aCategory,
+            TUint aKey,
+            TInt aValue );
+
+        // Prohibit copy constructor if not deriving from CBase.
+        RCustomerServiceProfileCache(
+            const RCustomerServiceProfileCache& );
+        // Prohibit assigment operator if not deriving from CBase.
+        RCustomerServiceProfileCache& operator= (
+            const RCustomerServiceProfileCache& );
+
+    private:
+
+        // Member data structure.
+        class TCspCacheData
+            {
+            public:
+                TCspCacheData();
+                
+            // ETel connection.
+            RTelServer iEtel;
+            
+            // Provides client access to mobile phone functionality 
+            // provided by TSY.
+            RMobilePhone iPhone;
+            
+            // Defines contents of the CSP (Customer Service Profile) 
+            // on the SIM.
+            RMobilePhone::TMobilePhoneCspFileV1 iCspFile;
+            
+            // Packaged contents of the CSP (Customer Service Profile) 
+            // on the SIM.
+            RMobilePhone::TMobilePhoneCspFileV1Pckg iCspFilePckg;
+            
+            // RProperty.
+            RProperty       iProperty;
+            };
+
+        //Pointer to the above.
+        TCspCacheData* iData;
+
+        // Defines the old content of the CSP (Customer Service Profile) on 
+        // the SIM before refresh.
+        RMobilePhone::TMobilePhoneCspFileV1* iOldCspFile;
+    };
+
+#endif      // RCUSTOMERSERVICEPROFILECACHE_H  
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/ss_settings_api/inc/rsssettings.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,383 @@
+/*
+* 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: 
+*     Class for getting information about the Clir, Cug, Als and Als blocking
+*     status in the phone. 
+*
+*/
+
+
+#ifndef RSSSETTINGS_H
+#define RSSSETTINGS_H
+
+//  INCLUDES
+#include <etelmm.h>
+#include <rcustomerserviceprofilecache.h> 
+
+// DATA TYPES
+
+/**
+* All enumerations are fixed - DO NOT CHANGE!!
+*/
+
+/**
+* It enumerates all SSSettings settings.
+*
+* ESSSettingsCug         - closed user group setting, 
+*                     for some values see TSSSettingsCugValue.
+* ESSSettingsClir        - default setting for calling line identification 
+*                     restriction, see TSSSettingsClirValue.
+* ESSSettingsAls         - selected line, see TSSSettingsAlsValue.
+* ESSSettingsAlsBlocking - line selection blocking, see TSSSettingsAlsBlocking.
+* ESSSettingsCugDefault - value for cug default.
+*/
+enum TSSSettingsSetting
+    {
+    ESSSettingsCug = 0,  
+    ESSSettingsClir = 1, 
+    ESSSettingsAls = 2,
+    ESSSettingsAlsBlocking = 3,
+    ESSSettingsDefaultCug = 4
+    };
+
+/**
+* It enumerates all values for CLIR.
+*
+* ESSSettingsClirNetworkDefault - use network default
+* ESSSettingsClirExplicitInvoke - by default, invoke CLIR
+* ESSSettingsClirExplicitSuppress - by default, suppress CLIR
+*/
+enum TSSSettingsClirValue
+    {
+    ESSSettingsClirNetworkDefault,
+    ESSSettingsClirExplicitInvoke,
+    ESSSettingsClirExplicitSuppress
+    };
+
+/**
+* It enumerates SOME values for CUG.
+* 
+* Alternative CUG default (and min value) can be set on/off from 
+* shared data (shareddatakeys.h, key: KPhoneCUGIndexStartValue).
+*
+* CUG value is basically interger.
+*
+* ESSSettingsCugSuppress - special, suppress CUG
+* ESSSettingsCugDefault - special, use network default CUG
+* ESSSettingsCugMin - minimum value for proper CUG index.
+* ESSSettingsCugMax - maximum value for proper CUG index.
+* ESSSettingsAltCugDefault - special, alternative default CUG
+* ESSSettingsAltCugMin - special, alternative minimum for CUG
+*/
+enum TSSSettingsCugValue
+    {
+    ESSSettingsCugSuppress = -1,
+    ESSSettingsCugDefault = 0, //Note: default can be 0 or 65535 (see above)
+    ESSSettingsCugMin = 1,     //Note: min value can be 0 or 1 (see above)
+    ESSSettingsCugMax = 32767,
+    ESSSettingsAltCugDefault = 65535,
+    ESSSettingsAltCugMin = 0
+    };
+
+/**
+* It enumerates all values for ALS.
+*
+* ESSSettingsAlsNotSupported - ALS not supported, always primary line.
+* ESSSettingsAlsPrimary - ALS supported, primary line selected.
+* ESSSettingsAlsAlternate - ALS supported, alternate line selected.
+*/
+enum TSSSettingsAlsValue
+    {
+    ESSSettingsAlsNotSupported = 0,
+    ESSSettingsAlsPrimary = 1,
+    ESSSettingsAlsAlternate = 2
+    };
+
+/**
+* It enumerates all values for ALS blocking.
+*
+* ESSSettingsAlsBlockingNotSupported - ALS blocking not supported.
+* ESSSettingsAlsBlockingOff - ALS blocking off.
+* ESSSettingsAlsBlockingOn - ALS blocking on.
+*/
+enum TSSSettingsAlsBlockingValue
+    {
+    ESSSettingsAlsBlockingNotSupported,
+    ESSSettingsAlsBlockingOff,
+    ESSSettingsAlsBlockingOn
+    };
+
+// FORWARD DECLARATIONS
+class MSSSettingsObserver;
+class CSSSettingsNotifier;
+class RMmCustomAPI;
+class CRepository;
+
+
+// CLASS DECLARATION
+
+/**
+*  It is class that can be used to fetch phone related settings.
+*  @since 1.0
+*  @lib sssettings.lib
+*/
+class RSSSettings
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * C++ default constructor.
+        */
+        IMPORT_C RSSSettings();
+
+    public: // New functions
+        
+        /**
+        * Closes SsSettings.
+        *
+        * After the use of the class, the method must be called.
+        */
+        IMPORT_C void Close();
+
+        /**
+        * Opens SsSettings.
+        *
+        * Before using the class, one of Open methods must be called.
+        *
+        * @return error code. KErrNone, if success.
+        */
+        IMPORT_C TInt Open();
+
+        /**
+        * Opens SsSettings.
+        *
+        * Ownership of parameters is NOT transferred. If parameter
+        * is NULL, then the instance creates its own sessions.
+        *
+        * Before using the class, one of Open methods must be called.
+        *
+        * @param aTelServer ETel server session.
+        * @return error code. KErrNone, if success.
+        */
+        IMPORT_C TInt Open(
+            RTelServer* aTelServer );
+
+
+        // CHANGE NOTIFICATIONS
+
+        /**
+        * Registers an observer to receive all changes.
+        *
+        * @param aObserver observer.
+        * @return error code. If other than KErrNone, CancelAll is called 
+        *                     automatically.
+        */
+        IMPORT_C TInt RegisterAll( 
+            MSSSettingsObserver& aObserver );
+
+        /**
+        * Registers an observer to receive changes of a setting.
+        *
+        * @param aSetting setting.
+        * @param aObserver observer.
+        * @return error code. KErrNone: observer is added
+        *                     KErrAlreadyExists: observer is already added
+        *                     KErrNotReady: Possible when BT SAP is on.
+        *                     KErrNotSupported: Possible with ALS.
+        *                     other: observer not registered
+        */
+        IMPORT_C TInt Register( 
+            TSSSettingsSetting aSetting, 
+            MSSSettingsObserver& aObserver );
+
+        /**
+        * Cancels all registrations of the observer.
+        *
+        * @param aObserver observer.
+        */
+        IMPORT_C void CancelAll( 
+            MSSSettingsObserver& aObserver );
+
+        /**
+        * Cancel specific setting.
+        *
+        * @param aSetting setting.
+        * @param aObserver observer.
+        */
+        IMPORT_C void Cancel( 
+            TSSSettingsSetting aSetting,
+            MSSSettingsObserver& aObserver );
+
+        // CHANGE & FETCH VALUE
+
+        /**
+        * Fetch value of a setting.
+        *
+        * @param aSetting setting.
+        * @param aValue result will be stored here (if success).
+        * @return error code: KErrNone, all ok aValue updated.
+        *                     KErrCorrupt, value in shared data is not OK.
+        *                     KErrNotSupported, aSetting is not a "real" setting
+        *                     KErrNotReady, get CSP from ETEL has failed.
+        *                     KErrServerBusy, get CSP from ETEL has failed.
+        */
+        IMPORT_C TInt Get( 
+            TSSSettingsSetting aSetting,
+            TInt& aValue );
+
+        /**
+        * Changes value of a setting. Successfull function call generates notify
+        * call to each observer in this object even if the value is the same. 
+        * From other objects of this class the observers will get only change 
+        * notifications.
+        *
+        * @param aSetting setting.
+        * @param aValue new value for setting.
+        * @return error code. KErrNone in case of non-error.
+        *                     KErrArgument: parameter not valid
+        *                     KErrNotSupported: In als, if ME doesn't support
+        *                     other, from Shared data or from ETel
+        */
+        IMPORT_C TInt Set(
+            TSSSettingsSetting aSetting,
+            TInt aValue );
+
+        // SIM CHANGE EVENT
+        
+        /**
+        * It is called when SIM changes.
+        *
+        * @return error code.
+        */
+        IMPORT_C TInt HandleSIMChanged();
+
+        /**
+        * Get previous CUG value
+        * @param aPreviousValue Old value is saved here. 0 if not set
+        * @return Error code
+        */
+        IMPORT_C TInt PreviousCugValue( TInt& aPreviousValue );
+
+        /**
+        * Reset previous CUG value
+        * @return Error code
+        */
+        IMPORT_C TInt ResetPreviousCugValue();
+
+        /**
+        * Handle refresh
+        * @return Error code
+        */
+        IMPORT_C TInt HandleRefresh();
+
+        /**
+        * Check whether or not the given CUG index is valid.
+        * @param aValue CUG index
+        * @return Boolean, is it valid CUG index or not
+        */
+        IMPORT_C TBool IsValueValidCugIndex( const TInt& aValue ) const;
+
+    private:
+    
+        /**
+        * Checks if Alternate Line is to be supported.
+        * @param aPpAlsValue parameter to be checked.
+        * @param aSimAlsValue parameter to be checked.
+        * @param aAlsCspSupport parameter to be checked.
+        * @param aAlsCspError parameter to be checked.
+        * @return error code. KErrNone in case of ALS supported.
+        *                     KErrNotSupported in case if ME doesn't support
+        */    
+        TInt IsALSSupported( TInt aPpAlsValue, TInt aSimAlsValue, 
+            TBool aAlsCspSupport, TInt aAlsCspError ) const;
+            
+        // Gets ALS setting value.
+        TInt GetALSSettingValue( TInt& aValue, const TInt aSimState );
+
+        // Prohibit copy constructor if not deriving from CBase.
+        RSSSettings( const RSSSettings& );
+        // Prohibit assigment operator if not deriving from CBase.
+        RSSSettings& operator= ( const RSSSettings& );
+
+        // Opens connection. Leaves on error cases
+        void OpenL( RTelServer* aTelServer );
+
+        // Closes all connections and deletes own data
+        void DeleteSettingsData();
+
+        // Finds if observer is already added
+        TBool ExistsObserver( TSSSettingsSetting aSetting, 
+                    MSSSettingsObserver& aObserver );
+
+        // Informs observers about the value change
+        void InformChange( TSSSettingsSetting aSetting , TInt aNewValue );
+
+        // Finds next observer, NULL if there isn't any. Used in deleting data.
+        MSSSettingsObserver* FindOneObserver() const;
+
+        // Async call back for informing observer about own changes.
+        static TInt InformCallBack( TAny* aPtr );
+
+        // CUG value is divided into two parts - needs special handling...
+        TInt GetCug( TInt& aValue ) const;
+        TInt GetDefaultCugL( TInt& aValue ) const;
+        TInt SetCug( const TInt aValue, const TInt aCugDefault ) const;
+
+    private:    // Data
+
+        //Private Array type for RSSSettings.
+        typedef RPointerArray<MSSSettingsObserver> RSSSettingsObserverArray;
+
+        /**
+        * All data members are included in one structure.
+        * This it can be changed accoring to needs, but the
+        * BC stays the same.
+        */
+        struct TSSSettingsData
+            {
+            RTelServer*          iTelServer;         // ETel client
+            TBool                iOwnTelServer;      // ETrue if own
+            RMobilePhone         iMobilePhone;       // Mobile Phone
+            RArray<RSSSettingsObserverArray> iObservers;// Array for obs. arrays
+            CAsyncCallBack*      iCallBack;          // Async call back
+            TInt                 iCallBackSetting;   // Setting that is changed
+            TInt                 iCallBackValue;     // New value.
+            CSSSettingsNotifier* iNotifier;          // Change notifier
+            RMmCustomAPI*        iCustomPhone;       // Custom Phone
+            TInt                 iCUGDefault;        // CUG default
+            CRepository*         iRepository;        // Central repository.           
+            };
+
+        TSSSettingsData* iData;                         // The data
+
+    protected:
+        // Friend class uses all members in iData. This procedure saves
+        // a lot of function from the API which are not meant for
+        // external use.
+        friend class CSSSettingsNotifier;
+    };
+
+// Panic enums
+enum TSSSettingsPanic
+    {
+    SSSettingsPanicOpenNotDone = 6000,  // Some function is called before Open()
+    SSSettingsPanicInvalidRequest,      // Given Setting is out of range.
+    SSSettingsPanicConflictInAls        // Can't determine ALS state.
+    };
+
+GLREF_C void Panic( TSSSettingsPanic aPanic );
+
+#endif      // RSSSETTINGS_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/string_parser_api/inc/cphonegsmemergencynumberhandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  It is base handler for emergency number.
+*
+*/
+
+
+#ifndef CPHONEGSMEMERGENCYNUMBERHANDLER_H
+#define CPHONEGSMEMERGENCYNUMBERHANDLER_H
+
+// INCLUDES
+#include    "cphonegsmhandlerbase.h" 
+
+// CLASS DECLARATION
+
+/**
+* It is base handler for phone number.
+*
+* @since S60 5.0
+* @lib phoneparser.lib
+*/
+class CPhoneGsmEmergencyNumberHandler 
+    : public CPhoneGsmHandlerBase
+    {
+    public: // New functions
+    
+        /**
+        * Process dial to emergency number
+        * 
+        * @param aNumber main number part.
+        */
+        virtual void ProcessDialToEmergencyNumberL( 
+            const TDesC& aNumber
+            ) = 0;
+
+    public: // Functions from base classes
+
+        /**
+        * From CPhoneGsmHandlerBase, processes result.
+        *
+        * @param aResult It is to be processed.
+        */
+        IMPORT_C virtual void ProcessL( CPhoneGsmParserResult& aResult );
+    };
+
+#endif      // CPHONEGSMEMERGENCYNUMBERHANDLER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/string_parser_api/inc/cphonegsmhandlerbase.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  It is base class for all handlers.
+*
+*/
+
+
+#ifndef CPHONEGSMHANDLERBASE_H
+#define CPHONEGSMHANDLERBASE_H
+
+// INCLUDES
+#include    <e32base.h>
+
+// FORWARD DECLARATIONS
+class CPhoneGsmParserResult;
+
+// CLASS DECLARATION
+
+/**
+* It is base class for all handlers.
+*
+* @since 1.0
+* @lib phoneparser.lib
+*/
+class CPhoneGsmHandlerBase 
+    : public CBase
+    {
+    public: // New functions
+        
+        /**
+        * Process the results of parsing.
+        *
+        * @param aResult It is results to be processed.
+        */
+        virtual void ProcessL( 
+            CPhoneGsmParserResult& aResult ) = 0;
+
+    };
+
+#endif      // CPHONEGSMHANDLERBASE_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/string_parser_api/inc/cphonegsmhandlercontainer.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,100 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  It is container for handlers. It can also be used as a handler.
+*
+*/
+
+
+#ifndef CPHONEGSMHANDLERCONTAINER_H
+#define CPHONEGSMHANDLERCONTAINER_H
+
+// INCLUDES
+#include    <e32base.h>
+#include    "cphonegsmhandlerbase.h" 
+
+// CLASS DECLARATION
+
+/**
+* It is container for handlers. It can also be used as a handler.
+*
+* @since 1.0
+* @lib phoneparser.lib
+*/
+class CPhoneGsmHandlerContainer 
+    : public CPhoneGsmHandlerBase
+    {
+    public:  // Constructors and destructor      
+        
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CPhoneGsmHandlerContainer* NewL();
+        
+        /**
+        * Destructor.
+        */
+        IMPORT_C ~CPhoneGsmHandlerContainer();
+
+    public: // New functions
+        
+        /**
+        * Add a new handler to the container.
+        *
+        * Note that ownership is transferred. The method panics if
+        * you try to add same instance twice.
+        */
+        IMPORT_C void AddHandlerL( CPhoneGsmHandlerBase& aHandler );
+
+    public: // Functions from base classes
+
+        /**
+        * From CPhoneGsmHandlerBase, process the results of parsing.
+        *
+        * Note that it will forward the request to each of the contained
+        * handler.
+        *
+        * @param aResult It is results to be processed.
+        */
+        void ProcessL( 
+            CPhoneGsmParserResult& aResult );
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CPhoneGsmHandlerContainer();
+
+        /**
+        * Symbian OS constructor.
+        */
+        void ConstructL();
+
+        // By default, prohibit copy constructor
+        CPhoneGsmHandlerContainer( const CPhoneGsmHandlerContainer& );
+        // Prohibit assigment operator
+        CPhoneGsmHandlerContainer& operator= ( const CPhoneGsmHandlerContainer& );
+
+    private:    // Data
+        
+        typedef CArrayPtrFlat< CPhoneGsmHandlerBase > CHandlerArray;
+
+        // Owned array of handlers.
+        CHandlerArray* iHandlers;
+
+    };
+
+#endif      // CPHONEGSMHANDLERCONTAINER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/string_parser_api/inc/cphonegsmmanufacturerhandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  It is base handler for manufacturer specific codes.
+*
+*/
+
+
+#ifndef CPHONEGSMMANUFACTURERHANDLER_H
+#define CPHONEGSMMANUFACTURERHANDLER_H
+
+// INCLUDES
+#include    "cphonegsmhandlerbase.h" 
+
+// CLASS DECLARATION
+
+/**
+* It is base handler for manufacturer specific codes.
+*
+* @since 1.0
+* @lib phoneparser.lib
+*/
+class CPhoneGsmManufacturerHandler 
+    : public CPhoneGsmHandlerBase
+    {
+    public: // New functions
+        
+        /**
+        * It enumerates all commands.
+        *
+        * EShowVersion - SW version display
+        * EBadPinChange - bad PIN change request, e.g. **04*#
+        * EBadPin2Change - bad PIN2 change request
+        * EBadPinUnblock - bad PIN unblock request, e.g. **05*#
+        * EBadPin2Unblock - bad PIN2 unblock request
+        * EActivateRfsNormal - RFS activation
+        * EActivateRfsDeep - RFS activation, deep version
+        * EShowBtAddress - BT address display
+        * EResetWallet - Wallet reset
+        * EBTLoopback - BT RF loopback activation/deactivation
+        * EBTDebugMode - BT debug mode activation
+        */
+        enum
+            {
+            EBadPinChange,
+            EBadPin2Change,
+            EBadPinUnblock,
+            EBadPin2Unblock,
+            EActivateRfsNormal,
+            EActivateRfsDeep,
+            EShowBtAddress,
+            EBTLoopback,
+            EShowWlanMac,
+            EBTDebugMode
+            };
+
+        /**
+        * Process manufacturer specific command.
+        *
+        * @param aCommand command to be performed.
+        */
+        virtual void ProcessCommandL( TUint aCommand ) = 0;
+
+        /**
+        * Process debug code.
+        *
+        * @param aCode code to be processed.
+        */
+        virtual void ProcessDebugL( const TDesC& aCode ) = 0;
+
+    public: // Functions from base classes
+
+        /**
+        * From CPhoneGsmHandlerBase, process the results of parsing.
+        *
+        * @param aResult It is results to be processed.
+        */
+        IMPORT_C virtual void ProcessL( 
+            CPhoneGsmParserResult& aResult );
+    
+    };
+
+#endif      // CPHONEGSMMANUFACTURERHANDLER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/string_parser_api/inc/cphonegsmmischandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  It is base class for handlers of ussd & show imei.
+*
+*/
+
+
+#ifndef CPHONEGSMMISCHANDLER_H
+#define CPHONEGSMMISCHANDLER_H
+
+// INCLUDES
+#include    "cphonegsmhandlerbase.h" 
+
+// CLASS DECLARATION
+
+/**
+* It is base class for handlers of ussd & show imei.
+*
+* @since 1.0
+* @lib phoneparser.lib
+*/
+class CPhoneGsmMiscHandler 
+    : public CPhoneGsmHandlerBase
+    {
+    public: // New functions
+        
+        /**
+        * Process USSD request.
+        *
+        * @param aString It is string to be sent.
+        */
+        virtual void ProcessUssdL( const TDesC& aString ) = 0;
+    
+    public: // Functions from base classes
+
+        /**
+        * From CPhoneGsmHandlerBase, process the results of parsing.
+        *
+        * @param aResult It is results to be processed.
+        */
+        IMPORT_C virtual void ProcessL( 
+            CPhoneGsmParserResult& aResult );
+            
+    };
+
+#endif      // CPHONEGSMMISCHANDLER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/string_parser_api/inc/cphonegsmoptioncontainerbase.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 options container that can be used 
+*                to configure the parsing process. 
+*
+*/
+
+
+#ifndef CPHONEGSMOPTIONCONTAINERBASE_H_
+#define CPHONEGSMOPTIONCONTAINERBASE_H_
+
+// INCLUDES
+#include    <e32base.h>
+
+// CONSTANTS
+
+/**
+* Option is true if operation is send. False if it is a code check.
+*/
+const TInt KPhoneOptionSend = 1;
+
+/**
+* Option is true if there is a call ongoing. Otherwise false.
+*/
+const TInt KPhoneOptionInCall = 2;
+
+/**
+* Option is true if two digit calling is supported. Otherwise false.
+* Client should not try to set this option with SetOptionStatus() -method because 
+* Two Digit Calling is variable feature.
+*/
+const TInt KPhoneOptionTwoDigitCalling = 3;
+
+/**
+* Option is true if voip call. Otherwise false.
+*/
+const TInt KPhoneOptionVoipCall = 4;
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+* It is container for options. Each option is identified by 
+* a single uid and each option has a boolean status.
+*
+* @since 5.0
+* @lib phoneparser.lib
+*/
+NONSHARABLE_CLASS( CPhoneGsmOptionContainerBase ) 
+    : public CBase
+    {
+    
+    public: // New functions
+                       
+        /**
+        * Sets status of option.
+        *        
+        * @param aOptionUid It is the uid of the option.
+        * @param aStatus It is the new status for the option.
+        */
+        virtual void SetOptionStatus( TInt aOptionUid, TBool aStatus ) = 0;    
+        
+        /**
+        * Finds status of option.
+        *
+        * @param aOptionUid It is the uid of the option.
+        * @return Returne status of the option.
+        */
+        virtual TBool FindOptionStatus( TInt aOptionUid ) const = 0;
+
+    };
+
+#endif /*CPHONEGSMOPTIONCONTAINERBASE_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/string_parser_api/inc/cphonegsmparserbase.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,179 @@
+/*
+* 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:  It is base class for parsers.
+*
+*/
+
+
+#ifndef CPHONEGSMPARSERBASE_H
+#define CPHONEGSMPARSERBASE_H
+
+// INCLUDES
+#include    <e32base.h>
+
+// MACROS
+
+/**
+* It defines macro that can be used to create a single uid.
+* 
+* Parameters main and sub should be positive integers, range of
+* main is 0..255 and sub is 0..2^16-1. 
+*
+* Macro is equivalent to (main mod 256)*2**16 + sub.
+*/
+#define PHONE_MAKE_UID( main, sub ) (TUint32)((((main) & 0xFF) << 16) + ((sub) & 0xFFFF))
+
+/**
+* Extracts main part from uid.
+*
+* Macro is equivalent to (main / 2**16) mod 256.
+*/
+#define PHONE_EXTRACT_MAIN( uid ) (((uid) >> 16) & 0xFF)
+
+// CONSTANTS
+
+/**
+* ALL MAIN UIDS ARE LISTED HERE.
+*
+* Please, do not change unless you know what you are doing!
+*/
+
+/**
+* Invalid string.
+*/
+const TUint32 KPhoneGsmUidInvalid = 0;
+
+/**
+* Supplementary services.
+*/
+const TUint32 KPhoneGsmUidSupplementaryService = 1;
+
+/**
+* Sim control procedure.
+*/
+const TUint32 KPhoneGsmUidSimControlProcedure = 2;
+
+/**
+* Phone number
+*/
+const TUint32 KPhoneGsmUidDialPhoneNumber = 3;
+
+/**
+* Misc GSM required strings, most notably USSD.
+*/
+const TUint32 KPhoneGsmUidMisc = 4;
+
+/**
+* Supplementary service, during calls.
+*/
+const TUint32 KPhoneGsmUidSupplementaryServiceDuringCall = 5;
+
+/**
+* Manufacturer specific codes.
+*/
+const TUint32 KPhoneGsmUidManufacturer = 6;
+
+/**
+* PCN specific codes.
+*/
+const TUint32 KPhoneGsmUidPcnProcedures = 7;
+
+/**
+* Emergency number
+*/
+const TUint32 KPhoneGsmUidDialEmergencyNumber = 8;
+
+/**
+* Voip number
+*/
+const TUint32 KPhoneUidDialVoipyNumber = 9;
+
+/**
+* ALL MISC UIDS:
+*/
+const TUint32 KPhoneUidUnstructuredService = 
+    PHONE_MAKE_UID( KPhoneGsmUidMisc, 0 );
+
+// FORWARD DECLARATIONS
+class CPhoneGsmParserResult;
+class CPhoneGsmOptionContainerBase;
+
+// CLASS DECLARATION
+
+/**
+* It is base class for parsers.
+*
+* @since 1.0
+* @lib phoneparser.lib
+*/
+class CPhoneGsmParserBase 
+    : public CBase
+    {
+    public: // New functions
+        
+        /**
+        * Parses string.
+        *
+        * String must not contain other characters than from set
+        * { 0..9, *, #, +, p, w }. If method leaves, then result
+        * may contain something that is not valid.
+        *
+        * @param aString string to be parsed.
+        * @param aResult It will contain result.
+        * @param aOptions It contains all options related to parsing.
+        * @return It returns boolean value indicating success of parsing.
+        */
+        virtual TBool ParseL( 
+            const TDesC& aString,
+            CPhoneGsmParserResult& aResult,
+            CPhoneGsmOptionContainerBase& aOptions ) = 0;
+
+        // SOME COMMON STATIC FUNCTIONS
+
+        /**
+        * Checks if string is prefix of another.
+        *
+        * @param aString original string.
+        * @param aPrefix possibly prefix of aString.
+        * @return ETrue iff aPrefix is prefix of aString.
+        */
+        static TBool IsPrefixOf( 
+            const TDesC& aString, 
+            const TDesC& aPrefix );
+        
+        /**
+        * Checks if string is postfix of another.
+        *
+        * @param aString original string.
+        * @param aPrefix possibly postfix of aString.
+        * @return ETrue iff aPostfix is postfix of aString.
+        */
+        static TBool IsPostfixOf(
+            const TDesC& aString,
+            const TDesC& aPostfix );
+
+        /**
+        * Extracts sequence of digits.
+        *
+        * @param aString input.
+        * @return sequence of digits, prefix of aString.
+        */
+        static TPtrC ExtractNumber( 
+            const TDesC& aString );
+
+    };
+
+#endif      // CPHONEGSMPARSERBASE_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/string_parser_api/inc/cphonegsmparserresult.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,142 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Instances will contain the results of the parsing.
+*
+*/
+
+
+#ifndef CPHONEGSMPARSERRESULT_H
+#define CPHONEGSMPARSERRESULT_H
+
+// INCLUDES
+#include    <e32base.h>
+
+// CLASS DECLARATION
+
+/**
+* Instances will contain the results of the parsing.
+*
+* @since 1.0
+* @lib phoneparser.lib
+*/
+NONSHARABLE_CLASS( CPhoneGsmParserResult )
+    : public CBase
+    {
+    public:  // Constructors and destructor      
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CPhoneGsmParserResult* NewL();
+        
+        /**
+        * Destructor.
+        */
+        ~CPhoneGsmParserResult();
+
+    public: // New functions
+        
+        /**
+        * Reserve parameters.
+        * 
+        * @param aAmount It is the amount of parameters to reserve.
+        */
+        void ReserveParametersL( TUint aAmount );
+
+        /**
+        * Sets state to initial.
+        */
+        void ClearL();
+
+        /**
+        * Returns uid.
+        */
+        inline TUint Uid() const;
+
+        /**
+        * Returns auxilirary information.
+        */
+        inline TUint AuxInformation() const;
+
+        /**
+        * Returns the count of parameters.
+        */
+        inline TUint CountParameters() const;
+
+        /**
+        * Returns parameter at given position.
+        *
+        * @param aIndex It is the position.
+        * @return Returns the parameter.
+        */
+        const TDesC& ParameterAt( TInt aIndex ) const;
+
+        /**
+        * Sets the uid.
+        *
+        * @param aUid It is the new uid.
+        */
+        void SetUid( TUint aUid );
+
+        /**
+        * Sets auxilirary information.
+        *
+        * @param aAuxInformation It is the new aux information.
+        */
+        void SetAuxInformation( TUint aAuxInformation );
+
+        /**
+        * Adds a parameter. 
+        *
+        * It will leave if there is not enough memory.
+        *
+        * @param aParameter It is the parameter.
+        */
+        void AddParameterL( const TDesC& aParameter );
+            
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CPhoneGsmParserResult();
+
+        /**
+        * Symbian OS constructor.
+        */
+        void ConstructL();
+
+        // By default, prohibit copy constructor
+        CPhoneGsmParserResult( const CPhoneGsmParserResult& );
+        // Prohibit assigment operator
+        CPhoneGsmParserResult& operator= ( const CPhoneGsmParserResult& );
+
+    private:    // Data
+
+        // Unique identifier, type of result.
+        TUint iUid;
+
+        // Additional information, specific to type.
+        TUint iAuxInformation;
+
+        // Array of parameters, pointer descriptors to original string.
+        CArrayFixFlat< TPtrC >* iParameters;
+
+    };
+
+#include    "cphonegsmparserresult.inl" 
+
+#endif      // CPHONEGSMPARSERRESULT_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/string_parser_api/inc/cphonegsmparserresult.inl	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 of the CPhoneGsmParserResult class.
+*
+*/
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CPhoneGsmParserResult::Uid
+// ---------------------------------------------------------
+//
+inline TUint CPhoneGsmParserResult::Uid() const
+    {
+    return iUid;
+    }
+
+// ---------------------------------------------------------
+// CPhoneGsmParserResult::AuxInformation
+// ---------------------------------------------------------
+//
+inline TUint CPhoneGsmParserResult::AuxInformation() const
+    {
+    return iAuxInformation;
+    }
+
+// ---------------------------------------------------------
+// CPhoneGsmParserResult::CountParameters
+// ---------------------------------------------------------
+//
+inline TUint CPhoneGsmParserResult::CountParameters() const
+    {
+    return iParameters->Count();
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/string_parser_api/inc/cphonegsmpcnprocedurehandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  It is handler for PCN specific procedures.
+*
+*/
+
+
+#ifndef CPHONEGSMPCNPROCEDUREHANDLER_H
+#define CPHONEGSMPCNPROCEDUREHANDLER_H
+
+// INCLUDES
+#include    "cphonegsmhandlerbase.h" 
+
+// CLASS DECLARATION
+
+/**
+* It is handler for GsmPcn procedures.
+*
+* @since 1.0
+* @lib phoneparser.lib
+*/
+class CPhoneGsmPcnProcedureHandler 
+    : public CPhoneGsmHandlerBase
+    {
+    public: // New functions
+
+        /**
+        * Process SIM locking.
+        *
+        * Parameters are empty strings if SIM lock
+        * code was just garbage.
+        * 
+        * @param aPassword sequence of digits.
+        * @param aType sequence of digits.
+        */
+        virtual void ProcessSimLockL( 
+            const TDesC& aPassword, 
+            const TDesC& aType ) = 0;
+
+        /**
+        * Process SIM unlocking.
+        *
+        * Parameters are empty strings if SIM unlock
+        * code was just garbage.
+        * 
+        * @param aPassword sequence of digits.
+        * @param aType sequence of digits.
+        */
+        virtual void ProcessSimUnlockL(
+            const TDesC& aPassword,
+            const TDesC& aType ) = 0;
+
+    public: // Functions from base classes
+
+        /**
+        * From CPhoneGsmHandlerBase, processes result.
+        *
+        * @param aResult It is to be processed.
+        */
+        IMPORT_C virtual void ProcessL( CPhoneGsmParserResult& aResult );
+        
+    };
+
+#endif      // CPHONEGSMPCNPROCEDUREHANDLER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/string_parser_api/inc/cphonegsmphonenumberhandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  It is base handler for phone number.
+*
+*/
+
+
+#ifndef CPHONEGSMPHONENUMBERHANDLER_H
+#define CPHONEGSMPHONENUMBERHANDLER_H
+
+// INCLUDES
+#include    "cphonegsmhandlerbase.h" 
+
+// CLASS DECLARATION
+
+/**
+* It is base handler for phone number.
+*
+* @since 1.0
+* @lib phoneparser.lib
+*/
+class CPhoneGsmPhoneNumberHandler 
+    : public CPhoneGsmHandlerBase
+    {
+    public: // New functions
+
+        /**
+        * Clir overriding options
+        *
+        * EClirDefault      - default clir
+        * EClirInvoke       - explicit invoke
+        * EClirSuppress     - explicit suppress
+        */
+        enum TClir
+            {
+            EClirDefault,
+            EClirInvoke,
+            EClirSuppress 
+            };
+        
+        /**
+        * Process dial to number
+        *
+        * @param aNumber main number part.
+        * @param aDtmfPostfix dtmf postfix.
+        * @param aClir clir part.
+        */
+        virtual void ProcessDialToNumberL( 
+            const TDesC& aNumber,
+            const TDesC& aDtmfPostfix,
+            TClir aClir ) = 0;
+
+    public: // Functions from base classes
+
+        /**
+        * From CPhoneGsmHandlerBase, processes result.
+        *
+        * @param aResult It is to be processed.
+        */
+        IMPORT_C virtual void ProcessL( CPhoneGsmParserResult& aResult );
+    };
+
+#endif      // CPHONEGSMPHONENUMBERHANDLER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/string_parser_api/inc/cphonegsmsimcontrolhandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  It is handler for SIM control procedures.
+*
+*/
+
+
+#ifndef CPHONEGSMSIMCONTROLHANDLER_H
+#define CPHONEGSMSIMCONTROLHANDLER_H
+
+// INCLUDES
+#include    "cphonegsmhandlerbase.h" 
+
+// CLASS DECLARATION
+
+/**
+* It is handler for sim control procedures.
+*
+* @since 1.0
+* @lib phoneparser.lib
+*/
+class CPhoneGsmSimControlHandler 
+    : public CPhoneGsmHandlerBase
+    {
+    public: // New functions
+        
+        /**
+        * It defines different types of codes.
+        */
+        enum TPinCode 
+            {
+            EPinCode,
+            EPin2Code
+            };
+
+        /**
+        * Change pin code
+        *
+        * @param aType It is type of pin.
+        * @param aOldPin It is old pin.
+        * @param aNewPin It is new pin.
+        * @param aNewPin2 It is new pin.
+        */
+        virtual void ProcessChangePinL( 
+            TPinCode aType, 
+            const TDesC& aOldPin,
+            const TDesC& aNewPin,
+            const TDesC& aNewPin2 ) = 0;
+
+        /**
+        * Unblock pin code.
+        *
+        * @param aType It is type of pin to unblock.
+        * @param aPuk It is unblocking code.
+        * @param aNewPin It is new pin.
+        * @param aNewPin2 It is new pin.
+        */
+        virtual void ProcessUnblockPinL(
+            TPinCode aType,
+            const TDesC& aPuk,
+            const TDesC& aNewPin,
+            const TDesC& aNewPin2 ) = 0;
+    
+    public: // Functions from base classes
+
+        /**
+        * From CPhoneGsmHandlerBase, process the results of parsing.
+        *
+        * @param aResult It is results to be processed.
+        */
+        IMPORT_C virtual void ProcessL( 
+            CPhoneGsmParserResult& aResult );
+
+    private:
+
+        /**
+        * Process pin change.
+        */
+        void ProcessPinChangeL(
+            TPinCode aType,
+            CPhoneGsmParserResult& aResult );
+
+        /**
+        * Process pin unblock.
+        */
+        void ProcessPinUnblockL(
+            TPinCode aType,
+            CPhoneGsmParserResult& aResult );
+    };
+
+#endif      // CPHONEGSMSIMCONTROLHANDLER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/string_parser_api/inc/cphonegsmsscallhandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,103 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  It is base handler for supplementary services during calls.
+*
+*/
+
+
+#ifndef CPHONEGSMSSCALLHANDLER_H
+#define CPHONEGSMSSCALLHANDLER_H
+
+// INCLUDES
+#include    "cphonegsmhandlerbase.h" 
+
+// CLASS DECLARATION
+
+/**
+* It is base handler for supplementary services during calls.
+*
+* @since 1.0
+* @lib phoneparser.lib
+*/
+class CPhoneGsmSsCallHandler 
+    : public CPhoneGsmHandlerBase
+    {
+    public: // New functions
+
+        /**
+        * Reject a call.
+        *
+        * Command: 0 SEND.
+        */
+        virtual void ProcessEndOrRejectL() = 0;
+        
+        /**
+        * Ends a call and accepts another.
+        *
+        * Command: 1 SEND.
+        */
+        virtual void ProcessEndAndAcceptL() = 0;
+
+        /**
+        * End specific active call.
+        *
+        * Command: 1X SEND.
+        *
+        * @param aCallNo index of call, X in 1X.
+        */
+        virtual void ProcessEndCallL( TInt aCallNo ) = 0;
+
+        /**
+        * Hold all active calls except specific call.
+        *
+        * Command: 2X SEND.
+        *
+        * @param aCallNo index of call, X in 2X.
+        */
+        virtual void ProcessHoldAllCallsExceptL( TInt aCallNo ) = 0;
+
+        /**
+        * Swap
+        *
+        * Command: 2 SEND.
+        */
+        virtual void ProcessSwapL() = 0;
+
+        /**
+        * Join two calls to conference.
+        *
+        * Command: 3 SEND.
+        */
+        virtual void ProcessJoinL() = 0;
+
+        /**
+        * Perform explicit call transfer
+        *
+        * Command: 4 SEND.
+        */ 
+        virtual void ProcessExplicitCallTransferL() = 0;
+               
+    public: // Functions from base classes
+
+        /**
+        * From CPhoneGsmHandlerBase, processes result.
+        *
+        * @param aResult It is to be processed.
+        */
+        IMPORT_C virtual void ProcessL( CPhoneGsmParserResult& aResult );
+    };
+
+#endif      // CPHONEGSMSSCALLHANDLER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/string_parser_api/inc/cphonegsmsshandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,204 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  It is base class for handlers of supplementary service requests.
+*
+*/
+
+
+#ifndef CPHONEGSMSSHANDLER_H
+#define CPHONEGSMSSHANDLER_H
+
+// INCLUDES
+#include    "cphonegsmhandlerbase.h" 
+
+// FORWARD DECLARATIONS
+class CPhoneGsmParserResult;
+
+// CLASS DECLARATION
+
+/**
+* It is base class for handlers of supplementary service requests.
+*
+* @since 1.0
+* @lib phoneparser.lib
+*/
+class CPhoneGsmSsHandler 
+    : public CPhoneGsmHandlerBase
+    {
+    public: // New functions
+
+        /**
+        * It is enumeration containing all actions.
+        */
+        enum TAction
+            {
+            EActivate,
+            EDeactivate,
+            EInterrogate,
+            ERegister,
+            EErase
+            };
+
+        /**
+        * It is enumeration containing all forwarding procedures.
+        */
+        enum TForwardingProcedure
+            {
+            EForwardingNotReachable,
+            EForwardingNoReply,
+            EForwardingBusy,
+            EForwardingUnconditional,
+            EForwardingAll,
+            EForwardingAllConditional
+            };
+
+        /**
+        * It is enumeration containing all barring procedures.
+        */
+        enum TBarringProcedure
+            {
+            EBarringAllOutgoingCalls,
+            EBarringAllOutgoingInternationalCalls,
+            EBarringAllOutgoingInternationalCallsExceptHome,
+            EBarringAllIncomingCalls,
+            EBarringAllIncomingCallsWhenRoaming,
+            EBarringAllServices,
+            EBarringAllOutgoingServices,
+            EBarringAllIncomingServices
+            };
+
+        /**
+        * It is enumeration containing all password procedures.
+        */ 
+        enum TPasswordProcedure
+            {
+            EPasswordBarring,
+            EPasswordNetwork
+            };
+
+        /**
+        * Process forwarding procedures.
+        *
+        * If a parameter is not allowed for a procedure,
+        * then it is empty. If a parameter is not explicitly given,
+        * then it is empty. If a parameter is present, then it can
+        * be assumed to contain appropriate values.
+        *
+        * @param aAction It is action.
+        * @param aForwarding It contains forwarding procedure.
+        * @param aNumber It is directory number.
+        * @param aBasicCode It is basic service code.
+        * @param aTimer It is timer.
+        */
+        virtual void ProcessForwardingL(
+            TAction aAction,
+            TForwardingProcedure aForwarding,
+            const TDesC& aNumber,
+            const TDesC& aBasicCode,
+            const TDesC& aTimer ) = 0;
+
+        /**
+        * Process barring procedures.
+        *
+        * See comments for forwarding, they apply also in here.
+        *
+        * @param aAction It is action.
+        * @param aBarring It contains barring procedure.
+        * @param aPassword It should be barring password, if required.
+        * @param aBasicCode It is basic service code.
+        */
+        virtual void ProcessBarringL(
+            TAction aAction,
+            TBarringProcedure aBarring,
+            const TDesC& aPassword,
+            const TDesC& aBasicCode ) = 0;
+
+        /**
+        * Process password change
+        *
+        * @param aPassword It is password procedure.
+        * @param aOldPassword It should be old password.
+        * @param aNewPassword1 It is new password.
+        * @param aNewPassword2 It is new password.
+        */
+        virtual void ProcessPasswordChangeL(
+            TPasswordProcedure aPassword,
+            const TDesC& aOldPassword,
+            const TDesC& aNewPassword1,
+            const TDesC& aNewPassword2 ) = 0;
+
+        /**
+        * Process waiting.
+        *
+        * @param aAction It is action.
+        * @param aBasicCode It is basic service code.
+        */
+        virtual void ProcessWaitingL(
+            TAction aAction,
+            const TDesC& aBasicCode ) = 0;
+
+        /**
+        * Process calling line identification presentation status.
+        */
+        virtual void ProcessClipStatusL() = 0;
+
+        /**
+        * Process calling line idnetification restriction status.
+        */
+        virtual void ProcessClirStatusL() = 0;
+
+        /**
+        * Process connected line presentation status.
+        */
+        virtual void ProcessColpStatusL() = 0;
+
+        /**
+        * Process connected line restriction status.
+        */
+        virtual void ProcessColrStatusL() = 0;
+
+        /**
+        * Process calling name presentation status.
+        */
+        virtual void ProcessCnapStatusL() = 0;
+
+    public: // Functions from base classes
+
+        /**
+        * From CPhoneGsmHandlerBase, processes result.
+        *
+        * @param aResult It is to be processed.
+        */
+        IMPORT_C virtual void ProcessL( CPhoneGsmParserResult& aResult );
+        
+    private:
+
+        /**
+        * Process barring result.
+        */
+        void DoProcessBarringL(
+            TBarringProcedure aBarring,
+            CPhoneGsmParserResult& aResult );
+
+        /**
+        * Process forwarding result.
+        */
+        void DoProcessForwardingL(
+            TForwardingProcedure aForwarding,
+            CPhoneGsmParserResult& aResult );
+    };
+
+#endif      // CPHONEGSMSSHANDLER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/string_parser_api/inc/cphonevoipnumberhandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  It is base handler for voip number.
+*
+*/
+
+
+#ifndef CPHONEVOIPNUMBERHANDLER_H
+#define CPHONEVOIPNUMBERHANDLER_H
+
+// INCLUDES
+#include    "cphonegsmhandlerbase.h" 
+
+// CLASS DECLARATION
+
+/**
+* It is base handler for phone number.
+*
+* @since S60 5.0
+* @lib phoneparser.lib
+*/
+class CPhoneVoipNumberHandler 
+    : public CPhoneGsmHandlerBase
+    {
+    public: // New functions
+    
+        /**
+        * Process dial to voip number
+        * 
+        * @param aNumber main number part.
+        * @param aDtmfPostfix DTMF postfix of the number
+        */
+        virtual void ProcessDialToVoipNumberL( 
+            const TDesC& aNumber,
+            const TDesC& aDtmfPostfix
+            ) = 0;
+
+    public: // Functions from base classes
+
+        /**
+        * From CPhoneGsmHandlerBase, processes result.
+        *
+        * @param aResult It is to be processed.
+        */
+        IMPORT_C virtual void ProcessL( CPhoneGsmParserResult& aResult );
+    };
+
+#endif      // CPHONEVOIPNUMBERHANDLER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/string_parser_api/inc/phonegsmparser.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,164 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  It is class containing static methods to create 
+*                instances of parser and parser results.
+*
+*/
+
+
+#ifndef PHONEGSMPARSER_H
+#define PHONEGSMPARSER_H
+
+// INCLUDES
+#include    <e32base.h>
+
+// FORWARD DECLARATIONS
+class CPhoneGsmParserBase;
+class CPhoneGsmParserResult;
+class CPhoneGsmOptionContainerBase;
+class CPhoneParserFeatures;
+
+// CLASS DECLARATION
+
+/**
+* It is class containing static methods to create 
+* instances of parser and parser results.
+*
+* @since 1.0
+* @lib phoneparser.lib
+*/
+class PhoneGsmParser 
+    {
+    public: // New functions
+           
+        /**
+        * Creates an instance of CPhoneGsmParser, GSM specific parser.
+        *
+        * @return Returns new instance of CPhoneGsmParser.
+        */
+        IMPORT_C static CPhoneGsmParserBase* 
+            CreateParserL();
+
+        /**
+        * Creates an instance of CPhoneGsmParserResult.
+        *
+        * @return Returns new instance of CPhoneGsmParserResult.
+        */
+        IMPORT_C static CPhoneGsmParserResult* 
+            CreateResultL();
+
+        /**
+        * Creates option container.
+        *
+        * Note that options are defined and set to initial status.
+        *
+        * @return Returns new instance of CPhoneGsmOptionContainerBase.
+        */
+        IMPORT_C static CPhoneGsmOptionContainerBase*
+            CreateOptionContainerL();
+        
+        /**
+        * Enumerates all common types.
+        */
+        enum TContentType
+            {
+            EContentInvalid,
+            EContentUnknown, // but still valid
+            EContentPhoneNumber,
+            EContentSupplementaryService,
+            EContentUnstructuredService
+            };
+
+        /**
+        * Determines the type of content.
+        */
+        IMPORT_C static TContentType DetermineContentType( 
+            const CPhoneGsmParserResult& aResult );
+
+        /**
+        * Checks if it is allowed for arriving call.
+        *
+        * Note that this is ui issue. This could be done otherwise,
+        * but this is clearly the simplest option.
+        *
+        * @return ETrue if allowed.
+        */
+        IMPORT_C static TBool IsAllowedForArriving(
+            const CPhoneGsmParserResult& aResult );
+
+        /**
+        * Checks if it is allowed for bad sim state.
+        *
+        * Note that this is ui issue. This could be done otherwise,
+        * but this is clearly the simplest option.
+        *
+        * @return ETrue if allowed.
+        */
+        IMPORT_C static TBool IsAllowedForBadSim(
+            const CPhoneGsmParserResult& aResult );
+
+#ifdef __WINS__
+        /**
+        * For testing purposes.
+        *
+        * @param aStub feature stub.
+        */
+        IMPORT_C static void UseFeatureStub( CPhoneParserFeatures* aStub );
+#endif // __WINS__
+
+        /**
+        * It enumerates the reasons for panics in parser.
+        */
+        enum TPanicReason
+            {
+            EIncorrectServiceDescription,
+            EIncorrectUse,
+            EOptionNotDefined,
+            EOptionAlreadyDefined,
+            EShouldNeverHappen
+            };
+
+        /**
+        * Panic!
+        *
+        * @param aReason It is the reason for panic.
+        */
+        static void Panic( TPanicReason aReason );
+
+    private:
+
+        /** 
+        * Define all options.
+        *
+        * @param aOptions It is the option container.
+        */
+        static void DefineOptionsL( 
+            CPhoneGsmOptionContainerBase& aOptions );
+        
+        /**
+        * Initialise options to default values.
+        */
+        static void InitialiseOptionsToDefaultValues(
+                CPhoneGsmOptionContainerBase& aOptions );
+
+        /**
+        * Creates parser for manufacturer specific procedures.
+        */
+        static CPhoneGsmParserBase* CreateManufacturerProcedureParserLC();
+
+    };
+
+#endif      // PHONEGSMPARSER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/telephony_mediator_api/tsrc/ut_telephony_mediator_api/src/ut_telephonymediator_dllmain.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -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:
+*
+*/
+
+#include "ut_callinfos.h"
+#include "ut_remotepartyinfos.h"
+#include "ut_remotepartyinfo.h"
+#include <CEUnitTestSuite.h>
+
+
+
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+    {
+    _LIT( KSuiteName, "Mediator API tests" );
+    CEUnitTestSuite* rootSuite = CEUnitTestSuite::NewLC( KSuiteName );
+    // Note that NewLC leaves the object in the cleanupstack.
+    rootSuite->AddL( ut_callinfos::NewLC() );
+    CleanupStack::Pop(); 
+    rootSuite->AddL( ut_remotepartyinfos::NewLC() );
+    CleanupStack::Pop();
+    rootSuite->AddL( ut_remotepartyinfo::NewLC() );
+    CleanupStack::Pop();
+    CleanupStack::Pop( rootSuite );
+    return rootSuite;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonesrv_plat/telephony_network_information_api/inc/networkhandlingdomainpskeys.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,86 @@
+/*
+* 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:  Domain Publish & Subscribe keys for network handling
+ *
+ *
+*/
+
+
+#ifndef NETWORKHANDLINGDOMAINPSKEYS_H
+#define NETWORKHANDLINGDOMAINPSKEYS_H
+
+const TUid KPSUidNetworkInfo = { 0x10202999 };
+/**
+* Used to indicate status of homezone
+*
+* Possible values:
+* 0: None
+* 1: City zone
+* 2: Home zone
+ */
+const TUint KNWHomeZoneStatus = 0x00000001;
+
+enum KNWZoneStatus
+    {
+    ENWNone,
+    ENWCityZone, 
+    ENWHomeZone 
+    };
+
+/**
+* Used to indicate mode of network
+*
+* Possible values:
+* 0: Unknown mode, Default value
+* 1: Gsm mode
+* 2: Cdma mode
+* 3: Wcdma mode
+*/
+const TUint KNWTelephonyNetworkMode = 0x00000002;
+
+enum KNWNetworkMode
+    {
+    ENWNetworkModeUnknown,
+    ENWNetworkModeGsm,
+    ENWNetworkModeCdma,
+    ENWNetworkModeWcdma
+    };
+/**
+* Used to indicate network registration status
+*
+* Possible values:
+* 0: Registration status unknown
+* 1: Not registered, no service
+* 2: Not registered, service available for emergency calls only
+* 3: Not registered, searching for network
+* 4: Registered, network busy
+* 5: Registered on home network
+* 6: Registration denied 
+* 7: Registered on roaming network
+*/
+const TUint KNWRegistrationStatus = 0x00000003;
+
+enum TNWNetworkRegistrationStatus
+    {
+    ENWStatusRegistrationUnknown,
+    ENWStatusNotRegisteredNoService,
+    ENWStatusNotRegisteredEmergencyOnly,
+    ENWStatusNotRegisteredSearching,
+    ENWStatusRegisteredBusy,
+    ENWStatusRegisteredOnHomeNetwork,
+    ENWStatusRegistrationDenied,
+    ENWStatusRegisteredRoaming
+    };    
+
+#endif //NETWORKHANDLINGDOMAINPSKEYS_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/CenRep/SATInternalPSKeys.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2004-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  SATEngine Subsystem PubSub uid and keys declaration.
+*
+*/
+
+
+#ifndef SATINTERNALPSKEYS_H
+#define SATINTERNALPSKEYS_H
+
+// CONSTANTS
+
+// SAT Internal Configuration API
+
+/* 
+ * The UID for internal use only. Using process secure uid 0x1000A833 
+ * which is define in satserver.mmp
+ */
+const TUid  KPSUidSatServerInternal = { 0x1000A833 }; 
+
+/*
+ * Indicates the occurred End Key action. Used to determine whether to fetch 
+ * icons from NAA syncronously or asynchronously. When the value is set to 1
+ * it indicates that the End Key is pressed and synchronous mode must be used.
+ *
+ * Default value: 0
+ */
+const TUint32 KSatAppClosedUsingEndKey( 0x00000032 );
+
+/**
+ * Set Up Idle Mode Text. Value is a unicode string with length 0 to 242.
+ *
+ * Default value: N/A
+ **/
+const TUint32 KSatIdleModeText( 0x00000001 );
+
+/**
+ * Set Up Idle Mode Text Icon Id. Possible values are -1 to 255.
+ * ID Determined independently of SAT.
+ *
+ * Default value: N/A
+ */
+const TUint32 KSatIdleModeTextIconId( 0x00000002 );
+
+/**
+ * Set Up Idle Mode Text Icon qualifier.
+ *
+ * Default value: N/A
+ */
+const TUint32 KSatIdleModeTextIconQualifier( 0x00000004 );
+
+/**
+ * Possible enumerations values for KSatAppClosedUsingEndKey.
+ */
+enum TSatAppTerminatedEventValue
+    {
+    KSatAppTerminatedNormal,
+    KSatAppTerminatedUsingEndKey
+    };
+
+/**
+ * Possible enumerations values for KSatIdleModeTextIconQualifier.
+ */
+enum TSatIdleModeTextIconQualifierValue
+    {
+    KSatIdleIconQInit = 0x00,
+    KSatIdleIconQNoIcon = 0x01,
+    KSatIdleIconQSelfExplanatory = 0x02,
+    KSatIdleIconQNotSelfExplanatory = 0x04
+    };
+
+#endif // SATINTERNALPSKEYS_H
+
+// End of File
Binary file satengine/satserver/CenRep/keys_sat.xls has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/CallControlCmd/group/CallControlCmd.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* 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:  Project definition file for project CallControl plug-in
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../../inc/SatMacroes.h"
+
+TARGET                  CallControlCmd.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D 0x1020298B
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  std.cpp
+SOURCE                  CCallControlHandler.cpp
+SOURCE                  ccallcontrolrequesthandler.cpp
+
+START RESOURCE          1020298B.rss
+TARGET                  CallControlCmd.rsc
+END
+
+USERINCLUDE             ../../../inc
+USERINCLUDE             ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+SYSTEMINCLUDE           ../../../../../inc      // Domain telephony
+SYSTEMINCLUDE           ../../../../inc         // Subsystem satengine
+
+LIBRARY                 euser.lib
+LIBRARY                 charconv.lib
+LIBRARY                 etelsat.lib
+LIBRARY                 etelmm.lib
+LIBRARY                 SatEngine.lib
+
+#ifdef ENABLE_SAT_LOGGING
+LIBRARY                 flogger.lib
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/CallControlCmd/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CallControlCmd plug-in
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+CallControlCmd.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/CallControlCmd/inc/CCallControlHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,182 @@
+/*
+* 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:  CallControl command handler
+*
+*/
+
+
+
+#ifndef CCALLCONTROLHANDLER_H
+#define CCALLCONTROLHANDLER_H
+
+#include <etelsat.h>
+#include "CSatCommandHandler.h"
+#include "SatSTypes.h"
+
+class MSatUtils;
+class CCallControlRequestHandler;
+
+/**
+*  Command handler for CallControl command.
+*
+*  @lib CallControlCmd.lib
+*  @since Series 60 3.0
+*/
+class CCallControlHandler : public CSatCommandHandler
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aUtils Utils inteface
+        */
+        static CCallControlHandler* NewL( MSatUtils* aUtils );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CCallControlHandler();
+
+    public: // Functions from base classes
+
+        /**
+        * From MSatCommand.
+        */
+        void ClientResponse();
+        
+    public:// New Functions
+         
+        /**
+        * Processes the Cc Request Complete.
+        *
+        * @param aErrCode Result of ETelMM Api calling.
+        */
+        void DispatchCcRequestComplete( const TInt aErrCode );
+         
+        /**
+        * TCcStatus
+        * Call control status, when there is an asynchronous
+        * operation is handling by the CCallControlRequestHandler
+        * we will save some status information
+        */
+        enum TCcStatus
+            {
+            ECcIdle = 0,
+            ECcDialWaiting,
+            ECcSendSsWaiting,
+            ECcSendUssdWaiting
+            };
+            
+    protected:  // Functions from base classes
+
+        /**
+        * From CActive Cancels the usat request.
+        */
+        void DoCancel();
+
+        /**
+        * From CSatCommandHandler Requests the command notification.
+        * @param aStatus Request status to active object notification
+        */
+        void IssueUSATRequest( TRequestStatus& aStatus );
+
+        /**
+        * From CSatCommandHandler Precheck before executing the command.
+        * @return Boolean indicating is this command allowed to execute.
+        */
+        TBool CommandAllowed();
+
+        /**
+        * From CSatCommandHandler Need for ui session.
+        * @return Boolean indicating does this command need UI session.
+        */
+        TBool NeedUiSession();
+
+        /**
+        * From CSatCommandHandler Called when USAT API notifies that command.
+        */
+        void HandleCommand();
+
+        /**
+        * From CSatCommandHandler. Indicates the failure of launching ui client
+        */
+        void UiLaunchFailed();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CCallControlHandler();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+        
+        
+        /**
+        * If it is needed that sat makes a no FDN check call or 
+        * send SS or send USSD we should perform these operation 
+        */
+        void CallControlClientOperation();
+        
+        /**
+        * If SAT needs to do Call Control next action, 
+        * i.e. Call Control has modified the type of request,
+        * then this method should be called
+        */
+        TInt DialNumber();
+    
+        /**
+        * Make a no FDN check Send SS
+        */
+        TInt SendSs();
+
+        /**
+        * Make a no FDN check Send USSD
+        */
+        TInt SendUssd();
+        
+        /**
+         * Notify session done, start recieve more command.
+         */
+        void CompleteCallControlCmd( TInt aErrCode );
+        
+    private:    // Data
+
+        // CallControl command data.
+        RSat::TCallControlV6 iCallControlData;
+        // CallControl command package.
+        RSat::TCallControlV6Pckg iCallControlPckg;
+        // CallControl send data
+        TSatNotificationV1 iCallControlSendData;
+        // CallControl SendData package
+        TSatNotificationV1Pckg iCallControlSendDataPckg;
+        // CallControl UI Response data
+        TSatNotificationRspV1 iCallControlUiRespData;
+        // CallControl UI Response package
+        TSatNotificationRspV1Pckg iCallControlUiRespDataPckg;
+        // Indicates is UI needed or not
+        TBool iNeedUiSession;
+        // Handing the asynchronous request
+        CCallControlRequestHandler* iRequestHandler;
+        // Current status
+        TCcStatus iCcStatus;
+
+    };
+
+#endif      // CCALLCONTROLHANDLER_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/CallControlCmd/inc/CallControlCmd.rls	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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 headers for project CallControlCmd
+*
+*/
+
+
+#ifndef CALLCONTROLCMD_RLS
+#define CALLCONTROLCMD_RLS
+
+rls_string STRING_r_callcontrolcmd_display_name "CallControl command"
+rls_string STRING_r_callcontrolcmd_default_data "CallControlCmd"
+rls_string STRING_r_callcontrolcmd_opaque_data  ""
+
+#endif // CALLCONTROLCMD_RLS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/CallControlCmd/inc/ccallcontrolrequesthandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,125 @@
+/*
+* 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 CallControl request that need SAT perform
+*
+*/
+
+
+#ifndef CCALLCONTROLREQUESTHANDLER_H
+#define CCALLCONTROLREQUESTHANDLER_H
+
+#include <e32base.h>
+#include "msatmultimodeapi.h"
+
+class CCallControlHandler;
+
+/**
+*  This is the handler for the ETel MM api Request.
+*  This active objects is registered with ETelMM Api to send request and 
+*  receive notifications about some Request Complete.
+*
+*  @lib CallControlCmd
+*  @since S60 v5.0.1
+*/
+
+class CCallControlRequestHandler : public CActive
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     * @param aPhone A reference to the MSatMultiModeApi.
+     * @param aDispatcher Pointer to Ss handler
+     * @return a pointer to the newly created object.
+     */
+    static CCallControlRequestHandler* NewL( MSatMultiModeApi& aPhone,
+        CCallControlHandler* aDispatcher );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCallControlRequestHandler();
+
+    /**
+     * Access RMobileCall::DialNoFdnCheck by MSatMultiModeApi
+     * for the paramter information please see the etelmm.h
+     */
+    void DialNumber( const TDesC8& aCallParams, const TDesC& aTelNumber );
+
+    /**
+     * Starts send the SS Request (No FDN check).
+     * for the paramter information please see the etelmm.h
+     */
+    void SendSs( const TDesC& aServiceString );
+
+    /**
+     * Starts send the USSD Request (No FDN check).
+     * for the paramter information please see the etelmm.h
+     */
+    void SendUssd( const TDesC8& aMsgData, const TDesC8& aMsgAttributes );
+
+    /**
+     * Cancel the asynchronous operations that required to the ETel MM api  
+     * for the paramter information please see the etelmm.h
+     */
+    void CancelOperation( TInt aOperationType );
+ 
+protected:
+
+    /**
+     * From CActive, handles the request completion.
+     */
+    void RunL();
+    
+    
+    /**
+     * From CActive, handle the request cancel
+     */
+    void DoCancel();
+
+private:
+
+    /**
+     * C++ default constructor.
+     * @param aPriority An active object priority value.
+     * @param aPhone A reference to MSatMultiModeApi.
+     */
+    CCallControlRequestHandler( MSatMultiModeApi& aPhone,
+        CCallControlHandler* aDispatcher );
+        
+    /**
+     * Two phase contruction.
+     */    
+    void ConstructL();
+
+private: // Data
+
+    /**
+     * Reference to the MSatMultiModeApi
+     */
+    MSatMultiModeApi& iPhone;
+        
+    /**
+     * Result of the operations
+     */
+    TInt iCcStatus;
+
+    /**
+     * Pointer to SendSs command handler
+     */
+    CCallControlHandler* iDispatcher;
+    };
+
+#endif      // CCALLCONTROLREQUESTHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/CallControlCmd/src/1020298B.rss	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 1020 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Registry information for ECOM
+*
+*/
+
+
+
+//  INCLUDES
+#include <registryinfo.rh>
+#include "CallControlCmd.rls"
+
+//  RESOURCE DEFINITIONS
+// -----------------------------------------------------------------------------
+//
+// CallControlCmdInfo
+// Registeration information for ECOM
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO CallControlCmdInfo
+    {
+    dll_uid = 0x1020298B;
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x1000f001;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x1020298C;
+                    version_no   = 1;
+                    display_name = STRING_r_callcontrolcmd_display_name;
+                    default_data = STRING_r_callcontrolcmd_default_data;
+                    opaque_data  = STRING_r_callcontrolcmd_opaque_data;
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/CallControlCmd/src/CCallControlHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,650 @@
+/*
+* 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:  Handles CallControl command
+*
+*/
+
+
+//Include Files
+#include    <utf.h>
+#include    "MSatApi.h"
+#include    "MSatUtils.h"
+#include    "MSatUiSession.h"
+#include    "MSatSUiClientHandler.h"
+#include    "CCallControlHandler.h"
+#include    "ccallcontrolrequesthandler.h"
+#include    "msatmultimodeapi.h"
+#include    "SatLog.h"
+
+// USSD DCS coding.
+const TUint8 KSatDcs7Bit( 0x40 );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CCallControlHandler::CCallControlHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+//lint -e{1403, 1769} Can not be initialized, harmless.
+CCallControlHandler::CCallControlHandler() :
+    CSatCommandHandler(),
+    iCallControlData(),
+    iCallControlPckg( iCallControlData ),
+    iCallControlSendData(),
+    iCallControlSendDataPckg( iCallControlSendData ),
+    iCallControlUiRespData(),
+    iCallControlUiRespDataPckg( iCallControlUiRespData ),
+    iCcStatus( ECcIdle )
+    {
+    LOG( SIMPLE, "CALLCONTROL: \
+        CCallControlHandler::CCallControlHandler calling - exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CCallControlHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCallControlHandler::ConstructL()
+    {
+    LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::ConstructL calling" )
+
+    iUtils->RegisterServiceRequestL(
+        ESatSProactiveNotification,
+        ESatSProactiveNotificationResponse,
+        this );
+
+    iRequestHandler = 
+        CCallControlRequestHandler::NewL( iUtils->MultiModeApi(), this ); 
+
+    LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CCallControlHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCallControlHandler* CCallControlHandler::NewL( MSatUtils* aUtils )
+    {
+    LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::NewL calling" )
+
+    CCallControlHandler* self = new( ELeave ) CCallControlHandler;
+
+    CleanupStack::PushL( self );
+    self->BaseConstructL( aUtils );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::NewL exiting" )
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCallControlHandler::~CCallControlHandler
+// Destructor
+// -----------------------------------------------------------------------------
+CCallControlHandler::~CCallControlHandler()
+    {
+    LOG( SIMPLE,
+        "CALLCONTROL: CCallControlHandler::~CCallControlHandler calling" )
+
+    Cancel();
+
+    LOG( SIMPLE,
+        "CALLCONTROL: CCallControlHandler::~CCallControlHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CCallControlHandler::ClientResponse
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCallControlHandler::ClientResponse()
+    {
+    LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::ClientResponse calling" )
+
+    CallControlClientOperation();    
+
+    LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::ClientResponse exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CCallControlHandler::DoCancel
+// Cancels the sat request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCallControlHandler::DoCancel()
+    {
+    LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::DoCancel calling" )
+
+    iUtils->USatAPI().NotifyCallControlCancel();
+    iRequestHandler->CancelOperation( iCcStatus ); 
+
+    LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CCallControlHandler::IssueUSATRequest
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCallControlHandler::IssueUSATRequest( TRequestStatus& aStatus )
+    {
+    LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::IssueUSATRequest calling" )
+
+    // Clear the IPC package.
+    new (&iCallControlData) RSat::TCallControlV6();
+    iNeedUiSession = EFalse;
+    iUtils->USatAPI().NotifyCallControl( aStatus, iCallControlPckg );
+
+    LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::IssueUSATRequest exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CCallControlHandler::CommandAllowed
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCallControlHandler::CommandAllowed()
+    {
+    LOG( SIMPLE,
+        "CALLCONTROL: CCallControlHandler::CommandAllowed calling - exiting" )
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCallControlHandler::NeedUiSession
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCallControlHandler::NeedUiSession()
+    {
+    LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::NeedUiSession calling" )
+    // UI is not needed, if control is AllowedWithMod and AlphaId is NULL or
+    // control is Allowed and AlphaId is not provided
+
+    //  Get values
+    RSat::TAlphaId alphaId;
+    RSat::TAlphaIdValidity validity;
+    RSat::TControlResult controlResult;
+
+    // Get Alpha Id and Control result by SIM.
+    iCallControlPckg().GetAlphaId( validity, alphaId );
+    iCallControlPckg().GetCcGeneralResult( controlResult );
+
+    const TBool alphaIdNull( RSat::EAlphaIdNull == alphaId.iStatus ||
+                             RSat::EAlphaIdNotSet == alphaId.iStatus );
+
+    const TBool controlAllowed( 
+                RSat::EAllowedNoModification == controlResult ||
+                RSat::EControlResultNotSet == controlResult );
+    LOG2( NORMAL, "CALLCONTROL: CCallControlHandler::NeedUiSession \
+            controlResult: %d", controlResult )
+    LOG2( NORMAL, "CALLCONTROL: CCallControlHandler::NeedUiSession \
+            alphaId.iStatus: %d", alphaId.iStatus )    
+
+    if ( RSat::EAllowedWithModifications == controlResult && 
+         alphaIdNull )
+        {
+        LOG( NORMAL, "CALLCONTROL: CCallControlHandler::NeedUiSession \
+             EAllowedWithModifications" )
+        iNeedUiSession = EFalse;
+        }
+    else if ( controlAllowed && ( RSat::EAlphaIdProvided != alphaId.iStatus ) )
+        {
+        LOG( NORMAL, "CALLCONTROL: CCallControlHandler::NeedUiSession \
+             RSat::EAlphaIdProvided != alphaId.iStatus" )
+        iNeedUiSession = EFalse;
+        }
+    else
+        {
+        iNeedUiSession = ETrue;
+        }
+
+    // Notify other commands that we are executing.
+    iUtils->NotifyEvent( MSatUtils::ECallControlExecuting );
+
+    LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::NeedUiSession exiting" )
+    return iNeedUiSession;
+    }
+
+// -----------------------------------------------------------------------------
+// CCallControlHandler::HandleCommand
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCallControlHandler::HandleCommand()
+    {
+    LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::HandleCommand calling" )
+
+    // Check do we need UI
+    if ( iNeedUiSession )
+        {
+        // Clear send data.
+        TSatNotificationV1 clear;
+        iCallControlSendData = clear;
+
+        //  Build the IPC package.
+        RSat::TAlphaId alphaId;
+        RSat::TAlphaIdValidity validity;
+        RSat::TControlResult controlResult;
+
+        // Get Alpha Id and Control result by SIM.
+        iCallControlPckg().GetAlphaId( validity, alphaId );
+        iCallControlPckg().GetCcGeneralResult( controlResult );
+        
+        // Enums to UI related parameters
+        TSatAlphaIdStatus satAlphaIdStatus;
+        TSatControlResult satControlResult;
+
+        LOG2( NORMAL, "CALLCONTROL: CCallControlHandler::HandleCommand\
+                alphaId.iStatus: %d", alphaId.iStatus ) 
+        LOG2( NORMAL, "CALLCONTROL: CCallControlHandler::HandleCommand\
+                controlResult: %d", controlResult )
+        // Map RSat value
+        switch ( alphaId.iStatus )
+            {
+            case RSat::EAlphaIdProvided :
+                {
+                satAlphaIdStatus = ESatAlphaIdNotNull;
+                break;
+                }
+
+            case RSat::EAlphaIdNotPresent :
+                {
+                satAlphaIdStatus = ESatAlphaIdNotProvided;
+                break;
+                }
+
+            // Use this also as a default value
+            case RSat::EAlphaIdNull :
+            case RSat::EAlphaIdNotSet :
+            default :
+                {
+                satAlphaIdStatus = ESatAlphaIdNull;
+                break;
+                }
+            }
+
+        // Map RSat value
+        switch ( controlResult )
+            {
+            case RSat::ENotAllowed :
+                {
+                satControlResult = ESatNotAllowed;
+                break;
+                }
+
+            case RSat::EAllowedWithModifications :
+                {
+                satControlResult = ESatAllowedWithModifications;
+                break;
+                }
+
+            // Use this also as a default value
+            case RSat::EAllowedNoModification :
+            case RSat::EControlResultNotSet :
+            default :
+                {
+                satControlResult = ESatAllowedNoModification;
+                break;
+                }
+            }
+
+        // Get information needed.
+        iCallControlSendData.iCommand = ESatSCallControlNotify;
+        iCallControlSendData.iText = alphaId.iAlphaId;
+        iCallControlSendData.iAlphaIdStatus = satAlphaIdStatus;
+        iCallControlSendData.iControlResult = satControlResult;
+
+        // Register notification observer
+        TRAPD( regErr, iUtils->RegisterServiceRequestL(
+            ESatSProactiveNotification,
+            ESatSProactiveNotificationResponse,
+            this )
+            ); // TRAPD
+        LOG2( NORMAL, "CALLCONTROL: CCallControlHandler::HandleCommand \
+                regErr: %d",regErr )
+        // No need to check error value, since we cannot send terminal
+        // response for this command
+        if ( KErrNone == regErr )
+            {
+            // Get UISession.
+            MSatUiSession* uiSession = iUtils->SatUiHandler().UiSession();
+
+            // Send command to SatClient.
+            uiSession->SendCommand( &iCallControlSendDataPckg,
+                &iCallControlUiRespDataPckg, ESatSProactiveNotification );
+            }
+        }
+    else
+        {
+        LOG( NORMAL, "CCallControlHandler::HandleCommand UI isn't needed" )
+        CallControlClientOperation();
+        }
+    LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::HandleCommand exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CCallControlHandler::UiLaunchFailed
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCallControlHandler::UiLaunchFailed()
+    {
+    LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::UiLaunchFailed calling" )
+
+    // We cannot send terminal response to SIM since it doesn't
+    // expect terminal response from MoSmControl command...
+
+    // Inform the session that we are done here
+    iUtils->NotifyEvent( MSatUtils::EDelaySimSessionEnd );
+
+    // Start to receive more commands.
+    Start();
+
+    LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::UiLaunchFailed exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CCallControlHandler::CallControlClientOperation
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCallControlHandler::CallControlClientOperation()
+    {
+    LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::CallControlClientOperation\
+     calling" )
+    RSat::TCallParamOrigin controlOrigin;
+    iCallControlData.GetCallParamOrigin( controlOrigin );
+    LOG2( NORMAL, "CALLCONTROL: CCallControlHandler::\
+        CallControlClientOperation GetCallParamOrigin = %d", controlOrigin )
+    iCcStatus = ECcIdle;
+   
+    RSat::TActionOriginator actionOrigin;
+    iCallControlData.GetActionOriginator( actionOrigin );
+    LOG2( NORMAL, "CALLCONTROL: CCallControlHandler::\
+          CallControlClientOperation GetActionOriginator: %d", actionOrigin )
+
+    if ( RSat::EClientOriginator == actionOrigin )
+        {
+        RSat::TCallControlType controlType;
+        iCallControlData.GetCallControlType( controlType );
+        
+        switch ( controlType )
+            {
+            case RSat::ECcAddress:
+                {
+                LOG( NORMAL, "CALLCONTROL: CCallControlHandler::\
+                 CallControlClientOperation ControlType ECcArddress" )
+                if ( KErrNone == DialNumber() )
+                    {
+                    iCcStatus = ECcDialWaiting;
+                    }
+                break;
+                }
+            case RSat::ECcSsString:
+                {
+                LOG( NORMAL, "CALLCONTROL: CCallControlHandler::\
+                 CallControlClientOperation ControlType ECcSsString" )
+                if ( KErrNone == SendSs() )
+                    {
+                    iCcStatus = ECcSendSsWaiting;
+                    }
+                break;
+                }
+            case RSat::ECcUssdString:
+                {
+                LOG( NORMAL, "CALLCONTROL: CCallControlHandler::\
+                 CallControlClientOperation ControlType ECcUssdString" )
+                if ( KErrNone == SendUssd() )
+                    {
+                    iCcStatus = ECcSendUssdWaiting;
+                    }
+                break;
+                }
+            default:
+                {
+                LOG2( NORMAL, "CALLCONTROL: CCallControlHandler::\
+                 CallControlClientOperation ControlType %d", controlType )
+                break;
+                }
+            }
+        }
+            
+    if ( ECcIdle == iCcStatus )
+        {
+        CompleteCallControlCmd( KErrNone );
+        }
+    LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::CallControlClientOperation\
+         exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CCallControlHandler::DialNumber
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCallControlHandler::DialNumber()
+    {
+    LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::DialNumber calling" )
+    TInt err( KErrNone );
+    iCcStatus = ECcDialWaiting;
+    RSat::TCallSetUpParams callParams;
+    err = iCallControlData.GetCallSetUpDetails ( callParams );
+        
+    if ( !err )
+        {
+        RMobileCall::TMobileCallParamsV7 dialParams;
+        dialParams.iAutoRedial = ETrue;
+        dialParams.iBearerMode = RMobileCall::EMulticallNewBearer;
+        dialParams.iCallParamOrigin = RMobileCall::EOriginatorEtelClient;
+        dialParams.iSubAddress = callParams.iSubAddress;
+        dialParams.iBearerCap1 = callParams.iCcp1;
+        dialParams.iBearerCap2 = callParams.iCcp2;        
+        iCallControlData.GetBCRepeatIndicator( 
+            reinterpret_cast< RSat::TBCRepeatIndicator& > 
+            ( dialParams.iBCRepeatIndicator ) );
+        dialParams.iIconId.iQualifier = RMobileCall::EIconQualifierNotSet;
+        dialParams.iIconId.iIdentifier = 0;
+        
+        RSat::TAlphaId alphaid;
+        RSat::TAlphaIdValidity validity;
+        iCallControlData.GetAlphaId( validity, alphaid );
+        
+        if ( (RSat::EValidAlpaId == validity)
+            && ( RSat::EAlphaIdProvided == alphaid.iStatus ) )
+            {                   
+            LOG2( NORMAL, 
+                "CALLCONTROL: CCallControlHandler::DialNumber id:%S",
+                &alphaid.iAlphaId )
+            dialParams.iAlphaId = alphaid.iAlphaId;
+            }        
+
+        LOG2( NORMAL, 
+            "CALLCONTROL: CCallControlHandler::DialNumber string %S",
+            &callParams.iAddress.iTelNumber )
+
+        
+        RMobileCall::TMobileCallParamsV7Pckg package( dialParams );
+        iRequestHandler->DialNumber( package, callParams.iAddress.iTelNumber );
+        }
+    LOG2( NORMAL, "CALLCONTROL: CCallControlHandler::DialNumber exiting %d",
+          err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CCallControlHandler::SendSS
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCallControlHandler::SendSs()
+    {
+    LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::SendSs calling" )
+    TInt err( KErrNone );
+    
+    RSat::TSsString ssString;
+    err = iCallControlData.GetSendSsDetails( ssString );
+    if ( !err )
+        {
+        LOG2( NORMAL, "CALLCONTROL: CCallControlHandler::SendSs type %d",
+          ssString.iTypeOfNumber )
+        LOG2( NORMAL, "CALLCONTROL: CCallControlHandler::SendSs plan %d",
+          ssString.iNumberPlan )
+
+        HBufC16* ss16 =  HBufC16::New( ssString.iSsString.Length() );
+        if ( ss16 )
+            {
+            TPtr16 ssPtr( ss16->Des() );
+            CnvUtfConverter::ConvertToUnicodeFromUtf8( ssPtr,
+                ssString.iSsString );  
+    
+            LOG2( NORMAL, "CALLCONTROL: CCallControlHandler::SendSs string %S",
+              ss16 )
+            iRequestHandler->SendSs( *ss16 );        
+            delete ss16;
+            }
+        else
+            {
+            err = KErrNoMemory;
+            }    
+        }
+    LOG2( NORMAL, "CALLCONTROL: CCallControlHandler::SendSs exiting %d", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CCallControlHandler::SendUssd
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCallControlHandler::SendUssd()
+    {
+    LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::SendUssd calling" )
+    TInt err( KErrNone );
+    RSat::TUssdString ussdString;
+    err = iCallControlData.GetSendUssdDetails ( ussdString );
+    if ( !err )
+        {
+        LOG2( NORMAL, "CALLCONTROL: CCallControlHandler::SendUssd string %S",
+            &ussdString.iUssdString )
+         
+        LOG2( NORMAL, "CALLCONTROL: CCallControlHandler::SendUssd schema %d",
+            ussdString.iDcs )
+
+        RMobileUssdMessaging::TMobileUssdAttributesV1 ussdAttr;
+        
+        
+        if ( KSatDcs7Bit == ussdString.iDcs )
+            {
+            ussdAttr.iFormat= RMobileUssdMessaging::EFormatPackedString;
+            }
+        else
+            {
+            ussdAttr.iFormat= RMobileUssdMessaging::EFormatUnspecified;                        
+            }
+        
+        HBufC8* ussd8 =  HBufC8::New( ussdString.iUssdString.Length() );
+        if ( ussd8 )
+            {
+            ussd8->Des().Copy( ussdString.iUssdString );
+    
+            ussdAttr.iFlags = RMobileUssdMessaging::KUssdDataFormat
+               | RMobileUssdMessaging::KUssdMessageType
+               | RMobileUssdMessaging::KUssdMessageDcs;
+                
+            ussdAttr.iDcs = ussdString.iDcs;
+            ussdAttr.iType = RMobileUssdMessaging::EUssdMORequest;
+            RMobileUssdMessaging::TMobileUssdAttributesV1Pckg 
+                ussdPckg( ussdAttr );
+    
+            iRequestHandler->SendUssd ( *ussd8, ussdPckg );
+            delete ussd8;
+            }
+        else
+            {
+            err = KErrNoMemory;
+            }    
+        }
+
+    LOG2( NORMAL, "CALLCONTROL: CCallControlHandler::SendUssd exiting %d",
+          err)
+    return err;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCallControlHandler::DispatchCcRequestComplete
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCallControlHandler::DispatchCcRequestComplete( TInt aErrCode )
+    {
+    LOG( SIMPLE, 
+    "CALLCONTROL: CCallControlHandler::DispatchCcRequestComplete calling" )
+    
+    LOG2( NORMAL, 
+    "CALLCONTROL: CCallControlHandler::DispatchCcRequestComplete aErrCode %d",
+    aErrCode )
+
+    iCcStatus = ECcIdle;
+    CompleteCallControlCmd( aErrCode );
+    
+    LOG2( NORMAL, 
+        "CALLCONTROL: CCallControlHandler::SendUssd exiting %d", aErrCode )
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCallControlHandler::CompleteCallControlCmd
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCallControlHandler::CompleteCallControlCmd( TInt /*aErrCode*/ )
+    {
+    LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::CompleteCallControlCmd\
+         calling" )
+
+    // Start to receive more commands. We have to start again here because
+    // we don't send terminal response, wich does this automatically.
+    Start();
+
+    // Inform the system that we are finished executing. If there is 
+    // proactive SendSm command pending, it is notified and it continues
+    // from here.
+    iUtils->NotifyEvent( MSatUtils::ECallControlDone );
+
+    // If we launched UI, close it.
+    if ( !iUtils->SatUiHandler().UiLaunchedByUser() )
+        {
+        iUtils->NotifyEvent( MSatUtils::ESimSessionEndCallBack );
+        }
+    else
+        {
+        // Inform the session that we are done here.
+        iUtils->NotifyEvent( MSatUtils::EDelaySimSessionEnd );
+        }
+        
+    // We do not send TerminalResponse to SIM.
+    LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::CompleteCallControlCmd\
+          exiting" )
+    }
+    
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/CallControlCmd/src/ccallcontrolrequesthandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,224 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Handles CallControl request that need SAT perform
+*
+*/
+
+
+#include <etelmm.h>
+
+#include "ccallcontrolrequesthandler.h"
+#include "CCallControlHandler.h"
+#include "SatLog.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCallControlRequestHandler::CCallControlRequestHandler
+// The class constructor.
+// -----------------------------------------------------------------------------
+//
+CCallControlRequestHandler::CCallControlRequestHandler(
+                MSatMultiModeApi& aPhone, CCallControlHandler* aDispatcher )
+    : CActive( EPriorityStandard ), iPhone( aPhone ), 
+      iDispatcher( aDispatcher )
+    {
+    LOG( SIMPLE,
+        "CALLCONTROL: CCallControlRequestHandler::CCallControlRequestHandler \
+        calling" )
+
+    CActiveScheduler::Add( this );
+
+    LOG( SIMPLE,
+        "CALLCONTROL: CCallControlRequestHandler::CCallControlRequestHandler \
+        exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CCallControlRequestHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCallControlRequestHandler* CCallControlRequestHandler::NewL(
+    MSatMultiModeApi& aPhone, CCallControlHandler* aDispatcher )
+    {
+    LOG( SIMPLE, "CALLCONTROL: CCallControlRequestHandler::NewL calling" )
+
+    CCallControlRequestHandler* self =
+        new ( ELeave ) CCallControlRequestHandler( aPhone, aDispatcher );
+            
+    LOG( SIMPLE, "CALLCONTROL: CCallControlRequestHandler::NewL exiting" )
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCallControlRequestHandler::~CCallControlRequestHandler
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CCallControlRequestHandler::~CCallControlRequestHandler()
+    {
+    LOG( SIMPLE, "CALLCONTROL: \
+            CCallControlRequestHandler::~CCallControlRequestHandler calling" )
+
+    Cancel();
+    iDispatcher = NULL;
+
+    LOG( SIMPLE, "CALLCONTROL: \
+            CCallControlRequestHandler::~CCallControlRequestHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CCallControlRequestHandler::DialNumber
+// -----------------------------------------------------------------------------
+//
+void CCallControlRequestHandler::DialNumber( const TDesC8& aCallParams,
+                                             const TDesC& aTelNumber )
+    {
+    LOG( SIMPLE, "CALLCONTROL: CCallControlRequestHandler::DialNumber calling" )
+
+    if ( !IsActive() )
+        {
+        iPhone.DialNoFdnCheck( iStatus, aCallParams, aTelNumber );
+        SetActive();
+        }
+    else
+        {
+        iDispatcher->DispatchCcRequestComplete( KErrInUse );
+        }
+
+    LOG( SIMPLE, "CALLCONTROL: CCallControlRequestHandler::DialNumber exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CCallControlRequestHandler::SendSs
+// -----------------------------------------------------------------------------
+//
+void CCallControlRequestHandler::SendSs( const TDesC& aServiceString )
+    {
+    LOG( SIMPLE, "CALLCONTROL: CCallControlRequestHandler::SendSs calling" )
+
+    if ( !IsActive() )
+        {        
+        iPhone.SendNetworkServiceRequestNoFdnCheck( iStatus, aServiceString );
+        SetActive();
+        }
+    else
+        {
+        iDispatcher->DispatchCcRequestComplete( KErrInUse );
+        }
+
+    LOG( SIMPLE, "CALLCONTROL: CCallControlRequestHandler::SendSs exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CCallControlRequestHandler::SendUssd
+// -----------------------------------------------------------------------------
+//
+void CCallControlRequestHandler::SendUssd( const TDesC8& aMsgData,
+		const TDesC8& aMsgAttributes )
+    {
+    LOG( SIMPLE, "CALLCONTROL: CCallControlRequestHandler::SendUssd calling" )
+
+    if ( !IsActive() )
+        {
+        iPhone.SendMessageNoFdnCheck( iStatus, aMsgData, aMsgAttributes );
+        SetActive();
+        }
+    else
+        {
+        iDispatcher->DispatchCcRequestComplete( KErrInUse );
+        }
+
+    LOG( SIMPLE, "CALLCONTROL: CCallControlRequestHandler::SendUssd exiting" )
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCallControlRequestHandler::RunL
+// Handles the command.
+// -----------------------------------------------------------------------------
+//
+void CCallControlRequestHandler::RunL()
+    {
+    LOG( SIMPLE, "CALLCONTROL: CCallControlRequestHandler::RunL calling" )
+    
+    if ( iStatus == KErrNone )
+        {
+        LOG( NORMAL, "CALLCONTROL: CCallControlRequestHandler::RunL\
+             iStatus == KErrNone" )
+        iDispatcher->DispatchCcRequestComplete( iCcStatus );
+        }
+    else
+        {
+        LOG2( NORMAL, "CALLCONTROL: CCallControlRequestHandler::RunL\
+              iStatus == %i", iStatus.Int() )
+        iDispatcher->DispatchCcRequestComplete( KErrGeneral );
+        }
+    
+    LOG( SIMPLE, "CALLCONTROL: CCallControlRequestHandler::RunL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CCallControlRequestHandler::CancelOperation
+// -----------------------------------------------------------------------------
+//
+void CCallControlRequestHandler::CancelOperation( TInt aOperationType )
+    {
+    LOG( SIMPLE, "CALLCONTROL: \
+                  CCallControlRequestHandler::CancelOperation calling" )
+
+    LOG2( NORMAL, "CALLCONTROL: \
+        CCallControlRequestHandler::CancelOperation callingOperation Type %d",
+        aOperationType )
+
+    switch( aOperationType )
+        {
+        case CCallControlHandler::ECcDialWaiting:
+            {
+            iPhone.DialCancel();
+            break;
+            }
+        case CCallControlHandler::ECcSendSsWaiting:
+            {
+            iPhone.CancelAsyncRequest( 
+                EMobilePhoneSendNetworkServiceRequestNoFdnCheck );
+            break;
+            }
+        case CCallControlHandler::ECcSendUssdWaiting:
+            {
+            iPhone.CancelAsyncRequest( 
+                EMobileUssdMessagingSendMessageNoFdnCheck );
+            break;
+            }
+        }
+    LOG( SIMPLE, 
+        "CALLCONTROL: CCallControlRequestHandler::CancelOperation exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CActive.
+// Cancels the sat request.
+// -----------------------------------------------------------------------------
+//
+void CCallControlRequestHandler::DoCancel()
+    {
+    LOG( SIMPLE, "CALLCONTROL: CCallControlRequestHandler::DoCancel calling" )
+
+    LOG( SIMPLE, "CALLCONTROL: CCallControlRequestHandler::DoCancel exiting" )
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/CallControlCmd/src/std.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 functions
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    <implementationproxy.h>
+#include    "CCallControlHandler.h"
+
+// CONSTANTS
+
+const TImplementationProxy implementationTable[] =
+    {
+    //lint -e{611,1924} Warning "Suspicious cast" can not be avoided.
+    IMPLEMENTATION_PROXY_ENTRY( 0x1020298C, CCallControlHandler::NewL )
+    };
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy ECOM framework factory function
+// Calculates the number of implementations.
+// Returns: Implementation proxy.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount ) // Number of implementations
+    {
+    aTableCount =
+        sizeof( implementationTable ) /
+        sizeof( TImplementationProxy );
+    return implementationTable;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/CloseChannelCmd/group/CloseChannelCmd.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* 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:  Project definition file for project CloseChannel plug-in
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../../inc/SatMacroes.h"
+
+TARGET                  CloseChannelCmd.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D 0x102078DB
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  std.cpp
+SOURCE                  CCloseChannelHandler.cpp
+
+START RESOURCE          102078DB.rss
+TARGET                  CloseChannelCmd.rsc
+END
+
+USERINCLUDE             ../../../inc
+USERINCLUDE             ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+SYSTEMINCLUDE           ../../../../../inc      // Domain telephony
+SYSTEMINCLUDE           ../../../../inc         // Subsystem satengine
+
+LIBRARY                 euser.lib
+LIBRARY                 etelsat.lib
+LIBRARY                 SatEngine.lib
+
+#ifdef ENABLE_SAT_LOGGING
+LIBRARY                 flogger.lib
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/CloseChannelCmd/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CloseChannel plug-in
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+CloseChannelCmd.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/CloseChannelCmd/inc/CCloseChannelHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,180 @@
+/*
+* 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:  CloseChannel command handler
+*
+*/
+
+
+
+#ifndef CCLOSECHANNELHANDLER_H
+#define CCLOSECHANNELHANDLER_H
+
+#include <etelsat.h>
+
+#include "CSatCommandHandler.h"
+#include "SatSTypes.h"
+
+class MSatUtils;
+
+// CLASS DECLARATION
+
+/**
+*  Command handler for CloseChannel command.
+*
+*  @lib CloseChannelCmd.lib
+*  @since Series 60 v3.0
+*/
+class CCloseChannelHandler : public CSatCommandHandler
+    {
+
+public:
+
+    static CCloseChannelHandler* NewL( MSatUtils* aUtils );
+
+    virtual ~CCloseChannelHandler();
+
+// from base class MSatCommand
+
+    /**
+     * From MSatCommand.
+     * Response from the client
+     *
+     */
+    void ClientResponse();
+
+protected:
+    
+// from base class CActive
+
+    /**
+     * From CActive.
+     * Cancels the usat request.
+     *
+     */
+    void DoCancel();
+    
+// from base class CSatCommandHandler
+
+    /**
+     * From CSatCommandHandler.
+     * Requests the command notification.
+     *
+     * @param aStatus Request status to active object notification
+     */
+    void IssueUSATRequest( TRequestStatus& aStatus );
+
+    /**
+     * From CSatCommandHandler.
+     * Precheck before executing the command.
+     *
+     * @return TBool indicating is this command allowed to execute.
+     */
+    TBool CommandAllowed();
+
+    /**
+     * From CSatCommandHandler.
+     * Need for ui session.
+     *
+     * @return TBool indicating does this command need UI session.
+     */
+    TBool NeedUiSession();
+
+    /**
+     * From CSatCommandHandler.
+     * Called when USAT API notifies that command.
+     *
+     */
+    void HandleCommand();
+
+    /**
+     * From CSatCommandHandler.
+     * Indicates the failure of launching ui client.
+     *
+     */
+    void UiLaunchFailed();
+
+private:
+
+    CCloseChannelHandler();
+
+    /**
+     * Sends notification to UI.
+     *
+     * @return KErrNone if notification is sent successfully
+     */
+    TInt SendUiNotification();
+
+private: // data
+
+    /**
+     * CloseChannel command data
+     */
+    RSat::TCloseChannelV2 iCloseChannelData;
+
+    /**
+     * CloseChannel command package
+     */
+    RSat::TCloseChannelV2Pckg iCloseChannelPckg;
+
+    /**
+     * CloseChannel response data
+     */
+    RSat::TCloseChannelRspV2 iCloseChannelRspData;
+
+    /**
+     * CloseChannel response package
+     */
+    RSat::TCloseChannelRspV2Pckg iCloseChannelRspPckg;
+
+    /**
+     * Data to UI
+     */
+    TSatNotificationV1 iCloseChannelUiData;
+
+    /**
+     * IPC Package to ui data
+     */
+    TSatNotificationV1Pckg iCloseChannelUiPckg;
+
+    /**
+     * UI Response
+     */
+    TSatNotificationRspV1 iCloseChannelUiRsp;
+
+    /**
+     * IPC Package to response
+     */
+    TSatNotificationRspV1Pckg iCloseChannelUiRspPckg;
+
+    /**
+     * Flag to signal client response that handle command is not done
+     */
+    TBool iWaitHandleCloseCommand;
+
+    /**
+     * Flag to signal that icon response is needed before terminal
+     * response is done
+     */
+    TBool iWaitClientIconResponse;
+        
+    /**
+     * Flag to signal that command has icon data
+     * To be removed when icons are allowed in this command
+     */
+    TBool iIconCommand;
+
+    };
+
+#endif      // CCLOSECHANNELHANDLER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/CloseChannelCmd/inc/CloseChannelCmd.rls	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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 headers for project CloseChannelCmd
+*
+*/
+
+
+#ifndef CLOSECHANNELCMD_RLS
+#define CLOSECHANNELCMD_RLS
+
+rls_string STRING_r_closechannelcmd_display_name "CloseChannel command"
+rls_string STRING_r_closechannelcmd_default_data "CloseChannelCmd"
+rls_string STRING_r_closechannelcmd_opaque_data  ""
+
+#endif // CLOSECHANNELCMD_RLS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/CloseChannelCmd/src/102078DB.rss	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 1020 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Registry information for ECOM
+*
+*/
+
+
+
+//  INCLUDES
+#include <registryinfo.rh>
+#include "CloseChannelCmd.rls"
+
+//  RESOURCE DEFINITIONS
+// -----------------------------------------------------------------------------
+//
+// CloseChannelCmdInfo
+// Registeration information for ECOM
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO CloseChannelCmdInfo
+    {
+    dll_uid = 0x102078DB;
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x1000f001;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x102078DC;
+                    version_no   = 1;
+                    display_name = STRING_r_closechannelcmd_display_name;
+                    default_data = STRING_r_closechannelcmd_default_data;
+                    opaque_data  = STRING_r_closechannelcmd_opaque_data;
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/CloseChannelCmd/src/CCloseChannelHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,491 @@
+/*
+* 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:  Handles CloseChannel command
+*
+*/
+
+
+#include    "MSatApi.h"
+#include    "MSatUtils.h"
+#include    "MSatBIPUtils.h"
+#include    "MSatUiSession.h"
+#include    "SatSOpcodes.h"
+#include    "MSatSUiClientHandler.h"
+#include    "CCloseChannelHandler.h"
+#include    "SatLog.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCloseChannelHandler* CCloseChannelHandler::NewL( MSatUtils* aUtils )
+    {
+    LOG( NORMAL, "CLOSECHANNEL: CCloseChannelHandler::NewL calling" )
+
+    CCloseChannelHandler* self = new( ELeave ) CCloseChannelHandler;
+
+    CleanupStack::PushL( self );
+    self->BaseConstructL( aUtils );
+    // ConstructL not needed.
+    CleanupStack::Pop( self );
+
+    LOG( NORMAL, "CLOSECHANNEL: CCloseChannelHandler::NewL exiting" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CCloseChannelHandler::~CCloseChannelHandler()
+    {
+    LOG( NORMAL,
+        "CLOSECHANNEL: CCloseChannelHandler::~CCloseChannelHandler calling" )
+
+    Cancel();
+
+    LOG( NORMAL,
+        "CLOSECHANNEL: CCloseChannelHandler::~CCloseChannelHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class MSatCommand.
+// Response from client
+// -----------------------------------------------------------------------------
+//
+void CCloseChannelHandler::ClientResponse()
+    {
+    LOG( NORMAL,
+        "CLOSECHANNEL: CCloseChannelHandler::ClientResponse calling" )
+
+    // Send terminal response if closing channel doesn't have to be waited and
+    // it was necessary to wait UI response due to icon response
+    if ( !iWaitHandleCloseCommand && iWaitClientIconResponse )
+        {
+        // requested icon not shown
+        if ( !iCloseChannelUiRsp.iRequestedIconDisplayed )
+            {
+            LOG( NORMAL, "CCloseChannelHandler::ClientResponse requested icon\
+                 not shown" )
+            // Icons are not yet supported
+            iCloseChannelRspData.iGeneralResult =
+                RSat::KSuccessRequestedIconNotDisplayed;
+            }
+        else
+            {
+            LOG( NORMAL, "CCloseChannelHandler::ClientResponse success" )
+            iCloseChannelRspData.iGeneralResult = RSat::KSuccess;
+            }
+
+        iCloseChannelRspData.iInfoType = RSat::KNoAdditionalInfo;
+        iCloseChannelRspData.iAdditionalInfo.Zero();
+        TerminalRsp( RSat::ECloseChannel, iCloseChannelRspPckg );
+        }
+
+    iWaitClientIconResponse = EFalse;
+    LOG( NORMAL,
+        "CLOSECHANNEL: CCloseChannelHandler::ClientResponse calling" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CActive.
+// Cancels the sat request.
+// -----------------------------------------------------------------------------
+//
+void CCloseChannelHandler::DoCancel()
+    {
+    LOG( NORMAL, "CLOSECHANNEL: CCloseChannelHandler::DoCancel calling" )
+
+    iUtils->USatAPI().NotifyCloseChannelCancel();
+
+    LOG( NORMAL, "CLOSECHANNEL: CCloseChannelHandler::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Requests the command notification.
+// -----------------------------------------------------------------------------
+//
+void CCloseChannelHandler::IssueUSATRequest( TRequestStatus& aStatus )
+    {
+    LOG( NORMAL,
+        "CLOSECHANNEL: CCloseChannelHandler::IssueUSATRequest calling" )
+
+    // Reset command data.
+    new (&iCloseChannelData) RSat::TCloseChannelV2();
+
+    iUtils->USatAPI().NotifyCloseChannel( aStatus, iCloseChannelPckg );
+
+    LOG( NORMAL,
+        "CLOSECHANNEL: CCloseChannelHandler::IssueUSATRequest exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Precheck before executing the command.
+// -----------------------------------------------------------------------------
+//
+TBool CCloseChannelHandler::CommandAllowed()
+    {
+    LOG( NORMAL, "CLOSECHANNEL: CCloseChannelHandler::CommandAllowed calling" )
+    TBool commandAllowed( ETrue );
+    
+    LOG2( NORMAL, 
+    "CLOSECHANNEL: CCloseChannelHandler::CommandAllowed \
+    iCloseChannelData.iAlphaId.iStatus: %d",
+    iCloseChannelData.iAlphaId.iStatus )
+    
+    LOG2( NORMAL, 
+    "CLOSECHANNEL: CCloseChannelHandler::CommandAllowed \
+    iCloseChannelData.iIconId.iQualifier: %d",
+    iCloseChannelData.iIconId.iQualifier )
+    
+    // If icon data without alpha id
+    if ( ( RSat::EAlphaIdProvided != iCloseChannelData.iAlphaId.iStatus ) &&
+        ( ( RSat::ESelfExplanatory ==
+            iCloseChannelData.iIconId.iQualifier ) ||
+        ( RSat::ENotSelfExplanatory ==
+            iCloseChannelData.iIconId.iQualifier ) ) )
+        {
+        commandAllowed = EFalse;
+        iCloseChannelRspData.iGeneralResult = RSat::KCmdDataNotUnderstood;
+        iCloseChannelRspData.iInfoType = RSat::KNoAdditionalInfo;
+        iCloseChannelRspData.iAdditionalInfo.Zero();
+        iCloseChannelRspData.SetPCmdNumber( iCloseChannelData.PCmdNumber() );
+        TerminalRsp( RSat::ECloseChannel, iCloseChannelRspPckg );
+        LOG( SIMPLE,
+            "CLOSECHANNEL: CCloseChannelHandler::CommandAllowed \
+            data not understood" )
+        }
+    // Set icon command flag whether icon data was received and set qualifier
+    // to no icon id
+    // To be removed when icons are allowed in this command
+    else if ( ( RSat::ESelfExplanatory ==
+        iCloseChannelData.iIconId.iQualifier ) ||
+        ( RSat::ENotSelfExplanatory ==
+        iCloseChannelData.iIconId.iQualifier ) )
+        {
+        LOG( NORMAL, "CCloseChannelHandler::CommandAllowed set no icon id" )
+        iIconCommand = ETrue;
+        iCloseChannelData.iIconId.iQualifier = RSat::ENoIconId;
+        }
+    else
+        {
+        LOG( NORMAL, "CCloseChannelHandler::CommandAllowed others" )
+        iIconCommand = EFalse;
+        }
+    
+    LOG2( NORMAL, "CLOSECHANNEL: CCloseChannelHandler::CommandAllowed \
+          exiting,commandAllowed: %d", commandAllowed )
+    return commandAllowed;
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Need for ui session.
+// -----------------------------------------------------------------------------
+//
+TBool CCloseChannelHandler::NeedUiSession()
+    {
+    LOG( NORMAL, "CLOSECHANNEL: CCloseChannelHandler::NeedUiSession calling" )
+
+    // UI is NOT needed in case where AlphaID is provided and it is a NULL
+    const TBool retVal( !( RSat::EAlphaIdNull ==
+                           iCloseChannelData.iAlphaId.iStatus ) );
+    LOG( NORMAL, "CLOSECHANNEL: CCloseChannelHandler::NeedUiSession calling" )
+
+    // Send notification to Mediator client if Cover UI is supported
+    if ( retVal && iUtils->CoverUiSupported() )
+        {
+        LOG( NORMAL, "CCloseChannelHandler::NeedUiSession CoverUiSupported" )
+        TSatCommandData medEventData;
+        medEventData.iPCmdNumber = RSat::ECloseChannel;
+        medEventData.iAlphaId = iCloseChannelData.iAlphaId;
+        medEventData.iDuration.iNumOfUnits = KSatDefaultDuration;
+        medEventData.iIconID = iCloseChannelData.iIconId;
+        TSatCommandPckg tPckg( medEventData );
+        iUtils->RaiseSatEvent( tPckg );
+        }
+
+    LOG2( NORMAL, 
+    "CLOSECHANNEL: CCloseChannelHandler::NeedUiSession exiting,retVal: %d",
+    retVal )
+    return retVal;
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Called when USAT API notifies that command.
+// -----------------------------------------------------------------------------
+//
+void CCloseChannelHandler::HandleCommand()
+    {
+    LOG( NORMAL, "CLOSECHANNEL: CCloseChannelHandler::HandleCommand calling" )
+
+    // Notify other's about this command execution.
+    iUtils->NotifyEvent( MSatUtils::ECloseChannelExecuting );
+
+    TInt uiError( KErrNone );
+
+    // Reset flags
+    iWaitHandleCloseCommand = EFalse;
+    iWaitClientIconResponse = EFalse;
+
+    // If information indication to the user is needed, show it now.
+    if ( !( RSat::EAlphaIdNull == iCloseChannelData.iAlphaId.iStatus ) )
+        {
+        LOG( NORMAL, "CLOSECHANNEL: CCloseChannelHandler::HandleCommand \
+            Sending UI Notification" )
+        iWaitHandleCloseCommand = ETrue;
+        uiError = SendUiNotification();
+        }
+    LOG2( NORMAL, "CCloseChannelHandler::HandleCommand uiError: %i", 
+          uiError )
+    // Check UI error status
+    if ( KErrNone == uiError )
+        {
+        // Proceed with the command
+        const TInt channelId( iCloseChannelData.iDestination );
+        LOG2( NORMAL, 
+        "CLOSECHANNEL: CCloseChannelHandler::HandleCommand channelId: %d",
+        channelId )
+        if ( RSat::KChannel1 > channelId || RSat::KChannel7 < channelId )
+            {
+            // Create the response IPC package
+            iCloseChannelRspData.SetPCmdNumber(
+                                 iCloseChannelData.PCmdNumber() );
+            iCloseChannelRspData.iGeneralResult = RSat::KCmdDataNotUnderstood;
+            iCloseChannelRspData.iInfoType = RSat::KNoAdditionalInfo;
+            iCloseChannelRspData.iAdditionalInfo.Zero();
+            iWaitClientIconResponse = EFalse;
+            }
+        else
+            {
+            // Close the channel
+            const TInt err( iUtils->BipUtils().CloseChannel( channelId ) );
+            // Create the response IPC package
+            iCloseChannelRspData.SetPCmdNumber(
+                                 iCloseChannelData.PCmdNumber() );
+
+            // Check were the channel close-up success.
+            if ( MSatBIPUtils::ESatBIPSuccess != err )
+                {
+                LOG2( NORMAL,
+                    "CLOSECHANNEL: CCloseChannel::HandleCommand Error %i", err )
+                iCloseChannelRspData.iGeneralResult =
+                    RSat::KBearerIndepProtocolError;
+                iCloseChannelRspData.iInfoType = RSat::KMeProblem;
+                iCloseChannelRspData.iAdditionalInfo.SetLength( 1 );
+                iCloseChannelRspData.iAdditionalInfo[0] =
+                    static_cast<TUint8> ( err );
+                iWaitClientIconResponse = EFalse;
+                }
+            else
+                {
+                LOG( NORMAL,
+                    "CLOSECHANNEL: CCloseChannel::HandleCommand success")
+                LOG2( NORMAL,
+                "CLOSECHANNEL: CCloseChannel::HandleCommand \
+                iCloseChannelUiRsp.iRequestedIconDisplayed: %i", 
+                iCloseChannelUiRsp.iRequestedIconDisplayed )
+                
+                LOG2( NORMAL,
+                "CLOSECHANNEL: CCloseChannel::HandleCommand \
+                iCloseChannelData.iIconId.iQualifier: %i", 
+                iCloseChannelData.iIconId.iQualifier )
+                // requested icon not shown
+                if ( !iCloseChannelUiRsp.iRequestedIconDisplayed &&
+                    ( ( RSat::ENotSelfExplanatory ==
+                        iCloseChannelData.iIconId.iQualifier ) ||
+                    ( RSat::ESelfExplanatory ==
+                        iCloseChannelData.iIconId.iQualifier ) ) )
+                    {
+                    // Icons could not be shown
+                    iCloseChannelRspData.iGeneralResult =
+                        RSat::KSuccessRequestedIconNotDisplayed;
+                    }
+                else
+                    {
+                    iCloseChannelRspData.iGeneralResult = RSat::KSuccess;
+                    }
+
+                // No additional info for CloseChannel
+                iCloseChannelRspData.iInfoType = RSat::KNoAdditionalInfo;
+                iCloseChannelRspData.iAdditionalInfo.Zero();
+                }
+            }
+
+        iWaitHandleCloseCommand = EFalse;
+        
+        // If command had icon data and was done succesfully, report that icon
+        // was not shown
+        // To be removed when icons are allowed in this command
+        if ( ( RSat::KSuccess == iCloseChannelRspData.iGeneralResult ) &&
+            iIconCommand )
+            {
+            LOG( NORMAL, "CLOSECHANNEL: CCloseChannelHandler::\
+                         HandleCommand requested icon not shown" )
+            iCloseChannelRspData.iGeneralResult =
+                RSat::KSuccessRequestedIconNotDisplayed;
+            }
+        
+        // Send terminal response if UI response doesn't have to be waited
+        if ( !iWaitClientIconResponse )
+            {
+            LOG( NORMAL, "CLOSECHANNEL: CCloseChannelHandler::\
+                         HandleCommand send terminal response" )
+            TerminalRsp( RSat::ECloseChannel, iCloseChannelRspPckg );
+            }
+        }
+
+    LOG( NORMAL, "CLOSECHANNEL: CCloseChannelHandler::HandleCommand exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Indicates the failure of launching ui client.
+// -----------------------------------------------------------------------------
+//
+void CCloseChannelHandler::UiLaunchFailed()
+    {
+    LOG( NORMAL, "CLOSECHANNEL: CCloseChannelHandler::UiLaunchFailed calling" )
+
+    iCloseChannelRspData.iGeneralResult = RSat::KMeUnableToProcessCmd;
+    iCloseChannelRspData.iInfoType = RSat::KMeProblem;
+    iCloseChannelRspData.iAdditionalInfo.SetLength( 1 );
+    iCloseChannelRspData.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
+    iCloseChannelRspData.SetPCmdNumber( iCloseChannelData.PCmdNumber() );
+    TerminalRsp( RSat::ECloseChannel, iCloseChannelRspPckg );
+
+    LOG( NORMAL, "CLOSECHANNEL: CCloseChannelHandler::UiLaunchFailed exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+//lint -e{1403, 1769} Can not be initialized.
+CCloseChannelHandler::CCloseChannelHandler() :
+    CSatCommandHandler(),
+    iCloseChannelData(),
+    iCloseChannelPckg( iCloseChannelData ),
+    iCloseChannelRspData(),
+    iCloseChannelRspPckg( iCloseChannelRspData ),
+    iCloseChannelUiData(),
+    iCloseChannelUiPckg( iCloseChannelUiData ),
+    iCloseChannelUiRsp(),
+    iCloseChannelUiRspPckg( iCloseChannelUiRsp ),
+    iWaitHandleCloseCommand( EFalse ),
+    iWaitClientIconResponse( EFalse ),
+    // To be removed when icons are allowed in this command
+    iIconCommand( EFalse )
+    {
+    LOG( NORMAL, "CLOSECHANNEL: CCloseChannelHandler::CCloseChannelHandler \
+        calling - exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Sends notification to UI.
+// -----------------------------------------------------------------------------
+//
+TInt CCloseChannelHandler::SendUiNotification()
+    {
+    LOG( NORMAL,
+        "CloseChannel: CCloseChannelHandler::SendUiNotification calling" )
+
+    // Register to ui service request
+    TRAPD( uiError, iUtils->RegisterServiceRequestL(
+        ESatSProactiveNotification,
+        ESatSProactiveNotificationResponse,
+        this ) );
+     LOG2( NORMAL, "CCloseChannelHandler::SendUiNotification uiError: %i",
+           uiError )
+    if ( KErrNone != uiError )
+        {
+        // Send error terminal response
+        UiLaunchFailed();
+        }
+    else
+        {
+        // Create IPC data to UI
+        iCloseChannelUiData.iCommand = ESatSCloseChannelNotify;
+        iCloseChannelUiData.iText = iCloseChannelData.iAlphaId.iAlphaId;
+        iCloseChannelUiData.iIconId.iIdentifier
+             = iCloseChannelData.iIconId.iIdentifier;
+
+        // Define icon qualifier
+        if ( RSat::ENotSelfExplanatory ==
+            iCloseChannelData.iIconId.iQualifier )
+            {
+            LOG( NORMAL, "CloseChannel: CCloseChannelHandler::\
+                 SendUiNotification ENotSelfExplanatory" )
+            iCloseChannelUiData.iIconId.iIconQualifier =
+                ESatNotSelfExplanatory;
+            // Terminal response may be only when UI has resposed
+            iWaitClientIconResponse = ETrue;
+            }
+        else if ( RSat::ESelfExplanatory ==
+            iCloseChannelData.iIconId.iQualifier )
+            {
+            LOG( NORMAL, "CloseChannel: CCloseChannelHandler::\
+                 SendUiNotification ESelfExplanatory" )
+            iCloseChannelUiData.iIconId.iIconQualifier = ESatSelfExplanatory;
+            // Terminal response may be only when UI has resposed
+            iWaitClientIconResponse = ETrue;
+            }
+        else // Icon qualifier not present
+            {
+            LOG( NORMAL, "CloseChannel: CCloseChannelHandler::\
+                 SendUiNotification others" )
+            iCloseChannelUiData.iIconId.iIconQualifier = ESatENoIconId;
+            }
+        LOG2( NORMAL, "CCloseChannelHandler::SendUiNotification \
+              iCloseChannelData.iAlphaId.iStatus: %i",
+              iCloseChannelData.iAlphaId.iStatus )
+        // Define AlphaID status
+        switch ( iCloseChannelData.iAlphaId.iStatus )
+            {
+            case RSat::EAlphaIdNotPresent:
+                {
+                iCloseChannelUiData.iAlphaIdStatus = ESatAlphaIdNotProvided;
+                break;
+                }
+
+            case RSat::EAlphaIdProvided:
+                {
+                iCloseChannelUiData.iAlphaIdStatus = ESatAlphaIdNotNull;
+                break;
+                }
+
+            default:
+                {
+                iCloseChannelUiData.iAlphaIdStatus = ESatAlphaIdNull;
+                break;
+                }
+            }
+
+        // Send notification to UI
+        MSatUiSession* session = iUtils->SatUiHandler().UiSession();
+        session->SendCommand( &iCloseChannelUiPckg,
+                              &iCloseChannelUiRspPckg,
+                              ESatSProactiveNotification );
+        }
+
+    LOG( NORMAL,
+        "CloseChannel: CCloseChannelHandler::SendUiNotification exiting" )
+    return uiError;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/CloseChannelCmd/src/std.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 functions
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    <implementationproxy.h>
+#include    "CCloseChannelHandler.h"
+
+// CONSTANTS
+
+const TImplementationProxy implementationTable[] =
+    {
+    //lint -e{611,1924} Warning "Suspicious cast" can not be avoided.
+    IMPLEMENTATION_PROXY_ENTRY( 0x102078DC, CCloseChannelHandler::NewL )
+    };
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy ECOM framework factory function
+// Calculates the number of implementations.
+// Returns: Implementation proxy.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount ) // Number of implementations
+    {
+    aTableCount =
+        sizeof( implementationTable ) /
+        sizeof( TImplementationProxy );
+    return implementationTable;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/DisplayTextCmd/group/DisplayTextCmd.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* 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:  Project definition file for project DisplayText plug-in
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../../inc/SatMacroes.h"
+
+TARGET                  DisplayTextCmd.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D 0x10202989
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  std.cpp
+SOURCE                  CDisplayTextHandler.cpp
+SOURCE                  CClearScreenHandler.cpp
+
+START RESOURCE          10202989.rss
+TARGET                  DisplayTextCmd.rsc
+END
+
+USERINCLUDE             ../../../inc
+USERINCLUDE             ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+SYSTEMINCLUDE           ../../../../../inc      // Domain telephony
+SYSTEMINCLUDE           ../../../../inc         // Subsystem satengine
+
+LIBRARY                 euser.lib
+LIBRARY                 etelsat.lib
+LIBRARY                 SatEngine.lib
+
+#ifdef ENABLE_SAT_LOGGING
+LIBRARY                 flogger.lib
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/DisplayTextCmd/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 DisplayTextCmd plug-in
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+DisplayTextCmd.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/DisplayTextCmd/inc/CClearScreenHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ClearScreen handler is responsible for clearing screen when
+*                DisplayText has sent immediate response and it is still active
+*                when any other command starts to execute.
+*
+*/
+
+
+
+#ifndef CCLEARSCREENHANDLER_H
+#define CCLEARSCREENHANDLER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "MSatEventObserver.h"
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class MSatUtils;
+
+// CLASS DECLARATION
+
+/**
+*  CClearScreenHandler for ClearScreen event
+*
+*  @lib DisplayTextCmd.lib
+*  @since Series 60 3.0
+*/
+class CClearScreenHandler : public CBase,
+                            public MSatEventObserver
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aUtils SAT Utils interface
+        */
+        static CClearScreenHandler* NewL( MSatUtils& aUtils );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CClearScreenHandler();
+
+    public: // New functions
+
+        /**
+        * Updates immediate response state to ETrue or EFalse
+        * @param aState new state
+        */
+        void UpdateImmediateState( TBool aState );
+
+    public: // From MSatEventObserver
+
+        /**
+        * Notification of event.
+        * @param aEvent Identifies the event.
+        */
+        void Event( TInt aEvent );
+
+    private:
+
+        /**
+        * C++ default constructor.
+        * @param aUtils SAT Utils interface
+        */
+        CClearScreenHandler( MSatUtils& aUtils );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Sends the request for clear screen.
+        */
+        void ClearScreen();
+
+    private:    // Data
+
+        // Holds immediate response's status.
+        TBool iImmediateResponse;
+
+        // Utils interface
+        MSatUtils& iUtils;
+
+    };
+
+#endif      // CCLEARSCREENHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/DisplayTextCmd/inc/CDisplayTextHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,149 @@
+/*
+* 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:  DisplayText command handler
+*
+*/
+
+
+
+#ifndef CDISPLAYTEXTHANDLER_H
+#define CDISPLAYTEXTHANDLER_H
+
+//  INCLUDES
+#include <etelsat.h>
+#include "CSatCommandHandler.h"
+#include "SatSTypes.h"
+
+// FORWARD DECLARATION
+class MSatUtils;
+class CClearScreenHandler;
+
+// CLASS DECLARATION
+
+/**
+*  Command handler for DisplayText command.
+*
+*  @lib DisplayTextCmd.lib
+*  @since Series 60 3.0
+*/
+class CDisplayTextHandler : public CSatCommandHandler
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aUtils SAT Utils interface
+        */
+        static CDisplayTextHandler* NewL( MSatUtils* aUtils );
+
+
+        /**
+        * Destructor.
+        */
+        virtual ~CDisplayTextHandler();
+
+    public: // Functions from base classes
+
+        /**
+        * From MSatCommand.
+        */
+        void ClientResponse();
+
+    protected:  // Functions from base classes
+
+        /**
+        * From CActive Cancels the usat request.
+        */
+        void DoCancel();
+
+        /**
+        * From CSatCommandHandler Requests the command notification.
+        * @param aStatus Request status
+        */
+        void IssueUSATRequest( TRequestStatus& aStatus );
+
+        /**
+        * From CSatCommandHandler Precheck before executing the command.
+        */
+        TBool CommandAllowed();
+
+        /**
+        * From CSatCommandHandler Need for ui session.
+        */
+        TBool NeedUiSession();
+
+        /**
+        * From CSatCommandHandler Called when USAT API notifies that command.
+        */
+        void HandleCommand();
+
+        /**
+        * From CSatCommandHandler. Indicates the failure of launching ui client
+        */
+        void UiLaunchFailed();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CDisplayTextHandler();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Return given duration in seconds.
+        * @param aDuration Duration data
+        * @return Return given duration in seconds.
+        */
+        TTimeIntervalSeconds DurationInSeconds(
+            const RSat::TDuration& aDuration ) const;
+
+    private:    // Data
+
+        // DisplayText command data.
+        RSat::TDisplayTextV2 iDisplayTextData;
+
+        // DisplayText command package.
+        RSat::TDisplayTextV2Pckg iDisplayTextPckg;
+
+        // Response from client.
+        RSat::TDisplayTextRspV1 iDisplayTextRsp;
+
+        // Response package.
+        RSat::TDisplayTextRspV1Pckg iDisplayTextRspPckg;
+
+        // DisplayText IPC data.
+        TSatDisplayTextV1 iDisplayTextSendData;
+
+        // DisplayText IPC package.
+        TSatDisplayTextV1Pckg iDisplayTextSendPckg;
+
+        // ClearScreen handler.
+        CClearScreenHandler* iClearScreenHandler;
+
+        // Own information of Immediate response
+        TBool iImmediateResponse;
+
+        // Next immediate pending
+        TBool iImmediatePending;
+
+    };
+
+#endif      // CDISPLAYTEXTHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/DisplayTextCmd/inc/DisplayTextCmd.rls	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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 headers for project DisplayTextCmd
+*
+*/
+
+
+#ifndef DISPLAYTEXTCMD_RLS
+#define DISPLAYTEXTCMD_RLS
+
+rls_string STRING_r_displaytextcmd_display_name "DisplayText command"
+rls_string STRING_r_displaytextcmd_default_data "DisplayTextCmd"
+rls_string STRING_r_displaytextcmd_opaque_data  ""
+
+#endif // DISPLAYTEXTCMD_RLS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/DisplayTextCmd/src/10202989.rss	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 1020 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Registry information for ECOM
+*
+*/
+
+
+
+//  INCLUDES
+#include <registryinfo.rh>
+#include "DisplayTextCmd.rls"
+
+//  RESOURCE DEFINITIONS
+// -----------------------------------------------------------------------------
+//
+// DisplayTextCmdInfo
+// Registeration information for ECOM
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO DisplayTextCmdInfo
+    {
+    dll_uid = 0x10202989;
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x1000f001;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x1020298A;
+                    version_no   = 1;
+                    display_name = STRING_r_displaytextcmd_display_name;
+                    default_data = STRING_r_displaytextcmd_default_data;
+                    opaque_data  = STRING_r_displaytextcmd_opaque_data;
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/DisplayTextCmd/src/CClearScreenHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,198 @@
+/*
+* 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:  ClearScreen handler is responsible for clearing screen when
+*                DisplayText has sent immediate response and it is still active
+*                when any other command starts to execute.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "MSatUtils.h"
+#include    "SatSTypes.h"
+#include    "CClearScreenHandler.h"
+#include    "SatLog.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CClearScreenHandler::CClearScreenHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CClearScreenHandler::CClearScreenHandler( MSatUtils& aUtils ) :
+    iUtils( aUtils )
+    {
+    LOG( SIMPLE, "DISPLAYTEXT: \
+        CClearScreenHandler::CClearScreenHandler calling - exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CClearScreenHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CClearScreenHandler::ConstructL()
+    {
+    LOG( SIMPLE, "DISPLAYTEXT: CClearScreenHandler::ConstructL calling" )
+
+    // Set immediate response to false.
+    iImmediateResponse = EFalse;
+
+    // List all events we should listen.
+    iUtils.RegisterL( this, MSatUtils::ESetUpMenuExecuting );
+    iUtils.RegisterL( this, MSatUtils::ESelectItemExecuting );
+    iUtils.RegisterL( this, MSatUtils::ESetUpCallExecuting );
+    iUtils.RegisterL( this, MSatUtils::EDisplayTextExecuting );
+    iUtils.RegisterL( this, MSatUtils::ELaunchBrowserExecuting );
+    iUtils.RegisterL( this, MSatUtils::EGetInputExecuting );
+    iUtils.RegisterL( this, MSatUtils::EGetInkeyExecuting );
+    iUtils.RegisterL( this, MSatUtils::ESendDtmfExecuting );
+    iUtils.RegisterL( this, MSatUtils::ESendSsExecuting );
+    iUtils.RegisterL( this, MSatUtils::ESendUssdExecuting );
+    iUtils.RegisterL( this, MSatUtils::EPlayToneExecuting );
+    iUtils.RegisterL( this, MSatUtils::ERefreshExecuting );
+    iUtils.RegisterL( this, MSatUtils::ECallControlExecuting );
+    iUtils.RegisterL( this, MSatUtils::ESendSmExecuting );
+    iUtils.RegisterL( this, MSatUtils::EMoSmControlExecuting );
+
+    LOG( SIMPLE, "DISPLAYTEXT: CClearScreenHandler::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CClearScreenHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CClearScreenHandler* CClearScreenHandler::NewL( MSatUtils& aUtils )
+    {
+    LOG( SIMPLE, "DISPLAYTEXT: CClearScreenHandler::NewL calling" )
+
+    CClearScreenHandler* self =
+        new ( ELeave ) CClearScreenHandler( aUtils );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "DISPLAYTEXT: CClearScreenHandler::NewL exiting" )
+    return self;
+    }
+
+
+// Destructor
+CClearScreenHandler::~CClearScreenHandler()
+    {
+    LOG( SIMPLE,
+        "DISPLAYTEXT: CClearScreenHandler::~CClearScreenHandler calling" )
+
+    // Unregister this as an event observer
+    iUtils.UnregisterEventObserver( this );
+
+    LOG( SIMPLE,
+        "DISPLAYTEXT: CClearScreenHandler::~CClearScreenHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CClearScreenHandler::UpdateImmediateState
+// Updates immediate response state.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CClearScreenHandler::UpdateImmediateState( TBool aState )
+    {
+    LOG( SIMPLE,
+        "DISPLAYTEXT: CClearScreenHandler::UpdateImmediateState calling" )
+
+    iImmediateResponse = aState;
+
+    LOG( SIMPLE,
+        "DISPLAYTEXT: CClearScreenHandler::UpdateImmediateState exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CClearScreenHandler::Event
+// Notification of an event.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CClearScreenHandler::Event( TInt aEvent )
+    {
+    LOG2( SIMPLE, "DISPLAYTEXT: CClearScreenHandler::Event calling, \
+          aEvent: %d", aEvent )
+    LOG2( SIMPLE, "DISPLAYTEXT: CClearScreenHandler::Event, \
+          iImmediateResponse: %d", iImmediateResponse )
+    // We don't have to do anything if immediate response is not active.
+    if ( iImmediateResponse )
+        {
+        switch ( aEvent )
+            {
+            case MSatUtils::ESetUpMenuExecuting:
+            case MSatUtils::ESelectItemExecuting:
+            case MSatUtils::ESetUpCallExecuting:
+            case MSatUtils::EDisplayTextExecuting:
+            case MSatUtils::ELaunchBrowserExecuting:
+            case MSatUtils::EGetInputExecuting:
+            case MSatUtils::EGetInkeyExecuting:
+            case MSatUtils::ESendDtmfExecuting:
+            case MSatUtils::ESendSsExecuting:
+            case MSatUtils::ESendUssdExecuting:
+            case MSatUtils::EPlayToneExecuting:
+            case MSatUtils::ERefreshExecuting:
+            case MSatUtils::ECallControlExecuting:
+            case MSatUtils::ESendSmExecuting:
+            case MSatUtils::EMoSmControlExecuting:
+                {
+                ClearScreen();
+                break;
+                }
+
+            default:
+                {
+                // Do nothing.
+                break;
+                }
+            }
+        }
+
+    LOG( SIMPLE, "DISPLAYTEXT: CClearScreenHandler::Event exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CClearScreenHandler::ClearScreen
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CClearScreenHandler::ClearScreen()
+    {
+    LOG( SIMPLE, "DISPLAYTEXT: CClearScreenHandler::ClearScreen calling" )
+    LOG2( SIMPLE, "DISPLAYTEXT: CClearScreenHandler::ClearScreen, \
+          iImmediateResponse: %d", iImmediateResponse )
+    // Clear the screen if immediate response is active.
+    //lint -e{961} Else block meaningless
+    if ( iImmediateResponse )
+        {
+        iUtils.NotifyUiEvent(
+            ESatSClearScreenEvent, ESatEventNone, KErrNone );
+        iImmediateResponse = EFalse;
+
+        iUtils.NotifyEvent( MSatUtils::ESustainedTextRemoved );
+        }
+
+    LOG( SIMPLE, "DISPLAYTEXT: CClearScreenHandler::ClearScreen exiting" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/DisplayTextCmd/src/CDisplayTextHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,539 @@
+/*
+* 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:  Handles DisplayText command
+*
+*/
+
+
+#include    <MSatShellController.h>
+#include    "MSatApi.h"
+#include    "MSatUtils.h"
+#include    "MSatSystemState.h"
+#include    "MSatUiSession.h"
+#include    "SatSOpcodes.h"
+#include    "MSatSUiClientHandler.h"
+#include    "CDisplayTextHandler.h"
+#include    "CClearScreenHandler.h"
+#include    "SatLog.h"
+
+const TInt8 KSecondsInMinute = 60;
+const TInt8 KSecond = 10;
+const TUint8 KHalfSecond = 5;
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// CDisplayTextHandler::CDisplayTextHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CDisplayTextHandler::CDisplayTextHandler() :
+    CSatCommandHandler(),
+    iDisplayTextData(),
+    iDisplayTextPckg( iDisplayTextData ),
+    iDisplayTextRsp(),
+    iDisplayTextRspPckg( iDisplayTextRsp ),
+    iDisplayTextSendData(),
+    iDisplayTextSendPckg( iDisplayTextSendData )
+    {
+    LOG( SIMPLE, "DISPLAYTEXT: \
+        CDisplayTextHandler::CDisplayTextHandler calling - exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplayTextHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CDisplayTextHandler::ConstructL()
+    {
+    LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::ConstructL calling" )
+
+    // Register service request handler for DisplayText command
+    iUtils->RegisterServiceRequestL(
+        ESatSProactiveDisplayText,
+        ESatSProactiveDisplayTextResponse,
+        this );
+
+    iClearScreenHandler = CClearScreenHandler::NewL( *iUtils );
+
+    LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplayTextHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CDisplayTextHandler* CDisplayTextHandler::NewL( MSatUtils* aUtils )
+    {
+    LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::NewL calling" )
+
+    CDisplayTextHandler* self = new( ELeave ) CDisplayTextHandler;
+
+    CleanupStack::PushL( self );
+    self->BaseConstructL( aUtils );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::NewL exiting" )
+    return self;
+    }
+
+// Destructor
+CDisplayTextHandler::~CDisplayTextHandler()
+    {
+    LOG( SIMPLE,
+        "DISPLAYTEXT: CDisplayTextHandler::~CDisplayTextHandler calling" )
+
+    Cancel();
+    delete iClearScreenHandler;
+
+    LOG( SIMPLE,
+        "DISPLAYTEXT: CDisplayTextHandler::~CDisplayTextHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplayTextHandler::ClientResponse
+// -----------------------------------------------------------------------------
+//
+void CDisplayTextHandler::ClientResponse()
+    {
+    LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::ClientResponse calling" )
+
+    // SatShellController checks if SatUi was brought to foreground from
+    // background and set SatUi background again.
+    if ( RSat::EHighPriority == iDisplayTextData.iPriority )
+        {
+        LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::ClientResponse \
+             set SatUi background" )
+        iUtils->SatUiHandler().ShellController().SetSatUiToBackground();
+        }
+
+    TBool terminatedByUser( EFalse );
+    if ( RSat::KPSessionTerminatedByUser == iDisplayTextRsp.iGeneralResult )
+        {
+        LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::ClientResponse \
+             session terminated by user" )
+        terminatedByUser = ETrue;
+
+        iUtils->NotifyEvent( MSatUtils::ESessionTerminatedByUser );
+        }
+
+    // Check immediate response. If true, no need to send TerminalResponse
+    // This must be checked from our own member variable, because
+    // ClearScreenHandler may have this value set to false already if the
+    // timer has run out and screen was cleared.
+    if ( iImmediateResponse )
+        {
+        // Check has sustained text cleared in ClearScreen handler
+        if ( !iImmediatePending )
+            {
+            // No need to send terminal response since it is already sent.
+            iImmediateResponse = EFalse;
+
+            // Notify sustained text removal, if not yet notified.
+            iUtils->NotifyEvent( MSatUtils::ESustainedTextRemoved );
+            iClearScreenHandler->UpdateImmediateState( EFalse );
+
+            if ( !iUtils->SatUiHandler().UiLaunchedByUser() ||
+                 terminatedByUser )
+                {
+                LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::\
+                     ClientResponse close ui session" )
+                // Next SimSession end will close the ui session.
+                iUtils->NotifyEvent( MSatUtils::ESessionTerminatedByUser );
+                }
+            else
+                {
+                LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::\
+                     ClientResponse others" )
+                // If SATUI client application is running, show the setup menu.
+                if ( iUtils->SatUiHandler().UiSession() )
+                    {
+                    LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::\
+                         ClientResponse SetUpMenu" )
+                    iUtils->NotifyEvent( MSatUtils::ESetUpMenuNeeded );
+                    }
+                }
+            }
+        iImmediatePending = EFalse;
+        }
+    else
+        {
+        LOG( SIMPLE,
+            "DISPLAYTEXT: CDisplayTextHandler::ClientResponse Success" )
+        // Generate terminal response
+        iDisplayTextRsp.SetPCmdNumber( iDisplayTextData.PCmdNumber() );
+        TerminalRsp( RSat::EDisplayText, iDisplayTextRspPckg );
+        }
+
+    LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::ClientResponse exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplayTextHandler::DoCancel
+// Cancels the sat request.
+// -----------------------------------------------------------------------------
+//
+void CDisplayTextHandler::DoCancel()
+    {
+    LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::DoCancel calling" )
+
+    iUtils->USatAPI().NotifyDisplayTextCancel();
+
+    LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplayTextHandler::IssueUSATRequest
+// -----------------------------------------------------------------------------
+//
+void CDisplayTextHandler::IssueUSATRequest( TRequestStatus& aStatus )
+    {
+    LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::IssueUSATRequest calling" )
+
+    // Clear the IPC package.
+    new (&iDisplayTextData) RSat::TDisplayTextV2();
+    iDisplayTextRsp.iGeneralResult = RSat::KPSessionTerminatedByUser; // default
+    iDisplayTextSendData.iDuration = 0;
+    iDisplayTextSendData.iClearScreen = RSat::EClearScreenTriggerNotSet;
+
+    iUtils->USatAPI().NotifyDisplayText( aStatus, iDisplayTextPckg );
+
+    LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::IssueUSATRequest exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplayTextHandler::CommandAllowed
+// -----------------------------------------------------------------------------
+//
+TBool CDisplayTextHandler::CommandAllowed()
+    {
+    LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::CommandAllowed calling" )
+
+    // By default, this is true.
+    TBool commandAllowed( ETrue );
+
+    const TBool callIncoming( iUtils->SystemState().IsCallIncoming() );
+    const TBool phoneInIdle( IsPhoneInIdleState() );
+
+    
+    TBool screenSaver( EFalse );
+    
+    // By default, this is true.    
+    TBool uiNotReady( ETrue );     
+    
+    // If screen saver is actived from idle.
+    screenSaver = iUtils->SystemState().IsScreenSaverActivedFromIdle();
+      
+    if ( screenSaver )
+        {
+        uiNotReady = EFalse;
+        }
+    else
+        {
+        uiNotReady = ( !phoneInIdle  &&
+                     ( !iUtils->SatUiHandler().UiSession() ) );        
+        }
+
+    const RSat::TDisplayPriority priority( iDisplayTextData.iPriority );
+
+    // Icon without text
+    if ( ( 0 == iDisplayTextData.iText.Length() ) &&
+         ( RSat::ENotSelfExplanatory == iDisplayTextData.iIconId.iQualifier ||
+           RSat::ESelfExplanatory == iDisplayTextData.iIconId.iQualifier ) )
+        {
+        iDisplayTextRsp.iGeneralResult = RSat::KCmdDataNotUnderstood;
+        iDisplayTextRsp.iInfoType = RSat::KNoAdditionalInfo;
+        iDisplayTextRsp.iAdditionalInfo.Zero();
+        commandAllowed = EFalse;
+        }
+    // Check is call incoming or if Normal priority check is call ongoing or is
+    // phone in idle state and is there UiSession. AND Ui is not closing
+    else if ( callIncoming ||
+         ( ( priority == RSat::ENormalPriority ) &&
+           ( uiNotReady ) ) )
+        {
+        // Check is UI closing
+        if ( !iUtils->SatUiHandler().IsUiClosing() )
+            {
+            // Generate proper terminal response and send it.
+            // By default, this command does not have additional information,
+            // except in this case when screen is busy.
+            iDisplayTextRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+            iDisplayTextRsp.iInfoType = RSat::KMeProblem;
+            iDisplayTextRsp.iAdditionalInfo.SetLength( 1 );
+            iDisplayTextRsp.iAdditionalInfo[0] = RSat::KScreenBusy;
+
+            // Command is not allowed.
+            LOG( SIMPLE,
+                "DISPLAYTEXT: CDisplayTextHandler::CommandAllowed Not allowed" )
+            commandAllowed = EFalse;
+            }
+        else // UI is closing, command is allowed. UI is launched again when it
+             // has been fully closed
+            {
+            LOG( SIMPLE,
+                "DISPLAYTEXT: CDisplayTextHandler::CommandAllowed Ui is closing\
+                Command is allowed" )
+            }
+        }
+    else
+        {
+        LOG( SIMPLE,
+                "DISPLAYTEXT: CDisplayTextHandler::CommandAllowed Allowed" )
+        }
+
+    if ( !commandAllowed )
+        {
+        LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::CommandAllowed \
+             commandAllowed false" )
+        iDisplayTextRsp.SetPCmdNumber( iDisplayTextData.PCmdNumber() );
+        TerminalRsp( RSat::EDisplayText, iDisplayTextRspPckg );
+        }
+
+    LOG2( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::CommandAllowed exiting,\
+          commandAllowed: %d", commandAllowed )
+    return commandAllowed;
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplayTextHandler::NeedUiSession
+// -----------------------------------------------------------------------------
+//
+TBool CDisplayTextHandler::NeedUiSession()
+    {
+    // Priority and phone idle state is checked in CommandAllowed function, so
+    // in this case it has passed and we need UI.
+    LOG( NORMAL,
+        "DISPLAYTEXT: CDisplayTextHandler::NeedUiSession calling - calling" )
+
+    // Notify Mediator if Cover UI is supported
+    if ( iUtils->CoverUiSupported() )
+        {
+        TSatCommandData medEventData;
+        medEventData.iPCmdNumber = RSat::EDisplayText;
+        medEventData.iAlphaId.iStatus = RSat::EAlphaIdProvided;
+        medEventData.iAlphaId.iAlphaId.Copy( iDisplayTextData.iText );
+        if ( RSat::ETimeUnitNotSet == iDisplayTextData.iDuration.iTimeUnit &&
+            RSat::EClearAfterDelay == iDisplayTextData.iClearScreenTrigger )
+            {
+            LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::NeedUiSession \
+                 KSatDefaultDuration" )
+            medEventData.iDuration.iTimeUnit = RSat::ESeconds;
+            medEventData.iDuration.iNumOfUnits = KSatDefaultDuration;
+            }
+        else if (
+            ( RSat::ETimeUnitNotSet == iDisplayTextData.iDuration.iTimeUnit ) &&
+            ( RSat::EUserClear == iDisplayTextData.iClearScreenTrigger ) )
+            {
+            LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::NeedUiSession \
+                 KSatLongDuration" )
+            medEventData.iDuration.iTimeUnit = RSat::ESeconds;
+            medEventData.iDuration.iNumOfUnits = KSatLongDuration;
+            }
+        else
+            {
+            LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::NeedUiSession \
+                 others" )
+            medEventData.iDuration = iDisplayTextData.iDuration;
+            }
+
+        medEventData.iIconID = iDisplayTextData.iIconId;
+        TSatCommandPckg tPckg( medEventData );
+        iUtils->RaiseSatEvent( tPckg );
+        }
+
+    LOG( NORMAL,
+        "DISPLAYTEXT: CDisplayTextHandler::NeedUiSession - exiting" )
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplayTextHandler::HandleCommand
+// -----------------------------------------------------------------------------
+//
+void CDisplayTextHandler::HandleCommand()
+    {
+    LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::HandleCommand calling" )
+
+    // If this is a High priority message, bring SatUi to foreground.
+    if ( RSat::EHighPriority == iDisplayTextData.iPriority )
+        {
+        LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::HandleCommand bring \
+             SatUi to foreground" )
+        iUtils->SatUiHandler().ShellController().BringSatUiToForeground();
+        }
+
+    // Notify must be here, because it triggers ClearScreen and
+    // this notify must be before UpdateImmediateState function call.
+    iUtils->NotifyEvent( MSatUtils::EDisplayTextExecuting );
+
+    // Send terminal response immediately if SIM requires it.
+    if ( RSat::EImmediateRsp == iDisplayTextData.iImmediateRsp )
+        {
+        LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::HandleCommand \
+             immediate response" )
+        // There is sustained text already on display
+        if ( iImmediateResponse )
+            {
+            LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::HandleCommand \
+                 iImmediateResponse true" )
+            iImmediatePending = ETrue;
+            }
+
+        // Generate terminal response
+        iDisplayTextRsp.iGeneralResult = RSat::KSuccess;
+        iDisplayTextRsp.iInfoType = RSat::KNoAdditionalInfo;
+        iDisplayTextRsp.iAdditionalInfo.Zero();
+        iDisplayTextRsp.SetPCmdNumber( iDisplayTextData.PCmdNumber() );
+
+        // We cannot use CSatCommandHandler's TerminalRsp here because it
+        // restarts the request and we are not yet ready for that
+        iUtils->NotifyEvent( MSatUtils::EDelaySimSessionEnd );
+
+        iUtils->USatAPI().TerminalRsp(
+            RSat::EDisplayText, iDisplayTextRspPckg );
+
+        iImmediateResponse = ETrue;
+        iClearScreenHandler->UpdateImmediateState( ETrue );
+
+        iUtils->NotifyEvent( MSatUtils::ESustainedTextInDisplay );
+
+        // Inform UI that this is sustained text
+        iDisplayTextSendData.iSustainedText = ETrue;
+        }
+    else
+        {
+        LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::HandleCommand \
+             others" )
+        // Reset information for other cases.
+        // Inform UI that this is not sustained text.
+        iDisplayTextSendData.iSustainedText = EFalse;
+        }
+
+    // Check if duration data is available.
+    if ( ( RSat::ENoDurationAvailable != iDisplayTextData.iDuration.iTimeUnit )
+        && ( RSat::ETimeUnitNotSet != iDisplayTextData.iDuration.iTimeUnit )
+        && iDisplayTextData.iDuration.iNumOfUnits )
+        {
+        LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::HandleCommand \
+             duration data available" )
+        // The resolution of a timer is 1 second.
+        TTimeIntervalSeconds duration( 0 );
+        duration = DurationInSeconds( iDisplayTextData.iDuration );
+        iDisplayTextSendData.iDuration = duration;
+        }
+
+    // Build the IPC Package.
+    iDisplayTextSendData.iText = iDisplayTextData.iText;
+    iDisplayTextSendData.iSimApplicationName = iUtils->SatAppName();
+    iDisplayTextSendData.iPCmdNumber = iDisplayTextData.PCmdNumber();
+    iDisplayTextSendData.iIconId = iDisplayTextData.iIconId;
+    iDisplayTextSendData.iClearScreen = iDisplayTextData.iClearScreenTrigger;
+
+    // Now we can send command to client.
+    MSatUiSession* uiSession = iUtils->SatUiHandler().UiSession();
+    uiSession->SendCommand(
+        &iDisplayTextSendPckg,
+        &iDisplayTextRspPckg,
+        ESatSProactiveDisplayText );
+
+    // Restart request, if immediate response.
+    if ( RSat::EImmediateRsp == iDisplayTextData.iImmediateRsp )
+        {
+        LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::HandleCommand \
+             immediate response" )
+        // Renew the request
+        Start();
+        }
+
+    LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::HandleCommand exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplayTextHandler::UiLaunchFailed
+// -----------------------------------------------------------------------------
+//
+void CDisplayTextHandler::UiLaunchFailed()
+    {
+    LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::UiLaunchFailed calling" )
+
+    // Send terminal response
+    iDisplayTextRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+    iDisplayTextRsp.iInfoType = RSat::KMeProblem;
+    iDisplayTextRsp.iAdditionalInfo.SetLength( 1 );
+    iDisplayTextRsp.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
+    iDisplayTextRsp.SetPCmdNumber( iDisplayTextData.PCmdNumber() );
+    TerminalRsp( RSat::EDisplayText, iDisplayTextRspPckg );
+
+    LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::UiLaunchFailed exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CDisplayTextHandler::DurationInSeconds
+// Return duration in seconds.
+// -----------------------------------------------------------------------------
+//
+TTimeIntervalSeconds CDisplayTextHandler::DurationInSeconds(
+    const RSat::TDuration& aDuration ) const
+    {
+    LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::DurationInSeconds calling" )
+
+    TTimeIntervalSeconds duration( 0 );
+    LOG2( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::DurationInSeconds \
+          aDuration.iTimeUnit: %d", aDuration.iTimeUnit )
+    switch ( aDuration.iTimeUnit )
+        {
+        case RSat::EMinutes:
+            {
+            duration = aDuration.iNumOfUnits * KSecondsInMinute;
+            break;
+            }
+
+        case RSat::ESeconds:
+            {
+            duration = aDuration.iNumOfUnits;
+            break;
+            }
+
+        case RSat::ETenthsOfSeconds:
+            {
+            // If duration exists minimum values is 1 second
+            if ( aDuration.iNumOfUnits < KHalfSecond )
+                {
+                LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::\
+                     DurationInSeconds aDuration.iNumOfUnits < KHalfSecond" )
+                duration = KSecond;
+                }
+            else
+                {
+                // Make Roundup
+                duration = ( aDuration.iNumOfUnits + KHalfSecond ) / KSecond;
+                }
+            break;
+            }
+
+        default:
+            {
+            //duration is 0
+            break;
+            }
+        }
+
+    LOG( SIMPLE, "DISPLAYTEXT: CDisplayTextHandler::DurationInSeconds exiting" )
+    return duration;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/DisplayTextCmd/src/std.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 functions
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    <implementationproxy.h>
+#include    "CDisplayTextHandler.h"
+
+// CONSTANTS
+
+const TImplementationProxy implementationTable[] =
+    {
+    //lint -e{611,1924} Warning "Suspicious cast" can not be avoided.
+    IMPLEMENTATION_PROXY_ENTRY( 0x1020298A, CDisplayTextHandler::NewL )
+    };
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy ECOM framework factory function
+// Calculates the number of implementations.
+// Returns: Implementation proxy.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount ) // Number of implementations
+    {
+    aTableCount =
+        sizeof( implementationTable ) /
+        sizeof( TImplementationProxy );
+    return implementationTable;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/GetChannelStatusCmd/group/GetChannelStatusCmd.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* 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:  Project definition file for project GetChannelStatus plug-in
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../../inc/SatMacroes.h"
+
+TARGET                  GetChannelStatusCmd.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D 0x102078DD
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  std.cpp
+SOURCE                  CGetChannelStatusHandler.cpp
+
+START RESOURCE          102078DD.rss
+TARGET                  GetChannelStatusCmd.rsc
+END
+
+USERINCLUDE             ../../../inc
+USERINCLUDE             ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+SYSTEMINCLUDE           ../../../../../inc      // Domain telephony
+SYSTEMINCLUDE           ../../../../inc         // Subsystem satengine
+
+LIBRARY                 euser.lib
+LIBRARY                 etelsat.lib
+LIBRARY                 SatEngine.lib
+
+#ifdef ENABLE_SAT_LOGGING
+LIBRARY                 flogger.lib
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/GetChannelStatusCmd/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 GetChannelStatus plug-in
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+GetChannelStatusCmd.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/GetChannelStatusCmd/inc/CGetChannelStatusHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,118 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  GetChannelStatus command handler
+*
+*/
+
+
+
+#ifndef CGETCHANNELSTATUSHANDLER_H
+#define CGETCHANNELSTATUSHANDLER_H
+
+//  INCLUDES
+#include <etelsat.h>
+#include "CSatCommandHandler.h"
+#include "SatSTypes.h"
+
+// FORWARD DECLARATION
+class MSatUtils;
+
+// CLASS DECLARATION
+
+/**
+*  Command handler for GetChannelStatus command.
+*
+*  @lib GetChannelStatusCmd.lib
+*  @since Series 60 3.0
+*/
+class CGetChannelStatusHandler : public CSatCommandHandler
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CGetChannelStatusHandler* NewL( MSatUtils* aUtils );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CGetChannelStatusHandler();
+
+    protected:  // Functions from base classes
+
+        /**
+        * From CActive Cancels the usat request.
+        */
+        void DoCancel();
+
+        /**
+        * From CSatCommandHandler Requests the command notification.
+        * @param aStatus Request status to active object notification
+        */
+        void IssueUSATRequest( TRequestStatus& aStatus );
+
+        /**
+        * From CSatCommandHandler Precheck before executing the command.
+        * @return Boolean indicating is this command allowed to execute.
+        */
+        TBool CommandAllowed();
+
+        /**
+        * From CSatCommandHandler Need for ui session.
+        * @return Boolean indicating does this command need UI session.
+        */
+        TBool NeedUiSession();
+
+        /**
+        * From CSatCommandHandler Called when USAT API notifies that command.
+        */
+        void HandleCommand();
+
+        /**
+        * From CSatCommandHandler. Indicates the failure of launching ui client.
+        */
+        void UiLaunchFailed();
+
+    private:
+
+        /**
+        * Gets channel statuses and adds them into Terminalresponse
+        * @param aChannelCount The number of non-closed channels
+        */
+        void GetChannelStatusesL( const TInt aChannelCount );
+
+        /**
+        * C++ default constructor.
+        */
+        CGetChannelStatusHandler();
+
+    private:    // Data
+
+        // GetChannelStatus command data
+        RSat::TGetChannelStatusV2 iGetChannelData;
+
+        // GetChannelStatus command package
+        RSat::TGetChannelStatusV2Pckg iGetChannelDataPckg;
+
+        // GetChannelStatus response data
+        RSat::TGetChannelStatusRspV2 iGetChannelRsp;
+
+        // GetChannelStatus response package
+        RSat::TGetChannelStatusRspV2Pckg iGetChannelRspPckg;
+    };
+
+#endif      // CGETCHANNELSTATUSHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/GetChannelStatusCmd/inc/GetChannelStatusCmd.rls	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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 headers for project GetChannelStatusCmd
+*
+*/
+
+
+#ifndef GETCHANNELSTATUSCMD_RLS
+#define GETCHANNELSTATUSCMD_RLS
+
+rls_string STRING_r_getchannelstatuscmd_display_name "GetChannelStatus command"
+rls_string STRING_r_getchannelstatuscmd_default_data "GetChannelStatusCmd"
+rls_string STRING_r_getchannelstatuscmd_opaque_data  ""
+
+#endif // GETCHANNELSTATUSCMD_RLS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/GetChannelStatusCmd/src/102078DD.rss	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 1020 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Registry information for ECOM
+*
+*/
+
+
+
+//  INCLUDES
+#include <registryinfo.rh>
+#include "GetChannelStatusCmd.rls"
+
+//  RESOURCE DEFINITIONS
+// -----------------------------------------------------------------------------
+//
+// GetChannelStatusCmdInfo
+// Registeration information for ECOM
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO GetChannelStatusCmdInfo
+    {
+    dll_uid = 0x102078DD;
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x1000f001;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x102078DE;
+                    version_no   = 1;
+                    display_name = STRING_r_getchannelstatuscmd_display_name;
+                    default_data = STRING_r_getchannelstatuscmd_default_data;
+                    opaque_data  = STRING_r_getchannelstatuscmd_opaque_data;
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/GetChannelStatusCmd/src/CGetChannelStatusHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,270 @@
+/*
+* 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:  Handles GetChannelStatus command
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "MSatApi.h"
+#include    "MSatUtils.h"
+#include    "MSatBIPUtils.h"
+#include    "MSatBIPDataChannel.h"
+#include    "CGetChannelStatusHandler.h"
+#include    "SatLog.h"
+
+// CONSTANTS
+// length of channel status info
+const TUint8 KChannelStatusLength = 2;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CGetChannelStatusHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CGetChannelStatusHandler* CGetChannelStatusHandler::NewL( MSatUtils* aUtils )
+    {
+    LOG( SIMPLE, "GETCHANNELSTATUS: CGetChannelStatusHandler::NewL calling" )
+    CGetChannelStatusHandler* self = new( ELeave ) CGetChannelStatusHandler;
+
+    CleanupStack::PushL( self );
+    self->BaseConstructL( aUtils );
+    // ConstructL not needed.
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "GETCHANNELSTATUS: CGetChannelStatusHandler::NewL exiting" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CGetChannelStatusHandler::~CGetChannelStatusHandler
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CGetChannelStatusHandler::~CGetChannelStatusHandler()
+    {
+    LOG( SIMPLE, "GETCHANNELSTATUS: CGetChannelStatusHandler::\
+        CGetChannelStatusHandler calling" )
+
+    Cancel();
+
+    LOG( SIMPLE, "GETCHANNELSTATUS: CGetChannelStatusHandler::\
+        ~CGetChannelStatusHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CGetChannelStatusHandler::DoCancel
+// Cancels the sat request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CGetChannelStatusHandler::DoCancel()
+    {
+    LOG( SIMPLE, "GETCHANNELSTATUS: CGetChannelStatusHandler::\
+        DoCancel calling" )
+
+    iUtils->USatAPI().NotifyGetChannelStatusCancel();
+
+    LOG( SIMPLE, "GETCHANNELSTATUS: CGetChannelStatusHandler::\
+        DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CGetChannelStatusHandler::IssueUSATRequest
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CGetChannelStatusHandler::IssueUSATRequest( TRequestStatus& aStatus )
+    {
+    LOG( SIMPLE,
+        "GETCHANNELSTATUS: CGetChannelStatusHandler::IssueUSATRequest calling" )
+
+    // Reset previously received data
+    new (&iGetChannelData) RSat::TGetChannelStatusV2();
+    iUtils->USatAPI().NotifyGetChannelStatus( aStatus, iGetChannelDataPckg );
+
+    LOG( SIMPLE,
+        "GETCHANNELSTATUS: CGetChannelStatusHandler::IssueUSATRequest exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CGetChannelStatusHandler::CommandAllowed
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CGetChannelStatusHandler::CommandAllowed()
+    {
+    LOG( SIMPLE, "GETCHANNELSTATUS: CGetChannelStatusHandler::CommandAllowed \
+        calling - exiting" )
+    // Get channel status command is always allowed
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CGetChannelStatusHandler::NeedUiSession
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CGetChannelStatusHandler::NeedUiSession()
+    {
+    LOG( SIMPLE, "GETCHANNELSTATUS: CGetChannelStatusHandler::NeedUiSession\
+        calling - exiting" )
+    // This command doesn't need UI
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CGetChannelStatusHandler::HandleCommand
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CGetChannelStatusHandler::HandleCommand()
+    {
+    LOG( SIMPLE,
+        "GETCHANNELSTATUS: CGetChannelStatusHandler::HandleCommand calling" )
+
+    iUtils->NotifyEvent( MSatUtils::EGetChannelStatusExecuting );
+    // Get data channels from BIP Utils
+    CArrayPtrFlat<MSatBIPDataChannel>* dataChannels(
+        iUtils->BipUtils().DataChannels() );
+
+    // Get number of data channels
+    const TInt channelCount( dataChannels->Count() );
+
+    // Create IPC package
+    iGetChannelRsp.SetPCmdNumber( iGetChannelData.PCmdNumber() );
+
+    // Check that count is more than 0
+    if ( channelCount > 0 )
+        {
+        LOG( NORMAL, "GETCHANNELSTATUS: CGetChannelStatusHandler::HandleCommand\
+            Gathering channel statuses" )
+
+        TRAPD( err, GetChannelStatusesL( channelCount ) );
+        if ( KErrNone == err )
+            {
+            // Result is success
+            iGetChannelRsp.iInfoType = RSat::KChannelStatusInfo;
+            iGetChannelRsp.iGeneralResult = RSat::KSuccess;
+            }
+        else
+            {
+            LOG2( NORMAL, "GETCHANNELSTATUS: CGetChannelStatusHandler::\
+                HandleCommand with error: %i", err )
+            // Error
+            iGetChannelRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+            iGetChannelRsp.iInfoType = RSat::KMeProblem;
+            iGetChannelRsp.iAdditionalInfo.SetLength( 1 );
+            iGetChannelRsp.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
+            }
+        }
+    else
+        {
+        LOG( NORMAL, "GETCHANNELSTATUS: CGetChannelStatusHandler::HandleCommand\
+            No data channels" )
+        // No data channels available, return one empty ChannelStatus object
+        iGetChannelRsp.iInfoType = RSat::KChannelStatusInfo;
+        iGetChannelRsp.iGeneralResult = RSat::KSuccess;
+        // No channels, return ChannelStatusInfo 00 00
+        iGetChannelRsp.iAdditionalInfo.SetLength( KChannelStatusLength );
+        iGetChannelRsp.iAdditionalInfo[0] = 0x00;
+        iGetChannelRsp.iAdditionalInfo[1] = 0x00;
+        }
+
+    // Send terminal response
+    TerminalRsp( RSat::EGetChannelStatus, iGetChannelRspPckg );
+
+    LOG( SIMPLE,
+        "GETCHANNELSTATUS: CGetChannelStatusHandler::HandleCommand exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CGetChannelStatusHandler::UiLaunchFailed
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CGetChannelStatusHandler::UiLaunchFailed()
+    {
+    LOG( SIMPLE, "GETCHANNELSTATUS: CGetChannelStatusHandler::UiLaunchFailed \
+        calling-exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CGetChannelStatusHandler::GetChannelStatusesL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CGetChannelStatusHandler::GetChannelStatusesL( const TInt aChannelCount )
+    {
+    LOG( SIMPLE, "GETCHANNELSTATUS: CGetChannelStatusHandler::\
+        GetChannelStatuses calling" )
+
+    // Get data channels from BIP Utils
+    CArrayPtrFlat<MSatBIPDataChannel>* dataChannels(
+        iUtils->BipUtils().DataChannels() );
+
+    // Each data channel needs 2 slots in additional info
+    iGetChannelRsp.iAdditionalInfo.SetLength(
+        aChannelCount * KChannelStatusLength );
+
+    TInt addInfoIndex = 0;
+    LOG2( SIMPLE, "GETCHANNELSTATUS: CGetChannelStatusHandler::\
+        GetChannelStatusesL aChannelCount: %d", aChannelCount )
+    // Loop data channels
+    if ( dataChannels->Count() >= aChannelCount )
+        {
+        LOG( SIMPLE, "GETCHANNELSTATUS: CGetChannelStatusHandler::\
+             GetChannelStatusesL dataChannels->Count() >= aChannelCount" )
+        for ( TInt i = 0; i < aChannelCount; i++ )
+            {
+            // Get data channel from array
+            MSatBIPDataChannel* channel = dataChannels->At( i );
+            // Generate TChannelStatus
+            RSat::TChannelStatus status(
+                iUtils->BipUtils().GenerateChannelStatusL(
+                    channel->ChannelId(), channel->Status() ) );
+
+            // Add first byte (channel ID and context activation state)
+            iGetChannelRsp.iAdditionalInfo[addInfoIndex++] = status[0];
+            // Add second byte (channel status)
+            iGetChannelRsp.iAdditionalInfo[addInfoIndex++] = status[1];
+            }
+        }
+
+    LOG( SIMPLE, "GETCHANNELSTATUS: CGetChannelStatusHandler::\
+        GetChannelStatuses exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CGetChannelStatusHandler::CGetChannelStatusHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CGetChannelStatusHandler::CGetChannelStatusHandler() :
+    CSatCommandHandler(),
+    iGetChannelData(),
+    iGetChannelDataPckg( iGetChannelData ),
+    iGetChannelRsp(),
+    iGetChannelRspPckg( iGetChannelRsp )
+    {
+    LOG( SIMPLE,
+        "GETCHANNELSTATUS: CGetChannelStatusHandler::\
+            CGetChannelStatusHandler calling - exiting" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/GetChannelStatusCmd/src/std.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 functions
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    <implementationproxy.h>
+#include    "CGetChannelStatusHandler.h"
+
+// CONSTANTS
+
+const TImplementationProxy implementationTable[] =
+    {
+    //lint -e{611,1924} Warning "Suspicious cast" can not be avoided.
+    IMPLEMENTATION_PROXY_ENTRY( 0x102078DE, CGetChannelStatusHandler::NewL )
+    };
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy ECOM framework factory function
+// Calculates the number of implementations.
+// Returns: Implementation proxy.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount ) // Number of implementations
+    {
+    aTableCount =
+        sizeof( implementationTable ) /
+        sizeof( TImplementationProxy );
+    return implementationTable;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/GetInkeyCmd/group/GetInkeyCmd.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* 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:  Project definition file for project GetInkey plug-in
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../../inc/SatMacroes.h"
+
+TARGET                  GetInkeyCmd.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D 0x1000A889
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  std.cpp
+SOURCE                  CGetInkeyHandler.cpp
+
+START RESOURCE          1000A889.rss
+TARGET                  GetInkeyCmd.rsc
+END
+
+USERINCLUDE             ../../../inc
+USERINCLUDE             ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+SYSTEMINCLUDE           ../../../../../inc      // Domain telephony
+SYSTEMINCLUDE           ../../../../inc         // Subsystem satengine
+
+LIBRARY                 euser.lib
+LIBRARY                 etelsat.lib
+LIBRARY                 SatEngine.lib
+
+#ifdef ENABLE_SAT_LOGGING
+LIBRARY                 flogger.lib
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/GetInkeyCmd/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 GetInkeyCmd plug-in
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+GetInkeyCmd.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/GetInkeyCmd/inc/CGetInkeyHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,140 @@
+/*
+* 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:  GetInkeyHandler
+*
+*/
+
+
+#ifndef CGETINKEYHANDLER_H
+#define CGETINKEYHANDLER_H
+
+#include "CSatCommandHandler.h"
+
+#include <etelsat.h>
+
+class MSatUtils;
+
+/**
+ *  Command handler for GetInkey command.
+ *
+ *  @lib GetInkeyCmd.lib
+ *  @since S60 v3.0
+ */
+class CGetInkeyHandler : public CSatCommandHandler
+    {
+
+public:
+
+    static CGetInkeyHandler* NewL( MSatUtils* aUtils );
+
+    virtual ~CGetInkeyHandler();
+
+// from base class MSatCommand
+
+    /**
+     * From MSatCommand
+     * Response from the client.
+     *
+     */
+    void ClientResponse();
+
+protected:
+
+// from base class CActive
+
+    /**
+     * From CActive.
+     * Cancels the usat request.
+     *
+     */
+    void DoCancel();
+    
+// from base class CSatCommandHandler
+
+    /**
+     * From CSatCommandHandler.
+     * Requests the command notification.
+     *
+     * @param aStatus Request status
+     */
+    void IssueUSATRequest( TRequestStatus& aStatus );
+
+    /**
+     * From CSatCommandHandler.
+     * Precheck before executing the command.
+     *
+     * @return TBool indicating is this command allowed to execute.
+     */
+    TBool CommandAllowed();
+
+    /**
+     * From CSatCommandHandler.
+     * Need for ui session.
+     *
+     * @return TBool indicating need of ui session.
+     */
+    TBool NeedUiSession();
+
+    /**
+     * From CSatCommandHandler.
+     * Called when USAT API notifies that command.
+     *
+     */
+    void HandleCommand();
+
+    /**
+     * From CSatCommandHandler.
+     * Indicates the failure of launching ui client.
+     *
+     */
+    void UiLaunchFailed();
+
+private:
+
+    CGetInkeyHandler();
+
+    void ConstructL();
+
+private: // data
+
+    /**
+     * SetUpCall command data.
+     */
+    RSat::TGetInkeyV2 iGetInkeyData;
+
+    /**
+     * SetUpCall command package.
+     */
+    RSat::TGetInkeyV2Pckg iGetInkeyPckg;
+
+    /**
+     * Response from client.
+     */
+    RSat::TGetInkeyRspV2 iGetInkeyRsp;
+
+    /**
+     * Response package.
+     */
+    RSat::TGetInkeyRspV2Pckg iGetInkeyRspPckg;
+    
+    /**
+     * Flag to signal that command has icon data
+     * To be removed when icons are allowed in this command
+     */
+    TBool iIconCommand;
+
+    };
+
+#endif      // CGETINKEYHANDLER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/GetInkeyCmd/inc/GetInkeyCmd.rls	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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 headers for project GetInkeyCmd
+*
+*/
+
+
+#ifndef GETINKEYCMD_RLS
+#define GETINKEYCMD_RLS
+
+rls_string STRING_r_getinkeycmd_display_name "GetInkey command"
+rls_string STRING_r_getinkeycmd_default_data "GetInkeyCmd"
+rls_string STRING_r_getinkeycmd_opaque_data  ""
+
+#endif // GETINKEYCMD_RLS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/GetInkeyCmd/src/1000A889.rss	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 1000 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Registry information for ECOM
+*
+*/
+
+
+
+//  INCLUDES
+#include <registryinfo.rh>
+#include "GetInkeyCmd.rls"
+
+//  RESOURCE DEFINITIONS
+// -----------------------------------------------------------------------------
+//
+// GetInkeyCmdInfo
+// Registeration information for ECOM
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO GetInkeyCmdInfo
+    {
+    dll_uid = 0x1000A889;
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x1000f001;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x1000A888;
+                    version_no   = 1;
+                    display_name = STRING_r_getinkeycmd_display_name;
+                    default_data = STRING_r_getinkeycmd_default_data;
+                    opaque_data  = STRING_r_getinkeycmd_opaque_data;
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/GetInkeyCmd/src/CGetInkeyHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,311 @@
+/*
+* 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:  Handles GetInkey command
+*
+*/
+
+
+#include    "MSatApi.h"
+#include    "MSatUtils.h"
+#include    "MSatUiSession.h"
+#include    "SatSOpcodes.h"
+#include    "MSatSUiClientHandler.h"
+#include    "CGetInkeyHandler.h"
+#include    "SatLog.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CGetInkeyHandler* CGetInkeyHandler::NewL( MSatUtils* aUtils )
+    {
+    LOG( SIMPLE, "GETINKEY: CGetInkeyHandler::NewL calling" )
+
+    CGetInkeyHandler* self = new( ELeave ) CGetInkeyHandler;
+
+    CleanupStack::PushL( self );
+    self->BaseConstructL( aUtils );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "GETINKEY: CGetInkeyHandler::NewL exiting" )
+    return self;
+    }
+    
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CGetInkeyHandler::~CGetInkeyHandler()
+    {
+    LOG( SIMPLE, "GETINKEY: CGetInkeyHandler::~CGetInkeyHandler calling" )
+
+    Cancel();
+
+    LOG( SIMPLE, "GETINKEY: CGetInkeyHandler::~CGetInkeyHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class MSatCommand.
+// Response from the client.
+// -----------------------------------------------------------------------------
+//
+void CGetInkeyHandler::ClientResponse()
+    {
+    LOG( SIMPLE, "GETINKEY: CGetInkeyHandler::ClientResponse calling" )
+
+    if ( RSat::KPSessionTerminatedByUser == iGetInkeyRsp.iGeneralResult )
+        {
+        LOG( SIMPLE, "GETINKEY: CGetInkeyHandler::ClientResponse close ui \
+             session" )
+        // Next SimSession end will close the ui session
+        iUtils->NotifyEvent( MSatUtils::ESessionTerminatedByUser );
+        }
+        
+    // If command had icon data and was done succesfully, report that icon
+    // was not shown
+    // To be removed when icons are allowed in this command
+    if ( ( RSat::KSuccess == iGetInkeyRsp.iGeneralResult ) &&
+        iIconCommand )
+        {
+        LOG( SIMPLE, "GETINKEY: CGetInkeyHandler::ClientResponse requested \
+             icon not displayed" )
+        iGetInkeyRsp.iGeneralResult =
+                    RSat::KSuccessRequestedIconNotDisplayed;
+        }
+
+    iGetInkeyRsp.SetPCmdNumber( iGetInkeyData.PCmdNumber() );
+    CSatCommandHandler::TerminalRsp( RSat::EGetInkey, iGetInkeyRspPckg );
+
+    LOG( SIMPLE, "GETINKEY: CGetInkeyHandler::ClientResponse exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CActive.
+// Cancels the sat request.
+// -----------------------------------------------------------------------------
+//
+void CGetInkeyHandler::DoCancel()
+    {
+    LOG( SIMPLE, "GETINKEY: CGetInkeyHandler::DoCancel calling" )
+
+    iUtils->USatAPI().NotifyGetInkeyCancel();
+
+    LOG( SIMPLE, "GETINKEY: CGetInkeyHandler::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Requests the command notification.
+// -----------------------------------------------------------------------------
+//
+void CGetInkeyHandler::IssueUSATRequest( TRequestStatus& aStatus )
+    {
+    LOG( SIMPLE, "GETINKEY: CGetInkeyHandler::IssueUSATRequest calling" )
+
+    // Clear the IPC package.
+    new (&iGetInkeyData) RSat::TGetInkeyV2();
+    iGetInkeyRsp.iGeneralResult = RSat::KPSessionTerminatedByUser; // default
+
+    iUtils->USatAPI().NotifyGetInkey( aStatus, iGetInkeyPckg );
+
+    LOG( SIMPLE, "GETINKEY: CGetInkeyHandler::IssueUSATRequest exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Precheck before executing the command.
+// -----------------------------------------------------------------------------
+//
+TBool CGetInkeyHandler::CommandAllowed()
+    {
+    LOG( SIMPLE, "GETINKEY: CGetInkeyHandler::CommandAllowed calling" )
+    TBool allowed( ETrue );
+    
+    // If provided duration is missing time units
+    if ( ( RSat::ENoDurationAvailable != iGetInkeyData.iDuration.iTimeUnit &&
+        RSat::ETimeUnitNotSet != iGetInkeyData.iDuration.iTimeUnit ) &&
+        0 == iGetInkeyData.iDuration.iNumOfUnits )
+        {
+        LOG( SIMPLE,
+            "GETINKEY: CGetInkeyHandler::CommandAllowed invalid duration" )
+        allowed = EFalse;
+        }
+
+    // If icon is provided without any text
+    if ( ( 0 == iGetInkeyData.iText.Length() ) &&
+         ( RSat::ENotSelfExplanatory == iGetInkeyData.iIconId.iQualifier ||
+           RSat::ESelfExplanatory == iGetInkeyData.iIconId.iQualifier ) )
+        {
+        LOG( SIMPLE,
+            "GETINKEY: CGetInkeyHandler::CommandAllowed icon w/o alpha id" )
+        allowed = EFalse;
+        }
+    // Set icon command flag whether icon data was received and set qualifier
+    // to no icon id
+    // To be removed when icons are allowed in this command
+    else if ( ( RSat::ESelfExplanatory ==
+        iGetInkeyData.iIconId.iQualifier ) ||
+        ( RSat::ENotSelfExplanatory ==
+        iGetInkeyData.iIconId.iQualifier ) )
+        {
+        LOG( SIMPLE,
+            "GETINKEY: CGetInkeyHandler::CommandAllowed set no icon id" )
+        iIconCommand = ETrue;
+        iGetInkeyData.iIconId.iQualifier = RSat::ENoIconId;
+        }
+    else
+        {
+        iIconCommand = EFalse;
+        }
+
+    if ( !allowed )
+        {
+        LOG( SIMPLE,
+            "GETINKEY: CGetInkeyHandler::CommandAllowed allowed false" )
+        iGetInkeyRsp.iGeneralResult = RSat::KCmdDataNotUnderstood;
+        iGetInkeyRsp.iInfoType = RSat::KNoAdditionalInfo;
+        iGetInkeyRsp.iAdditionalInfo.Zero();        
+        iGetInkeyRsp.SetPCmdNumber( iGetInkeyData.PCmdNumber() );
+        // send terminal response
+        TerminalRsp( RSat::EGetInkey, iGetInkeyRspPckg );   
+        }
+
+    LOG2( SIMPLE, "GETINKEY: CGetInkeyHandler::CommandAllowed exiting,\
+          allowed: %d", allowed )
+    return allowed;
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Need for ui session.
+// -----------------------------------------------------------------------------
+//
+TBool CGetInkeyHandler::NeedUiSession()
+    {
+    LOG( NORMAL, "GETINKEY: CGetInkeyHandler::NeedUiSession calling" )
+
+    // Notify Cover UI if it's supported
+    if ( iUtils->CoverUiSupported() )
+        {
+        LOG( NORMAL, "CGetInkeyHandler::NeedUiSession coverui supported" )
+        TSatCommandData medEventData;
+        medEventData.iPCmdNumber = RSat::EGetInkey;
+        if ( iGetInkeyData.iText.Length() )
+            {
+            LOG( NORMAL, "CGetInkeyHandler::NeedUiSession EAlphaIdProvided" )
+            medEventData.iAlphaId.iStatus = RSat::EAlphaIdProvided;
+            medEventData.iAlphaId.iAlphaId.Copy( iGetInkeyData.iText );
+            }
+        else
+            {
+            medEventData.iAlphaId.iStatus = RSat::EAlphaIdNotPresent;
+            }
+        // Duration not set, use KSatLongDuration    
+        if ( RSat::ETimeUnitNotSet == iGetInkeyData.iDuration.iTimeUnit )
+            {
+            LOG( NORMAL, "CGetInkeyHandler::NeedUiSession Duration not set" )
+            medEventData.iDuration.iTimeUnit = RSat::ESeconds;
+            medEventData.iDuration.iNumOfUnits = KSatLongDuration;
+            }
+        else
+            {
+            medEventData.iDuration = iGetInkeyData.iDuration;
+            }
+            
+        medEventData.iIconID = iGetInkeyData.iIconId;
+        TSatCommandPckg tPckg( medEventData );
+        iUtils->RaiseSatEvent( tPckg );
+        }
+
+    LOG( NORMAL, "GETINKEY: CGetInkeyHandler::NeedUiSession exiting" )
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Called when USAT API notifies that command.
+// -----------------------------------------------------------------------------
+//
+void CGetInkeyHandler::HandleCommand()
+    {
+    LOG( SIMPLE, "GETINKEY: CGetInkeyHandler::HandleCommand calling" )
+
+    iUtils->NotifyEvent( MSatUtils::EGetInkeyExecuting );
+
+    MSatUiSession* uiSession = iUtils->SatUiHandler().UiSession();
+    uiSession->SendCommand(
+        &iGetInkeyPckg,
+        &iGetInkeyRspPckg,
+        ESatSProactiveGetInkey );
+
+    LOG( SIMPLE, "GETINKEY: CGetInkeyHandler::HandleCommand exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Indicates the failure of launching ui client.
+// -----------------------------------------------------------------------------
+//
+void CGetInkeyHandler::UiLaunchFailed()
+    {
+    LOG( SIMPLE, "GETINKEY: CGetInkeyHandler::UiLaunchFailed calling" )
+
+    iGetInkeyRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+    iGetInkeyRsp.iInfoType = RSat::KMeProblem;
+    iGetInkeyRsp.iAdditionalInfo.SetLength( 1 );
+    iGetInkeyRsp.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
+    iGetInkeyRsp.SetPCmdNumber( iGetInkeyData.PCmdNumber() );
+    TerminalRsp( RSat::EGetInkey, iGetInkeyRspPckg );
+
+    LOG( SIMPLE, "GETINKEY: CGetInkeyHandler::UiLaunchFailed exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CGetInkeyHandler::CGetInkeyHandler() :
+    CSatCommandHandler(),
+    iGetInkeyData(),
+    iGetInkeyPckg( iGetInkeyData ),
+    iGetInkeyRsp(),
+    iGetInkeyRspPckg( iGetInkeyRsp ),
+    // To be removed when icons are allowed in this command
+    iIconCommand( EFalse )
+    {
+    LOG( SIMPLE,
+        "GETINKEY: CGetInkeyHandler::CGetInkeyHandler calling - exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CGetInkeyHandler::ConstructL()
+    {
+    LOG( SIMPLE, "GETINKEY: CGetInkeyHandler::ConstructL calling" )
+
+    // Register service request handler for GetInkey command
+    iUtils->RegisterServiceRequestL(
+        ESatSProactiveGetInkey,
+        ESatSProactiveGetInkeyResponse,
+        this );
+
+    LOG( SIMPLE, "GETINKEY: CGetInkeyHandler::ConstructL exiting" )
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/GetInkeyCmd/src/std.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 functions
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    <implementationproxy.h>
+#include    "CGetInkeyHandler.h"
+
+// CONSTANTS
+
+const TImplementationProxy implementationTable[] =
+    {
+    //lint -e{611,1924} Warning "Suspicious cast" can not be avoided.
+    IMPLEMENTATION_PROXY_ENTRY( 0x1000A888, CGetInkeyHandler::NewL )
+    };
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy ECOM framework factory function
+// Calculates the number of implementations.
+// Returns: Implementation proxy.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount ) // Number of implementations
+    {
+    aTableCount =
+        sizeof( implementationTable ) /
+        sizeof( TImplementationProxy );
+    return implementationTable;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/GetInputCmd/group/GetInputCmd.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* 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:  Project definition file for project GetInput plug-in
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../../inc/SatMacroes.h"
+
+TARGET                  GetInputCmd.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D 0x10202985
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  std.cpp
+SOURCE                  CGetInputHandler.cpp
+
+START RESOURCE          10202985.rss
+TARGET                  GetInputCmd.rsc
+END
+
+USERINCLUDE             ../../../inc
+USERINCLUDE             ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+SYSTEMINCLUDE           ../../../../../inc      // Domain telephony
+SYSTEMINCLUDE           ../../../../inc         // Subsystem satengine
+
+LIBRARY                 euser.lib
+LIBRARY                 etelsat.lib
+LIBRARY                 SatEngine.lib
+
+#ifdef ENABLE_SAT_LOGGING
+LIBRARY                 flogger.lib
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/GetInputCmd/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 GetInputCmd plug-in
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+GetInputCmd.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/GetInputCmd/inc/CGetInputHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,140 @@
+/*
+* 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:  GetInput command handler
+*
+*/
+
+
+#ifndef CGETINPUTHANDLER_H
+#define CGETINPUTHANDLER_H
+
+#include <etelsat.h>
+
+#include "CSatCommandHandler.h"
+
+class MSatUtils;
+
+/**
+ *  Command handler for GetInput command.
+ *
+ *  @lib GetInputCmd.lib
+ *  @since S60 v3.0
+ */
+class CGetInputHandler : public CSatCommandHandler
+    {
+
+public:
+
+    static CGetInputHandler* NewL( MSatUtils* aUtils );
+
+    virtual ~CGetInputHandler();
+
+// from base class MSatCommand
+
+    /**
+     * From MSatCommand.
+     * Response from the client.
+     *
+     */
+    void ClientResponse();
+
+protected:
+
+// from base class CActive
+
+    /**
+     * From CActive.
+     * Cancels the usat request.
+     *
+     */
+    void DoCancel();
+
+// from base class CSatCommandHandler
+
+    /**
+     * From CSatCommandHandler.
+     * Requests the command notification.
+     *
+     * @param aStatus Request status
+     */
+    void IssueUSATRequest( TRequestStatus& aStatus );
+
+    /**
+     * From CSatCommandHandler.
+     * Precheck before executing the command.
+     *
+     * @return TBool indicating command is currently allowed.
+     */
+    TBool CommandAllowed();
+
+    /**
+     * From CSatCommandHandler.
+     * Need for ui session.
+     *
+     * @return TBool indicating need of ui session.
+     */
+    TBool NeedUiSession();
+
+    /**
+     * From CSatCommandHandler.
+     * Called when USAT API notifies that command.
+     *
+     */
+    void HandleCommand();
+
+    /**
+     * From CSatCommandHandler.
+     * Indicates the failure of launching ui client.
+     *
+     */
+    void UiLaunchFailed();
+
+private:
+
+    CGetInputHandler();
+
+    void ConstructL();
+
+private: // data
+
+    /**
+     * GetInput command data.
+     */
+    RSat::TGetInputV1 iGetInputData;
+
+    /**
+     * GetInput command package.
+     */
+    RSat::TGetInputV1Pckg iGetInputPckg;
+
+    /**
+     * Response from client.
+     */
+    RSat::TGetInputRspV1 iGetInputRsp;
+
+    /**
+     * Response package.
+     */
+    RSat::TGetInputRspV1Pckg iGetInputRspPckg;
+                
+    /**
+     * Flag to signal that command has icon data
+     * To be removed when icons are allowed in this command
+     */
+    TBool iIconCommand;
+
+    };
+
+#endif      // CGETINPUTHANDLER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/GetInputCmd/inc/GetInputCmd.rls	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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 headers for project GetInputCmd
+*
+*/
+
+
+#ifndef GETINPUTCMD_RLS
+#define GETINPUTCMD_RLS
+
+rls_string STRING_r_getinputcmd_display_name "GetInput Command"
+rls_string STRING_r_getinputcmd_default_data "GetInputCmd"
+rls_string STRING_r_getinputcmd_opaque_data  ""
+
+#endif // GETINPUTCMD_RLS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/GetInputCmd/src/10202985.rss	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 1020 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Registry information for ECOM
+*
+*/
+
+
+
+//  INCLUDES
+#include <registryinfo.rh>
+#include "GetInputCmd.rls"
+
+//  RESOURCE DEFINITIONS
+// -----------------------------------------------------------------------------
+//
+// GetInputCmdInfo
+// Registeration information for ECOM
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO GetInputCmdInfo
+    {
+    dll_uid = 0x10202985;
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x1000f001;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x10202986;
+                    version_no   = 1;
+                    display_name = STRING_r_getinputcmd_display_name;
+                    default_data = STRING_r_getinputcmd_default_data;
+                    opaque_data  = STRING_r_getinputcmd_opaque_data;
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/GetInputCmd/src/CGetInputHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,308 @@
+/*
+* 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:  Handles GetInputCall command
+*
+*/
+
+
+#include    "MSatApi.h"
+#include    "MSatUtils.h"
+#include    "MSatUiSession.h"
+#include    "MSatSystemState.h"
+#include    "SatSOpcodes.h"
+#include    "MSatSUiClientHandler.h"
+#include    "CGetInputHandler.h"
+#include    "SatLog.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CGetInputHandler* CGetInputHandler::NewL( MSatUtils* aUtils )
+    {
+    LOG( SIMPLE, "GETINPUT: CGetInputHandler::NewL calling" )
+
+    CGetInputHandler* self = new( ELeave ) CGetInputHandler;
+
+    CleanupStack::PushL( self );
+    self->BaseConstructL( aUtils );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "GETINPUT: CGetInputHandler::NewL exiting" )
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CGetInputHandler::~CGetInputHandler()
+    {
+    LOG( SIMPLE, "GETINPUT: CGetInputHandler::~CGetInputHandler calling" )
+
+    Cancel();
+
+    LOG( SIMPLE, "GETINPUT: CGetInputHandler::~CGetInputHandler exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// From class MSatCommand.
+// Response from the client.
+// ---------------------------------------------------------------------------
+//
+void CGetInputHandler::ClientResponse()
+    {
+    LOG( SIMPLE, "GETINPUT: CGetInputHandler::ClientResponse calling" )
+
+    iGetInputRsp.SetPCmdNumber( iGetInputData.PCmdNumber() );
+    if ( RSat::KPSessionTerminatedByUser == iGetInputRsp.iGeneralResult )
+        {
+        LOG( SIMPLE, "GETINPUT: CGetInputHandler::ClientResponse close ui \
+             session" )
+        // Next SimSession end will close the ui session
+        iUtils->NotifyEvent( MSatUtils::ESessionTerminatedByUser );
+        }
+        
+    // If command had icon data and was done succesfully, report that icon
+    // was not shown
+    // To be removed when icons are allowed in this command
+    if ( ( RSat::KSuccess == iGetInputRsp.iGeneralResult ) &&
+        iIconCommand )
+        {
+        LOG( SIMPLE, "GETINPUT: CGetInputHandler::ClientResponse requested \
+             icon not displayed" )
+        iGetInputRsp.iGeneralResult =
+                    RSat::KSuccessRequestedIconNotDisplayed;
+        }
+
+    CSatCommandHandler::TerminalRsp( RSat::EGetInput, iGetInputRspPckg );
+
+    LOG( SIMPLE, "GETINPUT: CGetInputHandler::ClientResponse exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CActive.
+// Cancels the sat request.
+// -----------------------------------------------------------------------------
+//
+void CGetInputHandler::DoCancel()
+    {
+    LOG( SIMPLE, "GETINPUT: CGetInputHandler::DoCancel calling" )
+
+    iUtils->USatAPI().NotifyGetInputCancel();
+
+    LOG( SIMPLE, "GETINPUT: CGetInputHandler::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Requests the command notification.
+// -----------------------------------------------------------------------------
+//
+void CGetInputHandler::IssueUSATRequest( TRequestStatus& aStatus )
+    {
+    LOG( SIMPLE, "GETINPUT: CGetInputHandler::IssueUSATRequest calling" )
+
+    // Clear the IPC package.
+    new (&iGetInputData) RSat::TGetInputV1();
+    iGetInputRsp.iGeneralResult = RSat::KPSessionTerminatedByUser; // default
+
+    iUtils->USatAPI().NotifyGetInput( aStatus, iGetInputPckg );
+
+    LOG( SIMPLE, "GETINPUT: CGetInputHandler::IssueUSATRequest exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Precheck before executing the command.
+// -----------------------------------------------------------------------------
+//
+TBool CGetInputHandler::CommandAllowed()
+    {
+    LOG( SIMPLE, "GETINPUT: CGetInputHandler::CommandAllowed calling" )
+
+    //Is This command Allowed.
+    TBool response( ETrue );
+
+     // If icon is provided without any text
+    if ( ( 0 == iGetInputData.iText.Length() ) &&
+        ( RSat::ENotSelfExplanatory == iGetInputData.iIconId.iQualifier ||
+          RSat::ESelfExplanatory == iGetInputData.iIconId.iQualifier ) )
+        {
+        LOG( SIMPLE,
+            "GETINPUT: CGetInputHandler::CommandAllowed icon without text" )
+        iGetInputRsp.iGeneralResult = RSat::KCmdDataNotUnderstood;
+        iGetInputRsp.iInfoType = RSat::KNoAdditionalInfo;
+        iGetInputRsp.iAdditionalInfo.Zero();
+        response = EFalse;
+        }
+    // Check if phone is busy on calling and send response
+    // to SIM if phone is busy.
+    else if ( iUtils->SystemState().IsCallIncoming() )
+        {
+        LOG( SIMPLE,
+            "GETINPUT: CGetInputHandler::CommandAllowed busy or calling" )
+        // By default, this command does not have additional information
+        // except in this case when phone is busy on calling
+        iGetInputRsp.iInfoType = RSat::KMeProblem;
+        iGetInputRsp.iAdditionalInfo.Zero();
+        iGetInputRsp.iAdditionalInfo.Append( RSat::KMeBusyOnCall );
+        iGetInputRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+        // This command will not be allowed for now.
+        response = EFalse;
+        }
+    // Set icon command flag whether icon data was received and set qualifier
+    // to no icon id
+    // To be removed when icons are allowed in this command
+    else if ( ( RSat::ESelfExplanatory ==
+        iGetInputData.iIconId.iQualifier ) ||
+        ( RSat::ENotSelfExplanatory ==
+        iGetInputData.iIconId.iQualifier ) )
+        {
+        LOG( SIMPLE,
+            "GETINPUT: CGetInputHandler::CommandAllowed set no icon id" )
+        iIconCommand = ETrue;
+        iGetInputData.iIconId.iQualifier = RSat::ENoIconId;
+        }
+    else
+        {
+        iIconCommand = EFalse;
+        }
+
+    if ( !response )
+        {
+         LOG( SIMPLE,
+            "GETINPUT: CGetInputHandler::CommandAllowed response false" )
+        iGetInputRsp.SetPCmdNumber( iGetInputData.PCmdNumber() );
+        TerminalRsp( RSat::EGetInput, iGetInputRspPckg );
+        }
+
+    LOG2( SIMPLE, "GETINPUT: CGetInputHandler::CommandAllowed exiting,\
+          response: %d", response )
+    return response;
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Need for ui session.
+// -----------------------------------------------------------------------------
+//
+TBool CGetInputHandler::NeedUiSession()
+    {
+    LOG( NORMAL, "GETINPUT: CGetInputHandler::NeedUiSession calling" )
+    // Notify Cover UI if it's supported
+    if ( iUtils->CoverUiSupported() )
+        {
+        LOG( NORMAL, "CGetInputHandler::NeedUiSession coverui supported" )
+        TSatCommandData medEventData;
+        medEventData.iPCmdNumber = RSat::EGetInput;
+        if ( iGetInputData.iText.Length() )
+            {
+            LOG( NORMAL, "CGetInputHandler::NeedUiSession EAlphaIdProvided" )
+            medEventData.iAlphaId.iStatus = RSat::EAlphaIdProvided;
+            medEventData.iAlphaId.iAlphaId.Copy( iGetInputData.iText );
+            }
+        else
+            {
+            medEventData.iAlphaId.iStatus = RSat::EAlphaIdNotPresent;
+            }
+        medEventData.iDuration.iNumOfUnits = KSatDefaultDuration;
+        medEventData.iDuration.iTimeUnit = RSat::ESeconds;
+        medEventData.iIconID = iGetInputData.iIconId;
+        TSatCommandPckg tPckg( medEventData );
+        iUtils->RaiseSatEvent( tPckg );
+        }
+    LOG( NORMAL, "GETINPUT: CGetInputHandler::NeedUiSession exiting" )
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Called when USAT API notifies that command.
+// -----------------------------------------------------------------------------
+//
+void CGetInputHandler::HandleCommand()
+    {
+    LOG( SIMPLE, "GETINPUT: CGetInputHandler::HandleCommand calling" )
+
+    // Send the response
+    iUtils->NotifyEvent( MSatUtils::EGetInputExecuting );
+
+    MSatUiSession* uiSession = iUtils->SatUiHandler().UiSession();
+    uiSession->SendCommand(
+        &iGetInputPckg,
+        &iGetInputRspPckg,
+        ESatSProactiveGetInput );
+
+    LOG( SIMPLE, "GETINPUT: CGetInputHandler::HandleCommand exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Indicates the failure of launching ui client.
+// -----------------------------------------------------------------------------
+//
+void CGetInputHandler::UiLaunchFailed()
+    {
+    LOG( SIMPLE, "GETINPUT: CGetInputHandler::UiLaunchFailed calling" )
+
+    iGetInputRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+    iGetInputRsp.iInfoType = RSat::KMeProblem;
+    iGetInputRsp.iAdditionalInfo.SetLength( 1 );
+    iGetInputRsp.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
+    iGetInputRsp.SetPCmdNumber( iGetInputData.PCmdNumber() );
+    TerminalRsp( RSat::EGetInput, iGetInputRspPckg );
+
+    LOG( SIMPLE, "GETINPUT: CGetInputHandler::UiLaunchFailed exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CGetInputHandler::CGetInputHandler() :
+    CSatCommandHandler(),
+    iGetInputData(),
+    iGetInputPckg( iGetInputData ),
+    iGetInputRsp(),
+    iGetInputRspPckg( iGetInputRsp ),
+    // To be removed when icons are allowed in this command
+    iIconCommand( EFalse )
+    {
+    LOG( SIMPLE,
+        "GETINPUT: CGetInputHandler::CGetInputHandler calling - exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CGetInputHandler::ConstructL()
+    {
+    LOG( SIMPLE, "GETINPUT: CGetInputHandler::ConstructL calling" )
+
+    // Register service request handler for GetInput command
+    iUtils->RegisterServiceRequestL(
+        ESatSProactiveGetInput,
+        ESatSProactiveGetInputResponse,
+        this );
+
+    LOG( SIMPLE, "GETINPUT: CGetInputHandler::ConstructL exiting" )
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/GetInputCmd/src/std.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 functions
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    <implementationproxy.h>
+#include    "CGetInputHandler.h"
+
+// CONSTANTS
+
+const TImplementationProxy implementationTable[] =
+    {
+    //lint -e{611,1924} Warning "Suspicious cast" can not be avoided.
+    IMPLEMENTATION_PROXY_ENTRY( 0x10202986, CGetInputHandler::NewL )
+    };
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy ECOM framework factory function
+// Calculates the number of implementations.
+// Returns: Implementation proxy.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount ) // Number of implementations
+    {
+    aTableCount =
+        sizeof( implementationTable ) /
+        sizeof( TImplementationProxy );
+    return implementationTable;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/LanguageNotificationCmd/group/LanguageNotificationCmd.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* 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:  Project definition file for project LanguageNotificationCmd
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../../inc/SatMacroes.h"
+
+TARGET                  LanguageNotificationCmd.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D 0x101F79FE
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  std.cpp
+SOURCE                  CLanguageNotificationHandler.cpp
+
+START RESOURCE          101F79FE.rss
+TARGET                  LanguageNotificationCmd.rsc
+END // RESOURCE
+
+USERINCLUDE             ../../../inc
+USERINCLUDE             ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+SYSTEMINCLUDE           ../../../../../inc      // Domain telephony
+SYSTEMINCLUDE           ../../../../inc         // Subsystem satengine
+
+LIBRARY                 euser.lib
+LIBRARY                 etelsat.lib
+LIBRARY                 SatEngine.lib
+
+#ifdef ENABLE_SAT_LOGGING
+LIBRARY                 flogger.lib
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/LanguageNotificationCmd/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* 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:  Build information file for project LanguageNotificationCmd plug-in
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+LanguageNotificationCmd.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/LanguageNotificationCmd/inc/CLanguageNotificationHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,120 @@
+/*
+* 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:  Launguage Notification command handler
+*
+*/
+
+
+#ifndef CLANGUAGENOTIFICATIONHANDLER_H
+#define CLANGUAGENOTIFICATIONHANDLER_H
+
+//  INCLUDES
+#include <etelsat.h>
+#include "CSatCommandHandler.h"
+#include "SatSTypes.h"
+
+// FORWARD DECLARATION
+class MSatUtils;
+
+// CLASS DECLARATION
+
+/**
+*  Command handler for Language Notification command.
+*
+*  @lib CLanguageNotificationHandler.lib
+*  @since Series 60 3.0
+*/
+class CLanguageNotificationHandler : public CSatCommandHandler
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aUtils Utils interface
+        */
+        static CLanguageNotificationHandler* NewL( MSatUtils* aUtils );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CLanguageNotificationHandler();
+
+    public: // Functions from base classes
+
+        /**
+        * From MSatCommand.
+        */
+        void ClientResponse(){};
+
+    protected:  // Functions from base classes
+
+        /**
+        * From CActive Cancels the usat request.
+        */
+        void DoCancel();
+
+        /**
+        * From CSatCommandHandler Requests the command notification.
+        * @param aStatus Request status to active object notification
+        */
+        void IssueUSATRequest( TRequestStatus& aStatus );
+
+        /**
+        * From CSatCommandHandler Precheck before executing the command.
+        * @return Boolean indicating is this command allowed to execute.
+        */
+        TBool CommandAllowed();
+
+        /**
+        * From CSatCommandHandler Need for ui session.
+        * @return Boolean indicating does this command need UI session.
+        */
+        TBool NeedUiSession();
+
+        /**
+        * From CSatCommandHandler Called when USAT API notifies that command.
+        */
+        void HandleCommand();
+
+        /**
+        * From CSatCommandHandler. Indicates the failure of launching ui client
+        */
+        void UiLaunchFailed(){};
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CLanguageNotificationHandler();
+
+    private:    // Data
+
+        // The data structure for the command data
+        RSat::TLanguageNotificationV2 iLanguageNotify;
+
+        // The data package for IPC
+        RSat::TLanguageNotificationV2Pckg iLanguageNotifyPckg;
+
+        // The response.
+        RSat::TLanguageNotificationRspV2 iLanguageNotifyRsp;
+
+        // The response package.
+        RSat::TLanguageNotificationRspV2Pckg iLanguageNotifyRspPckg;
+
+    };
+
+#endif      // CLANGUAGENOTIFICATIONHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/LanguageNotificationCmd/inc/LanguageNotificationCmd.rls	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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 headers for project LanguageNotificationCmd
+*
+*/
+
+
+#ifndef LANGUAGENOTIFICATIONCMD_RLS
+#define LANGUAGENOTIFICATIONCMD_RLS
+
+rls_string STRING_r_languagenotificationcmd_display_name "Language notification"
+rls_string STRING_r_languagenotificationcmd_default_data "LanguageNotificationCmd"
+rls_string STRING_r_languagenotificationcmd_opaque_data  ""
+
+#endif // LANGUAGENOTIFICATIONCMD_RLS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/LanguageNotificationCmd/src/101F79FE.rss	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Registry information for ECOM
+*
+*/
+
+
+
+//  INCLUDES
+#include <registryinfo.rh>
+#include "LanguageNotificationCmd.rls"
+
+//  RESOURCE DEFINITIONS
+// -----------------------------------------------------------------------------
+//
+// LanguageNotificationInfo
+// Registeration information for ECOM
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO LanguageNotificationInfo
+    {
+    dll_uid = 0x101F79FE;
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x1000f001;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x101F79FF;
+                    version_no   = 1;
+                    display_name = STRING_r_languagenotificationcmd_display_name;
+                    default_data = STRING_r_languagenotificationcmd_default_data;
+                    opaque_data  = STRING_r_languagenotificationcmd_opaque_data;
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/LanguageNotificationCmd/src/CLanguageNotificationHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -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:  Handles CLanguageNotification command
+*
+*/
+
+
+// INCLUDE FILES
+#include    "MSatApi.h"
+#include    "MSatUtils.h"
+#include    "MSatUiSession.h"
+#include    "MSatSystemState.h"
+#include    "SatSOpcodes.h"
+#include    "MSatSUiClientHandler.h"
+#include    "CLanguageNotificationHandler.h"
+#include    "SatLog.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CLanguageNotificationHandler::CLanguageNotificationHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CLanguageNotificationHandler::CLanguageNotificationHandler() :
+    CSatCommandHandler(),
+    iLanguageNotify(),
+    iLanguageNotifyPckg( iLanguageNotify ),
+    iLanguageNotifyRsp(),
+    iLanguageNotifyRspPckg( iLanguageNotifyRsp )
+    {
+    LOG( SIMPLE, "LangNotify: CLanguageNotificationHandler:: \
+        CLanguageNotificationHandler calling-exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CLanguageNotificationHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CLanguageNotificationHandler* CLanguageNotificationHandler::NewL(
+MSatUtils* aUtils )
+    {
+    LOG( SIMPLE, "LangNotify: CLanguageNotificationHandler::NewL calling" )
+    CLanguageNotificationHandler* self = new( ELeave ) CLanguageNotificationHandler;
+
+    CleanupStack::PushL( self );
+    self->BaseConstructL( aUtils );
+    // ConstructL not needed.
+    CleanupStack::Pop( self );
+    LOG( SIMPLE, "LangNotify: CLanguageNotificationHandler::NewL exiting" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CLanguageNotificationHandler::~CLanguageNotificationHandler
+// Destructor.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CLanguageNotificationHandler::~CLanguageNotificationHandler()
+    {
+    LOG( SIMPLE,
+        "LangNotify: CLanguageNotificationHandler:: \
+        ~CLanguageNotificationHandler() calling" )
+
+    Cancel();
+
+    LOG( SIMPLE,
+        "LangNotify: CLanguageNotificationHandler:: \
+        ~CLanguageNotificationHandler() exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CLanguageNotificationHandler::DoCancel
+// Cancels the sat request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CLanguageNotificationHandler::DoCancel()
+    {
+    LOG( SIMPLE,
+        "LangNotify: CLanguageNotificationHandler::DoCancel calling" )
+
+    iUtils->USatAPI().NotifyLanguageNotificationCancel();
+
+    LOG( SIMPLE,
+        "LangNotify: CLanguageNotificationHandler::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CLanguageNotificationHandler::IssueUSATRequest
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CLanguageNotificationHandler::IssueUSATRequest( TRequestStatus& aStatus )
+    {
+    LOG( SIMPLE,
+        "LangNotify: CLanguageNotificationHandler::IssueUSATRequest calling" )
+
+    // Clear the IPC package.
+    new (&iLanguageNotify) RSat::TLanguageNotificationV2();
+
+    iUtils->USatAPI().NotifyLanguageNotification(
+        aStatus,
+        iLanguageNotifyPckg );
+
+    LOG( SIMPLE,
+        "LangNotify: CLanguageNotificationHandler::IssueUSATRequest exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CLanguageNotificationHandler::CommandAllowed
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CLanguageNotificationHandler::CommandAllowed()
+    {
+    LOG( SIMPLE, "LangNotify: \
+        CLanguageNotificationHandler::CommandAllowed calling-exiting" )
+    // By default, this is true
+    // There is never any reason to disallow this
+    // command, even if an error occurs.
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CLanguageNotificationHandler::NeedUiSession
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CLanguageNotificationHandler::NeedUiSession()
+    {
+    LOG( SIMPLE, "LangNotify: CLanguageNotificationHandler::NeedUiSession \
+        calling-exiting" )
+    // The UI is not needed by this command.
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CLanguageNotificationHandler::HandleCommand
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CLanguageNotificationHandler::HandleCommand()
+    {
+    LOG( SIMPLE,
+        "LangNotify: CLanguageNotificationHandler::HandleCommand calling" )
+
+    // Just OK the request and send a response.
+    iLanguageNotifyRsp.iInfoType = RSat::KNoAdditionalInfo;
+    iLanguageNotifyRsp.iAdditionalInfo.Zero();
+    iLanguageNotifyRsp.iGeneralResult = RSat::KSuccess;
+    iLanguageNotifyRsp.SetPCmdNumber( iLanguageNotify.PCmdNumber() );
+
+    TerminalRsp( RSat::ELanguageNotification, iLanguageNotifyRspPckg );
+
+    LOG( SIMPLE,
+        "LangNotify: CLanguageNotificationHandler::HandleCommand exiting" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/LanguageNotificationCmd/src/std.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 functions
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    <implementationproxy.h>
+#include    "CLanguageNotificationHandler.h"
+
+// CONSTANTS
+
+const TImplementationProxy implementationTable[] =
+    {
+    //lint -e{611,1924} Warning "Suspicious cast" can not be avoided.
+    IMPLEMENTATION_PROXY_ENTRY( 0x101F79FF, CLanguageNotificationHandler::NewL )
+    };
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy ECOM framework factory function
+// Calculates the number of implementations.
+// Returns: Implementation proxy.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount ) // Number of implementations
+    {
+    aTableCount =
+        sizeof( implementationTable ) /
+        sizeof( TImplementationProxy );
+    return implementationTable;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/LaunchBrowserCmd/group/LaunchBrowserCmd.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,56 @@
+/*
+* 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:  Project definition file for project LaunchBrowser plug-in
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../../inc/SatMacroes.h"
+
+TARGET                  LaunchBrowserCmd.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D 0x1000A88D
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  std.cpp
+SOURCE                  CLaunchBrowserHandler.cpp
+
+START RESOURCE          1000A88D.rss
+TARGET                  LaunchBrowserCmd.rsc
+END
+
+USERINCLUDE             ../../../inc
+USERINCLUDE             ../inc
+
+// Application layer system include is needed due CR provided by Browser
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+SYSTEMINCLUDE           ../../../../../inc      // Domain telephony
+SYSTEMINCLUDE           ../../../../inc         // Subsystem satengine
+
+LIBRARY                 euser.lib
+LIBRARY                 etelsat.lib
+LIBRARY                 SatEngine.lib
+LIBRARY                 ws32.lib                // RWsSession
+LIBRARY                 apgrfx.lib              // CApaCommandLine
+LIBRARY                 cmmanager.lib
+
+#ifdef ENABLE_SAT_LOGGING
+LIBRARY                 flogger.lib
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/LaunchBrowserCmd/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 LaunchBrowserCmd plug-in
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+LaunchBrowserCmd.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/LaunchBrowserCmd/inc/CLaunchBrowserHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,381 @@
+/*
+* 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:  LaunchBrowser command handler
+*
+*/
+
+
+#ifndef CLAUNCHBROWSERHANDLER_H
+#define CLAUNCHBROWSERHANDLER_H
+
+#include <etelsat.h>
+#include <etelpckt.h>
+#include <w32std.h>             // WsSession
+#include <apgtask.h>            // TApaTask
+#include <DocumentHandler.h>    // KWmlcHandler
+
+#include "CSatCommandHandler.h"
+#include "SatSTypes.h"          // TSatQuery
+
+class MSatUtils;
+class RCmManager;
+class RCmConnectionMethod;
+
+/**
+ *  Command handler for LaunchBrowser command.
+ *
+ *  @lib LaunchBrowserCmd.lib
+ *  @since S60 v3.0
+ */
+class CLaunchBrowserHandler : public CSatCommandHandler
+    {
+    
+public:
+
+    static CLaunchBrowserHandler* NewL( MSatUtils* aUtils );
+
+    virtual ~CLaunchBrowserHandler();
+
+// from base class MSatCommand
+
+    /**
+     * From MSatCommand.
+     * Response from the client.
+     *
+     */
+    void ClientResponse();
+
+// from base class CSatCommandHandler
+
+    /**
+     * From CSatCommandHandler.
+     * Event notification.
+     *
+     * @param aEvent An event that is occured.
+     */
+    void Event( TInt aEvent );
+
+protected:
+
+// from base class CActive
+
+    /**
+     * From CActive.
+     * Cancels the usat request.
+     *
+     */
+    void DoCancel();
+    
+// from base class CSatCommandHandler
+
+    /**
+     * From CSatCommandHandler.
+     * Requests the command notification.
+     *
+     * @param aStatus Request status
+     */
+    void IssueUSATRequest( TRequestStatus& aStatus );
+
+    /**
+     * From CSatCommandHandler.
+     * Precheck before executing the command.
+     *
+     * @return TBool indicating command is currently allowed.
+     */
+    TBool CommandAllowed();
+
+    /**
+     * From CSatCommandHandler.
+     * Need for ui session.
+     *
+     * @return TBool indicating need of ui session.
+     */
+    TBool NeedUiSession();
+
+    /**
+     * From CSatCommandHandler.
+     * Called when USAT API notifies that command.
+     *
+     */
+    void HandleCommand();
+
+    /**
+     * From CSatCommandHandler.
+     * Indicates the failure of launching ui client.
+     *
+     */
+    void UiLaunchFailed();
+
+private:
+
+    CLaunchBrowserHandler();
+
+    void ConstructL();
+
+    /**
+     * Checks if Browser application is launched.
+     *
+     * @return The result of the operation.
+     */
+    TBool BrowserExists();
+
+    /**
+     * Closes the Browser application if it is active.
+     *
+     * @return The result of the operation.
+     */
+    void CloseBrowser();
+
+    /**
+     * Launches The Browser with URL.
+     *
+     * @param aParam, Reference to the parameter for the Browser
+     * application.
+     * @param aAccessPointUid, Reference to the accesspoint uid.
+     */
+    void LaunchWithUrlL( 
+        const TDesC& aParam,
+        const TUid& aAccessPointUid );
+
+    /**
+     * Handle the Launch Browser command.
+     *
+     */
+    void LaunchBrowserL();
+
+    /**
+     * Starts timer. Function returns as the given time has elapsed or
+     * timer is cancelled.
+     *
+     * @param aDelay Delay from the function call to complete function in
+     *               microseconds
+     * @param aInterval Interval to complete wait after aDelay, zero by
+     *                  default
+     */
+    void After(
+        const TTimeIntervalMicroSeconds32& aDelay,
+        const TTimeIntervalMicroSeconds32& aInterval = 0 );
+
+    /**
+     * Called after given delay in After function.
+     * Causes the After function to complete
+     *
+     * @param aPtr Pointer to itself since this is static function
+     * @return whether to call function again after an interval
+     */
+    static TInt DelayCallBack( TAny* aPtr );
+
+    /**
+     * Create a new APN with given parameters using Access Point engine.
+     *
+     * @param aApName APN name.
+     * @param aProxyServerAddr Proxy/Gateway server address.
+     * @param aProxyPortNumber Proxy server port number.
+     * @param aIPvType Gateway address IP type.
+     *
+     * @return the ID for the new APN
+     */
+    TUint32 CreateAccessPointL( const TDesC16& aApName,
+        const TDesC16& aProxyServerAddr,
+        const TUint32 aProxyPortNumber,
+        const RPacketContext::TProtocolType& aIPvType );
+
+    /**
+     * Select an Access Point by the given gateway address. Create one if
+     * there is not a corresponding AP.
+     * 
+     * @return IAP id from GCF connection method.
+     */
+    TUint32 GetAccessPointByGatewayAddressL();
+    
+    /**
+     * Get an Access Point by default.
+     *
+     * @return IAP id from default connection method.
+     */ 
+    TUint32 GetAccessPointByDefaultL();
+
+    /**
+     * Get default Url by access point id.
+     *
+     * @param aApId Input IAP id by given connection method.
+     * @return Default Url by given connection method.
+     */    
+    HBufC* GetDefaultUrlByAccessPointLC( TUint32 aApId );
+
+    /**
+     * A gateway address is required to be a IP address in 
+     * connection method, so it is necessary to check 
+     * the validity of the gateway address to avioding leave in
+     * APE.
+     *
+     * @param aAddress A gateway address.
+     * @return EIPv4 if the gateway address is a valid IPv4 address.
+     *         EIPv6 if the gateway address is a valid IPv6 address.
+     *         otherwise return 0 to indicate a invalid IP address.
+     */
+    TInt ValidateGatewayAddress( const TDesC16& aAddress );
+
+    /**
+     * Check the validity of a IPv4 address.
+     *
+     * @param aAddress A IPv4 address.
+     * @return ETrue if the address is a valid IPv4 address.
+     */
+    TBool ValidateIPv4Address( const TDesC16& aAddress );
+
+    /**
+     * Check the validity of a IPv6 address.
+     *
+     * @param aAddress A IPv6 address.
+     * @return ETrue if the address is a valid IPv6 address.
+     */
+    TBool ValidateIPv6Address( const TDesC16& aAddress );
+
+    /**
+     * Convert a descriptor to a integer.
+     *
+     * @param aAddress A descriptor.
+     * @return Integer value.
+     */
+    TInt ConvertDesToInt( const TDesC16& aValue );
+         
+    /**
+     * Check the validity of a descriptor in hex.
+     *
+     * @param aAddress A descriptor.
+     * @return ETrue if each character in the descriptor is a valid 
+     *         hexadecimal.
+     */
+    TBool ValidateHexadecimal( const TDesC16& aHex );
+        
+    /**
+     * Separate the port number from a address if it is existing. For example, 
+     * 210.13.246.172:8080.
+     *
+     * @param aAddress A address.
+     * @param aPureAddr The pure address without any additional info.
+     * @param aPortNumber The port number.
+     * @return None.
+     */
+    void SeparatePortNumberFromAddress( const TDesC16& aAddress, 
+        TDes16& aPureAddr, TUint32& aPortNumber );
+         
+    /**
+     * Fulfill connecion method with default params.
+     *
+     * @param aCmManager Connection method manager.
+     * @param aCm Output reference to RCmConnectionMethod.
+     * @return None
+     */    
+    void FulfillConnnectionMethodL( RCmManager& aCmManager,
+                                    RCmConnectionMethod& aCm );
+   
+    /**
+     * Check the validity of offered bearer type
+     *
+     * @param aCm reference to RCmConnectionMethod.
+     * @param aIsValid Output KErrNone if connection method is valid.
+     * @return None
+     */     
+    void ValidateBearerTypeL( RCmConnectionMethod& aCm, TInt& aIsValid );
+    
+    /**
+     * Get default connection method.
+     *
+     * @param aCmManager Input Connection method manager.
+     * @param aDefCm Output reference to RCmConnectionMethod.
+     * @param aIsValid Output KErrNone if found
+     * @return None
+     */       
+    void GetDefConnMethodL( RCmManager& aCmManager,
+                            RCmConnectionMethod& aDefCm,
+                            TInt& aIsValid );  
+    
+private: // data
+
+    /**
+     * LaunchBrowser command data.
+     */
+    RSat::TLaunchBrowserV2 iLaunchBrowserData;
+
+    /**
+     * LaunchBrowser command package.
+     */
+    RSat::TLaunchBrowserV2Pckg iLaunchBrowserPckg;
+
+    /**
+     * Response from client
+     */
+    RSat::TLaunchBrowserRspV2 iLaunchBrowserRsp;
+
+    /**
+     * Response package.
+     */
+    RSat::TLaunchBrowserRspV2Pckg iLaunchBrowserRspPckg;
+
+    /**
+     * Query command data
+     */
+    TSatQueryV1 iQueryData;
+
+    /**
+     * Query package
+     */
+    TSatQueryV1Pckg iQueryPckg;
+
+    /**
+     * Query response
+     */
+    TSatQueryRspV1 iQueryRsp;
+
+    /**
+     * Query response package
+     */
+    TSatQueryRspV1Pckg iQueryRspPckg;
+
+    /**
+     * Window server session
+     */
+    RWsSession iWsSession;
+
+    /**
+     * Application UID of the Browser.
+     */
+    TUid iUidWmlBrowser;
+
+    /**
+     * Indicates does this command need UI session ot not
+     */
+    TBool iNeedUiSession;
+
+    /**
+     * Blocker for After
+     */
+    CActiveSchedulerWait iAfterWait;
+
+    /**
+     * Timer used in After
+     */
+    CPeriodic* iAfterTimer;
+                
+    /**
+     * Flag to signal that command has icon data
+     * To be removed when icons are allowed in this command
+     */
+    TBool iIconCommand;
+    };
+
+#endif      // CLAUNCHBROWSERHANDLER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/LaunchBrowserCmd/inc/LaunchBrowserCmd.rls	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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 headers for project LaunchBrowserCmd
+*
+*/
+
+
+#ifndef LAUNCHBROWSERCMD_RLS
+#define LAUNCHBROWSERCMD_RLS
+
+rls_string STRING_r_launchbrowsercmd_display_name "LaunchBrowser command"
+rls_string STRING_r_launchbrowsercmd_default_data "LaunchBrowserCmd"
+rls_string STRING_r_launchbrowsercmd_opaque_data  ""
+
+#endif // LAUNCHBROWSERCMD_RLS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/LaunchBrowserCmd/src/1000A88D.rss	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 1000 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Registry information for ECOM
+*
+*/
+
+
+
+//  INCLUDES
+#include <registryinfo.rh>
+#include "LaunchBrowserCmd.rls"
+
+//  RESOURCE DEFINITIONS
+// -----------------------------------------------------------------------------
+//
+// LaunchBrowserCmdInfo
+// Registeration information for ECOM
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO LaunchBrowserCmdInfo
+    {
+    dll_uid = 0x1000A88D;
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x1000f001;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x1000A88E;
+                    version_no   = 1;
+                    display_name = STRING_r_launchbrowsercmd_display_name;
+                    default_data = STRING_r_launchbrowsercmd_default_data;
+                    opaque_data  = STRING_r_launchbrowsercmd_opaque_data;
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/LaunchBrowserCmd/src/CLaunchBrowserHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,1967 @@
+/*
+* 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:  Handles LaunchBrowser command
+*
+*/
+
+
+
+#include    <MSatShellController.h>
+#include    <cmmanager.h>
+#include    <cmconnectionmethod.h>
+#include    <cmconnectionmethoddef.h>
+#include    <cmpluginpacketdatadef.h>
+#include    <cmdestination.h>
+
+#include    "MSatApi.h"
+#include    "MSatUtils.h"
+#include    "MSatUiSession.h"
+#include    "SatSOpcodes.h"
+#include    "MSatSUiClientHandler.h"
+#include    "CLaunchBrowserHandler.h"
+#include    "SatLog.h"
+#include    "MSatSystemState.h"
+
+// The pause constant for checking if BrowserApp has exited.
+// This value may be adjusted to ensure the time sequence
+const TInt KSatSShortLoopTimeout = 800000; //0.8 sec
+
+// How many times the browser status is checked, when waiting for
+// browser shutdown. Total time
+// used to check the exiting of browser app is
+// KSatSWaitCount * KSatSShortLoopTimeout.
+const TInt KSatSWaitCount = 10;
+
+// Invalid PDP type
+const TInt KSatInvalidPdpType = -1;
+
+#ifdef _DEBUG
+// Class name for error information.
+//lint -e752 Accessed in __ASSERT_DEBUG, but lint will not notice it.
+_LIT( KLaunchBrowserHandlerName, "CLaunchBrowserHandler" );
+#endif
+
+const TInt KSatMaxIPv4AddressLength( 15 );
+const TInt KSatMaxIPv6AddressLength( 39 );
+const TInt KSatMinIPv4AddressLength( 7 );
+const TInt KSatMinIPv6AddressLength( 7 );
+const TInt KSatMaxIPv4SegmentCounter( 3 );
+const TInt KSatMaxIPv4SegmentLength( 3 );
+const TInt KSatIPv4Broadcast( 255 );
+const TInt KSatIPv4Network( 0 );
+const TInt KSatMaxIPv6SegmentCounter( 7 );
+const TInt KSatMaxIPv6SegmentLength( 4 );
+const TUint32 KSatLaunchBrowserProxyPortNumber( 80 );
+const TUint32 KSatMaxProxyPortNumber( 9999 );
+const TUint32 KSatMinProxyPortNumber( 0 );
+// Granularity for getting connection methods from CM session
+const TUint32 KSatCMGranularity( 5 );
+
+_LIT( KSatAccessPointName, "SAT Launch Browser" );
+_LIT( KSatGprsAccessPointName, "internet" );
+_LIT( KSatIPv4Delimiter, "." );
+_LIT( KSatIPv6Delimiter, ":" );
+
+// ======== MEMBER FUNCTIONS ========
+// -----------------------------------------------------------------------------
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CLaunchBrowserHandler* CLaunchBrowserHandler::NewL( MSatUtils* aUtils )
+    {
+    LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::NewL calling" )
+
+    CLaunchBrowserHandler* self = new( ELeave ) CLaunchBrowserHandler;
+
+    CleanupStack::PushL( self );
+    self->BaseConstructL( aUtils );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::NewL exiting" )
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CLaunchBrowserHandler::~CLaunchBrowserHandler()
+    {
+    LOG( SIMPLE,
+        "LAUNCHBROWSER: CLaunchBrowserHandler::~CSatSLaunchBrowserHandler \
+        calling" )
+
+    if ( iAfterWait.IsStarted() )
+        {
+        iAfterWait.AsyncStop();
+        }
+
+    if ( iAfterTimer )
+        {
+        iAfterTimer->Cancel();
+        delete iAfterTimer;
+        iAfterTimer = NULL;
+        }
+
+    iWsSession.Close();
+
+    Cancel();
+
+    LOG( SIMPLE,
+        "LAUNCHBROWSER: CLaunchBrowserHandler::~CSatSLaunchBrowserHandler \
+        exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class MSatCommand.
+// Response from the client.
+// -----------------------------------------------------------------------------
+//
+void CLaunchBrowserHandler::ClientResponse()
+    {
+    LOG( SIMPLE,
+        "LAUNCHBROWSER: CLaunchBrowserHandler::ClientResponse calling" )
+
+    // TPCmdResult
+    iLaunchBrowserRsp.iGeneralResult = RSat::KLaunchBrowserError;
+
+    // TAdditionalInfoType
+    iLaunchBrowserRsp.iInfoType = RSat::KNoAdditionalInfo;
+    iLaunchBrowserRsp.iAdditionalInfo.Zero();
+    iLaunchBrowserRsp.SetPCmdNumber( iLaunchBrowserData.PCmdNumber() );
+
+    // Perform the action that we just queried the user for.
+    if ( iQueryRsp.iAccepted )
+        {
+        // Launch the Browser.
+        TRAPD( err, LaunchBrowserL() );
+        if ( KErrNone != err )
+            {
+            iLaunchBrowserRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+            LOG2( SIMPLE, "LAUNCHBROWSER: \
+                CLaunchBrowserHandler::ClientResponse error: %i", err )
+            }
+        else
+            {
+            LOG( SIMPLE,
+                "LAUNCHBROWSER: CLBH::CR ESetUpMenuRequested registered" )
+            TRAP_IGNORE( iUtils->RegisterL(
+                this, MSatUtils::ESetUpMenuRequested ) )
+            }
+        }
+    else // User denied this action
+        {
+        iLaunchBrowserRsp.iGeneralResult = RSat::KPCmdNotAcceptedByUser;
+        LOG( SIMPLE, "LAUNCHBROWSER: \
+            CLaunchBrowserHandler::ClientResponse not accepted" )
+        if ( iQueryRsp.iSessionTerminatedByUser )
+            {
+            LOG( SIMPLE, "LAUNCHBROWSER: \
+                 CLaunchBrowserHandler::ClientResponse close ui session" )
+            // Next SimSession end will close the ui session
+            iUtils->NotifyEvent( MSatUtils::ESessionTerminatedByUser );
+            }
+        }
+        
+    // If command had icon data and was done succesfully, report that icon
+    // was not shown
+    // To be removed when icons are allowed in this command
+    if ( ( RSat::KSuccess == iLaunchBrowserRsp.iGeneralResult ) &&
+        iIconCommand )
+        {
+        LOG( SIMPLE, "LAUNCHBROWSER: \
+                 CLaunchBrowserHandler::ClientResponse icon not display" )
+        iLaunchBrowserRsp.iGeneralResult =
+            RSat::KSuccessRequestedIconNotDisplayed;
+        }
+
+    TerminalRsp( RSat::ELaunchBrowser, iLaunchBrowserRspPckg );
+
+    LOG( SIMPLE,
+        "LAUNCHBROWSER: CLaunchBrowserHandler::ClientResponse exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Event notification
+// -----------------------------------------------------------------------------
+//
+void CLaunchBrowserHandler::Event( TInt aEvent )
+    {
+    LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::Event calling" )
+
+    switch ( aEvent )
+        {
+        // SetUpMenu is listening by SAT Client.
+        case MSatUtils::ESetUpMenuRequested:
+            {
+            LOG( NORMAL,
+                "LAUNCHBROWSER::Event ESetUpMenuRequested catched and unreg" )
+            iUtils->UnregisterEvent( this, MSatUtils::ESetUpMenuRequested );
+            // Browser is brought to the top after short period of time.
+            //iUtils->SatUiHandler().ShellController().
+            //    BringBrowserToForegroundAfterPeriod();
+            break;
+            }
+
+        default:
+            {
+            LOG2( NORMAL, "LAUNCHBROWSER:   Unexpected event: %i", aEvent )
+            CSatCommandHandler::Event( aEvent );
+            }
+        }
+
+    LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::Event exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CActive.
+// Cancels the sat request.
+// -----------------------------------------------------------------------------
+//
+void CLaunchBrowserHandler::DoCancel()
+    {
+    LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::DoCancel calling" )
+
+    iUtils->USatAPI().NotifyLaunchBrowserCancel();
+
+    LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Requests the command notification.
+// -----------------------------------------------------------------------------
+//
+void CLaunchBrowserHandler::IssueUSATRequest( TRequestStatus& aStatus )
+    {
+    LOG( SIMPLE,
+        "LAUNCHBROWSER: CLaunchBrowserHandler::IssueUSATRequest calling" )
+
+    // Clear the IPC package.
+    new (&iLaunchBrowserData) RSat::TLaunchBrowserV2();
+    iQueryRsp.iAccepted = EFalse; // default
+
+    iUtils->USatAPI().NotifyLaunchBrowser( aStatus, iLaunchBrowserPckg );
+
+    LOG( SIMPLE,
+        "LAUNCHBROWSER: CLaunchBrowserHandler::IssueUSATRequest exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Precheck before executing the command.
+// -----------------------------------------------------------------------------
+//
+TBool CLaunchBrowserHandler::CommandAllowed()
+    {
+    LOG( SIMPLE,
+        "LAUNCHBROWSER: CLaunchBrowserHandler::CommandAllowed calling" )
+
+    iLaunchBrowserRsp.iGeneralResult = RSat::KLaunchBrowserError;
+    iLaunchBrowserRsp.iInfoType = RSat::KNoAdditionalInfo;
+    iLaunchBrowserRsp.iAdditionalInfo.Zero();
+
+    RMobilePhone::TMobilePhoneRegistrationStatus registrationStatus(
+        iUtils->SystemState().GetNetworkRegistrationStatus() );
+
+    TBool commandAllowed( ETrue );
+
+    if ( RSat::EBrowserIdNotSpecified == iLaunchBrowserData.iBrowserId )
+        {
+        // When get unknown browser id, such as RFU value, return
+        // terminal response of command not understood.
+        iLaunchBrowserRsp.iGeneralResult = RSat::KCmdDataNotUnderstood;
+        commandAllowed = EFalse;
+        LOG( SIMPLE, "LAUNCHBROWSER: \
+            CLaunchBrowserHandler::CommandAllowed unknown browser id" )
+        }
+    else if ( ( RSat::EAlphaIdProvided !=
+        iLaunchBrowserData.iAlphaId.iStatus ) &&
+        ( RSat::ESelfExplanatory ==
+            iLaunchBrowserData.iIconId.iQualifier ||
+          RSat::ENotSelfExplanatory ==
+            iLaunchBrowserData.iIconId.iQualifier ) )
+        {
+        iLaunchBrowserRsp.iGeneralResult = RSat::KCmdDataNotUnderstood;
+        commandAllowed = EFalse;
+        LOG( SIMPLE, "LAUNCHBROWSER: \
+            CLaunchBrowserHandler::CommandAllowed icon without alpha id" )
+        }
+    else if (
+        ( RMobilePhone::ERegisteredOnHomeNetwork != registrationStatus ) &&
+        ( RMobilePhone::ERegisteredRoaming != registrationStatus ) )
+        {
+        iLaunchBrowserRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+        iLaunchBrowserRsp.iInfoType = RSat::KMeProblem;
+        iLaunchBrowserRsp.iAdditionalInfo.SetLength( 1 );
+        iLaunchBrowserRsp.iAdditionalInfo[0] = RSat::KNoService;
+        commandAllowed = EFalse;
+        LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::CommandAllowed\
+             MS is out of service (Net. Reg. status wrong)" )
+        }
+    else if ( RSat::EBrowserSelectionNotSet == iLaunchBrowserData.iBrowserSel )
+        {
+        iLaunchBrowserRsp.iGeneralResult = RSat::KCmdTypeNotUnderstood;
+        commandAllowed = EFalse;
+        LOG( SIMPLE, "LAUNCHBROWSER: \
+            CLaunchBrowserHandler::CommandAllowed selection not set" )
+        }
+    else if ( RSat::ELaunchBrowserIfNotAlreadyLaunched ==
+        iLaunchBrowserData.iBrowserSel )
+        {
+        if ( BrowserExists() )
+            {
+            iLaunchBrowserRsp.iInfoType = RSat::KMeProblem;
+            iLaunchBrowserRsp.iAdditionalInfo.Append( 
+                RSat::KBrowserUnavailable );
+            commandAllowed = EFalse;
+            LOG( SIMPLE, "LAUNCHBROWSER: \
+                CLaunchBrowserHandler::CommandAllowed not launched" )
+            }
+        }
+    else
+        {
+        LOG( SIMPLE,
+            "LAUNCHBROWSER: CLaunchBrowserHandler::CommandAllowed ok" )
+        }
+
+    if ( !commandAllowed )
+        {
+        LOG( SIMPLE,
+            "CLaunchBrowserHandler::CommandAllowed commandAllowed false" )
+        iLaunchBrowserRsp.SetPCmdNumber( iLaunchBrowserData.PCmdNumber() );
+        TerminalRsp( RSat::ELaunchBrowser, iLaunchBrowserRspPckg );
+        }
+    // Set icon command flag whether icon data was received and set qualifier
+    // to no icon id
+    // To be removed when icons are allowed in this command
+    else if ( ( RSat::ESelfExplanatory ==
+        iLaunchBrowserData.iIconId.iQualifier ) ||
+        ( RSat::ENotSelfExplanatory ==
+        iLaunchBrowserData.iIconId.iQualifier ) )
+        {
+         LOG( SIMPLE,
+            "CLaunchBrowserHandler::CommandAllowed commandAllowed ENoIconId" )
+        iIconCommand = ETrue;
+        iLaunchBrowserData.iIconId.iQualifier = RSat::ENoIconId;
+        }
+    else
+        {
+        iIconCommand = EFalse;
+        }
+
+    LOG2( SIMPLE,
+        "LAUNCHBROWSER: CLaunchBrowserHandler::CommandAllowed exiting, \
+         commandAllowed: %d", commandAllowed )
+    return commandAllowed;
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Answers for need of UI session.
+// -----------------------------------------------------------------------------
+//
+TBool CLaunchBrowserHandler::NeedUiSession()
+    {
+    LOG( SIMPLE,
+        "LAUNCHBROWSER: CLaunchBrowserHandler::NeedUiSession calling" )
+
+    const RSat::TAlphaId alphaId( iLaunchBrowserData.iAlphaId );
+
+    iNeedUiSession = ETrue;
+
+    if ( ( ( alphaId.iStatus == RSat::EAlphaIdProvided &&
+        alphaId.iAlphaId.Length() == 0 ) ||
+        alphaId.iStatus == RSat::EAlphaIdNull ) &&
+        ( !iUtils->SystemState().IsConfirmSatOperationsOn() ) )
+        {
+        iNeedUiSession = EFalse;
+        LOG( NORMAL,
+            "LAUNCHBROWSER: CLaunchBrowserHandler::NeedUiSession no  \
+            Ui session needed" )
+        }
+
+    if ( iUtils->CoverUiSupported() && iNeedUiSession )
+        {
+        LOG( NORMAL,
+            "LAUNCHBROWSER: CLaunchBrowserHandler::NeedUiSession Ui session \
+            needed" )
+        TSatCommandData medEventData;
+        medEventData.iPCmdNumber = RSat::ELaunchBrowser;
+        medEventData.iAlphaId = iLaunchBrowserData.iAlphaId;
+
+        if ( iUtils->SystemState().IsConfirmSatOperationsOn() )
+            {
+            LOG( NORMAL,
+            "LAUNCHBROWSER: CLaunchBrowserHandler::NeedUiSession \
+             KSatLongDuration" )
+            medEventData.iDuration.iNumOfUnits = KSatLongDuration;
+            }
+        else
+            {
+            medEventData.iDuration.iNumOfUnits = KSatDefaultDuration;
+            }
+
+        medEventData.iDuration.iTimeUnit = RSat::ESeconds;
+        medEventData.iIconID = iLaunchBrowserData.iIconId;
+        TSatCommandPckg tPckg( medEventData );
+        iUtils->RaiseSatEvent( tPckg );
+        }
+
+    LOG2( SIMPLE,
+        "LAUNCHBROWSER: CLaunchBrowserHandler::NeedUiSession exiting, \
+         iNeedUiSession: %d", iNeedUiSession )
+    return iNeedUiSession;
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Called when USAT API notifies that command.
+// -----------------------------------------------------------------------------
+//
+void CLaunchBrowserHandler::HandleCommand()
+    {
+    LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::HandleCommand calling" )
+
+    // Register service request handler for LaunchBrowser command,
+    // If there is already service request for query, registering
+    // updates command handler, so client responses comes to this
+    // command handler
+    TRAPD( err, iUtils->RegisterServiceRequestL(
+        ESatSProactiveQuery,
+        ESatSProactiveQueryResponse,
+        this ) );
+
+    if ( KErrNone != err )
+        {
+        iLaunchBrowserRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+        iLaunchBrowserRsp.iInfoType = RSat::KMeProblem;
+        iLaunchBrowserRsp.iAdditionalInfo.SetLength( 1 );
+        iLaunchBrowserRsp.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
+        iLaunchBrowserRsp.SetPCmdNumber( iLaunchBrowserData.PCmdNumber() );
+        TerminalRsp( RSat::ELaunchBrowser, iLaunchBrowserRspPckg );
+
+        LOG2( SIMPLE,
+        "LAUNCHBROWSER: CLaunchBrowserHandler::HandleCommand error: %i", err )
+        }
+    else if ( iNeedUiSession )
+        {
+        iQueryData.iCommand = ESatSLaunchBrowserQuery;
+        iQueryData.iQueryText = iLaunchBrowserData.iAlphaId.iAlphaId;
+        iQueryData.iIconId.iIdentifier =
+            iLaunchBrowserData.iIconId.iIdentifier;
+        LOG2( SIMPLE, "CLaunchBrowserHandler::HandleCommand \
+              iLaunchBrowserData.iIconId.iQualifier: %i", 
+              iLaunchBrowserData.iIconId.iQualifier )
+        switch ( iLaunchBrowserData.iIconId.iQualifier )
+            {
+            case RSat::ESelfExplanatory:
+                {
+                // Icon qualifier is self explanatory (to display instead
+                // of the alpha id or text string).
+                iQueryData.iIconId.iIconQualifier = ESatSelfExplanatory;
+                break;
+                }
+
+            case RSat::ENotSelfExplanatory:
+                {
+                // Icon qualifier is not self explanatory.
+                iQueryData.iIconId.iIconQualifier = ESatNotSelfExplanatory;
+                break;
+                }
+
+            default:
+                {
+                // Icon qualifier not present
+                iQueryData.iIconId.iIconQualifier = ESatENoIconId;
+                break;
+                }
+            }
+
+        if ( RSat::EAlphaIdNotPresent == iLaunchBrowserData.iAlphaId.iStatus )
+            {
+            LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::HandleCommand \
+                 EAlphaIdNotPresent" )
+            iQueryData.iAlphaIdStatus = ESatAlphaIdNotProvided;
+            }
+        else if ( RSat::EAlphaIdProvided ==
+            iLaunchBrowserData.iAlphaId.iStatus )
+            {
+            LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::HandleCommand \
+                 EAlphaIdProvided" )
+            iQueryData.iAlphaIdStatus = ESatAlphaIdNotNull;
+            }
+        else
+            {
+            iQueryData.iAlphaIdStatus = ESatAlphaIdNull;
+            }
+
+        iQueryData.iSimApplicationName = iUtils->SatAppName();
+
+        // Ask the user permission to launch browser. Reply will come
+        // to ClientResponse() method.
+        iUtils->SatUiHandler().UiSession()->SendCommand(
+            &iQueryPckg,
+            &iQueryRspPckg,
+            ESatSProactiveQuery );
+        }
+    else // transparent launch
+        {
+        // Launch the Browser.
+        TRAP( err, LaunchBrowserL() );
+
+        if ( KErrNone != err )
+            {
+            iLaunchBrowserRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+            LOG2( SIMPLE, "LAUNCHBROWSER: \
+                CLaunchBrowserHandler::HandleCommand error: %i", err )
+            }
+        else
+            {
+            LOG( SIMPLE,
+                "LAUNCHBROWSER: CLBH::CR ESetUpMenuRequested registered" )
+            TRAP_IGNORE( iUtils->RegisterL(
+                this, MSatUtils::ESetUpMenuRequested ) )
+            }
+
+        TerminalRsp( RSat::ELaunchBrowser, iLaunchBrowserRspPckg );
+        }
+
+    LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::HandleCommand exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Indicates the failure of launching ui client.
+// -----------------------------------------------------------------------------
+//
+void CLaunchBrowserHandler::UiLaunchFailed()
+    {
+    LOG( SIMPLE,
+        "LAUNCHBROWSER: CLaunchBrowserHandler::UiLaunchFailed calling" )
+
+    iLaunchBrowserRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+    iLaunchBrowserRsp.iInfoType = RSat::KMeProblem;
+    iLaunchBrowserRsp.iAdditionalInfo.SetLength( 1 );
+    iLaunchBrowserRsp.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
+    iLaunchBrowserRsp.SetPCmdNumber( iLaunchBrowserData.PCmdNumber() );
+    TerminalRsp( RSat::ELaunchBrowser, iLaunchBrowserRspPckg );
+
+    LOG( SIMPLE,
+        "LAUNCHBROWSER: CLaunchBrowserHandler::UiLaunchFailed exiting" )
+    }
+    
+// -----------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+//lint -e{1403, 1769} Can not be initialized, harmless.
+CLaunchBrowserHandler::CLaunchBrowserHandler() :
+    CSatCommandHandler(),
+    iLaunchBrowserData(),
+    iLaunchBrowserPckg( iLaunchBrowserData ),
+    iLaunchBrowserRsp(),
+    iLaunchBrowserRspPckg( iLaunchBrowserRsp ),
+    iQueryData(),
+    iQueryPckg( iQueryData ),
+    iQueryRsp(),
+    iQueryRspPckg( iQueryRsp ),
+    iUidWmlBrowser( TUid::Uid( KWmlcHandler ) ),
+    iAfterTimer( NULL ),
+    // To be removed when icons are allowed in this command
+    iIconCommand( EFalse )
+    {
+    LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::CLaunchBrowserHandler \
+        calling - exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CLaunchBrowserHandler::ConstructL()
+    {
+    LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::ConstructL calling" )
+
+    // Open the Window server session.
+    User::LeaveIfError( iWsSession.Connect() );
+
+    LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::ConstructL exiting" )
+    }
+
+
+// -----------------------------------------------------------------------------
+// Checks if Browser application is launched.
+// -----------------------------------------------------------------------------
+//
+TBool CLaunchBrowserHandler::BrowserExists()
+    {
+    LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::BrowserExists calling" )
+    TBool browserExists( EFalse );
+
+    TApaTaskList taskList( iWsSession );
+    TApaTask task = taskList.FindApp( iUidWmlBrowser );
+    browserExists = task.Exists();
+
+    LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::BrowserExists exiting" )
+    return browserExists;
+    }
+
+// -----------------------------------------------------------------------------
+// The Launch Browser handler.
+// -----------------------------------------------------------------------------
+//
+void CLaunchBrowserHandler::LaunchBrowserL()
+    {
+    LOG( SIMPLE,
+        "LAUNCHBROWSER: CLaunchBrowserHandler::LaunchBrowserL calling" )
+
+    // Check the URL length.
+    const TInt urlLen( iLaunchBrowserData.iUrl.Length() );
+
+    // ID of the accesspoint in the communications database.
+    TUid accesspointID( TUid::Uid( KErrNotFound ) );
+
+    // If apId is given by SIM card, then we use that, otherwise,
+    // get default apId from default connection method.
+    TUint32 apId( 0 );
+    // GCF is supported since S60 5.0
+    apId = GetAccessPointByGatewayAddressL();
+    if ( apId )
+        {
+        LOG2( SIMPLE, 
+              "LAUNCHBROWSER: CLaunchBrowserHandler::LaunchBrowserL, \
+              Get gcf AP id = %d", apId )
+        accesspointID.iUid = static_cast<TInt32>( apId );
+        }    
+    
+    // Get default AP if GCF ap not found
+    if ( KErrNotFound == accesspointID.iUid )
+        {
+        LOG( SIMPLE, 
+             "LAUNCHBROWSER: CLaunchBrowserHandler::LaunchBrowserL, \
+             no gcf AP id" )
+        apId = GetAccessPointByDefaultL();
+        if ( apId )
+            {
+            LOG2( SIMPLE, 
+                  "LAUNCHBROWSER: CLaunchBrowserHandler::LaunchBrowserL, \
+                  default AP id = %d", apId )            
+            accesspointID.iUid = static_cast<TInt32>( apId );
+            }
+        }
+    
+    LOG2( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::LaunchBrowserL, \
+          accesspointID.iUid=%d", accesspointID.iUid )
+    
+    HBufC* param = NULL;
+    // If the URL is given by SIM, then we use that
+    if ( urlLen )
+        {
+        // Url is given by SIM, and we use that.
+        param = HBufC::NewLC( urlLen );
+        param->Des().Copy( iLaunchBrowserData.iUrl );
+        LOG3( SIMPLE, 
+              "LAUNCHBROWSER: CLaunchBrowserHandler::LaunchBrowserL,\
+              url is given by SIM, url=%s, length=%d", 
+              param, param->Des().Length() )
+        }  
+    // If no url from SIM, get default URL by selected access point.
+    else if ( !param && accesspointID.iUid > 0 )
+        {
+        param = GetDefaultUrlByAccessPointLC( 
+                static_cast<TUint32>( accesspointID.iUid) );
+        LOG3( SIMPLE, 
+              "LAUNCHBROWSER: CLaunchBrowserHandler::LaunchBrowserL,\
+              url is given by IAP, url=%s, length=%d",
+              param, param->Des().Length() )
+        }
+    else
+        {
+        param = KNullDesC().AllocLC();
+        LOG( SIMPLE, 
+             "LAUNCHBROWSER: CLaunchBrowserHandler::LaunchBrowserL no url" )
+        }
+    
+    switch ( iLaunchBrowserData.iBrowserSel )
+        {
+        case RSat::ECloseExistingLaunchNewBrowserSession:
+            {
+            LOG( NORMAL, "LAUNCHBROWSER: CLaunchBrowserHandler:: \
+                 LaunchBrowserL, ECloseExistingLaunchNewBrowserSession" )
+            CloseBrowser();  // Close Browser Session if it exists.
+            LaunchWithUrlL( param->Des(), accesspointID );
+            break;
+            }
+
+        case RSat::ELaunchBrowserIfNotAlreadyLaunched:
+            {
+            LOG( NORMAL, "LAUNCHBROWSER: CLaunchBrowserHandler:: \
+                 LaunchBrowserL, ELaunchBrowserIfNotAlreadyLaunched" )
+            if ( BrowserExists() )
+                {
+                LOG( SIMPLE,"CLaunchBrowserHandler::LaunchBrowserL \
+                     BrowserExists" )
+                // Browser exists, error response returned.
+                iLaunchBrowserRsp.iGeneralResult = RSat::KLaunchBrowserError;
+                iLaunchBrowserRsp.iInfoType = RSat::KMeProblem;
+                iLaunchBrowserRsp.iAdditionalInfo.Append( 
+                    RSat::KBrowserUnavailable );
+                }
+            else
+                {
+                LaunchWithUrlL( param->Des(), accesspointID );
+                }
+            break;
+            }
+
+        case RSat::EUseExistingBrowser:
+            {
+            // SAT Shell Controller looks if browser already exists.
+            LOG( NORMAL, "LAUNCHBROWSER: CLaunchBrowserHandler:: \
+                 LaunchBrowserL,EUseExistingBrowser" )
+            LaunchWithUrlL( param->Des(), accesspointID );
+            break;
+            }
+
+        case RSat::EBrowserSelectionNotSet:
+        default:
+            __ASSERT_DEBUG( EFalse,
+                Panic( KLaunchBrowserHandlerName, KErrBadName ) );
+            break;
+        }
+
+    CleanupStack::PopAndDestroy( param );
+
+    LOG( SIMPLE,
+        "LAUNCHBROWSER: CLaunchBrowserHandler::LaunchBrowserL exiting" )
+    }
+
+// --------------------------------------------------------------------------
+// Closes the Browser application if it is active and waits until
+// closing is complete.
+// --------------------------------------------------------------------------
+//
+void CLaunchBrowserHandler::CloseBrowser()
+    {
+    LOG( SIMPLE, 
+         "LAUNCHBROWSER: CLaunchBrowserHandler::CloseBrowser calling" )
+    TApaTaskList taskList( iWsSession );
+    TApaTask task = taskList.FindApp( iUidWmlBrowser );
+
+    if ( task.Exists() )
+        {
+        task.SendSystemEvent( EApaSystemEventShutdown );
+
+        TBool browserExists( ETrue );
+        TInt waitCount( 0 );
+        LOG2( SIMPLE, 
+              "CLaunchBrowserHandler::CloseBrowser browserExists: %d",
+              browserExists )
+        // Make sure that closing is completed.
+        while ( browserExists )
+            {
+            After( KSatSShortLoopTimeout );
+            ++waitCount;
+
+            TApaTask newTask = taskList.FindApp( iUidWmlBrowser );
+            browserExists = newTask.Exists();
+
+            if ( KSatSWaitCount <= waitCount )
+                {
+                newTask.KillTask();
+                browserExists = EFalse;
+                LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler:: \
+                    CloseBrowser force kill task" )
+                }
+            }
+        }
+
+    LOG( SIMPLE, 
+         "LAUNCHBROWSER: CLaunchBrowserHandler::CloseBrowser exiting" )
+    }
+
+// --------------------------------------------------------------------------
+// Launches The Browser with URL.
+// --------------------------------------------------------------------------
+//
+void CLaunchBrowserHandler::LaunchWithUrlL( const TDesC& aParam,
+    const TUid& aAccessPointUid )
+    {
+    LOG( SIMPLE,
+        "LAUNCHBROWSER: CLaunchBrowserHandler::LaunchWithUrlL calling" )
+    LOG3( SIMPLE,
+         "LAUNCHBROWSER: CLaunchBrowserHandler::LaunchWithUrlL\
+          url=%s, IAP=%d", &aParam, aAccessPointUid.iUid )        
+
+    // Browser launching called.
+    //TInt err = iUtils->SatUiHandler().ShellController().LaunchBrowserL(
+    //    aParam, aAccessPointUid );
+    TInt err =  KErrNone;
+
+    if ( KErrNone == err )
+        {
+        if ( !iQueryRsp.iRequestedIconDisplayed &&
+            ( ( RSat::ESelfExplanatory ==
+            iLaunchBrowserData.iIconId.iQualifier ) ||
+            ( RSat::ENotSelfExplanatory ==
+            iLaunchBrowserData.iIconId.iQualifier ) ) )
+            {
+            iLaunchBrowserRsp.iGeneralResult =
+                RSat::KSuccessRequestedIconNotDisplayed;
+            LOG( SIMPLE,
+                "LAUNCHBROWSER: CLaunchBrowserHandler::LaunchWithUrlL \
+                no icon shown" )
+            }
+        else
+            {
+            iLaunchBrowserRsp.iGeneralResult = RSat::KSuccess;
+            LOG( SIMPLE,
+                "LAUNCHBROWSER: CLaunchBrowserHandler::LaunchWithUrlL \
+                command ok" )
+            }
+        }
+    else
+        {
+        iLaunchBrowserRsp.iGeneralResult  = RSat::KLaunchBrowserError;
+        iLaunchBrowserRsp.iInfoType       = RSat::KMeProblem;
+        iLaunchBrowserRsp.iAdditionalInfo.Append( 
+                RSat::KBrowserUnavailable );
+        LOG2( SIMPLE, 
+        "LAUNCHBROWSER: CLaunchBrowserHandler::LaunchWithUrlL error: %i", 
+        err )
+        }
+
+    LOG( SIMPLE,
+        "LAUNCHBROWSER: CLaunchBrowserHandler::LaunchWithUrlL exiting" )
+    }
+
+// --------------------------------------------------------------------------
+// Starts timer. Function returns as the given time has elapsed or
+// timer is cancelled.
+// --------------------------------------------------------------------------
+void CLaunchBrowserHandler::After(
+    const TTimeIntervalMicroSeconds32& aDelay,
+    const TTimeIntervalMicroSeconds32& aInterval )
+    {
+    LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::After calling" )
+
+    if ( !iAfterWait.IsStarted() )
+        {
+        TRAPD( err, iAfterTimer = CPeriodic::NewL( EPriorityStandard ) )
+        LOG2( SIMPLE, 
+        "LAUNCHBROWSER: CLaunchBrowserHandler::After err: %i", err )
+        if ( ( KErrNone == err ) && iAfterTimer )
+            {
+            iAfterTimer->Start(
+                aDelay, aInterval, TCallBack( DelayCallBack, this ) );
+            iAfterWait.Start();
+
+            delete iAfterTimer;
+            iAfterTimer = NULL;
+            }
+        }
+
+    LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::After exiting" )
+    }
+
+// --------------------------------------------------------------------------
+// Timer call back function
+// --------------------------------------------------------------------------
+TInt CLaunchBrowserHandler::DelayCallBack( TAny* aPtr )
+    {
+    LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::DelayCallBack \
+    calling" )
+    CLaunchBrowserHandler* ptrThis =
+        static_cast<CLaunchBrowserHandler*>( aPtr );
+
+    if ( ptrThis && ( ptrThis->iAfterWait.IsStarted() ) )
+        {
+        LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::DelayCallBack \
+             stop iAfterWait" )
+        ptrThis->iAfterWait.AsyncStop();
+        }
+    LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::DelayCallBack \
+    exiting" )
+    return ( EFalse );
+    }
+
+// --------------------------------------------------------------------------
+// Create a new access point using the Access Point Engine.
+// --------------------------------------------------------------------------
+//
+TUint32 CLaunchBrowserHandler::CreateAccessPointL( 
+        const TDesC16& aApName,
+        const TDesC16& aProxyServerAddr,
+        const TUint32 aProxyPortNumber,
+        const RPacketContext::TProtocolType& aIPvType )
+    {
+    LOG( SIMPLE, 
+         "LAUNCHBROWSER: CLaunchBrowserHandler::CreateAccessPointL calling" )
+
+    // Connection method interface.
+    RCmConnectionMethod cm;
+    // Connection method manager interface.
+    RCmManager cmManager;
+    // Used to exit connection methods go through loop
+    TBool exitConnectionMethodsLoop( EFalse );
+    
+    cmManager.OpenLC();
+
+    // Find if the access point with the same name is already exist.
+    // If such access point exists, delete it and then create a new one.
+     
+    // Get the Connection Methods does not belogns to any destination
+    RArray<TUint32> array = RArray<TUint32>( KSatCMGranularity );
+    CleanupClosePushL( array );
+
+    cmManager.ConnectionMethodL( array );
+
+    // Go through the Connection Method list to find if there is matched one
+     
+    for( TInt i = 0; 
+         ( i < array.Count() ) && !exitConnectionMethodsLoop; ++i)
+        {
+        cm = cmManager.ConnectionMethodL( array[i] );
+        CleanupClosePushL( cm );
+        
+        // query the access point name
+        HBufC * pa = NULL;
+        pa = cm.GetStringAttributeL( CMManager::ECmName );
+        CleanupStack::PushL(pa);
+        
+        if ( *pa == aApName )
+            {
+            // Find the matched connection method
+            LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::\
+                 CreateAccessPointL, find the existing ap" )
+            cm.DeleteL();
+            exitConnectionMethodsLoop = ETrue;
+            }
+        CleanupStack::PopAndDestroy( pa );
+        CleanupStack::PopAndDestroy( &cm ); 
+        } 
+    CleanupStack::PopAndDestroy( &array );
+
+    // Create a connection method without destination.
+    cm = cmManager.CreateConnectionMethodL( KUidPacketDataBearerType );
+    CleanupClosePushL( cm );
+    
+    // Fulfill connection method params with default setting from OCC.
+    // We use trap to continue following operations even if leaving from 
+    // FulfillConnnectionMethodL.
+    TRAPD( errCode, FulfillConnnectionMethodL( cmManager, cm ) );
+    LOG3( SIMPLE, "SATENGINE: CLaunchBrowserHandler::CreateAccessPointL \
+          errCode=%d ad line %d", errCode, __LINE__ )
+    // Set attributes of the connection method.
+    cm.SetStringAttributeL( CMManager::ECmName, aApName );
+    cm.SetIntAttributeL( CMManager::EPacketDataPDPType, aIPvType );
+    cm.SetStringAttributeL( CMManager::ECmWapIPGatewayAddress, 
+                            TPtrC( aProxyServerAddr ) );
+    cm.SetStringAttributeL( CMManager::ECmProxyServerName, 
+                            TPtrC( aProxyServerAddr ) );
+    cm.SetIntAttributeL( CMManager::ECmProxyPortNumber, aProxyPortNumber );
+        
+    // Update the access point ID for use later.
+    cm.UpdateL();
+
+    TUint32 apId = cm.GetIntAttributeL( CMManager::ECmIapId );
+    LOG2( SIMPLE, 
+          "LAUNCHBROWSER: CLaunchBrowserHandler::CreateAccessPointL apId=%d",
+          apId )
+
+    CleanupStack::PopAndDestroy( &cm );
+    CleanupStack::PopAndDestroy( &cmManager );
+    
+    LOG( SIMPLE, 
+         "LAUNCHBROWSER: CLaunchBrowserHandler::CreateAccessPointL exiting" )
+    
+    return apId;
+    }
+
+// --------------------------------------------------------------------------
+// Get a AP from the Connection Method Manager.
+// --------------------------------------------------------------------------
+TUint32 CLaunchBrowserHandler::GetAccessPointByGatewayAddressL()
+    {
+    LOG( SIMPLE, "LAUNCHBROWSER: \
+        CLaunchBrowserHandler::GetAccessPointByGatewayAddressL calling" )
+    // Access Point ID.
+    TUint32 apId( 0 ); 
+    // Unknown IP address type.
+    TInt ipvType( 0 );
+    // Get the gateway address.
+    TPtrC gatewayAddrPtr( iLaunchBrowserData.iText );
+    // Get the bearer list.
+    TPtrC8 bearerListPtr( iLaunchBrowserData.iBearerList ); 
+
+    // Proxy address.
+    HBufC* proxyAddress = NULL;
+    // Proxy port number.
+    TUint32 proxyPortNumber( 0 );
+    HBufC* pa = NULL;
+    TUint32 pn( 0 );
+
+    // Used to exit the connection method go through loop
+    TBool exitConnectionMethodsLoop( EFalse );
+    
+    // SAT access point name.
+    TPtrC satAPN( KNullDesC );
+    
+    // Use SAT application name as SAT APN.
+    satAPN.Set( iUtils->SatAppName() );
+    // Use default SAT APN if SAT application name is not available.
+    if ( satAPN == KNullDesC )
+        {
+        LOG( SIMPLE, 
+             "CLaunchBrowserHandler::GetAccessPointByGatewayAddressL\
+             satAPN == KNullDesC" )
+        satAPN.Set( KSatAccessPointName );
+        }
+        
+    // Get the proxy address and port number
+    proxyAddress = HBufC::NewLC( gatewayAddrPtr.Length() );
+    TPtr proxyAddrPtr( proxyAddress->Des() );
+    SeparatePortNumberFromAddress( gatewayAddrPtr, proxyAddrPtr, 
+        proxyPortNumber );
+    proxyAddrPtr.TrimAll();
+    
+    // Check the launch browser package for gateway setting.
+    ipvType = ValidateGatewayAddress( proxyAddrPtr );
+    
+    if ( RPacketContext::EPdpTypeIPv4 == ipvType || \
+         RPacketContext::EPdpTypeIPv6 == ipvType )
+        {
+        LOG2( SIMPLE, 
+              "CLaunchBrowserHandler::GetAccessPointByGatewayAddressL \
+              gatewayAddrPtr.Length(): %d", gatewayAddrPtr.Length() )
+        // Check the launch browser package for bearer setting if the gateway
+        // address is valid.
+        LOG2( SIMPLE, 
+              "LAUNCHBROWSER: CLaunchBrowserHandler:: \
+              GetAccessPointByGatewayAddressL, IPvType is %d",
+              ipvType)
+        if ( gatewayAddrPtr.Length() )
+            {
+            // The bearer is GPRS.
+            if ( bearerListPtr != KNullDesC8 && bearerListPtr.Length() > 0 
+                    && RSat::KGprsBearer == bearerListPtr[0] )
+                {
+                
+                // Go through the candidate connection methods to find 
+                // the one matched the gateway address. If a matched one 
+                // is found,using it as the access point for SIM service, 
+                // else a new one is created.      
+                RCmManager cmManager;
+                cmManager.OpenLC();
+
+                // Get the Connection Methods does not belongs to 
+                // any destination
+                RArray<TUint32> array = RArray<TUint32>( 
+                                        KSatCMGranularity );
+                CleanupClosePushL( array );
+
+                cmManager.ConnectionMethodL( array );
+
+                // Go through the Connection Method list to find 
+                // if there is matched one
+                 
+                for( TInt i = 0; 
+                     ( i < array.Count() ) && !exitConnectionMethodsLoop; 
+                     ++i )
+                    {
+                    RCmConnectionMethod cm = cmManager.ConnectionMethodL(
+                                                          array[i] );
+                    CleanupClosePushL( cm );
+                    
+                    // query the Gateway proxy address 
+                    // of the Connection Method
+                    pa = cm.GetStringAttributeL( 
+                         CMManager::ECmWapIPGatewayAddress );
+                    CleanupStack::PushL(pa);
+                    
+                    // query the Gateway proxy port number of the Connection 
+                    // Method
+                    pn = cm.GetIntAttributeL( 
+                            CMManager::ECmProxyPortNumber );
+                    
+                    if (( pn == proxyPortNumber ) && 
+                        ( *pa == *proxyAddress ))
+                        {
+                        // Find the matched connection method
+                        apId = cm.GetIntAttributeL( CMManager::ECmIapId );
+                        LOG2( SIMPLE, 
+                              "LAUNCHBROWSER: CLaunchBrowserHandler::\
+                              GetAccessPointByGatewayAddressL, apId=%d",
+                              apId )
+                        exitConnectionMethodsLoop = ETrue;
+                        }
+                        
+                    CleanupStack::PopAndDestroy( pa );
+                    CleanupStack::PopAndDestroy( &cm );
+                    }
+            
+                CleanupStack::PopAndDestroy( &array );
+                CleanupStack::PopAndDestroy( &cmManager );
+                
+                LOG2( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler:: \
+                      GetAccessPointByGatewayAddressL apId=%d", apId )
+                           
+                if ( !apId )
+                    {
+                    // Create a new AP if there is not a matched one.
+                    apId = CreateAccessPointL( 
+                            satAPN,
+                            proxyAddrPtr,
+                            proxyPortNumber,
+                            static_cast<RPacketContext::TProtocolType>(
+                                                              ipvType ) );
+                    }
+                }
+            }
+        }
+    CleanupStack::PopAndDestroy( proxyAddress );
+    
+    LOG2( SIMPLE, 
+          "LAUNCHBROWSER: CLaunchBrowserHandler::\
+          GetAccessPointByGatewayAddressL exiting, apId=%d", apId )
+    
+    // return the AP.
+    return apId;
+    }
+
+// --------------------------------------------------------------------------
+// Get an Access Point by default.
+// --------------------------------------------------------------------------
+TUint32 CLaunchBrowserHandler::GetAccessPointByDefaultL()
+    {
+    LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::\
+         GetAccessPointByDefaultL calling" )
+         
+    TUint32 apId ( KErrNone );
+    RCmManager cmManager;
+    cmManager.OpenLC();
+    RCmConnectionMethod cm;
+    CleanupClosePushL( cm );
+    
+    // Get a default connection method
+    TInt ret( KErrNotFound );
+    GetDefConnMethodL( cmManager, cm, ret );
+    if ( !ret )
+        {
+        LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::\
+             GetAccessPointByDefaultL default connection found" )        
+        apId = cm.GetIntAttributeL( CMManager::ECmIapId );
+        }
+    
+    CleanupStack::PopAndDestroy( &cm );
+    CleanupStack::PopAndDestroy( &cmManager );
+    
+    LOG2( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::\
+          GetAccessPointByDefaultL exiting, apId=%d", apId )
+    
+    return apId;
+    }
+
+// --------------------------------------------------------------------------
+// Get default URL by access point
+// --------------------------------------------------------------------------
+HBufC* CLaunchBrowserHandler::GetDefaultUrlByAccessPointLC( TUint32 aApId )
+    {
+    LOG2( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::\
+         GetDefaultUrlByAccessPointLC calling, aApId=%d", aApId )
+    
+    HBufC* url = NULL;
+    if ( aApId > 0 )
+        {
+        // Create CMManager session
+        RCmManager cmManager;
+        cmManager.OpenLC();
+        
+        // get the connection method by apId
+        RCmConnectionMethod cm = cmManager.ConnectionMethodL( aApId );
+        CleanupClosePushL( cm );
+        
+        // Get the default URL from default accesspoint
+        // If the access point doesn't include the default URL,
+        // the empty string is returned.
+        url = cm.GetStringAttributeL( CMManager::ECmStartPage );
+        
+        CleanupStack::PopAndDestroy( &cm );
+        CleanupStack::PopAndDestroy( &cmManager );
+
+        CleanupStack::PushL( url );  
+        }
+    
+    if ( !url )
+        {
+        url = KNullDesC().AllocLC();
+        }
+    
+    LOG2( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::\
+          GetDefaultUrlByAccessPointLC exiting, url=%s", url )
+    return url;
+    }
+
+// --------------------------------------------------------------------------
+// Convert a descriptor into a integer.
+// --------------------------------------------------------------------------
+TInt CLaunchBrowserHandler::ConvertDesToInt( const TDesC16& aDes )
+    {
+    LOG2( SIMPLE, "LAUNCHBROWSER: \
+          CLaunchBrowserHandler::ConvertDesToInt calling,length of aDes:%d",
+          aDes.Length() )
+
+    TLex converter;
+    TInt intValue( KErrNotFound );
+    TBool digital( ETrue );
+
+    if ( aDes != KNullDesC && aDes.Length() > 0 )
+        {
+        // The literal value of every element in the descriptor 
+        // should be numerical.
+        for ( TInt i = 0; i < aDes.Length() && digital; i++ )
+            {
+            TChar ch( aDes[i] );
+            
+            if ( !ch.IsDigit() )
+                {
+                LOG( SIMPLE, "LAUNCHBROWSER: \
+                CLaunchBrowserHandler::ConvertDesToInt not digit" )
+                digital = EFalse;
+                }
+            }
+            
+        if ( digital )
+            {
+            LOG( SIMPLE, "LAUNCHBROWSER: \
+            CLaunchBrowserHandler::ConvertDesToInt digit" )
+            // Converting.
+            converter.Assign( aDes );
+            converter.Val( intValue );
+            }
+        }
+
+    LOG2( SIMPLE, "LAUNCHBROWSER: \
+          CLaunchBrowserHandler::ConvertDesToInt exiting,intValue:%d", 
+          intValue )
+
+    return intValue;
+    }
+
+// --------------------------------------------------------------------------
+// Check the validity of a descriptor in hex.
+// --------------------------------------------------------------------------
+TBool CLaunchBrowserHandler::ValidateHexadecimal( const TDesC16& aHex )
+    {
+    LOG( SIMPLE, "LAUNCHBROWSER: \
+        CLaunchBrowserHandler::ValidateHexadecimal calling" )
+
+    // The hexadecimal descriptor can be null.
+    TInt length( aHex.Length() );
+    TBool retVal( ETrue );
+    LOG2( SIMPLE, "LAUNCHBROWSER: \
+        CLaunchBrowserHandler::ValidateHexadecimal length:%d", length )
+
+    // Validate characters one by one.
+    for ( TInt i = 0; i < length && retVal; i++ )
+        {
+        TChar ch( aHex[i] );
+        
+        if ( !ch.IsHexDigit() )
+            {
+            LOG2( SIMPLE, "LAUNCHBROWSER: \
+            CLaunchBrowserHandler::ValidateHexadecimal hex digit,i: %d",
+            i )
+            retVal = EFalse;
+            }
+        }
+
+    LOG2( SIMPLE, "LAUNCHBROWSER: \
+          CLaunchBrowserHandler::ValidateHexadecimal exiting, retVal:%d",
+          retVal )
+        
+    return retVal;
+    }
+
+// --------------------------------------------------------------------------
+// Check the validity of a IPv4 address. For example, 210.13.246.172.
+// --------------------------------------------------------------------------
+TBool CLaunchBrowserHandler::ValidateIPv4Address( 
+        const TDesC16& aAddress )
+    {
+    LOG2( SIMPLE, "LAUNCHBROWSER: \
+    CLaunchBrowserHandler::ValidateIPv4Address calling,aAddress: %s",
+    &aAddress )
+
+    // Separate the address to be three segments using dot and validate
+    // each segment.
+    TPtrC segPtr( aAddress );
+    TBuf<KSatMaxIPv4SegmentLength> segment;
+    TInt posInDes( KErrNone );
+    TInt posInPtr( KErrNone );
+    TInt segCounter( KErrNone );
+    TBool first( ETrue );
+    TBool retVal( ETrue );
+    // Segment value in integer.
+    TInt intValue( KErrNone );
+        
+    // Convert each segment into integer.
+    while ( KErrNotFound != ( posInPtr = segPtr.Find( KSatIPv4Delimiter ) )
+            && retVal )
+        {
+        
+        if ( KSatMaxIPv4SegmentLength >= posInPtr && 0 < posInPtr )
+            {
+            LOG( SIMPLE, "LAUNCHBROWSER: \
+            CLaunchBrowserHandler::ValidateIPv4Address posInPtr valid" )
+            segCounter++;
+            posInDes += posInPtr;
+            segment = segPtr.Mid( 0, posInPtr );
+            
+            // The first integer should be > 0 and < 255, others should be 
+            // >=0 and < 255.
+            intValue = ConvertDesToInt( segment );
+            LOG2( SIMPLE, "LAUNCHBROWSER: \
+            CLaunchBrowserHandler::ValidateIPv4Address first:%d",first )
+            if ( first )
+                {
+                first = EFalse;
+                
+                if ( !( KSatIPv4Network < intValue && 
+                        KSatIPv4Broadcast > intValue ) )
+                    {
+                    LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::\
+                         ValidateIPv4Address intValue valid" )
+                    retVal = EFalse;
+                    }
+                }
+            else
+                {
+                
+                if ( !( KSatIPv4Network <= intValue && 
+                        KSatIPv4Broadcast > intValue ) )
+                    {
+                    LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::\
+                         ValidateIPv4Address intValue range" )
+                    retVal = EFalse;
+                    }
+                }
+            // Skip dot.
+            posInDes++;
+            segPtr.Set( aAddress.Mid( posInDes, 
+                aAddress.Length() - posInDes ) );
+            }
+        else
+            {
+            retVal = EFalse;
+            }
+        }
+    
+    // IPv4 address is consist of 4 segment
+    if ( KSatMaxIPv4SegmentCounter == segCounter && retVal )
+        {
+        LOG( SIMPLE, "LAUNCHBROWSER: \
+        CLaunchBrowserHandler::ValidateIPv4Address valid address" )
+        // Validate the last segment.
+        segment = segPtr;
+        
+        if ( KSatMaxIPv4SegmentLength < segment.Length() )
+            {
+            LOG( SIMPLE, "LAUNCHBROWSER: \
+            CLaunchBrowserHandler::ValidateIPv4Address address invalid" )
+            retVal = EFalse;
+            }
+            
+        intValue = ConvertDesToInt( segment );
+        
+        if ( !( KSatIPv4Network < intValue && 
+                KSatIPv4Broadcast > intValue ) )
+            {
+            LOG( SIMPLE, "LAUNCHBROWSER: \
+            CLaunchBrowserHandler::ValidateIPv4Address intValue range" )
+            retVal = EFalse;
+            }
+        }
+    else
+        {
+        retVal = EFalse;
+        }
+        
+    LOG2( SIMPLE, "LAUNCHBROWSER: \
+        CLaunchBrowserHandler::ValidateIPv4Address exiting,retVal:%d",
+        retVal )
+
+    return retVal;
+    }
+
+// --------------------------------------------------------------------------
+// Check the validity of a IPv6 address. For example,
+// 3ffe:ffff:101::230:6eff:fe04:d9ff.
+// --------------------------------------------------------------------------
+TBool CLaunchBrowserHandler::ValidateIPv6Address( 
+        const TDesC16& aAddress )
+    {
+    LOG2( SIMPLE, "LAUNCHBROWSER: \
+    CLaunchBrowserHandler::ValidateIPv6Address calling,aAddress: %s",
+    &aAddress )
+
+    // Separate the address to be eight segments using colon and validate
+    // each segment.
+    TPtrC segPtr( aAddress );
+    TBuf<KSatMaxIPv6SegmentLength> segment;
+    TInt posInDes( KErrNone );
+    TInt posInPtr( KErrNone );
+    TInt segCounter( KErrNone );
+    TBool first( ETrue );
+    TBool retVal( ETrue );
+    
+    while ( KErrNotFound != ( posInPtr = segPtr.Find( KSatIPv6Delimiter ) )
+            && retVal )
+        {
+        
+        if ( KSatMaxIPv6SegmentLength >= posInPtr && 0 <= posInPtr )
+            {
+            LOG( SIMPLE, "LAUNCHBROWSER: \
+            CLaunchBrowserHandler::ValidateIPv6Address posInPtr valid" )
+            segCounter++;
+            posInDes += posInPtr;
+            segment = segPtr.Mid( 0, posInPtr );
+            LOG2( SIMPLE, "LAUNCHBROWSER: \
+            CLaunchBrowserHandler::ValidateIPv6Address first:%d",first )
+            if ( first )
+                {
+                first = EFalse;
+                
+                if ( 0 >= segment.Length() )
+                    {
+                    retVal = EFalse;
+                    }
+                }
+                
+            if ( KSatMaxIPv6SegmentLength < segment.Length() )
+                {
+                LOG( SIMPLE, "LAUNCHBROWSER: \
+                CLaunchBrowserHandler::ValidateIPv6Address address invalid" )
+                retVal = EFalse;
+                }
+                
+            if ( !ValidateHexadecimal( segment ) )
+                {
+                LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::\
+                ValidateIPv6Address address invalid hex" )
+                retVal = EFalse;
+                }
+            
+            // Skip colon.
+            posInDes++; 
+            segPtr.Set( aAddress.Mid( posInDes, 
+                aAddress.Length() - posInDes ) );
+            }
+        else 
+            {
+            retVal = EFalse;
+            }
+        }
+
+    // IPv6 address is consist of 8 segment
+    if ( KSatMaxIPv6SegmentCounter == segCounter && retVal )
+        {
+        LOG( SIMPLE, "LAUNCHBROWSER: \
+        CLaunchBrowserHandler::ValidateIPv6Address valid address" )
+        // Validate the last segment.
+        segment = segPtr;
+        
+        if ( KSatMaxIPv6SegmentLength < segment.Length() )
+            {
+            LOG( SIMPLE, "LAUNCHBROWSER: \
+            CLaunchBrowserHandler::ValidateIPv6Address address invalid" )
+            retVal = EFalse;
+            }
+            
+        if ( !ValidateHexadecimal( segment ) )
+            {
+            LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::\
+            ValidateIPv6Address address invalid hex" )
+            retVal = EFalse;
+            }
+        }
+    else
+        {
+        retVal = EFalse;
+        }
+    
+    LOG2( SIMPLE, "LAUNCHBROWSER: \
+          CLaunchBrowserHandler::ValidateIPv6Address exiting,retVal:%d", 
+          retVal )
+
+    return retVal;
+    }
+    
+// --------------------------------------------------------------------------
+// Check the validity of a gateway IP address. Either it is IPv4 or IPv6. 
+// For example, 210.13.246.172 or 3ffe:ffff:101::230:6eff:fe04:d9ff.
+// --------------------------------------------------------------------------
+TInt CLaunchBrowserHandler::ValidateGatewayAddress( 
+        const TDesC16& aAddress )
+    {
+    LOG2( SIMPLE, "LAUNCHBROWSER: \
+          CLaunchBrowserHandler::ValidateGatewayAddress calling,length of \
+          aAddress: %d", aAddress.Length() )
+    
+    LOG2( SIMPLE, "LAUNCHBROWSER: \
+    CLaunchBrowserHandler::ValidateGatewayAddress aAddress: %s", &aAddress )
+    TInt ipvType( KSatInvalidPdpType );
+    TInt length( aAddress.Length() );
+    
+    if ( length )
+        {
+        // The maximum length of a IP address is less than 39.
+        if ( KSatMaxIPv4AddressLength >= length && 
+                KSatMinIPv4AddressLength <= length )
+            {
+            LOG( SIMPLE, "LAUNCHBROWSER: \
+            CLaunchBrowserHandler::ValidateGatewayAddress IPV4 address" )
+            // aAddress is a IPv4 address.
+            if ( ValidateIPv4Address( aAddress ) )
+                {
+                LOG( SIMPLE, "LAUNCHBROWSER: \
+                CLaunchBrowserHandler::ValidateGatewayAddress valid IPV4 \
+                address" )
+                ipvType = RPacketContext::EPdpTypeIPv4;
+                }
+            }
+        else if ( KSatMaxIPv6AddressLength >= length && 
+                    KSatMinIPv6AddressLength <= length )
+            {
+            LOG( SIMPLE, "LAUNCHBROWSER: \
+            CLaunchBrowserHandler::ValidateGatewayAddress IPV6 address" )
+            // aAddress is a IPv6 address.
+            if ( ValidateIPv6Address( aAddress ) )
+                {
+                LOG( SIMPLE, "LAUNCHBROWSER: \
+                CLaunchBrowserHandler::ValidateGatewayAddress valid IPV6 \
+                address" )
+                ipvType = RPacketContext::EPdpTypeIPv6;
+                }
+            }
+        }
+    
+    LOG2( SIMPLE, "LAUNCHBROWSER: \
+        CLaunchBrowserHandler::ValidateGatewayAddress exiting,ipvType:%d",
+        ipvType )
+
+    // Returned IP address.
+    return ipvType;
+    }
+
+// --------------------------------------------------------------------------
+// Separate the port number from a address if it is existing. For example,
+// 210.13.246.172:8080.
+// --------------------------------------------------------------------------
+void CLaunchBrowserHandler::SeparatePortNumberFromAddress( 
+    const TDesC16& aAddress, 
+    TDes16& aPureAddr,
+    TUint32& aPortNumber )
+    {
+    LOG2( SIMPLE, "LAUNCHBROWSER: \
+    CLaunchBrowserHandler::SeparatePortNumberFromAddress calling,\
+    aAddress: %s", &aAddress )
+
+    // The following three variables are used to locate the port number.
+    TBool isSeparator( EFalse );
+    TBool portNumberBegin( EFalse );
+    TBool portNumberEnd( EFalse );
+    TBool pureAddrEnd( EFalse );
+    // Count delimiters in the address.
+    TInt delimiterCounter( 0 );
+    // Count symbols in a segment of the address.
+    TInt symbolCounter( 0 );
+    // Currsent position of the address descriptor.
+    TInt curPos( 0 );
+    TInt posOffset( 0 );
+    // The position of the last valid character.
+    TInt rightBound( 0 );
+    // Digital port number.
+    TUint32 portNumber( KSatLaunchBrowserProxyPortNumber );
+    // The descriptor pointer for the address.
+    TPtrC addrPtr;
+    // The length of the address.
+    TInt addrLen( 0 );
+    
+    // The address is a valid descriptor.
+    if ( NULL != &aAddress &&
+            KSatMinIPv4AddressLength <= aAddress.Length() )
+        {
+        addrPtr.Set( aAddress );
+        addrLen = aAddress.Length();
+        curPos = addrPtr.Find( KSatIPv4Delimiter );
+        
+        LOG2( SIMPLE, "CLaunchBrowserHandler::\
+        SeparatePortNumberFromAddress curPos: %i", curPos )
+        if ( KErrNotFound != curPos )
+            {
+            // Skip three delimiters in the IPv4 address.
+            delimiterCounter++;
+     
+            while ( KSatMaxIPv4SegmentCounter > delimiterCounter
+                        && curPos < addrLen )
+                {
+                curPos++;
+                posOffset = addrPtr.Right( addrLen - curPos ).Find( 
+                                KSatIPv4Delimiter );
+                LOG2( SIMPLE, "CLaunchBrowserHandler::\
+                SeparatePortNumberFromAddress posOffset: %i", posOffset )
+                if ( KErrNotFound != posOffset )
+                    {
+                    delimiterCounter++;
+                    curPos += posOffset;
+                    }
+                else
+                    {
+                    delimiterCounter = KSatMaxIPv4SegmentCounter;
+                    }
+                }
+
+            // Locate the separator between the pure address and 
+            // the port number.
+            curPos++;
+     
+            while ( curPos < addrLen 
+                &&  KSatMaxIPv4SegmentLength > symbolCounter 
+                && !isSeparator )
+                {
+                TChar ch( addrPtr[curPos] );
+     
+                if ( ch.IsAlphaDigit() )
+                    {
+                    LOG( SIMPLE, "CLaunchBrowserHandler::\
+                    SeparatePortNumberFromAddress AlphaDigit" )
+                    symbolCounter++;
+                    }
+                else
+                    {
+                    isSeparator = ETrue;
+                    }
+
+                curPos++;
+                }
+            }
+        else
+            {
+            curPos = addrPtr.Find( KSatIPv6Delimiter );
+            LOG2( SIMPLE, "CLaunchBrowserHandler::\
+            SeparatePortNumberFromAddress curPos: %i", curPos )
+            if ( KErrNotFound != curPos )
+                {
+                // Skip seven delimiters in the IPv6 address.
+                delimiterCounter++;
+     
+                while ( KSatMaxIPv6SegmentCounter > delimiterCounter
+                            && curPos < addrLen )
+                    {
+                    curPos++;
+                    posOffset = addrPtr.Right( addrLen - curPos ).Find( 
+                                    KSatIPv6Delimiter );
+                    LOG2( SIMPLE, "CLaunchBrowserHandler::\
+                    SeparatePortNumberFromAddress posOffset: %i", posOffset )
+                    if ( KErrNotFound != posOffset )
+                        {
+                        delimiterCounter++;
+                        curPos += posOffset;
+                        }
+                    }
+
+                // Locate the separator between the pure address and 
+                // the port number.
+                curPos++;
+     
+                while ( curPos < addrLen && 
+                            KSatMaxIPv6SegmentLength > symbolCounter && 
+                            !isSeparator )
+                    {
+                    TChar ch( addrPtr[curPos] );
+     
+                    if ( ch.IsAlphaDigit() )
+                        {
+                        LOG( SIMPLE, "CLaunchBrowserHandler::\
+                        SeparatePortNumberFromAddress AlphaDigit" )
+                        symbolCounter++;
+                        }
+                    else
+                        {
+                        isSeparator = ETrue;
+                        }
+
+                    curPos++;
+                    }
+                }
+            }
+
+        // Extract the pure address.
+        while ( curPos < addrLen && KSatMinIPv4AddressLength < curPos 
+                && !pureAddrEnd )
+            {
+            TChar ch( addrPtr[curPos] );
+            
+            if ( !ch.IsAlphaDigit() )
+                {
+                LOG( SIMPLE, "CLaunchBrowserHandler::\
+                SeparatePortNumberFromAddress not AlphaDigit" )
+                curPos--;
+                }
+            else
+                {
+                pureAddrEnd = ETrue;
+                }
+            }
+
+        if ( curPos <= addrLen )
+            {
+            aPureAddr.Copy( addrPtr.Left( curPos + 1 ) );
+            }
+
+        // Extract the port number.
+        // Locate the beginning of the port number.
+        curPos++;
+    
+        while ( curPos < addrLen && !portNumberBegin)
+            {
+            TChar ch( addrPtr[curPos] );
+
+            if ( ch.IsDigit() )
+                {
+                LOG( SIMPLE, "CLaunchBrowserHandler::\
+                SeparatePortNumberFromAddress Digit" )
+                portNumberBegin = ETrue;
+                }
+            else
+                {
+                curPos++;
+                }
+            }
+        
+        // Locate the end of the port number.    
+        rightBound = addrLen;
+        rightBound--;
+
+        while ( rightBound > curPos && !portNumberEnd )
+            {
+            TChar ch( addrPtr[rightBound] );
+
+            if ( ch.IsDigit() )
+                {
+                LOG( SIMPLE, "CLaunchBrowserHandler::\
+                SeparatePortNumberFromAddress Digit" )
+                portNumberEnd = ETrue;
+                }
+            else 
+                {
+                rightBound--;
+                }
+            }
+        
+        // Convert the port number and validate it.
+        // Set the port number to default port number
+        aPortNumber = portNumber; 
+        if ( curPos < rightBound && rightBound < addrLen )
+            {
+            portNumber = ConvertDesToInt( 
+                addrPtr.Mid( curPos, rightBound - curPos + 1 ) );
+
+            if ( KSatMaxProxyPortNumber > portNumber &&
+                    KSatMinProxyPortNumber < portNumber )
+                {
+                LOG( SIMPLE, "CLaunchBrowserHandler::\
+                SeparatePortNumberFromAddress valid portNumber" )
+                aPortNumber = portNumber;
+                }
+            }
+        }
+        
+    LOG( SIMPLE, 
+    "LAUNCHBROWSER: CLaunchBrowserHandler::SeparatePortNumberFromAddress \
+    exiting" )
+    }
+
+// --------------------------------------------------------------------------
+// Fulfill connecion method params with default params.
+// --------------------------------------------------------------------------
+void CLaunchBrowserHandler::FulfillConnnectionMethodL( 
+    RCmManager& aCmManager,
+    RCmConnectionMethod& aCm )
+    {
+    LOG( SIMPLE, "SATENGINE: CLaunchBrowserHandler::\
+        FulfillConnnectionMethodL calling" )
+    
+    // The following 3 lines are used to preset the default parameters
+    // to avoid doing nothing for them if leaving.
+    aCm.SetStringAttributeL( CMManager::EPacketDataAPName, 
+        KSatGprsAccessPointName );
+    aCm.SetBoolAttributeL( CMManager::ECmIFPromptForAuth, EFalse );
+    aCm.SetBoolAttributeL( CMManager::ECmDisablePlainTextAuth, EFalse );
+        
+    // Get default access point ID.
+    RCmConnectionMethod defCm;
+    CleanupClosePushL( defCm );
+    
+    TInt ret ( KErrNotFound );
+    GetDefConnMethodL( aCmManager, defCm, ret );
+    
+    if ( !ret )
+        {
+        // Default AP found! Copy parameters from
+        // default AP to new created AP.
+        
+        // Copy AP name.
+        HBufC* strValue = defCm.GetStringAttributeL( 
+            CMManager::EPacketDataAPName );
+        LOG2( SIMPLE, "SATENGINE: CLaunchBrowserHandler::\
+            FulfillConnnectionMethodL AP Name is %s", strValue )
+        CleanupStack::PushL( strValue );
+        aCm.SetStringAttributeL( CMManager::EPacketDataAPName, *strValue );
+        CleanupStack::PopAndDestroy( strValue );
+        
+        // Copy authentic name
+        strValue = defCm.GetStringAttributeL( CMManager::ECmIFAuthName );
+        LOG2( SIMPLE, "SATENGINE: CLaunchBrowserHandler::\
+            FulfillConnnectionMethodL Auch name is %s", strValue )
+        CleanupStack::PushL( strValue );
+        aCm.SetStringAttributeL( CMManager::ECmIFAuthName, *strValue );
+        CleanupStack::PopAndDestroy( strValue );
+        
+        // Copy authentic pass
+        strValue = defCm.GetStringAttributeL( CMManager::ECmIFAuthPass );
+        LOG2( SIMPLE, "SATENGINE: CLaunchBrowserHandler::\
+            FulfillConnnectionMethodL Auch pass is %s", strValue )
+        CleanupStack::PushL( strValue );
+        aCm.SetStringAttributeL( CMManager::ECmIFAuthPass, *strValue );
+        CleanupStack::PopAndDestroy( strValue );
+        
+        // Copy default URL
+        strValue = defCm.GetStringAttributeL( CMManager::ECmStartPage );
+        LOG2( SIMPLE, "SATENGINE: CLaunchBrowserHandler::\
+            FulfillConnnectionMethodL Start page pass is %s", strValue )
+        CleanupStack::PushL( strValue );
+        aCm.SetStringAttributeL( CMManager::ECmStartPage, *strValue );
+        CleanupStack::PopAndDestroy( strValue );
+        
+        // Copy status if prompt for auth
+        TBool bValue = defCm.GetBoolAttributeL( 
+                CMManager::ECmIFPromptForAuth );
+        aCm.SetBoolAttributeL( CMManager::ECmIFPromptForAuth, bValue );
+        
+        // Copy security status.
+        bValue = defCm.GetBoolAttributeL( 
+                CMManager::ECmDisablePlainTextAuth );
+        aCm.SetBoolAttributeL( CMManager::ECmIFPromptForAuth, bValue );
+        }
+        
+    CleanupStack::PopAndDestroy( &defCm );
+    
+    LOG( SIMPLE, "SATENGINE: CLaunchBrowserHandler::\
+        FulfillConnnectionMethodL exiting" )
+    }
+
+// --------------------------------------------------------------------------
+// Check the validity of offered bearer type
+// --------------------------------------------------------------------------
+void CLaunchBrowserHandler::ValidateBearerTypeL( RCmConnectionMethod& aCm, 
+                                                 TInt& aIsValid )
+    {
+    LOG( SIMPLE, "SATENGINE: CLaunchBrowserHandler::\
+         ValidateBearerTypeL calling" )
+        
+    TUint32 bearerType = aCm.GetIntAttributeL( 
+        CMManager::ECmBearerType );
+    LOG2( SIMPLE, "SATENGINE: CLaunchBrowserHandler::\
+        ValidateBearerTypeL bearerType=0x%x", bearerType )
+    
+    if ( KUidPacketDataBearerType == bearerType )
+        {
+        LOG( SIMPLE, "SATENGINE: CLaunchBrowserHandler::\
+            ValidateBearerTypeL bearer type is GPRS" )
+        aIsValid = KErrNone;
+        }
+    
+    LOG2( SIMPLE, "SATENGINE: CLaunchBrowserHandler::\
+          ValidateBearerTypeL exiting, aIsValid=%d", aIsValid )
+    }
+
+// --------------------------------------------------------------------------
+// Get default connection method
+// --------------------------------------------------------------------------
+void CLaunchBrowserHandler::GetDefConnMethodL( RCmManager& aCmManager,
+                                               RCmConnectionMethod& aDefCm,
+                                               TInt& aIsValid )
+    {
+    LOG( SIMPLE, "SATENGINE: CLaunchBrowserHandler::\
+         GetDefConnMethodL calling" )   
+         
+    // Go through the default connection methods to find 
+    // the one valid connection method.   
+    TCmDefConnValue defConn;
+    aCmManager.ReadDefConnL( defConn );
+    
+    LOG3( SIMPLE, "SATENGINE: CLaunchBrowserHandler::\
+      GetDefConnMethodL DefConn type=%d, id=%d", 
+      defConn.iType, defConn.iId )
+    
+    // Mark aIsFound as KErrNone if there is one valid 
+    // connection method, otherwise KErrNotFound.
+    aIsValid = KErrNotFound;
+    
+    // Default setting is a connection method
+    if ( ECmDefConnConnectionMethod == defConn.iType )
+        {
+        LOG( SIMPLE, "SATENGINE: CLaunchBrowserHandler::\
+             GetDefConnMethodL ECmDefConnConnectionMethod" )
+        aDefCm = aCmManager.ConnectionMethodL( defConn.iId );
+        // Check bearer type, leave if not GPRS
+        ValidateBearerTypeL( aDefCm, aIsValid );
+        }
+
+    // Default setting is a destination
+    else if ( ECmDefConnDestination == defConn.iType )
+        {
+        LOG( SIMPLE, "SATENGINE: CLaunchBrowserHandler::\
+            GetDefConnMethodL ECmDefConnDestination" )
+        RCmDestination defDes = aCmManager.DestinationL( defConn.iId );
+        
+        TInt desCount = defDes.ConnectionMethodCount();
+        
+        LOG2( SIMPLE, "SATENGINE: CLaunchBrowserHandler::\
+            GetDefConnMethodL ECmDefConnDestination count=%d",
+            desCount )
+        
+        for ( TInt i = 0; 
+              desCount > 0 && aIsValid != KErrNone && i < desCount; i++ )
+            {
+            // Go through all the connection methods, 
+            // until find a valid one.
+            aDefCm = defDes.ConnectionMethodL( i );
+            ValidateBearerTypeL( aDefCm, aIsValid );
+            }
+        }
+    else
+        {
+        aIsValid = KErrNotFound;
+        }
+    LOG( SIMPLE, "SATENGINE: CLaunchBrowserHandler::GetDefConnMethodL exit" )
+    }
+// End Of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/LaunchBrowserCmd/src/std.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 functions
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    <implementationproxy.h>
+#include    "CLaunchBrowserHandler.h"
+
+// CONSTANTS
+
+const TImplementationProxy implementationTable[] =
+    {
+    //lint -e{611,1924} Warning "Suspicious cast" can not be avoided.
+    IMPLEMENTATION_PROXY_ENTRY( 0x1000A88E, CLaunchBrowserHandler::NewL )
+    };
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy ECOM framework factory function
+// Calculates the number of implementations.
+// Returns: Implementation proxy.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount ) // Number of implementations
+    {
+    aTableCount =
+        sizeof( implementationTable ) /
+        sizeof( TImplementationProxy );
+    return implementationTable;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/MoSmControlCmd/group/MoSmControl.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* 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:  Project definition file for project MoSmControlCmd plug-in
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../../inc/SatMacroes.h"
+
+TARGET                  MoSmControlCmd.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D 0x1020298D
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  std.cpp
+SOURCE                  CMoSmControlHandler.cpp
+
+START RESOURCE          1020298D.rss
+TARGET                  MoSmControlCmd.rsc
+END
+
+USERINCLUDE             ../../../inc
+USERINCLUDE             ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+SYSTEMINCLUDE           ../../../../../inc      // Domain telephony
+SYSTEMINCLUDE           ../../../../inc         // Subsystem satengine
+
+LIBRARY                 euser.lib
+LIBRARY                 etelsat.lib
+LIBRARY                 SatEngine.lib
+
+#ifdef ENABLE_SAT_LOGGING
+LIBRARY                 flogger.lib
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/MoSmControlCmd/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 MoSmControlCmd plug-in
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+MoSmControl.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/MoSmControlCmd/inc/CMoSmControlHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -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:  MO Short Message Control command handler
+*
+*/
+
+
+
+#ifndef CMOSMCONTROLHANDLER_H
+#define CMOSMCONTROLHANDLER_H
+
+//  INCLUDES
+#include <etelsat.h>
+#include "CSatCommandHandler.h"
+#include "SatSTypes.h"
+
+
+// FORWARD DECLARATIONS
+class MSatUtils;
+
+// CLASS DECLARATION
+
+/**
+*  Command handler for MO Short message control command
+*
+*  @lib MoSmControlCmd.lib
+*  @since Series 60 3.0
+*/
+class CMoSmControlHandler : public CSatCommandHandler
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aUtils Utils inteface
+        */
+        static CMoSmControlHandler* NewL( MSatUtils* aUtils );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CMoSmControlHandler();
+
+    public: // Functions from base classes
+
+        /**
+        * From MSatCommand.
+        */
+        void ClientResponse();
+
+    protected:  // Functions from base classes
+
+        /**
+        * From CActive Cancels the usat request.
+        */
+        void DoCancel();
+
+        /**
+        * From CSatCommandHandler Requests the command notification.
+        * @param aStatus Request status to active object notification
+        */
+        void IssueUSATRequest( TRequestStatus& aStatus );
+
+        /**
+        * From CSatCommandHandler Precheck before executing the command.
+        * @return Boolean indicating is this command allowed to execute.
+        */
+        TBool CommandAllowed();
+
+        /**
+        * From CSatCommandHandler Need for ui session.
+        * @return Boolean indicating does this command need UI session.
+        */
+        TBool NeedUiSession();
+
+        /**
+        * From CSatCommandHandler Called when USAT API notifies that command.
+        */
+        void HandleCommand();
+
+        /**
+        * From CSatCommandHandler. Indicates the failure of launching ui client.
+        */
+        void UiLaunchFailed();
+
+    private:  // Default functions
+
+        /**
+        * C++ default constructor
+        */
+        CMoSmControlHandler();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private:    // Data
+
+        // MoSmControl command data.
+        RSat::TMoSmControlV1        iMoSmControlData;
+        // MoSmControl command package.
+        RSat::TMoSmControlV1Pckg    iMoSmControlPckg;
+        // MoSmControl command data for SatClient.
+        TSatNotificationV1           iMoSmControlSendData;
+        // MoSmControl command package for SatClient.
+        TSatNotificationV1Pckg       iMoSmControlSendPckg;
+        // MoSmControl command response data from SatClient
+        TSatNotificationRspV1         iMoSmControlUiRespData;
+        // MoSmControl command response package from SatClient
+        TSatNotificationRspV1Pckg     iMoSmControlUiRespPckg;
+        // Indicates is UI needed or not
+        TBool iNeedUiSession;
+
+    };
+
+#endif      // CMOSMCONTROLHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/MoSmControlCmd/inc/MoSmControlCmd.rls	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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 headers for project MoSmControlCmd
+*
+*/
+
+
+#ifndef MOSMCONTROLCMD_RLS
+#define MOSMCONTROLCMD_RLS
+
+rls_string STRING_r_mosmcontrolcmd_display_name "MoSmControl Command"
+rls_string STRING_r_mosmcontrolcmd_default_data "MoSmControlCmd"
+rls_string STRING_r_mosmcontrolcmd_opaque_data  ""
+
+#endif // MOSMCONTROLCMD_RLS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/MoSmControlCmd/src/1020298D.rss	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 1020 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Registry information for ECOM
+*
+*/
+
+
+
+//  INCLUDES
+#include <registryinfo.rh>
+#include "MoSmControlCmd.rls"
+
+//  RESOURCE DEFINITIONS
+// -----------------------------------------------------------------------------
+//
+// MoSmControlCmdInfo
+// Registeration information for ECOM
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO MoSmControlCmdInfo
+    {
+    dll_uid = 0x1020298D;
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x1000f001;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x1020298E;
+                    version_no   = 1;
+                    display_name = STRING_r_mosmcontrolcmd_display_name;
+                    default_data = STRING_r_mosmcontrolcmd_default_data;
+                    opaque_data  = STRING_r_mosmcontrolcmd_opaque_data;
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/MoSmControlCmd/src/CMoSmControlHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,369 @@
+/*
+* 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:  Handles MO ShortMessage Control command
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "MSatApi.h"
+#include    "MSatUtils.h"
+#include    "MSatUiSession.h"
+#include    "MSatSUiClientHandler.h"
+#include    "CMoSmControlHandler.h"
+#include    "SatLog.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMoSmControlHandler::CMoSmControlHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+//lint -e{1403, 1769} Can not be initialized, harmless.
+CMoSmControlHandler::CMoSmControlHandler() :
+    CSatCommandHandler(),
+    iMoSmControlData(),
+    iMoSmControlPckg( iMoSmControlData ),
+    iMoSmControlSendData(),
+    iMoSmControlSendPckg( iMoSmControlSendData ),
+    iMoSmControlUiRespData(),
+    iMoSmControlUiRespPckg( iMoSmControlUiRespData )
+    {
+    LOG( SIMPLE, "MOSMCONTROL: \
+        CMoSmControlHandler::CMoSmControlHandler calling - exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CMoSmControlHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CMoSmControlHandler::ConstructL()
+    {
+    LOG( SIMPLE, "MOSMCONTROL: CMoSmControlHandler::ConstructL calling" )
+
+    // Register notification observer
+    iUtils->RegisterServiceRequestL(
+        ESatSProactiveNotification,
+        ESatSProactiveNotificationResponse,
+        this );
+
+    LOG( SIMPLE, "MOSMCONTROL: CMoSmControlHandler::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CMoSmControlHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CMoSmControlHandler* CMoSmControlHandler::NewL( MSatUtils* aUtils )
+    {
+    LOG( SIMPLE, "MOSMCONTROL: CMoSmControlHandler::NewL calling" )
+
+    CMoSmControlHandler* self = new( ELeave ) CMoSmControlHandler();
+
+    CleanupStack::PushL( self );
+    self->BaseConstructL( aUtils );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "MOSMCONTROL: CMoSmControlHandler::NewL exiting" )
+    return self;
+    }
+
+
+// Destructor
+CMoSmControlHandler::~CMoSmControlHandler()
+    {
+    LOG( SIMPLE,
+        "MOSMCONTROL: CMoSmControlHandler::~CMoSmControlHandler calling" )
+
+    Cancel();
+
+    LOG( SIMPLE,
+        "MOSMCONTROL: CMoSmControlHandler::~CMoSmControlHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CMoSmControlHandler::ClientResponse
+// Handles responses from client.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMoSmControlHandler::ClientResponse()
+    {
+    LOG( SIMPLE, "MOSMCONTROL: CMoSmControlHandler::ClientResponse calling" )
+
+    // Start to receive more commands. We have to start again here because
+    // we don't send terminal response, wich does this automatically.
+    Start();
+
+    // Inform the system that we are finished executing. If there is proactive
+    // SendSm command pending, it is notified and it continues from here.
+    iUtils->NotifyEvent( MSatUtils::EMoSmControlDone );
+
+    // If we launched UI, close it.
+    if ( !iUtils->SatUiHandler().UiLaunchedByUser() )
+        {
+        LOG( SIMPLE, "MOSMCONTROL: CMoSmControlHandler::ClientResponse \
+             ESimSessionEndCallBack" )
+        iUtils->NotifyEvent( MSatUtils::ESimSessionEndCallBack );
+        }
+
+    else
+        {
+        LOG( SIMPLE, "MOSMCONTROL: CMoSmControlHandler::ClientResponse \
+             EDelaySimSessionEnd" )
+        // Inform the session that we are done here.
+        iUtils->NotifyEvent( MSatUtils::EDelaySimSessionEnd );
+        }
+
+    // We do not send TerminalResponse to SIM.
+    LOG( SIMPLE, "MOSMCONTROL: CMoSmControlHandler::ClientResponse exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CMoSmControlHandler::DoCancel
+// Cancels the SAT request
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMoSmControlHandler::DoCancel()
+    {
+    LOG( SIMPLE, "MOSMCONTROL: CMoSmControlHandler::DoCancel calling" )
+
+    iUtils->USatAPI().NotifyMoSmControlCancel();
+
+    LOG( SIMPLE, "MOSMCONTROL: CMoSmControlHandler::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CMoSmControlHandler::IssueUSATRequest
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMoSmControlHandler::IssueUSATRequest( TRequestStatus& aStatus )
+    {
+    LOG( SIMPLE, "MOSMCONTROL: CMoSmControlHandler::IssueUSATRequest calling" )
+
+    // Clear the IPC package.
+    new (&iMoSmControlData) RSat::TMoSmControlV1();
+    iNeedUiSession = EFalse;
+
+    iUtils->USatAPI().NotifyMoSmControl( aStatus, iMoSmControlPckg );
+
+    LOG( SIMPLE, "MOSMCONTROL: CMoSmControlHandler::IssueUSATRequest exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CMoSmControlHandler::CommandAllowed
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CMoSmControlHandler::CommandAllowed()
+    {
+    LOG( SIMPLE, 
+        "MOSMCONTROL: CMoSmControlHandler::CommandAllowed calling - exiting" )
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CMoSmControlHandler::NeedUiSession
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CMoSmControlHandler::NeedUiSession()
+    {
+    LOG( SIMPLE, "MOSMCONTROL: CMoSmControlHandler::NeedUiSession calling" )
+    // UI is not needed, if control is AllowedWithMod and AlphaId is NULL or
+    // control is Allowed and AlphaId is not provided
+
+    const RSat::TAlphaIdStatus alphaId( iMoSmControlData.iAlphaId.iStatus );
+    const RSat::TControlResult control( iMoSmControlData.iResult );
+    
+    const TBool alphaIdNull( RSat::EAlphaIdNull == alphaId ||
+                             RSat::EAlphaIdNotSet == alphaId );
+
+    const TBool controlAllowed( 
+                RSat::EAllowedNoModification == control ||
+                RSat::EControlResultNotSet == control );
+
+    if ( RSat::EAllowedWithModifications == control && 
+         alphaIdNull )
+        {
+        LOG( SIMPLE, "MOSMCONTROL: CMoSmControlHandler::NeedUiSession \
+        RSat::EAllowedWithModifications == control" )
+        iNeedUiSession = EFalse;
+        }
+    else if ( controlAllowed && ( RSat::EAlphaIdProvided != alphaId ) )
+        {
+        LOG( SIMPLE, "MOSMCONTROL: CMoSmControlHandler::NeedUiSession \
+        RSat::EAlphaIdProvided != alphaId" )
+        iNeedUiSession = EFalse;
+        }
+    else
+        {
+        iNeedUiSession = ETrue;
+        }
+
+    LOG2( SIMPLE, "MOSMCONTROL: CMoSmControlHandler::NeedUiSession exiting,\
+          iNeedUiSession:%d", iNeedUiSession )
+    return iNeedUiSession;
+    }
+
+// -----------------------------------------------------------------------------
+// CMoSmControlHandler::HandleCommand
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMoSmControlHandler::HandleCommand()
+    {
+    LOG( SIMPLE, "MOSMCONTROL: CMoSmControlHandler::HandleCommand calling" )
+
+    // Notify other commands that we are executing.
+    iUtils->NotifyEvent( MSatUtils::EMoSmControlExecuting );
+    LOG2( SIMPLE, "MOSMCONTROL: CMoSmControlHandler::HandleCommand \
+          iNeedUiSession:%d", iNeedUiSession )
+    if ( iNeedUiSession )
+        {
+        // Clear send data.
+        TSatNotificationV1 temp;
+        iMoSmControlSendData = temp;
+        
+        // Enums to UI related parameters
+        TSatAlphaIdStatus satAlphaIdStatus;
+        TSatControlResult satControlResult;
+        LOG2( SIMPLE, "MOSMCONTROL: CMoSmControlHandler::HandleCommand \
+              iMoSmControlData.iAlphaId.iStatus:%d", 
+              iMoSmControlData.iAlphaId.iStatus )
+        // Map RSat value
+        switch ( iMoSmControlData.iAlphaId.iStatus )
+            {
+            case RSat::EAlphaIdProvided :
+                {
+                satAlphaIdStatus = ESatAlphaIdNotNull;
+                break;
+                }
+
+            case RSat::EAlphaIdNotPresent :
+                {
+                satAlphaIdStatus = ESatAlphaIdNotProvided;
+                break;
+                }
+
+            // Use this also as a default value
+            case RSat::EAlphaIdNull :
+            case RSat::EAlphaIdNotSet :
+            default :
+                {
+                satAlphaIdStatus = ESatAlphaIdNull;
+                break;
+                }
+            }
+        LOG2( SIMPLE, "MOSMCONTROL: CMoSmControlHandler::HandleCommand \
+              iMoSmControlData.iResult:%d", iMoSmControlData.iResult )
+        // Map RSat value
+        switch ( iMoSmControlData.iResult )
+            {
+            case RSat::ENotAllowed :
+                {
+                satControlResult = ESatNotAllowed;
+                break;
+                }
+
+            case RSat::EAllowedWithModifications :
+                {
+                satControlResult = ESatAllowedWithModifications;
+                break;
+                }
+
+            // Use this also as a default value
+            case RSat::EAllowedNoModification :
+            case RSat::EControlResultNotSet :
+            default :
+                {
+                satControlResult = ESatAllowedNoModification;
+                break;
+                }
+            }
+
+        // Build the IPC package.
+        iMoSmControlSendData.iCommand = ESatSMoSmControlNotify;
+        iMoSmControlSendData.iText = iMoSmControlData.iAlphaId.iAlphaId;
+        iMoSmControlSendData.iAlphaIdStatus = satAlphaIdStatus;
+        iMoSmControlSendData.iControlResult = satControlResult;
+
+        // Register notification observer
+        TRAPD( regErr, iUtils->RegisterServiceRequestL(
+            ESatSProactiveNotification,
+            ESatSProactiveNotificationResponse,
+            this )
+            ); // TRAPD
+        LOG2( SIMPLE, "MOSMCONTROL: CMoSmControlHandler::HandleCommand \
+              regErr:%d", regErr )
+        // No need to check error value, since we cannot send terminal response
+        // for this command
+        if ( KErrNone == regErr )
+            {
+            // Get UISession.
+            MSatUiSession* uiSession = iUtils->SatUiHandler().UiSession();
+
+            // Send command to SatClient.
+            uiSession->SendCommand( &iMoSmControlSendPckg,
+                &iMoSmControlUiRespPckg, ESatSProactiveNotification );
+            }
+        }
+
+    else
+        {
+        // Restart request since we don't get client response
+        Start();
+
+        // Inform the system that we are finished executing. If there is 
+        // proactive
+        // SendSm command pending, it is notified and it continues from here.
+        iUtils->NotifyEvent( MSatUtils::EMoSmControlDone );
+
+        // Inform the session that we are done here.
+        iUtils->NotifyEvent( MSatUtils::EDelaySimSessionEnd );
+        }
+
+    LOG( SIMPLE, "MOSMCONTROL: CMoSmControlHandler::HandleCommand exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CMoSmControlHandler::UiLaunchFailed
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMoSmControlHandler::UiLaunchFailed()
+    {
+    LOG( SIMPLE, "MOSMCONTROL: CMoSmControlHandler::UiLaunchFailed calling" )
+
+    // We cannot send terminal response to UICC since it doesn't
+    // expect terminal response from MoSmControl command...
+
+    // Inform the session that we are done here.
+    iUtils->NotifyEvent( MSatUtils::EDelaySimSessionEnd );
+
+    // Start to receive more commands.
+    Start();
+
+    LOG( SIMPLE, "MOSMCONTROL: CMoSmControlHandler::UiLaunchFailed exiting" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/MoSmControlCmd/src/std.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 functions
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    <implementationproxy.h>
+#include    "CMoSmControlHandler.h"
+
+// CONSTANTS
+
+const TImplementationProxy implementationTable[] =
+    {
+    //lint -e{611,1924} Warning "Suspicious cast" can not be avoided.
+    IMPLEMENTATION_PROXY_ENTRY( 0x1020298E, CMoSmControlHandler::NewL )
+    };
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy ECOM framework factory function
+// Calculates the number of implementations.
+// Returns: Implementation proxy.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount ) // Number of implementations
+    {
+    aTableCount =
+        sizeof( implementationTable ) /
+        sizeof( TImplementationProxy );
+    return implementationTable;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/OpenChannelCmd/group/OpenChannelCmd.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* 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:  Project definition file for project OpenChannel plug-in
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../../inc/SatMacroes.h"
+
+TARGET                  OpenChannelCmd.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D 0x101F79FA
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  std.cpp
+SOURCE                  COpenChannelHandler.cpp
+
+START RESOURCE          101F79FA.rss
+TARGET                  OpenChannelCmd.rsc
+END
+
+USERINCLUDE             ../../../inc
+USERINCLUDE             ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+SYSTEMINCLUDE           ../../../../../inc      // Domain telephony
+SYSTEMINCLUDE           ../../../../inc         // Subsystem satengine
+
+LIBRARY                 euser.lib
+LIBRARY                 etelsat.lib
+LIBRARY                 SatEngine.lib
+LIBRARY                 commdb.lib
+LIBRARY                 extendedconnpref.lib 
+
+#ifdef ENABLE_SAT_LOGGING
+LIBRARY                 flogger.lib
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/OpenChannelCmd/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 OpenChannel plug-in
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+OpenChannelCmd.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/OpenChannelCmd/inc/COpenChannelHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,278 @@
+/*
+* 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:  OpenChannel command handler
+*
+*/
+
+
+#ifndef COPENCHANNELHANDLER_H
+#define COPENCHANNELHANDLER_H
+
+#include <etelsat.h>
+
+#include "CSatCommandHandler.h"
+#include "MSatBIPDataChannel.h"
+#include "MSatBIPUtils.h"
+#include "SatSTypes.h"
+#include "MSatConnectionObserver.h"
+
+class MSatUtils;
+class MSatBIPDataChannel;
+
+/**
+ *  Command handler for OpenChannel command.
+ *
+ *  @lib OpenChannelCmd.lib
+ *  @since S60 v3.0
+ */
+class COpenChannelHandler : public CSatCommandHandler,
+                            public MSatConnectionObserver
+    {
+
+public:
+
+    static COpenChannelHandler* NewL( MSatUtils* aUtils );
+
+    virtual ~COpenChannelHandler();
+
+// from base class MSatCommand
+
+    /**
+     * From MSatCommand.
+     * Response from the client
+     *
+     */
+    void ClientResponse();
+    
+// from base class MSatConnectionObserver
+
+    /**
+     * From MSatConnectionObserver.
+     * Notification from the connection.
+     *
+     * @param aError Indicates the status of connection
+     */
+    void ConnectionNotification( TInt aError );
+    
+// from base class CSatCommandHandler
+
+    /**
+     * From CSatCommandHandler.
+     * Event notification.
+     *
+     * @param aEvent Identifies the event.
+     */
+    void Event( TInt aEvent );
+
+protected:
+
+// from base class CActive
+
+    /**
+     * From CActive.
+     * Cancels the usat request.
+     *
+     */
+    void DoCancel();
+    
+// from base class CSatCommandHandler
+
+    /**
+     * From CSatCommandHandler.
+     * Requests the command notification.
+     *
+     * @param aStatus Request status to active object notification
+     */
+    void IssueUSATRequest( TRequestStatus& aStatus );
+
+    /**
+     * From CSatCommandHandler.
+     * Precheck before executing the command.
+     *
+     * @return Boolean indicating is this command allowed to execute.
+     */
+    TBool CommandAllowed();
+
+    /**
+     * From CSatCommandHandler.
+     * Need for ui session.
+     *
+     * @return Boolean indicating does this command need UI session.
+     */
+    TBool NeedUiSession();
+
+    /**
+     * From CSatCommandHandler.
+     * Called when USAT API notifies that command.
+     *
+     */
+    void HandleCommand();
+
+    /**
+     * From CSatCommandHandler.
+     * Indicates the failure of launching ui client.
+     *
+     */
+    void UiLaunchFailed();
+
+private:
+
+    COpenChannelHandler();
+
+    void ConstructL();
+
+    /**
+     * Sets new connection settings for channel to open.
+     *
+     * @param aBearerType Bearer type for new connection.
+     */
+    void SetConnectionSettingsL(
+        MSatBIPUtils::TSatBearerType aBearerType );
+
+    /**
+     * Sets override settings into connection information.
+     *
+     * @param aIapId Unique ID in the IAP table.
+     */
+    void SetOverrideSettingsL( const TUint32 aIapId );
+
+    /**
+     * Sets up data channel. Does not activate context.
+     *
+     * @return Error code indicating connection settings setup
+     */
+    TInt SetUpChannel();
+
+    /**
+     * Activates context.
+     *
+     * @return Error code indicating the activation.
+     */
+    TInt ActivateChannel();
+
+    /**
+     * Creates and sends the terminal response on successful cases.
+     *
+     */
+    void SendSuccessTerminalRsp();
+
+    /**
+     * Sends confirmation query to UI.
+     *
+     */
+    void SendConfirmToUi();
+
+    /**
+     * Closes the channel in error cases.
+     *
+     */
+    void CloseChannel();
+
+    /**
+     * Checks parameters from SIM and makes modifications, if needed.
+     *
+     * @return TBool indicating is command allowed after parameters checked.
+     */
+    TBool CheckParameters();
+
+    /**
+     * Launches UI if it not active.
+     *
+     * @return Boolean value indicating did the function launch the UI or not.
+     */
+    TBool LaunchUiSession();
+
+private: // data
+
+    /**
+     * OpenChannel command data from SIM.
+     */
+    RSat::TOpenGprsChannelV4 iOpenChannelData;
+
+    /**
+     * OpenChannel command package.
+     */
+    RSat::TOpenGprsChannelV4Pckg iOpenChannelPckg;
+
+    /**
+     * OpenChannel response data from client.
+     */
+    RSat::TOpenChannelRspV2 iOpenChannelRsp;
+
+    /**
+     * OpenChannel response package.
+     */
+    RSat::TOpenChannelRspV2Pckg iOpenChannelRspPckg;
+
+    /**
+     * Query command data.
+     */
+    TSatQueryV1 iQueryData;
+
+    /**
+     * Query package.
+     */
+    TSatQueryV1Pckg iQueryPckg;
+
+    /**
+     * Query response.
+     */
+    TSatQueryRspV1 iQueryRsp;
+
+    /**
+     * Query rsp package.
+     */
+    TSatQueryRspV1Pckg iQueryRspPckg;
+
+    /**
+     * Commands PCmd. depends on requested bearer type.
+     */
+    RSat::TPCmd iPCmd;
+
+    /**
+     * Data channel.
+     * Not own.
+     */
+    MSatBIPDataChannel* iDataChannel;
+
+    /**
+     * Indicates did the channel setup need modifications.
+     */
+    TBool iSetUpWithModifications;
+
+    /**
+     * Indicates does this command need UI session.
+     */
+    TBool iNeedUiSession;
+
+    /**
+     * Bearer type.
+     */
+    MSatBIPUtils::TSatBearerType iBearerType;
+
+    /**
+     * Connection information.
+     */
+    MSatBIPDataChannel::TSatBipConnectionInfo iConnectionInfo;
+
+    /**
+     * Flag to signal that command has icon data
+     * To be removed when icons are allowed in this command
+     */
+    TBool iIconCommand;
+
+    };
+
+#endif      // COPENCHANNELHANDLER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/OpenChannelCmd/inc/OpenChannelCmd.rls	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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 headers for project OpenChannelCmd
+*
+*/
+
+
+#ifndef OPENCHANNELCMD_RLS
+#define OPENCHANNELCMD_RLS
+
+rls_string STRING_r_openchannelcmd_display_name "OpenChannel command"
+rls_string STRING_r_openchannelcmd_default_data "OpenChannelCmd"
+rls_string STRING_r_openchannelcmd_opaque_data  ""
+
+#endif // OPENCHANNELCMD_RLS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/OpenChannelCmd/src/101F79FA.rss	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Registry information for ECOM
+*
+*/
+
+
+
+//  INCLUDES
+#include <registryinfo.rh>
+#include "OpenChannelCmd.rls"
+
+//  RESOURCE DEFINITIONS
+// -----------------------------------------------------------------------------
+//
+// OpenChannelCmdInfo
+// Registeration information for ECOM
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO OpenChannelCmdInfo
+    {
+    dll_uid = 0x101F79FA;
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x1000f001;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x101F79FB;
+                    version_no   = 1;
+                    display_name = STRING_r_openchannelcmd_display_name;
+                    default_data = STRING_r_openchannelcmd_default_data;
+                    opaque_data  = STRING_r_openchannelcmd_opaque_data;
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/OpenChannelCmd/src/COpenChannelHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,1164 @@
+/*
+* 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:  Handles OpenChannel command
+*
+*/
+
+
+#include    <etelpckt.h>
+#include    <etelmmerr.h>
+
+#include    "COpenChannelHandler.h"
+#include    "MSatApi.h"
+#include    "MSatUtils.h"
+#include    "MSatUiSession.h"
+#include    "MSatSystemState.h"
+#include    "MSatApnHandler.h"
+#include    "SatSOpcodes.h"
+#include    "MSatSUiClientHandler.h"
+#include    "SatLog.h"
+#include    "extendedconnpref.h"
+
+const TUint8 KChannelStatusLength( 2 );
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+COpenChannelHandler* COpenChannelHandler::NewL( MSatUtils* aUtils )
+    {
+    LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::NewL calling" )
+
+    COpenChannelHandler* self = new( ELeave ) COpenChannelHandler;
+
+    CleanupStack::PushL( self );
+    self->BaseConstructL( aUtils );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::NewL exiting" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+//
+COpenChannelHandler::~COpenChannelHandler()
+    {
+    LOG( SIMPLE,
+        "OPENCHANNEL: COpenChannelHandler::~COpenChannelHandler calling" )
+
+    Cancel();
+    iDataChannel = NULL;
+
+    delete iConnectionInfo.iOverrideSet;
+
+    LOG( SIMPLE,
+        "OPENCHANNEL: COpenChannelHandler::~CCloseChannelHandler exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// From class MSatCommand.
+// Response from the client.
+// ---------------------------------------------------------------------------
+//
+void COpenChannelHandler::ClientResponse()
+    {
+    LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::ClientResponse calling" )
+
+    // Query response from client.
+    if ( !iQueryRsp.iAccepted ) // Not accepted by user
+        {
+        // Close data channel
+        CloseChannel();
+
+        if ( iQueryRsp.iSessionTerminatedByUser ) // Terminated by user
+            {
+            LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::ClientResponse \
+                Session terminated by user" )
+            // Notify sim session end command that next sim session end
+            // should close the ui session.
+            iUtils->NotifyEvent( MSatUtils::ESessionTerminatedByUser );
+
+            // Terminal response, SimSessionTerminatedByUser
+            iOpenChannelRsp.iGeneralResult = RSat::KPSessionTerminatedByUser;
+            }
+        else
+            {
+            LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::ClientResponse \
+                User not accept command" )
+
+            // Send terminal response -> User not accepted
+            iOpenChannelRsp.iGeneralResult = RSat::KPCmdNotAcceptedByUser;
+            }
+
+        iOpenChannelRsp.iInfoType = RSat::KNoAdditionalInfo;
+        iOpenChannelRsp.iAdditionalInfo.Zero();
+        iOpenChannelRsp.SetPCmdNumber( iOpenChannelData.PCmdNumber() );
+        TerminalRsp( iPCmd, iOpenChannelRspPckg );
+        }
+    else // Accepted by user
+        {
+        LOG( NORMAL,
+            "OPENCHANNEL: COpenChannelHandler::ClientResponse User accepted" )
+        // User accepted
+        const TInt linkEst( iOpenChannelData.iLinkEst );
+
+        // SetUp channel if activation is on demand
+        if ( ( RSat::EOnDemand == linkEst ) && ( KErrNone != SetUpChannel() ) )
+            {
+            // Close channel and send error if setup failed
+            CloseChannel();
+            LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::ClientResponse \
+                SetUp failed" )
+            iOpenChannelRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+            iOpenChannelRsp.iInfoType = RSat::KNoAdditionalInfo;
+            iOpenChannelRsp.iAdditionalInfo.Zero();
+            iOpenChannelRsp.SetPCmdNumber( iOpenChannelData.PCmdNumber() );
+            TerminalRsp( iPCmd, iOpenChannelRspPckg );
+            }
+        else
+            {
+            // Send terminal response
+            SendSuccessTerminalRsp();
+            }
+
+        }
+
+    LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::ClientResponse exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class MSatConnectionObserver.
+// Notification from the connection.
+// -----------------------------------------------------------------------------
+//
+void COpenChannelHandler::ConnectionNotification( TInt aError )
+    {
+    LOG2( SIMPLE, "OPENCHANNEL: COpenChannelHandler::ConnectionNotification\
+         calling with code %i", aError )
+
+    // Check connection status
+    if ( KErrNone == aError )
+        {
+        // If information indication to the user is needed, show it now.
+        if ( iNeedUiSession )
+            {
+            LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::HandleCommand \
+                Sending UI Notification" )
+
+            // Send confirmation to UI and wait for client response
+            SendConfirmToUi();
+            }
+        else
+            {
+            // Send successfull terminal response
+            SendSuccessTerminalRsp();
+            }
+        }
+    else
+        {
+        // Activation failed, Close channel and send error
+        LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::ConnectionNotification \
+            Channel activation failed" )
+
+        // Close channel
+        CloseChannel();
+
+        // PDP Activation failed
+        iOpenChannelRsp.iGeneralResult = RSat::KBearerIndepProtocolError;
+        iOpenChannelRsp.iInfoType = RSat::KMeProblem;
+        iOpenChannelRsp.iAdditionalInfo.SetLength( 1 );
+        iOpenChannelRsp.iAdditionalInfo[0] = RSat::KNoSpecificBIPError;
+        iOpenChannelRsp.SetPCmdNumber( iOpenChannelData.PCmdNumber() );
+        TerminalRsp( iPCmd, iOpenChannelRspPckg );
+        }
+
+    LOG( SIMPLE,
+        "OPENCHANNEL: COpenChannelHandler::ConnectionNotification exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Event notification.
+// -----------------------------------------------------------------------------
+//
+void COpenChannelHandler::Event( TInt aEvent )
+    {
+    LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::Event calling" )
+
+    // Check event
+    if ( MSatUtils::ESatUiLaunched == aEvent )
+        {
+        LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::Event ESatUiLaunched" )
+        iUtils->UnregisterEvent( this, MSatUtils::ESatUiLaunched );
+
+        // Send confirm to UI
+        SendConfirmToUi();
+        }
+
+    LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::Event exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CActive.
+// Cancels the sat request.
+// -----------------------------------------------------------------------------
+//
+void COpenChannelHandler::DoCancel()
+    {
+    LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::DoCancel calling" )
+
+    iUtils->USatAPI().NotifyOpenChannelCancel();
+
+    LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Requests the command notification.
+// -----------------------------------------------------------------------------
+//
+void COpenChannelHandler::IssueUSATRequest( TRequestStatus& aStatus )
+    {
+    LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::IssueUSATRequest calling" )
+
+    // Reset values
+    iDataChannel = NULL;
+    iSetUpWithModifications = EFalse;
+    iNeedUiSession = EFalse;
+
+    // Reset open channel data.
+    new (&iOpenChannelData) RSat::TOpenGprsChannelV4();
+    new (&iQueryData) TSatQueryV1();
+
+    iUtils->USatAPI().NotifyOpenChannel( aStatus, iOpenChannelPckg );
+    iUtils->NotifyEvent( MSatUtils::EBipCommandDoneExecuting );
+
+    LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::IssueUSATRequest exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// OpenChannel command is not allowed in following situations:
+//      - Phone is not registered to homenetwork and roaming.
+//      - phone is ringing, alerting or call is on and OpenChannel command
+//        is "make call only if not busy", "make call only if not busy wiht
+//        redial" or "Call type not set".
+// -----------------------------------------------------------------------------
+//
+TBool COpenChannelHandler::CommandAllowed()
+    {
+    LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::CommandAllowed calling" )
+
+    // Define the PCmd here since this is the first place after notification
+    iPCmd = RSat::EOpenChannelGprs; // Other possible values
+                                    // RSat::EOpenChannelCs
+                                    // RSat::EOpenChannelLocal
+
+    // Check parameters here, because every terminal response must contain info
+    // about Bearer Set and BufferSize.
+    TBool result( CheckParameters() );
+
+    // Indicates channel activation type
+    const TBool activateImmediately(
+        RSat::EImmediate == iOpenChannelData.iLinkEst );
+
+    //lint -e{961} Else block not needed.
+    if ( ( RSat::EAlphaIdProvided != iOpenChannelData.iAlphaId.iStatus ) &&
+         ( RSat::ESelfExplanatory == iOpenChannelData.iIconId.iQualifier ||
+           RSat::ENotSelfExplanatory == iOpenChannelData.iIconId.iQualifier ) )
+        {
+        iOpenChannelRsp.iGeneralResult = RSat::KCmdDataNotUnderstood;
+        iOpenChannelRsp.iInfoType = RSat::KNoAdditionalInfo;
+        iOpenChannelRsp.iAdditionalInfo.Zero();
+        result = EFalse;
+        LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::CommandAllowed \
+            icon received without alpha id" )
+        }
+    // If parameters are OK, check rest.
+    else if ( result && activateImmediately )
+        {
+        // Set result to False. If checks goes OK, this is set to ETrue.
+        result = EFalse;
+
+        RMobilePhone::TMobilePhoneRegistrationStatus registrationStatus(
+            iUtils->SystemState().GetNetworkRegistrationStatus() );
+
+        // Indicates is there service on network
+        const TBool noService(
+            ( RMobilePhone::ERegisteredOnHomeNetwork != registrationStatus ) &&
+            ( RMobilePhone::ERegisteredRoaming != registrationStatus ) );
+
+        if ( RMobilePhone::ERegistrationUnknown == registrationStatus )
+            {
+            LOG( NORMAL,
+                "OPENCHANNEL: COpenChannelHandler::CommandAllowed \
+                NetworkRegStatus not available" )
+            iOpenChannelRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+            iOpenChannelRsp.iInfoType = RSat::KMeProblem;
+            iOpenChannelRsp.iAdditionalInfo.SetLength( 1 );
+            iOpenChannelRsp.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
+            }
+        // Check registration status
+        else if ( noService )
+            {
+            // No service
+            LOG( NORMAL,
+                "OPENCHANNEL: COpenChannelHandler::CommandAllowed No service" )
+
+            iOpenChannelRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+            iOpenChannelRsp.iInfoType = RSat::KMeProblem;
+            iOpenChannelRsp.iAdditionalInfo.SetLength( 1 );
+            iOpenChannelRsp.iAdditionalInfo[0] = RSat::KNoService;
+            }
+        else
+            {
+            // Command allowed
+            LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::CommandAllowed \
+                Command is allowed Immediate activation" )
+            result = ETrue;
+            }
+        }
+
+    if ( !result ) // Send Terminal response, if result is not OK
+        {
+        LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::CommandAllowed \
+        result not OK" )
+        iOpenChannelRsp.SetPCmdNumber( iOpenChannelData.PCmdNumber() );
+        TerminalRsp( iPCmd, iOpenChannelRspPckg );
+        }
+    else
+        {
+        // Register to handle UI commands.
+        TRAPD( err, iUtils->RegisterServiceRequestL( ESatSProactiveQuery,
+            ESatSProactiveQueryResponse, this ) );
+
+        LOG2( NORMAL, "OPENCHANNEL: COpenChannelHandler::CommandAllowed \
+        err: %d", err )
+        // Above function leaves only when there is not enough memory to
+        // allocate new object. So this case is very rare.
+        if ( KErrNone != err )
+            {
+            LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::CommandAllowed \
+                 Error while registering service request" )
+
+            // Send general terminal response (no BIP specific)
+            iOpenChannelRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+            iOpenChannelRsp.iInfoType = RSat::KMeProblem;
+            iOpenChannelRsp.iAdditionalInfo.SetLength( 1 );
+            iOpenChannelRsp.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
+            iOpenChannelRsp.SetPCmdNumber( iOpenChannelData.PCmdNumber() );
+            TerminalRsp( iPCmd, iOpenChannelRspPckg );
+
+            // Cannot complete, there are some major memory problems
+            result = EFalse;
+            }
+        // Set icon command flag whether icon data was received and 
+        // set qualifier to no icon id
+        // To be removed when icons are allowed in this command
+        else if ( ( RSat::ESelfExplanatory ==
+            iOpenChannelData.iIconId.iQualifier ) ||
+            ( RSat::ENotSelfExplanatory ==
+            iOpenChannelData.iIconId.iQualifier ) )
+            {
+            LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::CommandAllowed \
+                 ENoIconId" )
+            iIconCommand = ETrue;
+            iOpenChannelData.iIconId.iQualifier = RSat::ENoIconId;
+            }
+        else
+            {
+            LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::CommandAllowed \
+                 others" )
+            iIconCommand = EFalse;
+            }
+        }
+
+    LOG2( SIMPLE, "OPENCHANNEL: COpenChannelHandler::CommandAllowed exiting,\
+    result: %d", result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Need for ui session.
+// -----------------------------------------------------------------------------
+//
+TBool COpenChannelHandler::NeedUiSession()
+    {
+    LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::NeedUiSession calling" )
+
+    // UI is NOT needed in case where AlphaID is provided and it is a NULL
+    iNeedUiSession =
+        !( RSat::EAlphaIdNull == iOpenChannelData.iAlphaId.iStatus );
+
+    LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::NeedUiSession exiting" )
+    // We do not need UI session at this point, but we will launch it by
+    // ourselves when we do.
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Called when USAT API notifies that command.
+// -----------------------------------------------------------------------------
+//
+void COpenChannelHandler::HandleCommand()
+    {
+    LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::HandleCommand calling" )
+
+    // Notify others
+    iUtils->NotifyEvent( MSatUtils::EOpenChannelExecuting );
+    iUtils->NotifyEvent( MSatUtils::EBipCommandExecuting );
+
+    TInt error( MSatBIPUtils::ESatBIPNoChannelAvail ); // By default, negative
+
+    // Create data channel
+    TRAPD( leaveErr,
+        iDataChannel = iUtils->BipUtils().CreateChannelL(
+            iBearerType, error ) );
+
+    // Check the channel creation
+    if ( ( MSatBIPUtils::ESatBIPSuccess != error ) || 
+         ( KErrNone != leaveErr ) )
+        {
+        LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::HandleCommand\
+            Channel creation failed" )
+
+        // Channel creation failed -> Send terminal response
+        iOpenChannelRsp.iGeneralResult = RSat::KBearerIndepProtocolError;
+        iOpenChannelRsp.iInfoType = RSat::KMeProblem;
+        iOpenChannelRsp.iAdditionalInfo.SetLength( 1 );
+        iOpenChannelRsp.iAdditionalInfo[0] = RSat::KNoChannelAvailable;
+        iOpenChannelRsp.SetPCmdNumber( iOpenChannelData.PCmdNumber() );
+        TerminalRsp( iPCmd, iOpenChannelRspPckg );
+
+        LOG( SIMPLE, "OPENCHANNEL: COpenChannel::HandleCommand exiting" )
+        return;
+        }
+
+    LOG( NORMAL,
+        "OPENCHANNEL: COpenChannelHandler::HandleCommand Channel creation OK" )
+
+    // Open channel or request confirmation from user
+    const TInt linkEst( iOpenChannelData.iLinkEst );
+
+    // If not confirmation to user or immediate activation, open channel
+    if ( ( !iNeedUiSession || RSat::EImmediate == linkEst )
+           && KErrNone != SetUpChannel() )
+        {
+        // Setup failed, close channel and send error
+        LOG( NORMAL,
+            "OPENCHANNEL: COpenChannelHandler::HandleCommand SetUp failed" )
+
+        // Close channel, there was an error
+        CloseChannel();
+
+        // Channel setup failed
+        iOpenChannelRsp.iGeneralResult = RSat::KBearerIndepProtocolError;
+        iOpenChannelRsp.iInfoType = RSat::KMeProblem;
+        iOpenChannelRsp.iAdditionalInfo.SetLength( 1 );
+        iOpenChannelRsp.iAdditionalInfo[0] = RSat::KNoSpecificBIPError;
+        iOpenChannelRsp.SetPCmdNumber( iOpenChannelData.PCmdNumber() );
+        TerminalRsp( iPCmd, iOpenChannelRspPckg );
+
+        LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::HandleCommand \
+            exiting" )
+        return;
+        }
+
+    // If immediate activation, activate.
+    if ( RSat::EImmediate == linkEst )
+        {
+        LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::HandleCommand \
+             immediate activation" )
+        // Check activation
+        TInt activateError = ActivateChannel();
+        if ( KErrNone != activateError )
+            {
+            // Activation failed, Close channel and send error
+            LOG2( NORMAL, "OPENCHANNEL: COpenChannelHandler::HandleCommand \
+                Channel activation failed error = %i", activateError )
+            // Close channel
+            CloseChannel();
+
+            // Check is there a call ongoing
+            const TBool callIsOngoing( iUtils->SystemState().IsCallActive() ||
+                iUtils->SystemState().IsCallIncoming() );
+
+            iOpenChannelRsp.iGeneralResult = RSat::KBearerIndepProtocolError;
+
+            // Map the error to correct response
+            if ( KErrGprsUserAuthenticationFailure == activateError )
+                {
+                LOG( DETAILED, 
+                "OPENCHANNEL: COpenChannelHandler::HandleCommand Security \
+                error" )
+                activateError = RSat::KSecurityError;
+                }
+            else if ( KErrGprsServicesNotAllowed == activateError || callIsOngoing )
+                {
+                LOG( DETAILED, 
+                "OPENCHANNEL: COpenChannelHandler::HandleCommand Busy on \
+                call or CC on GPRS" )
+                activateError = RSat::KMeBusyOnCall;
+                iOpenChannelRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+                }
+            else if ( ( KErrMMEtelActivationBlockedByCallControlNoText ==
+                            activateError ) ||
+                      ( KErrMMEtelActivationBlockedByCallControlWithText ==
+                            activateError ) )
+                {
+                iOpenChannelRsp.iGeneralResult = RSat::KInteractionWithCCPermanentError;
+                activateError = RSat::KActionNotAllowed;
+
+                LOG( DETAILED, 
+                "OPENCHANNEL: COpenChannelHandler::HandleCommand CC on GPRS \
+                not allowed" )
+                }
+            else
+                {
+                LOG( DETAILED, 
+                "OPENCHANNEL: COpenChannelHandler::HandleCommand No specific \
+                BIP error" )
+                activateError = RSat::KNoSpecificBIPError;
+                }
+
+            // PDP Activation failed
+            iOpenChannelRsp.iInfoType = RSat::KMeProblem;
+            iOpenChannelRsp.iAdditionalInfo.SetLength( 1 );
+            iOpenChannelRsp.iAdditionalInfo[0] =
+                static_cast<TUint16>( activateError );
+            iOpenChannelRsp.SetPCmdNumber( iOpenChannelData.PCmdNumber() );
+            TerminalRsp( iPCmd, iOpenChannelRspPckg );
+            }
+        }
+    else // OnDemand. Send terminal response or confirm to UI
+        {
+        // If information indication to the user is needed, show it now.
+        if ( iNeedUiSession )
+            {
+            LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::HandleCommand \
+                Sending UI Notification" )
+            // Send confirmation to UI and wait for client response
+            SendConfirmToUi();
+            }
+        else
+            {
+            // Send successfull terminal response
+            SendSuccessTerminalRsp();
+            }
+        }
+
+    LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::HandleCommand exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Indicates the failure of launching ui client.
+// -----------------------------------------------------------------------------
+//
+void COpenChannelHandler::UiLaunchFailed()
+    {
+    LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::UiLaunchFailed calling" )
+
+    iOpenChannelRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+    iOpenChannelRsp.iInfoType = RSat::KMeProblem;
+    iOpenChannelRsp.iAdditionalInfo.SetLength( 1 );
+    iOpenChannelRsp.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
+    iOpenChannelRsp.SetPCmdNumber( iOpenChannelData.PCmdNumber() );
+    TerminalRsp( iPCmd, iOpenChannelRspPckg );
+
+    LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::UiLaunchFailed exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+//lint -e{1403, 1769} Can not be initialized.
+COpenChannelHandler::COpenChannelHandler() :
+    CSatCommandHandler(),
+    iOpenChannelData(),
+    iOpenChannelPckg( iOpenChannelData ),
+    iOpenChannelRsp(),
+    iOpenChannelRspPckg( iOpenChannelRsp ),
+    iQueryData(),
+    iQueryPckg( iQueryData ),
+    iQueryRsp(),
+    iQueryRspPckg( iQueryRsp ),
+    // To be removed when icons are allowed in this command
+    iIconCommand( EFalse )
+    {
+    LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::COpenChannelHandler \
+        calling - exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void COpenChannelHandler::ConstructL()
+    {
+    LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::ConstructL calling" )
+
+    iUtils->RegisterServiceRequestL( ESatSProactiveQuery,
+        ESatSProactiveQueryResponse, this );
+
+    LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Sets new connection settings for channel to open.
+// -----------------------------------------------------------------------------
+//
+void COpenChannelHandler::SetConnectionSettingsL(
+    MSatBIPUtils::TSatBearerType aBearerType )
+    {
+    LOG2( SIMPLE,
+        "OPENCHANNEL: COpenChannelHandler::SetConnectionSettingsL calling,\
+        aBearerType: %d", aBearerType )
+
+    RPacketContext::TProtocolType pdpType = RPacketContext::EPdpTypeIPv4;
+    TUint32 defaultId( 0 );
+    switch ( aBearerType )
+        {
+        case MSatBIPUtils::ESatGPRS:
+            {
+            // Resolve override settings
+            if ( iOpenChannelData.iAccessName.Length() > 0 )
+                {
+                LOG( NORMAL, 
+                "OPENCHANNEL: COpenChannelHandler::SetConnectionSettingsL \
+                Getting APN" )
+
+                TUint32 iapId( 0 );
+                TUint32 nwId( 0 );
+                TBool apnCreated( EFalse );
+
+                pdpType = RPacketContext::EPdpTypeIPv6;
+
+                if ( RSat::EIPv4Address ==
+                    iOpenChannelData.iDestinationAddress.iType )
+                    {
+                    LOG( NORMAL, 
+                    "OPENCHANNEL: COpenChannelHandler::SetConnectionSettingsL \
+                    IPV4 Address" )
+                    pdpType = RPacketContext::EPdpTypeIPv4;
+                    }
+                iUtils->BipUtils().ApnHandler().GetApnInfoL
+                    (
+                    iOpenChannelData.iAccessName,
+                    iOpenChannelData.iUserLogin,
+                    iOpenChannelData.iUserPassword,
+                    iapId,
+                    nwId,
+                    apnCreated,
+                    pdpType, // IPv6 or IPv4
+                    iOpenChannelData.iLocalAddress.iAddress
+                    );
+
+                if ( apnCreated )
+                    {
+                    LOG( NORMAL, 
+                    "OPENCHANNEL: COpenChannelHandler::SetConnectionSettingsL \
+                    APN created by SAT" )
+                    // Store APN Id for later use
+                    iConnectionInfo.iCreatedApnId = nwId;
+                    }
+
+                SetOverrideSettingsL( iapId );
+                }
+            else
+                {
+                LOG( NORMAL, "OPENCHANNEL: SetConnectionSettingsL \
+                No APN, using defaults" )
+                // No APN, use default settings
+                TRAPD( err, defaultId = 
+                iUtils->BipUtils().ApnHandler().FindDefaultApL( pdpType ) );
+                LOG2( NORMAL, "OPENCHANNEL: SetConnectionSettingsL \
+                    No APN, using defaults err = %i", err )
+                SetOverrideSettingsL( defaultId );
+                }
+            break;
+            }
+
+        default:
+            {
+            LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::\
+                SetConnectionSettingsL exiting default" )
+            // Leave if not supported
+            User::Leave( KErrNotSupported );
+            }
+        }
+
+#ifdef SAT_USE_DUMMY_TSY
+    // No APN, use default settings
+    TRAPD( err, 
+    defaultId = iUtils->BipUtils().ApnHandler().FindDefaultApL( pdpType ) );
+    LOG2( NORMAL, "OPENCHANNEL: COpenChannelHandler::SetConnectionSettingsL \
+        No APN, using defaults err = %i", err )
+    SetOverrideSettingsL( defaultId );
+#endif // SAT_USE_DUMMY_TSY
+
+    LOG( SIMPLE,
+        "OPENCHANNEL: COpenChannelHandler::SetConnectionSettingsL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Sets override settings into connection information.
+// -----------------------------------------------------------------------------
+//
+void COpenChannelHandler::SetOverrideSettingsL( const TUint32 aIapId )
+    {
+    
+    LOG2( SIMPLE,
+    "OPENCHANNEL: COpenChannelHandler::SetOverrideSettingsL aIapId: %i", 
+    aIapId )
+
+    delete iConnectionInfo.iOverrideSet;
+    iConnectionInfo.iOverrideSet = NULL;
+
+    // Override connection preferences
+    TExtendedConnPref* overrideSettings = new( ELeave ) TExtendedConnPref;
+    overrideSettings->SetIapId( aIapId );
+    overrideSettings->SetNoteBehaviour( 
+            TExtendedConnPref::ENoteBehaviourConnSilent );
+    iConnectionInfo.iOverrideSet = overrideSettings;
+
+    LOG( SIMPLE,
+        "OPENCHANNEL: COpenChannelHandler::SetOverrideSettingsL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Sets up data channel. Does not activate context.
+// -----------------------------------------------------------------------------
+//
+TInt COpenChannelHandler::SetUpChannel()
+    {
+    LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::SetUpChannel calling" )
+
+    // get connection settings from CommDB and
+    // set connection settings to data channel
+    TRAPD( status,
+           SetConnectionSettingsL( iBearerType );
+           iDataChannel->SetupConnectionL( iConnectionInfo ); );
+
+    LOG2( SIMPLE,
+        "OPENCHANNEL: COpenChannelHandler::SetUpChannel exiting with status %i",
+        status )
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// Activates context.
+// -----------------------------------------------------------------------------
+//
+TInt COpenChannelHandler::ActivateChannel()
+    {
+    LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::ActivateChannel calling" )
+
+    // Activate the connection
+    TRAPD( err, iDataChannel->ActivateConnectionL( this ) );
+
+    LOG2( SIMPLE, "OPENCHANNEL: COpenChannelHandler::ActivateChannel exiting\
+        with error %i:", err )
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// Creates and sends the terminal response on successful cases.
+// -----------------------------------------------------------------------------
+//
+void COpenChannelHandler::SendSuccessTerminalRsp()
+    {
+    LOG( SIMPLE,
+        "OPENCHANNEL: COpenChannelHandler::SendSuccessTerminalRsp calling" )
+
+    iDataChannel->GetNegotiatedQoSParams( iOpenChannelRsp.iBearer.iParams );
+
+    // Get the channel status
+    RSat::TChannelStatus channelStatus;
+    TRAPD( err, channelStatus = iUtils->BipUtils().GenerateChannelStatusL(
+            iDataChannel->ChannelId(), 0 ) );
+    LOG2( SIMPLE, "OPENCHANNEL: COpenChannelHandler::SendSuccessTerminalRsp \
+          error: %i", err )
+    
+    if ( KErrNone == err )
+        {
+        iOpenChannelRsp.iInfoType = RSat::KChannelStatusInfo;
+        iOpenChannelRsp.iAdditionalInfo.SetLength( KChannelStatusLength );
+
+        // Channel ID + PDP context status
+        iOpenChannelRsp.iAdditionalInfo[0] = channelStatus[0];
+
+        // Channel status
+        iOpenChannelRsp.iAdditionalInfo[1] = channelStatus[1];
+        iOpenChannelRsp.SetPCmdNumber( iOpenChannelData.PCmdNumber() );
+
+        // Define the result of this command handling
+        if ( iSetUpWithModifications )
+            {
+            LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::HandleCommand\
+                Channel setup modified" )
+            iOpenChannelRsp.iGeneralResult = RSat::KPerformedWithModifications;
+            }
+        else if ( !iQueryRsp.iRequestedIconDisplayed &&
+            ( ( RSat::ESelfExplanatory ==
+            iOpenChannelData.iIconId.iQualifier ) ||
+            ( RSat::ENotSelfExplanatory ==
+            iOpenChannelData.iIconId.iQualifier ) ) )
+            {
+            LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::HandleCommand\
+                Open channel successful, no icon displayed" )
+            iOpenChannelRsp.iGeneralResult =
+                RSat::KSuccessRequestedIconNotDisplayed;
+            }
+        else
+            {
+            LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::HandleCommand\
+                Open channel successful" )
+            iOpenChannelRsp.iGeneralResult = RSat::KSuccess;
+            }
+        }
+    else
+        {
+        LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::HandleCommand\
+            Channel not found!" )
+        iOpenChannelRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+        iOpenChannelRsp.iInfoType = RSat::KMeProblem;
+        iOpenChannelRsp.iAdditionalInfo.SetLength( 1 );
+        iOpenChannelRsp.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
+        }
+
+    // If command had icon data and was done succesfully, report that icon
+    // was not shown
+    // To be removed when icons are allowed in this command
+    if ( ( RSat::KSuccess == iOpenChannelRsp.iGeneralResult ) &&
+        iIconCommand )
+        {
+        LOG( SIMPLE, "COpenChannelHandler::SendSuccessTerminalRsp requested\
+             icon not displayed" )
+        iOpenChannelRsp.iGeneralResult =
+            RSat::KSuccessRequestedIconNotDisplayed;
+        }
+
+    // Sending terminal response
+    TerminalRsp( iPCmd, iOpenChannelRspPckg );
+
+    LOG( SIMPLE,
+        "OPENCHANNEL: COpenChannelHandler::SendSuccessTerminalRsp exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Sends confirmation query to UI.
+// -----------------------------------------------------------------------------
+//
+void COpenChannelHandler::SendConfirmToUi()
+    {
+    LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::SendConfirmToUi calling" )
+
+    // Command Duration for Mediator Client
+    TUint8 commandDuration( KSatDurationNotSet );
+
+    // Launch UI of not launched. This function is called again when UI is
+    // launched.
+    if ( !LaunchUiSession() )
+        {
+        LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::SendConfirmToUi \
+             not launch UI" )
+        // Create IPC data to UI
+        iQueryData.iCommand = ESatOpenChannelQuery;
+        iQueryData.iQueryText = iOpenChannelData.iAlphaId.iAlphaId;
+        iQueryData.iIconId.iIdentifier = iOpenChannelData.iIconId.iIdentifier;
+        LOG2( SIMPLE, "COpenChannelHandler::SendConfirmToUi \
+             iOpenChannelData.iIconId.iQualifier:%d",
+             iOpenChannelData.iIconId.iQualifier )
+        // Check Icon
+        switch ( iOpenChannelData.iIconId.iQualifier )
+            {
+            case RSat::ESelfExplanatory:
+                {
+                // Icon qualifier is self explanatory (to display instead
+                // of the alpha id or text string).
+                iQueryData.iIconId.iIconQualifier = ESatSelfExplanatory;
+                break;
+                }
+
+            case RSat::ENotSelfExplanatory:
+                {
+                // Icon qualifier is not self explanatory.
+                iQueryData.iIconId.iIconQualifier = ESatNotSelfExplanatory;
+                break;
+                }
+
+            default:
+                {
+                // Icon qualifier not present
+                iQueryData.iIconId.iIconQualifier = ESatENoIconId;
+                break;
+                }
+            }
+        LOG2( SIMPLE, "COpenChannelHandler::SendConfirmToUi \
+             iOpenChannelData.iAlphaId.iStatus:%d",
+             iOpenChannelData.iAlphaId.iStatus )
+        // Define AlphaID status
+        switch ( iOpenChannelData.iAlphaId.iStatus )
+            {
+            case RSat::EAlphaIdNotPresent:
+                {
+                iQueryData.iAlphaIdStatus = ESatAlphaIdNotProvided;
+                commandDuration = KSatLongDuration;
+                break;
+                }
+
+            case RSat::EAlphaIdProvided:
+                {
+                iQueryData.iAlphaIdStatus = ESatAlphaIdNotNull;
+                commandDuration = KSatLongDuration;
+                break;
+                }
+
+            default:
+                {
+                iQueryData.iAlphaIdStatus = ESatAlphaIdNull;
+                commandDuration = KSatDurationNotSet;
+                break;
+                }
+            }
+
+        // Send notification to Mediator client if Cover UI is supported
+        if ( iUtils->CoverUiSupported() )
+            {
+            LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::SendConfirmToUi \
+                 CoverUiSupported" )
+            TSatCommandData medEventData;
+            medEventData.iPCmdNumber = iPCmd;
+            medEventData.iAlphaId = iOpenChannelData.iAlphaId;
+            medEventData.iDuration.iTimeUnit = RSat::ESeconds;
+            medEventData.iDuration.iNumOfUnits = commandDuration;
+            medEventData.iIconID = iOpenChannelData.iIconId;
+            TSatCommandPckg tPckg( medEventData );
+            iUtils->RaiseSatEvent( tPckg );
+            }
+        // Send notification to UI
+        MSatUiSession* session = iUtils->SatUiHandler().UiSession();
+        session->SendCommand(
+            &iQueryPckg, &iQueryRspPckg, ESatSProactiveQuery );
+        }
+
+    LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::SendConfirmToUi exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Closes the channel in error cases.
+// -----------------------------------------------------------------------------
+//
+void COpenChannelHandler::CloseChannel()
+    {
+    LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::CloseChannel calling" )
+
+    // If data channel is not null, close it
+    if ( iDataChannel )
+        {
+        LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::CloseChannel have\
+             channel" )
+        iUtils->BipUtils().CloseChannel( iDataChannel->ChannelId() );
+        }
+
+    if ( iConnectionInfo.iCreatedApnId > 0 )
+        {
+        LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::CloseChannel delete\
+             APN" )
+        // APN created -> Remove it
+        TRAP_IGNORE( iUtils->BipUtils().ApnHandler().DeleteApnL(
+            iConnectionInfo.iCreatedApnId ) )
+        }
+
+    LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::CloseChannel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Checks parameters from SIM and makes modifications, if needed.
+// -----------------------------------------------------------------------------
+//
+TBool COpenChannelHandler::CheckParameters()
+    {
+    LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::CheckParameters calling" )
+    // Return variable. Indicates is the context activation possible with
+    // given / modified parameters.
+    TBool paramsOk( EFalse );
+
+    // Check buffer size
+    if ( KSatBIPMaxBufferSize < iOpenChannelData.iBufferSize ||
+         0 == iOpenChannelData.iBufferSize )
+        {
+        LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::CheckParameters \
+            Changing buffersize" )
+        // Too big requested buffer size -> set to max
+        iConnectionInfo.iBufferSize = KSatBIPMaxBufferSize;
+        // put modified buffer size to terminal response
+        iOpenChannelRsp.iBufferSize = KSatBIPMaxBufferSize;
+        // Modified parameters
+        iSetUpWithModifications = ETrue;
+        }
+    else
+        {
+        iConnectionInfo.iBufferSize = iOpenChannelData.iBufferSize;
+        iOpenChannelRsp.iBufferSize = iOpenChannelData.iBufferSize;
+        }
+
+    // Set bearer for the terminal response. This information is mandatory to
+    // each terminal response.
+    iOpenChannelRsp.iBearer = iOpenChannelData.iBearer;
+
+    // Indicates is there destination address defined
+    const TBool destinationAddressNotDefined
+        (
+        RSat::EIPv4Address != iOpenChannelData.iDestinationAddress.iType &&
+        RSat::EIPv6Address != iOpenChannelData.iDestinationAddress.iType
+        );
+
+    // Indicates is there a transport protocol defined
+    const TBool transportProtoNotDefined
+        (
+        RSat::ETcp != iOpenChannelData.iSimMeInterface.iTransportProto &&
+        RSat::EUdp != iOpenChannelData.iSimMeInterface.iTransportProto
+        );
+
+    // Indicates is there a transport port number defined
+    const TBool transportPortNumberNotDefined
+        (
+        0 == iOpenChannelData.iSimMeInterface.iPrtNumber
+        );
+
+    // Indicates is selected bearer supported
+    const TBool bearerNotSupported
+        (
+        RSat::EPCmdTypeNotSet != iOpenChannelData.iPCmdType &&
+        RSat::EGprsBearer != iOpenChannelData.iPCmdType &&
+        RSat::EAnyBearer != iOpenChannelData.iPCmdType
+        );
+
+    // Check parameters
+    paramsOk = !( destinationAddressNotDefined ||
+                  transportProtoNotDefined ||
+                  bearerNotSupported ||
+                  transportPortNumberNotDefined );
+
+    // Check is connection possible
+    if ( paramsOk )
+        {
+        LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::CheckParameters \
+        Bearer type is GPRS" )
+        // Bearer type is GPRS
+        iBearerType = MSatBIPUtils::ESatGPRS;
+        // Set bearer type for the terminal response in case it was not defined
+        iOpenChannelRsp.iBearer.iType = RSat::EGPRSBearer;
+        // Destination address
+        iConnectionInfo.iDestination = iOpenChannelData.iDestinationAddress;
+        // Local address
+        iConnectionInfo.iSource = iOpenChannelData.iLocalAddress;
+        // Bearer parameters
+        iConnectionInfo.iBearerParams = iOpenChannelData.iBearer.iParams;
+        // Set protocol info to connection data
+        iConnectionInfo.iProtocol = iOpenChannelData.iSimMeInterface;
+        }
+    else if ( transportProtoNotDefined ||
+              bearerNotSupported ||
+              transportPortNumberNotDefined )
+        {
+        // Fail
+        LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::CheckParameters \
+        Unable to connect" )
+        // If parameters are not OK, send terminal response
+        LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::CommandAllowed \
+            Not valid parameters" )
+        iOpenChannelRsp.iGeneralResult = RSat::KCmdBeyondMeCapabilities;
+        iOpenChannelRsp.iInfoType = RSat::KNoAdditionalInfo;
+        iOpenChannelRsp.iAdditionalInfo.Zero();
+        }
+    else if ( destinationAddressNotDefined )
+        {
+        // Fail
+        LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::CheckParameters \
+        Destination not set" )
+        iOpenChannelRsp.iGeneralResult = RSat::KErrorRequiredValuesMissing;
+        iOpenChannelRsp.iInfoType = RSat::KNoAdditionalInfo;
+        iOpenChannelRsp.iAdditionalInfo.Zero();
+        }
+    else
+        {
+        // Fail
+        LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::CheckParameters \
+        Unable to connect" )
+        // If parameters are not OK, send terminal response
+        LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::CheckParameters \
+            Not valid parameters" )
+        iOpenChannelRsp.iGeneralResult = RSat::KCmdBeyondMeCapabilities;
+        iOpenChannelRsp.iInfoType = RSat::KNoAdditionalInfo;
+        iOpenChannelRsp.iAdditionalInfo.Zero();
+        }
+
+    LOG2( SIMPLE, "OPENCHANNEL: COpenChannelHandler::CheckParameters exiting,\
+          paramsOk: %d", paramsOk )
+    return paramsOk;
+    }
+
+// -----------------------------------------------------------------------------
+// Launches UI if it not active.
+// -----------------------------------------------------------------------------
+//
+TBool COpenChannelHandler::LaunchUiSession()
+    {
+    LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::LaunchUiSession calling" )
+    TBool retVal( EFalse );
+
+    // If ui session is not availabe, SATUI has to be
+    // launched.
+    if ( NULL == iUtils->SatUiHandler().UiSession() )
+        {
+        TRAPD( err,
+               iUtils->RegisterL( this, MSatUtils::ESatUiLaunched );
+               // Try to launch the ui client.
+               iUtils->SatUiHandler().LaunchSatUiL();
+             ); // End of TRAPD
+
+        if ( KErrNone != err )
+            {
+            LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::LaunchUiSession \
+                 Ui launch failed" )
+            // Ui launch failed, unregister event
+            iUtils->UnregisterEvent( this, MSatUtils::ESatUiLaunched );
+            // Notify SIM that ui launch failed.
+            UiLaunchFailed();
+            }
+        else
+            {
+            LOG( SIMPLE, "OPENCHANNEL: COpenChannelHandler::LaunchUiSession \
+                 Ui launch successfully" )
+            // Return true indicating that we had to launch UI
+            retVal = ETrue;
+            }
+        }
+
+    LOG2( SIMPLE, "OPENCHANNEL: COpenChannelHandler::LaunchUiSession exiting,\
+          retVal: %d", retVal )
+    return retVal;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/OpenChannelCmd/src/std.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 functions
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    <implementationproxy.h>
+#include    "COpenChannelHandler.h"
+
+// CONSTANTS
+
+const TImplementationProxy implementationTable[] =
+    {
+    //lint -e{611,1924} Warning "Suspicious cast" can not be avoided.
+    IMPLEMENTATION_PROXY_ENTRY( 0x101F79FB, COpenChannelHandler::NewL )
+    };
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy ECOM framework factory function
+// Calculates the number of implementations.
+// Returns: Implementation proxy.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount ) // Number of implementations
+    {
+    aTableCount =
+        sizeof( implementationTable ) /
+        sizeof( TImplementationProxy );
+    return implementationTable;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/PlayToneCmd/group/PlayToneCmd.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* 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:  Project definition file for project PlayTone plug-in
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../../inc/SatMacroes.h"
+
+TARGET                  PlayToneCmd.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D 0x1000A887
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  std.cpp
+SOURCE                  CPlayToneHandler.cpp
+
+START RESOURCE          1000A887.rss
+TARGET                  PlayToneCmd.rsc
+END
+
+USERINCLUDE             ../../../inc
+USERINCLUDE             ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+SYSTEMINCLUDE           ../../../../../inc      // Domain telephony
+SYSTEMINCLUDE           ../../../../inc         // Subsystem satengine
+
+LIBRARY                 euser.lib
+LIBRARY                 etelsat.lib
+LIBRARY                 SatEngine.lib
+
+#ifdef ENABLE_SAT_LOGGING
+LIBRARY                 flogger.lib
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/PlayToneCmd/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 PlayToneCmd plug-in
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+PlayToneCmd.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/PlayToneCmd/inc/CPlayToneHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,138 @@
+/*
+* 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:  Play Tone command handler
+*
+*/
+
+
+#ifndef CPLAYTONEHANDLER_H
+#define CPLAYTONEHANDLER_H
+
+#include <etelsat.h>
+
+#include "CSatCommandHandler.h"
+
+class MSatUtils;
+
+/**
+ *  Command handler for SelectItem command.
+ *
+ *  @lib PlayToneCmd.lib
+ *  @since S60 v3.0
+ */
+class CPlayToneHandler : public CSatCommandHandler
+    {
+    
+public:
+
+    static CPlayToneHandler* NewL( MSatUtils* aUtils );
+
+    virtual ~CPlayToneHandler();
+
+// from base class MSatCommand
+
+    /**
+     * From MSatCommand.
+     * Response from the client.
+     *
+     */
+    void ClientResponse();
+
+protected:
+
+// from base class CActive
+
+    /**
+     * From CActive.
+     * Cancels the usat request
+     *
+     */
+    void DoCancel();
+
+    /**
+     * From CSatCommandHandler
+     * Requests the command notification.
+     *
+     * @param aStatus Request status
+     */
+    void IssueUSATRequest( TRequestStatus& aStatus );
+
+    /**
+     * From CSatCommandHandler
+     * Precheck before executing the command.
+     *
+     * @return TBool indicating command is currently allowed.
+     */
+    TBool CommandAllowed();
+
+    /**
+     * From CSatCommandHandler
+     * Need for ui session.
+     *
+     * @return TBool indicating need of ui session.
+     */
+    TBool NeedUiSession();
+
+    /**
+     * From CSatCommandHandler
+     * Called when USAT API notifies that command.
+     *
+     */
+    void HandleCommand();
+
+    /**
+     * From CSatCommandHandler.
+     * Indicates the failure of launching ui client.
+     *
+     */
+    void UiLaunchFailed();
+
+private:
+
+    CPlayToneHandler();
+
+    void ConstructL();
+
+private: // data
+
+    /**
+     * The data structure for the command data.
+     */
+    RSat::TPlayToneV2 iPlayToneData;
+
+    /**
+     * The data package for IPC.
+     */
+    RSat::TPlayToneV2Pckg iPlayTonePckg;
+
+    /**
+     * the response.
+     */
+    RSat::TPlayToneRspV1 iPlayToneRsp;
+
+    /**
+     * the response package.
+     */
+    RSat::TPlayToneRspV1Pckg iPlayToneRspPckg;
+
+    /**
+     * Flag to signal that command has icon data.
+     *To be removed when icons are allowed in this command.
+     */
+    TBool iIconCommand;
+
+    };
+
+#endif      // CPLAYTONEHANDLER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/PlayToneCmd/inc/PlayToneCmd.rls	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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 headers for project PlayToneCmd
+*
+*/
+
+
+#ifndef PLAYTONECMD_RLS
+#define PLAYTONECMD_RLS
+
+rls_string STRING_r_playtonecmd_display_name "PlayTone command"
+rls_string STRING_r_playtonecmd_default_data "PlayToneCmd"
+rls_string STRING_r_playtonecmd_opaque_data  ""
+
+#endif // PLAYTONECMD_RLS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/PlayToneCmd/src/1000A887.rss	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 1000 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Registry information for ECOM
+*
+*/
+
+
+
+//  INCLUDES
+#include <registryinfo.rh>
+#include "PlayToneCmd.rls"
+
+//  RESOURCE DEFINITIONS
+// -----------------------------------------------------------------------------
+//
+// PlayToneCmdInfo
+// Registeration information for ECOM
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO PlayToneCmdInfo
+    {
+    dll_uid = 0x1000A887;
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x1000f001;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x1000A88C;
+                    version_no   = 1;
+                    display_name = STRING_r_playtonecmd_display_name;
+                    default_data = STRING_r_playtonecmd_default_data;
+                    opaque_data  = STRING_r_playtonecmd_opaque_data;
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/PlayToneCmd/src/CPlayToneHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,331 @@
+/*
+* 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:  Handles PlayTone command
+*
+*/
+
+
+#include    "MSatApi.h"
+#include    "MSatUtils.h"
+#include    "MSatUiSession.h"
+#include    "MSatSystemState.h"
+#include    "SatSOpcodes.h"
+#include    "MSatSUiClientHandler.h"
+#include    "CPlayToneHandler.h"
+#include    "SatLog.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPlayToneHandler* CPlayToneHandler::NewL( MSatUtils* aUtils )
+    {
+    LOG( SIMPLE, "PLAYTONE: CPlayToneHandler::NewL calling" )
+
+    CPlayToneHandler* self = new( ELeave ) CPlayToneHandler;
+
+    CleanupStack::PushL( self );
+    self->BaseConstructL( aUtils );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "PLAYTONE: CPlayToneHandler::NewL exiting" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CPlayToneHandler::~CPlayToneHandler()
+    {
+    LOG( SIMPLE, "PLAYTONE: CPlayToneHandler::~CPlayToneHandler calling" )
+
+    Cancel();
+
+    LOG( SIMPLE, "PLAYTONE: CPlayToneHandler::~CPlayToneHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class MSatCommand.
+// Response from the client.
+// -----------------------------------------------------------------------------
+//
+void CPlayToneHandler::ClientResponse()
+    {
+    LOG( SIMPLE, "PLAYTONE: CPlayToneHandler::ClientResponse calling" )
+
+    iPlayToneRsp.SetPCmdNumber( iPlayToneData.PCmdNumber() );
+    if ( RSat::KPSessionTerminatedByUser == iPlayToneRsp.iGeneralResult )
+        {
+        LOG( SIMPLE, "PLAYTONE: CPlayToneHandler::ClientResponse \
+             KPSessionTerminatedByUser" )
+        // Next SimSession end will close the ui session.
+        iUtils->NotifyEvent( MSatUtils::ESessionTerminatedByUser );
+        }
+        
+    // If command had icon data and was done succesfully, report that icon
+    // was not shown
+    // To be removed when icons are allowed in this command
+    if ( ( RSat::KSuccess == iPlayToneRsp.iGeneralResult ) &&
+        iIconCommand )
+        {
+        LOG( SIMPLE, "PLAYTONE: CPlayToneHandler::ClientResponse \
+             requested icon not displayed" )
+        iPlayToneRsp.iGeneralResult =
+                    RSat::KSuccessRequestedIconNotDisplayed;
+        }
+
+    CSatCommandHandler::TerminalRsp( RSat::EPlayTone, iPlayToneRspPckg );
+
+    LOG( SIMPLE, "PLAYTONE: CPlayToneHandler::ClientResponse exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CActive.
+// Cancels the sat request.
+// -----------------------------------------------------------------------------
+//
+void CPlayToneHandler::DoCancel()
+    {
+    LOG( SIMPLE, "PLAYTONE: CPlayToneHandler::DoCancel calling" )
+
+    iUtils->USatAPI().NotifyPlayToneCancel();
+
+    LOG( SIMPLE, "PLAYTONE: CPlayToneHandler::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Requests the command notification.
+// -----------------------------------------------------------------------------
+//
+void CPlayToneHandler::IssueUSATRequest( TRequestStatus& aStatus )
+    {
+    LOG( SIMPLE, "PLAYTONE: CPlayToneHandler::IssueUSATRequest calling" )
+
+    // Clear the IPC package.
+    new (&iPlayToneData) RSat::TPlayToneV2();
+    iPlayToneRsp.iGeneralResult = RSat::KPSessionTerminatedByUser; // default
+
+    iUtils->USatAPI().NotifyPlayTone( aStatus, iPlayTonePckg );
+
+    LOG( SIMPLE, "PLAYTONE: CPlayToneHandler::IssueUSATRequest exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Precheck before executing the command.
+// -----------------------------------------------------------------------------
+//
+TBool CPlayToneHandler::CommandAllowed()
+    {
+    LOG( SIMPLE, "PLAYTONE: CPlayToneHandler::CommandAllowed calling" )
+    TBool allowed( ETrue );
+
+    // This is used to determine zero length duration.
+    const TBool zeroDuration( iPlayToneData.iDuration.iNumOfUnits == 0 );
+    // Determines is it standard supervisory tone.
+    const TBool standardSupervisoryTone(
+        ( iPlayToneData.iTone >= RSat::KDialTone ) &&
+        ( iPlayToneData.iTone <= RSat::KRingingTone ) );
+    // Determines is it terminal proprietary tone
+    const TBool terminalProprietaryTone(
+        ( iPlayToneData.iTone >= RSat::KGeneralBeep ) &&
+        ( iPlayToneData.iTone <= RSat::KUserSelectedToneIncomingSms ) );
+    const TBool durationValid(
+        ( RSat::ENoDurationAvailable != iPlayToneData.iDuration.iTimeUnit ) &&
+        ( RSat::ETimeUnitNotSet != iPlayToneData.iDuration.iTimeUnit ) );
+
+    // if icon data is received without alpha id,
+    // command data is not understood.
+    //lint -e{961} Else block not needed, allowed is then true.
+    if ( ( RSat::EAlphaIdProvided != iPlayToneData.iAlphaId.iStatus ) &&
+            ( RSat::ENotSelfExplanatory == iPlayToneData.iIconId.iQualifier ||
+              RSat::ESelfExplanatory == iPlayToneData.iIconId.iQualifier ) )
+        {
+        allowed = EFalse;
+        iPlayToneRsp.iGeneralResult = RSat::KCmdDataNotUnderstood;
+        iPlayToneRsp.iInfoType = RSat::KNoAdditionalInfo;
+        iPlayToneRsp.iAdditionalInfo.Zero();
+        LOG( SIMPLE,
+            "PLAYTONE: CPlayToneHandler::CommandAllowed \
+            icon received without alpha id" )
+        }
+    // If the tone is not standard or terminal proprietary OR it is
+    // standard without duration, command is not allowed.
+    else if ( iPlayToneData.iTone != RSat::KToneNotSet &&
+            ( !( standardSupervisoryTone ^ terminalProprietaryTone ) ||
+               ( zeroDuration && durationValid ) ) )
+        {
+        allowed = EFalse;
+        iPlayToneRsp.iGeneralResult = RSat::KCmdDataNotUnderstood;
+        iPlayToneRsp.iInfoType = RSat::KNoAdditionalInfo;
+        iPlayToneRsp.iAdditionalInfo.Zero();
+        LOG( SIMPLE,
+            "PLAYTONE: CPlayToneHandler::CommandAllowed \
+            Not valid tone or duration" )
+        }
+    // If alpha id is not to be shown and 
+    // tones are not ON command is not allowed.
+    else if ( !iUtils->SystemState().IsWarningAndGameTonesOn() &&
+             ( 0 == iPlayToneData.iAlphaId.iAlphaId.Length() ) )
+        {
+        allowed = EFalse;
+        iPlayToneRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+        iPlayToneRsp.iInfoType = RSat::KNoAdditionalInfo;
+        iPlayToneRsp.iAdditionalInfo.Zero();
+        LOG( SIMPLE,
+            "PLAYTONE: CPlayToneHandler::CommandAllowed \
+            Tones are OFF" )
+        }
+    // Set icon command flag whether icon data was received and set qualifier
+    // to no icon id
+    // To be removed when icons are allowed in this command
+    else if ( ( RSat::ESelfExplanatory ==
+        iPlayToneData.iIconId.iQualifier ) ||
+        ( RSat::ENotSelfExplanatory ==
+        iPlayToneData.iIconId.iQualifier ) )
+        {
+        LOG( SIMPLE,
+            "PLAYTONE: CPlayToneHandler::CommandAllowed ENoIconId" )
+        iIconCommand = ETrue;
+        iPlayToneData.iIconId.iQualifier = RSat::ENoIconId;
+        }
+    else
+        {
+        LOG( SIMPLE,
+            "PLAYTONE: CPlayToneHandler::CommandAllowed others" )
+        iIconCommand = EFalse;
+        }
+        
+    // if not allowed, send terminal response immediatelly.
+    if ( !allowed )
+        {
+        LOG( SIMPLE,
+            "PLAYTONE: CPlayToneHandler::CommandAllowed allowed false" )
+        iPlayToneRsp.SetPCmdNumber( iPlayToneData.PCmdNumber() );
+        // Send terminal response.
+        TerminalRsp( RSat::EPlayTone, iPlayToneRspPckg );
+        }
+
+    LOG2( SIMPLE, "PLAYTONE: CPlayToneHandler::CommandAllowed exiting,\
+          allowed: %d", allowed )
+    return allowed;
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Answers for need of UI session.
+// -----------------------------------------------------------------------------
+//
+TBool CPlayToneHandler::NeedUiSession()
+    {
+    LOG( NORMAL, "PLAYTONE: CPlayToneHandler::NeedUiSession calling" )
+
+    // Notify Cover UI if it's supported
+    if ( iUtils->CoverUiSupported() )
+        {
+        LOG( NORMAL, "PLAYTONE: CPlayToneHandler::NeedUiSession \
+             CoverUiSupported" )
+        TSatCommandData medEventData;
+        medEventData.iPCmdNumber = RSat::EPlayTone;
+        medEventData.iAlphaId = iPlayToneData.iAlphaId;
+        medEventData.iDuration = iPlayToneData.iDuration;
+        medEventData.iIconID = iPlayToneData.iIconId;
+        TSatCommandPckg tPckg( medEventData );
+        iUtils->RaiseSatEvent( tPckg );
+        }
+
+    LOG( NORMAL, "PLAYTONE: CPlayToneHandler::NeedUiSession exiting" )
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Called when USAT API notifies that command.
+// -----------------------------------------------------------------------------
+//
+void CPlayToneHandler::HandleCommand()
+    {
+    LOG( SIMPLE, "PLAYTONE: CPlayToneHandler::HandleCommand calling" )
+
+    iUtils->NotifyEvent( MSatUtils::EPlayToneExecuting );
+
+    MSatUiSession* uiSession = iUtils->SatUiHandler().UiSession();
+    uiSession->SendCommand(
+        &iPlayTonePckg,
+        &iPlayToneRspPckg,
+        ESatSProactivePlayTone );
+
+    LOG( SIMPLE, "PLAYTONE: CPlayToneHandler::HandleCommand exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Indicates the failure of launching ui client.
+// -----------------------------------------------------------------------------
+//
+void CPlayToneHandler::UiLaunchFailed()
+    {
+    LOG( SIMPLE, "PLAYTONE: CPlayToneHandler::UiLaunchFailed calling" )
+
+    iPlayToneRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+    iPlayToneRsp.iInfoType = RSat::KMeProblem;
+    iPlayToneRsp.iAdditionalInfo.SetLength( 1 );
+    iPlayToneRsp.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
+    iPlayToneRsp.SetPCmdNumber( iPlayToneData.PCmdNumber() );
+    TerminalRsp( RSat::EPlayTone, iPlayToneRspPckg );
+
+    LOG( SIMPLE, "PLAYTONE: CPlayToneHandler::UiLaunchFailed exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+
+CPlayToneHandler::CPlayToneHandler() :
+    CSatCommandHandler(),
+    iPlayToneData(),
+    iPlayTonePckg( iPlayToneData ),
+    iPlayToneRsp(),
+    iPlayToneRspPckg( iPlayToneRsp ),
+    // To be removed when icons are allowed in this command
+    iIconCommand( EFalse )
+    {
+    LOG( SIMPLE,
+        "PLAYTONE: CPlayToneHandler::CPlayToneHandler calling - exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CPlayToneHandler::ConstructL()
+    {
+    LOG( SIMPLE, "PLAYTONE: CPlayToneHandler::ConstructL calling" )
+
+    // Register service request handler for PlayTone command.
+    iUtils->RegisterServiceRequestL(
+        ESatSProactivePlayTone,
+        ESatSProactivePlayToneResponse,
+        this );
+
+    LOG( SIMPLE, "PLAYTONE: CPlayToneHandler::ConstructL exiting" )
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/PlayToneCmd/src/std.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 functions
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    <implementationproxy.h>
+#include    "CPlayToneHandler.h"
+
+// CONSTANTS
+
+const TImplementationProxy implementationTable[] =
+    {
+    //lint -e{611,1924} Warning "Suspicious cast" can not be avoided.
+    IMPLEMENTATION_PROXY_ENTRY( 0x1000A88C, CPlayToneHandler::NewL )
+    };
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy ECOM framework factory function
+// Calculates the number of implementations.
+// Returns: Implementation proxy.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount ) // Number of implementations
+    {
+    aTableCount =
+        sizeof( implementationTable ) /
+        sizeof( TImplementationProxy );
+    return implementationTable;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/ProvideLocalInfoCmd/group/ProvideLocalInfoCmd.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* 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:  Project definition file for project ProvideLocalInfo plug-in
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../../inc/SatMacroes.h"
+
+TARGET                  ProvideLocalInfoCmd.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D 0x10205C45
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  std.cpp
+SOURCE                  CProvideLocalInfoHandler.cpp
+
+START RESOURCE          10205C45.rss
+TARGET                  ProvideLocalInfoCmd.rsc
+END
+
+USERINCLUDE             ../../../inc
+USERINCLUDE             ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+SYSTEMINCLUDE           ../../../../../inc      // Domain telephony
+SYSTEMINCLUDE           ../../../../inc         // Subsystem satengine
+
+LIBRARY                 euser.lib
+LIBRARY                 etelsat.lib
+LIBRARY                 SatEngine.lib
+
+#ifdef ENABLE_SAT_LOGGING
+LIBRARY                 flogger.lib
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/ProvideLocalInfoCmd/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 ProvideLocalInfoCmd plug-in
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+ProvideLocalInfoCmd.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/ProvideLocalInfoCmd/inc/CProvideLocalInfoHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -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:  ProvideLocalInfo command handler
+*
+*/
+
+
+#ifndef CPROVIDELOCALINFOHANDLER_H
+#define CPROVIDELOCALINFOHANDLER_H
+
+//  INCLUDES
+#include <etelsat.h>
+#include "CSatCommandHandler.h"
+
+// FORWARD DECLARATION
+class MSatUtils;
+
+// CLASS DECLARATION
+
+/**
+*  Command handler for ProvideLocalInfo command.
+*
+*  @lib ProvideLocalInfo.lib
+*  @since Series 60 3.0
+*/
+class CProvideLocalInfoHandler : public CSatCommandHandler
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aUtils Utils inteface.
+        */
+        static CProvideLocalInfoHandler* NewL( MSatUtils* aUtils );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CProvideLocalInfoHandler();
+
+    public: // Functions from base classes
+
+        /**
+        * From MSatCommand.
+        */
+        void ClientResponse();
+
+    protected:  // Functions from base classes
+
+        /**
+        * From CActive Cancels the usat request.
+        */
+        void DoCancel();
+
+        /**
+        * From CSatCommandHandler Requests the command notification.
+        * @param aStatus Request status to active object notification
+        */
+        void IssueUSATRequest( TRequestStatus& aStatus );
+
+        /**
+        * From CSatCommandHandler Precheck before executing the command.
+        * @return Boolean indicating is this command allowed to execute.
+        */
+        TBool CommandAllowed();
+
+        /**
+        * From CSatCommandHandler Need for ui session.
+        * @return Boolean indicating does this command need UI session.
+        */
+        TBool NeedUiSession();
+
+        /**
+        * From CSatCommandHandler Called when USAT API.
+        * notifies that command.
+        */
+        void HandleCommand();
+
+        /**
+        * From CSatCommandHandler Indicates the failure
+        * of launching ui client.
+        */
+        void UiLaunchFailed();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CProvideLocalInfoHandler();
+
+    protected:    // Data
+
+         // The data structure for the command data
+        RSat::TLocalInfoV3 iLocalInfoData;
+
+        // The data package for IPC
+        RSat::TLocalInfoV3Pckg iLocalInfoPckg;
+
+        // Response from client
+        RSat::TLocalInfoRspV3 iLocalInfoRsp;
+
+        // Response package.
+        RSat::TLocalInfoRspV3Pckg iLocalInfoRspPckg;
+
+    };
+
+#endif      // CPROVIDELOCALINFOHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/ProvideLocalInfoCmd/inc/ProvideLocalInfoCmd.rls	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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 headers for project ProvideLocalInfoCmd
+*
+*/
+
+
+#ifndef PROVIDELOCALINFOCMD_RLS
+#define PROVIDELOCALINFOCMD_RLS
+
+rls_string STRING_r_providelocalinfocmd_display_name "ProvideLocalInfo command"
+rls_string STRING_r_providelocalinfocmd_default_data "ProvideLocalInfoCmd"
+rls_string STRING_r_providelocalinfocmd_opaque_data  ""
+
+#endif // PROVIDELOCALINFOCMD_RLS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/ProvideLocalInfoCmd/src/10205C45.rss	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 1020 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Registry information for ECOM
+*
+*/
+
+
+
+//  INCLUDES
+#include <registryinfo.rh>
+#include "ProvideLocalInfoCmd.rls"
+
+//  RESOURCE DEFINITIONS
+// -----------------------------------------------------------------------------
+//
+// ProvideLocalInfoCmd
+// Registeration information for ECOM
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO ProvideLocalInfoCmd
+    {
+    dll_uid = 0x10205C45;
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x1000f001;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x10205C46;
+                    version_no   = 1;
+                    display_name = STRING_r_providelocalinfocmd_display_name;
+                    default_data = STRING_r_providelocalinfocmd_default_data;
+                    opaque_data  = STRING_r_providelocalinfocmd_opaque_data;
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/ProvideLocalInfoCmd/src/CProvideLocalInfoHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,234 @@
+/*
+* 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:  Handles ProvideLocalInfo command
+*
+*/
+
+
+#include    "MSatApi.h"
+#include    "MSatUtils.h"
+#include    "MSatUiSession.h"
+#include    "MSatSystemState.h"
+#include    "SatSOpcodes.h"
+#include    "MSatSUiClientHandler.h"
+#include    "MSatEventMonitorContainer.h"
+#include    "CProvideLocalInfoHandler.h"
+#include    "SatLog.h"
+
+const TInt8 KLangDescrSize( 2 );
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// CProvideLocalInfoHandler::CProvideLocalInfoHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CProvideLocalInfoHandler::CProvideLocalInfoHandler() :
+    CSatCommandHandler(),
+    iLocalInfoData(),
+    iLocalInfoPckg( iLocalInfoData ),
+    iLocalInfoRsp(),
+    iLocalInfoRspPckg( iLocalInfoRsp )
+    {
+    LOG( SIMPLE,
+        "PROVIDELOCALINFO: CProvideLocalInfoHandler::\
+            CProvideLocalInfoHandler calling - exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CProvideLocalInfoHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CProvideLocalInfoHandler* CProvideLocalInfoHandler::NewL( MSatUtils* aUtils )
+    {
+    LOG( SIMPLE, "PROVIDELOCALINFO: CProvideLocalInfoHandler::NewL calling" )
+
+    CProvideLocalInfoHandler* self = new( ELeave ) CProvideLocalInfoHandler;
+
+    CleanupStack::PushL( self );
+    self->BaseConstructL( aUtils );
+    // ConstructL not needed.
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "PROVIDELOCALINFO: CProvideLocalInfoHandler::NewL exiting" )
+    return self;
+    }
+
+// Destructor
+CProvideLocalInfoHandler::~CProvideLocalInfoHandler()
+    {
+    LOG( SIMPLE, "PROVIDELOCALINFO: CProvideLocalInfoHandler::\
+        CProvideLocalInfoHandler calling" )
+
+    Cancel();
+
+    LOG( SIMPLE, "PROVIDELOCALINFO: CProvideLocalInfoHandler::\
+        ~CProvideLocalInfoHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CProvideLocalInfoHandler::ClientResponse
+// -----------------------------------------------------------------------------
+//
+void CProvideLocalInfoHandler::ClientResponse()
+    {
+    LOG( SIMPLE, "PROVIDELOCALINFO: CProvideLocalInfoHandler::\
+        ClientResponse calling-exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CProvideLocalInfoHandler::DoCancel
+// Cancels the sat request.
+// -----------------------------------------------------------------------------
+//
+void CProvideLocalInfoHandler::DoCancel()
+    {
+    LOG( SIMPLE, "PROVIDELOCALINFO: CProvideLocalInfoHandler::\
+        DoCancel calling" )
+
+    iUtils->USatAPI().NotifyLocalInfoCancel();
+
+    LOG( SIMPLE, "PROVIDELOCALINFO: CProvideLocalInfoHandler::\
+        DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CProvideLocalInfoHandler::IssueUSATRequest
+// -----------------------------------------------------------------------------
+//
+void CProvideLocalInfoHandler::IssueUSATRequest( TRequestStatus& aStatus )
+    {
+    LOG( SIMPLE, "PROVIDELOCALINFO: CProvideLocalInfoHandler::\
+        IssueUSATRequest calling" )
+
+    // Clear the IPC package.
+    new (&iLocalInfoData) RSat::TLocalInfoV3();
+
+    iUtils->USatAPI().NotifyLocalInfo( aStatus, iLocalInfoPckg );
+
+    LOG( SIMPLE, "PROVIDELOCALINFO: CProvideLocalInfoHandler::\
+        IssueUSATRequest exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CProvideLocalInfoHandler::CommandAllowed
+// -----------------------------------------------------------------------------
+//
+TBool CProvideLocalInfoHandler::CommandAllowed()
+    {
+    LOG( SIMPLE, "PROVIDELOCALINFO: CProvideLocalInfoHandler::CommandAllowed \
+        calling - exiting" )
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CProvideLocalInfoHandler::NeedUiSession
+// -----------------------------------------------------------------------------
+//
+TBool CProvideLocalInfoHandler::NeedUiSession()
+    {
+    LOG( SIMPLE, "PROVIDELOCALINFO: CProvideLocalInfoHandler::NeedUiSession \
+        calling - exiting" )
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CProvideLocalInfoHandler::HandleCommand
+// -----------------------------------------------------------------------------
+//
+void CProvideLocalInfoHandler::HandleCommand()
+    {
+    LOG( SIMPLE,
+        "PROVIDELOCALINFO: CProvideLocalInfoHandler::HandleCommand calling" )
+
+    iUtils->NotifyEvent( MSatUtils::ELocalInfoExecuting );
+
+    if ( RSat::KProvideLocalInfoLanguage == iLocalInfoData.iInfoType )
+        {
+        LOG( SIMPLE,"PROVIDELOCALINFO: CProvideLocalInfoHandler::\
+        HandleCommand KProvideLocalInfoLanguage" )
+
+        // Get new display text language from SAT SystemState.
+        TInt language( iUtils->SystemState().DisplayTextLanguage() );
+
+        // Maximum size in ISO 639-1 language is 2.
+        TBuf<KLangDescrSize> languageISO( KNullDesC );
+
+        // Verify language.
+        // If it is automatic, language preferred by SIM is used
+        TRAPD( err, iUtils->EventMonitors()->LanguageSettingL( language ) );
+        LOG2( NORMAL, 
+        "PROVIDELOCALINFO: CProvideLocalInfoHandler::HandleCommand err %i", 
+        err )
+        if ( KErrNone == err )
+            {
+            LOG2( NORMAL, 
+            "PROVIDELOCALINFO: CProvideLocalInfoHandler::HandleCommand \
+            language: %i", language )
+            // If language is automatic, language = 0
+            if ( language )
+                {
+                // Event monitor container has the function for resolving
+                // language string
+                iUtils->EventMonitors()->GetLanguageString(
+                    language, languageISO );
+                }
+            }
+        
+        // Check the language string and build the response
+        if ( languageISO != KNullDesC )
+            {
+            LOG( NORMAL, "PROVIDELOCALINFO: CProvideLocalInfoHandler::\
+                HandleCommand Success" )
+            iLocalInfoRsp.iGeneralResult = RSat::KSuccess;
+            iLocalInfoRsp.iInfoType = RSat::KLocalInformation;
+            iLocalInfoRsp.iAdditionalInfo.Copy( languageISO );
+            }
+        else
+            {
+            LOG( NORMAL, "PROVIDELOCALINFO: CProvideLocalInfoHandler::\
+                HandleCommand UnableToProcessCmd" )
+            iLocalInfoRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+            iLocalInfoRsp.iInfoType = RSat::KNoAdditionalInfo;
+            iLocalInfoRsp.iAdditionalInfo.Zero();
+            }
+        }
+    else
+        {
+        LOG( NORMAL, "PROVIDELOCALINFO: CProvideLocalInfoHandler::\
+                HandleCommand TypeNotUnderstood" )
+        iLocalInfoRsp.iGeneralResult = RSat::KCmdTypeNotUnderstood;
+        iLocalInfoRsp.iInfoType = RSat::KNoAdditionalInfo;
+        iLocalInfoRsp.iAdditionalInfo.Zero();
+        }
+
+    iLocalInfoRsp.SetPCmdNumber( iLocalInfoData.PCmdNumber() );
+    TerminalRsp( RSat::ELocalInfo, iLocalInfoRspPckg );
+
+    LOG( SIMPLE,
+        "PROVIDELOCALINFO: CProvideLocalInfoHandler::HandleCommand exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CProvideLocalInfoHandler::UiLaunchFailed
+// -----------------------------------------------------------------------------
+//
+void CProvideLocalInfoHandler::UiLaunchFailed()
+    {
+    LOG( SIMPLE, "PROVIDELOCALINFO: CProvideLocalInfoHandler::UiLaunchFailed \
+        calling-exiting" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/ProvideLocalInfoCmd/src/std.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 functions
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    <implementationproxy.h>
+#include    "CProvideLocalInfoHandler.h"
+
+// CONSTANTS
+
+const TImplementationProxy implementationTable[] =
+    {
+    //lint -e{611,1924} Warning "Suspicious cast" can not be avoided.
+    IMPLEMENTATION_PROXY_ENTRY( 0x10205C46, CProvideLocalInfoHandler::NewL )
+    };
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy ECOM framework factory function
+// Calculates the number of implementations.
+// Returns: Implementation proxy.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount ) // Number of implementations
+    {
+    aTableCount =
+        sizeof( implementationTable ) /
+        sizeof( TImplementationProxy );
+    return implementationTable;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/ReceiveDataCmd/group/ReceiveDataCmd.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* 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:  Project definition file for project ReceiveData plug-in
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../../inc/SatMacroes.h"
+
+TARGET                  ReceiveDataCmd.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D 0x10205C52
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  std.cpp
+SOURCE                  CReceiveDataHandler.cpp
+
+START RESOURCE          10205C52.rss
+TARGET                  ReceiveDataCmd.rsc
+END
+
+USERINCLUDE             ../../../inc
+USERINCLUDE             ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+SYSTEMINCLUDE           ../../../../../inc      // Domain telephony
+SYSTEMINCLUDE           ../../../../inc         // Subsystem satengine
+
+LIBRARY                 euser.lib
+LIBRARY                 etelsat.lib
+LIBRARY                 SatEngine.lib
+
+#ifdef ENABLE_SAT_LOGGING
+LIBRARY                 flogger.lib
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/ReceiveDataCmd/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 ReceiveData plug-in
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+ReceiveDataCmd.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/ReceiveDataCmd/inc/CReceiveDataHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,206 @@
+/*
+* 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:  ReceiveData command handler
+*
+*/
+
+
+#ifndef CRECEIVEDATAHANDLER_H
+#define CRECEIVEDATAHANDLER_H
+
+#include <etelsat.h>
+
+#include "CSatCommandHandler.h"
+#include "SatSTypes.h"
+#include "MSatBIPUtils.h"
+
+class MSatUtils;
+
+/**
+*  Command handler for ReceiveData command.
+*
+*  @lib ReceiveDataCmd.lib
+*  @since S60 v3.0
+*/
+class CReceiveDataHandler : public CSatCommandHandler
+    {
+
+public:
+
+    static CReceiveDataHandler* NewL( MSatUtils* aUtils );
+
+    virtual ~CReceiveDataHandler();
+
+// from base class MSatCommand
+
+    /**
+     * From MSatCommand.
+     * Response from the client.
+     *
+     */
+    void ClientResponse();
+
+// from base class CSatCommandHandler
+
+    /**
+     * From CSatCommandHandler
+     * Overrides the default implementation.
+     *
+     * @param aEvent Identifies the event.
+     */
+    void Event( TInt aEvent );
+
+protected:
+
+// from base class CActive
+
+    /**
+     * From CActive
+     * Cancels the usat request.
+     *
+     */
+    void DoCancel();
+
+// from base class CSatCommandHandler
+
+    /**
+     * From CSatCommandHandler
+     * Requests the command notification.
+     *
+     * @param aStatus Request status to active object notification
+     */
+    void IssueUSATRequest( TRequestStatus& aStatus );
+
+    /**
+     * From CSatCommandHandler
+     * Precheck before executing the command.
+     *
+     * @return Boolean indicating is this command allowed to execute.
+     */
+    TBool CommandAllowed();
+
+    /**
+     * From CSatCommandHandler
+     * Need for ui session.
+     *
+     * @return Boolean indicating does this command need UI session.
+     */
+    TBool NeedUiSession();
+
+    /**
+     * From CSatCommandHandler
+     * Called when USAT API notifies that command.
+     *
+     */
+    void HandleCommand();
+
+    /**
+     * From CSatCommandHandler.
+     * Indicates the failure of launching ui client.
+     *
+     */
+    void UiLaunchFailed();
+
+private:
+
+    CReceiveDataHandler();
+
+    void ConstructL();
+
+    /**
+     * Sends notification to UI.
+     *
+     * @return KErrNone if notification is sent successfully
+     */
+    TInt SendUiNotification();
+
+    /**
+     * Completes Terminal response and sends it.
+     *
+     * @param aError is error code of reason
+     */
+    void SendTerminalResponse(
+        const TInt aError = MSatBIPUtils::ESatBIPSuccess );
+
+private: // data
+
+    /**
+     * ReceiveData command data.
+     */
+    RSat::TReceiveDataV2 iReceiveDataData;
+
+    /**
+     * ReceiveData command package.
+     */
+    RSat::TReceiveDataV2Pckg iReceiveDataPckg;
+
+    /**
+     * ReceiveData response data.
+     */
+    RSat::TReceiveDataRspV2 iReceiveDataRspData;
+
+    /**
+     * ReceiveData response package.
+     */
+    RSat::TReceiveDataRspV2Pckg iReceiveDataRspPckg;
+
+    /**
+     * The data structure for notification.
+     */
+    TSatNotificationV1 iReceiveDataUiData;
+
+    /**
+     * Nitificatio package.
+     */
+    TSatNotificationV1Pckg iReceiveDataUiPckg;
+
+    /**
+     * Notification response.
+     */
+    TSatNotificationRspV1 iReceiveDataUiRsp;
+
+    /**
+     * Notification response package.
+     */
+    TSatNotificationRspV1Pckg iReceiveDataUiRspPckg;
+
+    /**
+     * Reiceive data buffer.
+     */
+    TBuf8<KSatBIPMaxResponseSize> iChData;
+
+    /**
+     * Remaining amount of data in RX-buffer.
+     */
+    TInt iChDataLength;
+
+    /**
+     * Indicates has user cancelled the action.
+     */
+    TBool iUserCancelled;
+
+    /**
+     * Indicates does current command need UI or not.
+     */
+    TBool iNeedUiSession;
+
+    /**
+     * Flag to signal that command has icon data.
+     * To be removed when icons are allowed in this command
+     */
+    TBool iIconCommand;
+
+    };
+
+#endif      // CRECEIVEDATAHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/ReceiveDataCmd/inc/ReceiveDataCmd.rls	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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 headers for project ReceiveDataCmd
+*
+*/
+
+
+#ifndef RECEIVEDATACMD_RLS
+#define RECEIVEDATACMD_RLS
+
+rls_string STRING_r_receivedatacmd_display_name "ReceiveData command"
+rls_string STRING_r_receivedatacmd_default_data "ReceiveDataCmd"
+rls_string STRING_r_receivedatacmd_opaque_data  ""
+
+#endif // RECEIVEDATACMD_RLS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/ReceiveDataCmd/src/10205C52.rss	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 1020 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Registry information for ECOM
+*
+*/
+
+
+
+//  INCLUDES
+#include <registryinfo.rh>
+#include "ReceiveDataCmd.rls"
+
+//  RESOURCE DEFINITIONS
+// -----------------------------------------------------------------------------
+//
+// ReceiveDataCmdInfo
+// Registeration information for ECOM
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO ReceiveDataCmdInfo
+    {
+    dll_uid = 0x10205C52;
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x1000f001;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x10205C53;
+                    version_no   = 1;
+                    display_name = STRING_r_receivedatacmd_display_name;
+                    default_data = STRING_r_receivedatacmd_default_data;
+                    opaque_data  = STRING_r_receivedatacmd_opaque_data;
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/ReceiveDataCmd/src/CReceiveDataHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,591 @@
+/*
+* 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 ReceiveData command
+*
+*/
+
+
+#include    "MSatApi.h"
+#include    "MSatUtils.h"
+#include    "MSatSystemState.h"
+#include    "MSatUiSession.h"
+#include    "SatSOpcodes.h"
+#include    "MSatSUiClientHandler.h"
+#include    "CReceiveDataHandler.h"
+#include    "SatLog.h"
+#include    "MSatBIPDataChannel.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CReceiveDataHandler* CReceiveDataHandler::NewL( MSatUtils* aUtils )
+    {
+    LOG( NORMAL, "ReceiveData: CReceiveDataHandler::NewL calling" )
+    CReceiveDataHandler* self = new( ELeave ) CReceiveDataHandler;
+
+    CleanupStack::PushL( self );
+    self->BaseConstructL( aUtils );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( NORMAL, "ReceiveData: CReceiveDataHandler::NewL exiting" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CReceiveDataHandler::~CReceiveDataHandler()
+    {
+    LOG( NORMAL, "ReceiveData: CReceiveDataHandler::\
+        CReceiveDataHandler calling" )
+    Cancel();
+    LOG( NORMAL, "ReceiveData: CReceiveDataHandler::\
+        ~CReceiveDataHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class MSatCommand.
+// Response from the client.
+// -----------------------------------------------------------------------------
+//
+void CReceiveDataHandler::ClientResponse()
+    {
+    LOG( NORMAL, "CReceiveDataHandler::ClientResponse calling-exiting" )
+    }
+    
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Waits for indication of user wanting to close the BIP session.
+// -----------------------------------------------------------------------------
+//
+void CReceiveDataHandler::Event( TInt aEvent )
+    {
+    LOG2( NORMAL, "ReceiveData: CReceiveDataHandler::Event calling, \
+        aEvent:%d", aEvent )
+
+    switch ( aEvent )
+        {
+        case MSatUtils::ECommandCancelled:
+        case MSatUtils::ECancelledUsingEndKey:
+            {
+            // Check Channel activation status
+            if ( iUtils->BipUtils().IsContextActive() )
+                {
+                LOG( NORMAL, "ReceiveData: CReceiveDataHandler::Event \
+                     IsContextActive" )
+                // Next command is rejected
+                iUserCancelled = ETrue;
+                SendTerminalResponse(); // If command is executing, send.
+                }
+            break;
+            }
+        case MSatUtils::EOpenChannelExecuting:
+            {
+            // New channel, reset user cancel flag.
+            iUserCancelled = EFalse;
+            break;
+            }
+        default:
+            {
+            // Move event to base class
+            CSatCommandHandler::Event( aEvent );
+            }
+        }
+    LOG( NORMAL, "ReceiveData: CReceiveDataHandler::Event exiting" )
+    }
+
+
+// -----------------------------------------------------------------------------
+// From class CActive.
+// Cancels the sat request.
+// -----------------------------------------------------------------------------
+//
+void CReceiveDataHandler::DoCancel()
+    {
+    LOG( NORMAL, "ReceiveData: CReceiveDataHandler::\
+        DoCancel calling" )
+    iUtils->USatAPI().NotifyReceiveDataCancel();
+    LOG( NORMAL, "ReceiveData: CReceiveDataHandler::\
+        DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Requests the command notification.
+// -----------------------------------------------------------------------------
+//
+void CReceiveDataHandler::IssueUSATRequest( TRequestStatus& aStatus )
+    {
+    LOG( NORMAL, "ReceiveData: CReceiveDataHandler::\
+        IssueUSATRequest calling" )
+    // Empty data
+    new (&iReceiveDataData) RSat::TReceiveDataV2();
+
+    iUtils->USatAPI().NotifyReceiveData( aStatus, iReceiveDataPckg );
+    iUtils->NotifyEvent( MSatUtils::EBipCommandDoneExecuting );
+    LOG( NORMAL, "ReceiveData: CReceiveDataHandler::\
+        IssueUSATRequest exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Precheck before executing the command.
+// -----------------------------------------------------------------------------
+//
+TBool CReceiveDataHandler::CommandAllowed()
+    {
+    LOG( NORMAL, "ReceiveData: CReceiveDataHandler::CommandAllowed \
+        calling" )
+    TBool commandAllowed( ETrue );
+
+    // Check user cancel
+    if ( iUserCancelled )
+        {
+        LOG( NORMAL, "ReceiveData: CReceiveDataHandler::CommandAllowed \
+             iUserCancelled true" )
+        SendTerminalResponse();
+        commandAllowed = EFalse;
+        }
+    else
+        {
+
+        // Proceed with the command
+        const TInt channelId( iReceiveDataData.iDestination );
+
+        if ( ( RSat::KChannel1 > channelId ) ||
+            ( RSat::KChannel7 < channelId ) ||
+            // If icon data without alpha id 
+            ( ( RSat::EAlphaIdProvided !=
+                iReceiveDataData.iAlphaId.iStatus ) &&
+            ( ( RSat::ESelfExplanatory ==
+                iReceiveDataData.iIconId.iQualifier ) ||
+            ( RSat::ENotSelfExplanatory ==
+                iReceiveDataData.iIconId.iQualifier ) ) ) )
+            {
+            LOG( NORMAL, "ReceiveData: CReceiveDataHandler::CommandAllowed \
+                Unknown channel identifier or icon without alpha id - \
+                Not allowed" )
+            // Create the response IPC package
+            iReceiveDataRspData.SetPCmdNumber(
+                                 iReceiveDataData.PCmdNumber() );
+            iReceiveDataRspData.iGeneralResult = RSat::KCmdDataNotUnderstood;
+            iReceiveDataRspData.iInfoType = RSat::KNoAdditionalInfo;
+            iReceiveDataRspData.iAdditionalInfo.Zero();
+            TerminalRsp( RSat::EReceiveData, iReceiveDataRspPckg );
+            commandAllowed = EFalse;
+            }
+        // Set icon command flag whether icon data was received and set qualifier
+        // to no icon id
+        // To be removed when icons are allowed in this command
+        else if ( ( RSat::ESelfExplanatory ==
+            iReceiveDataData.iIconId.iQualifier ) ||
+            ( RSat::ENotSelfExplanatory ==
+            iReceiveDataData.iIconId.iQualifier ) )
+            {
+            LOG( NORMAL, "ReceiveData: CReceiveDataHandler::CommandAllowed \
+                 ENoIconId" )
+            iIconCommand = ETrue;
+            iReceiveDataData.iIconId.iQualifier = RSat::ENoIconId;
+            }
+        else
+            {
+            LOG( NORMAL, "ReceiveData: CReceiveDataHandler::CommandAllowed \
+                 others" )
+            iIconCommand = EFalse;
+            }
+            
+        // ReceiveData doesn't need to check Service, ongoing calls etc.
+        // because data is waiting in SAT Engine, so ReceiveData doesn't 
+        // do any network operations. 
+        }
+    LOG2( NORMAL, "ReceiveData: CReceiveDataHandler::CommandAllowed exiting,\
+          commandAllowed: %d", commandAllowed )
+    return commandAllowed;
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Need for ui session.
+// -----------------------------------------------------------------------------
+//
+TBool CReceiveDataHandler::NeedUiSession()
+    {
+    LOG( NORMAL, "ReceiveData: CReceiveDataHandler::NeedUiSession calling" )
+    // UI is NOT needed in case where AlphaID is provided and it is a NULL
+    iNeedUiSession = ( !( RSat::EAlphaIdNull ==
+                          iReceiveDataData.iAlphaId.iStatus ) &&
+                       !( RSat::EAlphaIdNotPresent ==
+                          iReceiveDataData.iAlphaId.iStatus ) );
+    // Send notification to Mediator client if Cover UI is supported
+    if ( iNeedUiSession && iUtils->CoverUiSupported() )
+        {
+        LOG( NORMAL, "ReceiveData: CReceiveDataHandler::NeedUiSession \
+             CoverUiSupported" )
+        TSatCommandData medEventData;
+        medEventData.iPCmdNumber = RSat::EReceiveData;
+        medEventData.iAlphaId = iReceiveDataData.iAlphaId;
+        medEventData.iDuration.iNumOfUnits = KSatDefaultDuration;
+        medEventData.iIconID = iReceiveDataData.iIconId;
+        TSatCommandPckg tPckg( medEventData );
+        iUtils->RaiseSatEvent( tPckg );
+        }
+    LOG2( NORMAL, "ReceiveData: CReceiveDataHandler::NeedUiSession exiting,\
+          iNeedUiSession: %d", iNeedUiSession )
+    return iNeedUiSession;
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Called when USAT API notifies that command.
+// -----------------------------------------------------------------------------
+//
+void CReceiveDataHandler::HandleCommand()
+    {
+    LOG( NORMAL, "ReceiveData: CReceiveDataHandler::HandleCommand calling" )
+
+    // Notify other's about this command executiuon
+    iUtils->NotifyEvent( MSatUtils::EReceiveDataExecuting );
+    iUtils->NotifyEvent( MSatUtils::EBipCommandExecuting );
+    TInt uiError( KErrNone );
+
+    if ( iNeedUiSession )
+        {
+        LOG( NORMAL, "ReceiveData: CReceiveDataHandler::HandleCommand \
+            Sending UI Notification" )
+        uiError = SendUiNotification();
+        }
+    LOG2( NORMAL, 
+    "ReceiveData: CReceiveDataHandler::HandleCommand uiError: %i", uiError )
+    if ( KErrNone == uiError )
+        {
+        iChDataLength = 0;
+
+        // Proceed with the command
+        TInt err( MSatBIPUtils::ESatBIPSuccess );
+        TInt error( KErrNone );
+
+        TInt requestedLength( iReceiveDataData.iChannelDataLength );
+
+        // Make sure that reguested data length is not
+        // more than KSatBIPMaxResponseSize
+        if ( requestedLength > KSatBIPMaxResponseSize )
+            {
+            LOG( NORMAL, "ReceiveData: CReceiveDataHandler::HandleCommand \
+            requestedLength > KSatBIPMaxResponseSize" )
+            requestedLength = KSatBIPMaxResponseSize;
+            }
+
+        LOG2( NORMAL, "ReceiveData: CReceiveDataHandler::HandleCommand \
+        Requested data length: %i", requestedLength )
+
+        // Get Data Channel
+        MSatBIPDataChannel* datachannel =
+            iUtils->BipUtils().DataChannel(
+                iReceiveDataData.iDestination, err );
+                
+        LOG2( NORMAL, "ReceiveData: CReceiveDataHandler::HandleCommand \
+        err: %i", err )
+        //Check if ch was found
+        if ( MSatBIPUtils::ESatBIPSuccess == err 
+            || MSatBIPUtils::ESatBIPChannelClosed == err )
+            {
+            LOG( NORMAL, "ReceiveData: CReceiveDataHandler::HandleCommand \
+            MSatBIPUtils::ESatBIPSuccess == err" )
+            iChData.Zero();
+            TRAP( error, err = datachannel->ReceiveDataL(
+                                    iChData,
+                                    requestedLength,
+                                    iChDataLength ) );
+            }
+        LOG2( NORMAL, "ReceiveData: CReceiveDataHandler::HandleCommand \
+        error: %i", error )
+        // No point to continue
+        if ( error != KErrNone )
+            {
+            iReceiveDataRspData.iGeneralResult =
+                RSat::KBearerIndepProtocolError;
+            }
+        // Not all requested data yet available
+        else if ( MSatBIPUtils::ESatBIPReqBufSizeNotAvail == err ||
+                  MSatBIPUtils::ESatBIPChannelClosed == err )
+            {
+            LOG( NORMAL, "ReceiveData: CReceiveDataHandler::HandleCommand \
+                Not all requested data available" )
+            iReceiveDataRspData.iGeneralResult = RSat::KMissingInformation;
+            }
+        // Some other error
+        else if ( MSatBIPUtils::ESatBIPSuccess != err )
+            {
+            LOG2( NORMAL, "ReceiveData: CReceiveDataHandler::HandleCommand \
+                Error %i", err )
+            iReceiveDataRspData.iGeneralResult =
+                RSat::KBearerIndepProtocolError;
+            }
+        // Everything fine
+        else
+            {
+            LOG( NORMAL, 
+            "ReceiveData: CReceiveDataHandler::HandleCommand success")
+            iReceiveDataRspData.iGeneralResult = RSat::KSuccess;
+            }
+
+        // Send terminal response
+        SendTerminalResponse( err );
+        }
+
+    LOG2( NORMAL, 
+    "ReceiveData: CReceiveDataHandler::HandleCommand %i bytes Remain in RX \
+    buffer.", iChDataLength )
+    LOG2( NORMAL, 
+    "ReceiveData: CReceiveDataHandler::HandleCommand Returning %i bytes", 
+    iChData.Length() )
+
+    LOG( NORMAL, "ReceiveData: CReceiveDataHandler::HandleCommand exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Indicates the failure of launching ui client.
+// -----------------------------------------------------------------------------
+//
+void CReceiveDataHandler::UiLaunchFailed()
+    {
+    LOG( NORMAL, "ReceiveData: CReceiveDataHandler::UiLaunchFailed calling" )
+    iReceiveDataRspData.iGeneralResult = RSat::KMeUnableToProcessCmd;
+    iReceiveDataRspData.iInfoType = RSat::KMeProblem;
+    iReceiveDataRspData.iAdditionalInfo.SetLength( 1 );
+    iReceiveDataRspData.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
+    iReceiveDataRspData.SetPCmdNumber( iReceiveDataData.PCmdNumber() );
+    TerminalRsp( RSat::EReceiveData, iReceiveDataRspPckg );
+    LOG( NORMAL, "ReceiveData: CReceiveDataHandler::UiLaunchFailed exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+//lint -e{1403, 1769} Can not be initialized.
+CReceiveDataHandler::CReceiveDataHandler() :
+    CSatCommandHandler(),
+    iReceiveDataData(),
+    iReceiveDataPckg( iReceiveDataData ),
+    iReceiveDataRspData(),
+    iReceiveDataRspPckg( iReceiveDataRspData ),
+    iReceiveDataUiData(),
+    iReceiveDataUiPckg( iReceiveDataUiData ),
+    iReceiveDataUiRsp(),
+    iReceiveDataUiRspPckg( iReceiveDataUiRsp ),
+    // To be removed when icons are allowed in this command
+    iIconCommand( EFalse )
+    {
+    LOG( NORMAL,
+        "ReceiveData: CReceiveDataHandler::\
+            CReceiveDataHandler calling - exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CReceiveDataHandler::ConstructL()
+    {
+    LOG( NORMAL, "ReceiveData: CReceiveDataHandler::ConstructL \
+        calling" )
+
+    iUtils->RegisterServiceRequestL( ESatSProactiveNotification,
+        ESatSProactiveNotificationResponse, this );
+
+    // Register to ui service request
+    iUtils->RegisterL( this, MSatUtils::ECommandCancelled );
+    iUtils->RegisterL( this, MSatUtils::ECancelledUsingEndKey );
+    iUtils->RegisterL( this, MSatUtils::EOpenChannelExecuting );
+
+    LOG( NORMAL, "ReceiveData: CReceiveDataHandler::ConstructL \
+        exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Sends notification to UI.
+// -----------------------------------------------------------------------------
+//
+TInt CReceiveDataHandler::SendUiNotification()
+    {
+    LOG( NORMAL, "ReceiveData: CReceiveDataHandler::SendUiNotification \
+        calling" )
+    // Register to ui service request
+    TRAPD( uiError, iUtils->RegisterServiceRequestL(
+        ESatSProactiveNotification,
+        ESatSProactiveNotificationResponse, this ) );
+    LOG2( NORMAL, "ReceiveData: CReceiveDataHandler::SendUiNotification \
+          uiError: %d", uiError )
+    // Check UI error
+    if ( KErrNone == uiError )
+        {
+        // Create IPC data to UI
+        iReceiveDataUiData.iCommand = ESatSReceiveDataNotify;
+        
+        iReceiveDataUiData.iText = iReceiveDataData.iAlphaId.iAlphaId;
+        iReceiveDataUiData.iIconId.iIdentifier
+             = iReceiveDataData.iIconId.iIdentifier;
+
+        // Define icon qualifier
+        if ( RSat::ENotSelfExplanatory ==
+            iReceiveDataData.iIconId.iQualifier )
+            {
+            LOG( NORMAL, "ReceiveData: CReceiveDataHandler::\
+                 SendUiNotification ENotSelfExplanatory" )
+            iReceiveDataUiData.iIconId.iIconQualifier =
+                ESatNotSelfExplanatory;
+            }
+        else if ( RSat::ESelfExplanatory ==
+            iReceiveDataData.iIconId.iQualifier )
+            {
+            LOG( NORMAL, "ReceiveData: CReceiveDataHandler::\
+                 SendUiNotification ESelfExplanatory" )
+            iReceiveDataUiData.iIconId.iIconQualifier = ESatSelfExplanatory; 
+            }
+        else // Icon qualifier not present
+            {
+            LOG( NORMAL, "ReceiveData: CReceiveDataHandler::\
+                 SendUiNotification ESatENoIconId" )
+            iReceiveDataUiData.iIconId.iIconQualifier = ESatENoIconId;
+            }
+        LOG2( NORMAL, "ReceiveData: CReceiveDataHandler::SendUiNotification \
+              iReceiveDataData.iAlphaId.iStatus: %d", 
+              iReceiveDataData.iAlphaId.iStatus )    
+        // Define AlphaID status
+        switch ( iReceiveDataData.iAlphaId.iStatus )
+            {
+            case RSat::EAlphaIdNotPresent:
+                {
+                iReceiveDataUiData.iAlphaIdStatus = ESatAlphaIdNotProvided;
+                break;
+                }
+
+            case RSat::EAlphaIdProvided:
+                {
+                iReceiveDataUiData.iAlphaIdStatus = ESatAlphaIdNotNull;
+                break;
+                }
+
+            default:
+                {
+                iReceiveDataUiData.iAlphaIdStatus = ESatAlphaIdNull;
+                break;
+                }
+            }
+
+        // Send notification to UI
+        MSatUiSession* session = iUtils->SatUiHandler().UiSession();
+        session->SendCommand( &iReceiveDataUiPckg,
+                              &iReceiveDataUiRspPckg,
+                              ESatSProactiveNotification );
+        }
+    else
+        {
+        // Send error terminal response
+        iReceiveDataRspData.iGeneralResult = RSat::KMeUnableToProcessCmd;
+        SendTerminalResponse( RSat::KNoSpecificMeProblem );
+        }
+    LOG( NORMAL, "ReceiveData: CReceiveDataHandler::SendUiNotification \
+        exiting" )
+    return uiError;
+    }
+
+// -----------------------------------------------------------------------------
+// Completes Terminal response and sends it.
+// -----------------------------------------------------------------------------
+//
+void CReceiveDataHandler::SendTerminalResponse( const TInt aError )
+    {
+    LOG( NORMAL, "ReceiveData: CReceiveDataHandler::SendTerminalResponse \
+        calling" )
+
+    if ( iUserCancelled )
+        {
+        LOG( NORMAL, "ReceiveData: CReceiveDataHandler::SendTerminalResponse \
+            User cancelled the action" )
+        iReceiveDataRspData.iGeneralResult = RSat::KPSessionTerminatedByUser;
+        iReceiveDataRspData.iInfoType = RSat::KNoAdditionalInfo;
+        iReceiveDataRspData.iAdditionalInfo.Zero();
+        }
+    else if ( RSat::KMissingInformation == iReceiveDataRspData.iGeneralResult ||
+              RSat::KSuccess == iReceiveDataRspData.iGeneralResult )
+        {
+        LOG( NORMAL, "ReceiveData: CReceiveDataHandler::SendTerminalResponse\
+            KMissingInformation or KSuccess" )
+        iReceiveDataRspData.iInfoType = RSat::KChannelData;
+        iReceiveDataRspData.iAdditionalInfo.Copy( iChData );
+        // More than maximum bytes remaining
+        if ( iChDataLength > KSatBIPMoreThanMaxSize )
+            {
+            LOG( NORMAL, "ReceiveData: CReceiveDataHandler::\
+            SendTerminalResponse iChDataLength > KSatBIPMoreThanMaxSize" )
+            iReceiveDataRspData.iChannelDataLength = KSatBIPMoreThanMaxSize;
+            }
+        else
+            {
+            iReceiveDataRspData.iChannelDataLength =
+                static_cast<TUint8>( iChDataLength );
+            }
+
+        // If command had icon data and was done succesfully,
+        // report that icon was not shown.
+        // To be removed and correct handling (i.e. ClientResponse to
+        // notification is received) for general result
+        // KSuccessRequestedIconNotDisplayed must be added when icons
+        // are allowed in this command 
+        if ( ( RSat::KSuccess == iReceiveDataRspData.iGeneralResult ) &&
+            iIconCommand )
+            {
+            LOG( NORMAL, "ReceiveData: CReceiveDataHandler::\
+            SendTerminalResponse KSuccessRequestedIconNotDisplayed" )
+            iReceiveDataRspData.iGeneralResult =
+                RSat::KSuccessRequestedIconNotDisplayed;
+            }
+        }
+    else
+        {
+        LOG( NORMAL, "ReceiveData: CReceiveDataHandler::SendTerminalResponse\
+             others" )
+        iReceiveDataRspData.iInfoType = RSat::KMeProblem;
+        iReceiveDataRspData.iAdditionalInfo.SetLength( 1 );
+        // Error code from MSatBIPUtils is the same as defined in etelsat.h,
+        // so we can put that error code straigth to additional info
+        iReceiveDataRspData.iAdditionalInfo[0] = static_cast<TUint8> ( aError );
+        iReceiveDataRspData.iChannelDataLength = 0;
+        }
+
+    if ( IsCommandExecuting() )
+        {
+        LOG( NORMAL, "ReceiveData: CReceiveDataHandler::SendTerminalResponse\
+             IsCommandExecuting" )
+        // Create the response IPC package
+        iReceiveDataRspData.SetPCmdNumber( iReceiveDataData.PCmdNumber() );
+
+        // Fixed order to send terminal response.
+        iUtils->NotifyEvent( MSatUtils::EDelaySimSessionEnd );
+        iUtils->USatAPI().TerminalRsp( RSat::EReceiveData, iReceiveDataRspPckg );
+        Start();
+        }
+    LOG( NORMAL, "ReceiveData: CReceiveDataHandler::SendTerminalResponse \
+        exiting" )
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/ReceiveDataCmd/src/std.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 functions
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    <implementationproxy.h>
+#include    "CReceiveDataHandler.h"
+
+// CONSTANTS
+
+const TImplementationProxy implementationTable[] =
+    {
+    //lint -e{611,1924} Warning "Suspicious cast" can not be avoided.
+    IMPLEMENTATION_PROXY_ENTRY( 0x10205C53, CReceiveDataHandler::NewL )
+    };
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy ECOM framework factory function
+// Calculates the number of implementations.
+// Returns: Implementation proxy.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount ) // Number of implementations
+    {
+    aTableCount =
+        sizeof( implementationTable ) /
+        sizeof( TImplementationProxy );
+    return implementationTable;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/RefreshCmd/group/RefreshCmd.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* 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:  Project definition file for project Refresh plug-in
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../../inc/SatMacroes.h"
+
+TARGET                  RefreshCmd.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D 0x10202990
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  std.cpp
+SOURCE                  CRefreshHandler.cpp
+
+START RESOURCE          10202990.rss
+TARGET                  RefreshCmd.rsc
+END
+
+USERINCLUDE             ../../../inc
+USERINCLUDE             ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+SYSTEMINCLUDE           ../../../../../inc      // Domain telephony
+SYSTEMINCLUDE           ../../../../inc         // Subsystem satengine
+
+LIBRARY                 euser.lib
+LIBRARY                 etelsat.lib
+LIBRARY                 SatEngine.lib
+
+#ifdef ENABLE_SAT_LOGGING
+LIBRARY                 flogger.lib
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/RefreshCmd/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 RefreshCmd plug-in
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+RefreshCmd.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/RefreshCmd/inc/CRefreshHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,147 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Refresh command handler
+*
+*/
+
+
+
+#ifndef CREFRESHHANDLER_H
+#define CREFRESHHANDLER_H
+
+//  INCLUDES
+#include <etelsat.h>
+#include "SatSTypes.h"
+#include "CSatCommandHandler.h"
+
+// FORWARD DECLARATION
+class MSatUtils;
+
+// CLASS DECLARATION
+
+/**
+*  Command handler for Refresh command.
+*
+*  @lib RefreshCmd.lib
+*  @since Series 60 3.0
+*/
+class CRefreshHandler : public CSatCommandHandler
+    {
+    public:     // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aUtils SAT Utils interface
+        */
+        static CRefreshHandler* NewL( MSatUtils* aUtils );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CRefreshHandler();
+
+    public:     // Functions from base classes
+
+        /**
+        * From MSatEventObserver. Overrides the default implementation.
+        * @param aEvent An event that is occured.
+        */
+        void Event( TInt aEvent );
+
+    protected:  // Functions from base classes
+
+        /**
+        * From CActive Cancels the usat request.
+        */
+        void DoCancel();
+
+        /**
+        * From CCommandHandler Requests the command notification.
+        * @param aStatus Request status
+        */
+        void IssueUSATRequest( TRequestStatus& aStatus );
+
+        /**
+        * From CSatCommandHandler Precheck before executing the command.
+        * @return TBool indicating command is currently allowed.
+        */
+        TBool CommandAllowed();
+
+        /**
+        * From CSatCommandHandler Need for ui session.
+        * @return TBool indicating need of ui session.
+        */
+        TBool NeedUiSession();
+
+        /**
+        * From CSatCommandHandler Called when USAT API notifies that command.
+        */
+        void HandleCommand();
+
+        /**
+        * From CSatCommandHandler. Indicates the failure of launching ui client.
+        */
+        void UiLaunchFailed();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CRefreshHandler();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private:    // New functions
+
+        /**
+        * Notifies the refresh clients about refresh cancel.
+        */
+        void NotifyRefreshClientsCancel();
+
+        /**
+        * Completes refresh when all clients has completed.
+        */
+        void CompleteRefresh();
+
+    private:    // Data
+
+        // Refresh command data.
+        RSat::TRefreshV2 iRefreshData;
+
+        // Refresh command package.
+        RSat::TRefreshV2Pckg iRefreshPckg;
+
+        // Response from client
+        RSat::TRefreshRspV1 iRefreshRsp;
+
+        // Response package.
+        RSat::TRefreshRspV1Pckg iRefreshRspPckg;
+
+        // Count of refresh clients notified refresh but not yet answered.
+        TInt iRefreshNotifyClientCount;
+
+        // True whether any client has indicated additional EF read.
+        TBool iAdditionalEFRead;
+
+        // Indicates SimReset type refresh is executing.
+        TBool iSimResetExecuting;
+    };
+
+#endif      // CREFRESHHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/RefreshCmd/inc/RefreshCmd.rls	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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 headers for project RefreshCmd
+*
+*/
+
+
+#ifndef REFRESHCMD_RLS
+#define REFRESHCMD_RLS
+
+rls_string STRING_r_refreshcmd_display_name "Refresh command"
+rls_string STRING_r_refreshcmd_default_data "RefreshCmd"
+rls_string STRING_r_refreshcmd_opaque_data  ""
+
+#endif // REFRESHCMD_RLS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/RefreshCmd/src/10202990.rss	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 1020 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Registry information for ECOM
+*
+*/
+
+
+
+//  INCLUDES
+#include <registryinfo.rh>
+#include "RefreshCmd.rls"
+
+//  RESOURCE DEFINITIONS
+// -----------------------------------------------------------------------------
+//
+// RefreshCmdInfo
+// Registeration information for ECOM
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO RefreshCmdInfo
+    {
+    dll_uid = 0x10202990;
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x1000f001;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x10202991;
+                    version_no   = 1;
+                    display_name = STRING_r_refreshcmd_display_name;
+                    default_data = STRING_r_refreshcmd_default_data;
+                    opaque_data  = STRING_r_refreshcmd_opaque_data;
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/RefreshCmd/src/CRefreshHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,345 @@
+/*
+* 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:  Handles Refresh command
+*
+*/
+
+
+#include    <msatrefreshobserver.h>
+#include    "MSatSUiClientHandler.h"
+#include    "CRefreshHandler.h"
+#include    "MSatApi.h"
+#include    "MSatUtils.h"
+#include    "MSatSystemState.h"
+#include    "MSatUiSession.h"
+#include    "SatSOpcodes.h"
+#include    "MSatRefreshSubSession.h"
+#include    "SatLog.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// CRefreshHandler::CRefreshHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CRefreshHandler::CRefreshHandler() :
+    CSatCommandHandler(),
+    iRefreshData(),
+    iRefreshPckg( iRefreshData ),
+    iRefreshRsp(),
+    iRefreshRspPckg( iRefreshRsp ),
+    iRefreshNotifyClientCount( 0 ),
+    iAdditionalEFRead( EFalse ),
+    iSimResetExecuting( EFalse )
+    {
+    LOG( SIMPLE,
+        "REFRESH: CRefreshHandler::CRefreshHandler calling - exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CRefreshHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CRefreshHandler::ConstructL()
+    {
+    LOG( SIMPLE, "REFRESH: CRefreshHandler::ConstructL calling" )
+
+    // Register events to be listen.
+    iUtils->RegisterL( this, MSatUtils::ERefreshEFRead );
+    iUtils->RegisterL( this, MSatUtils::ERefreshAdditionalEFRead );
+    iUtils->RegisterL( this, MSatUtils::ESimResetCalled );
+
+    LOG( SIMPLE, "REFRESH: CRefreshHandler::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CRefreshHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CRefreshHandler* CRefreshHandler::NewL( MSatUtils* aUtils )
+    {
+    LOG( SIMPLE, "REFRESH: CRefreshHandler::NewL calling" )
+
+    CRefreshHandler* self = new( ELeave ) CRefreshHandler;
+
+    CleanupStack::PushL( self );
+    self->BaseConstructL( aUtils );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "REFRESH: CRefreshHandler::NewL exiting" )
+    return self;
+    }
+
+
+// Destructor
+CRefreshHandler::~CRefreshHandler()
+    {
+    LOG( SIMPLE, "REFRESH: CRefreshHandler::~CRefreshHandler calling" )
+
+    Cancel();
+
+    LOG( SIMPLE, "REFRESH: CRefreshHandler::~CRefreshHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CRefreshHandler::Event
+// -----------------------------------------------------------------------------
+//
+void CRefreshHandler::Event( TInt aEvent )
+    {
+    LOG( SIMPLE, "REFRESH: CRefreshHandler::Event calling" )
+
+    switch ( aEvent )
+        {
+        case MSatUtils::ERefreshAdditionalEFRead:
+            {
+            LOG( NORMAL, "REFRESH:   Event: Additional EF read" )
+
+            // At least one client indicates additional EF read.
+            iAdditionalEFRead = ETrue;
+            }
+            //lint -fallthrough intended here
+
+        case MSatUtils::ERefreshEFRead:
+            {
+            LOG( NORMAL, "REFRESH:   Event: Client Completed" )
+
+            if ( 0 < iRefreshNotifyClientCount )
+                {
+                iRefreshNotifyClientCount--;
+                // Check whether all clients have replied.
+                if ( 0 == iRefreshNotifyClientCount )
+                    {
+                    LOG( NORMAL, "REFRESH:   All clients are complete" )
+                    // Construct and send terminal response..
+                    CompleteRefresh();
+                    }
+                }
+            break;
+            }
+
+        case MSatUtils::ESimResetCalled:
+            {
+            LOG( NORMAL, "REFRESH:   Event: Sim Reset called" )
+            iSimResetExecuting = ETrue;
+            break;
+            }
+
+        default:
+            {
+            LOG2( NORMAL, "REFRESH:   Event: %i", aEvent )
+            CSatCommandHandler::Event( aEvent );
+            }
+        }
+
+    LOG( SIMPLE, "REFRESH: CRefreshHandler::Event exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CRefreshHandler::DoCancel
+// Cancels the sat request.
+// -----------------------------------------------------------------------------
+//
+void CRefreshHandler::DoCancel()
+    {
+    LOG( SIMPLE, "REFRESH: CRefreshHandler::DoCancel calling" )
+
+    iUtils->USatAPI().NotifyRefreshCancel();
+
+    LOG( SIMPLE, "REFRESH: CRefreshHandler::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CRefreshHandler::IssueUSATRequest
+// -----------------------------------------------------------------------------
+//
+void CRefreshHandler::IssueUSATRequest( TRequestStatus& aStatus )
+    {
+    LOG( SIMPLE, "REFRESH: CRefreshHandler::IssueUSATRequest calling" )
+
+    // Refresh has been cancelled, lets notify clients waiting for it.
+    if ( KErrGeneral == aStatus.Int() )
+        {
+        LOG( SIMPLE, "REFRESH:   Refresh cancelled" )
+        NotifyRefreshClientsCancel();
+
+        if ( iSimResetExecuting )
+            {
+            LOG( SIMPLE, "CRefreshHandler::IssueUSATRequest \
+            iSimResetExecuting" )
+            iUtils->NotifyEvent( MSatUtils::EAddSatUiCalled );
+            iUtils->NotifyEvent( MSatUtils::ESimResetCancelled );
+
+            iSimResetExecuting = EFalse;
+            }
+        }
+
+    // Clear the IPC package.
+    new (&iRefreshData) RSat::TRefreshV2();
+
+    iUtils->USatAPI().NotifyRefresh( aStatus, iRefreshPckg );
+
+    LOG( SIMPLE, "REFRESH: CRefreshHandler::IssueUSATRequest exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CRefreshHandler::CommandAllowed
+// -----------------------------------------------------------------------------
+//
+TBool CRefreshHandler::CommandAllowed()
+    {
+    LOG( SIMPLE, "REFRESH: CRefreshHandler::CommandAllowed calling - exiting" )
+
+    // Now we must always allow Refresh. We had our last chnage to deny it in
+    // RefreshRequired command.
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CRefreshHandler::NeedUiSession
+// -----------------------------------------------------------------------------
+//
+TBool CRefreshHandler::NeedUiSession()
+    {
+    LOG( SIMPLE, "REFRESH: CRefreshHandler::NeedUiSession calling - exiting" )
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CRefreshHandler::HandleCommand
+// -----------------------------------------------------------------------------
+//
+void CRefreshHandler::HandleCommand()
+    {
+    LOG( SIMPLE, "REFRESH: CRefreshHandler::HandleCommand calling" )
+
+    // Refresh has been done.
+    iSimResetExecuting = EFalse;
+
+    #ifdef ENABLE_SAT_LOGGING
+    TInt fileCount( iRefreshData.iFileList.Length() );
+    LOG2( NORMAL, "REFRESH:   Refresh file count: %d", fileCount )
+    for ( TInt fileIndex = 0; fileIndex < fileCount; fileIndex++ )
+        {
+        LOG2( NORMAL, "REFRESH:     Refresh file : %x",
+            iRefreshData.iFileList[ fileIndex ] )
+        }
+    #endif
+
+    // Notify all registered clients about refresh.
+    // Whether any clients exists, we must wait them all to complete EF read,
+    // otherwise we can complete now.
+    // Count must be local variable, due some client may reply before
+    // all other has been notified.
+    TInt clientCount( iUtils->RefreshSubSessions().Count() );
+    iRefreshNotifyClientCount = clientCount; // Actually notified clients.
+    iAdditionalEFRead = EFalse;
+    if ( 0 != clientCount )
+        {
+        LOG2( NORMAL, "REFRESH:   Refresh client count: %d",
+            iRefreshNotifyClientCount )
+
+        // Notify refresh clients about refresh completion.
+        for ( TInt i = 0; i < clientCount ; i++ )
+            {
+            iUtils->RefreshSubSessions()[i]->NotifyClient( iRefreshData );
+            }
+        }
+    else
+        {
+        // Construct and send terminal response..
+        CompleteRefresh();
+        }
+
+    LOG( SIMPLE, "REFRESH: CRefreshHandler::HandleCommand exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CRefreshHandler::UiLaunchFailed
+// -----------------------------------------------------------------------------
+//
+void CRefreshHandler::UiLaunchFailed()
+    {
+    // This command will not launch ui.
+    LOG( SIMPLE, "REFRESH: CRefreshHandler::UiLaunchFailed calling-exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CRefreshHandler::CompleteRefresh
+// Waits for all clients complete.
+// -----------------------------------------------------------------------------
+//
+void CRefreshHandler::CompleteRefresh()
+    {
+    LOG( SIMPLE, "REFRESH: CRefreshHandler::CompleteRefresh calling" )
+
+    // Remove the idle mode text and icon for initialization type refreshes.
+    // Note that idle mode text was removed for ESimReset already in
+    // RefreshRequired command.
+    if ( ( RSat::EFileChangeNotification != iRefreshData.iType ) &&
+         ( RSat::ESimReset != iRefreshData.iType ) )
+        {
+        LOG( SIMPLE, "REFRESH: CRefreshHandler::CompleteRefresh ESimInitDone" )
+        iUtils->NotifyEvent( MSatUtils::ESimInitDone );
+        }
+
+    // Construct a proper refresh response data package.
+    if ( iAdditionalEFRead )
+        {
+        LOG( SIMPLE, "REFRESH: CRefreshHandler::CompleteRefresh \
+             iAdditionalEFRead" )
+        iRefreshRsp.iGeneralResult = RSat::KRefreshAdditionEFRead;
+        iAdditionalEFRead = EFalse;
+        }
+    else
+        {
+        iRefreshRsp.iGeneralResult = RSat::KSuccess;
+        }
+
+    iRefreshRsp.iInfoType = RSat::KNoAdditionalInfo;
+    iRefreshRsp.iAdditionalInfo.Zero();
+    iRefreshRsp.SetPCmdNumber( iRefreshData.PCmdNumber() );
+
+    // Send the response
+    TerminalRsp( RSat::ERefresh, iRefreshRspPckg );
+
+    LOG( SIMPLE, "REFRESH: CRefreshHandler::CompleteRefresh exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CRefreshHandler::NotifyRefreshClientsCancel
+// Notifies waiting clients about refrsh cancel.
+// -----------------------------------------------------------------------------
+//
+void CRefreshHandler::NotifyRefreshClientsCancel()
+    {
+    LOG( SIMPLE,
+        "REFRESH: CRefreshHandler::NotifyRefreshClientsCancel calling" )
+    LOG2( SIMPLE,
+        "REFRESH: CRefreshHandler::NotifyRefreshClientsCancel \
+        iRefreshNotifyClientCount: %d", iRefreshNotifyClientCount )
+    for ( TInt i = 0; i < iRefreshNotifyClientCount ; i++ )
+        {
+        iUtils->RefreshSubSessions()[i]->NotifyClientCancel();
+        }
+    iRefreshNotifyClientCount = 0;
+
+    LOG( SIMPLE,
+        "REFRESH: CRefreshHandler::NotifyRefreshClientsCancel exit" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/RefreshCmd/src/std.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 functions
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    <implementationproxy.h>
+#include    "CRefreshHandler.h"
+
+// CONSTANTS
+
+const TImplementationProxy implementationTable[] =
+    {
+    //lint -e{611,1924} Warning "Suspicious cast" can not be avoided.
+    IMPLEMENTATION_PROXY_ENTRY( 0x10202991, CRefreshHandler::NewL )
+    };
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy ECOM framework factory function
+// Calculates the number of implementations.
+// Returns: Implementation proxy.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount ) // Number of implementations
+    {
+    aTableCount =
+        sizeof( implementationTable ) /
+        sizeof( TImplementationProxy );
+    return implementationTable;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/RefreshRequiredCmd/group/RefreshRequiredCmd.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* 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:  Project definition file for project RefreshRequired plug-in
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../../inc/SatMacroes.h"
+
+TARGET                  RefreshRequiredCmd.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D 0x102078D9
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  std.cpp
+SOURCE                  CRefreshRequiredHandler.cpp
+
+START RESOURCE          102078D9.rss
+TARGET                  RefreshRequiredCmd.rsc
+END
+
+USERINCLUDE             ../../../inc
+USERINCLUDE             ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+SYSTEMINCLUDE           ../../../../../inc      // Domain telephony
+SYSTEMINCLUDE           ../../../../inc         // Subsystem satengine
+
+LIBRARY                 euser.lib
+LIBRARY                 etelsat.lib
+LIBRARY                 SatEngine.lib
+
+#ifdef ENABLE_SAT_LOGGING
+LIBRARY                 flogger.lib
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/RefreshRequiredCmd/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project RefreshRequiredCmd plug-in
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+RefreshRequiredCmd.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/RefreshRequiredCmd/inc/CRefreshRequiredHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,194 @@
+/*
+* 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:  RefreshRequired command handler
+*
+*/
+
+
+
+#ifndef CREFRESHREQUIREDHANDLER_H
+#define CREFRESHREQUIREDHANDLER_H
+
+//  INCLUDES
+#include <etelsat.h>
+#include "SatSTypes.h"
+#include "CSatCommandHandler.h"
+
+// FORWARD DECLARATION
+class MSatUtils;
+
+// CLASS DECLARATION
+
+/**
+*  Command handler for RefreshRequired command.
+*
+*  @lib RefreshRequiredCmd.lib
+*  @since Series 60 3.0
+*/
+class CRefreshRequiredHandler : public CSatCommandHandler
+    {
+    public:     // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aUtils SAT Utils interface
+        */
+        static CRefreshRequiredHandler* NewL( MSatUtils* aUtils );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CRefreshRequiredHandler();
+
+    public:     // Functions from base classes
+
+        /**
+        * From MSatEventObserver. Overrides the default implementation.
+        * @param aEvent An event that is occured.
+        */
+        void Event( TInt aEvent );
+
+        /**
+        * From MSatCommand.
+        */
+        void ClientResponse();
+
+    protected:  // Functions from base classes
+
+        /**
+        * From CActive Cancels the usat request.
+        */
+        void DoCancel();
+
+        /**
+        * From CCommandHandler Requests the command notification.
+        * @param aStatus Request status
+        */
+        void IssueUSATRequest( TRequestStatus& aStatus );
+
+        /**
+        * From CSatCommandHandler Precheck before executing the command.
+        * @return TBool indicating command is currently allowed.
+        */
+        TBool CommandAllowed();
+
+        /**
+        * From CSatCommandHandler Need for ui session.
+        * @return TBool indicating need of ui session.
+        */
+        TBool NeedUiSession();
+
+        /**
+        * From CSatCommandHandler Called when USAT API notifies that command.
+        */
+        void HandleCommand();
+
+        /**
+        * From CSatCommandHandler. Indicates the failure of launching ui client.
+        */
+        void UiLaunchFailed();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CRefreshRequiredHandler();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private:    // New functions
+
+        /**
+        * Checks whether EFimsi file change conditions prevent refresh.
+        * @return TBool indicating EFimsi file refresh allowed.
+        */
+        TBool EFIMSIRefreshAllowed() const;
+
+        /**
+        * Checks whether phone state prevents refresh.
+        * @return TBool indicating refresh allowed.
+        */
+        TBool BusyNotAllowed();
+
+        /**
+        * Asks permission to make refresh from clients.
+        * @return TBool indicating refresh can be started immediately.
+        */
+        TBool QueryRefreshClients();
+
+        /**
+        * Refresh observers call this to indicate refresh allow.
+        * Starts the refresh when all clients has agreed.
+        * @param aAllow Indicates allowness of this client.
+        */
+        void AllowRefresh( TBool aAllow );
+
+        /**
+        * Start refresh.
+        */
+        void DoRefresh();
+
+        /**
+        * Notifies the refresh clients about refresh cancel.
+        */
+        void NotifyRefreshClientsCancel();
+
+        /**
+        * Sends the RefreshRequired specific response to the SIM and renews
+        * the sat request. Note, this replaces TerminalRsp() here.
+        * @param aRsp RefreshRequired response data package.
+        */
+        void RefreshAllowed( const TDesC8& aRsp );
+        
+    private:    // Data
+
+        // Refresh command data.
+        RSat::TRefreshV2 iRefreshRequiredData;
+
+        // Refresh command package.
+        RSat::TRefreshV2Pckg iRefreshRequiredPckg;
+
+        // Response from client.
+        RSat::TRefreshRspV1 iRefreshRequiredRsp;
+
+        // Response package.
+        RSat::TRefreshRspV1Pckg iRefreshRequiredRspPckg;
+
+        // Query command data.
+        TSatQueryV1 iQueryData;
+
+        // Query package.
+        TSatQueryV1Pckg iQueryPckg;
+
+        // Query response.
+        TSatQueryRspV1 iQueryRsp;
+
+        // Query response package.
+        TSatQueryRspV1Pckg iQueryRspPckg;
+
+        // Count of refresh clients queried refresh allow but not yet answered.
+        TInt iRefreshQueryClientCount;
+
+        // Response of refresh query.
+        TBool iAllowRefresh;
+        
+    };
+
+#endif      // CREFRESHREQUIREDHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/RefreshRequiredCmd/inc/RefreshRequiredCmd.rls	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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 headers for project RefreshRequiredCmd
+*
+*/
+
+
+#ifndef REFRESHREQUIREDCMD_RLS
+#define REFRESHREQUIREDCMD_RLS
+
+rls_string STRING_r_refreshrequiredcmd_display_name "RefreshRequired command"
+rls_string STRING_r_refreshrequiredcmd_default_data "RefreshRequiredCmd"
+rls_string STRING_r_refreshrequiredcmd_opaque_data  ""
+
+#endif // REFRESHREQUIREDCMD_RLS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/RefreshRequiredCmd/src/102078D9.rss	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 1020 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Registry information for ECOM
+*
+*/
+
+
+
+//  INCLUDES
+#include <registryinfo.rh>
+#include "RefreshRequiredCmd.rls"
+
+//  RESOURCE DEFINITIONS
+// -----------------------------------------------------------------------------
+//
+// RefreshRequiredCmdInfo
+// Registeration information for ECOM
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO RefreshRequiredCmdInfo
+    {
+    dll_uid = 0x102078D9;
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x1000f001;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x102078DA;
+                    version_no   = 1;
+                    display_name = STRING_r_refreshrequiredcmd_display_name;
+                    default_data = STRING_r_refreshrequiredcmd_default_data;
+                    opaque_data  = STRING_r_refreshrequiredcmd_opaque_data;
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/RefreshRequiredCmd/src/CRefreshRequiredHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,729 @@
+/*
+* 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:  Handles RefreshRequired command
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <msatrefreshobserver.h>
+#include    "MSatSSimSubscriberId.h"
+#include    "MSatSystemState.h"
+#include    "MSatEventMonitorContainer.h"
+#include    "MSatSUiClientHandler.h"
+#include    "CRefreshRequiredHandler.h"
+#include    "MSatApi.h"
+#include    "MSatUtils.h"
+#include    "MSatBIPUtils.h"
+#include    "MSatUiSession.h"
+#include    "SatSOpcodes.h"
+#include    "MSatRefreshSubSession.h"
+#include    "SatLog.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CRefreshRequiredHandler::CRefreshRequiredHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+//lint -e{1403, 1769} Can not be initialized, harmless.
+CRefreshRequiredHandler::CRefreshRequiredHandler() :
+    CSatCommandHandler(),
+    iRefreshRequiredData(),
+    iRefreshRequiredPckg( iRefreshRequiredData ),
+    iRefreshRequiredRsp(),
+    iRefreshRequiredRspPckg( iRefreshRequiredRsp ),
+    iQueryData(),
+    iQueryPckg( iQueryData ),
+    iQueryRsp(),
+    iQueryRspPckg( iQueryRsp ),
+    iRefreshQueryClientCount( 0 ),
+    iAllowRefresh( ETrue )
+    {
+    LOG( SIMPLE, "REFRESHREQ: \
+        CRefreshRequiredHandler::CRefreshRequiredHandler calling - exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CRefreshRequiredHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CRefreshRequiredHandler::ConstructL()
+    {
+    LOG( SIMPLE, "REFRESHREQ: CRefreshRequiredHandler::ConstructL calling" )
+
+    // Register events to be listen.
+    iUtils->RegisterL( this, MSatUtils::ERefreshAllowed );
+    iUtils->RegisterL( this, MSatUtils::ERefreshNotAllowed );
+
+    LOG( SIMPLE, "REFRESHREQ: CRefreshRequiredHandler::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CRefreshRequiredHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CRefreshRequiredHandler* CRefreshRequiredHandler::NewL( MSatUtils* aUtils )
+    {
+    LOG( SIMPLE, "REFRESHREQ: CRefreshRequiredHandler::NewL calling" )
+
+    CRefreshRequiredHandler* self = new( ELeave ) CRefreshRequiredHandler;
+
+    CleanupStack::PushL( self );
+    self->BaseConstructL( aUtils );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "REFRESHREQ: CRefreshRequiredHandler::NewL exiting" )
+    return self;
+    }
+
+
+// Destructor
+CRefreshRequiredHandler::~CRefreshRequiredHandler()
+    {
+    LOG( SIMPLE, "REFRESHREQ: \
+        CRefreshRequiredHandler::~CRefreshRequiredHandler calling" )
+
+    Cancel();
+
+    LOG( SIMPLE, "REFRESHREQ: \
+        CRefreshRequiredHandler::~CRefreshRequiredHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CRefreshRequiredHandler::Event
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CRefreshRequiredHandler::Event( TInt aEvent )
+    {
+    LOG( SIMPLE, "REFRESHREQ: CRefreshRequiredHandler::Event calling" )
+
+    switch ( aEvent )
+        {
+        case MSatUtils::ERefreshAllowed:
+            {
+            LOG( NORMAL, "REFRESHREQ:   Event: ERefreshAllowed" )
+            AllowRefresh( ETrue );
+            break;
+            }
+
+        case MSatUtils::ERefreshNotAllowed:
+            {
+            LOG( NORMAL, "REFRESHREQ:   Event: ERefreshNotAllowed" )
+            AllowRefresh( EFalse );
+            break;
+            }
+
+        default:
+            {
+            LOG2( NORMAL, "REFRESHREQ:   Event: %i", aEvent )
+            CSatCommandHandler::Event( aEvent );
+            break;
+            }
+        }
+
+    LOG( SIMPLE, "REFRESHREQ: CRefreshRequiredHandler::Event exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CRefreshRequiredHandler::ClientResponse
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CRefreshRequiredHandler::ClientResponse()
+    {
+    LOG( SIMPLE, "REFRESHREQ: CRefreshRequiredHandler::ClientResponse calling" )
+    TBool commandAllowed( ETrue );
+
+    // Check ui client response for accepting refresh.
+    if ( iQueryRsp.iAccepted )
+        {
+        LOG( SIMPLE, "REFRESHREQ: CRefreshRequiredHandler::ClientResponse \
+             accept refresh" )
+        // Check phone state again, whether refresh is still allowed,
+        if ( BusyNotAllowed() )
+            {
+            LOG( SIMPLE, "REFRESHREQ: CRefreshRequiredHandler::ClientResponse \
+            BusyNotAllowed" )
+            // Refresh not allowed due phone is busy.
+            iRefreshRequiredRsp.iAdditionalInfo.SetLength( 1 );
+            iRefreshRequiredRsp.iAdditionalInfo[0] = RSat::KMeBusyOnCall;
+            commandAllowed = EFalse;
+            }
+        }
+    // Client did not accept refresh.
+    else
+        {
+        // Refresh is prevented by the user
+        iRefreshRequiredRsp.iAdditionalInfo.SetLength( 1 );
+        iRefreshRequiredRsp.iAdditionalInfo[0] = RSat::KScreenBusy;
+        commandAllowed = EFalse;
+
+        if ( iQueryRsp.iSessionTerminatedByUser )
+            {
+            LOG( SIMPLE, "REFRESHREQ:   close the ui session" )
+            // Next SimSession end will close the ui session
+            iUtils->NotifyEvent( MSatUtils::ESessionTerminatedByUser );
+            }
+        LOG( SIMPLE, "REFRESHREQ:   User did not accept refresh" )
+        }
+
+    if ( commandAllowed )
+        {
+        LOG( SIMPLE, "REFRESHREQ:   commandAllowed" )
+        // Refresh allowed.
+        iRefreshRequiredRsp.iInfoType = RSat::KNoAdditionalInfo;
+        iRefreshRequiredRsp.iGeneralResult = RSat::KSuccess;
+
+        if ( RSat::ESimReset == iRefreshRequiredData.iType )
+            {
+            LOG( SIMPLE, "REFRESHREQ:   ESimReset" )
+            iUtils->NotifyEvent( MSatUtils::ESimResetCalled );
+            }
+        }
+    else
+        {
+        // Notify clients already allowed Refresh about cancel.
+        NotifyRefreshClientsCancel();
+
+        // Refresh not allowed.
+        iRefreshRequiredRsp.iInfoType = RSat::KMeProblem;
+        iRefreshRequiredRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+        }
+
+    // Send the response
+    iRefreshRequiredRsp.SetPCmdNumber( iRefreshRequiredData.PCmdNumber() );
+    RefreshAllowed( iRefreshRequiredRspPckg );
+
+    LOG( SIMPLE, "REFRESHREQ: CRefreshRequiredHandler::ClientResponse exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CRefreshRequiredHandler::DoCancel
+// Cancels the sat request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CRefreshRequiredHandler::DoCancel()
+    {
+    LOG( SIMPLE, "REFRESHREQ: CRefreshRequiredHandler::DoCancel calling" )
+
+    iUtils->USatAPI().NotifyRefreshRequiredCancel();
+
+    LOG( SIMPLE, "REFRESHREQ: CRefreshRequiredHandler::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CRefreshRequiredHandler::IssueUSATRequest
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CRefreshRequiredHandler::IssueUSATRequest( TRequestStatus& aStatus )
+    {
+    LOG( SIMPLE,
+        "REFRESHREQ: CRefreshRequiredHandler::IssueUSATRequest calling" )
+
+    // Clear the IPC package.
+    new (&iRefreshRequiredData) RSat::TRefreshV2();
+    iQueryRsp.iAccepted = EFalse; // default
+
+    iUtils->USatAPI().NotifyRefreshRequired( aStatus, iRefreshRequiredPckg );
+
+    LOG( SIMPLE,
+        "REFRESHREQ: CRefreshRequiredHandler::IssueUSATRequest exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CRefreshRequiredHandler::CommandAllowed
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CRefreshRequiredHandler::CommandAllowed()
+    {
+    LOG( SIMPLE, "REFRESHREQ: CRefreshRequiredHandler::CommandAllowed calling" )
+    TBool commandAllowed( ETrue );
+
+    #ifdef ENABLE_SAT_LOGGING
+
+    // Log Refresh type.
+    switch ( iRefreshRequiredData.iType )
+        {
+        case RSat::ERefreshTypeNotSet:
+            {
+            LOG( NORMAL,
+                "REFRESHREQ:   Refresh type: ERefreshTypeNotSet" )
+            break;
+            }
+
+        case RSat::ESimInitFullFileChangeNotification:
+            {
+            LOG( NORMAL,
+                "REFRESHREQ:   Refresh type: ESimInitFullFileChangeNotificat." )
+            break;
+            }
+
+        case RSat::EFileChangeNotification:
+            {
+            LOG( NORMAL,
+                "REFRESHREQ:   Refresh type: EFileChangeNotification" )
+            break;
+            }
+
+        case RSat::ESimInitFileChangeNotification:
+            {
+            LOG( NORMAL,
+                "REFRESHREQ:   Refresh type: ESimInitFileChangeNotification" )
+            break;
+            }
+
+        case RSat::ESimInit:
+            {
+            LOG( NORMAL,
+                "REFRESHREQ:   Refresh type: ESimInit" )
+            break;
+            }
+
+        case RSat::ESimReset:
+            {
+            LOG( NORMAL,
+                "REFRESHREQ:   Refresh type: ESimReset" )
+            break;
+            }
+
+        case RSat::EUsimApplicationReset:
+            {
+            LOG( NORMAL,
+                "REFRESHREQ:   Refresh type: EUsimApplicationReset" )
+            break;
+            }
+
+        case RSat::E3GSessionReset:
+            {
+            LOG( NORMAL,
+                "REFRESHREQ:   Refresh type: E3GSessionReset" )
+            break;
+            }
+
+        default:
+            {
+            LOG2( NORMAL,
+                "REFRESHREQ:   Refresh type: unknown %d",
+                iRefreshRequiredData.iType )
+            break;
+            }
+        }
+
+    // Log the file list.
+    TInt fileCount ( iRefreshRequiredData.iFileList.Length() );
+    LOG2( NORMAL, "REFRESHREQ:   Refresh file count: %d", fileCount )
+    for ( TInt fileIndex = 0; fileIndex < fileCount; fileIndex++ )
+        {
+        LOG2( NORMAL, "REFRESHREQ:     Refresh file: %x",
+            iRefreshRequiredData.iFileList[ fileIndex ] )
+        }
+
+    #endif
+
+    // Check EFimsi file refresh type.
+    if ( !EFIMSIRefreshAllowed() )
+        {
+        LOG( NORMAL, "REFRESHREQ:   EFIMSIRefreshAllowed false" )
+        // Refresh not allowed
+        iRefreshRequiredRsp.iGeneralResult = RSat::KCmdDataNotUnderstood;
+        iRefreshRequiredRsp.iInfoType = RSat::KNoAdditionalInfo;
+        commandAllowed = EFalse;
+        }
+    // Check phone state.
+    else if ( BusyNotAllowed() )
+        {
+        LOG( NORMAL, "REFRESHREQ:   BusyNotAllowed true" )
+        // Refresh not allowed
+        iRefreshRequiredRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+        iRefreshRequiredRsp.iInfoType = RSat::KMeProblem;
+        iRefreshRequiredRsp.iAdditionalInfo.SetLength( 1 );
+        iRefreshRequiredRsp.iAdditionalInfo[0] = RSat::KMeBusyOnCall;
+        commandAllowed = EFalse;
+        }
+
+    // When refresh is not allowed, send terminal response to sim.
+    if ( !commandAllowed )
+        {
+        LOG( NORMAL, "REFRESHREQ:   Refresh not allowed" )
+        iRefreshRequiredRsp.SetPCmdNumber( iRefreshRequiredData.PCmdNumber() );
+
+        // Send the response
+        RefreshAllowed( iRefreshRequiredRspPckg );
+        }
+
+    LOG2( SIMPLE, "REFRESHREQ: CRefreshRequiredHandler::CommandAllowed \
+          exiting, commandAllowed: %d", commandAllowed )
+    return commandAllowed;
+    }
+
+// -----------------------------------------------------------------------------
+// CRefreshRequiredHandler::NeedUiSession
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CRefreshRequiredHandler::NeedUiSession()
+    {
+    LOG( NORMAL, "REFRESHREQ: CRefreshRequiredHandler::NeedUiSession calling" )
+    TBool needUiSession( EFalse );
+
+    if ( RSat::ESimReset == iRefreshRequiredData.iType
+            && iUtils->SystemState().IsConfirmSatOperationsOn() )
+        {
+        LOG( NORMAL, "REFRESHREQ:   Need ui session" )
+        needUiSession = ETrue;
+        }
+
+    // Notify Cover UI if it's supported
+    if ( needUiSession && iUtils->CoverUiSupported() )
+        {
+        LOG( NORMAL, "REFRESHREQ:   CoverUiSupported" )
+        TSatCommandData medEventData;
+        medEventData.iPCmdNumber = RSat::ERefresh;
+
+        //Doesn't have alpha id
+        medEventData.iAlphaId.iStatus = RSat::EAlphaIdNotSet;
+        medEventData.iDuration.iNumOfUnits = KSatSustainedDuration;
+        medEventData.iDuration.iTimeUnit = RSat::ESeconds;
+        medEventData.iIconID.iQualifier = RSat::ENoIconId;
+
+        TSatCommandPckg tPckg( medEventData );
+        iUtils->RaiseSatEvent( tPckg );
+        }
+
+    LOG2( NORMAL, "REFRESHREQ: CRefreshRequiredHandler::NeedUiSession exiting\
+          needUiSession: %d", needUiSession )
+    return needUiSession;
+    }
+
+// -----------------------------------------------------------------------------
+// CRefreshRequiredHandler::HandleCommand
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CRefreshRequiredHandler::HandleCommand()
+    {
+    LOG( SIMPLE, "REFRESHREQ: CRefreshRequiredHandler::HandleCommand calling" )
+
+    // Ask permission from clients.
+    if ( QueryRefreshClients() )
+        {
+        LOG( SIMPLE, "REFRESHREQ: CRefreshRequiredHandler::HandleCommand \
+             refresh" )
+        DoRefresh();
+        }
+
+    LOG( SIMPLE, "REFRESHREQ: CRefreshRequiredHandler::HandleCommand exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CRefreshRequiredHandler::UiLaunchFailed
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CRefreshRequiredHandler::UiLaunchFailed()
+    {
+    LOG( SIMPLE, "REFRESHREQ: CRefreshRequiredHandler::UiLaunchFailed calling" )
+
+    iRefreshRequiredRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+    iRefreshRequiredRsp.iInfoType = RSat::KNoAdditionalInfo;
+    iRefreshRequiredRsp.SetPCmdNumber( iRefreshRequiredData.PCmdNumber() );
+
+    // Send the response
+    RefreshAllowed( iRefreshRequiredRspPckg );
+
+    LOG( SIMPLE, "REFRESHREQ: CRefreshRequiredHandler::UiLaunchFailed exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CRefreshRequiredHandler::EFIMSIRefreshAllowed
+// If an EFimsi file change occurs under certain conditions a refresh is not
+// allowed.
+// -----------------------------------------------------------------------------
+//
+TBool CRefreshRequiredHandler::EFIMSIRefreshAllowed() const
+    {
+    LOG( SIMPLE,
+        "REFRESHREQ: CRefreshRequiredHandler::EFIMSIRefreshAllowed calling" )
+    TBool refreshAllowed( ETrue );
+
+    // If changed file is EFimsi and the refresh type is any of the ones
+    // specifed below, no refresh will take place as the behaviour of the UE
+    // is unpredicatable.
+    if ( RSat::EFileChangeNotification == iRefreshRequiredData.iType )
+        {
+        LOG( SIMPLE,
+        "REFRESHREQ: CRefreshRequiredHandler::EFIMSIRefreshAllowed \
+        EFileChangeNotification" )
+        const TChar efImsi( RSat::KImsiEf );
+        const TInt imsi( iRefreshRequiredData.iFileList.Locate( efImsi ) );
+
+        // Does the EFimsi file want to be updated.
+        if ( KErrNotFound != imsi )
+            {
+            LOG( SIMPLE, "REFRESHREQ:   EFImsi file refresh not allowed" )
+            refreshAllowed = EFalse;
+            }
+        }
+
+    LOG2( SIMPLE,
+        "REFRESHREQ: CRefreshRequiredHandler::EFIMSIRefreshAllowed exiting,\
+        refreshAllowed: %d", refreshAllowed )
+    return refreshAllowed;
+    }
+
+// -----------------------------------------------------------------------------
+// CRefreshRequiredHandler::BusyNotAllowed
+// Check whether Refresh is allowed.
+// -----------------------------------------------------------------------------
+//
+TBool CRefreshRequiredHandler::BusyNotAllowed()
+    {
+    LOG( SIMPLE, 
+        "REFRESHREQ: CRefreshRequiredHandler::BusyNotAllowed calling" )
+    TBool notAllowed( EFalse );
+
+    // Busy checked only for reset due only it may prevent call.
+    if ( RSat::EFileChangeNotification != iRefreshRequiredData.iType )
+        {
+        LOG( SIMPLE,
+        "REFRESHREQ: CRefreshRequiredHandler::EFIMSIRefreshAllowed \
+        not EFileChangeNotification" )
+        // Refresh is not allowed when call is active or incoming.
+        if ( iUtils->SystemState().IsCallActive() ||
+             iUtils->SystemState().IsCallIncoming() )
+            {
+            notAllowed = ETrue;
+            LOG( NORMAL, "REFRESHREQ:   Refresh not allowed: phone is busy" )
+            }
+        }
+
+    LOG2( SIMPLE, 
+        "REFRESHREQ: CRefreshRequiredHandler::BusyNotAllowed  exiting,\
+        notAllowed: %d", notAllowed )
+    return notAllowed;
+    }
+
+// -----------------------------------------------------------------------------
+// CRefreshRequiredHandler::QueryRefreshClients
+// Notifies the observers that refresh query should start.
+// -----------------------------------------------------------------------------
+//
+TBool CRefreshRequiredHandler::QueryRefreshClients()
+    {
+    LOG( SIMPLE,
+        "REFRESHREQ: CRefreshRequiredHandler::QueryRefreshClients calling" )
+    TBool allowNow( ETrue );
+    TInt clientCount( iUtils->RefreshSubSessions().Count() );
+
+    // By default refresh is allowed after all clients have queried.
+    iAllowRefresh = ETrue;
+
+    // When there are clients, we must ask them first and refresh will be
+    // started later, after all clients have allowed it.
+    // When there are clients, we can just start refresh.
+    if ( 0 != clientCount )
+        {
+        LOG2( NORMAL, "REFRESHREQ:   Client count: %d", clientCount )
+        allowNow = EFalse;
+        iRefreshQueryClientCount = clientCount;
+        for ( TInt i = 0; i < clientCount; i++ )
+            {
+            iUtils->RefreshSubSessions()[i]->QueryClient(
+                iRefreshRequiredData );
+            }
+        }
+
+    LOG2( SIMPLE, 
+        "REFRESHREQ: CRefreshRequiredHandler::QueryRefreshClients exiting,\
+        allowNow: %d", allowNow )
+    return allowNow;
+    }
+
+// -----------------------------------------------------------------------------
+// CRefreshRequiredHandler::AllowRefresh
+// Waits for all the responses of refresh query and
+// starts or declines the refresh.
+// -----------------------------------------------------------------------------
+//
+void CRefreshRequiredHandler::AllowRefresh( TBool aAllow )
+    {
+    LOG( SIMPLE, "REFRESHREQ: CRefreshRequiredHandler::AllowRefresh calling" )
+    LOG2( SIMPLE, "REFRESHREQ: CRefreshRequiredHandler::AllowRefresh \
+          iAllowRefresh: %d", iAllowRefresh )
+    LOG2( SIMPLE, "REFRESHREQ: CRefreshRequiredHandler::AllowRefresh \
+          iRefreshQueryClientCount: %d", iRefreshQueryClientCount )
+    // if iAllowRefresh already false no need to set new value.
+    if ( iAllowRefresh )
+        {
+        iAllowRefresh = aAllow;
+        }
+
+    // Check whether all clients have replied.
+    iRefreshQueryClientCount--;
+    if ( iRefreshQueryClientCount <= 0 )
+        {
+        if ( iAllowRefresh )
+            {
+            DoRefresh();
+            }
+        else
+            {
+            LOG( NORMAL, "REFRESHREQ:   At least one client rejected refresh" )
+            // Notify clients already allowed Refresh about cancel.
+            NotifyRefreshClientsCancel();
+
+            // Construct a proper refresh response data package
+            iRefreshRequiredRsp.iInfoType = RSat::KNoAdditionalInfo;
+            iRefreshRequiredRsp.SetPCmdNumber(
+                iRefreshRequiredData.PCmdNumber() );
+            iRefreshRequiredRsp.iGeneralResult = RSat::KPCmdNotAcceptedByUser;
+
+            // Send the response
+            RefreshAllowed( iRefreshRequiredRspPckg );
+            }
+        }
+
+    LOG( SIMPLE, "REFRESHREQ: CRefreshRequiredHandler::AllowRefresh exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CRefreshRequiredHandler::DoRefresh
+// Starts the refresh
+// -----------------------------------------------------------------------------
+//
+void CRefreshRequiredHandler::DoRefresh()
+    {
+    LOG( SIMPLE, "REFRESHREQ: CRefreshRequiredHandler::DoRefresh calling" )
+
+    if ( RSat::ESimReset == iRefreshRequiredData.iType )
+        {
+        LOG( SIMPLE, "REFRESHREQ: CRefreshRequiredHandler::DoRefresh \
+        ESimReset" )
+        // Register service request handler for RefreshRequired command,
+        // If there is already service request for query, registering
+        // updates command handler, so client responses comes to this
+        // command handler.
+        TRAPD( err, iUtils->RegisterServiceRequestL(
+            ESatSProactiveQuery,
+            ESatSProactiveQueryResponse,
+            this ) );
+
+        if ( KErrNone != err )
+            {
+            iRefreshRequiredRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+            iRefreshRequiredRsp.iInfoType = RSat::KMeProblem;
+            iRefreshRequiredRsp.iAdditionalInfo.SetLength( 1 );
+            iRefreshRequiredRsp.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
+            iRefreshRequiredRsp.SetPCmdNumber(
+                iRefreshRequiredData.PCmdNumber() );
+
+            // Notify clients already allowed Refresh about cancel.
+            NotifyRefreshClientsCancel();
+
+            // Send the response
+            RefreshAllowed( iRefreshRequiredRspPckg );
+            LOG2( SIMPLE, 
+                "REFRESHREQ: CRefreshRequiredHandler::DoRefresh error", err )
+            }
+        else
+            {
+            iUtils->NotifyEvent( MSatUtils::ERefreshExecuting );
+
+            // Ask the user permission to refresh. Reply will come
+            // to ClientResponse method.
+            if ( iUtils->SystemState().IsConfirmSatOperationsOn() )
+                {
+                LOG( SIMPLE, "REFRESHREQ: CRefreshRequiredHandler::DoRefresh \
+                     IsConfirmSatOperationsOn true" )
+                iQueryData.iCommand = ESatSRefreshQuery;
+                iUtils->SatUiHandler().UiSession()->SendCommand(
+                    &iQueryPckg,
+                    &iQueryRspPckg,
+                    ESatSProactiveQuery );
+                }
+            else
+                {
+                LOG( SIMPLE, "REFRESHREQ: CRefreshRequiredHandler::DoRefresh \
+                     IsConfirmSatOperationsOn false" )
+                iQueryRsp.iAccepted = ETrue;
+                ClientResponse();
+                }
+            }
+        }
+    else
+        {
+        LOG( SIMPLE, "REFRESHREQ: CRefreshRequiredHandler::DoRefresh refresh" )
+        // Construct a proper refresh response data package.
+        iRefreshRequiredRsp.iInfoType = RSat::KNoAdditionalInfo;
+        iRefreshRequiredRsp.SetPCmdNumber( iRefreshRequiredData.PCmdNumber() );
+        iRefreshRequiredRsp.iGeneralResult = RSat::KSuccess;
+
+        // Send the response
+        RefreshAllowed( iRefreshRequiredRspPckg );
+        }
+
+    LOG( SIMPLE, "REFRESHREQ: CRefreshRequiredHandler::DoRefresh exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CRefreshHandler::NotifyRefreshClientsCancel
+// Notifies waiting clients about refrsh cancel.
+// -----------------------------------------------------------------------------
+//
+void CRefreshRequiredHandler::NotifyRefreshClientsCancel()
+    {
+    LOG( SIMPLE, 
+        "REFRESHREQ: CRefreshHandler::NotifyRefreshClientsCancel calling" )
+    LOG2( SIMPLE,
+        "REFRESHREQ: CRefreshHandler::NotifyRefreshClientsCancel \
+        RefreshSubSessions().Count: %d",iUtils->RefreshSubSessions().Count() )
+    for ( TInt i = 0; i < iUtils->RefreshSubSessions().Count() ; i++ )
+        {
+        iUtils->RefreshSubSessions()[i]->NotifyClientCancel();
+        }
+
+    LOG( SIMPLE, "REFRESHREQ: CRefreshHandler::NotifyRefreshClientsCancel exit" )
+    }
+
+// -----------------------------------------------------------------------------
+// CRefreshRequiredHandler::RefreshAllowed
+// Sends the RefreshRequired specific response to the SIM and renews the sat
+// request. Notem, this replaces TerminalRsp() here.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CRefreshRequiredHandler::RefreshAllowed( const TDesC8& aRsp )
+    {
+    LOG( SIMPLE, "REFRESHREQ: CRefreshRequiredHandler::RefreshAllowed calling" )
+
+    iUtils->USatAPI().RefreshAllowed( aRsp );
+    iUtils->NotifyEvent( MSatUtils::EDelaySimSessionEnd );
+    Start();
+
+    LOG( SIMPLE, "REFRESHREQ: CRefreshRequiredHandler::RefreshAllowed exiting" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/RefreshRequiredCmd/src/std.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 functions
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    <implementationproxy.h>
+#include    "CRefreshRequiredHandler.h"
+
+// CONSTANTS
+
+const TImplementationProxy implementationTable[] =
+    {
+    //lint -e{611,1924} Warning "Suspicious cast" can not be avoided.
+    IMPLEMENTATION_PROXY_ENTRY( 0x102078DA, CRefreshRequiredHandler::NewL )
+    };
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy ECOM framework factory function
+// Calculates the number of implementations.
+// Returns: Implementation proxy.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount ) // Number of implementations
+    {
+    aTableCount =
+        sizeof( implementationTable ) /
+        sizeof( TImplementationProxy );
+    return implementationTable;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SelectItemCmd/group/Create-UT_CSelectItemHandler-Sis.bat	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,70 @@
+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: This BAT copies Test DLL to local folder and makes SIS file
+rem
+
+@echo off
+echo.
+echo ====================================
+echo.
+echo Digia EUnit - Test
+echo.
+echo This BAT copies Test DLL
+echo to local folder and makes SIS file
+echo.
+echo ====================================
+echo.
+
+:CHECK_EPOCROOT
+echo.
+echo - verify epoc root
+set EPOCROOT
+if errorlevel == 1 goto END_ERROR 
+
+:COPY_DLL
+echo.
+echo - copy test dll to current directory
+copy %EPOCROOT%epoc32\release\thumb\urel\UT_CSelectItemHandler.dll .
+if errorlevel == 1 goto END_ERROR 
+
+:CREATE_DIR
+echo.
+echo - create Sis folder (created only if needed)
+mkdir ..\Sis
+
+:MAKESIS
+echo.
+echo - makesis UT_CSelectItemHandler.pkg ..\sis\UT_CSelectItemHandler.sis
+call makesis UT_CSelectItemHandler.pkg ..\sis\UT_CSelectItemHandler.sis
+if errorlevel == 1 goto END_ERROR
+
+:DELETE_DLL
+echo.
+echo - remove the copied dll from current folder
+del UT_CSelectItemHandler.dll
+goto END
+
+:END_ERROR
+echo.
+echo Sis creation failed. 
+goto FINAL_END
+
+:END
+echo.
+echo Sis file created succesfully
+echo ============================
+
+:FINAL_END
+echo.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SelectItemCmd/group/SelectItemCmd.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* 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:  Project definition file for project SelectItem plug-in
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../../inc/SatMacroes.h"
+
+TARGET                  SelectItemCmd.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D 0x1000F00A
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  std.cpp
+SOURCE                  CSelectItemHandler.cpp
+
+START RESOURCE          1000f00A.rss
+TARGET                  SelectItemCmd.rsc
+END
+
+USERINCLUDE             ../../../inc
+USERINCLUDE             ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+SYSTEMINCLUDE           ../../../../../inc      // Domain telephony
+SYSTEMINCLUDE           ../../../../inc         // Subsystem satengine
+
+LIBRARY                 euser.lib
+LIBRARY                 etelsat.lib
+LIBRARY                 SatEngine.lib
+
+#ifdef ENABLE_SAT_LOGGING
+LIBRARY                 flogger.lib
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SelectItemCmd/group/UT_CSelectItemHandler.pkg	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,37 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: For packing UT_CSelectItemHandler.
+;
+
+; Supported languages
+&en
+
+; Package header (one name for each supported language)
+#{"UT_CSelectItemHandler"},(0x01700000),0,10,0
+
+; Package signature
+
+
+; Options line not supported currently
+
+; Conditions blocks not supported currently
+
+; Language independent files that are always installed
+"UT_CSelectItemHandler.dll"-"!:\DigiaEUnit\Tests\UT_CSelectItemHandler.dll"
+
+; Language dependent files 
+
+
+; Requisites (of type: (UID),Major,Minor,Build-Number,{"Requisite Name1", "Requisite Name2"})
+(0x101F6F88), 0, 0, 0, {"Series60ProductID"}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SelectItemCmd/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 SelectItemCmd plug-in
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+SelectItemCmd.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SelectItemCmd/inc/CSelectItemHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  SelectItem command handler
+*
+*/
+
+
+
+#ifndef CSELECTITEMHANDLER_H
+#define CSELECTITEMHANDLER_H
+
+//  INCLUDES
+#include <etelsat.h>
+#include "CSatCommandHandler.h"
+
+// FORWARD DECLARATION
+class MSatUtils;
+
+// CLASS DECLARATION
+
+/**
+*  Command handler for SelectItem command.
+*
+*  @lib SelectItemCmd.lib
+*  @since Series 60 3.0
+*/
+class CSelectItemHandler : public CSatCommandHandler
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aUtils Utils inteface.
+        */
+        static CSelectItemHandler* NewL( MSatUtils* aUtils );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSelectItemHandler();
+
+    public: // Functions from base classes
+
+        /**
+        * From MSatCommand.
+        */
+        void ClientResponse();
+
+    protected:  // Functions from base classes
+
+        /**
+        * From CActive Cancels the usat request.
+        */
+        void DoCancel();
+
+        /**
+        * From CSatCommandHandler Requests the command notification.
+        * @param aStatus Request status to active object notification
+        */
+        void IssueUSATRequest( TRequestStatus& aStatus );
+
+        /**
+        * From CSatCommandHandler Precheck before executing the command.
+        * @return Boolean indicating is this command allowed to execute.
+        */
+        TBool CommandAllowed();
+
+        /**
+        * From CSatCommandHandler Need for ui session.
+        * @return Boolean indicating does this command need UI session.
+        */
+        TBool NeedUiSession();
+
+        /**
+        * From CSatCommandHandler Called when USAT API.
+        * notifies that command.
+        */
+        void HandleCommand();
+
+        /**
+        * From CSatCommandHandler Indicates the failure
+        * of launching ui client.
+        */
+        void UiLaunchFailed();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CSelectItemHandler();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    protected:    // Data
+
+        // SetUpCall command data.
+        RSat::TSelectItemV2 iSelectItemData;
+
+        // SetUpCall command package.
+        RSat::TSelectItemV2Pckg iSelectItemPckg;
+
+        // Response from client
+        RSat::TSelectItemRspV1 iSelectItemRsp;
+
+        // Response package.
+        RSat::TSelectItemRspV1Pckg iSelectItemRspPckg;
+        
+        // Flag to signal that command has icon data
+        // To be removed when icons are allowed in this command
+        TBool iIconCommand;
+
+    };
+
+#endif      // CSELECTITEMHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SelectItemCmd/inc/SelectItemCmd.rls	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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 headers for project SelectItemCmd
+*
+*/
+
+
+#ifndef SELECTITEMCMD_RLS
+#define SELECTITEMCMD_RLS
+
+rls_string STRING_r_selectitemcmd_display_name "SelectItem command"
+rls_string STRING_r_selectitemcmd_default_data "SelectItemCmd"
+rls_string STRING_r_selectitemcmd_opaque_data  ""
+
+#endif // SELECTITEMCMD_RLS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SelectItemCmd/src/1000f00A.rss	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 1000 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Registry information for ECOM
+*
+*/
+
+
+
+//  INCLUDES
+#include <registryinfo.rh>
+#include "SelectItemCmd.rls"
+
+//  RESOURCE DEFINITIONS
+// -----------------------------------------------------------------------------
+//
+// SelectItemCmdInfo
+// Registeration information for ECOM
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO SelectItemCmdInfo
+    {
+    dll_uid = 0x1000f00A;
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x1000f001;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x1000f00B;
+                    version_no   = 1;
+                    display_name = STRING_r_selectitemcmd_display_name;
+                    default_data = STRING_r_selectitemcmd_default_data;
+                    opaque_data  = STRING_r_selectitemcmd_opaque_data;
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SelectItemCmd/src/CSelectItemHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,319 @@
+/*
+* 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:  Handles SelectItem command
+*
+*/
+
+#include    <etelsat.h>
+#include    "MSatApi.h"
+#include    "MSatUtils.h"
+#include    "MSatUiSession.h"
+#include    "SatSOpcodes.h"
+#include    "MSatSUiClientHandler.h"
+#include    "CSelectItemHandler.h"
+#include    "SatLog.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// CSelectItemHandler::CSelectItemHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSelectItemHandler::CSelectItemHandler() :
+    CSatCommandHandler(),
+    iSelectItemData(),
+    iSelectItemPckg( iSelectItemData ),
+    iSelectItemRsp(),
+    iSelectItemRspPckg( iSelectItemRsp ),
+    // To be removed when icons are allowed in this command
+    iIconCommand( EFalse )
+    {
+    LOG( SIMPLE,
+        "SELECTITEM: CSelectItemHandler::CSelectItemHandler calling - exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSelectItemHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSelectItemHandler::ConstructL()
+    {
+    LOG( SIMPLE, "SELECTITEM: CSelectItemHandler::ConstructL calling" )
+
+    // Register service request handler for SelectItem command.
+    iUtils->RegisterServiceRequestL(
+        ESatSProactiveSelectItem,
+        ESatSProactiveSelectItemResponse,
+        this );
+
+    LOG( SIMPLE, "SELECTITEM: CSelectItemHandler::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSelectItemHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSelectItemHandler* CSelectItemHandler::NewL( MSatUtils* aUtils )
+    {
+    LOG( SIMPLE, "SELECTITEM: CSelectItemHandler::NewL calling" )
+    CSelectItemHandler* self = new( ELeave ) CSelectItemHandler;
+
+    CleanupStack::PushL( self );
+    self->BaseConstructL( aUtils );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "SELECTITEM: CSelectItemHandler::NewL exiting" )
+    return self;
+    }
+
+
+// Destructor
+CSelectItemHandler::~CSelectItemHandler()
+    {
+    LOG( SIMPLE, "SELECTITEM: CSelectItemHandler::~CSelectItemHandler calling" )
+
+    Cancel();
+
+    LOG( SIMPLE, "SELECTITEM: CSelectItemHandler::~CSelectItemHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSelectItemHandler::ClientResponse
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSelectItemHandler::ClientResponse()
+    {
+    LOG( SIMPLE, "SELECTITEM: CSelectItemHandler::ClientResponse calling" )
+
+    //lint -e{961} Only these two cases need to be handeled.
+    if ( RSat::KPSessionTerminatedByUser == iSelectItemRsp.iGeneralResult )
+        {
+        LOG( SIMPLE, "SELECTITEM: CSelectItemHandler::ClientResponse close \
+             ui session" )
+        // Next SimSession end will close the ui session.
+        iUtils->NotifyEvent( MSatUtils::ESessionTerminatedByUser );
+        }
+    // If command had icon data and was done succesfully, report that icon
+    // was not shown
+    // To be removed when icons are allowed in this command
+    else if ( ( RSat::KSuccess == iSelectItemRsp.iGeneralResult ) &&
+        iIconCommand )
+        {
+        LOG( SIMPLE, "SELECTITEM: CSelectItemHandler::ClientResponse \
+             KSuccessRequestedIconNotDisplayed" )
+        iSelectItemRsp.iGeneralResult =
+                    RSat::KSuccessRequestedIconNotDisplayed;
+        }
+
+    CSatCommandHandler::TerminalRsp( RSat::ESelectItem, iSelectItemRspPckg );
+
+    LOG( SIMPLE, "SELECTITEM: CSelectItemHandler::ClientResponse exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSelectItemHandler::DoCancel
+// Cancels the sat request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSelectItemHandler::DoCancel()
+    {
+    LOG( SIMPLE, "SELECTITEM: CSelectItemHandler::DoCancel calling" )
+
+    iUtils->USatAPI().NotifySelectItemCancel();
+
+    LOG( SIMPLE, "SELECTITEM: CSelectItemHandler::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSelectItemHandler::IssueUSATRequest
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSelectItemHandler::IssueUSATRequest( TRequestStatus& aStatus )
+    {
+    LOG( SIMPLE, "SELECTITEM: CSelectItemHandler::IssueUSATRequest calling" )
+
+    // Clear the IPC package.
+    iSelectItemData.Reset();
+    iSelectItemData.iDefaultItemId = 0;
+    iSelectItemData.iIconId.iQualifier = RSat::EIconQualifierNotSet;
+    iSelectItemData.iIconListQualifier = RSat::EIconQualifierNotSet;
+    iSelectItemData.iIconId.iIdentifier = 0;
+
+    iUtils->USatAPI().NotifySelectItem( aStatus, iSelectItemPckg );
+
+    LOG( SIMPLE, "SELECTITEM: CSelectItemHandler::IssueUSATRequest exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSelectItemHandler::CommandAllowed
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CSelectItemHandler::CommandAllowed()
+    {
+    LOG( SIMPLE,
+        "SELECTITEM: CSelectItemHandler::CommandAllowed calling" )
+
+    TBool commandAllowed( ETrue );
+    TBool nullText( EFalse );
+    TInt err ( KErrNone );
+    RSat::TItem item;
+    TUint numberOfItems( iSelectItemData.NumberOfItems() );
+    TBool titleIcon(
+        ( RSat::ENotSelfExplanatory == iSelectItemData.iIconId.iQualifier ) ||
+        ( RSat::ESelfExplanatory == iSelectItemData.iIconId.iQualifier ) );
+    TBool itemIcons(
+        ( RSat::ENotSelfExplanatory == iSelectItemData.iIconListQualifier ) ||
+        ( RSat::ESelfExplanatory == iSelectItemData.iIconListQualifier ) );
+    LOG2( NORMAL, "SELECTITEM: CSelectItemHandler::CommandAllowed \
+          numberOfItems: %d", numberOfItems )
+    // Check if some item does not have text
+    for ( TUint count = 1; ( count <= numberOfItems ) && !nullText &&
+        ( KErrNone == err ); count++ )
+        {
+        err = iSelectItemData.GetItem( count, item );
+
+        if ( ( KErrNone == err ) && ( 0 == item.iItemString.Length() ) )
+            {
+            LOG( SIMPLE,
+            "SELECTITEM: CSelectItemHandler::CommandAllowed null string" )
+            nullText = ETrue;
+            }
+        }
+
+    // If icon is provided without any text
+    if ( ( ( RSat::EAlphaIdProvided != iSelectItemData.iAlphaId.iStatus ) &&
+             titleIcon ) || ( nullText && itemIcons ) )
+        {
+        iSelectItemRsp.iGeneralResult = RSat::KCmdDataNotUnderstood;
+        iSelectItemRsp.iInfoType = RSat::KNoAdditionalInfo;
+        iSelectItemRsp.iAdditionalInfo.Zero();
+        iSelectItemRsp.SetPCmdNumber( iSelectItemData.PCmdNumber() );
+        TerminalRsp( RSat::ESelectItem, iSelectItemRspPckg );
+        commandAllowed = EFalse;
+        LOG( NORMAL, "SELECTITEM: CSelectItemHandler::\
+            CommandAllowed icon received without alpha id" )
+        }
+    // Set icon command flag whether icon data was received and set qualifier
+    // to no icon id
+    // To be removed when icons are allowed in this command
+    else if ( !titleIcon && !itemIcons )
+        {
+        LOG( NORMAL, "SELECTITEM: CSelectItemHandler::\
+            CommandAllowed no icon " )
+        iIconCommand = EFalse;
+        }
+    else
+        {
+        iIconCommand = ETrue;
+
+        if ( titleIcon )
+            {
+            LOG( NORMAL, "SELECTITEM: CSelectItemHandler::\
+            CommandAllowed titleIcon true " )
+            iSelectItemData.iIconId.iQualifier = RSat::ENoIconId;
+            }
+
+        if ( itemIcons )
+            {
+            LOG( NORMAL, "SELECTITEM: CSelectItemHandler::\
+            CommandAllowed itemIcons true " )
+            iSelectItemData.iIconListQualifier = RSat::ENoIconId;
+            }
+        }
+
+    LOG2( SIMPLE,
+        "SELECTITEM: CSelectItemHandler::CommandAllowed exiting,\
+        commandAllowed: %d", commandAllowed )
+    return commandAllowed;
+    }
+
+// -----------------------------------------------------------------------------
+// CSelectItemHandler::NeedUiSession
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CSelectItemHandler::NeedUiSession()
+    {
+    LOG( NORMAL, "SELECTITEM: CSelectItemHandler::NeedUiSession calling" )
+    // Notify Cover UI if it's supported
+    if ( iUtils->CoverUiSupported() )
+        {
+        LOG( NORMAL, "SELECTITEM: CSelectItemHandler::NeedUiSession \
+             CoverUiSupported" )
+        TSatCommandData medEventData;
+        medEventData.iPCmdNumber = RSat::ESelectItem;
+        medEventData.iAlphaId =  iSelectItemData.iAlphaId;
+        medEventData.iDuration.iNumOfUnits = KSatDefaultDuration;
+        medEventData.iDuration.iTimeUnit = RSat::ESeconds;
+        medEventData.iIconID = iSelectItemData.iIconId;
+        TSatCommandPckg tPckg( medEventData );
+        iUtils->RaiseSatEvent( tPckg );
+        #ifdef ENABLE_SAT_LOGGING    
+        TBuf<RSat::KAlphaIdMaxSize> logAlphaId;        
+        logAlphaId.Copy( medEventData.iAlphaId.iAlphaId );                
+        LOG2( NORMAL, "SELECTITEM: CSelectItemHandler::NeedUiSession \
+        iAlphaId: %S", &logAlphaId )
+        #endif
+        }
+    LOG( NORMAL, "SELECTITEM: CSelectItemHandler::NeedUiSession exiting" )
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CSelectItemHandler::HandleCommand
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSelectItemHandler::HandleCommand()
+    {
+    LOG( SIMPLE, "SELECTITEM: CSelectItemHandler::HandleCommand calling" )
+
+    iUtils->NotifyEvent( MSatUtils::ESelectItemExecuting );
+
+    MSatUiSession* uiSession = iUtils->SatUiHandler().UiSession();
+    uiSession->SendCommand(
+        &iSelectItemPckg,
+        &iSelectItemRspPckg,
+        ESatSProactiveSelectItem );
+
+    LOG( SIMPLE, "SELECTITEM: CSelectItemHandler::HandleCommand exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSelectItemHandler::UiLaunchFailed
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSelectItemHandler::UiLaunchFailed()
+    {
+    LOG( SIMPLE, "SELECTITEM: CSelectItemHandler::UiLaunchFailed calling" )
+
+    iSelectItemRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+    iSelectItemRsp.iInfoType = RSat::KMeProblem;
+    iSelectItemRsp.iAdditionalInfo.SetLength( 1 );
+    iSelectItemRsp.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
+    iSelectItemRsp.SetPCmdNumber( iSelectItemData.PCmdNumber() );
+    CSatCommandHandler::TerminalRsp( RSat::ESelectItem, iSelectItemRspPckg );
+
+    LOG( SIMPLE, "SELECTITEM: CSelectItemHandler::UiLaunchFailed exiting" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SelectItemCmd/src/std.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 functions
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    <implementationproxy.h>
+#include    "CSelectItemHandler.h"
+
+// CONSTANTS
+
+const TImplementationProxy implementationTable[] =
+    {
+    //lint -e{611,1924} Warning "Suspicious cast" can not be avoided.
+    IMPLEMENTATION_PROXY_ENTRY( 0x1000f00B, CSelectItemHandler::NewL )
+    };
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy ECOM framework factory function
+// Calculates the number of implementations.
+// Returns: Implementation proxy.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount ) // Number of implementations
+    {
+    aTableCount =
+        sizeof( implementationTable ) /
+        sizeof( TImplementationProxy );
+    return implementationTable;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendDataCmd/group/SendDataCmd.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* 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:  Project definition file for project SendData plug-in
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../../inc/SatMacroes.h"
+
+TARGET                  SendDataCmd.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D 0x10205C50
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  std.cpp
+SOURCE                  CSendDataHandler.cpp
+
+START RESOURCE          10205C50.rss
+TARGET                  SendDataCmd.rsc
+END
+
+USERINCLUDE             ../../../inc
+USERINCLUDE             ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+SYSTEMINCLUDE           ../../../../../inc      // Domain telephony
+SYSTEMINCLUDE           ../../../../inc         // Subsystem satengine
+
+LIBRARY                 euser.lib
+LIBRARY                 etelsat.lib
+LIBRARY                 SatEngine.lib
+
+#ifdef ENABLE_SAT_LOGGING
+LIBRARY                 flogger.lib
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendDataCmd/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 SendData plug-in
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+SendDataCmd.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendDataCmd/inc/CSendDataHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,239 @@
+/*
+* 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:  SendData command handler
+*
+*/
+
+
+#ifndef CSENDDATAHANDLER_H
+#define CSENDDATAHANDLER_H
+
+#include <etelsat.h>
+
+#include "MSatSendDataObserver.h"
+#include "CSatCommandHandler.h"
+#include "SatSTypes.h"
+#include "MSatConnectionObserver.h"
+#include "MSatBIPUtils.h"
+#include "MSatEventObserver.h"
+
+class MSatUtils;
+class MSatBIPDataChannel;
+
+/**
+ *  Command handler for SendData command.
+ *
+ *  @lib SendDataCmd.lib
+ *  @since S60 v3.0
+ */
+class CSendDataHandler : public CSatCommandHandler,
+                         public MSatSendDataObserver,
+                         public MSatConnectionObserver
+    {
+
+public:
+
+    static CSendDataHandler* NewL( MSatUtils* aUtils );
+
+    virtual ~CSendDataHandler();
+
+// from base class MSatCommand
+
+    /**
+     * From MSatCommand.
+     * Response from the client
+     *
+     */
+    void ClientResponse();
+    
+// from base class MSatSendDataObserver
+
+    /**
+     * From MSatSendDataObserver
+     * Notification of data has been sent
+     *
+     * @param aError Indicates the status of data sent.
+     * @param aLength Number of bytes sent
+     */
+    void DataSentNotification( const TInt aError,
+                               const TInt aLength );
+
+    /**
+     * From MSatConnectionObserver
+     * Notfication from the connection
+     *
+     * @param aError Indicates the status of connection
+     */
+    void ConnectionNotification( TInt aError );
+
+// from base class CSatCommandHandler
+
+    /**
+     * From CSatCommandHandler
+     * Overrides the default implementation.
+     *
+     * @param aEvent Identifies the event.
+     */
+    void Event( TInt aEvent );
+
+protected:
+
+// from base class CActive
+
+    /**
+     * From CActive
+     * Cancels the usat request.
+     *
+     */
+    void DoCancel();
+
+// from base class CSatCommandHandler
+
+    /**
+     * From CSatCommandHandler
+     * Requests the command notification.
+     *
+     * @param aStatus Request status to active object notification
+     */
+    void IssueUSATRequest( TRequestStatus& aStatus );
+
+    /**
+     * From CSatCommandHandler
+     * Precheck before executing the command.
+     *
+     * @return Boolean indicating is this command allowed to execute.
+     */
+    TBool CommandAllowed();
+
+    /**
+     * From CSatCommandHandler
+     * Need for ui session.
+     *
+     * @return Boolean indicating does this command need UI session.
+     */
+    TBool NeedUiSession();
+
+    /**
+     * From CSatCommandHandler
+     * Called when USAT API notifies that command.
+     *
+     */
+    void HandleCommand();
+
+    /**
+     * From CSatCommandHandler.
+     * Indicates the failure of launching ui client.
+     *
+     */
+    void UiLaunchFailed();
+
+private:
+
+    CSendDataHandler();
+
+    void ConstructL();
+
+    /**
+     * Sends data
+     *
+     */
+    void SendData();
+
+    /**
+     * Completes Terminal response and sends it
+     *
+     * @param aError is error code of reason
+     */
+    void SendTerminalResponse(
+        const TInt aError = MSatBIPUtils::ESatBIPSuccess );
+
+    /**
+     * Sends notification to UI
+     *
+     * @return KErrNone if notification is sent successfully
+     */
+    TInt SendUiNotification();
+
+private: // data
+
+    /**
+     * SendData command data
+     */
+    RSat::TSendDataV2 iSendDataData;
+
+    /**
+     * SendData command package
+     */
+    RSat::TSendDataV2Pckg iSendDataPckg;
+
+    /**
+     * SendData response data
+     */
+    RSat::TSendDataRspV2 iSendDataRspData;
+
+    /**
+     * SendData response package
+     */
+    RSat::TSendDataRspV2Pckg iSendDataRspPckg;
+
+    /**
+     * Data to UI
+     */
+    TSatNotificationV1 iSendDataUiData;
+
+    /**
+     * IPC Package to ui data
+     */
+    TSatNotificationV1Pckg iSendDataUiPckg;
+
+    /**
+     * UI Response
+     */
+    TSatNotificationRspV1 iSendDataUiRsp;
+
+    /**
+     * IPC Package to response
+     */
+    TSatNotificationRspV1Pckg iSendDataUiRspPckg;
+
+    /**
+     * Remaining space in TX buffer
+     */
+    TInt iFreeBuffSize;
+
+    /**
+     * Pointer to DataChannel
+     */
+    MSatBIPDataChannel* iDataChannel;
+
+    /**
+     * Indicates has user cancelled the action
+     */
+    TBool iUserCancelled;
+
+    /**
+     * Indicates does current command need UI or not
+     */
+    TBool iNeedUiSession;
+
+    /**
+     * Flag to signal that command has icon data
+     * To be removed when icons are allowed in this command
+     */
+    TBool iIconCommand;
+
+    };
+
+#endif      // CSENDDATAHANDLER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendDataCmd/inc/SendDataCmd.rls	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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 headers for project SendDataCmd
+*
+*/
+
+
+#ifndef SENDDATACMD_RLS
+#define SENDDATACMD_RLS
+
+rls_string STRING_r_senddatacmd_display_name "SendData command"
+rls_string STRING_r_senddatacmd_default_data "SendDataCmd"
+rls_string STRING_r_senddatacmd_opaque_data  ""
+
+#endif // SENDDATACMD_RLS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendDataCmd/src/10205C50.rss	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 1020 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Registry information for ECOM
+*
+*/
+
+
+
+//  INCLUDES
+#include <registryinfo.rh>
+#include "SendDataCmd.rls"
+
+//  RESOURCE DEFINITIONS
+// -----------------------------------------------------------------------------
+//
+// SendDataCmdInfo
+// Registeration information for ECOM
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO SendDataCmdInfo
+    {
+    dll_uid = 0x10205C50;
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x1000f001;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x10205C51;
+                    version_no   = 1;
+                    display_name = STRING_r_senddatacmd_display_name;
+                    default_data = STRING_r_senddatacmd_default_data;
+                    opaque_data  = STRING_r_senddatacmd_opaque_data;
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendDataCmd/src/CSendDataHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,723 @@
+/*
+* 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 SendData command
+*
+*/
+
+
+#include    <e32std.h>
+#include    <etelmmerr.h>
+#include    "MSatApi.h"
+#include    "MSatUtils.h"
+#include    "MSatSystemState.h"
+#include    "MSatBIPUtils.h"
+#include    "MSatBIPDataChannel.h"
+#include    "MSatApnHandler.h"
+#include    "MSatUiSession.h"
+#include    "SatSOpcodes.h"
+#include    "MSatSUiClientHandler.h"
+#include    "CSendDataHandler.h"
+#include    "SatLog.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSendDataHandler* CSendDataHandler::NewL( MSatUtils* aUtils )
+    {
+    LOG( SIMPLE, "SendData: CSendDataHandler::NewL calling" )
+
+    CSendDataHandler* self = new( ELeave ) CSendDataHandler;
+
+    CleanupStack::PushL( self );
+    self->BaseConstructL( aUtils );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "SendData: CSendDataHandler::NewL exiting" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CSendDataHandler::~CSendDataHandler()
+    {
+    LOG( SIMPLE, "SendData: CSendDataHandler::~CSendDataHandler calling" )
+
+    Cancel();
+
+    iDataChannel = NULL;
+
+    LOG( SIMPLE, "SendData: CSendDataHandler::~CSendDataHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class MSatCommand.
+// Response from the client.
+// -----------------------------------------------------------------------------
+//
+void CSendDataHandler::ClientResponse()
+    {
+    LOG( SIMPLE, "SendData: CSendDataHandler::ClientResponse calling-exiting" )
+    // Don't send terminal response, already sent in HandleCommand
+    }
+
+// -----------------------------------------------------------------------------
+// From class MSatSendDataObserver.
+// Notification of data has been sent.
+// -----------------------------------------------------------------------------
+//
+void CSendDataHandler::DataSentNotification(
+    const TInt aError, const TInt aLength )
+    {
+    LOG( SIMPLE, "SendData: CSendDataHandler::DataSentNotification calling" )
+
+    if ( MSatBIPUtils::ESatBIPSuccess != aError )
+        {
+        LOG( SIMPLE, "SendData: CSendDataHandler::DataSentNotification Error" )
+        iSendDataRspData.iGeneralResult = RSat::KBearerIndepProtocolError;
+        }
+    else
+        {
+        iSendDataRspData.iGeneralResult = RSat::KSuccess;
+        iFreeBuffSize = aLength;
+        }
+
+    SendTerminalResponse( aError );
+
+    LOG( SIMPLE, "SendData: CSendDataHandler::DataSentNotification exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class MSatSendDataObserver.
+// Notfication from the connection.
+// -----------------------------------------------------------------------------
+//
+void CSendDataHandler::ConnectionNotification( TInt aError )
+    {
+    LOG2( SIMPLE, "SENDDATA: CSendDataHandler::ConnectionNotification\
+         calling with code %i", aError )
+
+    if ( KErrNone == aError )
+        {
+        // Connection established, send data
+        SendData();
+        }
+    else
+        {
+
+        // Get connection info and remove APN from CommDB, if created during
+        // OpenChannel command
+        TUint32 apnId( iDataChannel->ConnInfo().iCreatedApnId );
+        LOG2( SIMPLE, "SENDDATA: CSendDataHandler::ConnectionNotification \
+        apnId: %i", apnId )
+        if ( apnId > 0 )
+            {
+            TRAP_IGNORE( iUtils->BipUtils().ApnHandler().DeleteApnL( apnId ) )
+            }
+
+        // Connection failed
+        iSendDataRspData.iGeneralResult = RSat::KBearerIndepProtocolError;
+        SendTerminalResponse( MSatBIPUtils::ESatBIPChannelClosed );
+        }
+
+    LOG( SIMPLE, "SENDDATA: CSendDataHandler::ConnectionNotification exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Waits for indication of user wanting to close the BIP session.
+// -----------------------------------------------------------------------------
+//
+void CSendDataHandler::Event( TInt aEvent )
+    {
+    LOG2( SIMPLE, "CSendDataHandler::Event calling, aEvent:%d", aEvent )
+
+    switch ( aEvent )
+        {
+        case MSatUtils::ECommandCancelled:
+        case MSatUtils::ECancelledUsingEndKey:
+            {
+            // Check Channel activation status
+            if ( iUtils->BipUtils().IsContextActive() )
+                {
+                LOG( SIMPLE, "CSendDataHandler::Event IsContextActive" )
+                // Next command is rejected
+                iUserCancelled = ETrue;
+                SendTerminalResponse(); // If command is executing, send.
+                }
+            break;
+            }
+        case MSatUtils::EOpenChannelExecuting:
+            {
+            // New channel, reset user cancel flag.
+            iUserCancelled = EFalse;
+            break;
+            }
+        default:
+            {
+            // Move event to base class
+            CSatCommandHandler::Event( aEvent );
+            }
+        }
+
+    LOG( SIMPLE, "CSendDataHandler::Event exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CActive.
+// Cancels the sat request.
+// -----------------------------------------------------------------------------
+//
+void CSendDataHandler::DoCancel()
+    {
+    LOG( SIMPLE, "SendData: CSendDataHandler::DoCancel calling" )
+
+    iUtils->USatAPI().NotifySendDataCancel();
+
+    LOG( SIMPLE, "SendData: CSendDataHandler::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Requests the command notification.
+// -----------------------------------------------------------------------------
+//
+void CSendDataHandler::IssueUSATRequest( TRequestStatus& aStatus )
+    {
+    LOG( SIMPLE, "SendData: CSendDataHandler::IssueUSATRequest calling" )
+
+    // Empty previously recevied data.
+    new (&iSendDataData) RSat::TSendDataV2();
+
+    iUtils->USatAPI().NotifySendData( aStatus, iSendDataPckg );
+    iUtils->NotifyEvent( MSatUtils::EBipCommandDoneExecuting );
+
+    LOG( SIMPLE, "SendData: CSendDataHandler::IssueUSATRequest exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Precheck before executing the command.
+// -----------------------------------------------------------------------------
+//
+TBool CSendDataHandler::CommandAllowed()
+    {
+    LOG( SIMPLE, "SendData: CSendDataHandler::CommandAllowed calling" )
+
+    TBool commandAllowed( ETrue );
+
+    if ( iUserCancelled )
+        {
+        LOG( SIMPLE, "SendData: CSendDataHandler::CommandAllowed \
+        UserCancelled" )
+        SendTerminalResponse();
+
+        commandAllowed = EFalse;
+        }
+    else
+        {
+        // Proceed with the command
+        const TInt channelId( iSendDataData.iDestination );
+
+        if ( ( RSat::KChannel1 > channelId || RSat::KChannel7 < channelId ) ||
+            // If icon data without alpha id
+            ( ( RSat::EAlphaIdProvided !=
+                iSendDataData.iAlphaId.iStatus ) &&
+            ( ( RSat::ESelfExplanatory ==
+                iSendDataData.iIconId.iQualifier ) ||
+            ( RSat::ENotSelfExplanatory ==
+                iSendDataData.iIconId.iQualifier ) ) ) )
+            {
+            LOG( NORMAL, "SendData: CSendDataHandler::CommandAllowed Unknown \
+                channel identifier or icon without alpha id - Not allowed" )
+            // Create the response IPC package
+            iSendDataRspData.iGeneralResult = RSat::KCmdDataNotUnderstood;
+            iSendDataRspData.iInfoType = RSat::KNoAdditionalInfo;
+            iSendDataRspData.iAdditionalInfo.Zero();
+            commandAllowed = EFalse;
+            }
+        else
+            {
+            RMobilePhone::TMobilePhoneRegistrationStatus registrationStatus(
+                iUtils->SystemState().GetNetworkRegistrationStatus() );
+
+            if ( ( RMobilePhone::ERegisteredOnHomeNetwork !=
+                    registrationStatus ) &&
+                 ( RMobilePhone::ERegisteredRoaming != registrationStatus ) )
+                {
+
+                iSendDataRspData.iInfoType = RSat::KMeProblem;
+                iSendDataRspData.iAdditionalInfo.SetLength( 1 );
+                iSendDataRspData.iAdditionalInfo[0] = RSat::KNoService;
+                iSendDataRspData.iGeneralResult = RSat::KMeUnableToProcessCmd;
+                commandAllowed = EFalse;
+                LOG( NORMAL,
+                    "SendData: CSendDataHandler::CommandAllowed Not allowed" )
+                }
+            // Set icon command flag whether icon data was received and set qualifier
+            // to no icon id
+            // To be removed when icons are allowed in this command
+            else if ( ( RSat::ESelfExplanatory ==
+                iSendDataData.iIconId.iQualifier ) ||
+                ( RSat::ENotSelfExplanatory ==
+                iSendDataData.iIconId.iQualifier ) )
+                {
+                LOG( NORMAL,
+                    "SendData: CSendDataHandler::CommandAllowed ENoIconId" )
+                iIconCommand = ETrue;
+                iSendDataData.iIconId.iQualifier = RSat::ENoIconId;
+                }
+            else
+                {
+                LOG( NORMAL,
+                    "SendData: CSendDataHandler::CommandAllowed others" )
+                iIconCommand = EFalse;
+                }
+            }
+
+        if ( !commandAllowed )
+            {
+            LOG( NORMAL,
+            "SendData: CSendDataHandler::CommandAllowed command not allowed" )
+            iSendDataRspData.SetPCmdNumber( iSendDataData.PCmdNumber() );
+            TerminalRsp( RSat::ESendData, iSendDataRspPckg );
+            }
+        }
+
+    LOG2( SIMPLE, 
+    "SendData: CSendDataHandler::CommandAllowed exiting, commandAllowed: %d", 
+    commandAllowed )
+    return commandAllowed;
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Need for ui session.
+// -----------------------------------------------------------------------------
+//
+TBool CSendDataHandler::NeedUiSession()
+    {
+    LOG( SIMPLE, "SendData: CSendDataHandler::NeedUiSession calling" )
+
+    // UI is NOT needed in case where AlphaID is provided and it is a NULL
+    // If information indication to the user is needed and data is not
+    // stored in Tx Buffer, show it now.
+    iNeedUiSession = ( !( RSat::EAlphaIdNull ==
+                          iSendDataData.iAlphaId.iStatus ) &&
+                       !( RSat::EAlphaIdNotPresent ==
+                          iSendDataData.iAlphaId.iStatus ) &&
+                       !( RSat::EStoreDataInTxBuffer ==
+                          iSendDataData.iMode ) );
+    // Send notification to Mediator client if Cover UI is supported
+    if ( iNeedUiSession && iUtils->CoverUiSupported() )
+        {
+        LOG( SIMPLE, 
+            "SendData: CSendDataHandler::NeedUiSession CoverUiSupported" )
+        TSatCommandData medEventData;
+        medEventData.iPCmdNumber = RSat::ESendData;
+        medEventData.iAlphaId = iSendDataData.iAlphaId;
+        medEventData.iDuration.iNumOfUnits = KSatDefaultDuration;
+        medEventData.iIconID = iSendDataData.iIconId;
+        TSatCommandPckg tPckg( medEventData );
+        iUtils->RaiseSatEvent( tPckg );
+        }
+
+    LOG2( SIMPLE, 
+    "SendData: CSendDataHandler::NeedUiSession exiting,iNeedUiSession: %d",
+    iNeedUiSession )
+    return iNeedUiSession;
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Called when USAT API notifies that command.
+// -----------------------------------------------------------------------------
+//
+void CSendDataHandler::HandleCommand()
+    {
+    LOG( SIMPLE, "SendData: CSendDataHandler::HandleCommand calling" )
+
+    // Notify other's about this command executiuon
+    iUtils->NotifyEvent( MSatUtils::ESendDataExecuting );
+    iUtils->NotifyEvent( MSatUtils::EBipCommandExecuting );
+    TInt uiError( KErrNone );
+
+    if ( iNeedUiSession )
+        {
+        LOG( NORMAL, "SendData: CSendDataHandler::HandleCommand \
+            Sending UI Notification" )
+
+        uiError = SendUiNotification();
+        }
+    LOG2( NORMAL, "SendData: CSendDataHandler::HandleCommand \
+          uiError: %i", uiError )
+    if ( KErrNone == uiError )
+        {
+        iFreeBuffSize = 0;
+        TInt err( MSatBIPUtils::ESatBIPSuccess );
+
+        // Get Data Channel
+        iDataChannel = iUtils->BipUtils().DataChannel(
+            iSendDataData.iDestination, err );
+
+        // Check the SendData mode. If Store, no need for active channel
+        if ( ( iDataChannel ) &&
+             ( RSat::EStoreDataInTxBuffer == iSendDataData.iMode ) )
+            {
+            LOG( NORMAL, "SendData: CSendDataHandler::HandleCommand \
+                 send data" )
+            SendData();
+            }
+        //Check if ch was found and if not active, try to activate
+        else if ( ( iDataChannel ) &&
+                  ( MSatBIPUtils::ESatBIPChannelClosed == err ) )
+            {
+            LOG( NORMAL, "SendData: CSendDataHandler::HandleCommand \
+                Inactive channel found, try to activate" )
+            TRAP( err, iDataChannel->ActivateConnectionL( this ) );
+
+            if ( err != KErrNone )
+                {
+                LOG2( NORMAL, "SendData: CSendDataHandler::HandleCommand \
+                 Channel activation Failed Error %i", err )
+
+                // Get connection info and remove APN from CommDB, if created
+                // during OpenChannel command
+                TUint32 apnId( iDataChannel->ConnInfo().iCreatedApnId );
+                
+                LOG2( NORMAL, "SendData: CSendDataHandler::HandleCommand \
+                apnId: %i", apnId )
+                if ( apnId > 0 )
+                    {
+                    TRAP_IGNORE(
+                        iUtils->BipUtils().ApnHandler().DeleteApnL( apnId ) )
+                    }
+                    
+                if ( ( KErrMMEtelActivationBlockedByCallControlNoText == err ) ||
+                     ( KErrMMEtelActivationBlockedByCallControlWithText == err ) )
+                    {
+                    err = RSat::KActionNotAllowed;
+                    iSendDataRspData.iGeneralResult = 
+                        RSat::KInteractionWithCCPermanentError;
+                    LOG( DETAILED, "  CC on GPRS not allowed" )
+                    }
+                    
+                else
+                    {
+                    err = MSatBIPUtils::ESatBIPChannelClosed;
+                    iSendDataRspData.iGeneralResult =
+                        RSat::KBearerIndepProtocolError;
+                    }
+                    
+                SendTerminalResponse( err );
+                }
+            }
+        // SendImmediate, Only if Active channel exists
+        else if ( MSatBIPUtils::ESatBIPSuccess == err )
+            {
+            LOG( NORMAL, "SendData: CSendDataHandler::HandleCommand \
+                 SendImmediate" )
+            SendData();
+            }
+        // Active channel doesn't exist
+        else
+            {
+            LOG2( NORMAL, "SendData: CSendData::HandleCommand \
+                    Error %i", err )
+            iSendDataRspData.iGeneralResult = RSat::KBearerIndepProtocolError;
+            SendTerminalResponse( err );
+            }
+        }
+
+    LOG( SIMPLE, "SendData: CSendDataHandler::HandleCommand exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Indicates the failure of launching ui client.
+// -----------------------------------------------------------------------------
+//
+void CSendDataHandler::UiLaunchFailed()
+    {
+    LOG( SIMPLE, "SendData: CSendDataHandler::UiLaunchFailed calling" )
+
+    iSendDataRspData.iGeneralResult = RSat::KMeUnableToProcessCmd;
+    iSendDataRspData.iInfoType = RSat::KMeProblem;
+    iSendDataRspData.iAdditionalInfo.SetLength( 1 );
+    iSendDataRspData.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
+    iSendDataRspData.SetPCmdNumber( iSendDataData.PCmdNumber() );
+    TerminalRsp( RSat::ESendData, iSendDataRspPckg );
+
+    LOG( SIMPLE, "SendData: CSendDataHandler::UiLaunchFailed exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+//lint -e{1403, 1769} Can not be initialized.
+CSendDataHandler::CSendDataHandler() :
+    CSatCommandHandler(),
+    iSendDataData(),
+    iSendDataPckg( iSendDataData ),
+    iSendDataRspData(),
+    iSendDataRspPckg( iSendDataRspData ),
+    iSendDataUiData(),
+    iSendDataUiPckg( iSendDataUiData ),
+    iSendDataUiRsp(),
+    iSendDataUiRspPckg( iSendDataUiRsp ),
+    // To be removed when icons are allowed in this command
+    iIconCommand( EFalse )
+    {
+    LOG( SIMPLE,
+        "SendData: CSendDataHandler::CSendDataHandler calling - exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSendDataHandler::ConstructL()
+    {
+    LOG( SIMPLE, "SendData: CSendDataHandler::ConstructL calling" )
+
+     // Register to ui service request
+     iUtils->RegisterServiceRequestL( ESatSProactiveNotification,
+        ESatSProactiveNotificationResponse, this );
+
+    // Register to ui service request
+    // Cancel key event from dialog
+    iUtils->RegisterL( this, MSatUtils::ECommandCancelled );
+
+    // End key from dialog
+    iUtils->RegisterL( this, MSatUtils::ECancelledUsingEndKey );
+
+    // Open channel execution
+    iUtils->RegisterL( this, MSatUtils::EOpenChannelExecuting );
+
+    LOG( SIMPLE, "SendData: CSendDataHandler::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Sends data
+// -----------------------------------------------------------------------------
+//
+void CSendDataHandler::SendData()
+    {
+    LOG( SIMPLE, "SendData: CSendDataHandler::SendData calling" )
+
+    // Indicates the send mode.
+    TBool sendImmediately( RSat::ESendDataImmediately == iSendDataData.iMode );
+    TInt err( MSatBIPUtils::ESatBIPSuccess );
+
+    TRAPD( error, err = iDataChannel->SendDataL(
+        iSendDataData.iChannelData,
+        sendImmediately,
+        iFreeBuffSize,
+        this ) );
+    LOG2( NORMAL, "SendData: CSendDataHandler::SendData error: %i", error )
+
+    // Check were the send data success.
+    if ( ( error != KErrNone ) || ( err != MSatBIPUtils::ESatBIPSuccess ) )
+        {
+        LOG2( NORMAL, "SendData: CSendDataHandler::SendData Error %i", err )
+
+        if ( MSatBIPUtils::ESatBIPServiceError == err )
+            {
+            // Connection suspended
+            iSendDataRspData.iGeneralResult = RSat::KMeUnableToProcessCmd;
+            err = RSat::KNoSpecificMeProblem;
+            }
+        else
+            {
+            iSendDataRspData.iGeneralResult = RSat::KBearerIndepProtocolError;
+            }
+
+        SendTerminalResponse( err );
+        }
+    else if ( !sendImmediately )
+        {
+        // If data is stored, send terminal response, otherwise wait for
+        // notification of data sent.
+        LOG( NORMAL, "SendData: CSendDataHandler::SendData Succeed" )
+        iSendDataRspData.iGeneralResult = RSat::KSuccess;
+        SendTerminalResponse();
+        }
+    else
+        {
+        LOG( NORMAL,
+            "SendData: CSendDataHandler::SendData Waiting send to complete" )
+        }
+
+    LOG( SIMPLE, "SendData: CSendDataHandler::SendData exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Completes Terminal response and sends it
+// -----------------------------------------------------------------------------
+//
+void CSendDataHandler::SendTerminalResponse( const TInt aError )
+    {
+    LOG( SIMPLE, "SendData: CSendDataHandler::SendTerminalResponse calling" )
+
+    if ( iUserCancelled )
+        {
+        LOG( NORMAL, "SENDDATA: CSendDataHandler::SendTerminalResponse \
+            User cancelled the action" )
+        iSendDataRspData.iGeneralResult = RSat::KPSessionTerminatedByUser;
+        iSendDataRspData.iInfoType = RSat::KNoAdditionalInfo;
+        iSendDataRspData.iAdditionalInfo.Zero();
+        }
+    else if ( RSat::KSuccess == iSendDataRspData.iGeneralResult )
+        {
+        LOG( NORMAL, "SENDDATA: CSendDataHandler::SendTerminalResponse \
+            KSuccess" )
+        iSendDataRspData.iInfoType = RSat::KNoAdditionalInfo;
+        iSendDataRspData.iAdditionalInfo.Zero();
+        if ( iFreeBuffSize > KSatBIPMoreThanMaxSize )
+            {
+            LOG( NORMAL, "SENDDATA: CSendDataHandler::SendTerminalResponse \
+            iFreeBuffSize > KSatBIPMoreThanMaxSize" )
+            iSendDataRspData.iChannelDataLength = KSatBIPMoreThanMaxSize;
+            }
+        else
+            {
+            iSendDataRspData.iChannelDataLength =
+                static_cast<TUint8> ( iFreeBuffSize );
+            }
+        // If command had icon data and was done succesfully,
+        // report that icon was not shown.
+        // To be removed and correct handling (i.e. ClientResponse to
+        // notification is received) for general result
+        // KSuccessRequestedIconNotDisplayed must be added when icons
+        // are allowed in this command 
+        if ( iIconCommand )
+            {
+            LOG( NORMAL, "SENDDATA: CSendDataHandler::SendTerminalResponse \
+            iIconCommand true" )
+            iSendDataRspData.iGeneralResult =
+                RSat::KSuccessRequestedIconNotDisplayed;
+            }
+        }
+    else
+        {
+        iSendDataRspData.iInfoType = RSat::KMeProblem;
+        iSendDataRspData.iAdditionalInfo.SetLength( 1 );
+        // Error code from MSatBIPUtils is the same as defined in etelsat.h,
+        // so we can put that error code straigth to additional info
+        iSendDataRspData.iAdditionalInfo[0] = static_cast<TUint8> ( aError );
+        iSendDataRspData.iChannelDataLength = 0;
+        }
+
+    if ( IsCommandExecuting() )
+        {
+        LOG( NORMAL, "SENDDATA: CSendDataHandler::SendTerminalResponse \
+            IsCommandExecuting true" )
+        iSendDataRspData.SetPCmdNumber( iSendDataData.PCmdNumber() );
+
+        // Send terminal response
+        iUtils->NotifyEvent( MSatUtils::EDelaySimSessionEnd );
+        iUtils->USatAPI().TerminalRsp( RSat::ESendData, iSendDataRspPckg );
+        Start();
+        }
+
+    LOG( SIMPLE, "SendData: CSendDataHandler::::SendTerminalResponse exiting" )
+    }
+    
+// -----------------------------------------------------------------------------
+// Sends notification to UI
+// -----------------------------------------------------------------------------
+//
+TInt CSendDataHandler::SendUiNotification()
+    {
+    LOG( NORMAL, "SendData: CSendDataHandler::SendUiNotification calling" )
+
+    // Register to ui service request
+    TRAPD( uiError, iUtils->RegisterServiceRequestL(
+        ESatSProactiveNotification,
+        ESatSProactiveNotificationResponse, this ) );
+    LOG2( NORMAL, "CSendDataHandler::SendUiNotification uiError %i", uiError )
+    // Check UI error
+    if ( KErrNone == uiError )
+        {
+        // Create IPC data to UI
+        iSendDataUiData.iCommand = ESatSSendDataNotify;
+
+        iSendDataUiData.iText = iSendDataData.iAlphaId.iAlphaId;
+        iSendDataUiData.iIconId.iIdentifier =
+            iSendDataData.iIconId.iIdentifier;
+        LOG2( NORMAL, "CSendDataHandler::SendUiNotification \
+              iSendDataData.iIconId.iQualifier: %i",
+              iSendDataData.iIconId.iQualifier )
+        // Define icon qualifier
+        if ( RSat::ENotSelfExplanatory == iSendDataData.iIconId.iQualifier )
+            {
+            iSendDataUiData.iIconId.iIconQualifier = ESatNotSelfExplanatory;
+            }
+        else if ( RSat::ESelfExplanatory == iSendDataData.iIconId.iQualifier )
+            {
+            iSendDataUiData.iIconId.iIconQualifier = ESatSelfExplanatory;
+            }
+        else // Icon qualifier not present
+            {
+            iSendDataUiData.iIconId.iIconQualifier = ESatENoIconId;
+            }
+        LOG2( NORMAL, "CSendDataHandler::SendUiNotification \
+              iSendDataData.iAlphaId.iStatus: %i",
+              iSendDataData.iAlphaId.iStatus )
+        // Define AlphaID status
+        switch ( iSendDataData.iAlphaId.iStatus )
+            {
+            case RSat::EAlphaIdNotPresent:
+                {
+                iSendDataUiData.iAlphaIdStatus = ESatAlphaIdNotProvided;
+                break;
+                }
+
+            case RSat::EAlphaIdProvided:
+                {
+                iSendDataUiData.iAlphaIdStatus = ESatAlphaIdNotNull;
+                break;
+                }
+
+            default:
+                {
+                iSendDataUiData.iAlphaIdStatus = ESatAlphaIdNull;
+                break;
+                }
+            }
+
+        // Send notification to UI
+        MSatUiSession* session = iUtils->SatUiHandler().UiSession();
+        session->SendCommand( &iSendDataUiPckg,
+                              &iSendDataUiRspPckg,
+                              ESatSProactiveNotification );
+        }
+    else
+        {
+        // Send error terminal response
+        iSendDataRspData.iGeneralResult = RSat::KMeUnableToProcessCmd;
+        SendTerminalResponse( RSat::KNoSpecificMeProblem );
+        }
+
+    LOG( NORMAL, "SendData: CSendDataHandler::SendUiNotification exiting" )
+    return uiError;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendDataCmd/src/std.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 functions
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    <implementationproxy.h>
+#include    "CSendDataHandler.h"
+
+// CONSTANTS
+
+const TImplementationProxy implementationTable[] =
+    {
+    //lint -e{611,1924} Warning "Suspicious cast" can not be avoided.
+    IMPLEMENTATION_PROXY_ENTRY( 0x10205C51, CSendDataHandler::NewL )
+    };
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy ECOM framework factory function
+// Calculates the number of implementations.
+// Returns: Implementation proxy.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount ) // Number of implementations
+    {
+    aTableCount =
+        sizeof( implementationTable ) /
+        sizeof( TImplementationProxy );
+    return implementationTable;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendDtmfCmd/group/SendDtmfCmd.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* 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:  Project definition file for project SendDtmf plug-in
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../../inc/SatMacroes.h"
+
+TARGET                  SendDtmfCmd.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D 0x1000A88B
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  std.cpp
+SOURCE                  CSendDtmfHandler.cpp
+SOURCE                  csatdtmfsender.cpp
+
+START RESOURCE          1000A88B.rss
+TARGET                  SendDtmfCmd.rsc
+END
+
+USERINCLUDE             ../../../inc
+USERINCLUDE             ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+SYSTEMINCLUDE           ../../../../../inc      // Domain telephony
+SYSTEMINCLUDE           ../../../../inc         // Subsystem satengine
+
+LIBRARY                 euser.lib
+LIBRARY                 etelsat.lib
+LIBRARY                 SatEngine.lib
+
+#ifdef ENABLE_SAT_LOGGING
+LIBRARY                 flogger.lib
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendDtmfCmd/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 SendDtmfCmd plug-in
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+SendDtmfCmd.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendDtmfCmd/inc/CSendDtmfHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,253 @@
+/*
+* 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:  SendDtmf command handler
+*
+*/
+
+
+#ifndef CSENDDTMFHANDLER_H
+#define CSENDDTMFHANDLER_H
+
+#include <etelsat.h>
+
+#include "CSatCommandHandler.h"
+#include "SatSTypes.h"
+
+class CSatDtmfSender;
+
+/**
+ *  Command handler for SendDtmf command.
+ *
+ *  @lib SendDtmfCmd.lib
+ *  @since S60 v3.0
+ */
+class CSendDtmfHandler : public CSatCommandHandler
+    {
+
+public:
+
+    static CSendDtmfHandler* NewL( MSatUtils* aUtils );
+
+    virtual ~CSendDtmfHandler();
+
+    /**
+     * Gets the result of DTMF sending.
+     *
+     * @since S60 3.2
+     * @param aErrCode result of completed DTMF sending.
+     */
+    void SendDtmfComplete( const TInt aErrCode );
+
+// from base class MSatCommand
+
+    /**
+     * From MSatCommand.
+     * Response from the client
+     *
+     */
+    void ClientResponse();
+
+// from base class CSatCommandHandler
+
+    /**
+     * From CSatCommandHandler
+     * Overrides the default implementation.
+     *
+     * @param aEvent Identifies the event.
+     */
+    void Event( TInt aEvent );
+
+protected:
+
+// from base class CActive
+
+    /**
+     * From CActive
+     * Cancels the usat request.
+     *
+     */
+    void DoCancel();
+
+// from base class CSatCommandHandler
+
+    /**
+     * From CSatCommandHandler
+     * Requests the command notification.
+     *
+     * @param aStatus Request status
+     */
+    void IssueUSATRequest( TRequestStatus& aStatus );
+
+    /**
+     * From CSatCommandHandler
+     * Precheck before executing the command.
+     *
+     * @return TBool indicating command is currently allowed.
+     */
+    TBool CommandAllowed();
+
+    /**
+     * From CSatCommandHandler
+     * Need for ui session.
+     *
+     * @return TBool indicating need of ui session.
+     */
+    TBool NeedUiSession();
+
+    /**
+     * From CSatCommandHandler
+     * Called when USAT API notifies that command.
+     *
+     */
+    void HandleCommand();
+
+    /**
+     * From CSatCommandHandler
+     * Called when UI launch fails
+     *
+     */
+    void UiLaunchFailed();
+
+private:
+
+    CSendDtmfHandler();
+
+    void ConstructL();
+
+    /**
+     * Converts extended BCD string into UCS2 string
+     *
+     * @param aDtmfString destination string, to contain DTMF as UCS2
+     * @return ETrue if DTMF string in iSendDtmfData contains valid DTMF characters only
+     *         (0-9,*,#,pause)
+     */
+    TBool ConvertDtmfStringToUcs2( TDes& aDtmfString );
+
+    /**
+     * converts an extended BCD character according to GSM 11.11 into a UCS2 character
+     *
+     * @param aExtBcd extended BCD character
+     * @param aEndOfString ETrue iff aExtBcd signals end of string
+     * @param aDtmfCharacter ETrue iff aExtBcd represents DTMF character (0-9,*,#,pause)
+     * @param aUcs2Char DTMF character in UCS2 representation - only valid if aDtmfCharacter is true
+     */
+    void ConvertDtmfCharacterToUcs2(
+        const TChar& aExtBcd,
+        TBool& aEndOfString,
+        TBool& aDtmfCharacter,
+        TChar& aUcs2Char ) const;
+
+    /**
+     * Handles the result of DTMF sending and sends terminal response
+     *
+     */
+    void HandleResult();
+
+    /**
+     * Sends terminal response. Makes sure that terminal response
+     * is not send more that once / command.
+     *
+     */
+    void SendTerminalResponse();
+
+private: // data
+
+    /**
+     * SendDtmf command data from SIM.
+     */
+    RSat::TSendDtmfV1 iSendDtmfData;
+
+    /**
+     * SendDtmf command package.
+     */
+    RSat::TSendDtmfV1Pckg iSendDtmfPckg;
+
+    /**
+     * SendDtmf response data from client.
+     */
+    RSat::TSendDtmfRspV1 iSendDtmfRsp;
+
+    /**
+     * SendDtmf response package
+     */
+    RSat::TSendDtmfRspV1Pckg iSendDtmfRspPckg;
+
+// UI notification data
+
+    /**
+     * SendDtmf notification send data
+     */
+    TSatNotificationV1 iNotificationData;
+
+    /**
+     * SendDtmf notification package
+     */
+    TSatNotificationV1Pckg iNotificationDataPckg;
+
+    /**
+     * SendDtmf notification Response data
+     */
+    TSatNotificationRspV1 iNotificationRsp;
+
+    /**
+     * SendDtmf notification Response package
+     */
+    TSatNotificationRspV1Pckg iNotificationRspPckg;
+
+    /**
+     * DTMF handling
+     */
+        CSatDtmfSender* iDtmfSender;
+
+    /**
+     * Result of completed DTMF sending.
+     */
+    TInt iDtmfResult;
+
+    /**
+     * Indicates is terminal response sent
+     */
+    TBool iTerminalRespSent;
+
+    /**
+     * Indicates do we need UI
+     */
+    TBool iNeedUiSession;
+
+    /**
+     * Converted DTMF string container.
+     * Own.
+     */
+    HBufC16* iDtmfStringUcs2;
+
+    /**
+     * Flag to signal that command has icon data
+     * To be removed when icons are allowed in this command
+     */
+    TBool iIconCommand;
+
+    /**
+     * Wait scheduler for fast UI event cases.
+     */
+    CActiveSchedulerWait iWait;
+     
+    /**
+     * Indicates if client response is received.
+     */
+    TBool iClientResponseReceived;
+     
+    };
+
+#endif      // CSENDDTMFHANDLER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendDtmfCmd/inc/SendDtmfCmd.rls	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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 headers for project SendDtmfCmd
+*
+*/
+
+
+#ifndef SENDDTMFCMD_RLS
+#define SENDDTMFCMD_RLS
+
+rls_string STRING_r_senddtmfcmd_display_name "SendDtmf command"
+rls_string STRING_r_senddtmfcmd_default_data "SendDtmfCmd"
+rls_string STRING_r_senddtmfcmd_opaque_data  ""
+
+#endif // SENDDTMFCMD_RLS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendDtmfCmd/inc/csatdtmfsender.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,89 @@
+/*
+* 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:  DTMF sender for SendDtmf command
+*
+*/
+
+
+
+#ifndef CSATDTMFSENDER_H
+#define CSATDTMFSENDER_H
+
+#include <e32base.h>
+
+// CLASS DECLARATION
+class CSendDtmfHandler;
+class MSatMultiModeApi;
+
+/**
+ *  DTMF sender for SendDtmf command.
+ *
+ *  @lib SendDtmfCmd.lib
+ *  @since S60 3.2
+ */
+class CSatDtmfSender : public CActive
+    {
+
+public:  // Constructors and destructor
+
+    /**
+     * C++ default constructor.
+     * @param aDtmfHandler Observes completion of DTMF sending
+     * @param aPhone API for sending DTMF strings.
+     */
+    CSatDtmfSender( CSendDtmfHandler& aDtmfHandler, 
+                    MSatMultiModeApi& aPhone );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CSatDtmfSender();
+
+    /**
+     * Transmit DTMF tones across all the current active voice calls.
+     * @since S60 3.2
+     * @param aTones The string of DTMF characters.
+     */
+    void SendToneString( const TDesC& aTones );
+
+protected:
+
+    /**
+     * From CActive.
+     * Called when request status given SetActiveAndWait completes
+     */
+    void RunL();
+
+    /**
+     * From CActive.
+     * Called when request is cancelled
+     */
+    void DoCancel();
+
+private:    // Data
+
+    /**
+     * Observer of the DTMF sending.
+     */
+    CSendDtmfHandler& iDtmfHandler;
+
+    /**
+     * API used for sending DTMF string to adaptation.
+     */
+    MSatMultiModeApi& iPhone;
+
+    };
+
+#endif      // CSATDTMFSENDER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendDtmfCmd/src/1000A88B.rss	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 1000 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Registry information for ECOM
+*
+*/
+
+
+
+//  INCLUDES
+#include <registryinfo.rh>
+#include "SendDtmfCmd.rls"
+
+//  RESOURCE DEFINITIONS
+// -----------------------------------------------------------------------------
+//
+// SendDtmfCmdInfo
+// Registeration information for ECOM
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO SendDtmfCmdInfo
+    {
+    dll_uid = 0x1000A88B;
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x1000f001;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x10202987;
+                    version_no   = 1;
+                    display_name = STRING_r_senddtmfcmd_display_name;
+                    default_data = STRING_r_senddtmfcmd_default_data;
+                    opaque_data  = STRING_r_senddtmfcmd_opaque_data;
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendDtmfCmd/src/CSendDtmfHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,920 @@
+/*
+* 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:  Handles SendDtmf command
+*
+*/
+
+
+#include    "MSatApi.h"
+#include    "MSatUtils.h"
+#include    "MSatSystemState.h"
+#include    "MSatUiSession.h"
+#include    "SatSOpcodes.h"
+#include    "MSatSUiClientHandler.h"
+#include    "CSendDtmfHandler.h"
+#include    "csatdtmfsender.h"
+#include    "msatmultimodeapi.h"
+#include    "SatLog.h"
+
+const TUint KBcdZero      = 0x00;
+const TUint KBcdOne       = 0x01;
+const TUint KBcdTwo       = 0x02;
+const TUint KBcdThree     = 0x03;
+const TUint KBcdFour      = 0x04;
+const TUint KBcdFive      = 0x05;
+const TUint KBcdSix       = 0x06;
+const TUint KBcdSeven     = 0x07;
+const TUint KBcdEight     = 0x08;
+const TUint KBcdNine      = 0x09;
+const TUint KBcdStar      = 0x0A;
+const TUint KBcdHash      = 0x0B;
+const TUint KBcdPause     = 0x0C;
+const TUint KBcdWild      = 0x0D;
+const TUint KBcdExpansion = 0x0E;
+const TUint KBcdEnd       = 0x0F;
+
+const TUint KUcs2Zero     = 0x30; // '0'
+const TUint KUcs2Star     = 0x2A; // '*'
+const TUint KUcs2Hash     = 0x23; // '#'
+const TUint KUcs2Pause    = 0x70; // 'p'
+
+const TUint KHighNibble   = 0xF0;
+const TUint KLowNibble    = 0x0F;
+const TUint KBitsInNibble = 4;
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSendDtmfHandler* CSendDtmfHandler::NewL( MSatUtils* aUtils )
+    {
+    LOG( SIMPLE, "SENDDTMF: CSendDtmfHandler::NewL calling" )
+
+    CSendDtmfHandler* self = new( ELeave ) CSendDtmfHandler;
+
+    CleanupStack::PushL( self );
+    self->BaseConstructL( aUtils );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "SENDDTMF: CSendDtmfHandler::NewL exiting" )
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CSendDtmfHandler::~CSendDtmfHandler()
+    {
+    LOG( SIMPLE, "SENDDTMF: CSendDtmfHandler::~CSendDtmfHandler calling" )
+
+    Cancel();
+
+    if ( iDtmfSender )
+        {
+        delete iDtmfSender;
+        }
+
+    if ( iDtmfStringUcs2 )
+        {
+        delete iDtmfStringUcs2;
+        iDtmfStringUcs2 = NULL;
+        }
+
+    LOG( SIMPLE, "SENDDTMF: CSendDtmfHandler::~CSendDtmfHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Gets the result of DTMF sending.
+// -----------------------------------------------------------------------------
+//
+void CSendDtmfHandler::SendDtmfComplete( const TInt aErrCode )
+    {
+    LOG( SIMPLE, "SENDDTMF: CSendDtmfHandler::SendDtmfComplete calling" )
+
+    iDtmfResult = aErrCode;
+    // Handles result and sends terminal response.
+    HandleResult();
+
+    LOG( SIMPLE, "SENDDTMF: CSendDtmfHandler::SendDtmfComplete exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class MSatCommand.
+// Response from the client
+// -----------------------------------------------------------------------------
+//
+void CSendDtmfHandler::ClientResponse()
+    {
+    LOG( SIMPLE, "SENDDTMF: CSendDtmfHandler::ClientResponse calling" )
+
+    iClientResponseReceived = ETrue;
+    if( iWait.IsStarted() )
+        {
+        iWait.AsyncStop();
+        }
+
+    LOG( SIMPLE, "SENDDTMF: CSendDtmfHandler::ClientResponse exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Waits for indication of user rejection
+// -----------------------------------------------------------------------------
+//
+void CSendDtmfHandler::Event( TInt aEvent )
+    {
+    LOG2( SIMPLE,
+        "SENDTMF: CSendDtmfHandler::Event calling, aEvent:%d", aEvent )
+
+    switch ( aEvent )
+        {
+        case MSatUtils::ECommandCancelled:
+            {
+            // Cancel DTMF sending
+            if ( iDtmfSender )
+                {
+                LOG( SIMPLE, 
+                "SENDTMF: CSendDtmfHandler::Event Cancel DTMF sending" )
+                iDtmfSender->Cancel();
+                }
+
+            // Cancel key pressed. Send terminal response.
+            iSendDtmfRsp.iGeneralResult = RSat::KPSessionTerminatedByUser;
+            iSendDtmfRsp.iInfoType = RSat::KNoAdditionalInfo;
+            iSendDtmfRsp.iAdditionalInfo.Zero();
+
+            SendTerminalResponse();
+            break;
+            }
+
+        case MSatUtils::ECancelledUsingEndKey:
+            {
+            // Cancel DTMF sending
+            if ( iDtmfSender )
+                {
+                LOG( SIMPLE, 
+                "CSendDtmfHandler::Event Cancel DTMF sending by endkey" )
+                iDtmfSender->Cancel();
+                }
+
+            // End key pressed. Send terminal response.
+            iSendDtmfRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+            iSendDtmfRsp.iInfoType = RSat::KMeProblem;
+            iSendDtmfRsp.iAdditionalInfo.Zero();
+            iSendDtmfRsp.iAdditionalInfo.Append( RSat::KNotInSpeechCall );
+
+            // Next SimSession end will close the ui session
+            iUtils->NotifyEvent( MSatUtils::ESessionTerminatedByUser );
+            SendTerminalResponse();
+            break;
+            }
+
+        default:
+            {
+            // Move event to base class
+            CSatCommandHandler::Event( aEvent );
+            }
+        }
+
+    LOG( SIMPLE, "SENDTMF: CSendDtmfHandler::Event exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CActive.
+// Cancels the sat request.
+// -----------------------------------------------------------------------------
+//
+void CSendDtmfHandler::DoCancel()
+    {
+    LOG( SIMPLE, "SENDDTMF: CSendDtmfHandler::DoCancel calling" )
+
+    iUtils->USatAPI().NotifySendDtmfCancel();
+
+    LOG( SIMPLE, "SENDDTMF: CSendDtmfHandler::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Requests the command notification.
+// -----------------------------------------------------------------------------
+//
+void CSendDtmfHandler::IssueUSATRequest( TRequestStatus& aStatus )
+    {
+    LOG( SIMPLE, "SENDDTMF: CSendDtmfHandler::IssueUSATRequest calling" )
+
+    // Clear the IPC package.
+    new (&iSendDtmfData) RSat::TSendDtmfV1();
+
+    if ( iDtmfStringUcs2 )
+        {
+        LOG( SIMPLE, 
+        "CSendDtmfHandler::IssueUSATRequest iDtmfStringUcs2 true" )
+        delete iDtmfStringUcs2;
+        iDtmfStringUcs2 = NULL;
+        }
+
+    iUtils->USatAPI().NotifySendDtmf( aStatus, iSendDtmfPckg );
+
+    // Unregister from events
+    iUtils->UnregisterEvent( this, MSatUtils::ECommandCancelled );
+    iUtils->UnregisterEvent( this, MSatUtils::ECancelledUsingEndKey );
+
+    LOG( SIMPLE, "SENDDTMF: CSendDtmfHandler::IssueUSATRequest exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// SendDtmf command is not allowed if there is not active speech call.
+// -----------------------------------------------------------------------------
+//
+TBool CSendDtmfHandler::CommandAllowed()
+    {
+    LOG( SIMPLE, "SENDDTMF: CSendDtmfHandler::CommandAllowed calling" )
+
+    // By default, this is true
+    TBool commandAllowed( ETrue );
+
+    // Allow next terminal response to be sent
+    iTerminalRespSent = EFalse;
+
+    // This is needed every time
+    iSendDtmfRsp.SetPCmdNumber( iSendDtmfData.PCmdNumber() );
+
+    // Call has to be established, otherwise DTMF cannot be sent.
+#ifdef SAT_USE_DUMMY_TSY
+    TInt firstChar( ' ' );
+    if ( iSendDtmfData.iAlphaId.iStatus == RSat::EAlphaIdProvided )
+        {
+        firstChar = iSendDtmfData.iAlphaId.iAlphaId[0];
+        }
+    const TBool callIsOngoing( firstChar != 'T' );
+#else
+    const TBool callIsOngoing( iUtils->SystemState().IsCallActive() );
+#endif
+
+    const TInt dtmfLength( iSendDtmfData.iDtmfString.Length() );
+
+    // DTMF string shall have at least one BCD character.
+    // Otherwise, minimum set of data objects is not complete,
+    // and command has to be rejected with 'Error, required
+    // values are missing'.
+    const TBool dtmfStringHasContent( dtmfLength > 0 );
+
+    // DTMF string shall not be longer than is possible
+    // according to TS 11.14, clause 6.6.24. If the string is
+    // longer than this, the DTMF String data object is not valid,
+    // which means that the minimum set of data objects
+    // is not complete, and the command has to be rejected
+    // with 'Error, required values are missing'.
+    const TBool dtmfStringNotTooLong( dtmfLength <= RSat::KDtmfStringMaxSize );
+
+    // If icon data without alpha id.
+    if ( ( RSat::EAlphaIdProvided != iSendDtmfData.iAlphaId.iStatus ) &&
+        ( ( RSat::ESelfExplanatory == iSendDtmfData.iIconId.iQualifier ) ||
+        ( RSat::ENotSelfExplanatory == iSendDtmfData.iIconId.iQualifier ) ) )
+        {
+        commandAllowed = EFalse;
+        iSendDtmfRsp.iGeneralResult = RSat::KCmdDataNotUnderstood;
+        iSendDtmfRsp.iInfoType = RSat::KNoAdditionalInfo;
+        iSendDtmfRsp.iAdditionalInfo.Zero();
+        LOG( SIMPLE, "SENDDTMF: CSendDtmfHandler::CommandAllowed data not \
+            understood" )
+        }
+    else if ( !( dtmfStringHasContent && callIsOngoing && dtmfStringNotTooLong ) )
+        { // Handle the error cases.
+
+        if ( !dtmfStringHasContent || !dtmfStringNotTooLong )
+            {
+            LOG( SIMPLE,
+                "SENDDTMF: !dtmfStringHasContent || !dtmfStringNotTooLong" )
+            iSendDtmfRsp.iInfoType = RSat::KNoAdditionalInfo;
+            iSendDtmfRsp.iAdditionalInfo.Zero();
+            iSendDtmfRsp.iGeneralResult = RSat::KErrorRequiredValuesMissing;
+            }
+        else // No callIsOngoing
+            {
+            LOG( SIMPLE, "SENDDTMF: !callIsOngoing" )
+            // ME is not in speech call and dtmf string cannot be sent.
+            iSendDtmfRsp.iInfoType = RSat::KMeProblem;
+            iSendDtmfRsp.iAdditionalInfo.Zero();
+            iSendDtmfRsp.iAdditionalInfo.Append( RSat::KNotInSpeechCall );
+            iSendDtmfRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+            }
+        // Command is not allowed
+        commandAllowed = EFalse;
+        }
+    else
+        {
+        // Convert DTMF string. This is done here, so UI is not launched.
+        // for no reason.
+
+        // At the ETel interface level, the DTMF string uses a TBuf where each
+        // buffer character represents two DTMF digits coded as BCD characters.
+        const TUint KDtmfStringETelNumberOfBcdPerBufferCharacter = 2;
+
+        // The DTMF string uses a TBuf where each buffer character represents
+        // one DTMF digit.
+        const TUint KDtmfStringMaxLength =
+            KDtmfStringETelNumberOfBcdPerBufferCharacter *
+                RSat::KDtmfStringMaxSize;
+
+        TRAPD( noMemory, iDtmfStringUcs2 =
+            HBufC16::NewL( KDtmfStringMaxLength ) )
+
+        if ( KErrNone != noMemory )
+            {
+            LOG( SIMPLE, 
+            "SENDDTMF: CSendDtmfHandler::CommandAllowed KErrNone != noMemory" )
+            iSendDtmfRsp.iInfoType = RSat::KNoAdditionalInfo;
+            iSendDtmfRsp.iAdditionalInfo.Zero();
+            iSendDtmfRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+            // Command is not allowed
+            commandAllowed = EFalse;
+            }
+        else
+            {
+
+            TPtr ptr = iDtmfStringUcs2->Des();
+
+            if ( ! ConvertDtmfStringToUcs2( ptr ) )
+                {
+                LOG( SIMPLE, 
+                "CSendDtmfHandler::CommandAllowed not allowed" )
+                // DTMF string contains illegal characters
+                iSendDtmfRsp.iGeneralResult = RSat::KCmdDataNotUnderstood;
+                iSendDtmfRsp.iInfoType = RSat::KNoAdditionalInfo;
+                iSendDtmfRsp.iAdditionalInfo.Zero();
+                // Command is not allowed
+                commandAllowed = EFalse;
+                }
+            }
+        }
+
+    if ( !commandAllowed )
+        {
+        LOG( SIMPLE, 
+        "CSendDtmfHandler::CommandAllowed commandAllowed false" )
+        SendTerminalResponse();
+        }
+    // Set icon command flag whether icon data was received and set qualifier
+    // to no icon id
+    // To be removed when icons are allowed in this command
+    else if ( ( RSat::ESelfExplanatory ==
+        iSendDtmfData.iIconId.iQualifier ) ||
+        ( RSat::ENotSelfExplanatory ==
+        iSendDtmfData.iIconId.iQualifier ) )
+        {
+        LOG( SIMPLE, 
+        "CSendDtmfHandler::CommandAllowed ENoIconId" )
+        iIconCommand = ETrue;
+        iSendDtmfData.iIconId.iQualifier = RSat::ENoIconId;
+        }
+    else
+        {
+        iIconCommand = EFalse;
+        }
+
+    LOG( SIMPLE, "SENDDTMF: CSendDtmfHandler::CommandAllowed exiting" )
+    return commandAllowed;
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Need for ui session.
+// -----------------------------------------------------------------------------
+//
+TBool CSendDtmfHandler::NeedUiSession()
+    {
+    LOG( NORMAL, "SENDDTMF: CSendDtmfHandler::NeedUiSession calling" )
+    iNeedUiSession = ETrue;
+
+    if ( RSat::EAlphaIdNull == iSendDtmfData.iAlphaId.iStatus )
+        {
+        LOG( NORMAL, "SENDDTMF: CSendDtmfHandler::NeedUiSession EAlphaIdNull" )
+        iNeedUiSession = EFalse;
+        }
+
+    // Notify Cover UI if it's supported
+    if ( iNeedUiSession && iUtils->CoverUiSupported() )
+        {
+        LOG( NORMAL, 
+        "SENDDTMF: CSendDtmfHandler::NeedUiSession CoverUiSupported" )
+        TSatCommandData medEventData;
+        medEventData.iPCmdNumber = RSat::ESendDtmf;
+        medEventData.iAlphaId =  iSendDtmfData.iAlphaId;
+        medEventData.iDuration.iNumOfUnits = KSatDefaultDuration;
+        medEventData.iDuration.iTimeUnit = RSat::ESeconds;
+        medEventData.iIconID = iSendDtmfData.iIconId;
+        TSatCommandPckg tPckg( medEventData );
+        iUtils->RaiseSatEvent( tPckg );
+        }
+
+    LOG2( NORMAL, 
+    "SENDDTMF: CSendDtmfHandler::NeedUiSession exiting,iNeedUiSession: %d",
+    iNeedUiSession )
+    return iNeedUiSession;
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Called when USAT API notifies that command.
+// -----------------------------------------------------------------------------
+//
+void CSendDtmfHandler::HandleCommand()
+    {
+    LOG( SIMPLE, "SENDDTMF: CSendDtmfHandler::HandleCommand calling" )
+
+    iUtils->NotifyEvent( MSatUtils::ESendDtmfExecuting );
+
+    // Lower error granularity. This helps for mapping error cases
+    iUtils->MultiModeApi().LowerErrorGranularity();
+
+    // Pointer to converted DTMF string
+    TPtr ptr = iDtmfStringUcs2->Des();
+
+    iClientResponseReceived = EFalse;
+    
+    // First, send DTMF string
+    iDtmfSender->SendToneString( ptr );
+
+    if ( iNeedUiSession )
+        {
+        TRAPD( regErr,
+        // Register to listen user cancel events:
+        // Cancel key event from dialog
+        iUtils->RegisterL( this, MSatUtils::ECommandCancelled );
+        // End key from dialog
+        iUtils->RegisterL( this, MSatUtils::ECancelledUsingEndKey );
+
+        // Then send notification to UI
+        // Register notification observer
+        iUtils->RegisterServiceRequestL(
+            ESatSProactiveNotification,
+            ESatSProactiveNotificationResponse,
+            this )
+            ); // TRAPD
+        LOG2( NORMAL, 
+        "CSendDtmfHandler::HandleCommand regErr: %d", regErr )
+        if ( KErrNone != regErr )
+            {
+            iDtmfSender->Cancel();
+            // Raise error granularity back to extended errors
+            iUtils->MultiModeApi().RaiseErrorGranularity();
+
+            iSendDtmfRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+            iSendDtmfRsp.iInfoType = RSat::KMeProblem;
+            iSendDtmfRsp.iAdditionalInfo.Zero();
+            iSendDtmfRsp.iAdditionalInfo.Append( RSat::KNoSpecificMeProblem );
+            SendTerminalResponse();
+            }
+        else
+            {
+            TSatAlphaIdStatus alphaIdStatus;
+            if ( iSendDtmfData.iAlphaId.iStatus == RSat::EAlphaIdNotPresent )
+                {
+                LOG( SIMPLE, 
+                "SENDDTMF: CSendDtmfHandler::HandleCommand EAlphaIdNotPresent" )
+                // If AlphaID is not provided, show DTMF string in note.
+                // Deliver empty text if DTMF string is bigger than it is
+                // capable to deliver to SAT UI.
+                alphaIdStatus = ESatAlphaIdNotProvided;
+                LOG2( NORMAL, 
+                "SENDDTMF: CSendDtmfHandler::HandleCommand ptr.Length: %d", 
+                ptr.Length() )
+                if ( RSat::KAlphaIdMaxSize >= ptr.Length() )
+                    {
+                    iNotificationData.iText = ptr;
+                    }
+                else
+                    {
+                    iNotificationData.iText.Zero();
+                    }
+                }
+            else if ( iSendDtmfData.iAlphaId.iStatus == RSat::EAlphaIdProvided )
+                {
+                LOG( SIMPLE, 
+                "SENDDTMF: CSendDtmfHandler::HandleCommand EAlphaIdProvided" )
+                alphaIdStatus = ESatAlphaIdNotNull;
+                iNotificationData.iText = iSendDtmfData.iAlphaId.iAlphaId;
+                }
+            else
+                {
+                LOG( SIMPLE, 
+                "SENDDTMF: CSendDtmfHandler::HandleCommand others" )
+                alphaIdStatus = ESatAlphaIdNull;
+                iNotificationData.iText.Zero();
+                }
+
+            // Build notification data
+            iNotificationData.iAlphaIdStatus = alphaIdStatus;
+            iNotificationData.iCommand = ESatSSendDtmfNotify;
+
+            // Has to be casted to TInt before casting to TSatIconQualifier,
+            // because GCC warns about the direct cast.
+            const struct TSatIconId iconId =
+                { iSendDtmfData.iIconId.iIdentifier,
+                  static_cast<TSatIconQualifier>(
+                    static_cast<TInt>( iSendDtmfData.iIconId.iQualifier ) ) };
+
+            iNotificationData.iIconId = iconId;
+
+            // Send notification
+            iUtils->SatUiHandler().UiSession()->SendCommand(
+                &iNotificationDataPckg,
+                &iNotificationRspPckg,
+                ESatSProactiveNotification );
+
+            // DTMF String sent, wait for completion
+            }
+        }
+
+    LOG( SIMPLE, "SENDDTMF: CSendDtmfHandler::HandleCommand exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Called when UI launch fails.
+// -----------------------------------------------------------------------------
+//
+void CSendDtmfHandler::UiLaunchFailed()
+    {
+    LOG( SIMPLE, "SENDDTMF: CSendDtmfHandler::UiLaunchFailed calling" )
+
+    iSendDtmfRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+    iSendDtmfRsp.iInfoType = RSat::KMeProblem;
+    iSendDtmfRsp.iAdditionalInfo.Append( RSat::KNoSpecificMeProblem );
+    iSendDtmfRsp.SetPCmdNumber( iSendDtmfData.PCmdNumber() );
+    SendTerminalResponse();
+
+    LOG( SIMPLE, "SENDDTMF: CSendDtmfHandler::UiLaunchFailed exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+//lint -e{1403, 1769} Can not be initialized, harmless.
+CSendDtmfHandler::CSendDtmfHandler() :
+    CSatCommandHandler(),
+    iSendDtmfData(),
+    iSendDtmfPckg( iSendDtmfData ),
+    iSendDtmfRsp(),
+    iSendDtmfRspPckg( iSendDtmfRsp ),
+    iNotificationData(),
+    iNotificationDataPckg( iNotificationData ),
+    iNotificationRsp(),
+    iNotificationRspPckg( iNotificationRsp ),
+    // To be removed when icons are allowed in this command
+    iIconCommand( EFalse )
+    {
+    LOG( SIMPLE,
+        "SENDDTMF: CSendDtmfHandler::CSendDtmfHandler calling - exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSendDtmfHandler::ConstructL()
+    {
+    LOG( SIMPLE, "SENDDTMF: CSendDtmfHandler::ConstructL calling" )
+
+    // Register notification observer
+    iUtils->RegisterServiceRequestL(
+        ESatSProactiveNotification,
+        ESatSProactiveNotificationResponse,
+        this );
+
+    // DTMF Sender
+    iDtmfSender = 
+        new ( ELeave ) CSatDtmfSender( *this, iUtils->MultiModeApi() );
+
+    LOG( SIMPLE, "SENDDTMF: CSendDtmfHandler::ConstructL exiting" )
+    }
+
+
+// -----------------------------------------------------------------------------
+// Converts DTMF string from extended BCD to UCS2.
+// -----------------------------------------------------------------------------
+//
+TBool CSendDtmfHandler::ConvertDtmfStringToUcs2( TDes& aDtmfString )
+    {
+    LOG( SIMPLE,
+        "SENDDTMF: CSendDtmfHandler::ConvertDtmfStringToUcs2 calling" )
+    aDtmfString.Zero();
+
+    const TInt bcdLength = iSendDtmfData.iDtmfString.Length();
+    TInt i( 0 );
+    TBool retVal( ETrue );
+    TBool continueLoop( ETrue );
+
+    for ( i = 0; i < bcdLength && continueLoop; i++ )
+        {
+        // each 16 bit DTMF character of SAT ETel API holds two nibbles,
+        // high byte always being 0
+        TChar twoBcd = iSendDtmfData.iDtmfString[i];
+
+        // low nibble yields first BCD in semi-octet representation
+        TChar firstBcd = twoBcd & KLowNibble;
+
+        // high nibble yields second BCD in semi-octet representation
+        TChar secondBcd = ( twoBcd & KHighNibble ) >> KBitsInNibble;
+
+        TChar destChar;
+        TBool endOfString;
+        TBool dtmfCharacter;
+
+        // convert first extended BCD character
+        ConvertDtmfCharacterToUcs2(
+            firstBcd, endOfString, dtmfCharacter, destChar );
+
+        if ( endOfString )
+            {
+            LOG( SIMPLE, "SENDDTMF: CSendDtmfHandler::ConvertDtmfStringToUcs2 \
+                (End of string in first BCD)" )
+            retVal = ETrue; // completed string (F digit)
+            continueLoop = EFalse;
+            }
+        else if ( !dtmfCharacter )
+            {
+            LOG( SIMPLE, "SENDDTMF: CSendDtmfHandler::ConvertDtmfStringToUcs2 \
+                (not dtmfCharacter in first BCD)" )
+            retVal = EFalse;
+            continueLoop = EFalse;
+            }
+        else
+            {
+            aDtmfString.Append( destChar );
+
+            // convert second extended BCD character
+            ConvertDtmfCharacterToUcs2(
+                secondBcd, endOfString, dtmfCharacter, destChar );
+
+            if ( endOfString )
+                {
+                LOG( SIMPLE,
+                    "SENDDTMF: CSendDtmfHandler::ConvertDtmfStringToUcs2 \
+                    (End of string in second BCD)" )
+                retVal = ETrue; // completed string (F digit)
+                continueLoop = EFalse;
+                }
+            else if ( !dtmfCharacter )
+                {
+                LOG( SIMPLE,
+                    "SENDDTMF: CSendDtmfHandler::ConvertDtmfStringToUcs2 \
+                    (not dtmfCharacter in second BCD)" )
+                retVal = EFalse;
+                continueLoop = EFalse;
+                }
+            else
+                {
+                LOG( SIMPLE,
+                    "SENDDTMF: CSendDtmfHandler::ConvertDtmfStringToUcs2 \
+                    others" )
+                aDtmfString.Append( destChar );
+                }
+            }
+        }
+    LOG2( NORMAL, 
+        "CSendDtmfHandler::ConvertDtmfStringToUcs2 i: %d", i )
+    LOG2( SIMPLE,
+        "SENDDTMF: CSendDtmfHandler::ConvertDtmfStringToUcs2 exiting,\
+        retVal: %d", retVal )
+    return retVal; // completed string (all bytes converted)
+    }
+
+// -----------------------------------------------------------------------------
+// Converts character from extended BCD to UCS2.
+// -----------------------------------------------------------------------------
+//
+void CSendDtmfHandler::ConvertDtmfCharacterToUcs2(
+    const TChar& aExtBcd,
+    TBool& aEndOfString,
+    TBool& aDtmfCharacter,
+    TChar& aUcs2Char ) const
+    {
+    LOG( SIMPLE,
+        "SENDDTMF: CSendDtmfHandler::ConvertDtmfCharacterToUcs2 calling" )
+
+    aEndOfString = EFalse;
+    aDtmfCharacter = ETrue;
+
+    switch ( aExtBcd )
+        {
+        case KBcdZero:
+        case KBcdOne:
+        case KBcdTwo:
+        case KBcdThree:
+        case KBcdFour:
+        case KBcdFive:
+        case KBcdSix:
+        case KBcdSeven:
+        case KBcdEight:
+        case KBcdNine:
+            {
+            LOG( SIMPLE,
+            "SENDDTMF: CSendDtmfHandler::ConvertDtmfCharacterToUcs2 Digit" )
+            aUcs2Char = KUcs2Zero + aExtBcd;
+            break;
+            }
+
+        case KBcdStar:
+            {
+            LOG( SIMPLE,
+            "SENDDTMF: CSendDtmfHandler::ConvertDtmfCharacterToUcs2 KBcdStar" )
+            aUcs2Char = KUcs2Star;
+            break;
+            }
+
+        case KBcdHash:
+            {
+            LOG( SIMPLE,
+            "SENDDTMF: CSendDtmfHandler::ConvertDtmfCharacterToUcs2 KBcdHash" )
+            aUcs2Char = KUcs2Hash;
+            break;
+            }
+
+        case KBcdPause:
+            {
+            LOG( SIMPLE,
+            "SENDDTMF: CSendDtmfHandler::ConvertDtmfCharacterToUcs2 KBcdPause" )
+            aUcs2Char = KUcs2Pause;
+            break;
+            }
+
+        case KBcdEnd:
+            {
+            LOG( SIMPLE,
+            "SENDDTMF: CSendDtmfHandler::ConvertDtmfCharacterToUcs2 KBcdEnd" )
+            aEndOfString = ETrue;
+            break;
+            }
+
+        case KBcdWild:
+        case KBcdExpansion:
+        default:
+            {
+            LOG( SIMPLE,
+            "SENDDTMF: CSendDtmfHandler::ConvertDtmfCharacterToUcs2 unknown" )
+            aDtmfCharacter = EFalse;
+            }
+        }
+
+    LOG( SIMPLE,
+        "SENDDTMF: CSendDtmfHandler::ConvertDtmfCharacterToUcs2 exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Handles the result of DTMF sending and sends terminal response.
+// -----------------------------------------------------------------------------
+//
+void CSendDtmfHandler::HandleResult()
+    {
+    LOG( SIMPLE, "SENDDTMF: CSendDtmfHandler::HandleResult calling" )
+
+    // If UI is needed, send DTMF Done event to close any progress bar
+    if ( iNeedUiSession )
+        {
+        LOG( SIMPLE, "SENDDTMF: CSendDtmfHandler::HandleResult NeedUiSession" )
+        // To prevent client traffic jamming.
+        // Send UI event only when client response is received.
+        if ( !iClientResponseReceived && !iWait.IsStarted() )
+            {
+            LOG( SIMPLE, 
+            "SENDDTMF: CSendDtmfHandler::HandleResult start iwait" )
+            iWait.Start();
+            }
+        // No need to send command result since this only removes any
+        // existing wait notes...
+        iUtils->NotifyUiEvent( ESatSDtmfEndEvent, ESatEventNone, KErrNone );
+        }
+
+    // Raise error granularity back to extended errors
+    iUtils->MultiModeApi().RaiseErrorGranularity();
+
+#ifdef __WINS__
+    if ( KErrTimedOut == iDtmfResult )
+        {
+        iDtmfResult = KErrNone;
+        }
+#endif
+
+    LOG2( NORMAL, 
+    "SENDDTMF: CSendDtmfHandler::HandleResult Send DTMF result: %i", 
+    iDtmfResult )
+
+    switch ( iDtmfResult )
+        {
+        case KErrNone:
+            {
+            // No errors in DTMF sending. But cases like user termination and
+            // icons are handled here.
+            if ( iNotificationRsp.iSessionTerminatedByUser )
+                {
+                LOG( DETAILED,
+                "SENDDTMF: CSendDtmfHandler::HandleResult session terminated \
+                by user" )
+                iSendDtmfRsp.iGeneralResult = RSat::KPSessionTerminatedByUser;
+                iSendDtmfRsp.iInfoType = RSat::KNoAdditionalInfo;
+                iSendDtmfRsp.iAdditionalInfo.Zero();
+                }
+            else
+                {
+                iSendDtmfRsp.iGeneralResult = RSat::KSuccess;
+                iSendDtmfRsp.iInfoType = RSat::KNoAdditionalInfo;
+                iSendDtmfRsp.iAdditionalInfo.Zero();
+
+                // If command had icon data and was done succesfully,
+                // report that icon was not shown.
+                // To be removed and correct handling (i.e. ClientResponse to
+                // notification is received) for general result
+                // KSuccessRequestedIconNotDisplayed must be added when icons
+                // are allowed in this command.
+                if ( iIconCommand )
+                    {
+                    LOG( DETAILED,
+                    "SENDDTMF: CSendDtmfHandler::HandleResult iIconCommand \
+                    true" )
+                    iSendDtmfRsp.iGeneralResult =
+                        RSat::KSuccessRequestedIconNotDisplayed;
+                    }
+                }
+
+            break;
+            }
+        case KErrCancel:
+        case KErrEtelNoCarrier:
+            {
+            // Problems in communicating with receiving device are handled here
+            // e.g. call was unexpectedly dropped.
+            iSendDtmfRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+            iSendDtmfRsp.iInfoType = RSat::KMeProblem;
+            iSendDtmfRsp.iAdditionalInfo.Zero();
+            iSendDtmfRsp.iAdditionalInfo.Append( RSat::KNoSpecificMeProblem );
+            break;
+            }
+        case KErrArgument:
+            {
+            // Maximum length of DTMF string reached.
+            LOG( DETAILED,
+                 "SENDDTMF: CSendDtmfHandler  Over maximum DTMF length" )
+            iSendDtmfRsp.iGeneralResult = RSat::KErrorRequiredValuesMissing;
+            iSendDtmfRsp.iInfoType = RSat::KNoAdditionalInfo;
+            iSendDtmfRsp.iAdditionalInfo.Zero();
+            break;
+            }
+        default:
+            {
+            // By default for other errors.
+            iSendDtmfRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+            iSendDtmfRsp.iInfoType = RSat::KMeProblem;
+            iSendDtmfRsp.iAdditionalInfo.Zero();
+            iSendDtmfRsp.iAdditionalInfo.Append( RSat::KNotInSpeechCall );
+            break;
+            }
+        }
+
+    // Cancel DTMF sending if it is running.
+    iDtmfSender->Cancel();
+    SendTerminalResponse();
+
+    LOG( SIMPLE, "SENDDTMF: CSendDtmfHandler::HandleResult exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Sends terminal response. Makes sure that terminal response
+// is not send more that once / command.
+// -----------------------------------------------------------------------------
+//
+void CSendDtmfHandler::SendTerminalResponse()
+    {
+    LOG( SIMPLE, "SENDDTMF: CSendDtmfHandler::SendTerminalResponse calling" )
+
+    if ( !iTerminalRespSent )
+        {
+        LOG( SIMPLE, 
+        "CSendDtmfHandler::SendTerminalResponse iTerminalRespSent false" )
+        iTerminalRespSent = ETrue;
+        TerminalRsp( RSat::ESendDtmf, iSendDtmfRspPckg );
+        }
+
+    LOG( SIMPLE, "SENDDTMF: CSendDtmfHandler::SendTerminalResponse exiting" )
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendDtmfCmd/src/csatdtmfsender.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,102 @@
+/*
+* 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 SendDTMF command
+*
+*/
+
+
+#include    "csatdtmfsender.h"
+#include    "CSendDtmfHandler.h"
+#include    "msatmultimodeapi.h"
+#include    "SatLog.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSatDtmfSender::CSatDtmfSender
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatDtmfSender::CSatDtmfSender( 
+    CSendDtmfHandler& aDtmfHandler, MSatMultiModeApi& aPhone ) : 
+    CActive( EPriorityStandard ),
+    iDtmfHandler( aDtmfHandler ),
+    iPhone( aPhone )
+    {
+    LOG( SIMPLE,
+        "SENDDTMF: CSatDtmfSender::CSatDtmfSender calling - exiting" )
+    CActiveScheduler::Add( this );
+    }
+
+// Destructor
+CSatDtmfSender::~CSatDtmfSender()
+    {
+    LOG( SIMPLE, "SENDDTMF: CSatDtmfSender::~CSatDtmfSender calling" )
+
+    Cancel();
+
+    LOG( SIMPLE, "SENDDTMF: CSatDtmfSender::~CSatDtmfSender exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatDtmfSender::SendToneString
+// Sends DTMF tones during active, connected voice calls.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatDtmfSender::SendToneString( const TDesC& aTones )
+    {
+    LOG( SIMPLE, "SENDDTMF: CSatDtmfSender::SendToneString calling" )
+
+    if ( !IsActive() )
+        {
+        LOG( SIMPLE, "SENDDTMF: CSatDtmfSender::SendToneString set active" )
+        iPhone.SendDTMFTones( iStatus, aTones );
+        SetActive();
+        }
+
+    LOG( SIMPLE, "SENDDTMF: CSatDtmfSender::SendToneString exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatDtmfSender::DoCancel
+// Cancels the DTMF sending request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatDtmfSender::DoCancel()
+    {
+    LOG( SIMPLE, "SENDDTMF: CSatDtmfSender::DoCancel calling" )
+
+    iPhone.CancelAsyncRequest( EMobilePhoneSendDTMFTones );
+
+    LOG( SIMPLE, "SENDDTMF: CSatDtmfSender::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatDtmfSender::RunL
+// Informs observer about result of DTMF sending.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatDtmfSender::RunL()
+    {
+    LOG( SIMPLE, "SENDDTMF: CSatDtmfSender::RunL calling" )
+
+    iDtmfHandler.SendDtmfComplete( iStatus.Int() );
+
+    LOG( SIMPLE, "SENDDTMF: CSatDtmfSender::RunL exiting" )
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendDtmfCmd/src/std.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 functions
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    <implementationproxy.h>
+#include    "CSendDtmfHandler.h"
+
+// CONSTANTS
+
+const TImplementationProxy implementationTable[] =
+    {
+    //lint -e{611,1924} Warning "Suspicious cast" can not be avoided.
+    IMPLEMENTATION_PROXY_ENTRY( 0x10202987, CSendDtmfHandler::NewL )
+    };
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy ECOM framework factory function
+// Calculates the number of implementations.
+// Returns: Implementation proxy.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount ) // Number of implementations
+    {
+    aTableCount =
+        sizeof( implementationTable ) /
+        sizeof( TImplementationProxy );
+    return implementationTable;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendSSCmd/group/SendSsCmd.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,64 @@
+/*
+* 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:  Project definition file for project SendSs plug-in
+*
+*/
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../../inc/SatMacroes.h"
+
+TARGET                  SendSsCmd.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D 0x1000A884
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  std.cpp
+SOURCE                  CSendSsHandler.cpp
+SOURCE                  csatsendssadditionalinfohandler.cpp
+SOURCE                  csatsendsshandler.cpp
+SOURCE                  csatsendssrequestcompletehandler.cpp
+SOURCE                  csatsendssbarringnouiobs.cpp
+SOURCE                  csatsendssdivertnouiobs.cpp
+SOURCE                  csatsendsscallwaitingnouiobs.cpp
+SOURCE                  csatsendssclinouiobs.cpp
+
+START RESOURCE          1000A884.rss
+TARGET                  SendSsCmd.rsc
+END
+
+USERINCLUDE             ../../../inc
+USERINCLUDE             ../inc
+
+// The application domain layer systeminclude is needed as PhoneParser is used
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+SYSTEMINCLUDE           ../../../../../inc // Domain telephony
+SYSTEMINCLUDE           ../../../../inc // Subsystem satengine
+
+LIBRARY                 euser.lib
+LIBRARY                 etelsat.lib
+LIBRARY                 SatEngine.lib
+LIBRARY                 PhoneParser.lib
+LIBRARY                 customAPI.lib // RMmCustomAPI
+LIBRARY                 etel.lib
+LIBRARY                 etelmm.lib
+LIBRARY                 phonesettings.lib
+
+#ifdef ENABLE_SAT_LOGGING
+LIBRARY                 flogger.lib
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendSSCmd/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 SendSsCmd plug-in
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+SendSsCmd.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendSSCmd/inc/CSendSsHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,337 @@
+/*
+* 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:  Proactive SendSs command handler
+*
+*/
+
+
+#ifndef CSENDSSHANDLER_H
+#define CSENDSSHANDLER_H
+
+#include <etelsat.h>
+
+#include "CSatCommandHandler.h"
+#include "SatSTypes.h"
+
+class MSatUtils;
+class CSatSendSsRequestCompleteHandler;
+class CSatSendSsAdditionalInfoHandler;
+class CPhoneGsmHandlerBase;
+class CPhoneGsmParserBase;
+class CPhoneGsmParserResult;
+class CPhoneGsmOptionContainerBase;
+
+/**
+*  Command handler for SendSS command.
+*
+*  @lib SendSSCmd.lib
+*  @since S60 v3.0
+*/
+class CSendSSHandler : public CSatCommandHandler
+    {
+    
+public:
+
+    static CSendSSHandler* NewL( MSatUtils* aUtils );
+
+    virtual ~CSendSSHandler();
+    
+    /**
+     * Processes the SS Request Complete.
+     *
+     * @param aErrCode Result of Ss sending
+     */
+    void DispatchSsRequestComplete( const TInt aErrCode );
+
+    /**
+     * Processes the SS aditional info.
+     *
+     * @param Addtional info.
+     */
+    void DispatchSsAdditionalInfo( const TDesC& aAdditionalInfo );
+
+// from base class MSatCommand
+
+    /**
+     * From MSatCommand.
+     * Response from the client
+     *
+     */
+    void ClientResponse();
+    
+// from base class CSatCommandHandler
+
+    /**
+     * From CSatCommandHandler
+     * Overrides the default implementation.
+     *
+     * @param aEvent Identifies the event.
+     */
+    void Event( TInt aEvent );
+
+protected:
+
+// from base class CActive
+
+    /**
+     * From CActive
+     * Cancels the usat request.
+     *
+     */
+    void DoCancel();
+    
+// from base class CSatCommandHandler
+
+    /**
+     * From CSatCommandHandler
+     * Requests the command notification.
+     *
+     * @param aStatus Request status
+     */
+    void IssueUSATRequest( TRequestStatus& aStatus );
+
+    /**
+     * From CSatCommandHandler
+     * Precheck before executing the command.
+     *
+     * @return TBool indicating command is currently allowed.
+     */
+    TBool CommandAllowed();
+
+    /**
+     * From CSatCommandHandler
+     * Need for ui session.
+     *
+     * @return TBool indicating need of ui session.
+     */
+    TBool NeedUiSession();
+
+    /**
+     * From CSatCommandHandler
+     * Called when USAT API notifies that command.
+     *
+     */
+    void HandleCommand();
+
+    /**
+     * From CSatCommandHandler.
+     * Indicates the failure of launching ui client
+     *
+     */
+    void UiLaunchFailed();
+
+private:
+
+    CSendSSHandler();
+
+    void ConstructL();
+
+    /**
+     * Handles the Ss string sending
+     *
+     */
+    void SendSsStringL();
+
+    /**
+     * Handles the result of Ss sending
+     *
+     */
+    void HandleSendSsResult();
+
+    /**
+     * Checks is the command transparent or not
+     *
+     * @return Boolean indicating is current command transparent to user
+     */
+    TBool TransparentSsSending();
+
+    /**
+     * Sends terminal response, if not yet sent
+     *
+     */
+    void SendTerminalResponse();
+
+    /**
+     * Delay callback function. Called when predefined time
+     * has passed. Used to wait SendSS AdditionalInfoNotification
+     *
+     * @param aPtr Pointer to creator
+     * @return whether to call function again after an interval
+     */
+    static TInt SSRequestCallback( TAny* aPtr );
+
+private: // data
+
+    /**
+     * SendSSCall command data.
+     */
+    RSat::TSendSsV1 iSendSsData;
+
+    /**
+     * SendSSCall command package.
+     */
+    RSat::TSendSsV1Pckg iSendSsPckg;
+
+    /**
+     * Response from client
+     */
+    RSat::TSendSsRspV2 iSendSsRsp;
+
+    /**
+     * Response package.
+     */
+    RSat::TSendSsRspV2Pckg iSendSsRspPckg;
+
+    /**
+     * UI Queries and notifications:
+     * Query command data.
+     */
+    TSatQueryV1 iQueryData;
+
+    /**
+     * Query package.
+     */
+    TSatQueryV1Pckg iQueryPckg;
+
+    /**
+     * Query response.
+     */
+    TSatQueryRspV1 iQueryRsp;
+
+    /**
+     * Query rsp package.
+     */
+    TSatQueryRspV1Pckg iQueryRspPckg;
+
+    /**
+     * Notification send data
+     */
+    TSatNotificationV1 iNotificationData;
+
+    /**
+     * Notification package
+     */
+    TSatNotificationV1Pckg iNotificationDataPckg;
+
+    /**
+     * Notification Response data
+     */
+    TSatNotificationRspV1 iNotificationRsp;
+
+    /**
+     * Notification Response package
+     */
+    TSatNotificationRspV1Pckg iNotificationRspPckg;
+
+    /**
+     * Indicates is notification sent
+     */
+    TBool iNotificationSent;
+
+    /**
+     * Ss specific
+     */
+    TInt iSsResult;
+
+    /**
+     * Indicates is the result arrived
+     */
+    TBool iRequestCompleteArrived;
+
+    /**
+     * Indicates is additional info arrived
+     */
+    TBool iAdditionalInfoArrived;
+
+    /**
+     * Additional info of SS message
+     */
+    TBuf<RSat::KAlphaIdMaxSize> iAdditionalInfo;
+
+    /**
+     * Ss additional info handler
+     * Own.
+     */
+    CSatSendSsAdditionalInfoHandler* iAdditionalInfoHandler;
+
+    /**
+     * Ss request complete handler
+     * Own.
+     */
+    CSatSendSsRequestCompleteHandler* iRequestCompleteHandler;
+
+    /**
+     * SS Parser used to process  parser result.
+     * Own.
+     */
+    CPhoneGsmHandlerBase* iPhoneGsmHandlerBase;
+
+    /**
+     * Ss string parsers
+     * Own.
+     */
+    CPhoneGsmParserBase* iParser;
+
+    /**
+     * Ss result
+     * Own.
+     */
+    CPhoneGsmParserResult* iResult;
+
+    /**
+     * SS options used to update options.
+     * Own.
+     */
+    CPhoneGsmOptionContainerBase* iPhoneGsmOptionContainerBase;
+
+    /**
+     * Indicates is terminal response sent
+     */
+    TBool iTerminalRespSent;
+
+    /**
+     * Indicates is UI needed
+     */
+    TBool iNeedUiSession;
+
+    /**
+     * Indicates is Confirm SAT Operations on
+     */
+    TBool iQueryOn;
+
+    /**
+     * delay timer
+     * Own.
+     */
+    CPeriodic* iTimer;
+
+    /**
+     * Indicates wether user accepted or rejected
+     */
+   TBool iUserAccepted;
+
+    /**
+     * For delayed Ss sendinf
+     */
+    CActiveSchedulerWait iSendWait;
+        
+    /**
+     * Flag to signal that command has icon data
+     * To be removed when icons are allowed in this command
+     */
+    TBool iIconCommand;
+    };
+
+#endif      // CSENDSSHANDLER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendSSCmd/inc/SendSsCmd.rls	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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 headers for project SendSsCmd
+*
+*/
+
+
+#ifndef SENDSSCMD_RLS
+#define SENDSSCMD_RLS
+
+rls_string STRING_r_sendsscmd_display_name "SendSs command"
+rls_string STRING_r_sendsscmd_default_data "SendSsCmd"
+rls_string STRING_r_sendsscmd_opaque_data   ""
+
+#endif // SENDSSCMD_RLS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendSSCmd/inc/csatsendssadditionalinfohandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,101 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Handler for the SS Additional Info notification
+*
+*/
+
+
+#ifndef CSATSENDSSADDITIONALINFOHANDLER_H
+#define CSATSENDSSADDITIONALINFOHANDLER_H
+
+#include <e32base.h>
+#include <rmmcustomapi.h>
+
+class CSendSSHandler;
+
+/**
+*  This is the handler for the SS Additional Info notification.
+*  This active objects is registered with Custom ETel Api to receive notifications
+*  about the SS Additional Info.
+*
+*  @lib SendSsCmd
+*  @since S60 v3.1
+*/
+class CSatSendSsAdditionalInfoHandler : public CActive
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     * @param aPhone A reference to the Custom ETel API.
+     * @param aDispatcher Pointer to Ss handler
+     * @return a pointer to the newly created active object.
+     */
+    static CSatSendSsAdditionalInfoHandler* NewL( RMmCustomAPI& aPhone,
+        CSendSSHandler* aDispatcher );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CSatSendSsAdditionalInfoHandler();
+
+    /**
+     * Starts listening for the Sat command. 
+     */
+    void Start();
+
+protected:
+
+    /**
+     * From CActive, handles the request completion.
+     */
+    void RunL();
+
+    /**
+     * From CActive, implements the cancel protocol.
+     */
+    void DoCancel();
+
+private: // data
+
+    /**
+     * C++ default constructor.
+     * @param aPriority An active object priority value.
+     * @param aDispatcher Pointer to Ss handler
+     * @param aPhone A reference to the Custom ETel API.
+     */
+    CSatSendSsAdditionalInfoHandler( TInt aPriority, RMmCustomAPI& aPhone,
+        CSendSSHandler* aDispatcher );
+
+private:
+
+    /**
+     * Reference to the Custom API
+     */
+    RMmCustomAPI& iPhone;
+
+    /**
+     * Additional information received through Custom API
+     */
+    RMmCustomAPI::TSsAdditionalInfo iSsAdditionalInfo;
+
+    /**
+     * Pointer to SendSs command handler
+     */
+    CSendSSHandler* iDispatcher;
+
+    };
+
+#endif      // CSATUISSADDITIONALINFOHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendSSCmd/inc/csatsendssbarringnouiobs.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 MPsetBarringObserver.
+*
+*/
+
+
+#ifndef CSATSENDSSBARRINGNOUIOBS_H
+#define CSATSENDSSBARRINGNOUIOBS_H
+
+#include <mpsetbarringobs.h>
+
+/**
+*  Implements MPsetBarringObserver and gets notifications of the barring process
+*
+*  @lib SendSsCmd
+*  @since S60 v3.1
+*/
+class CSatSendSsBarringNoUiObs : public CBase,
+                                 public MPsetBarringObserver
+    {
+public:
+
+    /**
+     * C++ default constructor.
+     */
+    CSatSendSsBarringNoUiObs();
+
+    /**
+     * Destructor.
+     */
+    ~CSatSendSsBarringNoUiObs();
+
+    /**
+     * HandleBarringModeChangedL-function handles mode changed notes.
+     * @param aType defines what kind of barring program is involved.
+     * @param aStatus defines the status of the barring program.
+     * @param aPlural Plural notes should be used.
+     */
+    void HandleBarringModeChangedL( TBarringProgram aType,
+        TBarringStatus aStatus, TBool aPlural );
+    
+    /**
+     * HandleBarringModeStatusL-function handles mode status notes.
+     * @param aBsc defines what kind of basic service groups are involved.
+     * @param aStatus defines the status of the barring program.
+     */
+    void HandleBarringModeStatusL( 
+        TUint8 aBsc[KPSetNumberOfBsc], TBarringStatus aStatus );
+    
+    /**
+     * HandleBarringErrorL-function handles errors in call barring requests.
+     * @param aReason is the reason for error.
+     */
+    void HandleBarringErrorL( TInt aReason );
+
+    /**
+     * HandleCBRequestingL-function handles requesting notes.
+     * @param aOngoing defines whether or not there is a request going on.
+     * @param aInterrupted if ETrue, means that notemaster should be 
+     *                     immediately deleted.
+     */
+    void HandleCBRequestingL( TBool aOngoing, TBool aInterrupted );
+
+    /**
+     * CbPasswordChangedL-function handles notes relating to cb password 
+     * change requests.
+     * @param aSuccess defines whether or not the change request was successfull.
+     */
+    void CbPasswordChangedL( TBool aSuccess );
+
+    /**
+     * SetEngineContact-function is used to
+     * @param aEngineContact is a connection to the engine. 
+     */
+    void SetEngineContact( MPsetCallBarring* aBarringEngine );
+    };
+
+#endif // CSATSENDSSBARRINGNOUIOBS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendSSCmd/inc/csatsendsscallwaitingnouiobs.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 Waiting observer
+*
+*/
+
+
+#ifndef CSATSENDSSCALLWAITINGNOUIOBS_H
+#define CSATSENDSSCALLWAITINGNOUIOBS_H
+
+#include <mpsetcallwaitingobs.h>
+
+/**
+*  Implements MPsetCallWaitingObserver and gets notifications
+*  of the call waiting process.
+*
+*  @lib SendSsCmd
+*  @since S60 v3.1
+*/
+class CSatSendSsCallWaitingNoUiObs : public CBase,
+                                     public MPsetCallWaitingObserver
+    {
+public:
+
+    /**
+     * C++ default constructor.
+     */
+    CSatSendSsCallWaitingNoUiObs();
+
+    /**
+     * Destructor.
+     */
+    ~CSatSendSsCallWaitingNoUiObs();
+
+    /**
+     * HandleCallWaitingGetStatusL-function
+     * @param aStatus is the query result.
+     */
+    void HandleCallWaitingGetStatusL(
+        MPsetCallWaiting::TGetCallWaitingStatus aStatus,
+        TUint8 aBsc[KPSetNumberOfBsc] );
+
+    /**
+     * HandleCallWaitingChangedL-function
+     * @param aSetting is the setting that was changed.
+     * @param aResult is the result of the action.
+     */
+    void HandleCallWaitingChangedL(
+        MPsetCallWaiting::TSetCallWaiting aSetting,
+        TInt aResult );
+
+    /**
+     * HandleRequestingL-function handles requesting notes.
+     * @param aOngoing defines whether or not there is a request going on.
+     * @param aInterrupted if ETrue deletes immediately CPsuiNoteMaster-object.
+     */
+    void HandleCWRequestingL( TBool aOngoing, TBool aInterrupted );
+
+    /**
+     * This function handles errors in call waiting requests.
+     * @param aReason is the reason for error.
+     */
+    void HandleCWErrorL( TInt aReason );
+
+    /**
+     * SetEngineContact-function
+     * @param aEngineContact is a connection to the engine.
+     */
+    void SetEngineContact( MPsetCallWaiting& aEngineContact );
+    };
+
+#endif //CSATSENDSSCALLWAITINGNOUIOBS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendSSCmd/inc/csatsendssclinouiobs.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,87 @@
+/*
+* 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:  Responsible for handling notes related to CLIR, CLIP, 
+                 COLR and COLP.
+*
+*/
+
+
+#ifndef CSATSENDSSCLINOUIOBS_H
+#define CSATSENDSSCLINOUIOBS_H
+
+#include <mpsetcliobserver.h>
+
+/**
+*  Implements MPsetCliObserver and is responsible for handling notes related 
+*  to CLIR, CLIP, COLR and COLP.
+*
+*  @lib SendSsCmd
+*  @since S60 v3.1
+*/
+class CSatSendSsCliNoUiObs : public CBase, public MPsetCliObserver
+    {
+public:
+
+    /**
+     * C++ default constructor.
+     */
+    CSatSendSsCliNoUiObs();
+
+    /**
+     * Destructor.
+     */
+    ~CSatSendSsCliNoUiObs();
+
+    /**
+     * CliInformation-method takes the correct type of cli
+     * and passes it on to iNote
+     * @param aType defines the type and status of cli info.
+     */
+    void CliInformationL( TPsuiCli aType );
+
+    /**
+     * HandleCliRequestingL-function handles requesting notes.
+     * @param aOngoing defines whether or not there is a request going on.
+     * @param aInterrupted if ETrue, means that notemaster should be
+     *                     immediately deleted.
+     */
+    void HandleCliRequestingL( TBool aOngoing, TBool aInterrupted );
+
+    /**
+     * SetEngineContact-function...
+     * @param aEngine reference to the PS engine
+     */
+    void SetEngineContact( MPsetCli* aEngine );
+
+    /*
+     * HandleCliStatusL-function shows the status of Cli if requested.
+     *   @param  aBsc list of basic service groups
+     *   @param  aMode status of CLI
+     */
+    void HandleCliStatusL( TUint8 aBsc[KPSetNumberOfBsc], TPsuiCli aMode );
+
+    /*
+     * HandleCnapStatusL-function shows the status of Cnap if requested.
+     *   @param  aStatus status of Cnap
+     */
+    void HandleCnapStatusL( TInt aStatus );
+
+    /**
+     * Handles errors.
+     * @param aError error code.
+     */
+    void HandleCliErrorL( TInt aError );
+    };
+
+#endif // CSATSENDSSCLINOUIOBS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendSSCmd/inc/csatsendssdivertnouiobs.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implements the MPsetDivertObserver observer.
+*
+*/
+
+
+#ifndef CSATSENDSSDIVERTNOUIOBS_H
+#define CSATSENDSSDIVERTNOUIOBS_H
+
+#include <mpsetdivertobs.h>
+
+/**
+*  Implements MPsetDivertObserver and gets notifications of
+*  the diverting process
+*
+*  @lib SendSsCmd
+*  @since S60 v3.1
+*/
+class CSatSendSsDivertNoUiObs : public CBase,
+                                public MPsetDivertObserver
+    {
+public:
+
+    /**
+     * C++ default constructor.
+     */
+    CSatSendSsDivertNoUiObs();
+
+    /**
+     * Destructor.
+     */
+    ~CSatSendSsDivertNoUiObs();
+
+    /**
+     * From MPsetDivertObserver, handles diverting changed.
+     * @param aSetting identifies the cf setting.
+     * @param aPlural indicates that operation affected several bscs.
+     */
+    void HandleDivertingChangedL(
+        const TCallDivertSetting& aSetting,
+        TBool aPlural );
+
+    /**
+     * From MPsetDivertObserver, handles diverting status.
+     * @param aBsc array of Bscs
+     * @param aSetting identifies the cf setting.
+     * @param aPlural indicates that operation affects several bscs.
+     */
+    void HandleDivertingStatusL(
+        CMobilePhoneCFList& aSetting,
+        TBool aPlural );
+
+    /**
+     * From MPsetDivertObserver, handles diverting error.
+     * @param aReason identifies the reason for error.
+     */
+    void HandleDivertingErrorL( TInt aReason );
+
+    /**
+     * HandleCFRequestingL-function handles requesting notes.
+     * @param aOngoing defines whether or not there is a request going on.
+     * @param aInterrupted if ETrue, means that notemaster should be
+     *                     immediately deleted.
+     */
+    void HandleCFRequestingL( TBool aOngoing, TBool aInterrupted );
+
+    /**
+     * SetEngineContact-function sets engine contact for observer
+     * @param aDivertEngine is the contact.
+     */
+    void SetEngineContact( MPsetCallDiverting* aDivertEngine );
+    };
+
+#endif //CSATSENDSSDIVERTNOUIOBS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendSSCmd/inc/csatsendsshandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,221 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Process forwarding procedures.
+*
+*/
+
+
+#ifndef CSATSENDSSHANDLER_H
+#define CSATSENDSSHANDLER_H
+
+#include <cphonegsmsshandler.h>
+#include <nwdefs.h>
+#include <psetcallwaiting.h>
+#include <psetcontainer.h>
+#include <psetcallbarring.h>
+#include <psetcalldiverting.h>
+#include <psetcli.h>
+#include <mpsetrequestobs.h>
+
+class CSatSendSsBarringNoUiObs;
+class CSatSendSsCliNoUiObs;
+class CSatSendSsCallWaitingNoUiObs;
+class CSatSendSsDivertNoUiObs;
+
+/**
+*  Handles process forwarding procedures.
+*
+*  @lib SendSsCmd
+*  @since S60 v3.1
+*/
+class CSatSendSsHandler : public CPhoneGsmSsHandler,
+                          public MPsetRequestObserver
+    {
+
+public:
+
+    /**
+     * Destructor.
+     */
+    ~CSatSendSsHandler();
+
+    /**
+     * From CPhoneGsmSsHandler, Process forwarding procedures.
+     *
+     * If a parameter is not allowed for a procedure,
+     * then it is empty. If a parameter is not explicitly given,
+     * then it is empty. If a parameter is present, then it can
+     * be asumed to contain appropriate values.
+     *
+     * @param aAction It is action.
+     * @param aForwarding It contains forwarding procedure.
+     * @param aNumber It is directory number.
+     * @param aBasicCode It is basic service code.
+     * @param aTimer It is timer.
+     */
+    void ProcessForwardingL(
+        TAction aAction,
+        TForwardingProcedure aForwarding,
+        const TDesC& aNumber,
+        const TDesC& aBasicCode,
+        const TDesC& aTimer );
+
+    /**
+     * From CPhoneGsmSsHandler, Process barring procedures.
+     *
+     * See comments for forwarding, they apply also in here.
+     *
+     * @param aAction It is action.
+     * @param aBarring It contains barring procedure.
+     * @param aPassword It should be barring password, if required.
+     * @param aBasicCode It is basic service code.
+     */
+    void ProcessBarringL(
+        TAction aAction,
+        TBarringProcedure aBarring,
+        const TDesC& aPassword,
+        const TDesC& aBasicCode );
+
+    /**
+     * From CPhoneGsmSsHandler, Process password change
+     *
+     * @param aPassword It is password procedure.
+     * @param aOldPassword It should be old password.
+     * @param aNewPassword1 It is new password.
+     * @param aNewPassword2 It is new password.
+     */
+    void ProcessPasswordChangeL(
+        TPasswordProcedure aPassword,
+        const TDesC& aOldPassword,
+        const TDesC& aNewPassword1,
+        const TDesC& aNewPassword2 );
+
+    /**
+     * From CPhoneGsmSsHandler, Process waiting.
+     *
+     * @param aAction It is action.
+     * @param aBasicCode It is basic service code.
+     */
+    void ProcessWaitingL(
+        TAction aAction,
+        const TDesC& aBasicCode );
+
+    /**
+     * From CPhoneGsmSsHandler, Process calling line
+     * identification presentation status.
+     */
+    void ProcessClipStatusL();
+
+    /**
+     * From CPhoneGsmSsHandler, Process calling line
+     * idnetification restriction status.
+     */
+    void ProcessClirStatusL();
+
+    /**
+     * From CPhoneGsmSsHandler, Process connected line
+     * presentation status.
+     */
+    void ProcessColpStatusL();
+
+    /**
+     * From CPhoneGsmSsHandler, Process connected line
+     * restriction status.
+     */
+    void ProcessColrStatusL();
+
+    /**
+     * From CPhoneGsmSsHandler, Processes result
+     */
+    void ProcessCnapStatusL();
+
+    /**
+     * From MPsetRequestObs, called when request is completed
+     * so that also ui browsing is ended
+     */
+    void RequestComplete();
+
+    /**
+     * From MPsetRequestObs, called when request status is changed
+     * so that also ui browsing is ended
+     */
+    void RequestStatusChanged( TInt aNewStatus );
+
+    /**
+     * cancel function cancels current request
+     */
+    void Cancel();
+
+private:
+
+    /**
+     * Changes parameter to basic service code
+     */
+    TBasicServiceGroups ChangeToBsc( const TDesC& aBasicCode ) const;
+
+    /**
+     * Connects class to the phonesettings
+     */
+    void ConnectToSsEngineL();
+
+private:    // Data
+
+    /**
+     * Pointer to PhoneSettings
+     */
+    CPsetContainer* iSettings;
+
+    /**
+     * Call waiting handler in Phone Settings
+     */
+    CPsetCallWaiting* iWaiting;
+
+    /**
+     * Call waiting observer
+     */
+    CSatSendSsCallWaitingNoUiObs* iSatCwObserver;
+
+    /**
+     * Call barring handler in Phone Settings
+     */
+    CPsetCallBarring* iBarring;
+
+    /**
+     * Call barring observer
+     */
+    CSatSendSsBarringNoUiObs* iSatCbObserver;
+
+    /**
+     * Cli handler in Phone Settings
+     */
+    CPsetCli* iCli;
+
+    /**
+     * Cli observer
+     */
+    CSatSendSsCliNoUiObs* iSatCliObserver;
+
+    /**
+     * Call diverting handler in Phone Settings
+     */
+    CPsetCallDiverting* iDivert;
+
+    /**
+     * Call diverting observer
+     */
+    CSatSendSsDivertNoUiObs* iSatCfObserver;
+
+    };
+
+#endif      // CSATSENDSSHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendSSCmd/inc/csatsendssrequestcompletehandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,100 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Handler for the SS Request Complete notification.
+*
+*/
+
+
+#ifndef CSATSENDSSREQUESTCOMPLETEHANDLER_H
+#define CSATSENDSSREQUESTCOMPLETEHANDLER_H
+
+#include <e32base.h>
+#include <rmmcustomapi.h>
+
+class CSendSSHandler;
+
+/**
+*  This is the handler for the SS Request Complete notification.
+*  This active objects is registered with Custom ETel Api to receive
+*  notifications about the SS Request Complete.
+*
+*  @lib SendSsCmd
+*  @since S60 v3.1
+*/
+
+class CSatSendSsRequestCompleteHandler : public CActive
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     * @param aPhone A reference to the Custom ETel API.
+     * @param aDispatcher Pointer to Ss handler
+     * @return a pointer to the newly created active object.
+     */
+    static CSatSendSsRequestCompleteHandler* NewL( RMmCustomAPI& aPhone,
+        CSendSSHandler* aDispatcher );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CSatSendSsRequestCompleteHandler();
+
+    /**
+     * Starts listening for the SS Request Complete notification.
+     */
+    void Start();
+
+protected:
+
+    /**
+     * From CActive, handles the request completion.
+     */
+    void RunL();
+
+    /**
+     * From CActive, implements the cancel protocol.
+     */
+    void DoCancel();
+
+private:
+
+    /**
+     * C++ default constructor.
+     * @param aPriority An active object priority value.
+     * @param aPhone A reference to the Custom ETel API.
+     */
+    CSatSendSsRequestCompleteHandler( TInt aPriority, RMmCustomAPI& aPhone,
+        CSendSSHandler* aDispatcher );
+
+private: // Data
+
+    /**
+     * Reference to the Custom API
+     */
+    RMmCustomAPI& iPhone;
+
+    /**
+     * Result of the Ss sending
+     */
+    TInt iSsStatus;
+
+    /**
+     * Pointer to SendSs command handler
+     */
+    CSendSSHandler* iDispatcher;
+    };
+
+#endif      // CSATSENDSSREQUESTCOMPLETEHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendSSCmd/src/1000A884.rss	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 1000 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Registry information for ECOM
+*
+*/
+
+
+
+//  INCLUDES
+#include <registryinfo.rh>
+#include "SendSsCmd.rls"
+
+//  RESOURCE DEFINITIONS
+// -----------------------------------------------------------------------------
+//
+// SendSSCmdInfo
+// Registeration information for ECOM
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO SendSSCmdInfo
+    {
+    dll_uid = 0x1000a884;
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x1000f001;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x1000a885;
+                    version_no   = 1;
+                    display_name = STRING_r_sendsscmd_display_name;
+                    default_data = STRING_r_sendsscmd_default_data;
+                    opaque_data  = STRING_r_sendsscmd_opaque_data;
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendSSCmd/src/CSendSsHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,1002 @@
+/*
+* 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 SendSS command
+*
+*/
+
+
+#include    <cphonegsmparserbase.h>
+#include    <cphonegsmparserresult.h>
+#include    <phonegsmparser.h>
+#include    <cphonegsmoptioncontainerbase.h>
+
+#include    "MSatSystemState.h"
+#include    "MSatApi.h"
+#include    "MSatUtils.h"
+#include    "MSatUiSession.h"
+#include    "SatSOpcodes.h"
+#include    "MSatSUiClientHandler.h"
+#include    "CSendSsHandler.h"
+#include    "SatLog.h"
+#include    "csatsendssrequestcompletehandler.h"
+#include    "csatsendssadditionalinfohandler.h"
+#include    "csatsendsshandler.h"
+
+// CustomAPI returns KCustomApiSsGsmActive=0x01
+const TInt KSsGsmActiveSuccess = 0x01;
+// CustomAPI returns KCustomApiSsGsmRegistered=0x02
+const TInt KSsGsmRegistered = 0x02;
+// CustomAPI returns KCustomApiSsGsmProvisioned=0x04
+const TInt KSsGsmProvisioned = 0x04;
+// CustomAPI returns KCustomApiSsGsmQuiescent=0x08
+const TInt KSsGsmQuiescent = 0x08;
+// CustomAPI returns SsServiceFailedResp=0xFFFF
+const TInt KSsServiceFailed = 0xFFFF;
+// Error code for NetworkFailure = 0xFFFE
+const TInt KSsNetworkError = 0xFFFE;
+//interval wait for ussd send
+const TInt KCallbackInterval = 1000000;
+// Interval wait for additional info
+const TInt KSSRequestCallbackInterval = 5000000;
+// Ss OperationCode value.
+const TInt KSsOperationShowFDNLIst = 0x05;
+const TInt KSsOperationPasswordRegistration = 0x06;
+// Ss error
+const TInt KSsSimAtkCcRejected = 0x13;
+const TInt KTwo = 2;
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSendSSHandler* CSendSSHandler::NewL( MSatUtils* aUtils )
+    {
+    LOG( SIMPLE, "SENDSS: CSendSSHandler::NewL calling" )
+
+    CSendSSHandler* self = new( ELeave ) CSendSSHandler;
+
+    CleanupStack::PushL( self );
+    self->BaseConstructL( aUtils );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "SENDSS: CSendSSHandler::NewL exiting" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CSendSSHandler::~CSendSSHandler()
+    {
+    LOG( SIMPLE, "SENDSS: CSendSSHandler::~CSendSSHandler calling" )
+
+    Cancel();
+    // Destroy all objects.
+    delete iAdditionalInfoHandler;
+    delete iRequestCompleteHandler;
+    delete iPhoneGsmHandlerBase;
+    delete iParser;
+    delete iResult;
+    delete iPhoneGsmOptionContainerBase;
+    if ( iTimer )
+        {
+        iTimer->Cancel();
+        delete iTimer;
+        iTimer = NULL;
+        }
+
+    LOG( SIMPLE, "SENDSS: CSendSSHandler::~CSendSSHandler exiting" )
+    }
+    
+// -----------------------------------------------------------------------------
+// Processes the SS Request Complete.
+// -----------------------------------------------------------------------------
+//
+void CSendSSHandler::DispatchSsRequestComplete( TInt aErrCode )
+    {
+    LOG2( SIMPLE, "SENDSS: CSendSSHandler::DispatchSsRequestComplete \
+    called aErrCode: %i", aErrCode )
+
+    if ( ( KSsGsmActiveSuccess == aErrCode ) ||
+         ( KSsGsmRegistered == aErrCode ) ||
+         ( KSsGsmProvisioned == aErrCode ) ||
+         ( KSsGsmQuiescent == aErrCode ) )
+        {
+        iSsResult = KErrNone;
+        }
+    else
+        {
+        iSsResult = aErrCode;
+        }
+
+    // Store result for later use
+    iSsResult = aErrCode;
+    iRequestCompleteArrived = ETrue;
+
+    //is additional info received
+    if ( iAdditionalInfoArrived )
+        {
+        LOG( SIMPLE, 
+        "SENDSS: CSendSSHandler::DispatchSsRequestComplete \
+        iAdditionalInfoArrived true" )
+        HandleSendSsResult();
+        }
+    else    //if not 5 second timer to get additional info
+        {
+        if ( !iTimer )
+            {
+            LOG( SIMPLE, 
+            "CSendSSHandler::DispatchSsRequestComplete iTimer false" )
+            TRAPD( err, iTimer = CPeriodic::NewL( CActive::EPriorityStandard ); );
+            
+            LOG2( NORMAL, "SENDSS: CSendSSHandler::DispatchSsRequestComplete \
+            CPeriodic::NewL err: %d ", err )              
+            if ( KErrNone == err )
+                {
+                iTimer->Start( KSSRequestCallbackInterval,
+                    KCallbackInterval, TCallBack( SSRequestCallback, this ) );
+                }
+            }
+        }
+
+    LOG( SIMPLE, "CSendSSHandler::DispatchSsRequestComplete exit" )
+    }
+
+// -----------------------------------------------------------------------------
+// Processes the SS aditional info.
+// -----------------------------------------------------------------------------
+//
+void CSendSSHandler::DispatchSsAdditionalInfo(
+    const TDesC& aAdditionalInfo )
+    {
+    LOG( SIMPLE, "SENDSS: CSendSSHandler::DispatchSsAdditionalInfo called" )
+
+    iAdditionalInfoArrived = ETrue;
+    iAdditionalInfo.Copy( aAdditionalInfo );
+    LOG2( SIMPLE, "SENDSS: CSendSSHandler::DispatchSsAdditionalInfo length of\
+    aAdditionalInfo: %i", aAdditionalInfo.Length())
+
+    if ( aAdditionalInfo.Length() > 0 )
+        {
+        // This is special case due tsy will not send request complete.
+        if ( ( ( KSsOperationPasswordRegistration == aAdditionalInfo[0] ) ||
+               ( KSsOperationShowFDNLIst == aAdditionalInfo[0] ) ) &&
+             ( !iRequestCompleteArrived ) )
+            {
+            LOG( SIMPLE, 
+            "SENDSS: CSendSSHandler::DispatchSsAdditionalInfo special case" )
+            iSsResult = KErrNone;
+            iRequestCompleteArrived = ETrue;
+            }
+        }
+
+    //is requestcompletenotification reveived
+    if ( iRequestCompleteArrived )
+        {
+        LOG( SIMPLE, 
+        "SENDSS: CSendSSHandler::DispatchSsAdditionalInfo \
+        iRequestCompleteArrived true" )
+        HandleSendSsResult();
+        }
+    else    //if not 5 second timer to get requestcompletenote
+        {
+        if ( !iTimer )
+            {
+            LOG( SIMPLE, 
+            "SENDSS: CSendSSHandler::DispatchSsAdditionalInfo iTimer false" )
+            TRAPD( err, iTimer = CPeriodic::NewL( CActive::EPriorityStandard ); );
+            
+            LOG2( NORMAL, "SENDSS: CSendSSHandler::DispatchSsAdditionalInfo \
+            CPeriodic::NewL err: %d ", err )            
+            if ( KErrNone == err )
+                {
+                iTimer->Start( KSSRequestCallbackInterval,
+                    KCallbackInterval, TCallBack( SSRequestCallback, this ) );
+                }
+            }
+        }
+
+    LOG( SIMPLE, "SENDSS: CSendSSHandler::DispatchSsAdditionalInfo exit" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class MSatCommand.
+// Response from the client.
+// -----------------------------------------------------------------------------
+//
+void CSendSSHandler::ClientResponse()
+    {
+    LOG( SIMPLE, "SENDSS: CSendSSHandler::ClientResponse calling" )
+
+    if ( iQueryRsp.iAccepted && !iNotificationSent )
+        {
+        LOG( NORMAL, 
+        "SENDSS: CSendSSHandler::ClientResponse Sending notification" )
+        iNotificationSent = ETrue;
+
+        // Register service request
+        TRAP_IGNORE( iUtils->RegisterServiceRequestL(
+            ESatSProactiveNotification,
+            ESatSProactiveNotificationResponse,
+            this ) )
+
+        // Send notification
+        iUtils->SatUiHandler().UiSession()->SendCommand(
+            &iNotificationDataPckg,
+            &iNotificationRspPckg,
+            ESatSProactiveNotification );
+        }
+    else if ( iNotificationRsp.iAccepted && iNotificationSent )
+        {
+        LOG( NORMAL, 
+        "SENDSS: CSendSSHandler::ClientResponse Notification response" )
+        }
+    else // User reject
+        {
+        iUserAccepted = EFalse;
+        // Cannot return KPCmdNotAcceptedByUser (ETSI 11.14 v8.3.0 p65)
+        iSendSsRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+        iSendSsRsp.iInfoType = RSat::KMeProblem;
+        iSendSsRsp.iAdditionalInfo.SetLength( 1 );
+        iSendSsRsp.iAdditionalInfo[0] = RSat::KScreenBusy;
+
+        if ( iQueryRsp.iSessionTerminatedByUser )
+            {
+            LOG( NORMAL, "SENDSS: CSendSSHandler::ClientResponse \
+            ESessionTerminatedByUser" )
+            // Notify sim session end command that next sim session end
+            // should close the ui session.
+            iUtils->NotifyEvent( MSatUtils::ESessionTerminatedByUser );
+            }
+
+        SendTerminalResponse();
+        }
+
+    // Release Wait
+    if ( iSendWait.IsStarted() )
+        {
+        LOG( NORMAL, "SENDSS: CSendSSHandler::ClientResponse stop iSendWait" )
+        iSendWait.AsyncStop();
+        }
+
+    LOG( SIMPLE, "SENDSS: CSendSSHandler::ClientResponse exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Waits for indication of user rejection
+// -----------------------------------------------------------------------------
+//
+void CSendSSHandler::Event( TInt aEvent )
+    {
+    LOG2( SIMPLE, "SENDSS: CSendSSHandler::Event calling, aEvent:%d", aEvent )
+
+    switch ( aEvent )
+        {
+        case MSatUtils::ECancelledUsingEndKey:
+            {
+            // Notify sim session end command that next sim session end
+            // should close the ui session.
+            iUtils->NotifyEvent( MSatUtils::ESessionTerminatedByUser );
+            // This event is handled as above, but notification must be done.
+            }
+            //lint -fallthrough intended here
+
+        case MSatUtils::ECommandCancelled:
+            {
+            // Check is there a confirmation on screen
+            if ( !iQueryOn || iNotificationSent )
+                {
+                LOG( SIMPLE, 
+                "SENDSS: CSendSSHandler::Event iNotificationSent true" )
+                // Cancel notification requests
+                iRequestCompleteHandler->Cancel();
+                iAdditionalInfoHandler->Cancel();
+
+                iSendSsRsp.iGeneralResult = RSat::KUssdTransactionTerminatedByUser;
+                iSendSsRsp.iInfoType = RSat::KNoAdditionalInfo;
+                iSendSsRsp.iAdditionalInfo.Zero();
+                SendTerminalResponse();
+                }
+            break;
+            }
+
+        default:
+            {
+            // Move event to base class
+            CSatCommandHandler::Event( aEvent );
+            }
+        }
+
+    LOG( SIMPLE, "SENDSS: CSendSSHandler::Event exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CActive.
+// Cancels the sat request.
+// -----------------------------------------------------------------------------
+//
+void CSendSSHandler::DoCancel()
+    {
+    LOG( SIMPLE, "SENDSS: CSendSSHandler::DoCancel calling" )
+
+    iUtils->USatAPI().NotifySendSsCancel();
+
+    LOG( SIMPLE, "SENDSS: CSendSSHandler::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Requests the command notification.
+// -----------------------------------------------------------------------------
+//
+void CSendSSHandler::IssueUSATRequest( TRequestStatus& aStatus )
+    {
+    LOG( SIMPLE, "SENDSS: CSendSSHandler::IssueUSATRequest calling" )
+
+    // Clear the IPC package.
+    new (&iSendSsData) RSat::TSendSsV1();
+    iQueryOn = EFalse;
+    iQueryRsp.iAccepted = EFalse; // default
+    iNotificationRsp.iAccepted = EFalse;
+    iSendSsRsp.iGeneralResult = RSat::KPSessionTerminatedByUser; // default
+    iSendSsRsp.iInfoType = RSat::KNoAdditionalInfo;
+    iSendSsRsp.iAdditionalInfo.Zero();
+
+    iUtils->USatAPI().NotifySendSs( aStatus, iSendSsPckg );
+
+    // Unregister from events
+    iUtils->UnregisterEvent( this, MSatUtils::ECommandCancelled );
+    iUtils->UnregisterEvent( this, MSatUtils::ECancelledUsingEndKey );
+
+    LOG( SIMPLE, "SENDSS: CSendSSHandler::IssueUSATRequest exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Precheck before executing the command.
+// -----------------------------------------------------------------------------
+//
+TBool CSendSSHandler::CommandAllowed()
+    {
+    LOG( SIMPLE, "SENDSS: CSendSSHandler::CommandAllowed calling" )
+
+    // Allow this command to send terminal response
+    iTerminalRespSent = EFalse;
+    RMobilePhone::TMobilePhoneRegistrationStatus registrationStatus(
+        iUtils->SystemState().GetNetworkRegistrationStatus() );
+
+    TBool commandAllowed( ETrue );
+
+    // icon without alpha id
+    if ( ( RSat::EAlphaIdProvided != iSendSsData.iAlphaId.iStatus ) &&
+         ( RSat::ESelfExplanatory == iSendSsData.iIconId.iQualifier ||
+           RSat::ENotSelfExplanatory == iSendSsData.iIconId.iQualifier ) )
+        {
+        iSendSsRsp.iGeneralResult = RSat::KCmdDataNotUnderstood;
+        iSendSsRsp.iInfoType = RSat::KNoAdditionalInfo;
+        iSendSsRsp.iAdditionalInfo.Zero();
+        commandAllowed = EFalse;
+        LOG( SIMPLE,
+            "SENDSS: CSendSSHandler::CommandAllowed icon without alpha id" )
+        }
+    else if ( ( RMobilePhone::ERegisteredOnHomeNetwork != registrationStatus ) &&
+        ( RMobilePhone::ERegisteredRoaming != registrationStatus ) )
+        {
+        iSendSsRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+        iSendSsRsp.iInfoType = RSat::KMeProblem;
+        iSendSsRsp.iAdditionalInfo.SetLength( 1 );
+        iSendSsRsp.iAdditionalInfo[0] = RSat::KNoService;
+        commandAllowed = EFalse;
+        LOG( SIMPLE,
+            "SENDSS: CSendSSHandler::CommandAllowed no service" )
+        }
+    // Set icon command flag whether icon data was received and set qualifier
+    // to no icon id
+    // To be removed when icons are allowed in this command
+    else if ( ( RSat::ESelfExplanatory ==
+        iSendSsData.iIconId.iQualifier ) ||
+        ( RSat::ENotSelfExplanatory ==
+        iSendSsData.iIconId.iQualifier ) )
+        {
+        LOG( SIMPLE,
+            "SENDSS: CSendSSHandler::CommandAllowed ENoIconId" )
+        iIconCommand = ETrue;
+        iSendSsData.iIconId.iQualifier = RSat::ENoIconId;
+        }
+    else
+        {
+        LOG( SIMPLE,
+            "SENDSS: CSendSSHandler::CommandAllowed others" )
+        iIconCommand = EFalse;
+        }
+
+    if ( !commandAllowed )
+        {
+        SendTerminalResponse();
+        LOG( SIMPLE, "SENDSS: CSendSSHandler::CommandAllowed not allowed" )
+        }
+
+    LOG( SIMPLE, "SENDSS: CSendSSHandler::CommandAllowed exiting" )
+    return commandAllowed;
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Answers for need of UI session.
+// -----------------------------------------------------------------------------
+//
+TBool CSendSSHandler::NeedUiSession()
+    {
+    LOG( SIMPLE, "SENDSS: CSendSSHandler::NeedUiSession calling" )
+
+    iNeedUiSession = !TransparentSsSending();
+
+    // Notify Cover UI if it's supported
+    if ( iNeedUiSession && iUtils->CoverUiSupported() )
+        {
+        TSatCommandData medEventData;
+        medEventData.iPCmdNumber = RSat::ESendSs;
+        medEventData.iAlphaId = iSendSsData.iAlphaId;
+        if ( iUtils->SystemState().IsConfirmSatOperationsOn() )
+            {
+            LOG( SIMPLE, 
+            "SENDSS: CSendSSHandler::NeedUiSession KSatLongDuration" )
+            medEventData.iDuration.iNumOfUnits = KSatLongDuration;
+            }
+        else
+            {
+            LOG( SIMPLE, 
+            "SENDSS: CSendSSHandler::NeedUiSession KSatDefaultDuration" )
+            medEventData.iDuration.iNumOfUnits = KSatDefaultDuration;
+            }
+        medEventData.iDuration.iTimeUnit = RSat::ESeconds;
+        medEventData.iIconID = iSendSsData.iIconId;
+        TSatCommandPckg tPckg( medEventData );
+        iUtils->RaiseSatEvent( tPckg );
+        }
+
+    LOG2( SIMPLE, "SENDSS: CSendSSHandler::NeedUiSession exiting,\
+    iNeedUiSession: %d", iNeedUiSession )
+    return iNeedUiSession;
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Called when USAT API notifies that command.
+// -----------------------------------------------------------------------------
+//
+void CSendSSHandler::HandleCommand()
+    {
+    LOG( SIMPLE, "SENDSS: CSendSSHandler::HandleCommand calling" )
+
+    iUtils->NotifyEvent( MSatUtils::ESendSsExecuting );
+
+    // This is true, by default
+    iUserAccepted = ETrue;
+
+    if ( iNeedUiSession )
+        {
+        LOG( SIMPLE, 
+        "SENDSS: CSendSSHandler::HandleCommand iNeedUiSession true" )
+        TRAP_IGNORE(
+        // Register to listen user cancel events:
+        // Cancel key event from dialog
+        iUtils->RegisterL( this, MSatUtils::ECommandCancelled );
+        // End key from dialog
+        iUtils->RegisterL( this, MSatUtils::ECancelledUsingEndKey ) )
+
+        // Build Qyery and Notify packages
+        // Has to be casted to TInt before casting to TSatIconQualifier, because
+        // GCC warns about the direct cast.
+        const struct TSatIconId iconId = { iSendSsData.iIconId.iIdentifier,
+            static_cast<TSatIconQualifier>(
+                static_cast<TInt>( iSendSsData.iIconId.iQualifier ) ) };
+
+        if ( RSat::EAlphaIdNotPresent == iSendSsData.iAlphaId.iStatus )
+            {
+            LOG( SIMPLE, 
+            "SENDSS: CSendSSHandler::HandleCommand EAlphaIdNotPresent" )
+            iQueryData.iAlphaIdStatus = ESatAlphaIdNotProvided;
+            iNotificationData.iAlphaIdStatus = ESatAlphaIdNotProvided;
+            }
+        else if ( RSat::EAlphaIdProvided == iSendSsData.iAlphaId.iStatus )
+            {
+            LOG( SIMPLE, 
+            "SENDSS: CSendSSHandler::HandleCommand EAlphaIdProvided" )
+            iQueryData.iAlphaIdStatus = ESatAlphaIdNotNull;
+            iNotificationData.iAlphaIdStatus = ESatAlphaIdNotNull;
+            }
+        else
+            {
+            LOG( SIMPLE, 
+            "SENDSS: CSendSSHandler::HandleCommand ESatAlphaIdNull" )
+            iQueryData.iAlphaIdStatus = ESatAlphaIdNull;
+            iNotificationData.iAlphaIdStatus = ESatAlphaIdNull;
+            }
+
+        iQueryData.iCommand = ESatSSendSsQuery;
+        iQueryData.iQueryText = iSendSsData.iAlphaId.iAlphaId;
+        iQueryData.iIconId = iconId;
+
+        iNotificationSent = EFalse;
+        iNotificationData.iCommand = ESatSSendSsNotify;
+        iNotificationData.iText = iSendSsData.iAlphaId.iAlphaId;
+        iNotificationData.iIconId = iconId;
+
+        MSatUiSession* uiSession = iUtils->SatUiHandler().UiSession();
+
+        // Send either query or notification
+        if ( iQueryOn )
+            {
+            LOG( NORMAL, 
+            "SENDSS: CSendSSHandler::HandleCommand Sending Query" )
+            iNotificationSent = EFalse;
+            // Register service request
+            TRAP_IGNORE( iUtils->RegisterServiceRequestL(
+                ESatSProactiveQuery,
+                ESatSProactiveQueryResponse,
+                this ) )
+
+            // Send query
+            uiSession->SendCommand(
+                &iQueryPckg,
+                &iQueryRspPckg,
+                ESatSProactiveQuery );
+            }
+        else
+            {
+            LOG( NORMAL, 
+            "SENDSS: CSendSSHandler::HandleCommand Sending notification" )
+            iNotificationSent = ETrue;
+
+            // Register service request
+            TRAP_IGNORE( iUtils->RegisterServiceRequestL(
+                ESatSProactiveNotification,
+                ESatSProactiveNotificationResponse,
+                this ) )
+
+            // Send notification
+            uiSession->SendCommand(
+                &iNotificationDataPckg,
+                &iNotificationRspPckg,
+                ESatSProactiveNotification );
+            }
+
+        if ( !iSendWait.IsStarted() )
+            {
+            LOG( NORMAL, 
+            "SENDSS: CSendSSHandler::HandleCommand start iSendWait" )
+            // Start waiting response from the user
+            iSendWait.Start();
+            }
+        }
+
+    if ( iUserAccepted )
+        {
+        LOG( NORMAL, 
+        "SENDSS: CSendSSHandler::HandleCommand iUserAccepted true" )
+        // Ready to send Ss string
+        TRAPD( err, SendSsStringL() )
+        if ( KErrNone != err )
+            {
+            LOG2( NORMAL, " Ss sending failed: %i", err )
+            iSendSsRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+            iSendSsRsp.iInfoType = RSat::KMeProblem;
+            iSendSsRsp.iAdditionalInfo.SetLength( 1 );
+            iSendSsRsp.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
+            SendTerminalResponse();
+            }
+        }
+
+    LOG( SIMPLE, "SENDSS: CSendSSHandler::HandleCommand exiting" )
+    }
+    
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Indicates the failure of launching ui client
+// -----------------------------------------------------------------------------
+//
+void CSendSSHandler::UiLaunchFailed()
+    {
+    LOG( SIMPLE, "SENDSS: CSendSSHandler::UiLaunchFailed calling" )
+
+    iSendSsRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+    iSendSsRsp.iInfoType = RSat::KMeProblem;
+    iSendSsRsp.iAdditionalInfo.SetLength( 1 );
+    iSendSsRsp.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
+    SendTerminalResponse();
+
+    LOG( SIMPLE, "SENDSS: CSendSSHandler::UiLaunchFailed exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+//lint -e{1403, 1769} Can not be initialized.
+CSendSSHandler::CSendSSHandler() :
+    CSatCommandHandler(),
+    iSendSsData(),
+    iSendSsPckg( iSendSsData ),
+    iSendSsRsp(),
+    iSendSsRspPckg( iSendSsRsp ),
+    iQueryData(),
+    iQueryPckg( iQueryData ),
+    iQueryRsp(),
+    iQueryRspPckg( iQueryRsp ),
+    iNotificationData(),
+    iNotificationDataPckg( iNotificationData ),
+    iNotificationRsp(),
+    iNotificationRspPckg( iNotificationRsp ),
+    // To be removed when icons are allowed in this command
+    iIconCommand( EFalse )
+    {
+    LOG( SIMPLE, "SENDSS: CSendSSHandler::CSendSSHandler calling - exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSendSSHandler::ConstructL()
+    {
+    LOG( SIMPLE, "SENDSS: CSendSSHandler::ConstructL calling" )
+
+    // Create additional info and request complete handlers
+    iAdditionalInfoHandler = CSatSendSsAdditionalInfoHandler::NewL(
+        *iUtils->CustomApi(), this );
+    iRequestCompleteHandler = CSatSendSsRequestCompleteHandler::NewL(
+        *iUtils->CustomApi(), this );
+    iPhoneGsmHandlerBase = new ( ELeave ) CSatSendSsHandler();
+
+    LOG( SIMPLE, "SENDSS: CSendSSHandler::ConstructL exiting" )
+    }
+    
+// -----------------------------------------------------------------------------
+// Handles the Ss string sending.
+// -----------------------------------------------------------------------------
+//
+void CSendSSHandler::SendSsStringL()
+    {
+    LOG( SIMPLE, "SENDSS: CSendSSHandler::SendSsString calling" )
+
+    // Set default values
+    iSsResult = KErrArgument;
+    iRequestCompleteArrived = EFalse;
+    iAdditionalInfoArrived = EFalse;
+
+    //Parsing and interpreting
+    TBuf<RSat::KStringMaxSize> sendMessage;
+    sendMessage.Copy( iSendSsData.iSsString.iSsString );
+
+    // CPhoneGsmOptionContainerBase cannot be deleted before SendSsString 
+    // complete, so the object is designed as a member in order that it can be 
+    // deleted asychronously.
+    iParser = PhoneGsmParser::CreateParserL();
+    iResult = PhoneGsmParser::CreateResultL();
+    iPhoneGsmOptionContainerBase = PhoneGsmParser::CreateOptionContainerL();
+
+    //Update options
+    iPhoneGsmOptionContainerBase->SetOptionStatus( KPhoneOptionSend, ETrue );
+
+    //Parsing and interpreting
+
+    //Parse string
+    if ( iParser->ParseL( sendMessage, *iResult, *iPhoneGsmOptionContainerBase ) )
+        {
+        if ( PhoneGsmParser::DetermineContentType( *iResult ) ==
+            PhoneGsmParser::EContentSupplementaryService )
+            {
+
+            if ( !iRequestCompleteHandler->IsActive() )
+                {
+                LOG( SIMPLE, 
+                "SENDSS: CSendSSHandler::SendSsString start \
+                iRequestCompleteHandler" )
+                iRequestCompleteHandler->Start();
+                }
+
+            if ( !iAdditionalInfoHandler->IsActive() )
+                {
+                LOG( SIMPLE, 
+                "SENDSS: CSendSSHandler::SendSsString start \
+                iAdditionalInfoHandler" )
+                iAdditionalInfoHandler->Start();
+                }
+
+            // Make a Default Additional Info here, in case additional
+            // info field won't be received
+            // the field is a dummy
+            iAdditionalInfo.SetLength( 1 );
+            iAdditionalInfo[0] = 0x00;
+
+            LOG( SIMPLE, 
+            "SENDSS: CSendSSHandler::SendSsString Processing Ss" )
+
+            // CPhoneGsmHandlerBase lives in all lifetime of 
+            // CSendSSHandler. So, it designed as a member.
+            iPhoneGsmHandlerBase->ProcessL( *iResult );
+            }
+        else
+            {
+            LOG( SIMPLE, 
+            "SENDSS: CSendSSHandler::SendSsString KCmdDataNotUnderstood" )
+            iSendSsRsp.iGeneralResult = RSat::KCmdDataNotUnderstood;
+            iSendSsRsp.iInfoType = RSat::KNoAdditionalInfo;
+            iSendSsRsp.iAdditionalInfo.Zero();
+
+            // Send terminal response
+            SendTerminalResponse();
+            }
+        }
+
+    LOG( SIMPLE, "SENDSS: CSendSSHandler::SendSsString exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Handles the result of Ss sending.
+// -----------------------------------------------------------------------------
+//
+void CSendSSHandler::HandleSendSsResult()
+    {
+    LOG( SIMPLE, "SENDSS: CSendSSHandler::HandleSendSsResult calling" )
+    LOG2( SIMPLE, 
+    "SENDSS: CSendSSHandler::HandleSendSsResult iSsResult: %i", iSsResult )
+    // Remove progress bar from the screen
+    if ( KSsServiceFailed == iSsResult || KSsNetworkError == iSsResult )
+        {
+        LOG( SIMPLE, 
+        "SENDSS: CSendSSHandler::HandleSendSsResult Clearing Progress bar.." )
+        iUtils->NotifyUiEvent( ESatSsEndEvent, ESatEventFailure, iSsResult );
+        // Send Error notification, but only if Alpha ID was provided
+	    if ( ESatAlphaIdNotNull == iNotificationData.iAlphaIdStatus )
+	        {
+	        LOG( SIMPLE, 
+	        "SENDSS: CSendSSHandler::HandleSendSsResult Sending Ss note: \
+	        Not Done" )
+	        iUtils->NotifyUiEvent( ESatSsErrorEvent, ESatEventFailure, 
+	        	iSsResult );
+	        }
+        }
+    else if ( iNotificationSent )
+        {
+        // Remove the UI dialog
+        LOG( SIMPLE, 
+        "SENDSS: CSendSSHandler::HandleSendSsResult iNotificationSent true" )
+        iUtils->NotifyUiEvent( ESatSsEndEvent, ESatEventCompleteOk, iSsResult );
+        }
+
+    switch ( iSsResult )
+        {
+        case KErrGeneral: // Command not processed
+            {
+            iSendSsRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+            iSendSsRsp.iInfoType = RSat::KMeProblem;
+            iSendSsRsp.iAdditionalInfo.SetLength( 1 );
+            iSendSsRsp.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
+            break;
+            }
+
+        case KErrArgument:
+            {
+            iSendSsRsp.iGeneralResult = RSat::KCmdDataNotUnderstood;
+            iSendSsRsp.iInfoType = RSat::KNoAdditionalInfo;
+            iSendSsRsp.iAdditionalInfo.Zero();
+            break;
+            }
+
+        case KSsServiceFailed:
+            {
+            //This is a special case, TSY sends error value in additional info
+            //when SS is rejected by Call control 
+            if ( KTwo <= iAdditionalInfo.Length() && 
+                KSsSimAtkCcRejected == iAdditionalInfo[1] )
+                {
+                LOG( SIMPLE, 
+                "SENDSS: CSendSSHandler::HandleSendSsResult \
+                KInteractionWithCCPermanentError" )
+                iSendSsRsp.iGeneralResult = 
+                    RSat::KInteractionWithCCPermanentError;
+                iSendSsRsp.iAdditionalInfo.SetLength( 1 );
+                iSendSsRsp.iAdditionalInfo[0] = RSat::KActionNotAllowed;	
+                }
+            else
+                {
+                LOG( SIMPLE, 
+                "SENDSS: CSendSSHandler::HandleSendSsResult KSsReturnError" )
+                iSendSsRsp.iGeneralResult = RSat::KSsReturnError;
+                iSendSsRsp.iAdditionalInfo.Copy( iAdditionalInfo );	
+                }
+            iSendSsRsp.iInfoType = RSat::KMeProblem;
+            break;
+            }
+
+        case KSsNetworkError:
+            {
+            iSendSsRsp.iGeneralResult = RSat::KNetworkUnableToProcessCmd;
+            iSendSsRsp.iInfoType = RSat::KSatNetworkErrorInfo;
+            iSendSsRsp.iAdditionalInfo.SetLength( 1 );
+            if ( iAdditionalInfo.Length() > 1 )
+                {
+                LOG( SIMPLE, 
+                "SENDSS: CSendSSHandler::HandleSendSsResult \
+                iAdditionalInfo.Length() > 1" )
+                iSendSsRsp.iAdditionalInfo[0] = \
+                    ( iAdditionalInfo[1] == RSat::KNoSpecificMeProblem ) \
+                    ? iAdditionalInfo[1] : ( iAdditionalInfo[1] | 0x80 );
+                }
+            else
+                {
+                iSendSsRsp.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
+                }
+            break;
+            }
+
+        default:
+            {
+            // Convert terminal rsp if icon used
+            iSendSsRsp.iGeneralResult = RSat::KSuccess;
+
+            // If command had icon data and was done succesfully,
+            // report that icon was not shown.
+            // To be removed and correct handling (i.e. ClientResponse to
+            // notification is received) for general result
+            // KSuccessRequestedIconNotDisplayed must be added when icons are
+            // allowed in this command 
+            if ( iIconCommand )
+                {
+                LOG( SIMPLE, 
+                "SENDSS: CSendSSHandler::HandleSendSsResult iIconCommand \
+                true" )
+                iSendSsRsp.iGeneralResult =
+                            RSat::KSuccessRequestedIconNotDisplayed;
+                }
+            
+            if ( iAdditionalInfo.Length() )
+                {
+                LOG( SIMPLE, 
+                "SENDSS: CSendSSHandler::HandleSendSsResult \
+                iAdditionalInfo.Length >0" )
+                iSendSsRsp.iInfoType = RSat::KSendSsInfo;
+                iSendSsRsp.iAdditionalInfo.Copy( iAdditionalInfo );
+                }
+            else
+                {
+                iSendSsRsp.iInfoType = RSat::KNoAdditionalInfo;
+                iSendSsRsp.iAdditionalInfo.Zero();
+                }
+
+            break;
+            }
+        }
+
+    delete iResult;
+    iResult = NULL;
+
+    delete iParser;
+    iParser = NULL;
+
+    delete iPhoneGsmOptionContainerBase;
+    iPhoneGsmOptionContainerBase = NULL;
+
+    iRequestCompleteHandler->Cancel();
+    iAdditionalInfoHandler->Cancel();
+
+    // Send terminal response
+    SendTerminalResponse();
+
+    LOG( SIMPLE, "SENDSS: CSendSSHandler::HandleSendSsResult exiting" )
+    }
+    
+// -----------------------------------------------------------------------------
+// SS sending should be transparent if alpha identifier is provided but it's
+// length is 0. Also user query setting is not on.
+// -----------------------------------------------------------------------------
+//
+TBool CSendSSHandler::TransparentSsSending()
+    {
+    LOG( SIMPLE, "SENDSS: CSendSSHandler::TransparentSsSending calling" )
+
+    TBool result( EFalse );
+    const RSat::TAlphaId alphaId( iSendSsData.iAlphaId );
+
+    // Store to member variable for later use
+    iQueryOn = iUtils->SystemState().IsConfirmSatOperationsOn();
+
+    if ( ( alphaId.iStatus == RSat::EAlphaIdProvided &&
+           alphaId.iAlphaId.Length() == 0 ) ||
+           alphaId.iStatus == RSat::EAlphaIdNull )
+        {
+        LOG( SIMPLE, 
+        "SENDSS: CSendSSHandler::TransparentSsSending EAlphaIdNull" )
+        if ( !iQueryOn )
+            {
+            LOG( SIMPLE, 
+            "SENDSS: CSendSSHandler::TransparentSsSending iQueryOn false" )
+            result = ETrue;
+            }
+        }
+
+    LOG2( SIMPLE, "SENDSS: CSendSSHandler::TransparentSsSending exiting: %i",
+        result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// Sends terminal response, if not yet sent
+// -----------------------------------------------------------------------------
+//
+void CSendSSHandler::SendTerminalResponse()
+    {
+    LOG( SIMPLE, "SENDSS: CSendSSHandler::SendTerminalResponse calling" )
+
+    if ( !iTerminalRespSent )
+        {
+        LOG( SIMPLE, 
+        "SENDSS: CSendSSHandler::SendTerminalResponse iTerminalRespSent false" )
+        iTerminalRespSent = ETrue;
+        iSendSsRsp.SetPCmdNumber( iSendSsData.PCmdNumber() );
+        TerminalRsp( RSat::ESendSs, iSendSsRspPckg );
+        }
+
+    // Delete timer in case it is still active
+    if ( iTimer )
+        {
+        LOG( SIMPLE, 
+        "SENDSS: CSendSSHandler::SendTerminalResponse iTimer true" )
+        iTimer->Cancel();
+        delete iTimer;
+        iTimer = NULL;
+        }
+
+    LOG( SIMPLE, "SENDSS: CSendSSHandler::SendTerminalResponse exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Callback for SendSS additionalinfo waiting timer.
+// -----------------------------------------------------------------------------
+//
+TInt CSendSSHandler::SSRequestCallback( TAny* aPtr )
+    {
+    LOG( SIMPLE, "SENDSS: CSendSSHandler::SSRequestCallback calling" )
+
+    CSendSSHandler* handler =
+        static_cast<CSendSSHandler*>( aPtr );
+
+    if ( handler )
+        {
+        LOG( SIMPLE, 
+        "SENDSS: CSendSSHandler::SSRequestCallback handler true" )
+        handler->HandleSendSsResult();
+
+        if ( handler->iTimer )
+            {
+            LOG( SIMPLE, 
+            "SENDSS: CSendSSHandler::SSRequestCallback cancel iTimer" )
+            handler->iTimer->Cancel();
+            delete handler->iTimer;
+            handler->iTimer = NULL;
+            }
+        }
+
+    LOG( SIMPLE, "SENDSS: CSendSSHandler::SSRequestCallback exiting" )
+    return ( KErrNone );
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendSSCmd/src/csatsendssadditionalinfohandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,155 @@
+/*
+* 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:  Handler for the SS Additional Info notification
+*
+*/
+
+
+#include    "csatsendssadditionalinfohandler.h"
+#include    "CSendSsHandler.h"
+#include    "SatLog.h"
+
+// ================= MEMBER FUNCTIONS ==========================================
+
+// The class constructor.
+CSatSendSsAdditionalInfoHandler::CSatSendSsAdditionalInfoHandler(
+    TInt aPriority, RMmCustomAPI& aPhone,
+    CSendSSHandler* aDispatcher )
+    : CActive( aPriority ), iPhone( aPhone ),
+    iDispatcher( aDispatcher )
+    {
+    LOG( SIMPLE,
+        "CSatSendSsAdditionalInfoHandler::CSatSendSsAdditionalInfoHandler \
+        calling" )
+
+    // Add to active scheduler
+    CActiveScheduler::Add( this );
+
+    LOG( SIMPLE,
+        "CSatSendSsAdditionalInfoHandler::CSatSendSsAdditionalInfoHandler \
+        exiting" )
+    }
+
+// Destructor
+CSatSendSsAdditionalInfoHandler::~CSatSendSsAdditionalInfoHandler()
+    {
+    LOG( SIMPLE,
+        "CSatSendSsAdditionalInfoHandler::~CSatSendSsAdditionalInfoHandler \
+        calling" )
+
+    // Cancel any outstanding requests.
+    Cancel();
+
+    iDispatcher = NULL;
+
+    LOG( SIMPLE,
+        "CSatSendSsAdditionalInfoHandler::~CSatSendSsAdditionalInfoHandler \
+        exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsAdditionalInfoHandler::NewL
+// -----------------------------------------------------------------------------
+//
+CSatSendSsAdditionalInfoHandler* CSatSendSsAdditionalInfoHandler::NewL(
+    RMmCustomAPI& aPhone, CSendSSHandler* aDispatcher )
+    {
+    LOG( SIMPLE, "CSatSendSsAdditionalInfoHandler::NewL calling" )
+
+    // Perform construction
+    CSatSendSsAdditionalInfoHandler* self =
+        new ( ELeave ) CSatSendSsAdditionalInfoHandler(
+            EPriorityStandard, aPhone, aDispatcher );
+
+    LOG( SIMPLE, "CSatSendSsAdditionalInfoHandler::NewL exiting" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsAdditionalInfoHandler::Start
+// Starts the handler.
+// -----------------------------------------------------------------------------
+//
+void CSatSendSsAdditionalInfoHandler::Start()
+    {
+    LOG( SIMPLE, "CSatSendSsAdditionalInfoHandler::Start calling" )
+
+    // Clear the IPC package
+    RMmCustomAPI::TSsAdditionalInfo temp;
+    iSsAdditionalInfo = temp;
+
+    if ( !IsActive() )
+        {
+        LOG( SIMPLE, "CSatSendSsAdditionalInfoHandler::Start set active" )
+        // Request the notification.
+        iPhone.SsAdditionalInfoNotification( iStatus, iSsAdditionalInfo );
+        // Set to active so that requests can be received.
+        SetActive();
+        }
+
+    LOG( SIMPLE, "CSatSendSsAdditionalInfoHandler::Start exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsAdditionalInfoHandler::RunL
+// Handles the command.
+// -----------------------------------------------------------------------------
+//
+void CSatSendSsAdditionalInfoHandler::RunL()
+    {
+    LOG( SIMPLE, "CSatSendSsAdditionalInfoHandler::RunL calling" )
+
+    TBuf16<RSat::KAdditionalInfoMaxSize> additionalInfo;
+    LOG2( SIMPLE, "CSatSendSsAdditionalInfoHandler::RunL iStatus: %d",
+          iStatus.Int() )
+    // Check the status of the asnychronous operation
+    if ( iStatus == KErrNone )
+        {
+        additionalInfo.Append( iSsAdditionalInfo.iOperationCode );
+        TInt i = 0;
+        while ( i < iSsAdditionalInfo.iAdditionalInfo.Length()
+            && additionalInfo.Length() < RSat::KAdditionalInfoMaxSize )
+            {
+            additionalInfo.Append( iSsAdditionalInfo.iAdditionalInfo[i++] );
+            }
+        LOG2( SIMPLE, "CSatSendSsAdditionalInfoHandler::RunL i: %d", i )
+        }
+
+    iDispatcher->DispatchSsAdditionalInfo( additionalInfo );
+
+    if ( KErrNone == iStatus.Int() )
+        {
+        // Renew the notification request.
+        Start();
+        }
+
+    LOG( SIMPLE, "CSatSendSsAdditionalInfoHandler::RunL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsAdditionalInfoHandler::DoCancel
+// Cancels the pending request.
+// -----------------------------------------------------------------------------
+//
+void CSatSendSsAdditionalInfoHandler::DoCancel()
+   {
+   LOG( SIMPLE, "CSatSendSsAdditionalInfoHandler::DoCancel calling" )
+
+   // Cancel the outstanding request.
+   iPhone.CancelAsyncRequest( ECustomSsAdditionalInfoNotificationIPC );
+
+   LOG( SIMPLE, "CSatSendSsAdditionalInfoHandler::DoCancel exiting" )
+   }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendSSCmd/src/csatsendssbarringnouiobs.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,170 @@
+/*
+* 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:  Send Ss barrings observer
+*
+*/
+
+
+#include    "csatsendssbarringnouiobs.h"
+#include    "SatLog.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// CSatSendSsBarringNoUiObs::CSatSendSsBarringNoUiObs
+// C++ default constructor can NOT contain any code, that might leave.
+// -----------------------------------------------------------------------------
+//
+CSatSendSsBarringNoUiObs::CSatSendSsBarringNoUiObs()
+    {
+    LOG( SIMPLE,
+        "SENDSS: CSatSendSsBarringNoUiObs::CSatSendSsBarringNoUiObs \
+        calling-exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsBarringNoUiObs::~CSatSendSsBarringNoUiObs
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CSatSendSsBarringNoUiObs::~CSatSendSsBarringNoUiObs()
+    {
+    LOG( SIMPLE,
+        "SENDSS: CSatSendSsBarringNoUiObs::~CSatSendSsBarringNoUiObs \
+        calling-exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsBarringNoUiObs::HandleBarringModeChangedL
+// Notification of barring mode change
+// -----------------------------------------------------------------------------
+//
+void CSatSendSsBarringNoUiObs::HandleBarringModeChangedL(
+    TBarringProgram aType,
+    TBarringStatus aStatus,
+    TBool aPlural )
+    {
+    LOG( SIMPLE,
+        "SENDSS: CSatSendSsBarringNoUiObs::HandleBarringModeChangedL calling" )
+
+    LOG2( DETAILED, "  Barring program: %i", aType )
+    LOG2( DETAILED, "  Barring status:  %i", aStatus )
+    LOG2( DETAILED, "  Plural:          %i", aPlural)
+
+    // Avoid warnigs about unused parameters.
+    aType = aType;
+    aStatus = aStatus;
+    aPlural = aPlural;
+
+    LOG( SIMPLE,
+        "SENDSS: CSatSendSsBarringNoUiObs::HandleBarringModeChangedL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsBarringNoUiObs::HandleBarringModeStatusL
+// Notification of barring mode status
+// -----------------------------------------------------------------------------
+//
+void CSatSendSsBarringNoUiObs::HandleBarringModeStatusL(
+    TUint8 aBsc[KPSetNumberOfBsc],
+    TBarringStatus aStatus )
+    {
+    LOG( SIMPLE,
+        "SENDSS: CSatSendSsBarringNoUiObs::HandleBarringModeStatusL calling" )
+
+    LOG2( DETAILED, "  Barring status:  %i", aStatus )
+
+    // To avoid warnigs about unused parameters
+    aBsc = aBsc;
+    aStatus = aStatus;
+
+    LOG( SIMPLE,
+        "SENDSS: CSatSendSsBarringNoUiObs::HandleBarringModeStatusL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsBarringNoUiObs::HandleBarringErrorL
+// Notification of errors in call barring requests
+// -----------------------------------------------------------------------------
+//
+void CSatSendSsBarringNoUiObs::HandleBarringErrorL(
+    TInt aReason )
+    {
+    LOG( SIMPLE,
+        "SENDSS: CSatSendSsBarringNoUiObs::HandleBarringErrorL calling" )
+
+    LOG2( DETAILED, "  Barring error: %i", aReason )
+
+    // To avoid warnigs about unused parameters
+    aReason = aReason;
+
+    LOG( SIMPLE,
+        "SENDSS: CSatSendSsBarringNoUiObs::HandleBarringErrorL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsBarringNoUiObs::HandleCBRequestingL
+// Notification of requesting
+// -----------------------------------------------------------------------------
+//
+void CSatSendSsBarringNoUiObs::HandleCBRequestingL(
+    TBool aOngoing, TBool aInterrupted )
+    {
+    LOG( SIMPLE,
+        "SENDSS: CSatSendSsBarringNoUiObs::HandleCBRequestingL calling" )
+
+    LOG2( DETAILED, "  ongoing: %i", aOngoing )
+    LOG2( DETAILED, "  interrupted: %i", aInterrupted )
+
+    // To avoid warnigs about unused parameters
+    aOngoing = aOngoing;
+    aInterrupted = aInterrupted;
+
+    LOG( SIMPLE,
+        "SENDSS: CSatSendSsBarringNoUiObs::HandleCBRequestingL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsBarringNoUiObs::CbPasswordChangedL
+// Notification relating to cb password change requests.
+// -----------------------------------------------------------------------------
+//
+void CSatSendSsBarringNoUiObs::CbPasswordChangedL(
+    TBool aSuccess )
+    {
+    LOG( SIMPLE,
+        "SENDSS: CSatSendSsBarringNoUiObs::CbPasswordChangedL calling" )
+
+    LOG2( DETAILED, "  success: %i", aSuccess )
+
+    // To avoid warnigs about unused parameters
+    aSuccess = aSuccess;
+
+    LOG( SIMPLE,
+        "SENDSS: CSatSendSsBarringNoUiObs::CbPasswordChangedL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsBarringNoUiObs::SetEngineContact
+// Notification relating to cb password change requests.
+// -----------------------------------------------------------------------------
+//
+ void CSatSendSsBarringNoUiObs::SetEngineContact(
+    MPsetCallBarring* /*aBarringEngine*/ )
+    {
+    LOG( SIMPLE,
+        "SENDSS: CSatSendSsBarringNoUiObs::SetEngineContact calling-exiting" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendSSCmd/src/csatsendsscallwaitingnouiobs.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,148 @@
+/*
+* 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:  Send Ss call waiting observer
+*
+*/
+
+
+#include    "csatsendsscallwaitingnouiobs.h"
+#include    "SatLog.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// CSatSendSsCallWaitingNoUiObs::CSatSendSsCallWaitingNoUiObs
+// C++ default constructor can NOT contain any code, that might leave.
+// -----------------------------------------------------------------------------
+//
+CSatSendSsCallWaitingNoUiObs::CSatSendSsCallWaitingNoUiObs()
+    {
+    LOG( SIMPLE,
+        "SENDSS: CSatSendSsCallWaitingNoUiObs::CSatSendSsCallWaitingNoUiObs \
+        calling-exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsCallWaitingNoUiObs::~CSatSendSsCallWaitingNoUiObs
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CSatSendSsCallWaitingNoUiObs::~CSatSendSsCallWaitingNoUiObs()
+    {
+    LOG( SIMPLE,
+        "SENDSS: CSatSendSsCallWaitingNoUiObs::~CSatSendSsCallWaitingNoUiObs \
+        calling-exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsCallWaitingNoUiObs::HandleCallWaitingGetStatusL
+// Notification of call waiting mode change
+// -----------------------------------------------------------------------------
+//
+void CSatSendSsCallWaitingNoUiObs::HandleCallWaitingGetStatusL(
+    MPsetCallWaiting::TGetCallWaitingStatus aStatus,
+    TUint8 aBsc[KPSetNumberOfBsc] )
+    {
+    LOG( SIMPLE,
+        "SENDSS: CSatSendSsCallWaitingNoUiObs::HandleCallWaitingGetStatusL \
+        calling" )
+    LOG2( DETAILED, "  call waiting status: %i", aStatus )
+
+    // Avoid warnigs about unused parameters
+    aStatus = aStatus;
+    aBsc = aBsc;
+
+    LOG( SIMPLE,
+        "SENDSS: CSatSendSsCallWaitingNoUiObs::HandleCallWaitingGetStatusL \
+        exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsCallWaitingNoUiObs::HandleCallWaitingChangedL
+// Notification of call waiting change
+// -----------------------------------------------------------------------------
+//
+void CSatSendSsCallWaitingNoUiObs::HandleCallWaitingChangedL(
+    MPsetCallWaiting::TSetCallWaiting aSetting,
+    TInt aResult )
+    {
+    LOG( SIMPLE,
+        "SENDSS: CSatSendSsCallWaitingNoUiObs::HandleCallWaitingChangedL \
+        calling" )
+
+    LOG2( DETAILED, "  call waiting status: %i", aSetting )
+    LOG2( DETAILED, "  result:              %i", aResult )
+
+    // Avoid warnigs about unused parameters
+    aSetting = aSetting;
+    aResult = aResult;
+
+    LOG( SIMPLE,
+        "SENDSS: CSatSendSsCallWaitingNoUiObs::HandleCallWaitingChangedL \
+        exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsCallWaitingNoUiObs::HandleCWErrorL
+// Notification of errors in call waitings
+// -----------------------------------------------------------------------------
+//
+void CSatSendSsCallWaitingNoUiObs::HandleCWErrorL( TInt aReason )
+    {
+    LOG( SIMPLE,
+        "SENDSS: CSatSendSsCallWaitingNoUiObs::HandleCWErrorL calling" )
+    LOG2( DETAILED, "  CallWaiting error: %i", aReason )
+
+    // Avoid warnigs about unused parameters
+    aReason = aReason;
+
+    LOG( SIMPLE,
+        "SENDSS: CSatSendSsCallWaitingNoUiObs::HandleCWErrorL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsCallWaitingNoUiObs::HandleCWRequestingL
+// Notification of requesting
+// -----------------------------------------------------------------------------
+//
+void CSatSendSsCallWaitingNoUiObs::HandleCWRequestingL(
+    TBool aOngoing, TBool aInterrupted )
+    {
+    LOG( SIMPLE,
+        "SENDSS: CSatSendSsCallWaitingNoUiObs::HandleCWRequestingL calling" )
+    LOG2( DETAILED, "  ongoing: %i", aOngoing )
+    LOG2( DETAILED, "  interrupted: %i", aInterrupted )
+
+    // Avoid warnigs about unused parameters
+    aOngoing = aOngoing;
+    aOngoing = aInterrupted;
+
+    LOG( SIMPLE,
+        "SENDSS: CSatSendSsCallWaitingNoUiObs::HandleCWRequestingL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsCallWaitingNoUiObs::SetEngineContact
+//
+// -----------------------------------------------------------------------------
+//
+void CSatSendSsCallWaitingNoUiObs::SetEngineContact(
+    MPsetCallWaiting& /*aEngineContact*/ )
+    {
+    LOG( SIMPLE,
+        "SENDSS: CSatSendSsCallWaitingNoUiObs::SetEngineContact \
+        calling-exiting" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendSSCmd/src/csatsendssclinouiobs.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,149 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Send Ss Cli observer
+*
+*/
+
+
+#include    "csatsendssclinouiobs.h"
+#include    "SatLog.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// CSatSendSsCliNoUiObs::CSatSendSsCliNoUiObs
+// C++ default constructor can NOT contain any code, that might leave.
+// -----------------------------------------------------------------------------
+//
+CSatSendSsCliNoUiObs::CSatSendSsCliNoUiObs()
+    {
+    LOG( SIMPLE,
+        "SENDSS: CSatSendSsCliNoUiObs::CSatSendSsCliNoUiObs calling-exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsCliNoUiObs::~CSatSendSsCliNoUiObs
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CSatSendSsCliNoUiObs::~CSatSendSsCliNoUiObs()
+    {
+    LOG( SIMPLE,
+        "SENDSS: CSatSendSsCliNoUiObs::~CSatSendSsCliNoUiObs calling-exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsCliNoUiObs::CliInformationL
+// Notification of Cli information
+// -----------------------------------------------------------------------------
+//
+void CSatSendSsCliNoUiObs::CliInformationL( TPsuiCli aType )
+    {
+    LOG( SIMPLE, "SENDSS: CSatSendSsCliNoUiObs::CliInformationL calling" )
+
+    LOG2( DETAILED, "  Type: %i", aType )
+
+    // Avoid warnigs about unused parameters
+    aType =  aType;
+
+    LOG( SIMPLE, "SENDSS: CSatSendSsCliNoUiObs::CliInformationL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsCliNoUiObs::HandleCliRequestingL
+// Notification of requesting
+// -----------------------------------------------------------------------------
+//
+void CSatSendSsCliNoUiObs::HandleCliRequestingL(
+    TBool aOngoing,
+    TBool aInterrupted )
+    {
+    LOG( SIMPLE, "SENDSS: CSatSendSsCliNoUiObs::HandleCliRequestingL calling" )
+
+    LOG2( DETAILED, "  ongoing: %i", aOngoing )
+    LOG2( DETAILED, "  interrupted: %i", aInterrupted )
+
+    // Avoid warnigs about unused parameters
+    aOngoing = aOngoing;
+    aInterrupted = aInterrupted;
+
+    LOG( SIMPLE, "SENDSS: CSatSendSsCliNoUiObs::HandleCliRequestingL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsCliNoUiObs::SetEngineContact
+//
+// -----------------------------------------------------------------------------
+//
+void CSatSendSsCliNoUiObs::SetEngineContact( MPsetCli* /*aEngine*/ )
+    {
+    LOG( SIMPLE,
+        "SENDSS: CSatSendSsCliNoUiObs::SetEngineContact calling-exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsCliNoUiObs::HandleCliStatusL
+// Notification of Cli status
+// -----------------------------------------------------------------------------
+//
+void CSatSendSsCliNoUiObs::HandleCliStatusL(
+    TUint8 aBsc[KPSetNumberOfBsc],
+    TPsuiCli aMode )
+    {
+    LOG( SIMPLE, "SENDSS: CSatSendSsCliNoUiObs::HandleCliStatusL calling" )
+
+    LOG2( DETAILED, "  Type: %i", aMode )
+
+    // Avoid warnigs about unused parameters
+    aBsc = aBsc;
+    aMode = aMode;
+
+    LOG( SIMPLE, "SENDSS: CSatSendSsCliNoUiObs::HandleCliStatusL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsCliNoUiObs::HandleCnapStatusL
+// Notification of the status of Cli if requested
+// -----------------------------------------------------------------------------
+//
+void CSatSendSsCliNoUiObs::HandleCnapStatusL( TInt aStatus )
+    {
+    LOG( SIMPLE, "SENDSS: CSatSendSsCliNoUiObs::HandleCnapStatusL calling" )
+
+    LOG2( DETAILED, "  status: %i", aStatus )
+
+    // Avoid warnigs about unused parameters
+    aStatus = aStatus;
+
+    LOG( SIMPLE, "SENDSS: CSatSendSsCliNoUiObs::HandleCnapStatusL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsCliNoUiObs::HandleCliErrorL
+// Notification of error in Cli handling
+// -----------------------------------------------------------------------------
+//
+void CSatSendSsCliNoUiObs::HandleCliErrorL( TInt aError )
+    {
+    LOG( SIMPLE, "SENDSS: CSatSendSsCliNoUiObs::HandleCliErrorL calling" )
+
+    LOG2( DETAILED, "  Cli error: %i", aError )
+
+    // Avoid warnigs about unused parameters
+    aError = aError;
+
+    LOG( SIMPLE, "SENDSS: CSatSendSsCliNoUiObs::HandleCliErrorL exiting" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendSSCmd/src/csatsendssdivertnouiobs.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,149 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Send Ss diverts observer
+*
+*/
+
+
+#include    "csatsendssdivertnouiobs.h"
+#include    "SatLog.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// CSatSendSsDivertNoUiObs::CSatSendSsDivertNoUiObs
+// C++ default constructor can NOT contain any code, that might leave.
+// -----------------------------------------------------------------------------
+//
+CSatSendSsDivertNoUiObs::CSatSendSsDivertNoUiObs()
+    {
+    LOG( SIMPLE,
+        "SENDSS: CSatSendSsDivertNoUiObs::CSatSendSsDivertNoUiObs \
+        calling-exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsDivertNoUiObs::~CSatSendSsDivertNoUiObs
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CSatSendSsDivertNoUiObs::~CSatSendSsDivertNoUiObs()
+    {
+    LOG( SIMPLE,
+        "SENDSS: CSatSendSsDivertNoUiObs::~CSatSendSsDivertNoUiObs \
+        calling-exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsDivertNoUiObs::HandleDivertingChangedL
+// Notification of diverting change
+// -----------------------------------------------------------------------------
+//
+void CSatSendSsDivertNoUiObs::HandleDivertingChangedL(
+    const TCallDivertSetting& aSetting,
+    TBool aPlural )
+    {
+    LOG( SIMPLE, "SENDSS: CSatSendSsDivertNoUiObs::HandleDivertingChangedL \
+    calling" )
+
+    LOG2( DETAILED, "  CallDivert setting Condition: %i",
+        aSetting.iCondition )
+    LOG2( DETAILED, "  CallDivert setting Setting: %i",
+        aSetting.iSetting )
+    LOG2( DETAILED, "  CallDivert setting Status: %i",
+        aSetting.iStatus )
+    LOG2( DETAILED, "  CallDivert setting Service group: %i",
+        aSetting.iServiceGroup )
+    LOG2( DETAILED, "  CallDivert setting Tel Number: %S",
+         &aSetting.iNumber )
+    LOG2( DETAILED, "  Plural:             %i",
+        aPlural )
+
+    // Avoid warnigs about unused parameters.
+    aPlural = aPlural;
+    aPlural = aSetting.iCondition;
+
+    LOG( SIMPLE, "SENDSS: CSatSendSsDivertNoUiObs::HandleDivertingChangedL \
+    exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsDivertNoUiObs::HandleDivertingStatusL
+// Notification of diverting status change
+// -----------------------------------------------------------------------------
+//
+void CSatSendSsDivertNoUiObs::HandleDivertingStatusL(
+    CMobilePhoneCFList&,
+    TBool )
+    {
+    LOG( SIMPLE,
+        "SENDSS: CSatSendSsDivertNoUiObs::HandleDivertingStatusL \
+        calling-exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsDivertNoUiObs::HandleDivertingErrorL
+// Notification of errors in diverts
+// -----------------------------------------------------------------------------
+//
+void CSatSendSsDivertNoUiObs::HandleDivertingErrorL( TInt aReason )
+    {
+    LOG( SIMPLE,
+        "SENDSS: CSatSendSsDivertNoUiObs::HandleDivertingErrorL calling" )
+
+    LOG2( DETAILED, "  Diverting error: %i", aReason )
+
+    // Avoid warnigs about unused parameters.
+    aReason = aReason;
+
+    LOG( SIMPLE,
+        "SENDSS: CSatSendSsDivertNoUiObs::HandleDivertingErrorL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsDivertNoUiObs::HandleCFRequestingL
+// Notification of requesting
+// -----------------------------------------------------------------------------
+//
+void CSatSendSsDivertNoUiObs::HandleCFRequestingL(
+    TBool aOngoing,
+    TBool aInterrupted )
+    {
+    LOG( SIMPLE,
+        "SENDSS: CSatSendSsDivertNoUiObs::HandleCFRequestingL calling" )
+
+    LOG2( DETAILED, "  ongoing: %i", aOngoing )
+    LOG2( DETAILED, "  interrupted: %i", aInterrupted )
+
+    // Avoid warnigs about unused parameters.
+    aOngoing = aOngoing;
+    aInterrupted = aInterrupted;
+
+    LOG( SIMPLE,
+        "SENDSS: CSatSendSsDivertNoUiObs::HandleCFRequestingL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsDivertNoUiObs::SetEngineContact
+//
+// -----------------------------------------------------------------------------
+//
+void CSatSendSsDivertNoUiObs::SetEngineContact(
+    MPsetCallDiverting* /*aDivertEngine*/ )
+    {
+    LOG( SIMPLE,
+        "SENDSS: CSatSendSsDivertNoUiObs::SetEngineContact calling-exiting" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendSSCmd/src/csatsendsshandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,573 @@
+/*
+* 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:  Process forwarding procedures.
+*
+*/
+
+#include "csatsendsshandler.h"
+#include <psetcallwaiting.h>
+#include <psetcontainer.h>
+#include <psetcallbarring.h>
+#include <psetcalldiverting.h>
+#include <psetcli.h>
+
+#include "csatsendssbarringnouiobs.h"
+#include "csatsendssdivertnouiobs.h"
+#include "csatsendsscallwaitingnouiobs.h"
+#include "csatsendssclinouiobs.h"
+
+#include    "SatLog.h"
+
+// ================= MEMBER FUNCTIONS ==========================================
+
+// Destructor
+CSatSendSsHandler::~CSatSendSsHandler()
+    {
+    delete iDivert;
+    delete iBarring;
+    delete iWaiting;
+    delete iCli;
+    delete iSettings;
+    delete iSatCwObserver;
+    delete iSatCbObserver;
+    delete iSatCliObserver;
+    delete iSatCfObserver;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsHandler::ProcessForwardingL
+// -----------------------------------------------------------------------------
+void CSatSendSsHandler::ProcessForwardingL(
+        TAction aAction,
+        TForwardingProcedure aForwarding,
+        const TDesC& aNumber,
+        const TDesC& aBasicCode,
+        const TDesC& aTimer )
+    {
+    LOG( SIMPLE, "CSatSendSsHandler::ProcessForwardingL calling" )
+
+    TBasicServiceGroups bsc = ChangeToBsc( aBasicCode );
+    ConnectToSsEngineL();
+
+    TCallDivertSetting setDivert;
+    setDivert.iNumber.Copy( aNumber );
+    setDivert.iServiceGroup = EServiceGroupVoice;
+    setDivert.iStatus = EDivertingStatusUnknown;
+    setDivert.iNoReplyTimer = 0;// all unconditional
+
+    LOG2( NORMAL, 
+    "CSatSendSsHandler::ProcessForwardingL aForwarding: %d", aForwarding )
+    switch ( aForwarding )
+        {
+        case EForwardingNotReachable:
+            {
+            LOG( NORMAL, 
+            "CSatSendSsHandler::ProcessForwardingL EForwardingNotReachable" )
+            setDivert.iCondition = EDivertConditionNotReachable;
+            break;
+            }
+
+        case EForwardingNoReply:
+            {
+            LOG( NORMAL, 
+            "CSatSendSsHandler::ProcessForwardingL EForwardingNoReply" )
+            if ( aTimer.Length() != 0 )
+                {
+                TLex input( aTimer );
+                User::LeaveIfError( input.Val( setDivert.iNoReplyTimer ) );
+                }
+            else
+                {
+                LOG( NORMAL, 
+                "CSatSendSsHandler::ProcessForwardingL iNoReplyTimer" )
+                setDivert.iNoReplyTimer = iDivert->GetTimerValueL();
+                }
+            setDivert.iCondition = EDivertConditionNoReply;
+            break;
+            }
+
+        case EForwardingBusy:
+            {
+            LOG( NORMAL, 
+            "CSatSendSsHandler::ProcessForwardingL EForwardingBusy" )
+            setDivert.iCondition = EDivertConditionBusy;
+            break;
+            }
+
+        case EForwardingUnconditional:
+            {
+            LOG( NORMAL, 
+            "CSatSendSsHandler::ProcessForwardingL EForwardingUnconditional" )
+            setDivert.iCondition = EDivertConditionUnconditional;
+            break;
+            }
+
+        case EForwardingAll:
+            {
+            LOG( NORMAL, 
+            "CSatSendSsHandler::ProcessForwardingL EForwardingAll" )
+            setDivert.iCondition = EDivertConditionAllCalls;
+            break;
+            }
+
+        case EForwardingAllConditional:
+            {
+            LOG( NORMAL, 
+            "CSatSendSsHandler::ProcessForwardingL \
+            EForwardingAllConditional" )
+            setDivert.iCondition = EDivertConditionAllConditionalCases;
+            break;
+            }
+
+        default:
+            {
+            LOG( NORMAL, 
+            "CSatSendSsHandler::ProcessForwardingL Unknown forwarding" )
+            break;
+            }
+        }
+
+    switch ( aAction )
+        {
+        case EActivate:
+            {
+            LOG( NORMAL, "CSatSendSsHandler::EActivate" )
+            setDivert.iSetting = EActivateDiverting;
+            iDivert->SetDivertingL( setDivert, bsc );
+            break;
+            }
+
+        case EDeactivate:
+            {
+            LOG( NORMAL, "CSatSendSsHandler::EDeactivate" )
+            setDivert.iSetting = ECancelDiverting;
+            iDivert->SetDivertingL( setDivert, bsc );
+            break;
+            }
+
+        case EInterrogate:
+            {
+            LOG( NORMAL, "CSatSendSsHandler::EInterrogate" )
+            iDivert->GetDivertingStatusL( EServiceGroupVoice,
+                setDivert.iCondition, bsc );
+            break;
+            }
+
+        case ERegister:
+            {
+            LOG( NORMAL, "CSatSendSsHandler::ERegister" )
+            setDivert.iSetting = ERegisterDiverting;
+            iDivert->SetDivertingL( setDivert, bsc );
+            break;
+            }
+
+        case EErase:
+            {
+            LOG( NORMAL, "CSatSendSsHandler::EErase" )
+            setDivert.iSetting = EEraseDiverting;
+            iDivert->SetDivertingL( setDivert, bsc );
+            break;
+            }
+
+        default:
+            {
+            LOG( NORMAL, "  Unknown action" )
+            break;
+            }
+        }
+
+    LOG( SIMPLE, "CSatSendSsHandler::ProcessForwardingL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsHandler::ProcessBarringL
+// -----------------------------------------------------------------------------
+void CSatSendSsHandler::ProcessBarringL(
+        TAction aAction,
+        TBarringProcedure aBarring,
+        const TDesC& aPassword,
+        const TDesC& aBasicCode )
+    {
+    LOG2( SIMPLE, "CSatSendSsHandler::ProcessBarringL calling, aBarring: %d",
+          aBarring )
+
+    TBasicServiceGroups bsc = ChangeToBsc( aBasicCode );
+    ConnectToSsEngineL();
+    TCallBarringSetting setBarring;
+    setBarring.iServiceGroup = EServiceGroupVoice;
+
+    setBarring.iPassword = aPassword;
+    switch ( aBarring )
+        {
+        case EBarringAllOutgoingCalls:
+            {
+            setBarring.iType = EBarringTypeAllOutgoing;
+            break;
+            }
+
+        case EBarringAllOutgoingInternationalCalls:
+            {
+            setBarring.iType = EBarringTypeOutgoingInternational;
+            break;
+            }
+
+        case EBarringAllOutgoingInternationalCallsExceptHome:
+            {
+            setBarring.iType = EBarringTypeOutgoingInternationalExceptToHomeCountry;
+            break;
+            }
+
+        case EBarringAllIncomingCalls:
+            {
+            setBarring.iType = EBarringTypeAllIncoming;
+            break;
+            }
+
+        case EBarringAllIncomingCallsWhenRoaming:
+            {
+            setBarring.iType = EBarringTypeIncomingWhenRoaming;
+            break;
+            }
+
+        case EBarringAllServices:
+            {
+            setBarring.iType = EBarringTypeAllServices;
+            break;
+            }
+
+        case EBarringAllOutgoingServices:
+            {
+            setBarring.iType = EBarringTypeAllOutgoingServices;
+            break;
+            }
+
+        case EBarringAllIncomingServices:
+            {
+            setBarring.iType = EBarringTypeAllIncomingServices;
+            break;
+            }
+
+        default:
+            {
+            break;
+            }
+        }
+    LOG2( SIMPLE, "CSatSendSsHandler::ProcessBarringL aAction: %d", aAction )
+    switch ( aAction )
+        {
+        case EActivate:
+            {
+            setBarring.iSetting = EActivateBarring;
+            iBarring->SetBarringL( setBarring, bsc );
+            break;
+            }
+
+        case EDeactivate:
+            {
+            setBarring.iSetting = ECancelBarring;
+            iBarring->SetBarringL( setBarring, bsc );
+            break;
+            }
+
+        case EInterrogate:
+            {
+            iBarring->GetBarringStatusL( EServiceGroupVoice, setBarring.iType );
+            break;
+            }
+
+        case ERegister:
+        case EErase:
+        default:
+            {
+            break;
+            }
+        }
+
+    LOG( SIMPLE, "CSatSendSsHandler::ProcessBarringL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsHandler::ProcessPasswordChangeL
+// -----------------------------------------------------------------------------
+void CSatSendSsHandler::ProcessPasswordChangeL(
+        TPasswordProcedure aPassword,
+        const TDesC& aOldPassword,
+        const TDesC& aNewPassword,
+        const TDesC& aVerifyNewPassword )
+    {
+    LOG( SIMPLE, "CSatSendSsHandler::ProcessPasswordChangeL calling" )
+
+    ConnectToSsEngineL();
+
+    //check the validity of aNewPassword and aVerifyNewPassword
+    if ( aNewPassword.Compare( aVerifyNewPassword ) != 0 )
+        {
+        LOG( SIMPLE, 
+        "CSatSendSsHandler::ProcessPasswordChangeL password error" )
+        // if not equal, show "PASSWORD ERROR"
+        iSatCbObserver->HandleBarringErrorL( 1 );
+        }
+    else
+        {
+        RMobilePhone::TMobilePhonePasswordChangeV2 passWords;
+        passWords.iOldPassword = aOldPassword;
+        passWords.iNewPassword = aNewPassword;
+        passWords.iVerifiedPassword = aVerifyNewPassword;
+        // if equal send to cpsetcallbarring
+        if ( aPassword == EPasswordBarring )
+            {
+            LOG( SIMPLE, 
+            "CSatSendSsHandler::ProcessPasswordChangeL EPasswordBarring" )
+            iBarring->ChangePasswordL( passWords, ETrue );
+            }
+        else
+            {
+            LOG( SIMPLE, 
+            "CSatSendSsHandler::ProcessPasswordChangeL others" )
+            iBarring->ChangePasswordL( passWords, EFalse );
+            }
+        }
+
+    LOG( SIMPLE, "CSatSendSsHandler::ProcessPasswordChangeL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsHandler::ChangeToBsc
+// -----------------------------------------------------------------------------
+TBasicServiceGroups CSatSendSsHandler::ChangeToBsc(
+    const TDesC& aBasicCode ) const
+    {
+    LOG( SIMPLE, "CSatSendSsHandler::ChangeToBsc calling" )
+
+    // Null values must be handled as well, length == 0
+    if ( aBasicCode.Length() == 0 )
+        {
+        LOG( SIMPLE, "CSatSendSsHandler::ChangeToBsc length is zero" )
+        return EAllTeleAndBearer;
+        }
+
+    TInt value = 0;
+    TLex input( aBasicCode );
+    input.Val( value );
+
+    // Presumed that the values given in aBasicCode are not acting violently
+    TBasicServiceGroups returnValue =
+        static_cast<TBasicServiceGroups>( value );
+
+    LOG( SIMPLE, "CSatSendSsHandler::ChangeToBsc exiting" )
+    return returnValue;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsHandler::ConnectToSsEngine
+// -----------------------------------------------------------------------------
+void CSatSendSsHandler::ConnectToSsEngineL()
+    {
+    LOG( SIMPLE, "CSatSendSsHandler::ConnectToSsEngineL calling" )
+
+    if ( !iSettings ) //create connection
+        {
+        LOG( SIMPLE, 
+        "CSatSendSsHandler::ConnectToSsEngineL iSettings false" )
+        //creates the containers
+        iSettings = CPsetContainer::NewL();
+
+        //call waiting engine
+        iSatCwObserver = new ( ELeave ) CSatSendSsCallWaitingNoUiObs();
+
+        iWaiting = iSettings->CreateCWObjectL( *iSatCwObserver );
+
+        //call barring engine
+        iSatCbObserver = new ( ELeave ) CSatSendSsBarringNoUiObs();
+
+        iBarring = iSettings->CreateCBObjectL( *iSatCbObserver );
+
+        iSatCliObserver = new ( ELeave ) CSatSendSsCliNoUiObs();
+
+        iCli = iSettings->CreateCliObjectL( *iSatCliObserver );
+
+        //call divert observer and engine
+        iSatCfObserver = new ( ELeave ) CSatSendSsDivertNoUiObs();
+
+        iDivert = iSettings->CreateCFObjectL( *iSatCfObserver );
+        }
+
+    LOG( SIMPLE, "CSatSendSsHandler::ConnectToSsEngineL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsHandler::Cancel
+// -----------------------------------------------------------------------------
+//
+void CSatSendSsHandler::Cancel()
+    {
+    LOG( SIMPLE, "CSatSendSsHandler::Cancel calling" )
+
+    if ( iWaiting )
+        {
+        iWaiting->CancelProcess();
+        }
+
+    if ( iBarring )
+        {
+        iBarring->CancelCurrentRequest();
+        }
+
+    if ( iCli )
+        {
+        iCli->CancelAll();
+        }
+
+    if ( iDivert )
+        {
+        iDivert->CancelCurrentRequest();
+        }
+
+    LOG( SIMPLE, "CSatSendSsHandler::Cancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsHandler::ProcessWaitingL
+// -----------------------------------------------------------------------------
+void CSatSendSsHandler::ProcessWaitingL(
+        TAction aAction,
+        const TDesC& aBasicCode )
+    {
+    LOG2( SIMPLE, "CSatSendSsHandler::ProcessWaitingL calling,aAction: %d",
+          aAction )
+
+    TBasicServiceGroups bsc = ChangeToBsc( aBasicCode );
+    ConnectToSsEngineL();
+
+    switch ( aAction )
+        {
+        case EActivate:
+            {
+            iWaiting->SetCallWaitingL( MPsetCallWaiting::EActivateCallWaiting,
+                bsc );
+            break;
+            }
+
+        case EDeactivate:
+            {
+            iWaiting->SetCallWaitingL( MPsetCallWaiting::EDeactivateCallWaiting,
+                bsc );
+            break;
+            }
+
+        case EInterrogate:
+            {
+            iWaiting->GetCallWaitingStatusL();
+            break;
+            }
+
+        case ERegister:
+        case EErase:
+        default:
+            {
+            break;
+            }
+        }
+
+    LOG( SIMPLE, "CSatSendSsHandler::ProcessWaitingL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsHandler::ProcessClipStatusL
+// -----------------------------------------------------------------------------
+void CSatSendSsHandler::ProcessClipStatusL()
+    {
+    LOG( SIMPLE, "CSatSendSsHandler::ProcessClipStatusL calling" )
+
+    ConnectToSsEngineL();
+    iCli->GetClipModeL();
+
+    LOG( SIMPLE, "CSatSendSsHandler::ProcessClipStatusL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsHandler::ProcessClirStatusL
+// -----------------------------------------------------------------------------
+void CSatSendSsHandler::ProcessClirStatusL()
+    {
+    LOG( SIMPLE, "CSatSendSsHandler::ProcessClirStatusL calling" )
+
+    ConnectToSsEngineL();
+    iCli->GetClirModeL();
+
+    LOG( SIMPLE, "CSatSendSsHandler::ProcessClirStatusL calling" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsHandler::ProcessColpStatusL
+// -----------------------------------------------------------------------------
+void CSatSendSsHandler::ProcessColpStatusL()
+    {
+    LOG( SIMPLE, "CSatSendSsHandler::ProcessColpStatusL calling" )
+
+    ConnectToSsEngineL();
+    iCli->GetColpModeL();
+
+    LOG( SIMPLE, "CSatSendSsHandler::ProcessColpStatusL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsHandler::ProcessColrStatusL
+// -----------------------------------------------------------------------------
+void CSatSendSsHandler::ProcessColrStatusL()
+    {
+    LOG( SIMPLE, "CSatSendSsHandler::ProcessColrStatusL calling" )
+
+    ConnectToSsEngineL();
+    iCli->GetColrModeL();
+
+    LOG( SIMPLE, "CSatSendSsHandler::ProcessColrStatusL exiting " )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsHandler::ProcessCnapStatusL
+// -----------------------------------------------------------------------------
+void CSatSendSsHandler::ProcessCnapStatusL()
+    {
+    LOG( SIMPLE, "CSatSendSsHandler::ProcessCnapStatusL calling" )
+
+    ConnectToSsEngineL();
+    iCli->GetCnapL();
+
+    LOG( SIMPLE, "CSatSendSsHandler::ProcessCnapStatusL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsHandler::RequestComplete
+// -----------------------------------------------------------------------------
+void CSatSendSsHandler::RequestComplete()
+    {
+    LOG( SIMPLE, "CSatSendSsHandler::RequestComplete calling - exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsHandler::RequestStatusChanged
+// -----------------------------------------------------------------------------
+void CSatSendSsHandler::RequestStatusChanged( TInt aNewStatus )
+    {
+    LOG( SIMPLE, "CSatSendSsHandler::RequestStatusChanged calling" )
+
+    TInt status = aNewStatus;
+    status = status;
+    LOG2( SIMPLE, "   RequestStatusChanged (%i)", status )
+
+    LOG( SIMPLE, "CSatSendSsHandler::RequestStatusChanged exiting" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendSSCmd/src/csatsendssrequestcompletehandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,137 @@
+/*
+* 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:  Handler for the SS Request Complete notification
+*
+*/
+
+
+#include    "CSendSsHandler.h"
+#include    "csatsendssrequestcompletehandler.h"
+#include    "SatLog.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// The class constructor.
+CSatSendSsRequestCompleteHandler::CSatSendSsRequestCompleteHandler(
+    TInt aPriority, RMmCustomAPI& aPhone,
+    CSendSSHandler* aDispatcher )
+    : CActive( aPriority ), iPhone( aPhone ),
+    iDispatcher( aDispatcher )
+    {
+    LOG( SIMPLE,
+        "CSatSendSsRequestCompleteHandler::CSatSendSsRequestCompleteHandler \
+        calling" )
+
+    // Add to active scheduler
+    CActiveScheduler::Add( this );
+
+    LOG( SIMPLE,
+        "CSatSendSsRequestCompleteHandler::CSatSendSsRequestCompleteHandler \
+        exiting" )
+    }
+
+// Two-phased constructor.
+CSatSendSsRequestCompleteHandler* CSatSendSsRequestCompleteHandler::NewL(
+    RMmCustomAPI& aPhone, CSendSSHandler* aDispatcher )
+    {
+    LOG( SIMPLE, "CSatSendSsRequestCompleteHandler::NewL calling" )
+
+    // Perform construction
+    CSatSendSsRequestCompleteHandler* self =
+        new ( ELeave ) CSatSendSsRequestCompleteHandler(
+            EPriorityLow, aPhone, aDispatcher );
+
+    LOG( SIMPLE, "CSatSendSsRequestCompleteHandler::NewL exiting" )
+    return self;
+    }
+
+// Destructor
+CSatSendSsRequestCompleteHandler::~CSatSendSsRequestCompleteHandler()
+    {
+    LOG( SIMPLE,
+        "CSatSendSsRequestCompleteHandler::~CSatSendSsRequestCompleteHandler \
+        calling" )
+
+    // Cancel any outstanding requests.
+    Cancel();
+
+    LOG( SIMPLE,
+        "CSatSendSsRequestCompleteHandler::~CSatSendSsRequestCompleteHandler \
+        exiting" )
+    iDispatcher = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsRequestCompleteHandler::Start
+// Starts the handler.
+// -----------------------------------------------------------------------------
+//
+void CSatSendSsRequestCompleteHandler::Start()
+    {
+    LOG( SIMPLE, "CSatSendSsRequestCompleteHandler::Start calling" )
+
+    if ( !IsActive() )
+        {
+        LOG( SIMPLE, "CSatSendSsRequestCompleteHandler::Start set active" )
+        // Request the notification.
+        iPhone.SsRequestCompleteNotification( iStatus, iSsStatus );
+        // Set to active so that requests can be received.
+        SetActive();
+        }
+
+    LOG( SIMPLE, "CSatSendSsRequestCompleteHandler::Start exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsRequestCompleteHandler::RunL
+// Handles the command.
+// -----------------------------------------------------------------------------
+//
+void CSatSendSsRequestCompleteHandler::RunL()
+    {
+    LOG( SIMPLE, "CSatSendSsRequestCompleteHandler::RunL calling" )
+
+    // Check the status of the asnychronous operation
+    if ( iStatus == KErrNone )
+        {
+        LOG( NORMAL, " iStatus == KErrNone" )
+        iDispatcher->DispatchSsRequestComplete( iSsStatus );
+        // Renew the notification request.
+        Start();
+        }
+    else
+        {
+        LOG2( NORMAL, "  iStatus == %i", iStatus.Int() )
+        iDispatcher->DispatchSsRequestComplete( KErrGeneral );
+        }
+
+    LOG( SIMPLE, "CSatSendSsRequestCompleteHandler::RunL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSendSsRequestCompleteHandler::DoCancel
+// Cancels the pending request.
+// -----------------------------------------------------------------------------
+//
+void CSatSendSsRequestCompleteHandler::DoCancel()
+   {
+   LOG( SIMPLE, "CSatSendSsRequestCompleteHandler::DoCancel calling" )
+
+   // Cancel the outstanding request.
+   iPhone.CancelAsyncRequest( ECustomNotifySsRequestCompleteIPC );
+
+   LOG( SIMPLE, "CSatSendSsRequestCompleteHandler::DoCancel exiting" )
+   }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendSSCmd/src/std.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 functions
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    <implementationproxy.h>
+#include    "CSendSsHandler.h"
+
+// CONSTANTS
+
+const TImplementationProxy implementationTable[] =
+    {
+    //lint -e{611,1924} Warning "Suspicious cast" can not be avoided.
+    IMPLEMENTATION_PROXY_ENTRY( 0x1000a885, CSendSSHandler::NewL )
+    };
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy ECOM framework factory function
+// Calculates the number of implementations.
+// Returns: Implementation proxy.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount ) // Number of implementations
+    {
+    aTableCount =
+        sizeof( implementationTable ) /
+        sizeof( TImplementationProxy );
+    return implementationTable;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendSmCmd/group/SendSmCmd.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* 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:  Project definition file for project SendSm plug-in
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../../inc/SatMacroes.h"
+
+TARGET                  SendSmCmd.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D 0x1000F020
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  std.cpp
+SOURCE                  CSendSmHandler.cpp
+SOURCE                  CSatSSendMessageNoLoggingHandler.cpp
+
+START RESOURCE          1000f020.rss
+TARGET                  SendSmCmd.rsc
+END
+
+USERINCLUDE             ../../../inc
+USERINCLUDE             ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+SYSTEMINCLUDE           ../../../../../inc      // Domain telephony
+SYSTEMINCLUDE           ../../../../inc         // Subsystem satengine
+
+LIBRARY                 euser.lib
+LIBRARY                 etelsat.lib
+LIBRARY                 SatEngine.lib
+
+#ifdef ENABLE_SAT_LOGGING
+LIBRARY                 flogger.lib
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendSmCmd/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 SendSm plug-in
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+SendSmCmd.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendSmCmd/inc/CSatSSendMessageNoLoggingHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,111 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This is the handler for the SIM Application Toolkit
+*                Send Message No
+*
+*/
+
+
+#ifndef CSATSSENDMESSAGENOLOGGINGHANDLER_H
+#define CSATSSENDMESSAGENOLOGGINGHANDLER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <etelsat.h>
+
+// FORWARD DECLARATIONS
+class MSatApi;
+class MSatSmsObserver;
+
+
+// CLASS DECLARATION
+
+/**
+*  This is the handler for the Send Message No Logging.
+*  This active object is registered with ETel SAT Api to receive notifications
+*  about the completion of Send SMS message
+*
+*  @lib SendSmCmd.lib
+*  @since Series 60 3.0
+*/
+class CSatSSendMessageNoLoggingHandler : public CActive
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aSatApi Reference to Sat api.
+        * @param aObserver Observer of the sms end event.
+        */
+        static CSatSSendMessageNoLoggingHandler* NewL(
+            MSatApi& aSatApi,
+            MSatSmsObserver& aObserver );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSatSSendMessageNoLoggingHandler();
+
+    public: // New functions
+
+        /**
+        * Starts listening for the Sat command.
+        * @param aSendSmData Data of the proactive SendSm command.
+        */
+        void Start( const RSat::TSendSmV1& aSendSmData );
+
+    protected: // Functions from base classes
+
+        /**
+        * From CActive, handles the request completion.
+        */
+        void RunL();
+
+        /**
+        * From CActive, implements the cancel protocol.
+        */
+        void DoCancel();
+
+    private: // Constructors
+
+        /**
+        * C++ default constructor.
+        * @param aSatApi Reference to Sat api.
+        * @param aObserver Observer of the sms end event.
+        */
+        CSatSSendMessageNoLoggingHandler(
+            MSatApi& aSatApi,
+            MSatSmsObserver& aObserver );
+
+    private: // Data
+
+        // The data structure for the command data.
+        RSat::TSatSmsV1 iSmsData;
+
+        // The data package for IPC.
+        RSat::TSatSmsV1Pckg iSmsPckg;
+
+        // Sat api.
+        MSatApi& iSatApi;
+
+        // Observer of the sms sending
+        MSatSmsObserver& iObserver;
+
+        // Reference to SMS message.
+        TUint16 iMessageRef;
+    };
+
+#endif      // CSATSSENDMESSAGENOLOGGINGHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendSmCmd/inc/CSendSmHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,253 @@
+/*
+* 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:  SendSm command handler
+*
+*/
+
+
+#ifndef CSENDSMHANDLER_H
+#define CSENDSMHANDLER_H
+
+#include <etelsat.h>
+
+#include "CSatCommandHandler.h"
+#include "SatSTypes.h"
+#include "MSatSmsObserver.h"
+
+class MSatUtils;
+class CSatSSendMessageNoLoggingHandler;
+
+/**
+*  Command handler for SendSm command.
+*
+*  @lib SendSmCmd.lib
+*  @since S60 v3.0
+*/
+class CSendSmHandler : public CSatCommandHandler,
+                       public MSatSmsObserver
+    {
+    
+public:
+
+    static CSendSmHandler* NewL( MSatUtils* aUtils );
+
+    virtual ~CSendSmHandler();
+
+// from base class MSatCommand
+
+    /**
+     * From MSatCommand. 
+     * Query response.
+     *
+     */
+    void ClientResponse();
+    
+// from base class MSatSmsObserver
+
+    /**
+     * From MSatEventObserver.
+     * Event notification
+     *
+     * @param aEvent An event that is occured.
+     */
+    void Event( TInt aEvent );
+
+    /**
+     * From MSatSmsObserver.
+     * Notification that sms was sent.
+     *
+     * @param aErrorCode Error code indicating a possible error.
+     */
+    void SmsSent( TInt aErrorCode );
+
+
+protected:
+
+    /**
+     * Sets the sca number to the iSendSmData.
+     *
+     * @param aScaNumber SCA number.
+     * @return Boolean indicating SCA number successfully set.
+     */
+    TBool SetScaNumber( const RSat::TSatTelNumber& aScaNumber );
+    
+// from base class CActive
+
+    /**
+     * From CActive
+     * Cancels the usat request.
+     *
+     */
+    void DoCancel();
+
+// from base class CSatCommandHandler
+
+    /**
+     * From CSatCommandHandler
+     * Requests the command notification.
+     *
+     * @param aStatus Request status to active object notification
+     */
+    void IssueUSATRequest( TRequestStatus& aStatus );
+
+    /**
+     * From CSatCommandHandler
+     * Precheck before executing the command.
+     *
+     * @return Boolean indicating is this command allowed to execute.
+     */
+    TBool CommandAllowed();
+
+    /**
+     * From CSatCommandHandler
+     * Need for ui session.
+     *
+     * @return Boolean indicating does this command need UI session.
+     */
+    TBool NeedUiSession();
+
+    /**
+     * From CSatCommandHandler
+     * Called when USAT API notifies that command.
+     *
+     */
+    void HandleCommand();
+
+    /**
+     * From CSatCommandHandler
+     * Called when UI launch fails
+     *
+     */
+    void UiLaunchFailed();
+
+private:
+
+    CSendSmHandler();
+
+    void ConstructL();
+
+    /**
+     * Checks is the command transparent or not
+     *
+     */
+    TBool TransparentSmsSending() const;
+
+    /**
+     * Checks is the SCA available
+     *
+     */
+    TBool IsSCAAvailable();
+
+private: // data
+
+    /**
+     * SendSm command data.
+     */
+    RSat::TSendSmV1 iSendSmData;
+
+    /**
+     * SendSm command package.
+     */
+    RSat::TSendSmV1Pckg iSendSmPckg;
+
+    /**
+     * SendSm response data
+     */
+    RSat::TSendSmRspV1 iSendSmRsp;
+
+    /**
+     * SendSm response package.
+     */
+    RSat::TSendSmRspV1Pckg iSendSmRspPckg;
+
+    /**
+     * Query command data.
+     */
+    TSatQueryV1 iQueryData;
+
+    /**
+     * Query package.
+     */
+    TSatQueryV1Pckg iQueryPckg;
+
+    /**
+     * Query response.
+     */
+    TSatQueryRspV1 iQueryRsp;
+
+    /**
+     * Query rsp package.
+     */
+    TSatQueryRspV1Pckg iQueryRspPckg;
+
+    /**
+     * SendSm notification send data
+     */
+    TSatNotificationV1 iNotificationData;
+
+    /**
+     * SendSm notification package
+     */
+    TSatNotificationV1Pckg iNotificationDataPckg;
+
+    /**
+     * SendSm notification Response data
+     */
+    TSatNotificationRspV1 iNotificationRsp;
+
+    /**
+     * SendSm notification Response package
+     */
+    TSatNotificationRspV1Pckg iNotificationRspPckg;
+
+    /**
+     * Is MoSmControl active.
+     */
+    TBool iMoSmControlActive;
+
+    /**
+     * Message sender.
+     */
+    CSatSSendMessageNoLoggingHandler* iMsgSender;
+
+    /**
+     * Indicates does this command need UI session ot not
+     */
+    TBool iNeedUiSession;
+
+    /**
+     * Indicates if KPartialComprehension is needed instead of KSuccess
+     */
+    TBool iPartialComprehension;
+
+    /**
+     * Indicates is SCA number available at all
+     */
+    TBool iSCANumberAvailable;
+
+    /**
+     * Indicates is notification already sent
+     */
+    TBool iNotificationSent;
+        
+    /**
+     * Flag to signal that command has icon data
+     * To be removed when icons are allowed in this command
+     */
+    TBool iIconCommand;
+
+    };
+
+#endif      // CSENDSMHANDLER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendSmCmd/inc/MSatSmsObserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 the sms event
+*
+*/
+
+
+
+#ifndef MSATSMSOBSERVER_H
+#define MSATSMSOBSERVER_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// CLASS DECLARATION
+
+/**
+*  Observer for send sms event.
+*
+*  @lib SendSmCmd.lib
+*  @since Series 60 3.0
+*/
+class MSatSmsObserver
+    {
+    protected:  // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        MSatSmsObserver() {};
+
+        /**
+        * Destructor.
+        */
+        virtual ~MSatSmsObserver() {};
+
+    public: // New functions
+
+        /**
+        * Notification of sms sent event.
+        * @param aErrorCode Error code.
+        */
+        virtual void SmsSent( TInt aErrorCode ) = 0;
+
+    private:
+
+        // Prohibit copy constructor if not deriving from CBase.
+        MSatSmsObserver( const MSatSmsObserver& );
+
+        // Prohibit assigment operator if not deriving from CBase.
+        MSatSmsObserver& operator=( const MSatSmsObserver& );
+
+    };
+
+#endif      // MSATSMSOBSERVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendSmCmd/inc/SendSmCmd.rls	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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 headers for project SendSmCmd
+*
+*/
+
+
+#ifndef SENDSMCMD_RLS
+#define SENDSMCMD_RLS
+
+rls_string STRING_r_sendsmcmd_display_name "SendSm command"
+rls_string STRING_r_sendsmcmd_default_data "SendSmCmd"
+rls_string STRING_r_sendsmcmd_opaque_data  ""
+
+#endif // SENDSMCMD_RLS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendSmCmd/src/1000f020.rss	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 1000 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Registry information for ECOM
+*
+*/
+
+
+
+//  INCLUDES
+#include <registryinfo.rh>
+#include "SendSmCmd.rls"
+
+//  RESOURCE DEFINITIONS
+// -----------------------------------------------------------------------------
+//
+// SendSmCmdInfo
+// Registeration information for ECOM
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO SendSmCmdInfo
+    {
+    dll_uid = 0x1000f020;
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x1000f001;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x1000f021;
+                    version_no   = 1;
+                    display_name = STRING_r_sendsmcmd_display_name;
+                    default_data = STRING_r_sendsmcmd_default_data;
+                    opaque_data  = STRING_r_sendsmcmd_opaque_data;
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendSmCmd/src/CSatSSendMessageNoLoggingHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,145 @@
+/*
+* 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:  This is the handler for the SIM Application Toolkit
+*                Send Message No logging.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    "MSatApi.h"
+#include    "CSatSSendMessageNoLoggingHandler.h"
+#include    "MSatSmsObserver.h"
+#include    "SatLog.h"
+
+// ================= MEMBER FUNCTIONS ==========================================
+
+// -----------------------------------------------------------------------------
+// CSatSSendMessageNoLoggingHandler::CSatSSendMessageNoLoggingHandler
+// The class constructor.
+// -----------------------------------------------------------------------------
+//
+CSatSSendMessageNoLoggingHandler::CSatSSendMessageNoLoggingHandler(
+    MSatApi& aSatApi,
+    MSatSmsObserver& aObserver ) :
+    CActive( CActive::EPriorityStandard ),
+    iSmsData(),
+    iSmsPckg( iSmsData ),
+    iSatApi( aSatApi ),
+    iObserver( aObserver )
+    {
+    LOG( SIMPLE, "SENDSM: CSatSSendMessageNoLoggingHandler::\
+        CSatSSendMessageNoLoggingHandler calling" )
+
+    CActiveScheduler::Add( this );
+
+    LOG( SIMPLE, "SENDSM: CSatSSendMessageNoLoggingHandler::\
+        CSatSSendMessageNoLoggingHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSSendMessageNoLoggingHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatSSendMessageNoLoggingHandler* CSatSSendMessageNoLoggingHandler::NewL(
+    MSatApi& aSatApi,
+    MSatSmsObserver& aObserver )
+    {
+    LOG( SIMPLE, "SENDSM: CSatSSendMessageNoLoggingHandler::NewL calling" )
+
+    CSatSSendMessageNoLoggingHandler* self =
+        new ( ELeave ) CSatSSendMessageNoLoggingHandler( aSatApi, aObserver );
+
+    LOG( SIMPLE, "SENDSM: CSatSSendMessageNoLoggingHandler::NewL exiting" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSSendMessageNoLoggingHandler::~CSatSSendMessageNoLoggingHandler
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CSatSSendMessageNoLoggingHandler::~CSatSSendMessageNoLoggingHandler()
+    {
+    LOG( SIMPLE, "SENDSM: CSatSSendMessageNoLoggingHandler::\
+        ~CSatSSendMessageNoLoggingHandler calling" )
+
+    Cancel();
+
+    LOG( SIMPLE, "SENDSM: CSatSSendMessageNoLoggingHandler::\
+        ~CSatSSendMessageNoLoggingHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSSendMessageNoLoggingHandler::Start
+// Starts the handler.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatSSendMessageNoLoggingHandler::Start(
+    const RSat::TSendSmV1& aSendSmData )
+    {
+    LOG( SIMPLE, "SENDSM: CSatSSendMessageNoLoggingHandler::Start calling" )
+
+    iSmsData.iServiceCenter = aSendSmData.iAddress;
+    iSmsData.iBuf = aSendSmData.iSmsTpdu;
+
+    if ( !IsActive() )
+        {
+        iSatApi.SendMessageNoLogging( iStatus, iSmsPckg, iMessageRef );
+        SetActive();
+        }
+    else
+        {
+        LOG( SIMPLE, " Sms sender already active!" )
+        }
+
+    LOG( SIMPLE, "SENDSM: CSatSSendMessageNoLoggingHandler::Start exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSSendMessageNoLoggingHandler::RunL
+// Handles the command.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatSSendMessageNoLoggingHandler::RunL()
+    {
+    LOG( SIMPLE, "SENDSM: CSatSSendMessageNoLoggingHandler::RunL calling" )
+
+    iObserver.SmsSent( iStatus.Int() );
+
+    LOG( SIMPLE, "SENDSM: CSatSSendMessageNoLoggingHandler::RunL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSSendMessageNoLoggingHandler::DoCancel
+// Cancels the pending request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatSSendMessageNoLoggingHandler::DoCancel()
+    {
+    LOG( SIMPLE, "SENDSM: CSatSSendMessageNoLoggingHandler::DoCancel calling" )
+
+    // Cancel the outstanding request.
+    iSatApi.SendMessageNoLoggingCancel();
+
+    LOG( SIMPLE, "SENDSM: CSatSSendMessageNoLoggingHandler::DoCancel exiting" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendSmCmd/src/CSendSmHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,812 @@
+/*
+* 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:  Handles SendSm command
+*
+*/
+
+
+#include    "MSatApi.h"
+#include    "MSatUtils.h"
+#include    "MSatSystemState.h"
+#include    "MSatUiSession.h"
+#include    "SatSTypes.h"
+#include    "SatSOpcodes.h"
+#include    "MSatSUiClientHandler.h"
+#include    "CSatSSendMessageNoLoggingHandler.h"
+#include    "CSendSmHandler.h"
+#include    "SatLog.h"
+#include    "gsmerror.h"
+#include    <exterror.h>
+#include    "TSatExtErrorUtils.h"
+
+const TUint8 KPlus = 0x2b; // '+' character
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSendSmHandler* CSendSmHandler::NewL( MSatUtils* aUtils )
+    {
+    LOG( SIMPLE, "SENDSM: CSendSmHandler::NewL calling" )
+
+    CSendSmHandler* self = new( ELeave ) CSendSmHandler;
+
+    CleanupStack::PushL( self );
+    self->BaseConstructL( aUtils );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "SENDSM: CSendSmHandler::NewL exiting" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CSendSmHandler::~CSendSmHandler()
+    {
+    LOG( SIMPLE, "SENDSM: CSendSmHandler::~CSendSmHandler calling" )
+
+    delete iMsgSender;
+    Cancel();
+
+    LOG( SIMPLE, "SENDSM: CSendSmHandler::~CSendSmHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class MSatCommand.
+// Query response.
+// -----------------------------------------------------------------------------
+//
+void CSendSmHandler::ClientResponse()
+    {
+    LOG( SIMPLE, "SENDSM: CSendSmHandler::ClientResponse calling" )
+
+    // Query response from client.
+    if ( iQueryRsp.iAccepted && !iNotificationSent )
+        {
+        LOG( SIMPLE, "SENDSM: CSendSmHandler::ClientResponse Query response" )
+        // Send notification to UI
+        // Register notification observer
+        TRAP_IGNORE( iUtils->RegisterServiceRequestL(
+            ESatSProactiveNotification,
+            ESatSProactiveNotificationResponse,
+            this ) )
+
+        // Get UISession.
+        MSatUiSession* uiSession = iUtils->SatUiHandler().UiSession();
+
+        // Send command to SatClient.
+        uiSession->SendCommand( &iNotificationDataPckg,
+            &iNotificationRspPckg, ESatSProactiveNotification );
+
+        iNotificationSent = ETrue;
+        }
+    else if ( iNotificationRsp.iAccepted && iNotificationSent )
+        {
+        LOG( SIMPLE, "SENDSM: CSendSmHandler::ClientResponse get response" )
+        // Then we can proceed with the msg sending
+        if ( !iMsgSender->IsActive() )
+            {
+            LOG( SIMPLE, 
+            "SENDSM: CSendSmHandler::ClientResponse start iMsgSender" )
+            iMsgSender->Start( iSendSmData );
+            }
+        }
+    else
+        {
+        if ( iQueryRsp.iSessionTerminatedByUser )
+            {
+            LOG( SIMPLE, 
+            "SENDSM: CSendSmHandler::ClientResponse close ui session" )
+            // Next SimSession end will close the ui session
+            iUtils->NotifyEvent( MSatUtils::ESessionTerminatedByUser );
+            }
+
+        iSendSmRsp.iGeneralResult = RSat::KPCmdNotAcceptedByUser;
+        iSendSmRsp.iInfoType = RSat::KNoAdditionalInfo;
+        iSendSmRsp.iAdditionalInfo.Zero();
+        iSendSmRsp.SetPCmdNumber( iSendSmData.PCmdNumber() );
+
+        TerminalRsp( RSat::ESendSm, iSendSmRspPckg );
+        }
+
+    LOG( SIMPLE, "SENDSM: CSendSmHandler::ClientResponse exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class MSatEventObserver.
+// Event notification.
+// -----------------------------------------------------------------------------
+//
+void CSendSmHandler::Event( TInt aEvent )
+    {
+    LOG( SIMPLE, "SENDSM: CSendSmHandler::Event calling" )
+    LOG2( SIMPLE, "SENDSM: CSendSmHandler::Event iWaitingUiLaunch=%d",  
+    iWaitingUiLaunch ) 
+    LOG2( SIMPLE, "SENDSM: CSendSmHandler::Event IsActive=%d", IsActive() ) 
+    if ( MSatUtils::EMoSmControlExecuting == aEvent )
+        {
+        LOG( NORMAL, "SENDSM:   Event EMoSmControlExecuting" )
+        iMoSmControlActive = ETrue;
+        }
+    else if ( MSatUtils::EMoSmControlDone == aEvent )
+        {
+        LOG( NORMAL, "SENDSM:   Event EMoSmControlDone" )
+        iMoSmControlActive = EFalse;
+        // Check if Sendsm is waiting.
+        // Completing call control should not trigger this command handler 
+        // if it is still waiting for UI to be launched. 
+        if ( !IsActive() && !iWaitingUiLaunch ) 
+            {
+            LOG( SIMPLE, "SENDSM: CSendSmHandler::Event sendsm" )
+            // Do the Sendsm.
+            HandleCommand();
+            }
+        }
+
+    CSatCommandHandler::Event( aEvent );
+
+    LOG( SIMPLE, "SENDSM: CSendSmHandler::Event exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class MSatEventObserver.
+// Notification that sms was sent.
+// -----------------------------------------------------------------------------
+//
+void CSendSmHandler::SmsSent( TInt aErrorCode )
+    {
+    LOG2( SIMPLE, "SENDSM: CSendSmHandler::SmsSent calling, &d", aErrorCode )
+
+    // Ui session is listening for sms sent event.
+    iUtils->NotifyUiEvent( ESatSSmEndEvent, ESatEventNone, aErrorCode );
+
+    iSendSmRsp.iInfoType = RSat::KNoAdditionalInfo;
+    iSendSmRsp.iAdditionalInfo.Zero();
+    iSendSmRsp.SetPCmdNumber( iSendSmData.PCmdNumber() );
+
+    if ( KErrSatMoSmControlModified == aErrorCode )
+        {
+        LOG( SIMPLE, "SENDSM:   KErrSatMoSmControlModified" )
+        iSendSmRsp.iGeneralResult = RSat::KSuccess;
+        }
+    else if ( KErrSatMoSmControlBarred == aErrorCode )
+        {
+        LOG( SIMPLE, "SENDSM:   KErrSatMoSmControlBarred" )
+        iSendSmRsp.iGeneralResult = RSat::KInteractionWithCCPermanentError;
+
+        // Additional info field contains extra info.
+        iSendSmRsp.iInfoType = RSat::KControlInteraction;
+
+        // Lower byte contains the SMS error cause.
+        iSendSmRsp.iAdditionalInfo.SetLength( 1 );
+        iSendSmRsp.iAdditionalInfo[0] =
+            static_cast<TUint16>( RSat::KActionNotAllowed );
+        }
+    else if ( TSatExtErrorUtils::IsExtendedError( aErrorCode ) )
+        {
+        LOG( SIMPLE, "SENDSM:   Error code < KErrGsmSmsBase" )
+
+        // Map error value
+        TUint8 addInfo( 0 );
+
+        if ( TSatExtErrorUtils::IsNetworkError( aErrorCode ) )
+            {
+            LOG( SIMPLE, "SENDSM:   NetworkError" )
+            // Map extended error
+            addInfo = TSatExtErrorUtils::MapError( aErrorCode );
+
+            // Error utils found the correct response
+            iSendSmRsp.iGeneralResult = RSat::KNetworkUnableToProcessCmd;
+            // Additional info field contains extra info.
+            iSendSmRsp.iInfoType = RSat::KSatNetworkErrorInfo;
+            }
+        else
+            {
+            LOG( SIMPLE, "SENDSM:   MeError" )
+            // No need to modify mapped value
+            addInfo = TSatExtErrorUtils::MapError( aErrorCode, EFalse );
+
+            // Return GSM Error specific value.
+            iSendSmRsp.iGeneralResult = RSat::KSmsRpError;
+            // Additional info field contains extra info.
+            iSendSmRsp.iInfoType = RSat::KMeProblem;
+            }
+
+        // Add additional info into terminal response
+        iSendSmRsp.iAdditionalInfo.SetLength( 1 );
+        iSendSmRsp.iAdditionalInfo[0] = static_cast<TUint16>( addInfo );
+        }
+    else if ( ( KErrGsmSMSNoNetworkService == aErrorCode ) ||
+              ( KErrGsmSSNotAvailable == aErrorCode ) )
+        {
+        LOG( SIMPLE, "SENDSM:     UnableToProcessCmd" )
+        iSendSmRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+        iSendSmRsp.iInfoType = RSat::KMeProblem;
+        iSendSmRsp.iAdditionalInfo.SetLength( 1 );
+        iSendSmRsp.iAdditionalInfo[0] = RSat::KNoService;
+        }
+    else if ( KErrGeneral == aErrorCode )
+        {
+        LOG( SIMPLE, "SENDSM:   KErrGeneral" )
+        iSendSmRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+        }
+    else if ( KErrTimedOut == aErrorCode )
+        {
+        LOG( SIMPLE, "SENDSM:   KErrTimedOut" )
+        iSendSmRsp.iGeneralResult = RSat::KNetworkUnableToProcessCmd;
+        }
+    else
+        {
+        if ( !iPartialComprehension )
+            {
+            if ( !iNotificationRsp.iRequestedIconDisplayed &&  // No icon displayed
+                ( RSat::ESelfExplanatory ==             // Only icon
+                    iSendSmData.iIconId.iQualifier ||
+                  RSat::ENotSelfExplanatory ==          // Icon and text
+                    iSendSmData.iIconId.iQualifier ) )
+                {
+                LOG( SIMPLE, "SENDSM:   KSuccessRequestedIconNotDisplayed" )
+                iSendSmRsp.iGeneralResult =
+                    RSat::KSuccessRequestedIconNotDisplayed;
+                }
+            else
+                {
+                LOG( SIMPLE, "SENDSM:   Succeed" )
+                iSendSmRsp.iGeneralResult = RSat::KSuccess;
+                }
+            }
+        else
+            {
+            LOG( SIMPLE, "SENDSM:   KPartialComprehension" )
+            iPartialComprehension = EFalse;
+            iSendSmRsp.iGeneralResult = RSat::KPartialComprehension;
+            }
+        }
+
+    // If command had icon data and was done succesfully, report that icon
+    // was not shown
+    // To be removed when icons are allowed in this command
+    if ( ( RSat::KSuccess == iSendSmRsp.iGeneralResult ) &&
+        iIconCommand )
+        {
+        LOG( SIMPLE, 
+        "SENDSM: CSendSmHandler::SmsSent KSuccessRequestedIconNotDisplayed" )
+        iSendSmRsp.iGeneralResult =
+                    RSat::KSuccessRequestedIconNotDisplayed;
+        }
+
+    TerminalRsp( RSat::ESendSm, iSendSmRspPckg );
+
+    LOG( SIMPLE, "SENDSM: CSendSmHandler::SmsSent exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Sets the sca number and also sets the numbering plan and the type of number.
+// -----------------------------------------------------------------------------
+//
+TBool CSendSmHandler::SetScaNumber( const RSat::TSatTelNumber& aScaNumber )
+    {
+    LOG2( SIMPLE,
+        "SENDSM: CSendSmHandler::SetScaNumber calling, aScaNumber :%S",
+        &aScaNumber )
+
+    TBool scaAvailable ( EFalse );
+
+    iSendSmData.iAddress.iTelNumber = aScaNumber;
+    if ( aScaNumber.Length() > 0 )
+        {
+        LOG2( SIMPLE, "SENDSM:   aScaNumber.Length: %d", aScaNumber.Length() )
+        const RSat::TAddress address = iSendSmData.iAddress;
+
+        scaAvailable = ETrue;
+
+        // Is the number in international format, ie first character is '+'.
+        if ( KPlus == address.iTelNumber[0] )
+            {
+            const RSat::TTypeOfNumber ton = address.iTypeOfNumber;
+
+            // Set the type of number, if it is not known.
+            if ( ( RSat::ETypeOfNumberNotSet == ton ) ||
+                 ( RSat::EUnknownNumber == ton ) )
+                {
+                LOG( SIMPLE, "SENDSM:   International Number" )
+                iSendSmData.iAddress.iTypeOfNumber =
+                    RSat::EInternationalNumber;
+                }
+
+            const RSat::TNumberingPlan npi = address.iNumberPlan;
+
+            // Set the numbering plan if it is not known.
+            if ( ( RSat::ENumberingPlanNotSet == npi ) ||
+                 ( RSat::EUnknownNumberingPlan == npi ) )
+                {
+                LOG( SIMPLE, "SENDSM:   Isdn Number Plan" )
+                iSendSmData.iAddress.iNumberPlan = RSat::EIsdnNumberPlan;
+                }
+            }
+        }
+
+    LOG2( SIMPLE,
+        "SENDSM: CSendSmHandler::SetScaNumber exiting, scaAvailable:%i",
+        scaAvailable )
+    return scaAvailable;
+    }
+
+// -----------------------------------------------------------------------------
+// From class CActive.
+// Cancels the sat request.
+// -----------------------------------------------------------------------------
+//
+void CSendSmHandler::DoCancel()
+    {
+    LOG( SIMPLE, "SENDSM: CSendSmHandler::DoCancel calling" )
+
+    iUtils->USatAPI().NotifySendSmCancel();
+
+    LOG( SIMPLE, "SENDSM: CSendSmHandler::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Requests the command notification.
+// -----------------------------------------------------------------------------
+//
+void CSendSmHandler::IssueUSATRequest( TRequestStatus& aStatus )
+    {
+    LOG( SIMPLE, "SENDSM: CSendSmHandler::IssueUSATRequest calling" )
+
+    // Clear the IPC package.
+    new (&iSendSmData) RSat::TSendSmV1();
+    iNeedUiSession = ETrue;
+    iQueryRsp.iAccepted = EFalse; // default
+    iNotificationRsp.iAccepted = EFalse;
+
+    iUtils->USatAPI().NotifySendSm( aStatus, iSendSmPckg );
+
+    LOG( SIMPLE, "SENDSM: CSendSmHandler::IssueUSATRequest exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// SendSm command is not allowed in following situations:
+//   - Phone is not registered to homenetwork and roaming.
+// -----------------------------------------------------------------------------
+//
+TBool CSendSmHandler::CommandAllowed()
+    {
+    LOG( SIMPLE, "SENDSM: CSendSmHandler::CommandAllowed calling" )
+    TBool commandAllowed( ETrue );
+
+    RMobilePhone::TMobilePhoneRegistrationStatus registrationStatus(
+        iUtils->SystemState().GetNetworkRegistrationStatus() );
+
+    // Check the PC Suite backup / restore status. If it is ongoing, SendSm is
+    // not allowed.
+    const TBool backupOngoing(
+        iUtils->SystemState().IsBackupProcessOngoing() );
+
+    if ( ( RSat::EAlphaIdProvided != iSendSmData.iAlphaId.iStatus ) &&
+        ( RSat::ESelfExplanatory == iSendSmData.iIconId.iQualifier ||
+          RSat::ENotSelfExplanatory == iSendSmData.iIconId.iQualifier ) )
+        {
+        commandAllowed = EFalse;
+        iSendSmRsp.iGeneralResult = RSat::KCmdDataNotUnderstood;
+        iSendSmRsp.iInfoType = RSat::KNoAdditionalInfo;
+        iSendSmRsp.iAdditionalInfo.Zero();
+        LOG( SIMPLE, "SENDSM:   Not allowed data not understood" )
+        }
+    else if ( ( RMobilePhone::ERegisteredOnHomeNetwork !=
+        registrationStatus ) &&
+        ( RMobilePhone::ERegisteredRoaming != registrationStatus ) ||
+        backupOngoing )
+        {
+        commandAllowed = EFalse;
+        iSendSmRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+        iSendSmRsp.iInfoType = RSat::KMeProblem;
+        iSendSmRsp.iAdditionalInfo.SetLength( 1 );
+        iSendSmRsp.iAdditionalInfo[0] = RSat::KNoService;
+        LOG( SIMPLE, "SENDSM:   Not allowed Me unable to process" )
+        }
+    else if ( !IsSCAAvailable() )
+        {
+        LOG( SIMPLE, "SENDSM:   Not allowed !IsSCAAvailable()" )
+        commandAllowed = EFalse;
+        iSendSmRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+        iSendSmRsp.iInfoType = RSat::KMeProblem;
+        iSendSmRsp.iAdditionalInfo.SetLength( 1 );
+        iSendSmRsp.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
+        }
+    // Set icon command flag whether icon data was received and set qualifier
+    // to no icon id
+    // To be removed when icons are allowed in this command
+    else if ( ( RSat::ESelfExplanatory ==
+        iSendSmData.iIconId.iQualifier ) ||
+        ( RSat::ENotSelfExplanatory ==
+        iSendSmData.iIconId.iQualifier ) )
+        {
+        LOG( SIMPLE, "SENDSM:   ENoIconId" )
+        iIconCommand = ETrue;
+        iSendSmData.iIconId.iQualifier = RSat::ENoIconId;
+        }
+    else
+        {
+        LOG( SIMPLE, "SENDSM:   others" )
+        iIconCommand = EFalse;
+        }
+
+    //lint -e{961} else block not needed.
+    if ( !commandAllowed )
+        {
+        iSendSmRsp.SetPCmdNumber( iSendSmData.PCmdNumber() );
+        TerminalRsp( RSat::ESendSm, iSendSmRspPckg );
+        }
+
+    LOG2( SIMPLE, "SENDSM: CSendSmHandler::CommandAllowed exiting,\
+          commandAllowed: %d", commandAllowed )
+    return commandAllowed;
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Need for ui session.
+// -----------------------------------------------------------------------------
+//
+TBool CSendSmHandler::NeedUiSession()
+    {
+    LOG( NORMAL, "SENDSM: CSendSmHandler::NeedUiSession calling" )
+    // Check do we need UI
+
+    // Store the result for later use
+    iNeedUiSession = !TransparentSmsSending();
+    // Notify Cover UI if it's supported
+    if ( iNeedUiSession && iUtils->CoverUiSupported() )
+        {
+        TSatCommandData medEventData;
+        medEventData.iPCmdNumber = RSat::ESendSm;
+        medEventData.iAlphaId =  iSendSmData.iAlphaId;
+        if ( iUtils->SystemState().IsConfirmSatOperationsOn() )
+            {
+            LOG( NORMAL, 
+            "SENDSM: CSendSmHandler::NeedUiSession KSatLongDuration" )
+            medEventData.iDuration.iNumOfUnits = KSatLongDuration;
+            }
+        else
+            {
+            LOG( NORMAL, 
+            "SENDSM: CSendSmHandler::NeedUiSession KSatDefaultDuration" )
+            medEventData.iDuration.iNumOfUnits = KSatDefaultDuration;
+            }
+
+        medEventData.iDuration.iTimeUnit = RSat::ESeconds;
+        medEventData.iIconID = iSendSmData.iIconId;
+        TSatCommandPckg tPckg( medEventData );
+        iUtils->RaiseSatEvent( tPckg );
+        }
+
+    LOG2( NORMAL, "SENDSM: CSendSmHandler::NeedUiSession exiting, \
+          iNeedUiSession: %d", iNeedUiSession )
+    return iNeedUiSession;
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Called when USAT API notifies that command.
+// -----------------------------------------------------------------------------
+//
+void CSendSmHandler::HandleCommand()
+    {
+    LOG( SIMPLE, "SENDSM: CSendSmHandler::HandleCommand calling" )
+
+    // If mo sm control is active, command waits for the EMoSmControlDone event
+    // and sends the command then.
+    if ( !iMoSmControlActive )
+        {
+        LOG2( SIMPLE,  
+        "SENDSM: CSendSmHandler::HandleCommand: !iMoSmControlActive, \
+        iNeedUiSession=%d",
+        iNeedUiSession ) 
+
+        iUtils->NotifyEvent( MSatUtils::ESendSmExecuting );
+
+        if ( !iNeedUiSession )
+            {
+            LOG( SIMPLE, 
+            "SENDSM: CSendSmHandler::HandleCommand not iNeedUiSession" )
+            // Dont show any messages in ui client, ETSI dictates that
+            // if alpha is is provided and alpha id length is 0 then ui
+            // should not show anyting.
+            // This is OK also for icon support.
+            // Icon is successfully processed. But not shown in this case.
+            if ( !iMsgSender->IsActive() )
+                {
+                LOG( SIMPLE, 
+                "SENDSM: CSendSmHandler::HandleCommand start iMsgSender" )
+                iMsgSender->Start( iSendSmData );
+                }
+            }
+        else
+            {
+            iQueryData.iCommand = ESatSSendSmQuery;
+            iQueryData.iQueryText = iSendSmData.iAlphaId.iAlphaId;
+            iQueryData.iIconId.iIdentifier = iSendSmData.iIconId.iIdentifier;
+
+            iNotificationSent = EFalse;
+            iNotificationData.iCommand = ESatSSendSmsNotify;
+            iNotificationData.iText = iSendSmData.iAlphaId.iAlphaId;
+            iNotificationData.iIconId.iIdentifier =
+                iSendSmData.iIconId.iIdentifier;
+            LOG2( NORMAL, "SENDSM: CSendSmHandler::HandleCommand \
+                  iSendSmData.iIconId.iQualifier: %d", 
+                  iSendSmData.iIconId.iQualifier )
+            switch ( iSendSmData.iIconId.iQualifier )
+                {
+                case RSat::ESelfExplanatory:
+                    {
+                    // Icon qualifier is self explanatory (to display instead
+                    // of the alpha id or text string).
+                    iQueryData.iIconId.iIconQualifier = ESatSelfExplanatory;
+                    iNotificationData.iIconId.iIconQualifier =
+                        ESatSelfExplanatory;
+                    break;
+                    }
+
+                case RSat::ENotSelfExplanatory:
+                    {
+                    // Icon qualifier is not self explanatory.
+                    iQueryData.iIconId.iIconQualifier = ESatNotSelfExplanatory;
+                    iNotificationData.iIconId.iIconQualifier =
+                        ESatNotSelfExplanatory;
+                    break;
+                    }
+
+                default:
+                    {
+                    // Icon qualifier not present
+                    iQueryData.iIconId.iIconQualifier = ESatENoIconId;
+                    iNotificationData.iIconId.iIconQualifier = ESatENoIconId;
+                    break;
+                    }
+
+                }
+            LOG2( NORMAL, "SENDSM: CSendSmHandler::HandleCommand \
+                  iSendSmData.iAlphaId.iStatus: %d", 
+                  iSendSmData.iAlphaId.iStatus )
+            switch ( iSendSmData.iAlphaId.iStatus )
+                {
+                case RSat::EAlphaIdNotPresent:
+                    {
+                    iQueryData.iAlphaIdStatus = ESatAlphaIdNotProvided;
+                    iNotificationData.iAlphaIdStatus = ESatAlphaIdNotProvided;
+                    break;
+                    }
+
+                case RSat::EAlphaIdProvided:
+                    {
+                    iQueryData.iAlphaIdStatus = ESatAlphaIdNotNull;
+                    iNotificationData.iAlphaIdStatus = ESatAlphaIdNotNull;
+                    break;
+                    }
+
+                default:
+                    {
+                    iQueryData.iAlphaIdStatus = ESatAlphaIdNull;
+                    iNotificationData.iAlphaIdStatus = ESatAlphaIdNull;
+                    break;
+                    }
+                }
+
+            // Check do we need to confirm operation from user
+            if ( !iUtils->SystemState().IsConfirmSatOperationsOn() )
+                {
+                LOG( SIMPLE, 
+                "SENDSM: CSendSmHandler::HandleCommand confirm operation" )
+                // No need to confirm, show only notification
+                // Register notification observer
+                TRAP_IGNORE( iUtils->RegisterServiceRequestL(
+                    ESatSProactiveNotification,
+                    ESatSProactiveNotificationResponse,
+                    this ) )
+
+                LOG( SIMPLE, 
+                    "SENDSM: CSendSmHandler::HandleCommand send ui notification" )
+                iUtils->SatUiHandler().UiSession()->SendCommand(
+                    &iNotificationDataPckg,
+                    &iNotificationRspPckg,
+                    ESatSProactiveNotification );
+
+                iNotificationSent = ETrue;
+                }
+            else
+                {
+                LOG( SIMPLE, 
+                "SENDSM: CSendSmHandler::HandleCommand user confirmation needed" ) 
+                // Register service request handler for SendSm command,
+                // If there is already service request for query, registering
+                // updates command handler, so client responses comes to this
+                // command handler
+                TRAP_IGNORE( iUtils->RegisterServiceRequestL(
+                    ESatSProactiveQuery,
+                    ESatSProactiveQueryResponse,
+                    this ) )
+
+                iNotificationSent = EFalse;
+
+                LOG( SIMPLE, 
+                "SENDSM: CSendSmHandler::HandleCommand send user confirmation request" ) 
+
+                // Ask the user permission to send sms. Reply will come
+                // to ClientResponse method.
+                iUtils->SatUiHandler().UiSession()->SendCommand(
+                    &iQueryPckg,
+                    &iQueryRspPckg,
+                    ESatSProactiveQuery );
+                }
+            }
+        }
+
+    LOG( SIMPLE, "SENDSM: CSendSmHandler::HandleCommand exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Called when UI launch fails
+// -----------------------------------------------------------------------------
+//
+void CSendSmHandler::UiLaunchFailed()
+    {
+    LOG( SIMPLE, "SENDSM: CSendSmHandler::UiLaunchFailed calling" )
+
+    iSendSmRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+    iSendSmRsp.iInfoType = RSat::KMeProblem;
+    iSendSmRsp.iAdditionalInfo.SetLength( 1 );
+    iSendSmRsp.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
+    iSendSmRsp.SetPCmdNumber( iSendSmData.PCmdNumber() );
+
+    TerminalRsp( RSat::ESendSm, iSendSmRspPckg );
+
+    LOG( SIMPLE, "SENDSM: CSendSmHandler::UiLaunchFailed exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+//lint -e{1403, 1769} Can not be initialized, harmless.
+CSendSmHandler::CSendSmHandler() :
+    CSatCommandHandler(),
+    iSendSmData(),
+    iSendSmPckg( iSendSmData ),
+    iSendSmRsp(),
+    iSendSmRspPckg( iSendSmRsp ),
+    iQueryData(),
+    iQueryPckg( iQueryData ),
+    iQueryRsp(),
+    iQueryRspPckg( iQueryRsp ),
+    iNotificationData(),
+    iNotificationDataPckg( iNotificationData ),
+    iNotificationRsp(),
+    iNotificationRspPckg( iNotificationRsp ),
+    // To be removed when icons are allowed in this command
+    iIconCommand( EFalse )
+    {
+    LOG( SIMPLE,
+        "SENDSM: CSendSmHandler::CSendSmHandler calling - exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSendSmHandler::ConstructL()
+    {
+    LOG( SIMPLE, "SENDSM: CSendSmHandler::ConstructL calling" )
+
+    iMsgSender = CSatSSendMessageNoLoggingHandler::NewL(
+        iUtils->USatAPI(),
+        *this );
+
+    iUtils->RegisterL( this, MSatUtils::EMoSmControlExecuting );
+    iUtils->RegisterL( this, MSatUtils::EMoSmControlDone );
+
+    // Create request handler. This is same that LaunchBrowser uses, so this
+    // is needed also in HandleCommand - function.
+    iUtils->RegisterServiceRequestL(
+        ESatSProactiveQuery,
+        ESatSProactiveQueryResponse,
+        this );
+
+    LOG( SIMPLE, "SENDSM: CSendSmHandler::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// SMS sending should be transparent if alpha identifier is provided but it's
+// length is 0. Also user query setting is not on.
+// -----------------------------------------------------------------------------
+//
+TBool CSendSmHandler::TransparentSmsSending() const
+    {
+    LOG( SIMPLE, "SENDSM: CSendSmHandler::TransparentSmsSending calling" )
+
+    TBool result( EFalse );
+    const RSat::TAlphaId alphaId( iSendSmData.iAlphaId );
+
+    if ( ( alphaId.iStatus == RSat::EAlphaIdProvided &&
+           alphaId.iAlphaId.Length() == 0 ) ||
+           alphaId.iStatus == RSat::EAlphaIdNull )
+        {
+        LOG( SIMPLE, 
+        "SENDSM: CSendSmHandler::TransparentSmsSending EAlphaIdProvided" )
+        if ( !iUtils->SystemState().IsConfirmSatOperationsOn() )
+            {
+            LOG( SIMPLE, 
+            "SENDSM: CSendSmHandler::TransparentSmsSending confirm" )
+            result = ETrue;
+            }
+
+        }
+
+    LOG2( SIMPLE, "SENDSM: CSendSmHandler::TransparentSmsSending exiting: %i",
+        result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// Chaeck SCA availability.
+// -----------------------------------------------------------------------------
+//
+TBool CSendSmHandler::IsSCAAvailable()
+    {
+    LOG( SIMPLE, "SENDSM: CSendSmHandler::IsSCAAvailable calling" )
+
+    TBool scaAvailable ( ETrue );
+
+    // If Service Center Address in not specified in proactive command,
+    // the SCA is taken from shared data. SMSUi sets the SCA in the
+    // shared data. If the SCA is not found from shared data, then
+    // sending is not allowed.
+    if ( 0 == iSendSmData.iAddress.iTelNumber.Length() )
+        {
+        LOG( SIMPLE, "SENDSM:   TelNumber is empty" )
+
+        // Address is not defined.
+        if ( RSat::ETypeOfNumberNotSet == iSendSmData.iAddress.iTypeOfNumber )
+            {
+            iPartialComprehension = EFalse;
+            }
+
+        // Address is set intentionally empty.
+        else
+            {
+            iPartialComprehension = ETrue;
+            LOG( SIMPLE, "SENDSM:   The result is KPartialComprehension" )
+            }
+
+        scaAvailable = SetScaNumber( iUtils->SystemState().SCANumber() );
+        }
+    else
+        {
+        LOG( SIMPLE, "SENDSM:   TelNumber is not empty." )
+        iPartialComprehension = EFalse;
+        }
+
+    LOG2( SIMPLE,
+        "SENDSM: CSendSmHandler::IsSCAAvailable exiting: %i", scaAvailable )
+    return scaAvailable;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendSmCmd/src/std.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 functions
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    <implementationproxy.h>
+#include    "CSendSmHandler.h"
+
+// CONSTANTS
+
+const TImplementationProxy implementationTable[] =
+    {
+    //lint -e{611,1924} Warning "Suspicious cast" can not be avoided.
+    IMPLEMENTATION_PROXY_ENTRY( 0x1000f021, CSendSmHandler::NewL )
+    };
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy ECOM framework factory function
+// Calculates the number of implementations.
+// Returns: Implementation proxy.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount ) // Number of implementations
+    {
+    aTableCount =
+        sizeof( implementationTable ) /
+        sizeof( TImplementationProxy );
+    return implementationTable;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendUSSDCmd/group/SendUssdCmd.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* 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:  Project definition file for project SendUssd plug-in
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../../inc/SatMacroes.h"
+
+TARGET                  SendUssdCmd.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D 0x10202983
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  std.cpp
+SOURCE                  CSendUssdHandler.cpp
+
+START RESOURCE          10202983.rss
+TARGET                  SendUssdCmd.rsc
+END
+
+USERINCLUDE             ../../../inc
+USERINCLUDE             ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+SYSTEMINCLUDE           ../../../../../inc      // Domain telephony
+SYSTEMINCLUDE           ../../../../inc         // Subsystem satengine
+
+LIBRARY                 euser.lib
+LIBRARY                 etelsat.lib
+LIBRARY                 SatEngine.lib
+LIBRARY                 phoneclient.lib         // Ussd sender
+
+#ifdef ENABLE_SAT_LOGGING
+LIBRARY                 flogger.lib
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendUSSDCmd/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 SendUssdCmd plug-in
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+SendUssdCmd.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendUSSDCmd/inc/CSendUssdHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,288 @@
+/*
+* 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:  SendUssd command handler
+*
+*/
+
+
+#ifndef CSENDUSSDHANDLER_H
+#define CSENDUSSDHANDLER_H
+
+#include <etelsat.h>
+
+#include "CSatCommandHandler.h"
+#include "SatSTypes.h"
+
+class MSatUtils;
+class CPhCltUssdSatClient;
+
+/**
+*  Command handler for SendUssd command.
+*
+*  @lib SendUssd.lib
+*  @since S60 v3.0
+*/
+class CSendUssdHandler : public CSatCommandHandler
+    {
+    
+public:
+
+    static CSendUssdHandler* NewL( MSatUtils* aUtils );
+
+    virtual ~CSendUssdHandler();
+
+// from base class MSatCommand
+
+    /**
+     * From MSatCommand.
+     * Response from the client
+     *
+     */
+    void ClientResponse();
+
+// from base class CSatCommandHandler
+
+    /**
+     * From CSatCommandHandler
+     * Overrides the default implementation.
+     *
+     * @param aEvent Identifies the event.
+     */
+    void Event( TInt aEvent );
+
+protected:
+
+// from base class CActive
+
+    /**
+     * From CActive
+     * Cancels the usat request.
+     *
+     */
+    void DoCancel();
+    
+// from base class CSatCommandHandler
+
+    /**
+     * From CSatCommandHandler
+     * Requests the command notification.
+     *
+     * @param aStatus Request status
+     */
+    void IssueUSATRequest( TRequestStatus& aStatus );
+
+    /**
+     * From CSatCommandHandler
+     * Precheck before executing the command.
+     *
+     * @return TBool indicating command is currently allowed.
+     */
+    TBool CommandAllowed();
+
+    /**
+     * From CSatCommandHandler
+     * Need for ui session.
+     *
+     * @return TBool indicating need of ui session.
+     */
+    TBool NeedUiSession();
+
+    /**
+     * From CSatCommandHandler
+     * Called when USAT API notifies that command.
+     *
+     */
+    void HandleCommand();
+
+    /**
+     * From CSatCommandHandler.
+     * Indicates the failure of launching ui client
+     *
+     */
+    void UiLaunchFailed();
+
+private:
+
+    CSendUssdHandler();
+
+    /**
+     * Handles the Ussd string sending
+     *
+     */
+    void SendUssdString();
+
+    /**
+     * Handles the Ussd string sending
+     *
+     * @param aSendMessage The USSD string to be sent
+     * @param aSendDcs Data coding scheme of the USSD string
+     * @param aReceiveMessage Response message from NW
+     * @param aSendCompletedFirst Indicates is this function completed
+     *        before response
+     * @param aReceivedDcs Data coding scheme of the received USSD string
+     */
+    void SendUssdStringL(
+        const TDesC& aSendMessage,
+        const TUint8 aSendDcs,
+        TDes& aReceiveMessage,
+        TBool& aSendCompletedFirst,
+        TUint8& aReceivedDcs );
+
+    /**
+     * Handles the result of Ussd sending
+     *
+     * @param aError Result of Ussd sending
+     */
+    void HandleSendUssdResult( TInt aError );
+
+    /**
+     * Converts reveived Dcs to correct format
+     *
+     * @param aReceivedDcs Received Dcs to convert
+     */
+    void ConvertReceivedDcs( TUint8& aReceivedDcs ) const;
+
+    /**
+     * Sends terminal response. Makes sure that terminal response
+     * is not send more that once / command.
+     *
+     */
+    void SendTerminalResponse();
+
+    /**
+     * Check validity of a given Data Coding Cheme (Dcs).
+     *
+     * @param aDcs Data Coding Cheme to be validated.
+     * @return TBool indicating Dcs validity.
+     */
+    TBool DcsValid( const TUint8 aDcs ) const;
+
+    /**
+     * Checks is the command transparent or not
+     *
+     */
+    TBool TransparentUssdSending();
+
+private: // data
+
+    /**
+     * SendUssd command data.
+     */
+    RSat::TSendUssdV1 iSendUssdData;
+
+    /**
+     * SendUssd command package.
+     */
+    RSat::TSendUssdV1Pckg iSendUssdPckg;
+
+    /**
+     * Response from client
+     */
+    RSat::TSendUssdRspV1 iSendUssdRsp;
+
+    /**
+     * Response package.
+     */
+    RSat::TSendUssdRspV1Pckg iSendUssdRspPckg;
+
+    /**
+     * UI query and notification data:
+     */
+    TBool iNeedUiSession;
+
+    /**
+     * Indicates the query status
+     */
+    TBool iQueryOn;
+
+    /**
+     * Indicates is AlphaId present
+     */
+    TBool iAlphaIdPresent;
+
+    /**
+     * Query command data.
+     */
+    TSatQueryV1 iQueryData;
+
+    /**
+     * Query package.
+     */
+    TSatQueryV1Pckg iQueryPckg;
+
+    /**
+     * Query response.
+     */
+    TSatQueryRspV1 iQueryRsp;
+
+    /**
+     * Query rsp package.
+     */
+    TSatQueryRspV1Pckg iQueryRspPckg;
+
+    /**
+     * Notification send data
+     */
+    TSatNotificationV1 iNotificationData;
+
+    /**
+     * Notification package
+     */
+    TSatNotificationV1Pckg iNotificationDataPckg;
+
+    /**
+     * Notification Response data
+     */
+    TSatNotificationRspV1 iNotificationRsp;
+
+    /**
+     * Notification Response package
+     */
+    TSatNotificationRspV1Pckg iNotificationRspPckg;
+
+    /**
+     * Indicates is notification sent
+     */
+    TBool iNotificationSent;
+
+    /**
+     * Indicates is terminal response sent
+     */
+    TBool iTerminalRespSent;
+
+    /**
+     * Ussd sender
+     */
+    CPhCltUssdSatClient* iUssdClient;
+
+    /**
+     * Blocks the USSD send until user has respond
+     */
+    CActiveSchedulerWait iWait;
+
+    /**
+     * Indicates wether user accepted or rejected
+     */
+    TBool iUserAccepted;
+    
+    /**
+     * Flag to signal that command has icon data
+     * To be removed when icons are allowed in this command
+     */
+    TBool iIconCommand;
+
+    };
+
+#endif      // CSENDUSSDHANDLER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendUSSDCmd/inc/SendUssdCmd.rls	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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 headers for project SendUssdCmd
+*
+*/
+
+
+#ifndef SENDUSSDCMD_RLS
+#define SENDUSSDCMD_RLS
+
+rls_string STRING_r_sendussdcmd_display_name "SendUssd command"
+rls_string STRING_r_sendussdcmd_default_data "SendUssdCmd"
+rls_string STRING_r_sendussdcmd_opaque_data  ""
+
+#endif // SENDUSSDCMD_RLS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendUSSDCmd/src/10202983.rss	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 1020 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Registry information for ECOM
+*
+*/
+
+
+
+//  INCLUDES
+#include <registryinfo.rh>
+#include "SendUssdCmd.rls"
+
+//  RESOURCE DEFINITIONS
+// -----------------------------------------------------------------------------
+//
+// SendUssdCmdInfo
+// Registeration information for ECOM
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO SendUssdCmdInfo
+    {
+    dll_uid = 0x10202983;
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x1000f001;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x10202984;
+                    version_no   = 1;
+                    display_name = STRING_r_sendussdcmd_display_name;
+                    default_data = STRING_r_sendussdcmd_default_data;
+                    opaque_data  = STRING_r_sendussdcmd_opaque_data;
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendUSSDCmd/src/CSendUssdHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,1004 @@
+/*
+* 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:  Handles SendUssd command
+*
+*/
+
+
+#include    <cphcltussdsatclient.h>
+#include	<cphcltussd.h>
+#include    <exterror.h>
+
+#include    "MSatSystemState.h"
+#include    "MSatApi.h"
+#include    "MSatUtils.h"
+#include    "MSatUiSession.h"
+#include    "SatSOpcodes.h"
+#include    "MSatSUiClientHandler.h"
+#include    "CSendUssdHandler.h"
+#include    "TSatExtErrorUtils.h"
+#include    "SatLog.h"
+
+const TUint8 KQuarterShift( 2 );
+const TUint8 KHighNibbleShift( 4 );
+const TUint8 KDcsCharacterSet7Bit( 0x00 );
+const TUint8 KDcsCharacterSet8Bit( 0x01 );
+const TUint8 KDcsCharacterSet16Bit( 0x02 );
+const TUint8 KDcsCharacterSet7Bit2( 0x00 );
+const TUint8 KDcsCharacterSet16Bit2( 0x01 );
+const TInt   KSatMaxUSSDString( 182 );
+
+// USSD DCS coding.
+const TUint8 KSatDcs7Bit( 0x40 );
+const TUint8 KSatDcs8Bit( 0x44 );
+const TUint8 KSatDcsUCS2( 0x48 );
+const TUint8 KSatDcsUnknown( 0xFF );
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSendUssdHandler* CSendUssdHandler::NewL( MSatUtils* aUtils )
+    {
+    LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::NewL calling" )
+
+    CSendUssdHandler* self = new( ELeave ) CSendUssdHandler;
+
+    CleanupStack::PushL( self );
+    self->BaseConstructL( aUtils );
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::NewL exiting" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CSendUssdHandler::~CSendUssdHandler()
+    {
+    LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::~CSendUssdHandler calling" )
+
+    Cancel();
+
+    if ( iUssdClient )
+        {
+        delete iUssdClient;
+        iUssdClient = NULL;
+        }
+
+    LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::~CSendUssdHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class MSatCommand.
+// Response from the client
+// -----------------------------------------------------------------------------
+//
+void CSendUssdHandler::ClientResponse()
+    {
+    LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::ClientResponse calling" )
+
+    if ( iQueryRsp.iAccepted && !iNotificationSent )
+        {
+        LOG( NORMAL, 
+        "SENDUSSD: CSendUssdHandler::ClientResponse Sending notification" )
+        iNotificationSent = ETrue;
+
+        // Register service request
+        TRAP_IGNORE( iUtils->RegisterServiceRequestL(
+            ESatSProactiveNotification,
+            ESatSProactiveNotificationResponse,
+            this ) )
+
+        // Send notification
+        iUtils->SatUiHandler().UiSession()->SendCommand(
+            &iNotificationDataPckg,
+            &iNotificationRspPckg,
+            ESatSProactiveNotification );
+        }
+
+    // Notification sent
+    else if ( iNotificationRsp.iAccepted && iNotificationSent )
+        {
+        LOG( NORMAL, 
+        "SENDUSSD: CSendUssdHandler::ClientResponse Notification response" )
+        }
+
+    // User reject
+    else
+        {
+        iUserAccepted = EFalse;
+        iSendUssdRsp.iInfoType = RSat::KMeProblem;
+        iSendUssdRsp.iAdditionalInfo.SetLength( 1 );
+        iSendUssdRsp.iAdditionalInfo[0] = RSat::KScreenBusy;
+        // Cannot return KPCmdNotAcceptedByUser (ETSI 11.14 v8.3.0 p65)
+        iSendUssdRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+
+        if ( iQueryRsp.iSessionTerminatedByUser )
+            {
+            LOG( NORMAL, 
+            "SENDUSSD: CSendUssdHandler::ClientResponse \
+            ESessionTerminatedByUser" )
+            // Notify sim session end command that next sim session end
+            // should close the ui session.
+            iUtils->NotifyEvent( MSatUtils::ESessionTerminatedByUser );
+            }
+
+        SendTerminalResponse();
+        }
+
+    // Release the wait
+    if ( iWait.IsStarted() )
+        {
+        LOG( NORMAL, "SENDUSSD: CSendUssdHandler::ClientResponse stop iWait" )
+        iWait.AsyncStop();
+        }
+
+    LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::ClientResponse exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Waits for indication of user rejection
+// -----------------------------------------------------------------------------
+//
+void CSendUssdHandler::Event( TInt aEvent )
+    {
+    LOG2( SIMPLE,
+        "SENDUSSD: CSendUssdHandler::Event calling, aEvent:%d", aEvent )
+
+    switch ( aEvent )
+        {
+        case MSatUtils::ECancelledUsingEndKey:
+            {
+            // Notify sim session end command that next sim session end
+            // should close the ui session.
+            iUtils->NotifyEvent( MSatUtils::ESessionTerminatedByUser );
+            // This event is handled as above, but notification must be done.
+            }
+        //lint -fallthrough intended here
+        case MSatUtils::ECommandCancelled:
+            {
+            // Cancel Ussd sending
+            if ( iUssdClient )
+                {
+                LOG( SIMPLE, 
+                "SENDUSSD: CSendUssdHandler::Event iUssdClient true" )
+                iUssdClient->SendSatMessageCancel();
+                iSendUssdRsp.iGeneralResult =
+                    RSat::KUssdTransactionTerminatedByUser;
+                iSendUssdRsp.iInfoType = RSat::KNoAdditionalInfo;
+                iSendUssdRsp.iAdditionalInfo.Zero();
+                SendTerminalResponse();
+                }
+            break;
+            }
+
+        default:
+            {
+            // Move event to base class
+            CSatCommandHandler::Event( aEvent );
+            }
+        }
+
+    LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::Event exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CActive.
+// Cancels the sat request.
+// -----------------------------------------------------------------------------
+//
+void CSendUssdHandler::DoCancel()
+    {
+    LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::DoCancel calling" )
+
+    iUtils->USatAPI().NotifySendUssdCancel();
+
+    if ( iUssdClient )
+        {
+        LOG( SIMPLE, 
+        "SENDUSSD: CSendUssdHandler::DoCancel iUssdClient true" )
+        delete iUssdClient;
+        iUssdClient = NULL;
+        }
+
+    LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Requests the command notification.
+// -----------------------------------------------------------------------------
+//
+void CSendUssdHandler::IssueUSATRequest( TRequestStatus& aStatus )
+    {
+    LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::IssueUSATRequest calling" )
+
+    // Clear the IPC package.
+    new (&iSendUssdData) RSat::TSendUssdV1();
+    iNeedUiSession = ETrue;
+    iQueryRsp.iAccepted = EFalse; // default
+    iNotificationRsp.iAccepted = EFalse;
+    iSendUssdRsp.iGeneralResult = RSat::KPSessionTerminatedByUser; // default
+
+    iUtils->USatAPI().NotifySendUssd( aStatus, iSendUssdPckg );
+
+    // Unregister from events
+    iUtils->UnregisterEvent( this, MSatUtils::ECommandCancelled );
+    iUtils->UnregisterEvent( this, MSatUtils::ECancelledUsingEndKey );
+
+    LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::IssueUSATRequest exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Precheck before executing the command.
+// -----------------------------------------------------------------------------
+//
+TBool CSendUssdHandler::CommandAllowed()
+    {
+    LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::CommandAllowed calling" )
+
+    // Allow next terminal response to be sent
+    iTerminalRespSent = EFalse;
+    
+    iSendUssdRsp.iUssdString.iUssdString.FillZ();
+    iSendUssdRsp.iUssdString.iDcs = 0;
+
+    RMobilePhone::TMobilePhoneRegistrationStatus registrationStatus(
+        iUtils->SystemState().GetNetworkRegistrationStatus() );
+
+    TBool commandAllowed( ETrue );
+
+    // If icon data without alpha id
+    if ( ( RSat::EAlphaIdProvided != iSendUssdData.iAlphaId.iStatus ) &&
+        ( ( RSat::ESelfExplanatory == iSendUssdData.iIconId.iQualifier ) ||
+        ( RSat::ENotSelfExplanatory == iSendUssdData.iIconId.iQualifier ) ) )
+        {
+        commandAllowed = EFalse;
+        iSendUssdRsp.iGeneralResult = RSat::KCmdDataNotUnderstood;
+        iSendUssdRsp.iInfoType = RSat::KNoAdditionalInfo;
+        iSendUssdRsp.iAdditionalInfo.Zero();
+        LOG( SIMPLE,
+        "SENDUSSD: CSendUssdHandler::CommandAllowed Icon without alphaid \
+        not allowed" )
+        }
+    else if (
+         ( RMobilePhone::ERegisteredOnHomeNetwork != registrationStatus ) &&
+         ( RMobilePhone::ERegisteredRoaming != registrationStatus ) )
+        {
+        commandAllowed = EFalse;
+        iSendUssdRsp.iInfoType = RSat::KMeProblem;
+        iSendUssdRsp.iAdditionalInfo.SetLength( 1 );
+        iSendUssdRsp.iAdditionalInfo[0] = RSat::KNoService;
+        iSendUssdRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+        LOG( SIMPLE,
+        "SENDUSSD: CSendUssdHandler::CommandAllowed Not registered in legal \
+        network" )
+        }
+    // OK
+    else
+        {
+        // Check Ussd string validity
+        TInt dataLength( iSendUssdData.iUssdString.iUssdString.Length() );
+        LOG2( SIMPLE, 
+        "SENDUSSD: CSendUssdHandler::CommandAllowed Length of string: %d", 
+        dataLength )
+
+        // Validate USSD string length.
+        TBool dataValid(
+            ( dataLength > 0 ) && ( dataLength <= KSatMaxUSSDString ) );
+
+        if ( dataValid )
+            {
+            LOG( SIMPLE, "SENDUSSD:  dataValid true" )
+            // Validate Data Coding Scheme.
+            dataValid = DcsValid( iSendUssdData.iUssdString.iDcs );
+            if ( !dataValid )
+                {
+                LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::CommandAllowed Dcs \
+                not acceptable" )
+                }
+            }
+
+        // Second check in case DcsValid() returns EFalse
+        if ( !dataValid )
+            {
+            LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::CommandAllowed \
+            dataValid false" )
+            commandAllowed = EFalse;
+            iSendUssdRsp.iGeneralResult = RSat::KCmdDataNotUnderstood;
+            iSendUssdRsp.iInfoType = RSat::KNoAdditionalInfo;
+            iSendUssdRsp.iAdditionalInfo.Zero();
+            }
+        }
+
+    // Check is command allowd
+    if ( !commandAllowed )
+        {
+        LOG( SIMPLE, "SENDUSSD: \
+            CSendUssdHandler::CommandAllowed exiting - not allowed" )
+        SendTerminalResponse();
+        }
+    // Set icon command flag whether icon data was received and set qualifier
+    // to no icon id
+    // To be removed when icons are allowed in this command
+    else if ( ( RSat::ESelfExplanatory ==
+        iSendUssdData.iIconId.iQualifier ) ||
+        ( RSat::ENotSelfExplanatory ==
+        iSendUssdData.iIconId.iQualifier ) )
+        {
+        LOG( SIMPLE, "SENDUSSD: \
+            CSendUssdHandler::CommandAllowed ENoIconId" )
+        iIconCommand = ETrue;
+        iSendUssdData.iIconId.iQualifier = RSat::ENoIconId;
+        }
+    else
+        {
+        iIconCommand = EFalse;
+        }
+
+    LOG2( SIMPLE, "SENDUSSD: CSendUssdHandler::CommandAllowed exiting,\
+    commandAllowed: %d", commandAllowed )
+    return commandAllowed;
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Answers for need of UI session.
+// -----------------------------------------------------------------------------
+//
+TBool CSendUssdHandler::NeedUiSession()
+    {
+    LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::NeedUiSession calling" )
+
+    iNeedUiSession = !TransparentUssdSending();
+
+    // Notify Cover UI if it's supported
+    if ( iNeedUiSession && iUtils->CoverUiSupported() )
+        {
+        TSatCommandData medEventData;
+        medEventData.iPCmdNumber = RSat::ESendUssd;
+        medEventData.iAlphaId =  iSendUssdData.iAlphaId;
+        if ( iUtils->SystemState().IsConfirmSatOperationsOn() )
+            {
+            LOG( SIMPLE, 
+            "SENDUSSD: CSendUssdHandler::NeedUiSession KSatLongDuration" )
+            medEventData.iDuration.iNumOfUnits = KSatLongDuration;
+            }
+        else
+            {
+            LOG( SIMPLE, 
+            "SENDUSSD: CSendUssdHandler::NeedUiSession KSatDefaultDuration" )
+            medEventData.iDuration.iNumOfUnits = KSatDefaultDuration;
+            }
+        medEventData.iDuration.iTimeUnit = RSat::ESeconds;
+        medEventData.iIconID = iSendUssdData.iIconId;
+        TSatCommandPckg tPckg( medEventData );
+        iUtils->RaiseSatEvent( tPckg );
+        }
+
+    LOG2( SIMPLE, 
+    "SENDUSSD: CSendUssdHandler::NeedUiSession exiting,iNeedUiSession:%d",
+    iNeedUiSession )
+    return iNeedUiSession;
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Called when USAT API notifies that command.
+// -----------------------------------------------------------------------------
+//
+void CSendUssdHandler::HandleCommand()
+    {
+    LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::HandleCommand calling" )
+
+    iUtils->NotifyEvent( MSatUtils::ESendUssdExecuting );
+
+    // This is ETrue, until user rejects
+    iUserAccepted = ETrue;
+
+    if ( iNeedUiSession )
+        {
+
+        TRAP_IGNORE(
+        // Register to listen user cancel events:
+        // Cancel key event from dialog
+        iUtils->RegisterL( this, MSatUtils::ECommandCancelled );
+        // End key from dialog
+        iUtils->RegisterL( this, MSatUtils::ECancelledUsingEndKey ) )
+
+        // Build Qyery and Notify packages
+        TSatAlphaIdStatus alphaIdStatus;
+        if ( RSat::EAlphaIdNotPresent == iSendUssdData.iAlphaId.iStatus )
+            {
+            LOG( SIMPLE, 
+            "SENDUSSD: CSendUssdHandler::HandleCommand EAlphaIdNotPresent" )
+            alphaIdStatus = ESatAlphaIdNotProvided;
+            }
+
+        else if ( RSat::EAlphaIdProvided == iSendUssdData.iAlphaId.iStatus )
+            {
+            LOG( SIMPLE, 
+            "SENDUSSD: CSendUssdHandler::HandleCommand EAlphaIdProvided" )
+            alphaIdStatus = ESatAlphaIdNotNull;
+            }
+
+        else
+            {
+            LOG( SIMPLE, 
+            "SENDUSSD: CSendUssdHandler::HandleCommand others" )
+            alphaIdStatus = ESatAlphaIdNull;
+            }
+
+        // Has to be casted to TInt before casting to TSatIconQualifier, because
+        // GCC warns about the direct cast.
+        const struct TSatIconId iconId = { iSendUssdData.iIconId.iIdentifier,
+            static_cast<TSatIconQualifier>(
+                static_cast<TInt>( iSendUssdData.iIconId.iQualifier ) ) };
+
+        iQueryData.iCommand = ESatSSendUssdQuery;
+        iQueryData.iQueryText = iSendUssdData.iAlphaId.iAlphaId;
+        iQueryData.iIconId = iconId;
+        iQueryData.iAlphaIdStatus = alphaIdStatus;
+
+        iNotificationSent = EFalse;
+        iNotificationData.iCommand = ESatSSendUssdNotify;
+        iNotificationData.iText = iSendUssdData.iAlphaId.iAlphaId;
+        iNotificationData.iIconId = iconId;
+        iNotificationData.iAlphaIdStatus = alphaIdStatus;
+
+        MSatUiSession* uiSession = iUtils->SatUiHandler().UiSession();
+
+        // Send either query or notification
+        if ( iQueryOn )
+            {
+            LOG( NORMAL, 
+            "SENDUSSD: CSendUssdHandler::HandleCommand Sending Query" )
+            iNotificationSent = EFalse;
+
+            // Register service request
+            TRAP_IGNORE( iUtils->RegisterServiceRequestL(
+                ESatSProactiveQuery,
+                ESatSProactiveQueryResponse,
+                this ) )
+
+            // Send query
+            uiSession->SendCommand(
+                &iQueryPckg,
+                &iQueryRspPckg,
+                ESatSProactiveQuery );
+            }
+         else
+            {
+            LOG( NORMAL, 
+            "SENDUSSD: CSendUssdHandler::HandleCommand Sending notification" )
+
+            iNotificationSent = ETrue;
+
+            // Register service request
+            TRAP_IGNORE( iUtils->RegisterServiceRequestL(
+                ESatSProactiveNotification,
+                ESatSProactiveNotificationResponse,
+                this ) )
+
+            // Send notification
+            uiSession->SendCommand(
+                &iNotificationDataPckg,
+                &iNotificationRspPckg,
+                ESatSProactiveNotification );
+            }
+
+        if ( !iWait.IsStarted() )
+            {
+            LOG( SIMPLE, 
+            "SENDUSSD: CSendUssdHandler::HandleCommand start iWait" )
+            // Notification / query sent to UI, wait for response
+            iWait.Start();
+            }
+        }
+
+    if ( iUserAccepted )
+        {
+        LOG( SIMPLE, 
+        "SENDUSSD: CSendUssdHandler::HandleCommand UserAccepted" )
+        // No need to wait response, send Ussd string
+        SendUssdString();
+        }
+
+    LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::HandleCommand exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Indicates the failure of launching ui client
+// -----------------------------------------------------------------------------
+//
+void CSendUssdHandler::UiLaunchFailed()
+    {
+    LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::UiLaunchFailed calling" )
+
+    iSendUssdRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+    iSendUssdRsp.iInfoType = RSat::KMeProblem;
+    iSendUssdRsp.iAdditionalInfo.SetLength( 1 );
+    iSendUssdRsp.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
+    SendTerminalResponse();
+
+    LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::UiLaunchFailed exiting" )
+    }
+    
+// -----------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+//lint -e{1403, 1769} Can not be initialized.
+CSendUssdHandler::CSendUssdHandler() :
+    CSatCommandHandler(),
+    iSendUssdData(),
+    iSendUssdPckg( iSendUssdData ),
+    iSendUssdRsp(),
+    iSendUssdRspPckg( iSendUssdRsp ),
+    iQueryData(),
+    iQueryPckg( iQueryData ),
+    iQueryRsp(),
+    iQueryRspPckg( iQueryRsp ),
+    iNotificationData(),
+    iNotificationDataPckg( iNotificationData ),
+    iNotificationRsp(),
+    iNotificationRspPckg( iNotificationRsp ),
+    // To be removed when icons are allowed in this command
+    iIconCommand( EFalse )
+    {
+    LOG( SIMPLE,
+        "SENDUSSD: CSendUssdHandler::CSendUssdHandler calling - exiting" )
+    }
+
+
+// -----------------------------------------------------------------------------
+// Handles the Ussd string sending
+// -----------------------------------------------------------------------------
+//
+void CSendUssdHandler::SendUssdString()
+    {
+    LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::SendUssdString calling" )
+
+    TBool sendCompletedFirst( EFalse ); // This is always false
+
+    TBuf<RSat::KStringMaxSize> sendMessage;
+    sendMessage.Copy( iSendUssdData.iUssdString.iUssdString );
+
+    TBuf<RSat::KStringMaxSize> receiveMessage;
+
+    TRAPD( error, SendUssdStringL(
+        sendMessage,
+        iSendUssdData.iUssdString.iDcs,
+        receiveMessage,
+        sendCompletedFirst,
+        iSendUssdRsp.iUssdString.iDcs ) );
+
+    iSendUssdRsp.iUssdString.iUssdString.Copy( receiveMessage );
+
+    HandleSendUssdResult( error );
+
+    LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::SendUssdString exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Handles the Ussd string sending.
+// -----------------------------------------------------------------------------
+//
+void CSendUssdHandler::SendUssdStringL(
+    const TDesC& aSendMessage,
+    const TUint8 aSendDcs,
+    TDes& aReceiveMessage,
+    TBool& aSendCompletedFirst,
+    TUint8& aReceivedDcs )
+    {
+    LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::SendUssdStringL calling" )
+    TInt error( KErrNone );
+
+    if ( iUssdClient )
+        {
+        delete iUssdClient;
+        iUssdClient = NULL;
+        }
+
+    // This needs to be EFalse, because otherwise KERN-EXEC:3 and SAT Server
+    // crashes.
+    iUssdClient = CPhCltUssdSatClient::NewL( EFalse );
+
+    LOG2( NORMAL, 
+    "SENDUSSD: CSendUssdHandler::SendUssdStringL aSendDcs:       %x", 
+    aSendDcs )
+    LOG2( NORMAL, 
+    "SENDUSSD: CSendUssdHandler::SendUssdStringL Send length:    %d", 
+    aSendMessage.Length() )
+
+    #ifdef ENABLE_SAT_LOGGING
+
+    const TInt count( aSendMessage.Length() );
+    for ( TInt i = 0; i < count; i++ )
+        {
+        LOG2( NORMAL, 
+        "SENDUSSD: CSendUssdHandler::SendUssdStringL :       0x%X", 
+        (char)aSendMessage[i] )
+        }
+
+    #endif
+
+    error = iUssdClient->SendSatMessage(
+        aSendMessage,
+        aSendDcs,
+        aReceiveMessage,
+        aSendCompletedFirst,
+        aReceivedDcs );
+
+    LOG2( NORMAL, 
+    "SENDUSSD: CSendUssdHandler::SendUssdStringL error:          %d", error )
+    LOG2( NORMAL, 
+    "SENDUSSD: CSendUssdHandler::SendUssdStringL aReceivedDcs:   %x", 
+    aReceivedDcs )
+    LOG2( NORMAL, 
+    "SENDUSSD: CSendUssdHandler::SendUssdStringL Received length:%d", 
+    aReceiveMessage.Length() )
+    LOG2( NORMAL, 
+    "SENDUSSD: CSendUssdHandler::SendUssdStringL Completed first:%i", 
+    aSendCompletedFirst )
+
+    // Convert received Dcs
+    ConvertReceivedDcs( aReceivedDcs );
+
+    User::LeaveIfError( error );
+
+    LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::SendUssdStringL exiting" )
+    }
+    
+// -----------------------------------------------------------------------------
+// Handles the result of Ussd sending.
+// -----------------------------------------------------------------------------
+//
+void CSendUssdHandler::HandleSendUssdResult( TInt aError )
+    {
+    LOG2( SIMPLE, "SENDUSSD: CSendUssdHandler::HandleSendUssdResult calling: \
+        %i", aError )
+
+    if ( iQueryRsp.iSessionTerminatedByUser ||
+         iNotificationRsp.iSessionTerminatedByUser ||
+         ( KErrCancel == aError ) ) // End key
+        {
+        LOG( SIMPLE, 
+        "SENDUSSD: CSendUssdHandler::HandleSendUssdResult TerminatedByUser" )
+        iSendUssdRsp.iGeneralResult = RSat::KUssdTransactionTerminatedByUser;
+        iSendUssdRsp.iInfoType = RSat::KNoAdditionalInfo;
+        iSendUssdRsp.iAdditionalInfo.Zero();
+        }
+    else if ( TSatExtErrorUtils::IsExtendedError( aError ) ) // extended error
+        {
+        TUint8 addInfo( 0 );
+        if ( KErrGsmCCCallRejected == aError )   
+           {
+           LOG( SIMPLE, 
+           "SENDUSSD: CSendUssdHandler::HandleSendUssdResult permanent error" )	
+           // ussd request is rejected by SIM
+           iSendUssdRsp.iGeneralResult = RSat::KInteractionWithCCPermanentError;
+           iSendUssdRsp.iInfoType = RSat::KMeProblem;
+           addInfo = RSat::KActionNotAllowed;
+           }   
+        // Check and map network failure
+        else if ( TSatExtErrorUtils::IsNetworkError( aError ) )
+            {
+            LOG( SIMPLE, 
+            "SENDUSSD: CSendUssdHandler::HandleSendUssdResult NetworkError" )
+            // Network error, map and modify
+            addInfo = TSatExtErrorUtils::MapError( aError );
+            iSendUssdRsp.iGeneralResult = RSat::KNetworkUnableToProcessCmd;
+            iSendUssdRsp.iInfoType = RSat::KSatNetworkErrorInfo;
+            }
+        else
+            {
+            LOG( SIMPLE, 
+            "SENDUSSD: CSendUssdHandler::HandleSendUssdResult MeProblem" )
+            // Not a network error, don't modify
+            addInfo = TSatExtErrorUtils::MapError( aError, EFalse );
+            iSendUssdRsp.iGeneralResult = RSat::KUssdReturnError;
+            iSendUssdRsp.iInfoType = RSat::KMeProblem;
+            }
+        // Add additional info to response
+        iSendUssdRsp.iAdditionalInfo.SetLength( 1 );
+        iSendUssdRsp.iAdditionalInfo[0] = static_cast<TUint16>( addInfo );
+        }
+    else if ( KErrInUse == aError )
+        {
+        LOG( SIMPLE, 
+        "SENDUSSD: CSendUssdHandler::HandleSendUssdResult KMeBusyOnUssd" )
+        iSendUssdRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+        iSendUssdRsp.iInfoType = RSat::KMeProblem;
+        iSendUssdRsp.iAdditionalInfo.SetLength( 1 );
+        iSendUssdRsp.iAdditionalInfo[0] = RSat::KMeBusyOnUssd;
+        }
+    else if ( KErrGeneral == aError )
+        {
+        LOG( SIMPLE, 
+        "SENDUSSD: CSendUssdHandler::HandleSendUssdResult KMeBusyOnSs" )
+        iSendUssdRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+        iSendUssdRsp.iInfoType = RSat::KMeProblem;
+        iSendUssdRsp.iAdditionalInfo.SetLength( 1 );
+        iSendUssdRsp.iAdditionalInfo[0] = RSat::KMeBusyOnSs;
+        }
+    else if ( KErrNotFound == aError )
+        {
+        LOG( SIMPLE, 
+        "SENDUSSD: CSendUssdHandler::HandleSendUssdResult \
+        KNoSpecificMeProblem" )
+        iSendUssdRsp.iGeneralResult = RSat::KUssdReturnError;
+        iSendUssdRsp.iInfoType = RSat::KMeProblem;
+        iSendUssdRsp.iAdditionalInfo.SetLength( 1 );
+        iSendUssdRsp.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
+        }
+    else if ( KErrSatBusy == aError )
+        {
+        LOG( SIMPLE, 
+        "SENDUSSD: CSendUssdHandler::HandleSendUssdResult \
+        KInteractionWithCCTemporaryError" )
+        iSendUssdRsp.iGeneralResult = RSat::KInteractionWithCCTemporaryError;
+        iSendUssdRsp.iInfoType = RSat::KNoAdditionalInfo;
+        iSendUssdRsp.iAdditionalInfo.SetLength( 0 );
+        iSendUssdRsp.iAdditionalInfo.Zero();
+        }
+    else if ( KErrSatControl == aError )
+        {
+        LOG( SIMPLE, 
+        "SENDUSSD: CSendUssdHandler::HandleSendUssdResult \
+        KModifiedByCallControl" )
+        iSendUssdRsp.iGeneralResult = RSat::KModifiedByCallControl;
+        iSendUssdRsp.iInfoType = RSat::KNoAdditionalInfo;
+        iSendUssdRsp.iAdditionalInfo.SetLength( 0 );
+        iSendUssdRsp.iAdditionalInfo.Zero();
+		}
+    else if ( KErrNone == aError )   //  Success case
+        {
+        LOG( SIMPLE, 
+        "SENDUSSD: CSendUssdHandler::HandleSendUssdResult success" )
+        // Convert terminal rsp if icon used
+        iSendUssdRsp.iGeneralResult = RSat::KSuccess;
+
+        // If command had icon data and was done succesfully,
+        // report that icon was not shown.
+        // To be removed and correct handling (i.e. ClientResponse to
+        // notification is received) for general result
+        // KSuccessRequestedIconNotDisplayed must be added when icons
+        // are allowed in this command 
+        if ( iIconCommand )
+            {
+            LOG( SIMPLE, 
+            "SENDUSSD: CSendUssdHandler::HandleSendUssdResult \
+            IconNotDisplayed" )
+            iSendUssdRsp.iGeneralResult =
+                        RSat::KSuccessRequestedIconNotDisplayed;
+            }
+
+        iSendUssdRsp.iInfoType = RSat::KNoAdditionalInfo;
+        iSendUssdRsp.iAdditionalInfo.Zero();
+        }
+    else // unknown error
+        {
+        LOG( SIMPLE, 
+        "SENDUSSD: CSendUssdHandler::HandleSendUssdResult unknown error" )
+        iSendUssdRsp.iGeneralResult = RSat::KUssdReturnError;
+        iSendUssdRsp.iInfoType = RSat::KNoAdditionalInfo;
+        iSendUssdRsp.iAdditionalInfo.Zero();
+        }
+
+    SendTerminalResponse();
+    LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::HandleSendUssdResult exiting" )
+    }
+
+
+// -----------------------------------------------------------------------------
+// Converts reveived Dcs to correct format.
+// -----------------------------------------------------------------------------
+//
+void CSendUssdHandler::ConvertReceivedDcs( TUint8& aReceivedDcs ) const
+    {
+    LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::ConvertReceivedDcs calling" )
+
+    switch ( aReceivedDcs )
+        {
+        case KPhCltDcs7Bit:
+            {
+            LOG( NORMAL, 
+            "SENDUSSD: CSendUssdHandler::ConvertReceivedDcs Dcs7Bit" )
+            aReceivedDcs = KSatDcs7Bit;
+            }
+            break;
+
+        case KPhCltDcs8Bit:
+            {
+            LOG( NORMAL, 
+            "SENDUSSD: CSendUssdHandler::ConvertReceivedDcs Dcs8Bit" )
+            aReceivedDcs = KSatDcs8Bit;
+            }
+            break;
+
+        case KPhCltDcsUcs2:
+            {
+            LOG( NORMAL, 
+            "SENDUSSD: CSendUssdHandler::ConvertReceivedDcs DcsUCS2" )
+            aReceivedDcs = KSatDcsUCS2;
+            }
+            break;
+
+        case KPhCltDcsUnknown:
+            {
+            LOG( NORMAL, 
+            "SENDUSSD: CSendUssdHandler::ConvertReceivedDcs DcsUnknown" )
+            aReceivedDcs = KSatDcsUnknown;
+            }
+            break;
+
+        case KSatDcs7Bit:
+        case KSatDcs8Bit:
+        case KSatDcsUCS2:
+        case KSatDcsUnknown:
+            {
+            LOG( NORMAL, 
+            "SENDUSSD: CSendUssdHandler::ConvertReceivedDcs Already valid" )
+            }
+            break;
+
+        default:
+            {
+            LOG( NORMAL, 
+            "SENDUSSD: CSendUssdHandler::ConvertReceivedDcs Unknown" )
+            aReceivedDcs = KSatDcsUnknown;
+            }
+            break;
+        }
+
+    LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::ConvertReceivedDcs exiting" )
+    }
+    
+// -----------------------------------------------------------------------------
+// Sends terminal response. Makes sure that terminal response
+// is not send more that once / command.
+// -----------------------------------------------------------------------------
+//
+void CSendUssdHandler::SendTerminalResponse()
+    {
+    LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::SendTerminalResponse calling" )
+
+    if ( !iTerminalRespSent )
+        {
+        LOG( SIMPLE, 
+        "SENDUSSD: CSendUssdHandler::SendTerminalResponse iTerminalRespSent \
+        false" )
+        
+        LOG3(SIMPLE, "SENDUSSD: CSendUssdHandler::SendTerminalResponse \
+            iDcs=%d,iUssdString=%s", iSendUssdRsp.iUssdString.iDcs,
+            &iSendUssdRsp.iUssdString.iUssdString);
+        
+        iTerminalRespSent = ETrue;
+        iSendUssdRsp.SetPCmdNumber( iSendUssdData.PCmdNumber() );
+        TerminalRsp( RSat::ESendUssd, iSendUssdRspPckg );
+        }
+
+    LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::SendTerminalResponse exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Check validity of a given Data Coding Cheme (Dcs).
+// -----------------------------------------------------------------------------
+//
+TBool CSendUssdHandler::DcsValid( const TUint8 aDcs ) const
+    {
+    LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::DcsValid calling" )
+
+    TBool isDcsValid( EFalse );
+                                                               //      76543210
+    TUint8 codingGroup  = ( aDcs & 0xF0 ) >> KHighNibbleShift; // bits XXXX____
+    TUint8 characterSet = ( aDcs & 0x0C ) >> KQuarterShift;    // bits ____XX__
+    TUint8 lowQuartet   = ( aDcs & 0x0F );                     // bits ____XXXX
+    LOG2( SIMPLE, 
+    "SENDUSSD: CSendUssdHandler::DcsValid codingGroup: %x", codingGroup)
+    switch ( codingGroup )
+        {
+        case 0x00:
+        case 0x02:
+        case 0x03:
+        case 0x0F:
+            {
+            isDcsValid = ETrue;
+            break;
+            }
+
+        case 0x01:
+            {
+            if ( ( KDcsCharacterSet7Bit2 == lowQuartet ) ||
+                 ( KDcsCharacterSet16Bit2 == lowQuartet ) )
+                {
+                LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::DcsValid valid" )
+                isDcsValid = ETrue;
+                }
+            break;
+            }
+
+        case 0x04:
+        case 0x05:
+        case 0x06:
+        case 0x07:
+        case 0x09:
+            {
+            if ( ( KDcsCharacterSet7Bit == characterSet ) ||
+                 ( KDcsCharacterSet8Bit == characterSet ) ||
+                 ( KDcsCharacterSet16Bit == characterSet ) )
+                {
+                LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::DcsValid isDcsValid" )
+                isDcsValid = ETrue;
+                }
+            break;
+            }
+
+        default:
+            {
+            LOG2( SIMPLE, "SENDUSSD:   Reserved Dcs found: %x", aDcs )
+            }
+        }
+
+    LOG2(
+        SIMPLE,
+        "SENDUSSD: CSendUssdHandler::DcsValid exiting, valid = %d",
+        isDcsValid )
+    return isDcsValid;
+    }
+
+// -----------------------------------------------------------------------------
+// USSD sending should be transparent if alpha identifier is provided but it's
+// length is 0. Also user query setting is not on.
+// -----------------------------------------------------------------------------
+//
+TBool CSendUssdHandler::TransparentUssdSending()
+    {
+    LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::TransparentUssdSending calling" )
+    TBool result( EFalse );
+    const RSat::TAlphaId alphaId( iSendUssdData.iAlphaId );
+
+    // Store to member variable for later use
+    iQueryOn = iUtils->SystemState().IsConfirmSatOperationsOn();
+
+    if ( ( alphaId.iStatus == RSat::EAlphaIdProvided &&
+           alphaId.iAlphaId.Length() == 0 ) ||
+           alphaId.iStatus == RSat::EAlphaIdNull )
+        {
+        LOG( SIMPLE, 
+        "SENDUSSD: CSendUssdHandler::TransparentUssdSending AlphaId" )
+        if ( !iQueryOn )
+            {
+            LOG( SIMPLE, 
+            "SENDUSSD: CSendUssdHandler::TransparentUssdSending iQueryOn \
+            false" )
+            result = ETrue;
+            }
+        }
+
+    LOG2( SIMPLE, 
+    "SENDUSSD: CSendUssdHandler::TransparentUssdSending exiting: %i", result )
+    return result;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SendUSSDCmd/src/std.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 functions
+*
+*/
+
+
+#include    <e32base.h>
+#include    <implementationproxy.h>
+#include    "CSendUssdHandler.h"
+
+const TImplementationProxy implementationTable[] =
+    {
+    //lint -e{611, 1924} Warning "Suspicious cast" can not be avoided.
+    IMPLEMENTATION_PROXY_ENTRY( 0x10202984, CSendUssdHandler::NewL )
+    };
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy ECOM framework factory function
+// Calculates the number of implementations.
+// Returns: Implementation proxy.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount ) // Number of implementations
+    {
+    aTableCount =
+        sizeof( implementationTable ) /
+        sizeof( TImplementationProxy );
+    return implementationTable;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SetUpCallCmd/group/Create-UT_CSetUpCallHandler-Sis.bat	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,70 @@
+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: This BAT copies Test DLL to local folder and makes SIS file
+rem
+
+@echo off
+echo.
+echo ====================================
+echo.
+echo Digia EUnit - Test
+echo.
+echo This BAT copies Test DLL
+echo to local folder and makes SIS file
+echo.
+echo ====================================
+echo.
+
+:CHECK_EPOCROOT
+echo.
+echo - verify epoc root
+set EPOCROOT
+if errorlevel == 1 goto END_ERROR 
+
+:COPY_DLL
+echo.
+echo - copy test dll to current directory
+copy %EPOCROOT%epoc32\release\thumb\urel\UT_CSetUpCallHandler.dll .
+if errorlevel == 1 goto END_ERROR 
+
+:CREATE_DIR
+echo.
+echo - create Sis folder (created only if needed)
+mkdir ..\Sis
+
+:MAKESIS
+echo.
+echo - makesis UT_CSetUpCallHandler.pkg ..\sis\UT_CSetUpCallHandler.sis
+call makesis UT_CSetUpCallHandler.pkg ..\sis\UT_CSetUpCallHandler.sis
+if errorlevel == 1 goto END_ERROR
+
+:DELETE_DLL
+echo.
+echo - remove the copied dll from current folder
+del UT_CSetUpCallHandler.dll
+goto END
+
+:END_ERROR
+echo.
+echo Sis creation failed. 
+goto FINAL_END
+
+:END
+echo.
+echo Sis file created succesfully
+echo ============================
+
+:FINAL_END
+echo.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SetUpCallCmd/group/SetUpCallCmd.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,56 @@
+/*
+* 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:  Project definition file for project SetUpCall plug-in
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../../inc/SatMacroes.h"
+
+TARGET                  SetUpCallCmd.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D 0x1000F005
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  std.cpp
+SOURCE                  CSetUpCallHandler.cpp
+SOURCE                  csetupcallrequesthandler.cpp
+SOURCE                  csetupcalldtmfsender.cpp
+
+START RESOURCE          1000f005.rss
+TARGET                  SetUpCallCmd.rsc
+END
+
+USERINCLUDE             ../../../inc
+USERINCLUDE             ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+SYSTEMINCLUDE           ../../../../../inc      // Domain telephony
+SYSTEMINCLUDE           ../../../../inc         // Subsystem satengine
+
+LIBRARY                 euser.lib
+LIBRARY                 etelsat.lib
+LIBRARY                 etelmm.lib
+LIBRARY                 etel.lib
+LIBRARY                 satengine.lib
+
+#ifdef ENABLE_SAT_LOGGING
+LIBRARY                 flogger.lib
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SetUpCallCmd/group/UT_CSetUpCallHandler.pkg	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,55 @@
+;
+; 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: For packing UT_CSetUpCallHandler.
+;
+
+/*
+* ==============================================================================
+*  Name        : UT_CSetUpCallHandler.pkg
+*  Part of     : SatServer / SetUpCallCmd
+*  Description : Project package file for project SetUpCall plug-in
+*  Version     : %version: e003sa17#6 %
+*
+*  Copyright (C) 2002-2008 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.
+* ============================================================================
+* Template version: 4.0
+*/
+; Supported languages
+&en
+
+; Package header (one name for each supported language)
+#{"UT_CSetUpCallHandler"},(0x01700000),0,10,0
+
+; Package signature
+
+
+; Options line not supported currently
+
+; Conditions blocks not supported currently
+
+; Language independent files that are always installed
+"UT_CSetUpCallHandler.dll"-"!:\DigiaEUnit\Tests\UT_CSetUpCallHandler.dll"
+
+; Language dependent files 
+
+
+; Requisites (of type: (UID),Major,Minor,Build-Number,{"Requisite Name1", "Requisite Name2"})
+(0x101F6F88), 0, 0, 0, {"Series60ProductID"}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SetUpCallCmd/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 SetUpCall plug-in
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+SetUpCallCmd.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SetUpCallCmd/inc/CSetUpCallHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,257 @@
+/*
+* 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:  SetUpCall command handler
+*
+*/
+
+
+#ifndef CSETUPCALLHANDLER_H
+#define CSETUPCALLHANDLER_H
+
+#include <etelsat.h>
+
+#include "CSatCommandHandler.h"
+#include "SatSTypes.h"
+
+class CSetupCallRequestHandler;
+
+/**
+*  Command handler for SetUpCall command.
+*
+*  @lib SetUpCallCmd.lib
+*  @since S60 v3.0
+*/
+class CSetUpCallHandler : public CSatCommandHandler
+    {
+
+public:
+
+    static CSetUpCallHandler* NewL( MSatUtils* aUtils );
+
+    virtual ~CSetUpCallHandler();
+
+// from base class MSatEventObserver
+
+    /**
+     * From MSatEventObserver.?
+     * Event notification.
+     *
+     * @param aEvent Identifies the event.
+     */
+    void Event( TInt aEvent );
+
+// from base class MSatCommand
+
+    /**
+     * From MSatCommand.
+     * Response from the client
+     *
+     */
+    void ClientResponse();
+
+    /**
+    * Handle the setup call Request Complete.
+    *
+    * @param aErrCode Result of ETelMM Api calling.
+    */
+    void SetupCallRequestComplete( const TInt aErrCode );
+
+protected:
+
+// from base class CActive
+
+    /**
+     * From CActive
+     * Cancels the usat request.
+     *
+     */
+    void DoCancel();
+
+// from base class CSatCommandHandler
+
+    /**
+     * From CSatCommandHandler
+     * Requests the command notification.
+     *
+     * @param aStatus Request status
+     */
+    void IssueUSATRequest( TRequestStatus& aStatus );
+
+    /**
+     * From CSatCommandHandler
+     * Precheck before executing the command.
+     *
+     * @return TBool indicating command is currently allowed.
+     */
+    TBool CommandAllowed();
+
+    /**
+     * From CSatCommandHandler
+     * Need for ui session.
+     *
+     * @return TBool indicating need of ui session.
+     */
+    TBool NeedUiSession();
+
+    /**
+     * From CSatCommandHandler
+     * Called when USAT API notifies that command.
+     *
+     */
+    void HandleCommand();
+
+    /**
+     * From CSatCommandHandler
+     * Indication that UI launching failed.
+     *
+     */
+    void UiLaunchFailed();
+
+private:
+
+    CSetUpCallHandler();
+
+    void ConstructL();
+
+    /**
+     * Performs the request to dial
+     *
+     * @since S60 3.2
+     */
+    void DoSetupCall( CSetupCallRequestHandler& aHandler );
+
+    /**
+     * Return terminal response filled according to dial result.
+     *
+     * @since S60 3.2
+     * @param aStatus Dial status from phone.
+     */
+    void CompleteSetupCallWithStatus(
+        const TInt32 aStatus );
+
+    /**
+     * Return terminal response filled according to result.
+     *
+     * @since S60 3.2
+     * @param aGeneralResult Completion status.
+     */
+    void CompleteSetupCall(
+        const RSat::TPCmdResult aGeneralResult );
+
+    /**
+     * Return terminal response filled according to result.
+     *
+     * @since S60 3.2
+     * @param aGeneralResult Completion status.
+     * @param aAdditionalInfo Completion status additional info.
+     */
+    void CompleteSetupCall(
+        const RSat::TPCmdResult aGeneralResult,
+        const TInt16 aAdditionalInfo );
+
+    /**
+     * Checks the dialling number string for extended BCD
+     * values. Changes them to correct characters
+     * see ETSI 11.11 10.5.1
+     *
+     * @param aNumber dialling number string
+     */
+    void CheckNumber( TDes& aNumber ) const;
+        
+    /**
+     * Create emergency call
+     */
+    void CreateEmergencyCall( CSetupCallRequestHandler& aHandler );
+    
+    /**
+     * Check the Param of the setup call 
+     */
+    TBool CheckSetupCallParam();
+    
+private: // data
+
+    /**
+     * SetUpCall command data from SIM.
+     */
+    RSat::TSetUpCallV1 iSetUpCallData;
+
+    /**
+     * SetUpCall command package.
+     */
+    RSat::TSetUpCallV1Pckg iSetUpCallPckg;
+
+    /**
+     * SetUpCall response data from client.
+     */
+    RSat::TSetUpCallRspV2 iSetUpCallRsp;
+
+    /**
+     * SetUpCall response package
+     */
+    RSat::TSetUpCallRspV2Pckg iSetUpCallRspPckg;
+
+    /**
+     * Query command data.
+     */
+    TSatQueryV1 iQueryData;
+
+    /**
+     * Query package.
+     */
+    TSatQueryV1Pckg iQueryPckg;
+
+    /**
+     * Query response.
+     */
+    TSatQueryRspV1 iQueryRsp;
+
+    /**
+     * Query rsp package.
+     */
+    TSatQueryRspV1Pckg iQueryRspPckg;
+
+    /**
+     * Handing the asynchronous request
+     */
+    CSetupCallRequestHandler* iRequestHandler;
+      
+    /**
+     * Current call is an emergency call.
+     */
+    TBool iEmergencyCall;
+
+    /**
+     * Indicates if call control is active
+     */
+    TBool iCallControlActive;
+
+    /**
+     * wait scheduler
+     */
+    CActiveSchedulerWait iWait;
+
+    /**
+     * Boolean indicating is command pending for CallControl completion
+     */
+    TBool iPCmdPending;
+
+    /**
+     * Flag to signal that command has icon data
+     * To be removed when icons are allowed in this command
+     */
+    TBool iIconCommand;
+
+    };
+
+#endif      // CSETUPCALLHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SetUpCallCmd/inc/SetUpCallCmd.rls	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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 headers for project SetUpCallCmd
+*
+*/
+
+
+#ifndef SETUPCALLCMD_RLS
+#define SETUPCALLCMD_RLS
+
+rls_string STRING_r_setupcallcmd_display_name "SetUpCall command"
+rls_string STRING_r_setupcallcmd_default_data "SetUpCallCmd"
+rls_string STRING_r_setupcallcmd_opaque_data  ""
+
+#endif // SETUPCALLCMD_RLS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SetUpCallCmd/inc/csetupcallrequesthandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,119 @@
+/*
+* 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:  Create the call and emergency call to ETelMM
+*
+*/
+
+
+#ifndef CSETUPCALLREQUESTHANDLER_H
+#define CSETUPCALLREQUESTHANDLER_H
+
+#include <e32base.h>
+#include "msatmultimodeapi.h"
+
+class CSetUpCallHandler;
+class MSatAsyncToSync;
+class CSetupCallDtmfSender;
+
+/**
+*  This is the handler for the ETel MM api Request.
+*  This active objects is registered with ETelMM Api to send request and 
+*  receive notifications about some Request Complete.
+*
+*/
+
+NONSHARABLE_CLASS ( CSetupCallRequestHandler ) : public CActive
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     * @param aPhone A reference to the MSatMultiModeApi.
+     * @param aDispatcher Pointer to Ss handler
+     * @return a pointer to the newly created object.
+     */
+    static CSetupCallRequestHandler* NewL( MSatMultiModeApi& aPhone,
+        CSetUpCallHandler* aDispatcher );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CSetupCallRequestHandler();
+
+    /**
+     * Access RMobileCall::DialNoFdnCheck by MSatMultiModeApi
+     * for the paramter information please see the etelmm.h
+     */
+    void DialNumber( const TDesC8& aCallParams, TDes& aTelNumber,
+            TBool aTerminateOtherCall, MSatAsyncToSync* aAsyncToSync );
+
+    /**
+     * Access RMobileCall::DialEmergencyCall by MSatMultiModeApi
+     * for the paramter information please see the etelmm.h
+     */
+    void DialEmergencyCall( const TDesC& aTelNumber );
+    
+    /**
+     * Cancel the asynchronous operations that required to the ETel MM api  
+     */
+    void CancelOperation();
+    
+ 
+protected:
+
+    /**
+     * From CActive, handles the request completion.
+     */
+    void RunL();
+    
+    
+    /**
+     * From CActive, handle the request cancel
+     */
+    void DoCancel();
+
+private:
+
+    /**
+     * C++ default constructor.
+     * @param aPriority An active object priority value.
+     * @param aPhone A reference to MSatMultiModeApi.
+     */
+    CSetupCallRequestHandler( MSatMultiModeApi& aPhone,
+        CSetUpCallHandler* aDispatcher );
+    
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */ 
+    void ConstructL();
+        
+private: // Data
+
+    /**
+     * Reference to the MSatMultiModeApi
+     */
+    MSatMultiModeApi& iPhone;
+        
+    /**
+     * Pointer to SetupCall command handler
+     */
+    CSetUpCallHandler* iDispatcher;
+    
+    /**
+     * Own. Dtmf sender
+     */    
+    CSetupCallDtmfSender* iDtmfSender;
+    };
+
+#endif      // CSETUPCALLREQUESTHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SetUpCallCmd/src/1000f005.rss	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 1000 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Registry information for ECOM
+*
+*/
+
+
+
+//  INCLUDES
+#include <registryinfo.rh>
+#include "SetUpCallCmd.rls"
+
+//  RESOURCE DEFINITIONS
+// -----------------------------------------------------------------------------
+//
+// SetUpCallCmdInfo
+// Registeration information for ECOM
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO SetUpCallCmdInfo
+    {
+    dll_uid = 0x1000f005;
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x1000f001;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x1000f006;
+                    version_no   = 1;
+                    display_name = STRING_r_setupcallcmd_display_name;
+                    default_data = STRING_r_setupcallcmd_default_data;
+                    opaque_data  = STRING_r_setupcallcmd_opaque_data;
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SetUpCallCmd/src/CSetUpCallHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,997 @@
+/*
+* 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:  Handles SetUpCall command
+*
+*/
+#include    <e32base.h>
+#include    <etelmm.h>
+#include    <exterror.h>
+
+#include    "MSatApi.h"
+#include    "MSatUtils.h"
+#include    "MSatSystemState.h"
+#include    "MSatUiSession.h"
+#include    "SatSOpcodes.h"
+#include    "MSatSUiClientHandler.h"
+#include    "csetupcallrequesthandler.h"
+#include    "CSetUpCallHandler.h"
+#include    "TSatExtErrorUtils.h"
+#include    "SatLog.h"
+
+const TUint8 KBCDAsterisk( 0x0A );
+const TUint8 KBCDDash( 0x0B );
+const TUint8 KBCDDTMF( 0x0C );
+const TUint8 KBCDWild( 0x0D );
+const TUint8 KBCDExpansion( 0x0E );
+
+const TUint8 KAsteriskChar( 0x2A );
+const TUint8 KDashChar( 0x23 );
+const TUint8 KDTMFChar( 0x70 );
+const TUint8 KWildChar( 0x77 );
+const TUint8 KExpansionChar( 0x2E );
+
+/** Maximum name length. */ 
+const TInt KSatMaximumNameLength = 50;
+
+/** Maximum phone number length same as  used by phone. */ 
+const TInt KSatMaximumPhoneNumberLength = 100;
+
+/** The subaddress length, see ITU-T I.330 and 3GPP TS 11.14. */ 
+const TInt KSatSubAddressLength = 21;
+
+/** The maximum bearer length. The bearer capabilities as 
+defined in GSM 04.08. */ 
+const TInt KSatBearerLength = 14;
+
+
+_LIT( KFixedSimEmergencyNumber, "112" );
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSetUpCallHandler* CSetUpCallHandler::NewL( MSatUtils* aUtils )
+    {
+    LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::NewL calling" )
+
+    CSetUpCallHandler* self = new( ELeave ) CSetUpCallHandler;
+
+    CleanupStack::PushL( self );
+    self->BaseConstructL( aUtils );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::NewL exiting" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CSetUpCallHandler::~CSetUpCallHandler()
+    {
+    LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::~CSetUpCallHandler calling" )
+
+    Cancel();
+    
+    delete iRequestHandler;
+    iRequestHandler = NULL;
+
+    LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::~CSetUpCallHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class MSatEventObserver.
+// Event notification.
+// -----------------------------------------------------------------------------
+//
+void CSetUpCallHandler::Event( TInt aEvent )
+    {
+    LOG2( SIMPLE, "SETUPCALL: CSetUpCallHandler::Event calling,aEvent: %i",
+          aEvent )
+
+    if ( MSatUtils::ECallControlExecuting == aEvent )
+        {
+        LOG( SIMPLE,
+            "SETUPCALL: CSetUpCallHandler::Event: ECallControlExecuting" )
+        iCallControlActive = ETrue;
+        }
+    else if ( MSatUtils::ECallControlDone == aEvent )
+        {
+        LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::Event: ECallControlDone" )
+        iCallControlActive = EFalse;
+
+        // Check if SetUpCall command has arrived from SIM during CC execution
+        // Emergency call is made immediate regardless of call control.
+        if ( !IsActive() && iPCmdPending && !iEmergencyCall )
+            {
+            LOG( SIMPLE, 
+            "SETUPCALL: CSetUpCallHandler::Event: setupcall" )
+            iPCmdPending = EFalse;
+            // Execute the setupcall.
+            DoHandleCommand();
+            }
+        }
+
+    CSatCommandHandler::Event( aEvent );
+
+    LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::Event exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class MSatCommand.
+// Response from the client.
+// -----------------------------------------------------------------------------
+//
+void CSetUpCallHandler::ClientResponse()
+    {
+    LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::ClientResponse calling" )
+
+    if ( iQueryRsp.iAccepted )
+        {
+        // User accepted the call, make the call
+        if( iRequestHandler )
+            {
+            DoSetupCall( *iRequestHandler );
+            }
+        else
+            {
+            CompleteSetupCall(
+                RSat::KMeUnableToProcessCmd,
+                RSat::KNoSpecificMeProblem );
+            }
+        }
+    else
+        {
+        LOG( NORMAL, 
+        "SETUPCALL: CSetUpCallHandler::ClientResponse User Cancel" )
+
+        if ( iQueryRsp.iSessionTerminatedByUser )
+            {
+            LOG( SIMPLE, 
+            "SETUPCALL: CSetUpCallHandler::ClientResponse TerminatedByUser" )
+            // Notify sim session end command that next sim session end
+            // should close the ui session.
+            iUtils->NotifyEvent( MSatUtils::ESessionTerminatedByUser );
+            }
+
+        // End key is pressed during confirmation or user denied call setup,
+        // KPCmdNotAcceptedByUser is an expected response,
+        CompleteSetupCall( RSat::KPCmdNotAcceptedByUser );
+        }
+
+    LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::ClientResponse exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CActive.
+// Cancels the sat request.
+// -----------------------------------------------------------------------------
+//
+void CSetUpCallHandler::DoCancel()
+    {
+    LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::DoCancel calling" )
+
+    iUtils->USatAPI().NotifySetUpCallCancel();
+    if( iRequestHandler )
+        {
+        iRequestHandler->Cancel();
+        }
+
+    LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Requests the command notification.
+// -----------------------------------------------------------------------------
+//
+void CSetUpCallHandler::IssueUSATRequest( TRequestStatus& aStatus )
+    {
+    LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::IssueUSATRequest calling" )
+
+    // Clear the IPC package.
+    new (&iSetUpCallData) RSat::TSetUpCallV1();
+    iPCmdPending = EFalse;
+    iQueryRsp.iAccepted = EFalse;
+
+    iUtils->USatAPI().NotifySetUpCall( aStatus, iSetUpCallPckg );
+
+    LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::IssueUSATRequest exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// SetUpCall command is not allowed in following situations:
+//      - Phone is not registered to homenetwork and roaming.
+//      - phone is ringing, alerting or call is on and SetUpCall command
+//        is "make call only if not busy", "make call only if not busy wiht
+//        redial" or "Call type not set".
+// -----------------------------------------------------------------------------
+//
+TBool CSetUpCallHandler::CommandAllowed()
+    {
+    LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CommandAllowed calling" )
+    TBool commandAllowed( ETrue );
+
+    // Emergency call can newer be denied.
+    // The usage of constant emergency number is according to ETSI TS 31.111.
+    iEmergencyCall =
+        ( 0 == iSetUpCallData.iAddress.iTelNumber.Compare(
+            KFixedSimEmergencyNumber ) );
+
+    if ( !iEmergencyCall )
+        {
+        RMobilePhone::TMobilePhoneRegistrationStatus networkStatus(
+            iUtils->SystemState().GetNetworkRegistrationStatus() );
+
+        if ( ( ( RSat::EAlphaIdProvided !=
+                     iSetUpCallData.iAlphaIdConfirmationPhase.iStatus ) &&
+               ( ( RSat::ESelfExplanatory ==
+                       iSetUpCallData.iIconIdConfirmationPhase.iQualifier ) ||
+                 ( RSat::ENotSelfExplanatory ==
+                       iSetUpCallData.iIconIdConfirmationPhase.iQualifier ) ) )
+                 ||
+             ( ( RSat::EAlphaIdProvided !=
+                     iSetUpCallData.iAlphaIdCallSetUpPhase.iStatus ) &&
+               ( ( RSat::ESelfExplanatory ==
+                       iSetUpCallData.iIconIdCallSetUpPhase.iQualifier ) ||
+                 ( RSat::ENotSelfExplanatory ==
+                       iSetUpCallData.iIconIdCallSetUpPhase.iQualifier ) ) ) )
+            {
+            // Icon data is received without alpha id.
+            CompleteSetupCall( RSat::KCmdDataNotUnderstood );
+
+            commandAllowed = EFalse;
+            LOG( SIMPLE, 
+            "SETUPCALL: CSetUpCallHandler::CommandAllowed Icon received \
+            without alpha id" )
+            }
+        else if ( ( RMobilePhone::ERegisteredOnHomeNetwork != networkStatus ) &&
+                  ( RMobilePhone::ERegisteredRoaming != networkStatus ) )
+            {
+            // Not registered to network.
+            CompleteSetupCall( RSat::KMeUnableToProcessCmd, RSat::KNoService );
+
+            commandAllowed = EFalse;
+            LOG( SIMPLE, 
+            "SETUPCALL: CSetUpCallHandler::CommandAllowed Registration not \
+            valid" )
+            }
+        else
+            {
+            LOG( SIMPLE, 
+            "SETUPCALL: CSetUpCallHandler::CommandAllowed others" )
+            // Call type
+            const RSat::TSetUpCallType callType( iSetUpCallData.iType );
+
+            // Command does not allow to make a call if busy
+            const TBool dontMakeCallIfBusy(
+                ( RSat::EOnlyIfNotBusy == callType ) ||
+                ( RSat::EOnlyIfNotBusyWithRedial == callType ) ||
+                ( RSat::ESetUpCallTypeNotSet == callType ) );
+
+            if ( dontMakeCallIfBusy )
+                {
+                LOG( SIMPLE, 
+                "SETUPCALL: CSetUpCallHandler::CommandAllowed \
+                dontMakeCallIfBusy true" )
+                // Is the call ongoing
+                const TBool callIsOngoing(
+                    iUtils->SystemState().IsCallActive() );
+
+                // Is the call incoming
+                const TBool callIsIncoming(
+                    iUtils->SystemState().IsCallIncoming() );
+
+                if ( callIsOngoing || callIsIncoming )
+                    {
+                    // Set the terminal response info.
+                    CompleteSetupCall(
+                        RSat::KMeUnableToProcessCmd,
+                        RSat::KMeBusyOnCall );
+
+                    commandAllowed = EFalse;
+                    LOG( SIMPLE, 
+                    "SETUPCALL: CSetUpCallHandler::CommandAllowed Busy" )
+                    }
+                }
+            }
+
+        if ( commandAllowed )
+            {
+            LOG( SIMPLE, 
+            "SETUPCALL: CSetUpCallHandler::CommandAllowed Allowed to call" )
+
+            // Set icon command flag whether icon data was received and
+            // set qualifier to no icon id
+            // To be removed when icons are allowed in this command
+            if ( ( RSat::ESelfExplanatory ==
+                     iSetUpCallData.iIconIdConfirmationPhase.iQualifier ) ||
+                 ( RSat::ENotSelfExplanatory ==
+                     iSetUpCallData.iIconIdConfirmationPhase.iQualifier ) ||
+                 ( RSat::ESelfExplanatory ==
+                     iSetUpCallData.iIconIdCallSetUpPhase.iQualifier ) ||
+                 ( RSat::ENotSelfExplanatory ==
+                     iSetUpCallData.iIconIdCallSetUpPhase.iQualifier ) )
+                {
+                LOG( SIMPLE, "SETUPCALL:   ENoIconId" )
+                iIconCommand = ETrue;
+                iSetUpCallData.iIconIdConfirmationPhase.iQualifier =
+                    RSat::ENoIconId;
+                iSetUpCallData.iIconIdCallSetUpPhase.iQualifier =
+                    RSat::ENoIconId;
+                }
+            else
+                {
+                iIconCommand = EFalse;
+                }
+            }
+        }
+    else
+        {
+        LOG( SIMPLE, 
+        "SETUPCALL: CSetUpCallHandler::CommandAllowed Emergency call" )
+        }
+
+    LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CommandAllowed exiting" )
+    
+    return commandAllowed;
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Need for ui session.
+// -----------------------------------------------------------------------------
+//
+TBool CSetUpCallHandler::NeedUiSession()
+    {
+    LOG( NORMAL, "SETUPCALL: CSetUpCallHandler::NeedUiSession calling" )
+
+    // Notify Cover UI if it's supported
+    if ( iUtils->CoverUiSupported() )
+        {
+        LOG( NORMAL, 
+        "SETUPCALL: CSetUpCallHandler::NeedUiSession CoverUiSupported" )
+        TSatCommandData medEventData;
+        medEventData.iPCmdNumber = RSat::ESetUpCall;
+        medEventData.iAlphaId = iSetUpCallData.iAlphaIdCallSetUpPhase;
+        medEventData.iDuration.iTimeUnit = RSat::ESeconds;
+        medEventData.iDuration.iNumOfUnits = KSatDefaultDuration;
+        medEventData.iIconID = iSetUpCallData.iIconIdCallSetUpPhase;
+        TSatCommandPckg tPckg( medEventData );
+        iUtils->RaiseSatEvent( tPckg );
+        }
+
+    LOG( NORMAL, "SETUPCALL: CSetUpCallHandler::NeedUiSession exiting" )
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Called when USAT API notifies that command.
+// -----------------------------------------------------------------------------
+//
+void CSetUpCallHandler::HandleCommand()
+    {
+    LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::HandleCommand calling" )
+
+    if ( iEmergencyCall )
+        {
+        LOG( SIMPLE, 
+        "SETUPCALL: CSetUpCallHandler::HandleCommand iEmergencyCall true" )
+        if ( iRequestHandler )
+            {
+            CreateEmergencyCall( *iRequestHandler );
+            }
+        else
+            {
+            iEmergencyCall = EFalse;
+            // Set the terminal response info.
+            CompleteSetupCall(
+                RSat::KMeUnableToProcessCmd,
+                RSat::KNoSpecificMeProblem );
+            }
+        }
+    else
+        {
+        const RSat::TAlphaIdStatus alphaIdStatus(
+            iSetUpCallData.iAlphaIdCallSetUpPhase.iStatus );
+
+        // If the alpha id is null, then use SAT name as a alpha identifier.
+        if ( ( RSat::EAlphaIdNull == alphaIdStatus )  ||
+             ( RSat::EAlphaIdNotPresent == alphaIdStatus ) )
+            {
+            LOG( SIMPLE, 
+            "SETUPCALL: CSetUpCallHandler::HandleCommand set AlphaId" )
+            iSetUpCallData.iAlphaIdCallSetUpPhase.iAlphaId =
+                iUtils->SatAppName();
+            iSetUpCallData.iAlphaIdCallSetUpPhase.iStatus =
+                RSat::EAlphaIdProvided;
+            }
+
+        // Copy the data to package, which is sent to client.
+        iQueryData.iCommand = ESatSSetUpCallQuery;
+        iQueryData.iQueryText.Copy(
+            iSetUpCallData.iAlphaIdConfirmationPhase.iAlphaId );
+        iQueryData.iSimApplicationName.Copy( iUtils->SatAppName() );
+        iQueryData.iAlphaIdStatus = ESatAlphaIdNotNull; // Always
+        iQueryData.iIconId.iIdentifier =
+            iSetUpCallData.iIconIdConfirmationPhase.iIdentifier;
+
+        LOG2( SIMPLE, 
+        "SETUPCALL: iSetUpCallData.iIconIdConfirmationPhase.iQualifier: %d",
+        iSetUpCallData.iIconIdConfirmationPhase.iQualifier )
+        switch ( iSetUpCallData.iIconIdConfirmationPhase.iQualifier )
+            {
+            case RSat::ESelfExplanatory:
+                {
+                // Icon qualifier is self explanatory (to display instead
+                // of the alpha id or text string).
+                iQueryData.iIconId.iIconQualifier = ESatSelfExplanatory;
+                break;
+                }
+
+            case RSat::ENotSelfExplanatory:
+                {
+                // Icon qualifier is not self explanatory.
+                iQueryData.iIconId.iIconQualifier = ESatNotSelfExplanatory;
+                break;
+                }
+
+            default:
+                {
+                // Icon qualifier not present
+                iQueryData.iIconId.iIconQualifier = ESatENoIconId;
+                break;
+                }
+            }
+
+        // If call control is active, set up call is made
+        // after the call control note is showed in ui ie
+        // ECallControlDone event is notified.
+        if ( !iCallControlActive )
+            {
+            LOG( SIMPLE, 
+            "SETUPCALL: CSetUpCallHandler::HandleCommand iCallControlActive \
+            false" )
+            iUtils->NotifyEvent( MSatUtils::ESetUpCallExecuting );
+
+            TRAPD( regErr, iUtils->RegisterServiceRequestL(
+                ESatSProactiveQuery,
+                ESatSProactiveQueryResponse,
+                this ) );
+            LOG2( SIMPLE, 
+            "SETUPCALL: CSetUpCallHandler::HandleCommand regErr: %d", regErr )
+            if ( KErrNone != regErr )
+                {
+                // Possible memory allocation error. Send error terminal
+                // response
+                UiLaunchFailed();
+                }
+            else
+                {
+                // Send query to UI
+                iUtils->SatUiHandler().UiSession()->SendCommand(
+                    &iQueryPckg,
+                    &iQueryRspPckg,
+                    ESatSProactiveQuery );
+                }
+            }
+        else
+            {
+            LOG( SIMPLE, 
+            "SETUPCALL: CSetUpCallHandler::HandleCommand iCallControlActive \
+            true" )
+            // Set pending flag on
+            iPCmdPending = ETrue;
+            }
+        }
+
+    LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::HandleCommand exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CSatCommandHandler.
+// Indication that UI lanching failed.
+// -----------------------------------------------------------------------------
+//
+void CSetUpCallHandler::UiLaunchFailed()
+    {
+    LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::UiLaunchFailed calling" )
+
+    CompleteSetupCall( RSat::KMeUnableToProcessCmd, 
+                       RSat::KNoSpecificMeProblem );
+
+    LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::UiLaunchFailed exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSetUpCallHandler::SetupCallRequestComplete
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSetUpCallHandler::SetupCallRequestComplete( TInt aErrCode )
+    {
+    LOG( SIMPLE,
+    "SETUPCALL: CSetUpCallHandler::SetupCallRequestComplete calling" )
+
+    LOG2( NORMAL,
+    "SETUPCALL: CSetUpCallHandler::SetupCallRequestComplete aErrCode %d",
+    aErrCode )
+    
+    if( !iEmergencyCall )
+        {
+        CompleteSetupCallWithStatus( aErrCode );
+        }
+    else
+        {
+        iEmergencyCall = EFalse;
+
+        if ( KErrNone == aErrCode )
+            {
+            // Set result
+            CompleteSetupCall( RSat::KSuccess );
+            }
+        else
+            {
+            // The emergency call implementation 
+            // before S60 SAT migration from AIW to EtelMM
+            // According current information, no requirement for this.
+            // We don't return extended network error.
+            CompleteSetupCall(
+                RSat::KNetworkUnableToProcessCmd,
+                RSat::KNoSpecificMeProblem );
+
+            LOG( SIMPLE,
+            "SETUPCALL: CSetUpCallHandler::HandleEmergencyDialL Network unable \
+            to process this" )
+            }
+        }
+    LOG2( NORMAL,
+        "SETUPCALL: CSetUpCallHandler::SetupCallRequestComplete exiting %d", aErrCode )
+    }
+
+// -----------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+//lint -e{1403, 1769} Can not be initialized, harmless.
+CSetUpCallHandler::CSetUpCallHandler() :
+    CSatCommandHandler(),
+    iSetUpCallData(),
+    iSetUpCallPckg( iSetUpCallData ),
+    iSetUpCallRsp(),
+    iSetUpCallRspPckg( iSetUpCallRsp ),
+    iQueryData(),
+    iQueryPckg( iQueryData ),
+    iQueryRsp(),
+    iQueryRspPckg( iQueryRsp ),
+    // To be removed when icons are allowed in this command
+    iIconCommand( EFalse )
+    {
+    LOG( SIMPLE,
+        "SETUPCALL: CSetUpCallHandler::CSetUpCallHandler calling - exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSetUpCallHandler::ConstructL()
+    {
+    LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::ConstructL calling" )
+
+    
+    iRequestHandler = CSetupCallRequestHandler::NewL( iUtils->MultiModeApi(),
+            this ); 
+    // Create request handler. This is same that LaunchBrowser uses, so this
+    // is needed also in HandleCommand - function.
+    iUtils->RegisterServiceRequestL(
+        ESatSProactiveQuery,
+        ESatSProactiveQueryResponse,
+        this );
+
+    iUtils->RegisterL( this, MSatUtils::ECallControlExecuting );
+    iUtils->RegisterL( this, MSatUtils::ECallControlDone );
+
+    LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Performs the request to dial
+// -----------------------------------------------------------------------------
+//
+void CSetUpCallHandler::DoSetupCall( CSetupCallRequestHandler& aHandler )
+    {
+    LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::DoSetupCallL calling" )
+    
+    if( CheckSetupCallParam() )
+        {
+
+        RSat::TSetUpCallType callType( iSetUpCallData.iType );
+    
+        TDes& telNumber( iSetUpCallData.iAddress.iTelNumber );
+        CheckNumber( telNumber );
+
+        RMobileCall::TMobileCallParamsV7 dialParams;
+        RMobileCall::TMobileCallParamsV7Pckg package( dialParams );
+    
+        //Redail has been removed from MCL, no redail support.
+        dialParams.iAutoRedial = EFalse;
+        dialParams.iBearerMode = RMobileCall::EMulticallNewBearer;
+        dialParams.iCallParamOrigin = RMobileCall::EOriginatorSIM;
+        dialParams.iSubAddress = iSetUpCallData.iSubAddress;
+        dialParams.iBearerCap1 = iSetUpCallData.iCapabilityConfigParams;
+        
+        dialParams.iBCRepeatIndicator = RMobileCall::EBCAlternateMode;
+        
+        dialParams.iIconId.iQualifier = RMobileCall::ENoIconId;
+        
+        
+        dialParams.iAlphaId = iSetUpCallData.iAlphaIdCallSetUpPhase.iAlphaId;
+        LOG2( NORMAL, 
+            "SETUPCALL: CSetUpCallHandler::DoSetupCallL id:%S",
+            &dialParams.iAlphaId )
+        
+        LOG2( NORMAL, 
+            "SETUPCALL: CSetUpCallHandler::DoSetupCallL number:%S",
+            &iSetUpCallData.iAddress.iTelNumber )
+        
+        TBool terminateOtherCall( EFalse );
+        // check if we need to disconnect other calls
+        if ( ( RSat::EDisconnectOtherCalls == callType ) ||
+             ( RSat::EDisconnectOtherCallsWithRedial == callType ) )
+            {
+            LOG( SIMPLE, 
+            "SETUPCALL: CSetUpCallHandler::DoSetupCallL end other call" )
+            terminateOtherCall = ETrue ;
+            }
+        
+        aHandler.DialNumber( package, iSetUpCallData.iAddress.iTelNumber,
+                terminateOtherCall, iUtils->CreateAsyncToSyncHelper() );
+        }
+    else
+        {
+        CompleteSetupCallWithStatus( KErrArgument );
+        }
+    
+    LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::DoSetupCallL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Return terminal response filled according to dial result.
+// -----------------------------------------------------------------------------
+//
+void CSetUpCallHandler::CompleteSetupCallWithStatus(
+    const TInt32 aStatus )
+    {
+    LOG2( SIMPLE,
+        "SETUPCALL: CSetUpCallHandler::CompleteSetupCallWithStatus calling: \
+        %i", aStatus )
+
+    // Form Terminal Response
+    if ( KErrNone != aStatus )
+        {
+        switch ( aStatus )
+            {
+            case KErrGsmCCCallRejected:
+                {
+                LOG( SIMPLE, 
+                "SETUPCALL: CSetUpCallHandler::CompleteSetupCallWithStatus Call \
+                Control not allowed" )
+                // If SetUpCall is not allowed by SIM in Call Control, then
+                // give a correct response.
+                CompleteSetupCall(
+                    RSat::KInteractionWithCCPermanentError,
+                    RSat::KActionNotAllowed );
+                break;
+                }
+
+            case KErrGsmCCBearerCapabilityNotAuthorised:
+                {
+                LOG( SIMPLE, 
+                "SETUPCALL: CSetUpCallHandler::CompleteSetupCallWithStatus \
+                Beyond ME Capabilities" )
+                // If bearer capability is not authorized, return correct value
+                CompleteSetupCall( RSat::KCmdBeyondMeCapabilities );
+                break;
+                }
+
+            case KErrAbort:
+                {
+                LOG( SIMPLE, 
+                "SETUPCALL: CSetUpCallHandler::CompleteSetupCallWithStatus User \
+                abort" )
+                if ( iQueryRsp.iSessionTerminatedByUser )
+                    {
+                    LOG( SIMPLE, 
+                    "SETUPCALL: CSetUpCallHandler::CompleteSetupCallWithStatus \
+                    TerminatedByUser" )
+                    // Notify sim session end command that next sim session end
+                    // should close the ui session.
+                    iUtils->NotifyEvent( MSatUtils::ESessionTerminatedByUser );
+                    }
+
+                // User has ended redial mechanism.
+                CompleteSetupCall( RSat::KCallClearedBeforeConnectionOrReleased );
+                break;
+                }
+
+            case KErrGeneral:
+            case KErrArgument:
+                {
+                LOG( SIMPLE, 
+                "SETUPCALL: CSetUpCallHandler::CompleteSetupCallWithStatus Data \
+                not understood" )
+                CompleteSetupCall( RSat::KCmdDataNotUnderstood );
+                break;
+                }
+
+            case KErrAccessDenied:
+                {
+                LOG( SIMPLE, 
+                "SETUPCALL: CSetUpCallHandler::CompleteSetupCallWithStatus \
+                Network unable to process this" )
+                CompleteSetupCall(
+                    RSat::KNetworkUnableToProcessCmd,
+                    RSat::KNoSpecificMeProblem );
+                break;
+                }
+                
+            case KErrSatControl:
+                {
+                LOG( SIMPLE, 
+                "SETUPCALL: CSetUpCallHandler::CompleteSetupCallWithStatus \
+                Call Command performed, but modified by Call Control" )
+                // Call control modified the type of request indicated in
+                // the proactive command, and the action requested by 
+                // call control was performed successfully.
+                CompleteSetupCall( RSat::KModifiedByCallControl );
+                break;
+                }
+                
+            default:
+                {
+                LOG( SIMPLE,
+                "SETUPCALL: CSetUpCallHandler::CompleteSetupCallWithStatus \
+                Network unable to process with error info" )
+
+                iSetUpCallRsp.iGeneralResult = RSat::KNetworkUnableToProcessCmd;
+                iSetUpCallRsp.iInfoType = RSat::KSatNetworkErrorInfo;
+
+                // Lower byte contains the error cause.
+                iSetUpCallRsp.iAdditionalInfo.SetLength( 1 );
+
+                // Get mapped additional info
+                TUint8 addInfo( TSatExtErrorUtils::MapError( aStatus ) );
+                iSetUpCallRsp.iAdditionalInfo[0] =
+                    static_cast<TUint16>( addInfo );
+
+                // Send terminal response
+                TerminalRsp( RSat::ESetUpCall, iSetUpCallRspPckg );
+                break;
+                }
+            }
+        }
+    else
+        {
+        // Convert terminal rsp if icon used
+        RSat::TIconQualifier qualifier1(
+            iSetUpCallData.iIconIdConfirmationPhase.iQualifier );
+        RSat::TIconQualifier qualifier2(
+            iSetUpCallData.iIconIdCallSetUpPhase.iQualifier );
+
+        RSat::TPCmdResult result( RSat::KSuccess );
+
+        // Icon support for call confirmtion phase not done.
+        if ( !iQueryRsp.iRequestedIconDisplayed &&
+           ( ( RSat::ESelfExplanatory == qualifier1 ) ||
+             ( RSat::ENotSelfExplanatory == qualifier1 ) ) )
+            {
+            result = RSat::KSuccessRequestedIconNotDisplayed;
+            LOG( SIMPLE, 
+            "SETUPCALL: CSetUpCallHandler::CompleteSetupCallWithStatus \
+            Confirmation icon not shown" )
+            }
+        // Icon support for call setup phase not done.
+        else if ( ( RSat::ESelfExplanatory == qualifier2 ) ||
+                  ( RSat::ENotSelfExplanatory == qualifier2 ) )
+            {
+            // Until 2009-10 the phone and NTSY not support the icon.
+            // to be updated after the updating of the phone and NTSY
+            result = RSat::KSuccessRequestedIconNotDisplayed;
+            LOG( SIMPLE, 
+            "SETUPCALL: CSetUpCallHandler::CompleteSetupCallWithStatus Icon \
+            not shown" )
+            }
+        // If command had icon data and was done succesfully, report that icon
+        // was not shown.
+        // To be removed when icons are allowed in this command.
+        else
+            {
+            LOG( SIMPLE, 
+            "SETUPCALL: CSetUpCallHandler::CompleteSetupCallWithStatus \
+            others" )
+            if ( iIconCommand )
+                {
+                LOG( SIMPLE, 
+                "SETUPCALL: CSetUpCallHandler::CompleteSetupCallWithStatus \
+                iIconCommand true" )
+                result = RSat::KSuccessRequestedIconNotDisplayed;
+                }
+            }
+        // Set result
+        CompleteSetupCall( result );
+        }
+
+    LOG( SIMPLE,
+        "SETUPCALL: CSetUpCallHandler::CompleteSetupCallWithStatus exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Return terminal response filled according to result.
+// -----------------------------------------------------------------------------
+//
+void CSetUpCallHandler::CompleteSetupCall(
+    const RSat::TPCmdResult aGeneralResult )
+    {
+    LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CompleteSetupCall calling" )
+
+    // Fill Terminal Response.
+    iSetUpCallRsp.iGeneralResult = aGeneralResult;
+    iSetUpCallRsp.iInfoType = RSat::KNoAdditionalInfo;
+    iSetUpCallRsp.iAdditionalInfo.Zero();
+    iSetUpCallRsp.SetPCmdNumber( iSetUpCallData.PCmdNumber() );
+
+    // Send terminal response.
+    TerminalRsp( RSat::ESetUpCall, iSetUpCallRspPckg );
+
+    LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CompleteSetupCall exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Return terminal response filled according to result.
+// -----------------------------------------------------------------------------
+//
+void CSetUpCallHandler::CompleteSetupCall(
+    const RSat::TPCmdResult aGeneralResult,
+    const TInt16 aAdditionalInfo )
+    {
+    LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CompleteSetupCall calling" )
+
+    // Fill Terminal Response.
+    iSetUpCallRsp.iGeneralResult = aGeneralResult;
+    iSetUpCallRsp.iInfoType = RSat::KMeProblem;
+    iSetUpCallRsp.iAdditionalInfo.SetLength( 1 );
+    iSetUpCallRsp.iAdditionalInfo[0] = aAdditionalInfo;
+    iSetUpCallRsp.SetPCmdNumber( iSetUpCallData.PCmdNumber() );
+
+    // Send terminal response.
+    TerminalRsp( RSat::ESetUpCall, iSetUpCallRspPckg );
+
+    LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CompleteSetupCall exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Checks the dialling number string for extended BCD
+// values. Changes them to correct characters
+// see ETSI 11.11 10.5.1
+// -----------------------------------------------------------------------------
+//
+void CSetUpCallHandler::CheckNumber( TDes& aNumber ) const
+    {
+    LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CheckNumber calling" )
+    
+    for ( TInt i = 0; i < aNumber.Length(); i++ )
+        {
+        // check values
+        if ( KBCDAsterisk == aNumber[i] )
+            {
+            LOG( SIMPLE, 
+            "SETUPCALL: CSetUpCallHandler::CheckNumber KAsteriskChar" )
+            aNumber[i] = KAsteriskChar;
+            }
+
+        if ( KBCDDash == aNumber[i] )
+            {
+            LOG( SIMPLE, 
+            "SETUPCALL: CSetUpCallHandler::CheckNumber KDashChar" )
+            aNumber[i] = KDashChar;
+            }
+
+        if ( KBCDDTMF == aNumber[i] )
+            {
+            LOG( SIMPLE, 
+            "SETUPCALL: CSetUpCallHandler::CheckNumber KDTMFChar" )
+            aNumber[i] = KDTMFChar;
+            }
+
+        if ( KBCDWild == aNumber[i] )
+            {
+            LOG( SIMPLE, 
+            "SETUPCALL: CSetUpCallHandler::CheckNumber KWildChar" )
+            aNumber[i] = KWildChar;
+            }
+
+        if ( KBCDExpansion == aNumber[i] )
+            {
+            LOG( SIMPLE, 
+            "SETUPCALL: CSetUpCallHandler::CheckNumber KExpansionChar" )
+            aNumber[i] = KExpansionChar;
+            }
+        }
+    
+    LOG2( SIMPLE, 
+    "SETUPCALL: CSetUpCallHandler::CheckNumber length of aNumber: %d",
+     aNumber.Length() )
+    LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CheckNumber exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Create emergency call
+// -----------------------------------------------------------------------------
+//
+void CSetUpCallHandler::CreateEmergencyCall( 
+        CSetupCallRequestHandler& aHandler )
+    {
+    LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CreateEmergencyCall calling" )
+   
+    aHandler.DialEmergencyCall( iSetUpCallData.iAddress.iTelNumber );
+    
+    LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CreateEmergencyCall exiting" )    
+    }
+
+// -----------------------------------------------------------------------------
+// check setup call param.
+// -----------------------------------------------------------------------------
+//
+TBool CSetUpCallHandler::CheckSetupCallParam()
+    {
+    LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CheckSetupCallParam calling" )
+
+    TBool valid( ETrue );
+    if ( iSetUpCallData.iAddress.iTelNumber.Length()
+          > KSatMaximumPhoneNumberLength )
+        {
+        LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CheckSetupCallParam num" )
+        valid = EFalse;
+        }    
+    else if ( iSetUpCallData.iAlphaIdCallSetUpPhase.iAlphaId.Length()
+               > KSatMaximumNameLength )
+        {
+        LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CheckSetupCallParam name" )
+        valid = EFalse;
+        }    
+    else if ( iSetUpCallData.iSubAddress.Length() > KSatSubAddressLength )
+        {
+        LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CheckSetupCallParam sub" )
+        valid = EFalse;
+        }    
+    else if ( iSetUpCallData.iCapabilityConfigParams.Length()
+               > KSatBearerLength )
+        {
+        LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CheckSetupCallParam bear" )
+        valid = EFalse;
+        }    
+    LOG2( SIMPLE, 
+    "SETUPCALL: CSetUpCallHandler::CheckSetupCallParam exiting %d", valid )
+    
+    return valid;        
+    }
+// End Of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SetUpCallCmd/src/csetupcallrequesthandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,219 @@
+/*
+* 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:  Create the call and emergency call to ETelMM
+*
+*/
+
+
+#include <etelmm.h>
+#include <mmtsy_names.h>
+
+#include "csetupcallrequesthandler.h"
+#include "CSetUpCallHandler.h"
+#include "csetupcalldtmfsender.h"
+#include "msatasynctosync.h"
+#include "SatLog.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CSetupCallRequestHandler::CSetupCallRequestHandler
+// The class constructor.
+// -----------------------------------------------------------------------------
+//
+CSetupCallRequestHandler::CSetupCallRequestHandler(
+                MSatMultiModeApi& aPhone, CSetUpCallHandler* aDispatcher )
+    : CActive( EPriorityStandard ), iPhone( aPhone ), 
+      iDispatcher( aDispatcher )
+    {
+    LOG( SIMPLE,
+        "SETUPCALL: CSetupCallRequestHandler::CSetupCallRequestHandler \
+        calling" )
+
+    CActiveScheduler::Add( this );
+
+    LOG( SIMPLE,
+        "SETUPCALL: CSetupCallRequestHandler::CSetupCallRequestHandler \
+        exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSetupCallRequestHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSetupCallRequestHandler* CSetupCallRequestHandler::NewL(
+    MSatMultiModeApi& aPhone, CSetUpCallHandler* aDispatcher )
+    {
+    LOG( SIMPLE, "SETUPCALL: CSetupCallRequestHandler::NewL calling" )
+
+    CSetupCallRequestHandler* self =
+        new ( ELeave ) CSetupCallRequestHandler( aPhone, aDispatcher );
+    
+    self->ConstructL();
+ 
+    LOG( SIMPLE, "SETUPCALL: CSetupCallRequestHandler::NewL exiting" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CSetupCallRequestHandler::~CSetupCallRequestHandler
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CSetupCallRequestHandler::~CSetupCallRequestHandler()
+    {
+    LOG( SIMPLE, "SETUPCALL: \
+            CSetupCallRequestHandler::~CSetupCallRequestHandler calling" )
+    Cancel();
+    iDispatcher = NULL;
+    
+    delete iDtmfSender;
+    iDtmfSender = NULL;
+
+    LOG( SIMPLE, "SETUPCALL: \
+            CSetupCallRequestHandler::~CSetupCallRequestHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSetupCallRequestHandler::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CSetupCallRequestHandler::ConstructL()
+{
+    LOG( SIMPLE, "SETUPCALL: CSetupCallRequestHandler::ConstructL calling" )
+    iDtmfSender = CSetupCallDtmfSender::NewL( iPhone );
+    LOG( SIMPLE, "SETUPCALL: CSetupCallRequestHandler::ConstructL exiting" )
+}
+
+// -----------------------------------------------------------------------------
+// CSetupCallRequestHandler::DialNumber
+// -----------------------------------------------------------------------------
+//
+void CSetupCallRequestHandler::DialNumber( const TDesC8& aCallParams,
+                  TDes& aTelNumber, TBool aTerminateOtherCall,
+                  MSatAsyncToSync* aAsyncToSync )
+    {
+    LOG( SIMPLE, "SETUPCALL: CSetupCallRequestHandler::DialNumber calling" )
+ 
+    TInt terminateRes ( KErrNone );
+    
+    if( aTerminateOtherCall )
+        {
+        if( aAsyncToSync )
+            {
+            iPhone.TerminateActiveCalls( aAsyncToSync->RequestStatus() );
+            terminateRes = aAsyncToSync->SetActiveAndWait();
+            }
+        else
+            {
+            LOG( SIMPLE, "SETUPCALL: CSetupCallRequestHandler::DialNumber \
+                    bad MSatAsyncToSync pointer" )
+            terminateRes  = KErrGeneral;
+            }
+        }
+    
+    if( !IsActive() )
+        {
+        if( KErrNone == terminateRes )
+            {
+            // Separate dtmf string from whole number and store in iDtmfString
+            // the dtmf string will be removed from aTelNumber 
+            iDtmfSender->SeparateDtmfFromTelNumber(aTelNumber);
+            // Dial the pure tel number
+            iPhone.DialNoFdnCheck( iStatus, aCallParams, aTelNumber );
+            SetActive();
+            }
+        else
+            {
+            iDispatcher->SetupCallRequestComplete( terminateRes );
+            }
+        }
+    else
+        {
+        iDispatcher->SetupCallRequestComplete( KErrInUse );
+        }
+    
+    LOG( SIMPLE, "SETUPCALL: CSetupCallRequestHandler::DialNumber exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSetupCallRequestHandler::DialEmergencyCall
+// -----------------------------------------------------------------------------
+//
+void CSetupCallRequestHandler::DialEmergencyCall( const TDesC& aTelNumber )
+    {
+    LOG( SIMPLE, "SETUPCALL: CSetupCallRequestHandler::DialNumber calling" )
+     
+    if( !IsActive() )
+        {
+        iPhone.DialEmergencyCall( iStatus, aTelNumber );
+        SetActive();
+        }
+    else
+        {
+        iDispatcher->SetupCallRequestComplete( KErrInUse );
+        }
+    
+    LOG( SIMPLE, 
+        "SETUPCALL: CSetupCallRequestHandler::DialEmergencyCall exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSetupCallRequestHandler::RunL
+// Handles the command.
+// -----------------------------------------------------------------------------
+//
+void CSetupCallRequestHandler::RunL()
+    {
+    LOG2( SIMPLE, "SETUPCALL: CSetupCallRequestHandler::RunL calling\
+        iStatus=%i", iStatus.Int() )
+    
+    iDispatcher->SetupCallRequestComplete( iStatus.Int() );
+    
+    if ( KErrNone == iStatus.Int() )
+        {
+        iDtmfSender->SendDtmfString();
+        }
+    
+    LOG( SIMPLE, "SETUPCALL: CSetupCallRequestHandler::RunL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSetupCallRequestHandler::CancelOperation
+// -----------------------------------------------------------------------------
+//
+void CSetupCallRequestHandler::CancelOperation()
+    {
+    LOG( SIMPLE, "SETUPCALL: \
+                  CSetupCallRequestHandler::CancelOperation calling" )
+    iPhone.DialCancel();
+    iDtmfSender->Cancel();
+    LOG( SIMPLE, 
+        "SETUPCALL: CSetupCallRequestHandler::CancelOperation exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// From class CActive.
+// Cancels the sat request.
+// -----------------------------------------------------------------------------
+//
+void CSetupCallRequestHandler::DoCancel()
+    {
+    LOG( SIMPLE, "SETUPCALL: CSetupCallRequestHandler::DoCancel calling" )
+    CancelOperation();
+    LOG( SIMPLE, "SETUPCALL: CSetupCallRequestHandler::DoCancel exiting" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SetUpCallCmd/src/std.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 functions
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    <implementationproxy.h>
+#include    "CSetUpCallHandler.h"
+
+// CONSTANTS
+
+const TImplementationProxy implementationTable[] =
+    {
+    //lint -e{611,1924} Warning "Suspicious cast" can not be avoided.
+    IMPLEMENTATION_PROXY_ENTRY( 0x1000f006, CSetUpCallHandler::NewL )
+    };
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy ECOM framework factory function
+// Calculates the number of implementations.
+// Returns: Implementation proxy.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount ) // Number of implementations
+    {
+    aTableCount =
+        sizeof( implementationTable ) /
+        sizeof( TImplementationProxy );
+    return implementationTable;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SetUpEventListCmd/group/SetUpEventListCmd.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* 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:  Project definition file for project SetUpEventList
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../../inc/SatMacroes.h"
+
+TARGET                  SetUpEventListCmd.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D 0x10202992
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  std.cpp
+SOURCE                  CSetUpEventListHandler.cpp
+
+START RESOURCE          10202992.rss
+TARGET                  SetUpEventListCmd.rsc
+END
+
+USERINCLUDE             ../../../inc
+USERINCLUDE             ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+SYSTEMINCLUDE           ../../../../../inc      // Domain telephony
+SYSTEMINCLUDE           ../../../../inc         // Subsystem satengine
+
+LIBRARY                 euser.lib
+LIBRARY                 etelsat.lib
+LIBRARY                 SatEngine.lib
+
+#ifdef ENABLE_SAT_LOGGING
+LIBRARY                 flogger.lib
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SetUpEventListCmd/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 SetUpEventListCmd plug-in
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+SetUpEventListCmd.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SetUpEventListCmd/inc/CSetUpEventListHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -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:  SetUpEventList command handler
+*
+*/
+
+
+
+#ifndef CSETUPEVENTLISTHANDLER_H
+#define CSETUPEVENTLISTHANDLER_H
+
+//  INCLUDES
+#include <etelsat.h>
+#include "CSatCommandHandler.h"
+
+// FORWARD DECLARATION
+class MSatUtils;
+
+// CLASS DECLARATION
+
+/**
+*  Command handler for SetUpEventList command.
+*
+*  @lib SetUpEventListCmd.lib
+*  @since Series 60 3.0
+*/
+class CSetUpEventListHandler : public CSatCommandHandler
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aUtils SAT Utils interface
+        */
+        static CSetUpEventListHandler* NewL( MSatUtils* aUtils );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSetUpEventListHandler();
+
+    public: // Functions from base classes
+
+        /**
+        * From MSatEventObserver. Notification of Refresh actions.
+        * @param aEvent Identifies the event.
+        */
+        void Event( TInt aEvent );
+
+    protected:  // Functions from base classes
+
+        /**
+        * From CActive Cancels the usat request.
+        */
+        void DoCancel();
+
+        /**
+        * From CSatCommandHandler Requests the command notification.
+        * @param aStatus Request status
+        */
+        void IssueUSATRequest( TRequestStatus& aStatus );
+
+        /**
+        * From CSatCommandHandler Precheck before executing the command.
+        * @return TBool indicating command is currently allowed.
+        */
+        TBool CommandAllowed();
+
+        /**
+        * From CSatCommandHandler Need for ui session.
+        * @return TBool indicating need of ui session.
+        */
+        TBool NeedUiSession();
+
+        /**
+        * From CSatCommandHandler Called when USAT API notifies that command.
+        */
+        void HandleCommand();
+
+        /**
+        * From CSatCommandHandler Never called since this command doesn't need UI
+        */
+        void UiLaunchFailed();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CSetUpEventListHandler();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private:    // Data
+
+        // SetUpEventList command data.
+        RSat::TSetUpEventListV1 iSetUpEventListData;
+
+        // SetUpEventList command package.
+        RSat::TSetUpEventListV1Pckg iSetUpEventListPckg;
+
+        // Response from client
+        RSat::TSetUpEventListRspV1 iSetUpEventListRsp;
+
+        // Response package.
+        RSat::TSetUpEventListRspV1Pckg iSetUpEventListRspPckg;
+
+    };
+
+#endif      // CSETUPEVENTLISTHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SetUpEventListCmd/inc/SetUpEventListCmd.rls	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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 headers for project SetUpEventListCmd
+*
+*/
+
+
+#ifndef SETUPEVENTLISTCMD_RLS
+#define SETUPEVENTLISTCMD_RLS
+
+rls_string STRING_r_setupeventlistcmd_display_name "SetUpEventList command"
+rls_string STRING_r_setupeventlistcmd_default_data "SetUpEventListCmd"
+rls_string STRING_r_setupeventlistcmd_opaque_data  ""
+
+#endif // SETUPEVENTLISTCMD_RLS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SetUpEventListCmd/src/10202992.rss	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 1020 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Registry information for ECOM
+*
+*/
+
+
+
+//  INCLUDES
+#include <registryinfo.rh>
+#include "SetUpEventListCmd.rls"
+
+//  RESOURCE DEFINITIONS
+// -----------------------------------------------------------------------------
+//
+// SetUpEventListCmdInfo
+// Registeration information for ECOM
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO SetUpEventListCmdInfo
+    {
+    dll_uid = 0x10202992;
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x1000f001;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x10202993;
+                    version_no   = 1;
+                    display_name = STRING_r_setupeventlistcmd_display_name;
+                    default_data = STRING_r_setupeventlistcmd_default_data;
+                    opaque_data  = STRING_r_setupeventlistcmd_opaque_data;
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SetUpEventListCmd/src/CSetUpEventListHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,266 @@
+/*
+* 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:  Handles SetUpEventList command
+*
+*/
+
+
+#include    "MSatApi.h"
+#include    "MSatUtils.h"
+#include    "MSatUiSession.h"
+#include    "MSatEventMonitorContainer.h"
+#include    "CSetUpEventListHandler.h"
+#include    "SatLog.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// CSetUpEventListHandler::CSetUpEventListHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSetUpEventListHandler::CSetUpEventListHandler() :
+    CSatCommandHandler(),
+    iSetUpEventListData(),
+    iSetUpEventListPckg( iSetUpEventListData ),
+    iSetUpEventListRsp(),
+    iSetUpEventListRspPckg( iSetUpEventListRsp )
+    {
+    LOG( SIMPLE, "SETUPEVENTLIST: \
+        CSetUpEventListHandler::CSetUpEventListHandler calling - exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSetUpEventListHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSetUpEventListHandler::ConstructL()
+    {
+    LOG( SIMPLE, "SETUPEVENTLIST: CSetUpEventListHandler::ConstructL calling" )
+
+    // Register to listen ESimReset execution.
+    iUtils->RegisterL( this, MSatUtils::ESimResetCalled );
+
+    LOG( SIMPLE, "SETUPEVENTLIST: CSetUpEventListHandler::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSetUpEventListHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSetUpEventListHandler* CSetUpEventListHandler::NewL( MSatUtils* aUtils )
+    {
+    LOG( SIMPLE, "SETUPEVENTLIST: CSetUpEventListHandler::NewL calling" )
+
+    CSetUpEventListHandler* self = new( ELeave ) CSetUpEventListHandler;
+
+    CleanupStack::PushL( self );
+    self->BaseConstructL( aUtils );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "SETUPEVENTLIST: CSetUpEventListHandler::NewL exiting" )
+    return self;
+    }
+    
+// -----------------------------------------------------------------------------
+// CSetUpEventListHandler::~CSetUpEventListHandler
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CSetUpEventListHandler::~CSetUpEventListHandler()
+    {
+    LOG( SIMPLE, "SETUPEVENTLIST: \
+        CSetUpEventListHandler::~CSetUpEventListHandler calling" )
+
+    Cancel();
+
+    LOG( SIMPLE, "SETUPEVENTLIST: \
+        CSetUpEventListHandler::~CSetUpEventListHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSetUpEventListHandler::Event
+// -----------------------------------------------------------------------------
+//
+void CSetUpEventListHandler::Event( TInt aEvent )
+    {
+    LOG2( SIMPLE, 
+    "SETUPEVENTLIST: CSetUpEventListHandler::Event calling,aEvent: %d",
+    aEvent )
+
+    // Check the response
+    switch ( aEvent )
+        {
+        case MSatUtils::ESimResetCalled:
+            {
+            LOG( NORMAL,
+                "SETUPEVENTLIST: CSetUpEventListHandler ESimResetCalled" )
+
+            // Cancel all event monitors.
+            iUtils->EventMonitors()->CancelAllMonitors();
+            break;
+            }
+
+        default:
+            {
+            CSatCommandHandler::Event( aEvent );
+            break;
+            }
+        }
+
+    LOG( SIMPLE, "SETUPEVENTLIST: CSetUpEventListHandler::Event exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSetUpEventListHandler::DoCancel
+// Cancels the sat request.
+// -----------------------------------------------------------------------------
+//
+void CSetUpEventListHandler::DoCancel()
+    {
+    LOG( SIMPLE, "SETUPEVENTLIST: CSetUpEventListHandler::DoCancel calling" )
+
+    iUtils->USatAPI().NotifySetUpEventListCancel();
+
+    LOG( SIMPLE, "SETUPEVENTLIST: CSetUpEventListHandler::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSetUpEventListHandler::IssueUSATRequest
+// -----------------------------------------------------------------------------
+//
+void CSetUpEventListHandler::IssueUSATRequest( TRequestStatus& aStatus )
+    {
+    LOG( SIMPLE,
+        "SETUPEVENTLIST: CSetUpEventListHandler::IssueUSATRequest calling" )
+
+    // Clear the IPC package.
+    new (&iSetUpEventListData) RSat::TSetUpEventListV1();
+
+    iUtils->USatAPI().NotifySetUpEventList( aStatus, iSetUpEventListPckg );
+
+    LOG( SIMPLE,
+        "SETUPEVENTLIST: CSetUpEventListHandler::IssueUSATRequest exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSetUpEventListHandler::CommandAllowed
+// -----------------------------------------------------------------------------
+//
+TBool CSetUpEventListHandler::CommandAllowed()
+    {
+    LOG( SIMPLE, "SETUPEVENTLIST: \
+        CSetUpEventListHandler::CommandAllowed calling - exiting" )
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CSetUpEventListHandler::NeedUiSession
+// -----------------------------------------------------------------------------
+//
+TBool CSetUpEventListHandler::NeedUiSession()
+    {
+    LOG( SIMPLE, "SETUPEVENTLIST: \
+        CSetUpEventListHandler::NeedUiSession calling - exiting" )
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CSetUpEventListHandler::HandleCommand
+// -----------------------------------------------------------------------------
+//
+void CSetUpEventListHandler::HandleCommand()
+    {
+    LOG( SIMPLE,
+        "SETUPEVENTLIST: CSetUpEventListHandler::HandleCommand calling" )
+
+    iUtils->NotifyEvent( MSatUtils::ESetUpEventListExecuting );
+
+    // Response
+    RSat::TSetUpEventListRspV1 setUpEventListRsp;
+    RSat::TSetUpEventListRspV1Pckg setUpEventListRspPckg( setUpEventListRsp );
+
+    // Update / cancel event monitors
+    TInt errorCode( KErrNone );
+
+    // Check the event list request type
+    if ( RSat::EUpdateEventList == iSetUpEventListData.iType )
+        {
+        LOG( NORMAL,
+        "SETUPEVENTLIST: CSetUpEventListHandler::HandleCommand UpdEvList" )
+        // Update event monitor list
+        errorCode = iUtils->EventMonitors()->
+            SetUpEventMonitors( iSetUpEventListData.iEvents );
+
+        if ( KErrNone != errorCode )
+            {
+            LOG2( NORMAL,
+            "SETUPEVENTLIST: CSetUpEventListHandler::HandleCommand errCode %d",
+            errorCode )
+            // If any error, cancel all monitors
+            iUtils->EventMonitors()->CancelAllMonitors();
+            }
+        }
+    else if ( RSat::ERemoveExistingEventList == iSetUpEventListData.iType )
+        {
+        LOG( NORMAL,
+        "SETUPEVENTLIST: CSetUpEventListHandler::HandleCommand RemExistEvList" )
+        // Cancel all monitors
+        errorCode = iUtils->EventMonitors()->CancelAllMonitors();
+        }
+    else
+        {
+        errorCode = KErrNotSupported;
+        }
+
+    // Resolve general result
+    if ( KErrNone == errorCode )
+        {
+        LOG( NORMAL,
+        "SETUPEVENTLIST: CSetUpEventListHandler::HandleCommand KSuccess" )
+        setUpEventListRsp.iGeneralResult = RSat::KSuccess;
+        }
+    else
+        {
+        setUpEventListRsp.iGeneralResult = RSat::KCmdBeyondMeCapabilities;
+        }
+
+    // Build the rest of the response
+    setUpEventListRsp.iInfoType = RSat::KNoAdditionalInfo;
+    setUpEventListRsp.iAdditionalInfo.Zero();
+    setUpEventListRsp.SetPCmdNumber( iSetUpEventListData.PCmdNumber() );
+
+    // Send terminal response
+    TerminalRsp( RSat::ESetUpEventList, setUpEventListRspPckg );
+
+    LOG( SIMPLE,
+        "SETUPEVENTLIST: CSetUpEventListHandler::HandleCommand exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSetUpEventListHandler::UiLaunchFailed
+// -----------------------------------------------------------------------------
+//
+void CSetUpEventListHandler::UiLaunchFailed()
+    {
+    LOG( SIMPLE,
+        "SETUPEVENTLIST: CSetUpEventListHandler::UiLaunchFailed calling" )
+    // This command does not launch ui client.
+    LOG( SIMPLE,
+        "SETUPEVENTLIST: CSetUpEventListHandler::UiLaunchFailed exiting" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SetUpEventListCmd/src/std.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* 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:  General functions
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    <implementationproxy.h>
+#include    "CSetUpEventListHandler.h"
+
+// CONSTANTS
+
+const TImplementationProxy implementationTable[] =
+    {
+    //lint -e{611,1924} Warning "Suspicious cast" can not be avoided.
+    IMPLEMENTATION_PROXY_ENTRY( 0x10202993, CSetUpEventListHandler::NewL )
+    };
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy ECOM framework factory function
+// Calculates the number of implementations.
+// Returns: Implementation proxy.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount ) // Number of implementations
+    {
+    aTableCount =
+        sizeof( implementationTable ) /
+        sizeof( TImplementationProxy );
+    return implementationTable;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SetUpIdleModeTextCmd/group/SetUpIdleModeTextCmd.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* 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:  Project definition file for project SetUpIdleModeText plug-in
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../../inc/SatMacroes.h"
+
+TARGET                  SetUpIdleModeTextCmd.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D 0x1000A88A
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  std.cpp
+SOURCE                  CSetUpIdleModeTextHandler.cpp
+
+START RESOURCE          1000A88A.rss
+TARGET                  SetUpIdleModeTextCmd.rsc
+END
+
+USERINCLUDE             ../../../inc
+USERINCLUDE             ../inc
+
+// Application layer system include path needed due networkhandling's P&S keys
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+SYSTEMINCLUDE           ../../../../../inc      // Domain telephony
+SYSTEMINCLUDE           ../../../../inc         // Subsystem satengine
+
+LIBRARY                 euser.lib
+LIBRARY                 etelsat.lib
+LIBRARY                 SatEngine.lib
+LIBRARY                 centralrepository.lib
+
+#ifdef ENABLE_SAT_LOGGING
+LIBRARY                 flogger.lib
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SetUpIdleModeTextCmd/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 SetUpIdleModeTextCmd plug-in
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+SetUpIdleModeTextCmd.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SetUpIdleModeTextCmd/inc/CSetUpIdleModeTextHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,134 @@
+/*
+* 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:  SetUpIdleModeText command handler
+*
+*/
+
+
+
+#ifndef CSETUPIDLEMODETEXTHANDLER_H
+#define CSETUPIDLEMODETEXTHANDLER_H
+
+//  INCLUDES
+#include <etelsat.h>
+#include "CSatCommandHandler.h"
+
+// FORWARD DECLARATION
+class MSatUtils;
+
+// CLASS DECLARATION
+
+/**
+*  Command handler for SetUpIdleModeText command.
+*
+*  @lib SetUpIdleModeTextCmd.lib
+*  @since Series 60 3.0
+*/
+class CSetUpIdleModeTextHandler : public CSatCommandHandler
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aUtils Utils inteface
+        */
+        static CSetUpIdleModeTextHandler* NewL( MSatUtils* aUtils );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSetUpIdleModeTextHandler();
+
+    public: // Functions from base classes
+
+        /**
+        * From MSatEventObserver. Notification of Idle Mode responses.
+        * @param aEvent Identifies the event.
+        */
+        void Event( TInt aEvent );
+
+    protected:  // Functions from base classes
+
+        /**
+        * From CActive Cancels the usat request.
+        */
+        void DoCancel();
+
+        /**
+        * From CCommandHandler Requests the command notification.
+        * @param aStatus Request status to active object notification
+        */
+        void IssueUSATRequest( TRequestStatus& aStatus );
+
+        /**
+        * From CCommandHandler Precheck before executing the command.
+        * @return Boolean indicating is this command allowed to execute.
+        */
+        TBool CommandAllowed();
+
+        /**
+        * From CCommandHandler Need for ui session.
+        * @return Boolean indicating does this command need UI session.
+        */
+        TBool NeedUiSession();
+
+        /**
+        * From CCommandHandler Called when USAT API notifies that command.
+        */
+        void HandleCommand();
+
+        /**
+        * From CSatCommandHandler. Indicates the failure of launching ui client.
+        */
+        void UiLaunchFailed();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CSetUpIdleModeTextHandler();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private:    // Data
+
+        // SetUpIdleModeText command data.
+        RSat::TSetUpIdleModeTextV1 iSetUpIdleModeTextData;
+
+        // SetUpIdleModeText command package.
+        RSat::TSetUpIdleModeTextV1Pckg iSetUpIdleModeTextPckg;
+
+        // Response from client.
+        RSat::TSetUpIdleModeTextRspV1 iSetUpIdleModeTextRsp;
+
+        // Response package.
+        RSat::TSetUpIdleModeTextRspV1Pckg iSetUpIdleModeTextRspPckg;
+
+        // Store for restoring last valid idle mode text.
+        TBool iSimResetExecuting;
+        RSat::TIdleModeText iLastValidText;
+        TInt iLastValidIconId;
+        RSat::TIconQualifier iLastValidIconQualifier;
+
+        // Indicates whether the homezone indicator is supported.
+        TInt iHasHomezoneIndicator;
+    };
+
+#endif      // CSETUPIDLEMODETEXTHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SetUpIdleModeTextCmd/inc/SetUpIdleModeTextCmd.rls	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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 headers for project SetUpIdleModeTextCmd
+*
+*/
+
+
+#ifndef SETUPIDLEMODETEXTCMD_RLS
+#define SETUPIDLEMODETEXTCMD_RLS
+
+rls_string STRING_r_setupidlemodetextcmd_display_name "SetUpIdleModeText command"
+rls_string STRING_r_setupidlemodetextcmd_default_data "SetUpIdleModeTextCmd"
+rls_string STRING_r_setupidlemodetextcmd_opaque_data  ""
+
+#endif // SETUPIDLEMODETEXTCMD_RLS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SetUpIdleModeTextCmd/src/1000A88A.rss	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 1000 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Registry information for ECOM
+*
+*/
+
+
+
+//  INCLUDES
+#include <registryinfo.rh>
+#include "SetUpIdleModeTextCmd.rls"
+
+//  RESOURCE DEFINITIONS
+// -----------------------------------------------------------------------------
+//
+// SetUpIdleModeTextCmdInfo
+// Registeration information for ECOM
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO SetUpIdleModeTextCmdInfo
+    {
+    dll_uid = 0x1000A88A;
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x1000f001;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x10202988;
+                    version_no   = 1;
+                    display_name = STRING_r_setupidlemodetextcmd_display_name;
+                    default_data = STRING_r_setupidlemodetextcmd_default_data;
+                    opaque_data  = STRING_r_setupidlemodetextcmd_opaque_data;
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SetUpIdleModeTextCmd/src/CSetUpIdleModeTextHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,391 @@
+/*
+* 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:  Handles SetUpIdleModeText command
+*
+*/
+
+
+#include    <e32property.h>
+#include    <centralrepository.h>
+#include    <networkhandlingdomainpskeys.h>
+#include    "SATPrivateCRKeys.h"
+#include    "MSatApi.h"
+#include    "MSatUtils.h"
+#include    "MSatUiSession.h"
+#include    "SatSOpcodes.h"
+#include    "MSatSUiClientHandler.h"
+#include    "MSatSystemState.h"
+#include    "CSetUpIdleModeTextHandler.h"
+#include    "SatLog.h"
+
+// This was agreed with Idle.
+const TInt KNoIcon = -1;
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// CSetUpIdleModeTextHandler::CSetUpIdleModeTextHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSetUpIdleModeTextHandler::CSetUpIdleModeTextHandler() :
+    CSatCommandHandler(),
+    iSetUpIdleModeTextData(),
+    iSetUpIdleModeTextPckg( iSetUpIdleModeTextData ),
+    iSetUpIdleModeTextRsp(),
+    iSetUpIdleModeTextRspPckg( iSetUpIdleModeTextRsp ),
+    iSimResetExecuting( EFalse ),
+    iLastValidText( KNullDesC ),
+    iLastValidIconId( KNoIcon ),
+    iLastValidIconQualifier( RSat::EIconQualifierNotSet ),
+    iHasHomezoneIndicator( 0 )
+    {
+    LOG( SIMPLE, "SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler::\
+        CSetUpIdleModeTextHandler calling - exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSetUpIdleModeTextHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSetUpIdleModeTextHandler::ConstructL()
+    {
+    LOG( SIMPLE, "SETUPIDLEMODETEXT: \
+        CSetUpIdleModeTextHandler::ConstructL calling" )
+
+    // Register to listen ESimReset execution.
+    iUtils->RegisterL( this, MSatUtils::ESimResetCalled );
+    iUtils->RegisterL( this, MSatUtils::ESimResetCancelled );
+    iUtils->RegisterL( this, MSatUtils::ESimInitDone );
+    // Get the homezone indicator flag from the Central Repository.
+    CRepository* repo = CRepository::NewLC( KCRUidSatServer );
+    TInt errorCode = repo->Get( KSatHomeZoneIconVisible, iHasHomezoneIndicator );
+    LOG2( NORMAL, "SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler::ConstructL \
+        get homezone indicator flag and return: %d", errorCode )
+    CleanupStack::PopAndDestroy( repo );
+
+    LOG( SIMPLE, "SETUPIDLEMODETEXT: \
+        CSetUpIdleModeTextHandler::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSetUpIdleModeTextHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSetUpIdleModeTextHandler* CSetUpIdleModeTextHandler::NewL( MSatUtils* aUtils )
+    {
+    LOG( SIMPLE,
+        "SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler::NewL calling" )
+
+    CSetUpIdleModeTextHandler* self = new( ELeave ) CSetUpIdleModeTextHandler;
+
+    CleanupStack::PushL( self );
+    self->BaseConstructL( aUtils );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE,
+        "SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler::NewL exiting" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CSetUpIdleModeTextHandler::~CSetUpIdleModeTextHandler
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CSetUpIdleModeTextHandler::~CSetUpIdleModeTextHandler()
+    {
+    LOG( SIMPLE, "SETUPIDLEMODETEXT: \
+        CSetUpIdleModeTextHandler::~CSetUpIdleModeTextHandler calling" )
+
+    Cancel();
+
+    LOG( SIMPLE, "SETUPIDLEMODETEXT: \
+        CSetUpIdleModeTextHandler::~CSetUpIdleModeTextHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSetUpIdleModeTextHandler::Event
+// -----------------------------------------------------------------------------
+//
+void CSetUpIdleModeTextHandler::Event( TInt aEvent )
+    {
+    LOG( SIMPLE,
+        "SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler::Event calling" )
+    // Check the response
+    switch ( aEvent )
+        {
+        case MSatUtils::ESimResetCalled:
+            {
+            LOG( NORMAL, "SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler \
+                 ESimResetCalled")
+            iSimResetExecuting = ETrue;
+            }
+            //lint -fallthrough intended here
+
+        case MSatUtils::ESimInitDone:
+            {
+            LOG( NORMAL, "SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler \
+                remove idle mode text")
+
+            // Remove the idle mode text and icon.
+            // Note no response now, responseOk remains EFalse.
+            iUtils->SystemState().WriteSetIdleModeText(
+                KNullDesC, KNoIcon, RSat::ENoIconId );
+            // Remove the homezone indicator.
+            if ( iHasHomezoneIndicator && iLastValidText.Length() )
+                {
+                TInt errorCode = RProperty::Set(
+                        KPSUidNetworkInfo,
+                        KNWHomeZoneStatus,
+                        ENWNone );
+                LOG2( NORMAL, "SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler \
+                    remove the homezone indicator and return %d", errorCode )
+                }
+            break;
+            }
+
+        case MSatUtils::ESimResetCancelled:
+            {
+            LOG( NORMAL, "SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler \
+                ESimResetCancelled")
+
+            // Restore the idle mode text and icon.
+            // Note no response now, responseOk remains EFalse.
+            if ( iSimResetExecuting )
+                {
+                LOG( NORMAL, "SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler \
+                iSimResetExecuting true")
+                iUtils->SystemState().WriteSetIdleModeText(
+                    iLastValidText, iLastValidIconId, iLastValidIconQualifier );
+                // Restore the homezone indicator as SIM reset was cancelled.
+                if ( iHasHomezoneIndicator && iLastValidText.Length() )
+                    {
+                    TInt errorCode = RProperty::Set(
+                            KPSUidNetworkInfo,
+                            KNWHomeZoneStatus,
+                            ENWHomeZone );
+                    LOG2( NORMAL, "SETUPIDLEMODETEXT: \
+                    CSetUpIdleModeTextHandler restore the homezone indicator \
+                    and return %d", errorCode )
+                    }
+                iSimResetExecuting = EFalse;
+                }
+            break;
+            }
+
+        default:
+            {
+            CSatCommandHandler::Event( aEvent );
+            break;
+            }
+        }
+    LOG( SIMPLE,
+        "SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler::Event exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSetUpIdleModeTextHandler::DoCancel
+// Cancels the sat request.
+// -----------------------------------------------------------------------------
+//
+void CSetUpIdleModeTextHandler::DoCancel()
+    {
+    LOG( SIMPLE,
+        "SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler::DoCancel calling" )
+
+    iUtils->USatAPI().NotifySetUpIdleModeTextCancel();
+
+    LOG( SIMPLE,
+        "SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSetUpIdleModeTextHandler::IssueUSATRequest
+// -----------------------------------------------------------------------------
+//
+void CSetUpIdleModeTextHandler::IssueUSATRequest( TRequestStatus& aStatus )
+    {
+    LOG( SIMPLE, "SETUPIDLEMODETEXT: \
+        CSetUpIdleModeTextHandler::IssueUSATRequest calling" )
+
+    // Clear the IPC package.
+    new (&iSetUpIdleModeTextData) RSat::TSetUpIdleModeTextV1();
+
+    iUtils->USatAPI().NotifySetUpIdleModeText(
+        aStatus, iSetUpIdleModeTextPckg );
+
+    LOG( SIMPLE, "SETUPIDLEMODETEXT: \
+        CSetUpIdleModeTextHandler::IssueUSATRequest exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSetUpIdleModeTextHandler::CommandAllowed
+// -----------------------------------------------------------------------------
+//
+TBool CSetUpIdleModeTextHandler::CommandAllowed()
+    {
+    LOG( SIMPLE, "SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler::\
+        CommandAllowed calling" )
+    TBool commandAllowed( ETrue );
+
+    if ( ( 0 == iSetUpIdleModeTextData.iText.Length() ) &&
+         ( RSat::ENotSelfExplanatory ==
+            iSetUpIdleModeTextData.iIconId.iQualifier ||
+           RSat::ESelfExplanatory ==
+            iSetUpIdleModeTextData.iIconId.iQualifier ) )
+        {
+        iSetUpIdleModeTextRsp.iGeneralResult = RSat::KCmdDataNotUnderstood;
+        iSetUpIdleModeTextRsp.iInfoType = RSat::KNoAdditionalInfo;
+        iSetUpIdleModeTextRsp.iAdditionalInfo.Zero();
+        iSetUpIdleModeTextRsp.SetPCmdNumber(
+            iSetUpIdleModeTextData.PCmdNumber() );
+        TerminalRsp( RSat::ESetUpIdleModeText, iSetUpIdleModeTextRspPckg );
+        commandAllowed = EFalse;
+        LOG( NORMAL,
+            "SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler \
+            CommandAllowed icon received without alpha id" )
+        }
+
+    LOG2( SIMPLE, "SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler::\
+        CommandAllowed exiting,commandAllowed: %d", commandAllowed )
+    return commandAllowed;
+    }
+
+// -----------------------------------------------------------------------------
+// CSetUpIdleModeTextHandler::NeedUiSession
+// -----------------------------------------------------------------------------
+//
+TBool CSetUpIdleModeTextHandler::NeedUiSession()
+    {
+    LOG( SIMPLE, "SETUPIDLEMODETEXT: \
+        CSetUpIdleModeTextHandler::NeedUiSession calling - exiting" )
+    return EFalse; // No need for UI Session.
+    }
+
+// -----------------------------------------------------------------------------
+// CSetUpIdleModeTextHandler::HandleCommand
+// -----------------------------------------------------------------------------
+//
+void CSetUpIdleModeTextHandler::HandleCommand()
+    {
+    LOG( SIMPLE,
+        "SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler::HandleCommand calling" )
+
+    iUtils->NotifyEvent( MSatUtils::ESetUpIdleModeTextExecuting );
+
+    // The idle mode text is not written to shared data if
+    // Sim indicates the removal of idle mode text.
+    TPtrC idleModeText( iSetUpIdleModeTextData.iText );
+    TInt iconId( iSetUpIdleModeTextData.iIconId.iIdentifier );
+
+    // Get the icon description.
+    const RSat::TIconQualifier qualifier
+        ( iSetUpIdleModeTextData.iIconId.iQualifier );
+
+    if ( RSat::ERemoveExistingIdleModeText == iSetUpIdleModeTextData.iType )
+        {
+        LOG( SIMPLE,
+        "SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler::HandleCommand \
+        ERemoveExistingIdleModeText" )
+        idleModeText.Set( KNullDesC );
+        iconId = KErrNotFound;
+        }
+    else
+        {
+        if ( ( RSat::ENoIconId == qualifier ) ||
+             ( RSat::EIconQualifierNotSet == qualifier ) )
+            {
+            LOG( SIMPLE,
+            "SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler::HandleCommand \
+            KErrNotFound" )
+            // Icon information not provided in command.
+            iconId = KErrNotFound;
+            }
+        }
+
+    // Write text and icon id to P&S.
+    const TInt err(
+        iUtils->SystemState().WriteSetIdleModeText(
+            idleModeText, iconId, qualifier ) );
+
+    iSetUpIdleModeTextRsp.iInfoType = RSat::KNoAdditionalInfo;
+    iSetUpIdleModeTextRsp.iAdditionalInfo.Zero();
+    iSetUpIdleModeTextRsp.SetPCmdNumber(
+        iSetUpIdleModeTextData.PCmdNumber() );
+
+    // Send the terminal response now, if there was an error.
+    if ( KErrNone != err )
+        {
+        LOG( NORMAL,
+            "SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler::HandleCommand \
+            Error, Sending Terminal Response" )
+        iSetUpIdleModeTextRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+
+        // Send the response.
+        TerminalRsp( RSat::ESetUpIdleModeText, iSetUpIdleModeTextRspPckg );
+        }
+    else
+        {
+        // Save data for restore.
+        iSimResetExecuting = EFalse;
+        iLastValidText = idleModeText;
+        iLastValidIconId = iconId;
+        iLastValidIconQualifier = qualifier;
+        // Show or remove the homezone indicator.
+        if ( iHasHomezoneIndicator )
+            {
+            if ( iLastValidText.Length() )
+                {
+                TInt errorCode = RProperty::Set(
+                        KPSUidNetworkInfo,
+                        KNWHomeZoneStatus,
+                        ENWHomeZone );
+                LOG2( NORMAL, "SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler \
+                    show the homezone indicator and return %d", errorCode )
+                }
+            else 
+                {
+                TInt errorCode = RProperty::Set(
+                        KPSUidNetworkInfo,
+                        KNWHomeZoneStatus,
+                        ENWNone );
+                LOG2( NORMAL, "SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler \
+                    remove the homezone indicator and return %d", errorCode )
+                }
+            }
+        
+        iSetUpIdleModeTextRsp.iGeneralResult = RSat::KSuccess;
+        TerminalRsp( RSat::ESetUpIdleModeText, iSetUpIdleModeTextRspPckg );
+        }
+
+    LOG( SIMPLE,
+        "SETUPIDLEMODETEXT: CSetUpIdleModeTextHandler::HandleCommand exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSetUpIdleModeTextHandler::UiLaunchFailed
+// -----------------------------------------------------------------------------
+//
+void CSetUpIdleModeTextHandler::UiLaunchFailed()
+    {
+    LOG( SIMPLE, "SETUPIDLEMODETEXT: \
+        CSetUpIdleModeTextHandler::UiLaunchFailed calling - exiting" )
+    // We don't need UI. This is derived function from CSatSCommandHandler,
+    // so this function must exist, even if it is never called.
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SetUpIdleModeTextCmd/src/std.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 functions
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    <implementationproxy.h>
+#include    "CSetUpIdleModeTextHandler.h"
+
+// CONSTANTS
+
+const TImplementationProxy implementationTable[] =
+    {
+    //lint -e{611,1924} Warning "Suspicious cast" can not be avoided.
+    IMPLEMENTATION_PROXY_ENTRY( 0x10202988, CSetUpIdleModeTextHandler::NewL )
+    };
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy ECOM framework factory function
+// Calculates the number of implementations.
+// Returns: Implementation proxy.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount ) // Number of implementations
+    {
+    aTableCount =
+        sizeof( implementationTable ) /
+        sizeof( TImplementationProxy );
+    return implementationTable;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SetUpMenuCmd/group/Create-UT_CSetUpMenuHandler-Sis.bat	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,70 @@
+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: SIS file for UT_CSetUpMenuHandler.
+rem
+
+@echo off
+echo.
+echo ====================================
+echo.
+echo Digia EUnit - Test
+echo.
+echo This BAT copies Test DLL
+echo to local folder and makes SIS file
+echo.
+echo ====================================
+echo.
+
+:CHECK_EPOCROOT
+echo.
+echo - verify epoc root
+set EPOCROOT
+if errorlevel == 1 goto END_ERROR 
+
+:COPY_DLL
+echo.
+echo - copy test dll to current directory
+copy %EPOCROOT%epoc32\release\thumb\urel\UT_CSetUpMenuHandler.dll .
+if errorlevel == 1 goto END_ERROR 
+
+:CREATE_DIR
+echo.
+echo - create Sis folder (created only if needed)
+mkdir ..\Sis
+
+:MAKESIS
+echo.
+echo - makesis UT_CSetUpMenuHandler.pkg ..\sis\UT_CSetUpMenuHandler.sis
+call makesis UT_CSetUpMenuHandler.pkg ..\sis\UT_CSetUpMenuHandler.sis
+if errorlevel == 1 goto END_ERROR
+
+:DELETE_DLL
+echo.
+echo - remove the copied dll from current folder
+del UT_CSetUpMenuHandler.dll
+goto END
+
+:END_ERROR
+echo.
+echo Sis creation failed. 
+goto FINAL_END
+
+:END
+echo.
+echo Sis file created succesfully
+echo ============================
+
+:FINAL_END
+echo.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SetUpMenuCmd/group/SetUpMenuCmd.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* 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:  Project definition file for project SetUpMenu plug-in
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../../inc/SatMacroes.h"
+
+TARGET                  SetUpMenuCmd.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D 0x1000F000
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  std.cpp
+SOURCE                  CSetUpMenuHandler.cpp
+
+START RESOURCE          1000f000.rss
+TARGET                  SetUpMenuCmd.rsc
+END
+
+USERINCLUDE             ../../../inc
+USERINCLUDE             ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+SYSTEMINCLUDE           ../../../../../inc      // Domain telephony
+SYSTEMINCLUDE           ../../../../inc         // Subsystem satengine
+
+LIBRARY                 euser.lib
+LIBRARY                 etelsat.lib
+LIBRARY                 SatEngine.lib
+
+#ifdef ENABLE_SAT_LOGGING
+LIBRARY                 flogger.lib
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SetUpMenuCmd/group/UT_CSetUpMenuHandler.pkg	Wed Jul 21 18:26:52 2010 +0300
@@ -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: For packing UT_CSetUpMenuHandler.
+;
+
+/*
+* ==============================================================================
+*  Name        : UT_CSetUpMenuHandler.mmp
+*  Part of     : SatServer / SetUpMenuCmd
+*  Description : Project package file for project SetUpMenu plug-in
+*  Version     : %version: e003sa17#6 %
+*
+*  Copyright (c)2002-2008 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.
+* ============================================================================
+* Template version: 4.0
+*/
+
+; Supported languages
+&en
+
+; Package header (one name for each supported language)
+#{"UT_CSetUpMenuHandler"},(0x01700000),0,10,0
+
+; Package signature
+
+
+; Options line not supported currently
+
+; Conditions blocks not supported currently
+
+; Language independent files that are always installed
+"UT_CSetUpMenuHandler.dll"-"!:\DigiaEUnit\Tests\UT_CSetUpMenuHandler.dll"
+
+; Language dependent files 
+
+
+; Requisites (of type: (UID),Major,Minor,Build-Number,{"Requisite Name1", "Requisite Name2"})
+(0x101F6F88), 0, 0, 0, {"Series60ProductID"}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SetUpMenuCmd/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 SetUpMenu plug-in
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+SetUpMenuCmd.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SetUpMenuCmd/inc/CSetUpMenuHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,177 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 the SetUpMenu proactive command.
+*
+*/
+
+
+
+#ifndef CSETUPMENUHANDLER_H
+#define CSETUPMENUHANDLER_H
+
+//  INCLUDES
+#include    <etelsat.h>
+#include    "CSatCommandHandler.h"
+
+// CLASS DECLARATION
+
+/**
+*  Handles the SetUpMenu proactive command.
+*
+*  @lib CSetUpMenuCmd.dll
+*  @since Series 60 3.0
+*/
+class CSetUpMenuHandler : public CSatCommandHandler
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aUtils Utils inteface.
+        */
+        static CSetUpMenuHandler* NewL( MSatUtils* aUtils );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSetUpMenuHandler();
+
+    public: // Functions from base classes
+
+        /**
+        * From MSatCommand.
+        */
+        void ClientResponse();
+
+        /**
+        * From CSatCommandHandler Overrides the default implementation.
+        * @param aEvent An event that is occured.
+        */
+        void Event( TInt aEvent );
+
+    protected: // Functions from base classes
+
+        /**
+        * From CActive Cancels the SAT request.
+        */
+        void DoCancel();
+
+    private: // New functions
+
+        /**
+        * Adds icon to shell.
+        * @param aAlphaId Alpha id.
+        * @param aIconId Icon id.
+        */
+        void AddIconToShellL(
+            const TDesC& aAlphaId,
+            const RSat::TIconId& aIconId );
+
+        /**
+        * Removes icon from shell.
+        */
+        void RemoveIconFromShellL();
+
+        /**
+        * Sends setup menu data to client.
+        */
+        void SendSetUpMenuToClient();
+
+        /**
+        * Update setup menu data to client.
+        */
+        void UpdateSetUpMenuToClientL();
+        
+        /**
+        * Sends empty setup menu data to client to indicate SIM services is NA.
+        */        
+        void SendEmptySetupMenuToClient();
+
+     private:  // Functions from base classes
+
+        /**
+        * From CSatCommandHandler Requests the command notification.
+        * @param aStatus Request status to active object notification
+        */
+        void IssueUSATRequest( TRequestStatus& aStatus );
+
+        /**
+        * From CSatCommandHandler Precheck before executing the command.
+        * @return Boolean indicating is this command allowed to execute.
+        */
+        TBool CommandAllowed();
+
+        /**
+        * From CSatCommandHandler Need for ui session.
+        * @return Boolean indicating does this command need UI session.
+        */
+        TBool NeedUiSession();
+
+        /**
+        * From CSatCommandHandler Handles the notification of SetUpMenu command.
+        */
+        void HandleCommand();
+
+        /**
+        * From CSatCommandHandler. Ui launch failed.
+        */
+        void UiLaunchFailed();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CSetUpMenuHandler();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private:    // Data
+
+        // Set up menu command data.
+        RSat::TSetUpMenuV2 iSetUpMenuData;
+
+        // Package for setupmenu command.
+        RSat::TSetUpMenuV2Pckg iSetUpMenuPckg;
+
+        // Set up menu arrived data. Needs to be different than
+        // the one used in request( iSetUpMenuData ), because
+        // SetUpMenu makes the new request before ui has handled
+        // the command.
+        RSat::TSetUpMenuV2 iArrivedSetUpMenuData;
+
+        // Package of arrived set up menu data.
+        RSat::TSetUpMenuV2Pckg iArrivedSetUpMenuPckg;
+
+        // Indication that command has arrived from SIM.
+        TBool iSetUpMenuArrived;
+
+        // Name should be changed when SetUp menu is launched.
+        TBool iSatAppNameUpdated;
+        
+        // Information about SAT service availability
+        TBool iSatServiceAvailable;
+        
+        // Flag to signal that command has icon data
+        // To be removed when icons are allowed in this command
+        TBool iIconCommand;
+
+    };
+
+#endif      // CSETUPMENUHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SetUpMenuCmd/inc/SetUpMenuCmd.rls	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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 headers for project SetUpMenuCmd
+*
+*/
+
+
+#ifndef SETUPMENUCMD_RLS
+#define SETUPMENUCMD_RLS
+
+rls_string STRING_r_setupmenucmd_display_name "SetUpMenu command"
+rls_string STRING_r_setupmenucmd_default_data "SetUpMenuCmd"
+rls_string STRING_r_setupmenucmd_opaque_data  ""
+
+#endif // SETUPMENUCMD_RLS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SetUpMenuCmd/src/1000f000.rss	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 1000 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Registry information for ECOM
+*
+*/
+
+
+
+//  INCLUDES
+#include <registryinfo.rh>
+#include "SetUpMenuCmd.rls"
+
+//  RESOURCE DEFINITIONS
+// -----------------------------------------------------------------------------
+//
+// SetUpMenuCmdInfo
+// Registeration information for ECOM
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO SetUpMenuCmdInfo
+    {
+    dll_uid = 0x1000f000;
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x1000f001;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x1000f002;
+                    version_no   = 1;
+                    display_name = STRING_r_setupmenucmd_display_name;
+                    default_data = STRING_r_setupmenucmd_default_data;
+                    opaque_data  = STRING_r_setupmenucmd_opaque_data;
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SetUpMenuCmd/src/CSetUpMenuHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,699 @@
+/*
+* 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:  Handles the SetUpMenu command from SIM.
+*
+*/
+
+
+#include    <MSatShellController.h>
+#include    "MSatApi.h"
+#include    "MSatUiSession.h"
+#include    "SatSOpcodes.h"
+#include    "MSatSUiClientHandler.h"
+#include    "CSetUpMenuHandler.h"
+#include    "SATPrivateCRKeys.h"
+#include    "SatLog.h"
+
+const TInt KMaxSatAppName = 30;
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// CSetUpMenuHandler::CSetUpMenuHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSetUpMenuHandler::CSetUpMenuHandler() :
+    CSatCommandHandler(),
+    iSetUpMenuData(),
+    iSetUpMenuPckg( iSetUpMenuData ),
+    iArrivedSetUpMenuData(),
+    iArrivedSetUpMenuPckg( iArrivedSetUpMenuData ),
+    iSatAppNameUpdated( EFalse ),
+    iSatServiceAvailable( EFalse ),
+    // To be removed when icons are allowed in this command
+    iIconCommand( EFalse )
+    {
+    LOG( SIMPLE,
+        "SETUPMENU: CSetUpMenuHandler::CSetUpMenuHandler calling - exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSetUpMenuHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSetUpMenuHandler::ConstructL()
+    {
+    LOG( SIMPLE, "SETUPMENU: CSetUpMenuHandler::ConstructL calling" )
+
+    // Register Service request handler for this command handler.
+    iUtils->RegisterServiceRequestL(
+        ESatSProactiveSetUpMenu,
+        ESatSNone,
+        this );
+
+    // Remove the sat ui client icon from the shell, otherwise
+    // sat icon remains in shell once set in shell.
+    iUtils->SatUiHandler().ShellController().RemoveSatUiL();
+
+    // When sim session arrives, setupmenu may need to be displayed.
+    iUtils->RegisterL( this, MSatUtils::ESimSessionEndExecuting );
+    iUtils->RegisterL( this, MSatUtils::ESatUiLaunched );
+    iUtils->RegisterL( this, MSatUtils::ESetUpMenuNeeded );
+    iUtils->RegisterL( this, MSatUtils::EApplNameUpdated );
+    iUtils->RegisterL( this, MSatUtils::ESimResetCalled );
+    iUtils->RegisterL( this, MSatUtils::ERemoveSatUiCalled );
+    iUtils->RegisterL( this, MSatUtils::EAddSatUiCalled );
+    iUtils->RegisterL( this, MSatUtils::ECallControlDone );
+
+    LOG( SIMPLE, "SETUPMENU: CSetUpMenuHandler::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSetUpMenuHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSetUpMenuHandler* CSetUpMenuHandler::NewL( MSatUtils* aUtils )
+    {
+    LOG( SIMPLE, "SETUPMENU: CSetUpMenuHandler::NewL calling" )
+
+    CSetUpMenuHandler* self = new( ELeave ) CSetUpMenuHandler;
+
+    CleanupStack::PushL( self );
+    self->BaseConstructL( aUtils ); // Need to be called before ConstructL
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "SETUPMENU: CSetUpMenuHandler::NewL exiting" )
+    return self;
+    }
+
+
+// Destructor
+CSetUpMenuHandler::~CSetUpMenuHandler()
+    {
+    LOG( SIMPLE, "SETUPMENU: CSetUpMenuHandler::~CSetUpMenuHandler calling" )
+
+    Cancel();
+
+    LOG( SIMPLE, "SETUPMENU: CSetUpMenuHandler::~CSetUpMenuHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSetUpMenuHandler::ClientResponse
+// -----------------------------------------------------------------------------
+//
+void CSetUpMenuHandler::ClientResponse()
+    {
+    // This is needed to prevent Panic when UI is closed right after start
+    }
+
+// -----------------------------------------------------------------------------
+// CSetUpMenuHandler::Event
+// Event notification
+// -----------------------------------------------------------------------------
+//
+void CSetUpMenuHandler::Event( TInt aEvent )
+    {
+    LOG( SIMPLE, "SETUPMENU: CSetUpMenuHandler::Event calling" )
+
+    switch ( aEvent )
+        {
+        // Sim session has arrived from SIM or ui launched
+        case MSatUtils::ESatUiLaunched:
+            {
+            LOG( NORMAL, "SETUPMENU:   Event: ESatUiLaunched" )
+            // Send SetUpMenu to ui client if ui client is running,
+            // ui client is launced by user and the set up menu data
+            // has arrived from SIM.
+            if ( iSetUpMenuArrived )
+                {
+                LOG( NORMAL, "SETUPMENU:   Event: iSetUpMenuArrived true" )
+                SendSetUpMenuToClient();
+                }
+            else
+                {
+                SendEmptySetupMenuToClient();
+                }
+
+            break;
+            }
+
+        case MSatUtils::ESetUpMenuNeeded:
+            {
+            LOG( NORMAL, "SETUPMENU:   Event: ESetUpMenuNeeded" )
+            // Some command has finished executing and needs SetUpMenu.
+            SendSetUpMenuToClient();
+            break;
+            }
+
+        case MSatUtils::EApplNameUpdated:
+            {
+            LOG( NORMAL, "SETUPMENU:   Event: EApplNameUpdated" )
+            // Update SetUpMenu to ui client if ui client is running,
+            // ui client is launced by user and the set up menu data
+            // has arrived from SIM.
+            TRAPD( err, UpdateSetUpMenuToClientL() );
+            if ( KErrNone != err )
+                {
+                LOG2( SIMPLE, "SETUPMENU:   Error: %i", err )
+                }            
+            break;
+            }
+
+        case MSatUtils::ESimSessionEndExecuting:
+            {
+            LOG( NORMAL, "SETUPMENU:   Event: ESimSessionEndExecuting" )
+            // If the sim session end is only command active currently
+            // then send the setupmenu to client.
+            if ( 1 == iUtils->NumberOfExecutingCommandHandlers() )
+                {
+                LOG( NORMAL, "SETUPMENU:   Event: setupmenu" )
+                SendSetUpMenuToClient();
+                }
+            break;
+            }
+
+        case MSatUtils::ESimResetCalled:
+            {
+            LOG( NORMAL, "SETUPMENU:   Event: ESimResetCalled" )
+            // Close SatUi and remove Sat icon from application shell
+            MSatUiSession* uiSession = iUtils->SatUiHandler().UiSession();
+            if ( uiSession )
+                {
+                LOG( NORMAL, "SETUPMENU:   Event: CloseUiSession" )
+                uiSession->CloseUiSession();
+                }
+            TRAP_IGNORE( RemoveIconFromShellL() )
+            break;
+            }
+
+        case MSatUtils::EAddSatUiCalled:
+            {
+            LOG( NORMAL, "SETUPMENU:   Event: EAddSatUiCalled" )
+            iSatServiceAvailable = ETrue;
+            if ( iSetUpMenuArrived )
+                {
+                LOG( NORMAL, "SETUPMENU:   Event: iSetUpMenuArrived true" )
+                TRAP_IGNORE( AddIconToShellL(
+                    iArrivedSetUpMenuData.iAlphaId.iAlphaId,
+                    iArrivedSetUpMenuData.iIconId ) )
+                }
+            break;
+            }
+
+        case MSatUtils::ERemoveSatUiCalled:
+            {
+            iSatServiceAvailable = EFalse;
+            LOG( NORMAL, "SETUPMENU:   Event: ERemoveSatUiCalled" )
+            // Close SAT UI and remove SAT icon from Application Shell.
+            MSatUiSession* uiSession = iUtils->SatUiHandler().UiSession();
+            if ( uiSession )
+                {
+                LOG( NORMAL, "SETUPMENU:   Event: CloseUiSession" )
+                uiSession->CloseUiSession();
+                }
+            TRAP_IGNORE( RemoveIconFromShellL() )
+            break;
+            }
+
+        case MSatUtils::ECallControlDone:
+            {
+            // If all commands end up, send the setupmenu to client.
+            if ( 0 == iUtils->NumberOfExecutingCommandHandlers() )
+                {
+                LOG( NORMAL, "SETUPMENU:   Event: setupmenu" )
+                SendSetUpMenuToClient();
+                }
+            break;
+            }
+
+        default:
+            {
+            LOG2( NORMAL, "SETUPMENU:   Unexpected event: %i", aEvent )
+            CSatCommandHandler::Event( aEvent );
+            }
+        }
+
+    LOG( SIMPLE, "SETUPMENU: CSetUpMenuHandler::Event exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSetUpMenuHandler::DoCancel
+// Cancels the SetUpMenu notification from SIM.
+// -----------------------------------------------------------------------------
+//
+void CSetUpMenuHandler::DoCancel()
+    {
+    LOG( SIMPLE, "SETUPMENU: CSetUpMenuHandler::DoCancel calling" )
+
+    iUtils->USatAPI().NotifySetUpMenuCancel();
+
+    LOG( SIMPLE, "SETUPMENU: CSetUpMenuHandler::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSetUpMenuHandler::AddIconToShellL
+// -----------------------------------------------------------------------------
+//
+void CSetUpMenuHandler::AddIconToShellL(
+    const TDesC& aAlphaId, // Alpha id of SetUpMenu command
+    const RSat::TIconId& aIconId ) // Icon id of SetUpMenu command
+    {
+    LOG( SIMPLE, "SETUPMENU: CSetUpMenuHandler::AddIconToShellL calling" )
+    TPtrC name( aAlphaId );
+
+    if ( 0 != aAlphaId.Length() )
+        {
+        LOG( SIMPLE, 
+        "SETUPMENU: CSetUpMenuHandler::AddIconToShellL aAlphaId not null" )
+        // Set new sat app name.
+        iUtils->SetSatAppNameL( aAlphaId );
+        }
+    else
+        {
+        LOG( SIMPLE, 
+        "SETUPMENU: CSetUpMenuHandler::AddIconToShellL aAlphaId null" )
+        iUtils->RestoreSatAppNameL();
+        name.Set( iUtils->SatAppName() );
+        }
+
+    // Menu application needs only a short name.
+    if ( iUtils->SatAppName().Length() > KMaxSatAppName )
+        {
+        LOG( SIMPLE, 
+        "SETUPMENU: CSetUpMenuHandler::AddIconToShellL AppName too long" )
+        name.Set( iUtils->SatAppName().Left( KMaxSatAppName ) );
+        }
+    else
+        {
+        name.Set( iUtils->SatAppName() );
+        }
+
+    // Check if there is icon available.
+    MSatShellController& controller = iUtils->SatUiHandler().ShellController();
+    if ( ( RSat::ENoIconId == aIconId.iQualifier ) ||
+         ( RSat::EIconQualifierNotSet == aIconId.iQualifier ) )
+        {
+        LOG( SIMPLE, 
+        "SETUPMENU: CSetUpMenuHandler::AddIconToShellL no icon" )
+        controller.AddSatUiL( name );
+        }
+    else
+        {
+        controller.AddSatUiL( name, aIconId.iIdentifier );
+        }
+
+    LOG( SIMPLE, "SETUPMENU: CSetUpMenuHandler::AddIconToShellL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSetUpMenuHandler::RemoveIconFromShellL
+// -----------------------------------------------------------------------------
+//
+void CSetUpMenuHandler::RemoveIconFromShellL()
+    {
+    LOG( SIMPLE, "SETUPMENU: CSetUpMenuHandler::RemoveIconFromShellL calling" )
+
+    iUtils->SatUiHandler().ShellController().RemoveSatUiL();
+
+    // Restore the original name of SAT application.
+    iUtils->RestoreSatAppNameL();
+
+    LOG( SIMPLE, "SETUPMENU: CSetUpMenuHandler::RemoveIconFromShellL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSetUpMenuHandler::SendSetUpMenuToClient
+// -----------------------------------------------------------------------------
+//
+void CSetUpMenuHandler::SendSetUpMenuToClient()
+    {
+    LOG( SIMPLE, "SETUPMENU: CSetUpMenuHandler::SendSetUpMenuToClient calling" )
+
+    MSatUiSession* uiSession = iUtils->SatUiHandler().UiSession();
+    if ( uiSession &&
+         iUtils->SatUiHandler().UiLaunchedByUser() &&
+         iSetUpMenuArrived )
+        {
+        LOG( SIMPLE, 
+        "SETUPMENU: CSetUpMenuHandler::SendSetUpMenuToClient setupmenu" )
+
+        // Does not update SIM application name when it is restored and service
+        // is not available.
+        if ( iSatServiceAvailable )
+            {
+            LOG( SIMPLE, 
+            "SETUPMENU: CSetUpMenuHandler::SendSetUpMenuToClient \
+            iSatServiceAvailable true" )
+            // When ME is launched with special SIM and SetUpMenu made with
+            // different name. Then also SetUpMenu data update is needed
+            // when Menu name was already OK.
+            iArrivedSetUpMenuData.iAlphaId.iAlphaId.Zero();
+            iArrivedSetUpMenuData.iAlphaId.iAlphaId.Copy(
+                iUtils->SatAppName() );
+            }
+
+        // Client does not respond to setupmenu cmd, therefore NULL.
+        uiSession->SendCommand(
+            &iArrivedSetUpMenuPckg,
+            NULL,
+            ESatSProactiveSetUpMenu );
+        }
+
+    LOG( SIMPLE, "SETUPMENU: CSetUpMenuHandler::SendSetUpMenuToClient exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSetUpMenuHandler::SendEmptySetupMenuToClient
+// -----------------------------------------------------------------------------
+//
+void CSetUpMenuHandler::SendEmptySetupMenuToClient()
+    {
+    LOG( SIMPLE, "SETUPMENU: CSetUpMenuHandler::SendEmptySetupMenuToClient\
+     calling" )
+
+    MSatUiSession* uiSession = iUtils->SatUiHandler().UiSession();
+    if ( uiSession &&
+         iUtils->SatUiHandler().UiLaunchedByUser() )
+        {
+        LOG( SIMPLE, "SETUPMENU: CSetUpMenuHandler::SendEmptySetupMenuToClient\
+        send setupmenu" )
+        // Client does not respond to setupmenu cmd, therefore NULL.
+        uiSession->SendCommand(
+            &iSetUpMenuPckg,
+            NULL,
+            ESatSProactiveSetUpMenu );
+        }
+
+    LOG( SIMPLE, "SETUPMENU: CSetUpMenuHandler::SendEmptySetupMenuToClient\
+     exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSetUpMenuHandler::UpdateSetUpMenuToClientL
+// -----------------------------------------------------------------------------
+//
+void CSetUpMenuHandler::UpdateSetUpMenuToClientL()
+    {
+    LOG( SIMPLE,
+        "SETUPMENU: CSetUpMenuHandler::UpdateSetUpMenuToClientL calling" )
+
+    iSatAppNameUpdated = ETrue;
+    if ( iSetUpMenuArrived )
+        {
+        // SetUpMenu application name update is needed.
+        iArrivedSetUpMenuData.iAlphaId.iAlphaId.Zero();
+        iArrivedSetUpMenuData.iAlphaId.iAlphaId.Append( iUtils->SatAppName() );
+        LOG( NORMAL, "SETUPMENU:   Name updated" )
+
+        // Restore icon after update.
+        AddIconToShellL(
+            iArrivedSetUpMenuData.iAlphaId.iAlphaId,
+            iArrivedSetUpMenuData.iIconId );
+
+        // Update display, when ui is launched.
+        MSatUiSession* uiSession = iUtils->SatUiHandler().UiSession();
+        if ( uiSession && iUtils->SatUiHandler().UiLaunchedByUser() )
+            {
+            LOG( SIMPLE,
+            "SETUPMENU: CSetUpMenuHandler::UpdateSetUpMenuToClientL \
+            UiLaunchedByUser" )
+            // Update it only when it is not empty.
+            if ( 0 != iArrivedSetUpMenuData.NumberOfItems() )
+                {
+                LOG( SIMPLE,
+                "SETUPMENU: CSetUpMenuHandler::UpdateSetUpMenuToClientL \
+                item not empty" )
+                // Send update to ui.
+                // Client does not respond to setupmenu cmd, therefore NULL.
+                uiSession->SendCommand(
+                    &iArrivedSetUpMenuPckg,
+                    NULL,
+                    ESatSProactiveSetUpMenu );
+                }
+            }
+        }
+
+    LOG( SIMPLE,
+        "SETUPMENU: CSetUpMenuHandler::UpdateSetUpMenuToClientL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSetUpMenuHandler::IssueUSATRequest
+// Makes the request of SetUpMenu from SIM
+// -----------------------------------------------------------------------------
+//
+void CSetUpMenuHandler::IssueUSATRequest( TRequestStatus& aStatus )
+    {
+    LOG( SIMPLE, "SETUPMENU: CSetUpMenuHandler::IssueUSATRequest calling" )
+
+    // Without reset, old menu items stay in the list.
+    iSetUpMenuData.Reset();
+
+#ifdef __WINS__
+    // Empty the IPC data
+    RSat::TSetUpMenuV2 temp;
+    iSetUpMenuData = temp;
+#endif
+
+    iUtils->USatAPI().NotifySetUpMenu( aStatus, iSetUpMenuPckg );
+
+    LOG( SIMPLE, "SETUPMENU: CSetUpMenuHandler::IssueUSATRequestx exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSetUpMenuHandler::CommandAllowed
+// SetUpMenu is allowed always.
+// -----------------------------------------------------------------------------
+//
+TBool CSetUpMenuHandler::CommandAllowed()
+    {
+    LOG( SIMPLE,
+        "SETUPMENU: CSetUpMenuHandler::CommandAllowed calling" )
+
+    TBool commandAllowed( ETrue );
+    TBool nullText( EFalse );
+    TInt err ( KErrNone );
+    RSat::TItem item;
+    TUint numberOfItems( iSetUpMenuData.NumberOfItems() );
+    TBool titleIcon(
+        ( RSat::ENotSelfExplanatory == iSetUpMenuData.iIconId.iQualifier ) ||
+        ( RSat::ESelfExplanatory == iSetUpMenuData.iIconId.iQualifier ) );
+    TBool itemIcons(
+        ( RSat::ENotSelfExplanatory == iSetUpMenuData.iIconListQualifier ) ||
+        ( RSat::ESelfExplanatory == iSetUpMenuData.iIconListQualifier ) );
+    RSat::TSetUpMenuRspV1 setUpMenuRsp;
+    RSat::TSetUpMenuRspV1Pckg setUpMenuRspPckg( setUpMenuRsp );
+
+    // Check if some item does not have text
+    for ( TUint count = 1; ( count <= numberOfItems ) && !nullText &&
+        ( KErrNone == err ); count++ )
+        {
+        err = iSetUpMenuData.GetItem( count, item );
+
+        if ( ( KErrNone == err ) && ( 0 == item.iItemString.Length() ) )
+            {
+            LOG( SIMPLE,
+            "SETUPMENU: CSetUpMenuHandler::CommandAllowed item null" )
+            nullText = ETrue;
+            }
+        }
+    LOG2( SIMPLE,
+    "SETUPMENU: CSetUpMenuHandler::CommandAllowed numberOfItems:%d",
+    numberOfItems )
+    // If icon is provided without any text
+    if ( ( ( RSat::EAlphaIdProvided != iSetUpMenuData.iAlphaId.iStatus ) &&
+             titleIcon ) || ( nullText && itemIcons ) )
+        {
+        setUpMenuRsp.iGeneralResult = RSat::KCmdDataNotUnderstood;
+        setUpMenuRsp.iInfoType = RSat::KNoAdditionalInfo;
+        setUpMenuRsp.iAdditionalInfo.Zero();
+        setUpMenuRsp.SetPCmdNumber( setUpMenuRsp.PCmdNumber() );
+        TerminalRsp( RSat::ESetUpMenu, setUpMenuRspPckg );
+        commandAllowed = EFalse;
+        LOG( NORMAL, "SETUPMENU: CSetUpMenuHandler::\
+            CommandAllowed icon received without alpha id" )
+        }
+    // Set icon command flag whether icon data was received and set qualifier
+    // to no icon id
+    // To be removed when icons are allowed in this command
+    else if ( !titleIcon && !itemIcons )
+        {
+        LOG( SIMPLE,
+        "SETUPMENU: CSetUpMenuHandler::CommandAllowed no icon" )
+        iIconCommand = EFalse;
+        }
+    else
+        {
+        iIconCommand = ETrue;
+
+        if ( titleIcon )
+            {
+            LOG( SIMPLE,
+            "SETUPMENU: CSetUpMenuHandler::CommandAllowed titleIcon true" )
+            iSetUpMenuData.iIconId.iQualifier = RSat::ENoIconId;
+            }
+
+        if ( itemIcons )
+            {
+            LOG( SIMPLE,
+            "SETUPMENU: CSetUpMenuHandler::CommandAllowed itemIcons true" )
+            iSetUpMenuData.iIconListQualifier = RSat::ENoIconId;
+            }
+        }
+
+    LOG2( SIMPLE,
+    "SETUPMENU: CSetUpMenuHandler::CommandAllowed exiting,commandAllowed: %d",
+    commandAllowed )
+    return commandAllowed;
+    }
+
+// -----------------------------------------------------------------------------
+// CSetUpMenuHandler::NeedUiSession
+// SetUpMenu command itself does not need ui session.
+// -----------------------------------------------------------------------------
+//
+TBool CSetUpMenuHandler::NeedUiSession()
+    {
+    LOG( SIMPLE,
+        "SETUPMENU: CSetUpMenuHandler::NeedUiSession calling - exiting" )
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CSetUpMenuHandler::HandleCommand
+// Handles the SetUpMenu proactive command.
+// -----------------------------------------------------------------------------
+//
+void CSetUpMenuHandler::HandleCommand()
+    {
+    LOG( SIMPLE, "SETUPMENU: CSetUpMenuHandler::HandleCommand calling" )
+
+    // This could be moved to base class.
+    iUtils->NotifyEvent( MSatUtils::ESetUpMenuExecuting );
+
+    iArrivedSetUpMenuData = iSetUpMenuData;
+
+    TInt err( KErrNone );
+
+    if ( iSetUpMenuData.IsRemoveMenu() ||
+         ( 0 == iSetUpMenuData.NumberOfItems() ) )
+        {
+        LOG( SIMPLE, 
+        "SETUPMENU: CSetUpMenuHandler::HandleCommand remove icon" )
+        TRAP( err, RemoveIconFromShellL() );
+        }
+    else
+        {
+        // If name has been changed prior launch of SetUpMenu, update name.
+        if ( iSatAppNameUpdated )
+            {
+            LOG( SIMPLE, 
+            "SETUPMENU: CSetUpMenuHandler::HandleCommand iSatAppNameUpdated" )
+            iArrivedSetUpMenuData.iAlphaId.iAlphaId.Zero();
+            }
+
+        // Set SAT name to alpha id if alpha ID is zero.
+        if ( 0 == iArrivedSetUpMenuData.iAlphaId.iAlphaId.Length() )
+            {
+            TRAP( err, iUtils->RestoreSatAppNameL() );
+            iArrivedSetUpMenuData.iAlphaId.iAlphaId.Append(
+                iUtils->SatAppName() );
+            LOG( NORMAL, 
+            "SETUPMENU: CSetUpMenuHandler::HandleCommand Name updated" )
+            }        
+        //Rentain the title of "SIM card application" for special card
+        else
+            {
+            // Set new sat app name.
+            TRAP( err, iUtils->SetSatAppNameL( 
+                               iArrivedSetUpMenuData.iAlphaId.iAlphaId ) );            
+            iArrivedSetUpMenuData.iAlphaId.iAlphaId.Zero();
+            iArrivedSetUpMenuData.iAlphaId.iAlphaId.Copy(
+                iUtils->SatAppName() );            
+            }
+            
+        MSatUiSession* session = iUtils->SatUiHandler().UiSession();
+        if ( session )
+            {
+            LOG( SIMPLE, 
+            "SETUPMENU: CSetUpMenuHandler::HandleCommand session true" )
+            // Send the setupmenu to ui client.
+            session->SendCommand(
+                &iArrivedSetUpMenuPckg,
+                NULL,
+                ESatSProactiveSetUpMenu );
+            }
+
+        if ( KErrNone == err )
+            {
+            LOG( SIMPLE, 
+            "SETUPMENU: CSetUpMenuHandler::HandleCommand AddIconToShellL" )
+            TRAP( err, AddIconToShellL(
+                iArrivedSetUpMenuData.iAlphaId.iAlphaId,
+                iArrivedSetUpMenuData.iIconId ) );
+            }
+
+        }
+
+    RSat::TSetUpMenuRspV1 setUpMenuRsp;
+    RSat::TSetUpMenuRspV1Pckg setUpMenuRspPckg( setUpMenuRsp );
+    setUpMenuRsp.iInfoType = RSat::KNoAdditionalInfo;
+    setUpMenuRsp.iAdditionalInfo.Zero();
+    setUpMenuRsp.SetPCmdNumber( iArrivedSetUpMenuData.PCmdNumber() );
+
+    if ( KErrNone == err )
+        {
+        LOG( SIMPLE, 
+        "SETUPMENU: CSetUpMenuHandler::HandleCommand no error" )
+        iSetUpMenuArrived = ETrue;
+        setUpMenuRsp.iGeneralResult = RSat::KSuccess;
+        // If command had icon data and was done succesfully, report that icon
+        // was not shown
+        // To be removed when icons are allowed in this command
+        // Result of icon showing must be received
+        if ( iIconCommand )
+            {
+            LOG( SIMPLE, 
+            "SETUPMENU: CSetUpMenuHandler::HandleCommand iIconCommand true" )
+            setUpMenuRsp.iGeneralResult =
+                        RSat::KSuccessRequestedIconNotDisplayed;
+            }
+        }
+    else
+        {
+        LOG( SIMPLE, 
+        "SETUPMENU: CSetUpMenuHandler::HandleCommand error" )
+        setUpMenuRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+        }
+
+    CSatCommandHandler::TerminalRsp( RSat::ESetUpMenu, setUpMenuRspPckg );
+
+    LOG( SIMPLE, "SETUPMENU: CSetUpMenuHandler::HandleCommand exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSetUpMenuHandler::UiLaunchFailed
+// -----------------------------------------------------------------------------
+//
+void CSetUpMenuHandler::UiLaunchFailed()
+    {
+    LOG( SIMPLE,
+        "SETUPMENU: CSetUpMenuHandler::UiLaunchFailed calling - exiting" )
+    // SetUpMenu command does not launch UI.
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SetUpMenuCmd/src/std.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 functions
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    <implementationproxy.h>
+#include    "CSetUpMenuHandler.h"
+
+// CONSTANTS
+
+const TImplementationProxy implementationTable[] =
+    {
+    //lint -e{611,1924} Warning "Suspicious cast" can not be avoided.
+    IMPLEMENTATION_PROXY_ENTRY( 0x1000f002, CSetUpMenuHandler::NewL )
+    };
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy ECOM framework factory function
+// Calculates the number of implementations.
+// Returns: Implementation proxy.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount ) // Number of implementations
+    {
+    aTableCount =
+        sizeof( implementationTable ) /
+        sizeof( TImplementationProxy );
+    return implementationTable;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SimSessionEndCmd/group/SimSessionEndCmd.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* 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:  Project definition file for project SimSessionEnd plug-in
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../../inc/SatMacroes.h"
+
+TARGET                  SimSessionEndCmd.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D 0x1000F010
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  std.cpp
+SOURCE                  CSimSessionEndHandler.cpp
+
+START RESOURCE          1000f010.rss
+TARGET                  SimSessionEndCmd.rsc
+END
+
+USERINCLUDE             ../../../inc
+USERINCLUDE             ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+SYSTEMINCLUDE           ../../../../../inc      // Domain telephony
+SYSTEMINCLUDE           ../../../../inc         // Subsystem satengine
+
+LIBRARY                 euser.lib
+LIBRARY                 SatEngine.lib
+
+#ifdef ENABLE_SAT_LOGGING
+LIBRARY                 flogger.lib
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SimSessionEndCmd/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 SimSessionEndCmd plug-in
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+SimSessionEndCmd.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SimSessionEndCmd/inc/CSimSessionEndHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,131 @@
+/*
+* 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:  SimSessionEnd command handler
+*
+*/
+
+
+
+#ifndef CSIMSESSIONENDHANDLER_H
+#define CSIMSESSIONENDHANDLER_H
+
+//  INCLUDES
+#include <etelsat.h>
+#include "CSatCommandHandler.h"
+#include "MSatEventObserver.h"
+
+// CLASS DECLARATION
+
+/**
+*  Command handler for SimSessionEnd command.
+*
+*  @lib SimSessionEndCmd.lib
+*  @since Series 60 3.0
+*/
+class CSimSessionEndHandler : public CSatCommandHandler
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aUtils SAT Utils interface
+        */
+        static CSimSessionEndHandler* NewL( MSatUtils* aUtils );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSimSessionEndHandler();
+
+    private: // New function
+
+        /**
+        * Timer call back for sim session end generation
+        */
+        static TInt TimerCallback( TAny* aSimSessionEndHandler );
+
+    public: // Functions from base classes
+
+        /**
+        * From CSatCommandHandler Overrides the default implementation.
+        * @param aEvent Identifies the event.
+        */
+        void Event( TInt aEvent );
+
+    protected:  // Functions from base classes
+
+        /**
+        * From CActive Cancels the usat request.
+        */
+        void DoCancel();
+
+        /**
+        * From CSatCommandHandler Requests the command notification.
+        * @param aStatus Request status
+        */
+        void IssueUSATRequest( TRequestStatus& aStatus );
+
+        /**
+        * From CSatCommandHandler Precheck before executing the command.
+        * @return TBool indicating command is currently allowed.
+        */
+        TBool CommandAllowed();
+
+        /**
+        * From CSatCommandHandler Need for ui session.
+        * @return TBool indicating need of ui session.
+        */
+        TBool NeedUiSession();
+
+        /**
+        * From CSatCommandHandler Called when USAT API notifies that command.
+        */
+        void HandleCommand();
+
+        /**
+        * From CSatCommandHandler. Ui launch failed.
+        */
+        void UiLaunchFailed();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CSimSessionEndHandler();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private: // Data
+
+        // Indication of user terminated the SIM session.
+        TBool iSimSessionTerminatedByUser;
+
+        // Timer for launcing simsession end.
+        CPeriodic* iTimer;
+
+        // Sustained display text on screen
+        TBool iSustainedTextActive;
+
+        // Sim session end pending because sustained text
+        TBool iSimSessionEndPending;
+
+    };
+
+#endif      // CSIMSESSIONENDHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SimSessionEndCmd/inc/SimSessionEndCmd.rls	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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 headers for project SimSessionEndCmd
+*
+*/
+
+
+#ifndef SIMSESSIONENDCMD_RLS
+#define SIMSESSIONENDCMD_RLS
+
+rls_string STRING_r_simsessionendcmd_display_name "SimSessionEnd command"
+rls_string STRING_r_simsessionendcmd_default_data "SimSessionEndCmd"
+rls_string STRING_r_simsessionendcmd_opaque_data  ""
+
+#endif // SIMSESSIONENDCMD_RLS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SimSessionEndCmd/src/1000f010.rss	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 1000 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Registry information for ECOM
+*
+*/
+
+
+
+//  INCLUDES
+#include <registryinfo.rh>
+#include "SimSessionEndCmd.rls"
+
+//  RESOURCE DEFINITIONS
+// -----------------------------------------------------------------------------
+//
+// SimSessionEndCmdInfo
+// Registeration information for ECOM
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO SimSessionEndCmdInfo
+    {
+    dll_uid = 0x1000f010;
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x1000f001;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x1000f011;
+                    version_no   = 1;
+                    display_name = STRING_r_simsessionendcmd_display_name;
+                    default_data = STRING_r_simsessionendcmd_default_data;
+                    opaque_data  = STRING_r_simsessionendcmd_opaque_data;
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SimSessionEndCmd/src/CSimSessionEndHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,375 @@
+/*
+* 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:  Handles SimSessionEnd command
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "MSatApi.h"
+#include    "MSatUiSession.h"
+#include    "MSatSUiClientHandler.h"
+#include    "CSimSessionEndHandler.h"
+#include    "SatLog.h"
+
+// CONSTANTS
+const TInt KSimSessionEndDelay = 60000000;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSimSessionEndHandler::CSimSessionEndHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSimSessionEndHandler::CSimSessionEndHandler() :
+    CSatCommandHandler()
+    {
+    LOG( SIMPLE, "SIMSESSIONEND: \
+        CSimSessionEndHandler::CSimSessionEndHandler calling - exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSimSessionEndHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSimSessionEndHandler::ConstructL()
+    {
+    LOG( SIMPLE, "SIMSESSIONEND: CSimSessionEndHandler::ConstructL calling" )
+
+    iTimer = CPeriodic::NewL( EPriorityStandard );
+
+    iUtils->RegisterL( this, MSatUtils::EDelaySimSessionEnd );
+    iUtils->RegisterL( this, MSatUtils::EDestroySimSessionEndTimer );
+    iUtils->RegisterL( this, MSatUtils::ESessionTerminatedByUser );
+    iUtils->RegisterL( this, MSatUtils::ESimSessionEndCallBack );
+    iUtils->RegisterL( this, MSatUtils::ESustainedTextInDisplay );
+    iUtils->RegisterL( this, MSatUtils::ESustainedTextRemoved );
+    iUtils->RegisterL( this, MSatUtils::ESatUiLaunched );
+
+    LOG( SIMPLE, "SIMSESSIONEND: CSimSessionEndHandler::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSimSessionEndHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSimSessionEndHandler* CSimSessionEndHandler::NewL( MSatUtils* aUtils )
+    {
+    LOG( SIMPLE, "SIMSESSIONEND: CSimSessionEndHandler::NewL calling" )
+
+    CSimSessionEndHandler* self = new( ELeave ) CSimSessionEndHandler;
+
+    CleanupStack::PushL( self );
+    self->BaseConstructL( aUtils );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "SIMSESSIONEND: CSimSessionEndHandler::NewL exiting" )
+    return self;
+    }
+
+
+// Destructor
+CSimSessionEndHandler::~CSimSessionEndHandler()
+    {
+    LOG( SIMPLE,
+        "SIMSESSIONEND: CSimSessionEndHandler::~CSimSessionEndHandler calling" )
+
+    Cancel();
+
+    if ( iTimer )
+        {
+        iTimer->Cancel();
+        }
+    delete iTimer;
+
+    LOG( SIMPLE,
+        "SIMSESSIONEND: CSimSessionEndHandler::~CSimSessionEndHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSimSessionEndHandler::TimerCallback
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CSimSessionEndHandler::TimerCallback( TAny* aSimSessionEndHandler )
+    {
+    LOG( SIMPLE, "SIMSESSIONEND: CSimSessionEndHandler::TimerCallback calling" )
+
+    CSimSessionEndHandler* handler =
+        static_cast<CSimSessionEndHandler*>( aSimSessionEndHandler );
+        
+    if ( handler )
+        {
+        LOG( SIMPLE, 
+        "SIMSESSIONEND: CSimSessionEndHandler::TimerCallback handler true" )
+        handler->iTimer->Cancel();
+        handler->HandleCommand();
+        }
+
+    LOG( SIMPLE, "SIMSESSIONEND: CSimSessionEndHandler::TimerCallback exiting" )
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CSimSessionEndHandler::Event
+// Waits for indication of user wanting to close the sim session.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSimSessionEndHandler::Event( TInt aEvent )
+    {
+    LOG( SIMPLE, "SIMSESSIONEND: CSimSessionEndHandler::Event calling" )
+
+    switch ( aEvent )
+        {
+        case MSatUtils::ESatUiLaunched:
+            {
+            LOG( NORMAL, 
+            "SIMSESSIONEND: CSimSessionEndHandler::Event UI is launched" )
+            // New UI session, reset flag
+            iSimSessionTerminatedByUser = EFalse;
+            break;
+            }
+
+        case MSatUtils::ESessionTerminatedByUser:
+            {
+            LOG( NORMAL, 
+            "SIMSESSIONEND: CSimSessionEndHandler::Event \
+            ESessionTerminatedByUser" )
+            // Next SimSessionEnd will close the ui session.
+            iSimSessionTerminatedByUser = ETrue;
+            break;
+            }
+
+        case MSatUtils::EDelaySimSessionEnd:
+            {
+            LOG( NORMAL, 
+            "SIMSESSIONEND: CSimSessionEndHandler::Event \
+            EDelaySimSessionEnd" )
+            iTimer->Cancel();
+            TCallBack callback( TimerCallback, this );
+            iTimer->Start( KSimSessionEndDelay, KSimSessionEndDelay, callback );
+            break;
+            }
+
+        case MSatUtils::EDestroySimSessionEndTimer:
+            {
+            LOG( NORMAL, 
+            "SIMSESSIONEND: CSimSessionEndHandler::Event \
+            EDestroySimSessionEndTimer" )
+            iTimer->Cancel();
+            break;
+            }
+
+        case MSatUtils::ESimSessionEndCallBack:
+            {
+            LOG( NORMAL, 
+            "SIMSESSIONEND: CSimSessionEndHandler::Event \
+            ESimSessionEndCallBack" )
+            // Forced Sim session end.
+            iTimer->Cancel();
+            HandleCommand();
+            break;
+            }
+
+        case MSatUtils::ESustainedTextInDisplay:
+            {
+            LOG( NORMAL, "SIMSESSIONEND: CSimSessionEndHandler::Event \
+            ESustainedTextInDisplay" )
+            // Indication of sustained text
+            iSustainedTextActive = ETrue;
+            break;
+            }
+
+        case MSatUtils::ESustainedTextRemoved:
+            {
+            LOG( NORMAL, "SIMSESSIONEND: CSimSessionEndHandler::Event \
+            ESustainedTextRemoved" )
+            // Indication of sustained text cleared
+            iSustainedTextActive = EFalse;
+            // If last sim session end is pending because of sustained text, 
+            // execute it now
+            if ( iSimSessionEndPending )
+                {
+                LOG( NORMAL, 
+                "SIMSESSIONEND: CSimSessionEndHandler::Event \
+                iSimSessionEndPending" )
+                HandleCommand();
+                }
+
+            break;
+            }
+
+        default:
+            {
+            LOG2( NORMAL, 
+            "SIMSESSIONEND: CSimSessionEndHandler::Event \
+            Unexpected event: %i", aEvent )
+            CSatCommandHandler::Event( aEvent );
+            break;
+            }
+        }
+
+    LOG( SIMPLE, "SIMSESSIONEND: CSimSessionEndHandler::Event exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSimSessionEndHandler::DoCancel
+// Cancels the sat request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSimSessionEndHandler::DoCancel()
+    {
+    LOG( SIMPLE, "SIMSESSIONEND: CSimSessionEndHandler::DoCancel calling" )
+
+    iUtils->USatAPI().NotifySimSessionEndCancel();
+
+    LOG( SIMPLE, "SIMSESSIONEND: CSimSessionEndHandler::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSimSessionEndHandler::IssueUSATRequest
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSimSessionEndHandler::IssueUSATRequest( TRequestStatus& aStatus )
+    {
+    LOG( SIMPLE,
+        "SIMSESSIONEND: CSimSessionEndHandler::IssueUSATRequest calling" )
+
+    iUtils->USatAPI().NotifySimSessionEnd( aStatus );
+
+    LOG( SIMPLE,
+        "SIMSESSIONEND: CSimSessionEndHandler::IssueUSATRequest exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSimSessionEndHandler::CommandAllowed
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CSimSessionEndHandler::CommandAllowed()
+    {
+    LOG( SIMPLE, "SIMSESSIONEND: \
+        CSimSessionEndHandler::CommandAllowed calling - exiting" )
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CSimSessionEndHandler::NeedUiSession
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CSimSessionEndHandler::NeedUiSession()
+    {
+    LOG( SIMPLE, "SIMSESSIONEND: \
+        CSimSessionEndHandler::NeedUiSession calling - exiting" )
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CSimSessionEndHandler::HandleCommand
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSimSessionEndHandler::HandleCommand()
+    {
+    LOG( SIMPLE, "SIMSESSIONEND: CSimSessionEndHandler::HandleCommand calling" )
+
+    // Note that the framework has destroyed the simsession
+    // end timer, when HandleCommand is called.
+    if ( !iSimSessionTerminatedByUser && !iSustainedTextActive )
+        {
+        LOG( SIMPLE, 
+        "SIMSESSIONEND: CSimSessionEndHandler::HandleCommand \
+        ESimSessionEndExecuting" )
+        iUtils->NotifyEvent( MSatUtils::ESimSessionEndExecuting );
+        }
+
+    MSatUiSession* uiSession = iUtils->SatUiHandler().UiSession();
+    if ( uiSession )
+        {
+        // If sustained Display text is on screen, cannot close UI
+        if ( !iSustainedTextActive && ( iSimSessionTerminatedByUser ||
+            !iUtils->SatUiHandler().UiLaunchedByUser() ) )
+            {
+            iSimSessionTerminatedByUser = EFalse;
+            iSimSessionEndPending = EFalse;
+            // Number of executing command handlers should be 0.
+            TInt expectedCommCount = 0;
+
+            // If SimSessionEnd is executing ie. not active, it has to take
+            // into account when checking executing command handlers.
+            if ( !IsActive() )
+                {
+                LOG( SIMPLE, 
+                "SIMSESSIONEND: CSimSessionEndHandler::HandleCommand \
+                isn't Active" )
+                expectedCommCount = 1;
+                }
+
+            LOG2( NORMAL, "SIMSESSIONEND: Expected commands: %i",
+                expectedCommCount )
+            // SimSession end is currently executing, therefore there is one
+            // executing command.
+            if ( expectedCommCount ==
+                 iUtils->NumberOfExecutingCommandHandlers() )
+                {
+                LOG( SIMPLE, 
+                "SIMSESSIONEND: CSimSessionEndHandler::HandleCommand \
+                expectedCommCount==iUtils->NumberOfExecutingCommandHandlers()" )
+                // Close the ui session only if there are no
+                // executing commands.
+                uiSession->CloseUiSession();
+                }
+            }
+        else
+            {
+            if ( iSustainedTextActive )
+                {
+                LOG( SIMPLE, 
+                "SIMSESSIONEND: CSimSessionEndHandler::HandleCommand \
+                iSustainedTextActive true" )
+                iSimSessionEndPending = ETrue;
+                }
+            }
+        }
+
+    // Renew the request, because the sim session end does not send
+    // terminal response, which would renew the request automatically.
+    Start();
+
+    LOG( SIMPLE, "SIMSESSIONEND: CSimSessionEndHandler::HandleCommand exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSimSessionEndHandler::UiLaunchFailed
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSimSessionEndHandler::UiLaunchFailed()
+    {
+    // This command does not launch ui client.
+    LOG( SIMPLE,
+        "SIMSESSIONEND: CSimSessionEndHandler::UiLaunchFailed calling-exiting" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Commands/SimSessionEndCmd/src/std.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 functions
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    <implementationproxy.h>
+#include    "CSimSessionEndHandler.h"
+
+// CONSTANTS
+
+const TImplementationProxy implementationTable[] =
+    {
+    //lint -e{611,1924} Warning "Suspicious cast" can not be avoided.
+    IMPLEMENTATION_PROXY_ENTRY( 0x1000f011, CSimSessionEndHandler::NewL )
+    };
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy ECOM framework factory function
+// Calculates the number of implementations.
+// Returns: Implementation proxy.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount ) // Number of implementations
+    {
+    aTableCount =
+        sizeof( implementationTable ) /
+        sizeof( TImplementationProxy );
+    return implementationTable;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/BWINS/SATENGINEU.DEF	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,20 @@
+EXPORTS
+	??0CSatCommandHandler@@IAE@XZ @ 1 NONAME ; CSatCommandHandler::CSatCommandHandler(void)
+	??0CSatSScheduler@@QAE@XZ @ 2 NONAME ; CSatSScheduler::CSatSScheduler(void)
+	??1CSatCommandHandler@@UAE@XZ @ 3 NONAME ; CSatCommandHandler::~CSatCommandHandler(void)
+	?BaseConstructL@CSatCommandHandler@@IAEXPAVMSatUtils@@@Z @ 4 NONAME ; void CSatCommandHandler::BaseConstructL(class MSatUtils *)
+	?ClientResponse@CSatCommandHandler@@UAEXXZ @ 5 NONAME ; void CSatCommandHandler::ClientResponse(void)
+	?CreateSatServerL@@YAPAVCSatSServer@@XZ @ 6 NONAME ; class CSatSServer * CreateSatServerL(void)
+	?DoHandleCommand@CSatCommandHandler@@MAEXXZ @ 7 NONAME ; void CSatCommandHandler::DoHandleCommand(void)
+	?Event@CSatCommandHandler@@UAEXH@Z @ 8 NONAME ; void CSatCommandHandler::Event(int)
+	?IsCommandExecuting@CSatCommandHandler@@QBEHXZ @ 9 NONAME ; int CSatCommandHandler::IsCommandExecuting(void) const
+	?IsExtendedError@TSatExtErrorUtils@@SAHH@Z @ 10 NONAME ; int TSatExtErrorUtils::IsExtendedError(int)
+	?IsNetworkError@TSatExtErrorUtils@@SAHH@Z @ 11 NONAME ; int TSatExtErrorUtils::IsNetworkError(int)
+	?IsPhoneInIdleState@CSatCommandHandler@@IAEHXZ @ 12 NONAME ; int CSatCommandHandler::IsPhoneInIdleState(void)
+	?MapError@TSatExtErrorUtils@@SAEHH@Z @ 13 NONAME ; unsigned char TSatExtErrorUtils::MapError(int, int)
+	?Panic@CSatCommandHandler@@QBEXABVTDesC16@@H@Z @ 14 NONAME ; void CSatCommandHandler::Panic(class TDesC16 const &, int) const
+	?RunL@CSatCommandHandler@@MAEXXZ @ 15 NONAME ; void CSatCommandHandler::RunL(void)
+	?SetServer@CSatSScheduler@@QAEXPAVCSatSServer@@@Z @ 16 NONAME ; void CSatSScheduler::SetServer(class CSatSServer *)
+	?Start@CSatCommandHandler@@QAEXXZ @ 17 NONAME ; void CSatCommandHandler::Start(void)
+	?TerminalRsp@CSatCommandHandler@@IAEXW4TPCmd@RSat@@ABVTDesC8@@@Z @ 18 NONAME ; void CSatCommandHandler::TerminalRsp(enum RSat::TPCmd, class TDesC8 const &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/EABI/SatEngineU.DEF	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,87 @@
+EXPORTS
+	_Z16CreateSatServerLv @ 1 NONAME
+	_ZN14CSatSScheduler9SetServerEP11CSatSServer @ 2 NONAME
+	_ZN14CSatSSchedulerC1Ev @ 3 NONAME
+	_ZN14CSatSSchedulerC2Ev @ 4 NONAME
+	_ZN17TSatExtErrorUtils14IsNetworkErrorEi @ 5 NONAME
+	_ZN17TSatExtErrorUtils15IsExtendedErrorEi @ 6 NONAME
+	_ZN17TSatExtErrorUtils8MapErrorEii @ 7 NONAME
+	_ZN18CSatCommandHandler11TerminalRspEN4RSat5TPCmdERK6TDesC8 @ 8 NONAME
+	_ZN18CSatCommandHandler14BaseConstructLEP9MSatUtils @ 9 NONAME
+	_ZN18CSatCommandHandler14ClientResponseEv @ 10 NONAME
+	_ZN18CSatCommandHandler15DoHandleCommandEv @ 11 NONAME
+	_ZN18CSatCommandHandler18IsPhoneInIdleStateEv @ 12 NONAME
+	_ZN18CSatCommandHandler4RunLEv @ 13 NONAME
+	_ZN18CSatCommandHandler5EventEi @ 14 NONAME
+	_ZN18CSatCommandHandler5StartEv @ 15 NONAME
+	_ZN18CSatCommandHandlerC2Ev @ 16 NONAME
+	_ZN18CSatCommandHandlerD0Ev @ 17 NONAME
+	_ZN18CSatCommandHandlerD1Ev @ 18 NONAME
+	_ZN18CSatCommandHandlerD2Ev @ 19 NONAME
+	_ZNK18CSatCommandHandler18IsCommandExecutingEv @ 20 NONAME
+	_ZNK18CSatCommandHandler5PanicERK7TDesC16i @ 21 NONAME
+	_ZTI11CSatSServer @ 22 NONAME ; #<TI>#
+	_ZTI12CSatBIPUtils @ 23 NONAME ; #<TI>#
+	_ZTI12CSatSSession @ 24 NONAME ; #<TI>#
+	_ZTI14CSatApnHandler @ 25 NONAME ; #<TI>#
+	_ZTI14CSatSScheduler @ 26 NONAME ; #<TI>#
+	_ZTI15CSatIconHandler @ 27 NONAME ; #<TI>#
+	_ZTI15CSatSSubSession @ 28 NONAME ; #<TI>#
+	_ZTI17CSatBIPDataSender @ 29 NONAME ; #<TI>#
+	_ZTI17CSatSUiSubSession @ 30 NONAME ; #<TI>#
+	_ZTI18CSatCommandHandler @ 31 NONAME ; #<TI>#
+	_ZTI18TSatEventsObserver @ 32 NONAME ; #<TI>#
+	_ZTI19CSatBIPDataReceiver @ 33 NONAME ; #<TI>#
+	_ZTI19CSatSIconSubSession @ 34 NONAME ; #<TI>#
+	_ZTI20CSatClientServiceReq @ 35 NONAME ; #<TI>#
+	_ZTI20CSatCommandContainer @ 36 NONAME ; #<TI>#
+	_ZTI20CSatSSimSubscriberId @ 37 NONAME ; #<TI>#
+	_ZTI20CSatSUiClientHandler @ 38 NONAME ; #<TI>#
+	_ZTI21CSatSAPChangeObserver @ 39 NONAME ; #<TI>#
+	_ZTI22CSatBIPGPRSDataChannel @ 40 NONAME ; #<TI>#
+	_ZTI22CSatSRefreshSubSession @ 41 NONAME ; #<TI>#
+	_ZTI22CSatThreadDeathMonitor @ 42 NONAME ; #<TI>#
+	_ZTI23CSatSBasicIconConverter @ 43 NONAME ; #<TI>#
+	_ZTI23CSatSColorIconConverter @ 44 NONAME ; #<TI>#
+	_ZTI25CSatEventMonitorContainer @ 45 NONAME ; #<TI>#
+	_ZTI25CSatMediatorEventProvider @ 46 NONAME ; #<TI>#
+	_ZTI8TUSatAPI @ 47 NONAME ; #<TI>#
+	_ZTV11CSatSServer @ 48 NONAME ; #<VT>#
+	_ZTV12CSatBIPUtils @ 49 NONAME ; #<VT>#
+	_ZTV12CSatSSession @ 50 NONAME ; #<VT>#
+	_ZTV14CSatApnHandler @ 51 NONAME ; #<VT>#
+	_ZTV14CSatSScheduler @ 52 NONAME ; #<VT>#
+	_ZTV15CSatIconHandler @ 53 NONAME ; #<VT>#
+	_ZTV15CSatSSubSession @ 54 NONAME ; #<VT>#
+	_ZTV17CSatBIPDataSender @ 55 NONAME ; #<VT>#
+	_ZTV17CSatSUiSubSession @ 56 NONAME ; #<VT>#
+	_ZTV18CSatCommandHandler @ 57 NONAME ; #<VT>#
+	_ZTV18TSatEventsObserver @ 58 NONAME ; #<VT>#
+	_ZTV19CSatBIPDataReceiver @ 59 NONAME ; #<VT>#
+	_ZTV19CSatSIconSubSession @ 60 NONAME ; #<VT>#
+	_ZTV20CSatClientServiceReq @ 61 NONAME ; #<VT>#
+	_ZTV20CSatCommandContainer @ 62 NONAME ; #<VT>#
+	_ZTV20CSatSSimSubscriberId @ 63 NONAME ; #<VT>#
+	_ZTV20CSatSUiClientHandler @ 64 NONAME ; #<VT>#
+	_ZTV21CSatSAPChangeObserver @ 65 NONAME ; #<VT>#
+	_ZTV22CSatBIPGPRSDataChannel @ 66 NONAME ; #<VT>#
+	_ZTV22CSatSRefreshSubSession @ 67 NONAME ; #<VT>#
+	_ZTV22CSatThreadDeathMonitor @ 68 NONAME ; #<VT>#
+	_ZTV23CSatSBasicIconConverter @ 69 NONAME ; #<VT>#
+	_ZTV23CSatSColorIconConverter @ 70 NONAME ; #<VT>#
+	_ZTV25CSatEventMonitorContainer @ 71 NONAME ; #<VT>#
+	_ZTV25CSatMediatorEventProvider @ 72 NONAME ; #<VT>#
+	_ZTV8TUSatAPI @ 73 NONAME ; #<VT>#
+	_ZThn28_N18CSatCommandHandler5EventEi @ 74 NONAME ; #<thunk>#
+	_ZThn28_N18CSatCommandHandlerD0Ev @ 75 NONAME ; #<thunk>#
+	_ZThn28_N18CSatCommandHandlerD1Ev @ 76 NONAME ; #<thunk>#
+	_ZThn32_N18CSatCommandHandler14ClientResponseEv @ 77 NONAME ; #<thunk>#
+	_ZThn32_N18CSatCommandHandlerD0Ev @ 78 NONAME ; #<thunk>#
+	_ZThn32_N18CSatCommandHandlerD1Ev @ 79 NONAME ; #<thunk>#
+	_ZTI18CSatSActiveWrapper @ 80 NONAME ; #<TI>#
+	_ZTV18CSatSActiveWrapper @ 81 NONAME ; #<VT>#
+	_ZTI25CSatProfileChangeObserver @ 82 NONAME ; #<TI>#
+	_ZTV25CSatProfileChangeObserver @ 83 NONAME ; #<VT>#
+	_ZTI25CSatBIPConnectionObserver @ 84 NONAME ; #<TI>#
+	_ZTV25CSatBIPConnectionObserver @ 85 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/group/Create-UT_CCommandHandler-Sis.bat	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,70 @@
+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: This BAT copies Test DLL to local folder and makes SIS file
+rem
+
+@echo off
+echo.
+echo ====================================
+echo.
+echo Digia EUnit - Test
+echo.
+echo This BAT copies Test DLL
+echo to local folder and makes SIS file
+echo.
+echo ====================================
+echo.
+
+:CHECK_EPOCROOT
+echo.
+echo - verify epoc root
+set EPOCROOT
+if errorlevel == 1 goto END_ERROR 
+
+:COPY_DLL
+echo.
+echo - copy test dll to current directory
+copy %EPOCROOT%epoc32\release\thumb\urel\UT_CCommandHandler.dll .
+if errorlevel == 1 goto END_ERROR 
+
+:CREATE_DIR
+echo.
+echo - create Sis folder (created only if needed)
+mkdir ..\Sis
+
+:MAKESIS
+echo.
+echo - makesis UT_CCommandHandler.pkg ..\sis\UT_CCommandHandler.sis
+call makesis UT_CCommandHandler.pkg ..\sis\UT_CCommandHandler.sis
+if errorlevel == 1 goto END_ERROR
+
+:DELETE_DLL
+echo.
+echo - remove the copied dll from current folder
+del UT_CCommandHandler.dll
+goto END
+
+:END_ERROR
+echo.
+echo Sis creation failed. 
+goto FINAL_END
+
+:END
+echo.
+echo Sis file created succesfully
+echo ============================
+
+:FINAL_END
+echo.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/group/Create-UT_TSatEventMediator-Sis.bat	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,70 @@
+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: This BAT copies Test DLL to local folder and makes SIS file
+rem
+
+@echo off
+echo.
+echo ====================================
+echo.
+echo Digia EUnit - Test
+echo.
+echo This BAT copies Test DLL
+echo to local folder and makes SIS file
+echo.
+echo ====================================
+echo.
+
+:CHECK_EPOCROOT
+echo.
+echo - verify epoc root
+set EPOCROOT
+if errorlevel == 1 goto END_ERROR 
+
+:COPY_DLL
+echo.
+echo - copy test dll to current directory
+copy %EPOCROOT%epoc32\release\thumb\urel\UT_TSatEventMediator.dll .
+if errorlevel == 1 goto END_ERROR 
+
+:CREATE_DIR
+echo.
+echo - create Sis folder (created only if needed)
+mkdir ..\Sis
+
+:MAKESIS
+echo.
+echo - makesis UT_TSatEventMediator.pkg ..\sis\UT_TSatEventMediator.sis
+call makesis UT_TSatEventMediator.pkg ..\sis\UT_TSatEventMediator.sis
+if errorlevel == 1 goto END_ERROR
+
+:DELETE_DLL
+echo.
+echo - remove the copied dll from current folder
+del UT_TSatEventMediator.dll
+goto END
+
+:END_ERROR
+echo.
+echo Sis creation failed. 
+goto FINAL_END
+
+:END
+echo.
+echo Sis file created succesfully
+echo ============================
+
+:FINAL_END
+echo.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/group/Create-UT_TSatEventsObserver-Sis.bat	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,70 @@
+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: This BAT copies Test DLL to local folder and makes SIS file
+rem
+
+@echo off
+echo.
+echo ====================================
+echo.
+echo Digia EUnit - Test
+echo.
+echo This BAT copies Test DLL
+echo to local folder and makes SIS file
+echo.
+echo ====================================
+echo.
+
+:CHECK_EPOCROOT
+echo.
+echo - verify epoc root
+set EPOCROOT
+if errorlevel == 1 goto END_ERROR 
+
+:COPY_DLL
+echo.
+echo - copy test dll to current directory
+copy %EPOCROOT%epoc32\release\thumb\urel\UT_TSatEventsObserver.dll .
+if errorlevel == 1 goto END_ERROR 
+
+:CREATE_DIR
+echo.
+echo - create Sis folder (created only if needed)
+mkdir ..\Sis
+
+:MAKESIS
+echo.
+echo - makesis UT_TSatEventsObserver.pkg ..\sis\UT_TSatEventsObserver.sis
+call makesis UT_TSatEventsObserver.pkg ..\sis\UT_TSatEventsObserver.sis
+if errorlevel == 1 goto END_ERROR
+
+:DELETE_DLL
+echo.
+echo - remove the copied dll from current folder
+del UT_TSatEventsObserver.dll
+goto END
+
+:END_ERROR
+echo.
+echo Sis creation failed. 
+goto FINAL_END
+
+:END
+echo.
+echo Sis file created succesfully
+echo ============================
+
+:FINAL_END
+echo.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/group/SatEngine.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,114 @@
+/*
+* 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:  Project definition file for project SatEngine
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../inc/SatMacroes.h"
+
+TARGET                  satengine.dll
+TARGETTYPE              dll
+UID                     0x1000008d 0x1000f100
+
+CAPABILITY              CAP_GENERAL_DLL NetworkControl ReadDeviceData WriteDeviceData AllFiles
+VENDORID                VID_DEFAULT
+
+// Library is created by SatEngineLib.mmp
+NOEXPORTLIBRARY
+
+SOURCEPATH              ../src
+SOURCE                  std.cpp
+SOURCE                  CSatSServer.cpp
+SOURCE                  CSatSSession.cpp
+SOURCE                  CSatSSubSession.cpp
+SOURCE                  CSatSUiSubSession.cpp
+SOURCE                  CSatSIconSubSession.cpp
+SOURCE                  CSatSIconConverter.cpp
+SOURCE                  CSatSBasicIconConverter.cpp
+SOURCE                  CSatSColorIconConverter.cpp
+SOURCE                  CSatIconHandler.cpp
+SOURCE                  TSatBitOP.cpp
+SOURCE                  CSatClientServiceReq.cpp
+SOURCE                  CSatSScheduler.cpp
+SOURCE                  CSatCommandHandler.cpp
+SOURCE                  CSatCommandContainer.cpp
+SOURCE                  TSatEventMediator.cpp
+SOURCE                  TSatEventsObserver.cpp
+SOURCE                  TUSatAPI.cpp
+SOURCE                  Panic.cpp
+SOURCE                  CSatSRefreshSubSession.cpp
+SOURCE                  CSatSSimSubscriberId.cpp
+SOURCE                  CSatThreadDeathMonitor.cpp
+SOURCE                  CSatSUiClientHandler.cpp
+SOURCE                  CSatEventMonitorContainer.cpp
+SOURCE                  CSatSAPChangeObserver.cpp
+SOURCE                  CSatBIPGPRSDataChannel.cpp
+SOURCE                  CSatBIPUtils.cpp
+SOURCE                  CSatBIPDataSender.cpp
+SOURCE                  CSatBIPDataReceiver.cpp
+SOURCE                  CSatApnHandler.cpp
+SOURCE                  TSatChannelIDInfo.cpp
+SOURCE                  TSatQoSParser.cpp
+SOURCE                  TSatExtErrorUtils.cpp
+SOURCE                  csatmediatoreventprovider.cpp
+SOURCE                  csatsactivewrapper.cpp
+SOURCE                  csatprofilechangeobserver.cpp
+SOURCE                  csatbipconnectionobserver.cpp
+SOURCE                  csatbipsubconneventobserver.cpp
+SOURCE                  csatmultimodeapi.cpp
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+SYSTEMINCLUDE           ../../../../inc         // Domain telephonyservices
+SYSTEMINCLUDE           ../../../inc            // Subsystem satengine
+
+START RESOURCE          ../src/SatServer.rss
+HEADER
+TARGETPATH              RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END // RESOURCE
+
+USERINCLUDE             ../inc
+USERINCLUDE             ../../inc
+
+LIBRARY                 euser.lib
+LIBRARY                 etel.lib
+LIBRARY                 etelsat.lib
+LIBRARY                 etelmm.lib
+LIBRARY                 ecom.lib
+LIBRARY                 bafl.lib
+LIBRARY                 efsrv.lib
+LIBRARY                 syslangutil.lib
+LIBRARY                 satsystemstate.lib
+LIBRARY                 sateventmonitors.lib
+LIBRARY                 fbscli.lib
+LIBRARY                 esock.lib
+LIBRARY                 insock.lib
+LIBRARY                 qoslib.lib
+LIBRARY                 etelpckt.lib
+LIBRARY                 commdb.lib
+LIBRARY                 customapi.lib
+LIBRARY                 featmgr.lib
+LIBRARY                 centralrepository.lib
+LIBRARY                 mediatorclient.lib
+LIBRARY                 netmeta.lib
+LIBRARY                 cmmanager.lib
+LIBRARY                 extendedconnpref.lib 
+
+#ifdef ENABLE_SAT_LOGGING
+LIBRARY                 flogger.lib
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/group/SatEngineLib.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,25 @@
+/*
+* 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:  Generate lib file
+*
+*/
+
+
+TARGET      satengine.dll
+TARGETTYPE  IMPLIB
+UID         0x1000008d 0x1000f100
+VENDORID    VID_DEFAULT
+
+CAPABILITY CAP_GENERAL_DLL NetworkControl ReadDeviceData WriteDeviceData AllFiles
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/group/UT_CCommandHandler.pkg	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,37 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: For packing UT_CCommandhandler.
+;
+
+; Supported languages
+&en
+
+; Package header (one name for each supported language)
+#{"UT_CCommandHandler"},(0x01700000),0,10,0
+
+; Package signature
+
+
+; Options line not supported currently
+
+; Conditions blocks not supported currently
+
+; Language independent files that are always installed
+"UT_CCommandHandler.dll"-"!:\DigiaEUnit\Tests\UT_CCommandHandler.dll"
+
+; Language dependent files 
+
+
+; Requisites (of type: (UID),Major,Minor,Build-Number,{"Requisite Name1", "Requisite Name2"})
+(0x101F6F88), 0, 0, 0, {"Series60ProductID"}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/group/UT_TSatEventMediator.pkg	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,37 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: For packing UT_TSatEventMediator.
+;
+
+; Supported languages
+&en
+
+; Package header (one name for each supported language)
+#{"UT_TSatEventMediator"},(0x01700000),0,10,0
+
+; Package signature
+
+
+; Options line not supported currently
+
+; Conditions blocks not supported currently
+
+; Language independent files that are always installed
+"UT_TSatEventMediator.dll"-"!:\DigiaEUnit\Tests\UT_TSatEventMediator.dll"
+
+; Language dependent files 
+
+
+; Requisites (of type: (UID),Major,Minor,Build-Number,{"Requisite Name1", "Requisite Name2"})
+(0x101F6F88), 0, 0, 0, {"Series60ProductID"}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/group/UT_TSatEventsObserver.pkg	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,36 @@
+;
+; 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: For packing UT_TSatEventObserver.
+;
+; Supported languages
+&en
+
+; Package header (one name for each supported language)
+#{"UT_TSatEventsObserver"},(0x01700000),0,10,0
+
+; Package signature
+
+
+; Options line not supported currently
+
+; Conditions blocks not supported currently
+
+; Language independent files that are always installed
+"UT_TSatEventsObserver.dll"-"!:\DigiaEUnit\Tests\UT_TSatEventsObserver.dll"
+
+; Language dependent files 
+
+
+; Requisites (of type: (UID),Major,Minor,Build-Number,{"Requisite Name1", "Requisite Name2"})
+(0x101F6F88), 0, 0, 0, {"Series60ProductID"}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2003-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 SatEngine
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../inc/MSatShellController.h        |../../../../inc/MSatShellController.h
+../../CenRep/SATInternalPSKeys.h    |../../../../inc/SATInternalPSKeys.h
+../../loc/SatServer.loc             MW_LAYER_LOC_EXPORT_PATH( satserver.loc )
+
+PRJ_MMPFILES
+SatEngine.mmp
+SatEngineLib.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/CSatApnHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,135 @@
+/*
+* 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:  Handles APN operations
+*
+*/
+
+
+
+#ifndef CSATAPNHANDLER_H
+#define CSATAPNHANDLER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "MSatApnHandler.h"
+
+class MSatUtils;
+
+/**
+*  Handles the Access point operations with CMManager. Searches, inserts and
+*  deletes APNs, if neccessary
+*
+*  @lib SatEngine
+*  @since S60 3.0
+*/
+class CSatApnHandler : public CBase,
+                       public MSatApnHandler
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aUtils Reference to SAT Utils
+        */
+        static CSatApnHandler* NewL( MSatUtils& aUtils );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSatApnHandler();
+
+    public: // Functions from MSatApnHandler
+
+        /**
+        * Locates APN from CMManager, creates new APN if not found, and
+        * returns IAP id and Network ID in referenced parameters
+        * @param aName Accesspoint to locate / create
+        * @param aUserLogin, User name in case new APN is needed
+        * @param aUserPwd, Password in case, new APN is needed
+        * @param aIapId, after completion, holds the IAP id of the APN
+        * @param aNwId, after completion, holds the Network id of the APN
+        * @param aApnCreated indicates is new APN created
+        * @param aPdpType, indicates whether the address type is IPv4  or IPv6
+        * @param aLocalAddress, represents the Local Address provided by NAA
+        */
+        void GetApnInfoL(
+            const RSat::TAccessName& aName,
+            const RSat::TTextString& aUserLogin,
+            const RSat::TTextString& aUserPwd,
+            TUint32& aIapId,
+            TUint32& aNwId,
+            TBool& aApnCreated,
+            const RPacketContext::TProtocolType& aPdpType,
+            const TDesC8& aLocalAddress );
+
+        /**
+        * Deletes the connection method with given APN ID. Note that aApnId is 
+        * the same id that GetApnInfoL returns in aNwId.
+        * @param aApnId APN to delete
+        */
+        void DeleteApnL( TUint32 aApnId );
+
+        /**
+         * Find the default APN Id
+         * @param aPdpType, indicates the address type is IPv4  or IPv6
+         * @return a default iap id
+         */
+        TUint32 FindDefaultApL(
+                const RPacketContext::TProtocolType& aPdpType );
+    private:
+
+        /**
+        * C++ default constructor.
+        * @param aUtils Reference to SAT Utils
+        */
+        CSatApnHandler( MSatUtils& aUtils );
+
+        /**
+        * create a new connection method  in case, access point does not exist
+        * @param aReqApn Formatted required access point name.
+        * @param aUserLogin User name
+        * @param aUserPwd Password
+        * @param aIapId, after completion, holds the IAP id of the new APN
+        * @param aNwId, after completion, holds the Network id of the new APN
+        * @param aPdpType, indicates whether the address type is IPv4  or IPv6
+        * @param aLocalAddress, represents the Local Address provided by NAA
+        */
+        void InsertRecordL(
+            const TDesC& aReqApn,
+            const RSat::TTextString& aUserLogin,
+            const RSat::TTextString& aUserPwd,
+            TUint32& aIapId,
+            TUint32& aNwId,
+            const RPacketContext::TProtocolType aPdpType,
+            const TDesC8& aLocalAddress );
+
+        /**
+        * Formats the APN from SIM into correct format.
+        * @param aReqApn Accesspoint to format
+        * @return Returns formatted APN in an HBufC
+        *         Invoker is responsible to release
+        *         the memory! 
+        */
+        HBufC* FormatAPN( const RSat::TAccessName& aReqApn ) const;
+
+    private:  // Data
+
+        // Reference to command container
+        MSatUtils& iUtils;
+
+    };
+
+#endif      // CSATAPNHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/CSatBIPDataReceiver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,109 @@
+/*
+* 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:  CSatBIPDataReceiver is responsible of Receive operations
+*
+*/
+
+
+
+#ifndef CSATBIPDATARECEIVER_H
+#define CSATBIPDATARECEIVER_H
+
+//  INCLUDES
+#include    <e32base.h>
+#include    <in_sock.h>
+#include    "MSatBIPUtils.h"
+
+// FORWARD DECLARATIONS
+class CSatBIPGPRSDataChannel;
+
+// CLASS DECLARATION
+
+/**
+*  CSatBIPDataReceiver is responsible for receiving data using deifned protocol
+*  and to notify CSatBIPGPRSDataChannel when data has been sent.
+*
+*  @lib SatEngine.lib
+*  @since Series 60 3.0
+*/
+class CSatBIPDataReceiver : public CActive
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Default constructor.
+        * @param aObserver GPRS data channel to whom the received data is passed
+        * @param aSocket Socket where the data is received
+        * @param aIsTcpSocket Indicates whether to use TCP or UDP
+        */
+        CSatBIPDataReceiver( CSatBIPGPRSDataChannel& aObserver,
+                             RSocket& aSocket,
+                             TBool aIsTcpSocket );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSatBIPDataReceiver();
+
+    public: // Functions from base classes
+
+        /**
+        * From CActive. Informs observer that data has been received.
+        */
+        void RunL();
+
+        /**
+        * From CActive. Cancels any outgoing requests
+        */
+        void DoCancel();
+
+    public: // New functions
+
+        /**
+        * This notification is called when SIM has received all the data
+        * from ReceiveStore in case of UDP. If there are any pending datagrams,
+        * it is stored and receive is available again.
+        */
+        void ReceiveStoreEmptyNotificationL();
+
+        /**
+        * Starts receiving data using predefined protocol.
+        * @param aAddr Source address where the data is received.
+        */
+        void StartReceive( TInetAddr& aAddr );
+
+    private:    // Data
+
+        // Observer the data sent event.
+        CSatBIPGPRSDataChannel& iObserver;
+
+        // Socket
+        RSocket& iSocket;
+
+        // Defines wether to use UDP or TCP sockets
+        TBool iIsTcpSocket;
+
+        // Receive buffer where the data is received
+        TBuf8<KSatBIPMinReceiveBufferSize> iRecvBuffer;
+
+        // Contains the number of bytes received
+        TInt iReceiveDataLen;
+
+        // Wrapper for bytes received indication
+        TSockXfrLength iRecvPckg;
+    };
+
+#endif      // CSATBIPDATARECEIVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/CSatBIPDataSender.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,107 @@
+/*
+* 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:  CSatBIPDataSender is responsible of Send operations
+*
+*/
+
+
+
+#ifndef CSATBIPDATASENDER_H
+#define CSATBIPDATASENDER_H
+
+//  INCLUDES
+#include    <e32base.h>
+#include    <in_sock.h>
+#include    "MSatBIPUtils.h"
+
+// FORWARD DECLARATIONS
+class MSatSendDataObserver;
+
+// CLASS DECLARATION
+
+/**
+*  CSatBIPDataSender is responsible for sending data using deifned protocol and
+*  to notify MSatSendDataObserver when data has been sent.
+*
+*  @lib SatEngine.lib
+*  @since Series 60 3.0
+*/
+class CSatBIPDataSender : public CActive
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Default constructor.
+        * @param aObserver Observer of successfull send data
+        * @param aSocket Socket where the data is sent
+        * @param aIsTcpSocket Indicates wheter to use TCP or UDP
+        * @param aBufferSize Size of Tx buffer. Sent back to aObserver
+        */
+        CSatBIPDataSender( MSatSendDataObserver& aObserver,
+                           RSocket& aSocket,
+                           TBool aIsTcpSocket,
+                           TInt aBufferSize );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSatBIPDataSender();
+
+    public: // Functions from base classes
+
+        /**
+        * From CActive. Informs observer that data has been sent.
+        */
+        void RunL();
+
+        /**
+        * From CActive. Cancels any outgoing requests
+        */
+        void DoCancel();
+
+    public: // New functions
+
+        /**
+        * Sends data using predefined protocol.
+        * @param aData Data to send.
+        * @param aDest Destination address where the data is sent. Used only
+        *        with UDP sockets.
+        */
+        void SendData( const TDesC8& aData, TInetAddr& aDest );
+
+    private:    // Data
+
+        // Observer the data sent event.
+        MSatSendDataObserver& iObserver;
+
+        // Socket
+        RSocket& iSocket;
+
+        // Defines wether to use UDP or TCP sockets
+        TBool iIsTcpSocket;
+
+        // Holds the amount of data sent with same connection
+        TUint iUplinkData;
+
+        // Sender buffer
+        TBuf8<KSatBIPMaxBufferSize> iSendPtr;
+
+        // Buffer size. Returned to observer when data is sent
+        TInt iBufferSize;
+
+    };
+
+#endif      // CSATBIPDATASENDER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/CSatBIPGPRSDataChannel.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,428 @@
+/*
+* 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:  GPRS Data channel
+*
+*/
+
+
+
+#ifndef CSATBIPGPRSDATACHANNEL_H
+#define CSATBIPGPRSDATACHANNEL_H
+
+#include  <e32base.h>
+#include  <es_enum.h>           // TConnectionInfo
+#include  <in_sock.h>
+#include  <etelqos.h>
+
+#include  "MSatBIPDataChannel.h"
+#include  "MSatBIPUtils.h"
+#include  "TSatQoSParser.h"
+
+class CSatBIPUtils;
+class MSatSendDataObserver;
+class CSatBIPDataSender;
+class CSatBIPDataReceiver;
+class MSatConnectionObserver;
+class TSatChannelIdInfo;
+class TNotificationEventBuf;
+class CSubConQosR5ParamSet;
+class CSubConExtensionParameterSet;
+class CSatSActiveWrapper;
+class CSatBIPSubConnEventObserver;
+
+/**  Maximum Address Length */
+const TInt KMaxAddressLength = 50;
+
+/**  Enum for connection stage */
+enum TSatBIPConnectionStage
+    {
+    ESatBIPClosed,
+    ESatBIPConnect,
+    ESatBIPConnected,
+    ESatBIPCancelled
+    };
+
+/**
+ *  GPRS Data channel for Bearer Independent Protocol.
+ *  
+ *  @lib SatServer
+ *  @since Series 60 3.0
+ */
+class CSatBIPGPRSDataChannel : public CActive,
+                               public MSatBIPDataChannel
+    {
+public:  
+
+// Constructors and destructor
+
+    /**
+     * Two-phased constructor.
+     * @param aUtils Interface for EventDownload commands
+     * @param aSocketServer Reference to Socket server.
+     * @param aChannelId ID for this data channel
+     * @param aConnection Reference to Connection
+     * @param aSubConnection ID Reference to SubConnection
+     */
+    static CSatBIPGPRSDataChannel* NewL( CSatBIPUtils& aUtils,
+        RSocketServ& aSocketServer,
+        TSatChannelIdInfo& aChannelId,
+        RConnection& aConnection,
+        RSubConnection& aSubConnection
+         );
+
+    /**
+     * Two-phased constructor.
+     * @param aUtils Interface for EventDownload commands
+     * @param aSocketServer Reference to Socket server.
+     * @param aChannelId ID for this data channel needs to add to comments
+     * @param aConnection Reference to Connection
+     * @param aSubConnection ID Reference to SubConnection
+     */
+    static CSatBIPGPRSDataChannel* NewLC( CSatBIPUtils& aUtils,
+        RSocketServ& aSocketServer,
+        TSatChannelIdInfo& aChannelId,
+        RConnection& aConnection,
+        RSubConnection& aSubConnection );
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CSatBIPGPRSDataChannel();
+
+// New functions
+
+    /**
+     * Notification that data has been received.
+     * @param aData Holds received data.
+     */
+    void DataReceivedNotificationL( const TDesC8& aData );
+
+    /**
+     * Error notification while receiving
+     * @param aError The error code
+     */
+    void DataReceiveError( const TInt aError );
+        
+    /**
+     * Granted parameters event is received correctly.
+     * @param aEventBuffer Holds the negotiated QoS parameters.
+     */
+    void GrantedEventReceivedL( const TNotificationEventBuf& aEventBuffer );
+        
+    /**
+     * Return the subconnection.
+     * @return Reference to SubConnection
+     */
+    RSubConnection& SubConnection() const;
+        
+// From base class MSatBIPDataChannel
+
+    /**
+     * From MSatBIPDataChannel Sets up connection. Does not activate it yet.
+     * @param aConnParams includes all needed information to open the connection.
+     */
+    void SetupConnectionL( const TSatBipConnectionInfo& aConnParams );
+
+    /**
+     * Notification that data has been received.
+     * @param aData Holds received data.
+     */
+    void ActivateConnectionL( MSatConnectionObserver* aObserver );
+
+    /**
+     * From MSatBIPDataChannel Returns Negotiated bearer parameters
+     * @param aResult Output Negotiated bearer parameters
+     */
+    void GetNegotiatedQoSParams( RSat::TBearerParams& aResult ) const;
+
+    /**
+     * From MSatBIPDataChannel Sends the data or stores it into a
+     * buffer for later send.
+     * @param aData Data to be send.
+     * @param aSendImmedeately Indicates whether to send immediately or
+     *        store data to buffer for later send.
+     * @param aFreeBufferSize The number of bytes of empty size in the buffer
+     * @param aObserver Observer of the SendData procedure. When data is sent,
+     *        observer gets notification. If data is stored for later send,
+     *        observer is not notified.
+     * @return Error code indicating the status of the command execution.
+     */
+    TInt SendDataL( const TDes8& aData, 
+        const TBool aSendImmediately,
+        TInt& aFreeBufferSize,
+        MSatSendDataObserver* aObserver );
+
+    /**
+     * From MSatBIPDataChannel Receives the data from the buffer.
+     * @param aData Data to receive.
+     * @param aBytesToRead The number of requested bytes to return
+     * @param aAvailableBytes Number of unread bytes left in the buffer.
+     * @return Error code indicating the status of the command execution.
+     */
+    TInt ReceiveDataL( TDes8& aData, const TInt aBytesToRead,
+        TInt& aAvailableBytes );
+
+    /**
+     * From MSatBIPDataChannel Returns the ID of this data channel.
+     * @return ID of this channel.
+     */
+    TInt ChannelId() const;
+    
+    /**
+     * From MSatBIPDataChannel Returns the ID of this data channel to
+     * ChannelStatus.
+     * @return ID that can be placed to ChannelStatus
+     */
+    TUint8 ChannelStatusChannelId() const;
+
+    /**
+     * From MSatBIPDataChannel Returns the status of this channel.
+     * @return Status of this data channel
+     */
+    TInt Status() const;
+
+    /**
+     * From MSatBIPDataChannel Closes the connection and empties the buffers.
+     */
+    void CloseChannel();
+    
+    /**
+     * From MSatBIPDataChannel Cancels all activities.
+     */
+    void CancelAll();
+
+    /**
+     * From MSatBIPDataChannel Indicates whether PDP contex is active or not.
+     * @return TBool indicating context activation.
+     */
+    TBool IsContextActive() const;
+
+    /**
+     * From MSatBIPDataChannel Returns connection information
+     * @return Connection information
+     */
+    const MSatBIPDataChannel::TSatBipConnectionInfo& ConnInfo() const;
+
+    /**
+     * From MSatBIPDataChannel Close socket if type is udp.
+     */
+     void StopUdpSocket();
+   
+
+ // From base class CActive
+ 
+    /**
+     * From CActive
+     */
+    void RunL();
+
+    /**
+     * From CActive
+     */
+    void DoCancel();
+
+    /**
+     * From CActive
+     */
+    TInt RunError( TInt aError );
+        
+
+
+private:
+
+    /**
+     * C++ default constructor.
+     * @param aUtils Interface for EventDownload commands
+     * @param aSocketServer Reference to Socket server.
+     * @param aChannelId ID for this data channel
+     * @param aConnection  Reference to RConnection
+     * @param aSubConnection Reference to RSubConnection
+     */
+    CSatBIPGPRSDataChannel( CSatBIPUtils& aUtils,
+        RSocketServ& aSocketServer,
+        TSatChannelIdInfo& aChannelId,
+        RConnection& aConnection,
+        RSubConnection& aSubConnection );
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+    /**
+     * Opens and connects / binds socket
+     * @param aAddrFamily Address family to use.
+     */
+    void OpenSocketL();
+
+    /**
+     * Opens sub-connection and attaches socket into it
+     */
+    void OpenSubConnection();
+
+    /**
+     * Sets QoS parameters to connection
+     */
+    void SetSubConQoSParamsL();
+    
+    /**
+     * Starts to receive data from socket
+     */
+    void StartReceiveL();
+    
+    /**
+     * Defines the IP address.
+     * @param aAddr An 8-bit descriptor containing the IP address
+     * @return IP address in TBuf descriptor, which may be 8- or 16-bit.
+     */
+    TInetAddr DestAddress( const TPtrC8& aAddr );
+        
+    /**
+     * Write QoS Values used for requesting Primary PDP context to RCmManager
+     */
+    void WritePrimaryPDPContextQoSParamsL();
+    
+    /**
+     * Write Default QoS values to RCmManager
+     */
+    void WriteDefaultQoSParamsL(); 
+    
+    /**
+     * Sets up QoS parameters for connection or subconnection
+     */
+    void SetConnQoSParamsL();
+    
+    /**
+     * Get the negotiated QoS parameters from granted event
+     * @param aEvent SubConNotificationEvent
+     * @param aNegQoSRel5 hold the negotiated QoS in Rel5 got from event
+     * @return errCode if it fails to get the parameters from event.
+     */
+    TInt GetSubConQoSR5ParamsFromEvent(
+        CSubConNotificationEvent& aEvent, 
+        TSatQoSParser::TQoSRel5& aNegQoSRel5 );
+        
+private:    // Data
+        
+    /**
+     * Receive Buffer
+     */
+    TBuf8<KSatBIPMinReceiveBufferSize> iRcvBuffer;
+        
+    /**
+     * Status of this channel
+     */
+    TInt iChannelStatus;
+        
+    /**
+     * Socket to send / receive data
+     */
+    RSocket iSocket;
+       
+    /**
+     * Connection information
+     */
+    MSatBIPDataChannel::TSatBipConnectionInfo iConnInfo;
+
+    /**
+     * Destination address
+     */
+    TInetAddr iDestAddr;
+
+    /**
+     * Sourceaddress
+     */
+    TInetAddr iSourceAddr;
+
+    /**
+     * Reference to BIP Utils.
+     * Not own.
+     */
+    CSatBIPUtils& iUtils;
+        
+    /**
+     * Connection stage
+     */
+    TSatBIPConnectionStage iConnStage;
+    
+    /**
+     * Indicates the protocol
+     */
+    TBool iUseTcpProtocol;
+        
+    /**
+     * Reference to a socket server
+     * Not own.
+     */
+    RSocketServ& iSocketServ;
+        
+    /**
+     * Identifier for this channel
+     * Not own.
+     */
+    TSatChannelIdInfo& iChannelId;
+        
+    /**
+     * Connection information
+     *  Not own
+     */
+    RConnection& iConnection;
+    
+    /**
+     * Subconnection, represents a data channel
+     *  Not own
+     */
+    RSubConnection& iSubConnection;
+        
+    /**
+     * SendBuffer
+     * Own.
+     */
+    HBufC8* iSendStore;
+        
+    /**
+     * SendData observer
+     * Own.
+     */
+    MSatSendDataObserver* iSendDataObserver;
+
+    /**
+     * Sender object
+     * Own.
+     */
+    CSatBIPDataSender* iSender;
+
+    /**
+     * Receiver object
+     * Own.
+     */
+    CSatBIPDataReceiver* iReceiver;
+
+    /**
+     * Connection observer
+     * Own.
+     */
+    MSatConnectionObserver* iConnectionObserver;
+        
+    /**
+     * Observer for SubConnection parameters event;
+     * Own.
+     */
+    CSatBIPSubConnEventObserver* iSubConnEventObserver;
+    
+    };
+
+#endif      // CSATBIPGPRSDATACHANNEL_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/CSatBIPUtils.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,427 @@
+/*
+* 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:  CSatBIPUtils is responsible for handling Bearer Independent
+                 Protocol data channels.
+*
+*/
+
+
+#ifndef CSATBIPUTILS_H
+#define CSATBIPUTILS_H
+
+#include    <e32base.h>
+#include    <es_sock.h>
+#include    <etelpckt.h>
+#include    <etelmm.h>
+#include    <etelqos.h>
+#include    "MSatBIPUtils.h"
+#include    "MSatBIPEventNotifier.h"
+#include    "MSatEventObserver.h"
+#include    "MSatBIPDataChannel.h"
+
+class MSatBIPChannelStatusObserver;
+class MSatBIPDataAvailableObserver;
+class TSatChannelIdInfo;
+class MSatUtils;
+class CSatApnHandler;
+class CSatSActiveWrapper;
+class CSatBIPConnectionObserver;
+
+/**
+ *  CSatBIPUtils is responsible for handling data channels used by
+ *
+ *  Bearer Independent Protocol (BIP)
+ *
+ *  @lib SatEngine.lib
+ *  @since S60 3.0
+ */
+class CSatBIPUtils : public CBase,
+                     public MSatBIPUtils,
+                     public MSatBIPEventNotifier,
+                     public MSatEventObserver
+    {
+public:  
+// Constructors and destructor
+    /**
+     * Two-phased constructor.
+     * @param aUtils Reference to common Utils class
+     */
+    static CSatBIPUtils* NewL( MSatUtils& aUtils );
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CSatBIPUtils();
+    
+// from base class MSatEventObserver
+    /**
+     * From MSatEventObserver
+     * Handles event
+     *
+     * @since S60 3.0
+     * @param aEvent Event that has occured
+     */       
+    void Event( TInt aEvent );
+    
+// from base class MSatBIPUtils
+    /**
+     * From MSatBIPUtils 
+     * Creates new data channel and returns reference to it
+     *
+     * @since S60 3.0
+     * @param TSatBIPError code indicating the execution status.
+     * @return Pointer to created data channel
+     */
+    MSatBIPDataChannel* CreateChannelL(
+        const TSatBearerType aBearerType,
+        TInt& aErrCode );
+    
+    /**
+     * From MSatBIPUtils 
+     * Request to close specified data channel.
+     *
+     * @since S60 3.0
+     * @param aChannelId Identifies the channel to be closed.
+     * @return TSatBIPError code indicating the execution status.
+     */
+    TInt CloseChannel( const TInt aChannelId );
+
+    /**
+     * From MSatBIPUtils 
+     * Request to open new data channel
+     *
+     * @since S60 3.0
+     * @param aChannelId Identifies the channel.
+     * @param aErrCode TSatBIPError code indicating the execution status.
+     * @return Pointer to requested data channel
+     */
+    MSatBIPDataChannel* DataChannel(
+        const TInt aChannelId,
+        TInt& aErrCode );
+    
+    /**
+     * From MSatBIPUtils 
+     * Generates channel status object from given 
+     * parameters to be used in terminal responses.
+     *
+     * @since S60 3.0
+     * @param aChannelId Data channel identifier.
+     * @param aStatus Data channel's status.
+     * @return channel status object that can be put into terminal responses.
+     */
+    RSat::TChannelStatus GenerateChannelStatusL(
+        const TInt aChannelId,
+        TInt aStatus );
+
+    /**
+     * From MSatBIPUtils 
+     * Reference to APN handler
+     *
+     * @since S60 3.0
+     * @return Interface reference to CSatApnHandler
+     */
+    MSatApnHandler& ApnHandler();
+    
+    /**
+     * From MSatBIPUtils 
+     * Status of the PDP Context
+     *
+     * @since S60 3.0
+     * @return ETrue, if there is active PDP Context
+     */
+    TBool IsContextActive();
+    
+    /**
+     * From MSatBIPUtils 
+     * Request to close specified data channel.
+     *
+     * @since S60 3.0
+     * @return Array containing all available data channels.
+     */
+    CArrayPtrFlat<MSatBIPDataChannel>* DataChannels();
+    
+// from base class MSatBIPUtils
+                
+    /**
+     * From MSatBIPEventNotifier
+     * Notification request for DataAvailable event.
+     *
+     * @since S60 3.0
+     * @param aObserver An observer of the event.
+     */
+    void NotifyDataAvailable(
+        MSatBIPDataAvailableObserver* aObserver );
+
+    /**
+     * From MSatBIPEventNotifier
+     * Notification request for ChannelStatus event.
+     *
+     * @since S60 3.0
+     * @param aObserver An observer of the event.
+     */
+    void NotifyChannelStatus(
+        MSatBIPChannelStatusObserver* aObserver );
+    
+    /**
+     * From MSatBIPEventNotifier 
+     * Cancels DataAvailable event notification request.
+     *
+     * @since S60 3.0
+     */
+    void CancelDataAvailable();
+    
+    /**
+     * From MSatBIPEventNotifier 
+     * Cancels ChannelStatus event notification request.
+     *
+     * @since S60 3.0
+     */
+    void CancelChannelStatus();
+
+// New Member Function
+    /**
+     * DataAvailable event from data channel.
+     *
+     * @since S60 S60 3.0
+     * @param aChannelId ID of the channel that called this function.
+     * @param aLength Number of bytes available.
+     */
+    void DataAvailable( const TInt aChannelId, const TInt aLength );
+    
+    /**
+     * ChannelStatus event from data channel.
+     *
+     * @since S60 S60 3.0
+     * @param aChannelId ID of the channel that called this function.
+     * @param aStatus Status that caused this event.
+     */
+    void ChannelStatus(
+        const TInt aChannelId,
+        const TInt aStatus );
+
+    
+    /**
+     * Closes all active data channels. This function is called
+     * when SAP is enabled or SAT Server closes
+     * @since S60 S60 3.0
+     */
+    void CloseAllChannels();
+
+    /**
+     * Proposes QoS parameters for the last created primary or secondary context
+     * and returns negotioated QoS parameters as a result.
+     *
+     * @since S60 S60 3.0
+     * @param aQoSParams Requested QoS parameters to propose for the context
+     * @return Negotioated QoS parameters, which may differ from requested
+     *         parameters.
+     */
+    RPacketQoS::TQoSGPRSNegotiated ProposeQoSParametersL(
+        const RPacketQoS::TQoSGPRSRequested& aQoSParams );
+       
+    /**
+     * Gives reference to RPacketService
+     *
+     * @since S60 S60 3.0
+     */
+    RPacketService& PacketService();
+    
+    
+    /**
+     * Current status of the GPRS service
+     *
+     * @since S60 S60 3.0
+     * @return Current status of the GPRS service
+     */     
+    RPacketService::TStatus ConnectionStatus() const;
+        
+    /**
+     * Stop all udp connection.
+     *
+     * @since S60 S60 3.2
+     */  
+    void StopUdpLink();
+        
+    /**
+     * Set the state for subconnection
+     *
+     * @since S60 S60 3.2
+     * @param aSet State to be set
+     */  
+    void SetConnectionActivated( TBool aSet );
+        
+    /**
+     * Get the state of connection
+     *
+     * @since S60 S60 3.2
+     * @param aSet State to be set
+     */  
+    TBool IsConnectionActivated();
+        
+    /**
+     * Set the state for subconnection
+     *
+     * @since S60 S60 3.2
+     * @param aSet State to be set
+     */  
+    void SetSubConnectionActivated( TBool aSet );
+        
+    /**
+     * Get the state of subconnection
+     *
+     * @since S60 S60 3.2
+     * @param aSet State to be set
+     */  
+    TBool IsSubConnectionActivated();  
+        
+private:
+
+    /**
+     * C++ default constructor.
+     * @param aUtils Reference to common utils class
+     */
+    CSatBIPUtils( MSatUtils& aUtils );
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+    /**
+     * Defines next available channel ID
+     * @return Pointer to next available channel id
+     */
+    TSatChannelIdInfo* AvailableChannelID();
+    
+    /**
+     * Reference to RPacketContex handle
+     * @return Error code indicating the success of function completion
+     */
+    TInt GprsService();
+    
+    /**
+     * Number of contexts currently in Gprs service
+     *
+     * @since S60 S60 3.0
+     * @return Number of active PDP contexts
+     */  
+    TInt ContextCount();
+
+private: // Data
+
+    /**
+     * Array containing all data channels
+     * Own
+     */
+    CArrayPtrFlat<MSatBIPDataChannel>* iDataChannels;
+
+    /**
+     * DataAvailable event observer
+     * Own
+     */
+    MSatBIPDataAvailableObserver* iDataAvailableObserver;
+
+    /**
+     * ChannelStatus event observer
+     * Own
+     */
+    MSatBIPChannelStatusObserver* iChannelStatusObserver;
+
+    /**
+     * Main session to Socket Server
+     * 
+     */
+    RSocketServ iSocketServer;
+
+    /**
+     * Indicates is there channel active or not
+     * 
+     */
+    TBool iDataChannelActivated;
+
+    /**
+     * Array containing datachannel IDs
+     * Own
+     */
+    CArrayPtrFlat<TSatChannelIdInfo>* iChannelIds;
+
+    /**
+     * Temporary Channel ID pointer, used for ~CSatBIPUtils to 
+     * cleanup when AppendL leave. Look into ConstructL and
+     * ~CSatBIPUtils to see how it be used.
+     * Not Own
+     */
+    TSatChannelIdInfo* iChannelId;
+   
+   /**
+     * Utils class
+     * Not Own
+     */
+    MSatUtils& iUtils;
+
+    /**
+     * Blocker for synchronous requests
+     * Own
+     */
+    CSatSActiveWrapper* iWrapper;
+
+    /**
+     * Classes for GPRS context activation
+     * 
+     */
+    RPacketService iPacketService;
+
+    /**
+     * Indicates is the Session to PacketService active
+     * 
+     */
+    TBool iPacketServiceActive;
+
+    /**
+     * Pointer to APN handler
+     * Own
+     */
+    MSatApnHandler* iApnHandler;
+
+    /**
+     * Pointer to connection status observer
+     * Own
+     */
+    CSatBIPConnectionObserver* iConnObserver;
+        
+    /**
+     * Represent the primary PDP context
+     * Own
+     */
+    RConnection iConnection;
+        
+    /**
+     * Represent the secondary PDP context
+     * Own
+     */
+    RSubConnection iSubConnection;
+        
+    /**
+     * iSubConnectionActivated
+     */
+    TBool iSubConnectionActivated;
+        
+    /**
+     * iConnectionActivated
+     */
+    TBool iConnectionActivated;
+    };
+
+#endif      // CSATBIPUTILS_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/CSatClientServiceReq.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,159 @@
+/*
+* 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:  Handles client requests.
+*
+*/
+
+
+
+#ifndef CSATCLIENTSERVICEREQ_H
+#define CSATCLIENTSERVICEREQ_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "MSatCommand.h"
+#include "SatSOpcodes.h"
+
+// FORWARD DECLARATION
+class MSatUtils;
+
+// CLASS DECLARATION
+
+/**
+*  Handles the buffering of command and client request.
+*  Buffering is needed because client can make request without command and
+*  viceversa.
+*
+*  @lib SatEngine
+*  @since Series 60 3.0
+*/
+class CSatClientServiceReq : public CBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aRequest Handled service request
+        * @param aResponse Handled response request.
+        * @param aCommand Command hander for request
+        * @param aUtils Reference to SAT Utilities
+        */
+        static CSatClientServiceReq* NewL(
+            TSatServerRequest aRequest,
+            TSatServerRequest aResponse,
+            MSatCommand* aCommand,
+            MSatUtils& aUtils );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSatClientServiceReq();
+
+    public: // New functions
+
+        /**
+        * Handles the command from SIM.
+        * @param aCmdData Data to be sent to client.
+        * @param aCmdRsp Clients response is written to this descriptor.
+        * @param aRequest Request which the data is sent.
+        * @return ETrue if command was recognised to be handled in this class ie aRequest is the same that
+        * set in constructor.
+        */
+        virtual TBool HandleCommand(
+            TDesC8* aCmdData,
+            TDes8* aCmdRsp,
+            TSatServerRequest aRequest );
+
+        /**
+        * Handles the request from client.
+        * @param aRequest Service request from client.
+        * @return ETrue if request was recognised to be handled in this class.
+        */
+        virtual TBool HandleRequest( const RMessage2& aRequest );
+
+        /**
+        * Checks is this service request handling this request
+        * @param aRequest Checks own request to this request
+        * @return TBool indicating is param aRequest this service
+        * requests request
+        */
+        virtual TBool IsMyRequest( const TSatServerRequest aRequest );
+
+        /**
+        * Sets command handler for this service request handler
+        * @param aCommand Command handler for this service request
+        */
+        virtual void SetCommandHandler( MSatCommand* aCommand );
+
+        /**
+        * Resets containing data.
+        */
+        virtual void Reset();
+
+    protected:  // New functions
+
+        /**
+        * Writes the data to client address space and
+        * completes the iRequest.
+        */
+        virtual void SendDataToClient();
+
+    protected:
+
+        /**
+        * C++ default constructor.
+        * @param aRequest Handled service request
+        * @param aResponse Handled response request.
+        * @param aCommand Command hander for request
+        * @param aUtils Reference to SAT Utilities
+        */
+        CSatClientServiceReq( 
+            TSatServerRequest aRequest,
+            TSatServerRequest aResponse,
+            MSatCommand* aCommand,
+            MSatUtils& aUtils );
+
+    private:  // Data
+
+        // Identifies the client request, which is handled in HandleRequest
+        const TSatServerRequest iHandledRequest;
+
+        // Identifies the client response, which is handled in HandleRequest
+        const TSatServerRequest iHandledResponse;
+
+        // Command from SIM
+        MSatCommand* iResponseObserver;
+
+        // Indicates if the command from SIM is not yet sent to client
+        TBool iCmdPending;
+
+        // Service request from client
+        RMessage2 iRequest;
+
+        // Indicates that request is waiting command from SIM.
+        TBool iRequestPending;
+
+        // Data from SIM.
+        TDesC8* iCmdData;
+
+        // Response from client..
+        TDes8* iCmdRsp;
+
+        // Utilities class
+        MSatUtils& iUtils;
+    };
+
+#endif      // CSATCLIENTSERVICEREQ_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/CSatCommandContainer.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,520 @@
+/*
+* 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:  Contains SAT commands
+*
+*/
+
+
+
+#ifndef C_CSATCOMMANDCONTAINER_H
+#define C_CSATCOMMANDCONTAINER_H
+
+
+#include <e32base.h>
+#include "MSatUtils.h"
+#include "TSatEventMediator.h"
+#include "MSatEventObserver.h"
+#include "MSatSystemStateObserver.h"
+#include "CSatCommandHandler.h"
+
+
+class TUSatAPI;
+class MSatSSessions;
+class MSatShellController;
+class MSatSystemState;
+class MSatSUiClientHandler;
+class CSatEventMonitorContainer;
+class MSatSSimSubscriberId;
+class CSatSAPChangeObserver;
+class CSatBIPUtils;
+class CSatMediatorEventProvider;
+class CSatProfileChangeObserver;
+class CSatMultiModeApi;
+class MSatSystemStateChangeNotifier;
+
+const TInt KSatMaxBipApnName = 50;
+
+
+/**
+*  Contains SAT commands and offers accessor API for
+*  command handlers.
+*
+*  @lib SatEngine.lib
+*  @since Series 60 3.0
+*/
+class CSatCommandContainer : public CBase,
+                             public MSatUtils,
+                             public MSatEventObserver,
+                             public MSatSystemStateObserver
+    {
+public:  // Constructors and destructor
+
+   /**
+    * Two-phased constructor.
+    * @param aSessions Accessor for sessions
+    * @param aEventMediator Event handler class
+    * @param aSatUiHandler UI Client handler class
+    */
+    static CSatCommandContainer* NewL(
+        MSatSSessions& aSessions,
+        TSatEventMediator& aEventMediator,
+        MSatSUiClientHandler& aSatUiHandler );
+
+    virtual ~CSatCommandContainer();
+
+    /**
+     * Starts command handlers.
+     *
+     * @since S60 v3.0
+     */
+    void StartCommandHandlersL();
+
+    /**
+     * Stops command handlers.
+     *
+     * @since S60 v3.0
+     */
+    void StopCommandHandlers();
+
+// from MSatEventObserver
+
+    /**
+     * From MSatEventObserver.
+     * Event notification.
+     *
+     * @since S60 v3.0
+     * @param  aEvent An event that has been notified by TSatEventMediator
+     */
+    void Event( TInt aEvent );
+
+    /**
+     * From MSatEventObserver.
+     * Sends UI Event Notification if UI session has found
+     *
+     * @since S60 v3.1
+     * @param aEvenId, identifies the event
+     * @param aEventStatus, status of the event
+     * @param aEventError, possible error value
+     */
+    void NotifyUiEvent(
+            TInt aEventId,
+            TInt aEventStatus,
+            TInt aEventError );
+
+// from MSatUtils
+    /**
+     * From MSatUtils.
+     * Gives USAT API wrapper.
+     *
+     * @since S60 v3.0
+     * @return USAT API wrapper reference
+     */
+    MSatApi& USatAPI();
+
+    /**
+     * From MSatUtils.
+     * Gives reference to system state.
+     *
+     * @since S60 v3.0
+     * @return SAT System state API reference
+     */
+    MSatSystemState& SystemState();
+
+    /**
+     * From MSatUtils.
+     * Gives pointer to MSatSUiClientHandler
+     *
+     * @since S60 v3.0
+     * @return SAT UI handler API reference
+     */
+    MSatSUiClientHandler& SatUiHandler();
+
+    /**
+     * From MSatUtils.
+     * Registers observer for event. Same observer will not
+     * be added more than once for one event.
+     *
+     * @since S60 v3.0
+     * @param aObserver Pointer of observer instance. Panic will occur if
+     * aObserver is NULL.
+     * @param aEvent Event, which will cause the notification of observer.
+     */
+    void RegisterL(
+            MSatEventObserver* aObserver,
+            TSatEvent aEvent );
+
+    /**
+     * From MSatUtils.
+     * Notifies all the listeners who are listening for aEvent.
+     *
+     * @since S60 v3.0
+     * @param aEvent Event to be notified.
+     */
+    void NotifyEvent( TSatEvent aEvent );
+
+    /**
+     * From MSatUtils.
+     * Unregisteres the event notification.
+     *
+     * @since S60 v3.0
+     * @param aObserver An event observer that is unregistering event
+     * @param aEvent An event that is unregistered from aObserver parameter
+     */
+    void UnregisterEvent(
+            MSatEventObserver* aObserver,
+            TSatEvent aEvent );
+
+    /**
+     * From MSatUtils.
+     * Removes observer from event observers
+     *
+     * @since S60 v3.0
+     * @param aObserver Observer to removed
+     */
+    void UnregisterEventObserver( MSatEventObserver* aObserver );
+
+    /**
+     * From MSatUtils.
+     * Number of executing commands.
+     *
+     * @since S60 v3.0
+     * @return Number of currently executing command handlers
+     */
+    TInt NumberOfExecutingCommandHandlers();
+
+    /**
+     * From MSatUtils.
+     * Gets the sim application name.
+     *
+     * @since S60 v3.0
+     * @return SAT Application name
+     */
+    const TDesC& SatAppName() const;
+
+    /**
+     * From MSatUtils.
+     * Gets the name for the APN.
+     *
+     * @since S60 v3.0
+     * @return BIP Apn name
+     */
+    const TDesC& BipApnName() const;
+    
+    /**
+     * From MSatUtils.
+     * Restores default SIM Application name.
+     *
+     * @since S60 v3.1
+     */
+    void RestoreSatAppNameL();
+
+    /**
+     * From MSatUtils.
+     * Sets the sim application name.
+     *
+     * @since S60 v3.0
+     * @param aName New name of Sat application
+     */
+    void SetSatAppNameL( const TDesC& aName );
+
+    /**
+     * From MSatUtils
+     * Gets an array of refresh subsessions
+     *
+     * @since S60 v3.0
+     * @return Pointer array containing refresh subsessions
+     */
+    const RPointerArray<MSatRefreshSubSession>& RefreshSubSessions();
+
+    /**
+     * From MSatUtils.
+     * Registers new service request handler
+     *
+     * @since S60 v3.0
+     * @param aRequest A Request this service request listens
+     * @param aResponse A Response for this service request
+     * @param aCommand A Command handler for request
+     */
+    void RegisterServiceRequestL(
+            TSatServerRequest aRequest,
+            TSatServerRequest aResponse,
+            MSatCommand* aCommand );
+
+    /**
+     * From MSatUtils Gets all registered service requests
+     *
+     * @since S60 v3.0
+     * @return Pointer array of registered Client Service requests
+     */
+    CArrayPtrFlat<CSatClientServiceReq>* ServiceRequests();
+
+    /**
+     * From MSatUtils.
+     * Gives pointer to event monitor container
+     *
+     * @since S60 v3.0
+     * @return Pointer to MSatEventMonitorContainer API
+     */
+    MSatEventMonitorContainer* EventMonitors();
+
+    /**
+     * From MSatUtils.
+     * Gives reference to subscriber id.
+     *
+     * @since S60 v3.0
+     * @return SIM subscriber id API reference.
+     */
+    MSatSSimSubscriberId& SimSubscriberId();
+
+    /**
+     * From MSatUtils.
+     * Gives reference to BIP Utils interface.
+     *
+     * @since S60 v3.0
+     * @return Reference to BIP Utils interface.
+     */
+    MSatBIPUtils& BipUtils();
+
+    /**
+     * From MSatUtils.
+     * Gives reference to BIP Event notifier interface.
+     *
+     * @since S60 v3.0
+     * @return Reference to BIP Event notifier interface.
+     */
+    MSatBIPEventNotifier& BipEventNotifier();
+
+    /**
+     * Gives reference to MSatMultiModeApi
+     *
+     * @since S60 v5.0
+     * @return Reference to MSatMultiModeApi
+     */
+    MSatMultiModeApi& MultiModeApi() ;
+
+    /**
+     * From MSatUtils.
+     * Gives reference to active RMmCustomApi session
+     *
+     * @since S60 v3.1
+     * @return Reference to active RMmCustomApi server session
+     */
+    RMmCustomAPI* CustomApi();
+
+    /**
+     * From MSatUtils.
+     * Raises SAT Mediator event
+     *
+     * @since S60 v3.1
+     * @param aData event data to Mediator Event consumer.
+     * @return KErrNone or error code.
+     */
+    TInt RaiseSatEvent( const TDesC8& aData );
+
+    /**
+     * From MSatUtils.
+     * Checks if Cover UI is supported by SAT
+     *
+     * @since S60 v3.1
+     * @return ETrue if Cover UI is supported.
+     */
+    TBool CoverUiSupported();
+
+    /**
+     * From MSatUtils.
+     * Gives pointer to MSatAsyncToSync interface.
+     *
+     * @since S60 v5.0.1
+     * @return a MSatAsyncToSync Pointer to CreateAsyncToSyncHelper object.
+     */
+    MSatAsyncToSync* CreateAsyncToSyncHelper();
+
+// from MSatSystemStateObserver
+
+    /**
+     * Notifies that system state changed.
+     * @param aValue The new value that has changed.
+     *
+     * @since S60 v3.1
+     */
+    void StateChanged( const TInt aValue );
+
+private:
+
+    /**
+     * Private Constructor
+     *
+     * @since S60 v3.0
+     * @param aSessions Accessor for sessions
+     * @param aEventMediator Event handler class
+     * @param aSatUiHandler UI Client handler class
+     */
+    CSatCommandContainer( MSatSSessions& aSessions,
+            TSatEventMediator& aEventMediator,
+            MSatSUiClientHandler& aSatUiHandler );
+
+    void ConstructL();
+
+    /**
+     * Reads sat application name from the resource.
+     *
+     * @since S60 v3.0
+     * @param aResourceId Selects name of the item to be read.
+     */
+    void CreateSatAppNameL( const TInt aResourceId );
+
+    /**
+     * Gives pointer to BIP Utils class.
+     *
+     * @since S60 v3.0
+     * @return Pointer to BIP Utils class.
+     */
+    CSatBIPUtils* CreateAndGetBIPUtils();
+
+    /**
+     * Gives pointer to SatMediatorEventProvider class.
+     *
+     * @since S60 v3.1
+     * @return Pointer to SatMediatorEventProvider class.
+     */
+    CSatMediatorEventProvider* CreateAndGetSatMediatorEventProvider();
+
+    /**
+     * Starts command handlers.
+     *
+     * @since S60 v3.1
+     */
+    void StartImportantCommandHandlersL();
+
+    /**
+     * Checks current startup state and starts rest of command handlers.
+     * @param aValue Current startup state to check.
+     *
+     * @since S60 v3.1
+     */    
+    void CheckStartupState( const TInt aValue );
+
+private: // Data
+
+    /**
+     * Default name of the SAT Application, used when creating new APN
+     */
+    TBuf<KSatMaxBipApnName>  iSatBipName;
+
+    /**
+     * Indicates special SIM to be currently used,
+     */
+    TBool iIsCmccSim;
+
+    
+    /**
+     * Access the encapsuled ETel MM api by CSatMultiModeApi
+     * Own
+     */
+    CSatMultiModeApi* iMultiModeApi;
+
+    /**
+     * Accessor for sessions.
+     */
+    MSatSSessions& iSessions;
+
+    /**
+     * Event mediator.
+     */
+    TSatEventMediator& iEventMediator;
+
+    /**
+     * UI Client handler API reference.
+     */
+    MSatSUiClientHandler& iSatUiHandler;
+
+    /**
+     * USat api.
+     * Own.
+     */
+    TUSatAPI* iUSatAPI;
+
+    /**
+     * Command handlers.
+     * Own.
+     */
+    CArrayPtrFlat<CSatCommandHandler>* iCmdHandlers;
+
+    /**
+     * Registered Client request handlers.
+     * Own.
+     */
+    CArrayPtrFlat<CSatClientServiceReq>* iServiceReqs;
+
+    /**
+     * Name of the Sat application.
+     * Own.
+     */
+    HBufC* iSatAppName;
+
+    /**
+     * System state interface.
+     * Own.
+     */
+    MSatSystemState* iSystemState;
+
+    /**
+     * Event monitor container interface
+     * Own.
+     */
+    CSatEventMonitorContainer* iEventMonitors;
+
+    /**
+     * SAP change observer / notifier
+     * Own.
+     */
+    CSatSAPChangeObserver* iSapObserver;
+
+    /**
+     * Subscriber id interface.
+     * Own.
+     */
+    MSatSSimSubscriberId* iSimSubscriberId;
+
+    /**
+     * BIP Utils class
+     * Own.
+     */
+    CSatBIPUtils* iBipUtils;
+
+    /**
+     * pointer to SAT Mediator event provider
+     * Own.
+     */
+    CSatMediatorEventProvider* iSatMediatorEvent;
+
+    /**
+     * Pointer to Profile state observer
+     * Own.
+     */
+    CSatProfileChangeObserver* iProfileObserver;
+
+    /**
+     * Boolean indicating is Startup ongoing
+     */
+    TBool iStartupPhase;
+
+    /**
+     * Pointer to startup change observer
+     */
+    MSatSystemStateChangeNotifier* iStartupChangeObserver;
+
+    };
+
+#endif // C_CSATCOMMANDCONTAINER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/CSatEventMonitorContainer.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,227 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Container of event monitors
+*
+*/
+
+
+
+#ifndef CSATEVENTMONITORCONTAINER_H
+#define CSATEVENTMONITORCONTAINER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <etelsat.h>
+#include "MSatEventMonitorUtils.h"
+#include "MSatEventMonitorContainer.h"
+#include "MSatEventObserver.h"
+
+
+// FORWARD DECLARATIONS
+class MSatEventMonitor;
+class TUSatAPI;
+class MSatUtils;
+class MSatBIPEventNotifier;
+
+/**
+*  Base class for SAT commands.
+*
+*  @lib SatServer
+*  @since Series 60 3.0
+*/
+class CSatEventMonitorContainer : public MSatEventMonitorContainer,
+                                  public MSatEventMonitorUtils,
+                                  public MSatEventObserver,
+                                  public CActive
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aUsatAPI Interface for EventDownload commands
+        * @param aSatUtils Interface for SAT Utils class.
+        */
+        static CSatEventMonitorContainer* NewL(
+            TUSatAPI& aUsatAPI,
+            MSatUtils& aSatUtils );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSatEventMonitorContainer();
+
+    public: // Functions from parent class
+
+        /**
+        * From MSatEventObserver
+        */
+        void Event( TInt aEvent );
+
+        /**
+        * From MSatEventMonitorContainer Updates monitors state.
+        * @param aEvents Events that should be monitored.
+        * @return KErrNone if all goes OK
+        */
+        TInt SetUpEventMonitors( TUint aEvents );
+
+        /**
+        * From MSatEventMonitorContainer Cancels all monitors
+        * @return KErrNone if all monitros were cancelled
+        */
+        TInt CancelAllMonitors();
+
+        /**
+        * From MSatEventMonitorContainer Solves language code.
+        * @param aLanguageId Resolved language ID
+        */
+        void LanguageSettingL( TInt& aLanguageId );
+
+        /**
+        * From MSatEventMonitorUtils Sends notify to SIM about some event
+        * using EventDownload command.
+        * @param aSingleEvent Single event reported to SIM.
+        * @param aFirstArg First argument interpreted according to type of event
+        * @param aSecArg Second argument interpreted according to type of event
+        */
+        void EventDownload( RSat::TEventList aSingleEvent,
+                            TInt aFirstArg,
+                            TInt aSecArg );
+
+        /**
+        * From MSatEventMonitorUtils Returns reference to
+        * BIP Event notifier class.
+        * @return Interface for BIP Utils class.
+        */
+        MSatBIPEventNotifier& BipNotifier();
+
+        /**
+        * From MSatEventMonitorContainer Called when SIM is removed.
+        * This causes all monitors to be cancelled.
+        */
+        void SimRemoved();
+
+        /**
+        * From MSatEventMonitorContainer Gets the ISO639 language code.
+        * @param aId Language ID
+        * @param aText Language code can be read from this after function call.
+        */
+        void GetLanguageString( const TInt aId, TDes& aText );
+
+        /**
+        * From CActive Checks that EventDownload were succesful
+        */
+        void RunL();
+
+        /**
+        * From CActive Cancels EventDownload
+        */
+        void DoCancel();
+        
+        /**
+        * From MSatEventMonitorUtils 
+        * Writes time between language selection and reboot.
+        * @param aTime Time before reboot.
+        * @return KErrNone if language selection time is set.
+        */
+        TInt WriteLanguageSelectionTime( TInt aTime );
+
+    private:
+
+        /**
+        * C++ default constructor.
+        * @param aUsatAPI Interface for EventDownload commands
+        * @param aSatUtils Interface for SAT Utils class.
+        */
+        CSatEventMonitorContainer( TUSatAPI& aUsatAPI, MSatUtils& aSatUtils );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private:
+
+        /**
+        * Handles Language Selection event and sends event download
+        * @param aLanguageId ID read from the P&S. Comes from monitor.
+        */
+        void LanguageSelectionEvent( TInt aLanguageId );
+
+        /**
+        * Handles the browser termination event and sends event download.
+        * @param aCause The cause of the browser termination
+        */
+        void BrowserTerminationEvent( TInt aCause );
+
+        /**
+        * Handles Data avaliable event and sends event download
+        * @param aChannelId Data channel identifier. Comes from monitor.
+        */
+        void DataAvailableEvent( const TInt aChannelId, const TInt aLength );
+
+        /**
+        * Handles Channel status event and sends event download
+        * @param aChannelId Data channel identifier. Comes from monitor.
+        * @param aStatus Status of the data channel.
+        */
+        void ChannelStatusEvent( const TInt aChannelId, const TInt aStatus );
+
+        /**
+        * Checks if aEvents contains only events that
+        * are supported.
+        * @param aEvents Events from SIM.
+        * @return ETrue if aEvents are supported.
+        */
+        TBool EventsSupported( TUint aEvents ) const;
+
+        /**
+        * Removes single event from event list
+        * @param aSingleEvent Event to remove
+        */
+        void RemoveSingleEvent( RSat::TEventList aSingleEvent );
+
+    private:    // Data
+
+        // Ponter array containing event monitors
+        CArrayPtrFlat<MSatEventMonitor>* iEventMonitors;
+
+        // Interface to EventDownload command sending
+        TUSatAPI& iSat;
+
+        // Indecates is there event pending
+        TBool iEventPending;
+
+        // Pending event
+        RSat::TEventList iPendingEvent;
+
+        // Pending first argument
+        TInt iPendingFirstArg;
+
+        // Pending second argument
+        TInt iPendingSecondArg;
+
+        // Utils class for BIP event monitors
+        MSatUtils& iSatUtils;
+
+        // Indicates whether there is BIP command executing or not
+        TBool iBipExecuting;
+
+        // Removable event after event download
+        TInt iRemovableSingleEvent;
+
+    };
+
+#endif      // CSATEVENTMONITORCONTAINER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/CSatIconHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,141 @@
+/*
+* Copyright (c) 2004-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Interface for accesing icon data in SIM.
+*
+*/
+
+
+#ifndef CSATICONHANDLER_H
+#define CSATICONHANDLER_H
+
+#include <e32std.h>
+#include <e32base.h>
+#include "MSatSIconAPI.h"
+
+class MSatIconObserver;
+
+/**
+*  Interface for accesing icon data in SIM.
+*
+*  @lib SatEngine.lib
+*  @since 3.0
+*/
+class CSatIconHandler : public CActive,
+                        public MSatSIconAPI
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        CSatIconHandler( MSatApi& aSatApi );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSatIconHandler();
+
+    public: // Functions from base classes
+
+        /**
+        * From MSatIconAPI. Gets the icon info from SIM.
+        * @param aRecordNumber Specifies the EF_IMG in SIM.
+        * @param aIconEf Contains the icon informations from SIM in returning
+        * of the method.
+        * @param aObserver Observer for icon info get completion.
+        */
+        void GetIconInfo(
+            TUint8 aRecordNumber,
+            RSat::TIcon& aIconEf,
+            MSatIconObserver& aObserver );
+
+        /**
+        * From MSatIconAPI. Gets the icon image.
+        * @param aInstanceInfo Informatio of the icon, which data is
+        * fetched from SIM.
+        * @param aInstance Contains the icon data from SIM in returning of the
+        * method.
+        * @param aObserver Observer for icon image get completion.
+        */
+        void GetIconInstance(
+            const RSat::TInstanceInfoV3& aInstanceInfo,
+            TDes8& aInstance,
+            MSatIconObserver& aObserver );
+
+        /**
+        * From MSatIconAPI. Gets color lookup table of the icon.
+        * @param aInstanceNumber Image instance number.
+        * @param aOffset Offset of the clut.
+        * @param aClut Contains the Clut of the icon in returning of the
+        * method.
+        * @param aObserver Observer for clut get completion.
+        */
+        void GetClut(
+            TUint aInstanceNumber,
+            TUint aOffset,
+            TDes8& aClut,
+            MSatIconObserver& aObserver );
+        /*
+         * Set a mode to determine whether to fetch icons from NAA syncronously
+         * or asynchronously.
+         *
+         * @param aMode Synchronous or asynchronous mode. Icons would be
+         * fetched from NAA in sychronous mode if SAT UI was closed by
+         * using the End Key. Otherwise, in asynchronous mode.
+         * @return None
+         */
+        void SetIconFetchingMode( TBool aMode );
+
+    protected:  // Functions from base classes
+
+        /**
+        * From CActive
+        */
+        void DoCancel();
+
+        /**
+        * From CActive
+        */
+        void RunL();
+
+        /**
+        * From CActive
+        * @param aError Received error code
+        * @return Result error code
+        */
+        TInt RunError( TInt aError );
+
+    private:    // Data
+
+        // Sat api
+        MSatApi& iSatApi;
+
+        // Indicates GetIconInfo is active.
+        TBool iGetIconInfoActive;
+
+        // Indicates GetIconInstance is active.
+        TBool iGetIconInstanceActive;
+
+        // Indicates GetClut is active.
+        TBool iGetClutActive;
+
+        // Observer for icon actions.
+        MSatIconObserver* iObserver;
+
+        // Indicates whether to fetch icons from NAA syncronously or 
+        // asynchronously.
+        TBool iSyncIconFetching;
+    };
+
+#endif      // CSATICONHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/CSatSAPChangeObserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,89 @@
+/*
+* 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:  Observes SIM Access Profile status changes.
+*
+*/
+
+
+
+#ifndef CSATSAPCHANGEOBSERVER_H
+#define CSATSAPCHANGEOBSERVER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "MSatSystemStateObserver.h"
+
+// FORWARD DECLARATION
+class CSatCommandContainer;
+class MSatSystemStateChangeNotifier;
+
+// CLASS DECLARATION
+
+/**
+*  Observes SIM Access Profile status change and informs CSatCommandContriner
+*  of a possible change.
+*
+*  @lib SatEngine
+*  @since Series 60 3.0
+*/
+class CSatSAPChangeObserver : public CBase,
+                              public MSatSystemStateObserver
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aContainer Container of command handlers.
+        */
+        static CSatSAPChangeObserver* NewL( CSatCommandContainer& aContainer );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSatSAPChangeObserver();
+
+    public: // From base classes
+
+        /**
+        * From MSatSystemStateObserver Notifies that system state changed.
+        * @param aValue The new value that has changed.
+        */
+        void StateChanged( const TInt aValue );
+
+    private:
+
+        /**
+        * C++ default constructor.
+        * @param aContainer Container of command handlers.
+        */
+        CSatSAPChangeObserver( CSatCommandContainer& aContainer );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private:  // Data
+
+        // Command container.
+        CSatCommandContainer& iContainer;
+
+        // System state notifier.
+        MSatSystemStateChangeNotifier* iStateNotifier;
+
+    };
+
+#endif      // CSATSAPCHANGEOBSERVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/CSatSBasicIconConverter.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2004-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:  Converts basic icon to CFbsBitmap.
+*
+*/
+
+
+
+#ifndef CSATSBASICICONCONVERTER_H
+#define CSATSBASICICONCONVERTER_H
+
+//  INCLUDES
+#include "CSatSIconConverter.h"
+
+// CLASS DECLARATION
+
+/**
+*  Converts the basic icon to CFbsBitmap
+*
+*  @lib SatEngine.lib
+*  @since 2.6
+*/
+class CSatSBasicIconConverter : public CSatSIconConverter
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        CSatSBasicIconConverter();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSatSBasicIconConverter() {};
+
+    public: // Functions from base classes
+
+        /**
+        * From CSatSIconConverter
+        * @param aData Icon basic data.
+        * @param aClut Color lookup table. Not used in basic icon
+        * conversion.
+        * @return Bitmap.
+        */
+        CFbsBitmap* ConvertL(
+            const TDesC8& aData,
+            const TDesC8& aClut ) const;
+
+    private: // New functions
+
+        /**
+        * Checks that the icon data has valid length.
+        * @param aData Image data.
+        */
+        void CheckDataValidityL(
+            const TDesC8& aData ) const;
+
+    };
+
+#endif      // CSATSBASICICONCONVERTER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/CSatSColorIconConverter.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,82 @@
+/*
+* 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:  Converts color icon to CFbsBitmap
+*
+*/
+
+
+
+#ifndef CSATSCOLORICONCONVERTER_H
+#define CSATSCOLORICONCONVERTER_H
+
+//  INCLUDES
+#include "CSatSIconConverter.h"
+
+// CLASS DECLARATION
+
+/**
+*  Converts color icon to CFbsBitmap
+*
+*  @lib SatEngine.lib
+*  @since 2.6
+*/
+class CSatSColorIconConverter : public CSatSIconConverter
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        CSatSColorIconConverter();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSatSColorIconConverter() {};
+
+    private: // New functions
+
+        /**
+        * Checks that image data and clut from SIM is valid.
+        * @param aData Image data from SIM.
+        */
+        void CheckDataValidityL(
+            const TDesC8& aData ) const;
+
+        /**
+        * Checks that clut is valid.
+        * @param aData Image data.
+        * @param aClut Clut.
+        */
+        void CheckClutValidityL(
+            const TDesC8& aData,
+            const TDesC8& aClut ) const;
+
+    public: // Functions from base classes
+
+        /**
+        * From CSatSIconConverter
+        * @param aData Image data.
+        * @param aClut Clut.
+        * @return Bitmap.
+        */
+        CFbsBitmap* ConvertL(
+            const TDesC8& aData,
+            const TDesC8& aClut ) const;
+
+    };
+
+#endif      // CSATSCOLORICONCONVERTER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/CSatSIconConverter.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,93 @@
+/*
+* 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:  Converts icon to bitmap.
+*
+*/
+
+
+
+#ifndef CSATSICONCONVERTER_H
+#define CSATSICONCONVERTER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <etelsat.h>
+#include <gdi.h>
+
+// FORWARD DECLARATION
+class CFbsBitmap;
+
+// CLASS DECLARATION
+
+/**
+*  Converts icon data to CFbsBitmap.
+*
+*  @lib SatEngine.lib
+*  @since 2.6
+*/
+class CSatSIconConverter : public CBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Factory method to create converter.
+        * @param aCoding Coding scheme of the icon.
+        * @return New converter instance.
+        */
+        static CSatSIconConverter* CreateConverterL(
+            const RSat::TImageCoding& aCoding );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSatSIconConverter() {};
+
+    public: // New functions
+
+        /**
+        * Converts the icon data to CFbsBitmap.
+        * @param aData Icon instance data.
+        * @param aClut Color look-up table. In basic icon clut is not provided.
+        * @return Bitmap.
+        */
+        virtual CFbsBitmap* ConvertL(
+            const TDesC8& aData,
+            const TDesC8& aClut ) const = 0;
+
+    protected:
+
+        /**
+        * Creates bitmap.
+        * @param aWidth Width of the bitmap.
+        * @param aHeight Height of the bitmap.
+        * @param aDisplayMode Display mode.
+        * @return New bitmap instance.
+        */
+        CFbsBitmap* CreateBitmapL(
+            TUint8 aWidth,
+            TUint8 aHeight,
+            TDisplayMode aDisplayMode ) const;
+
+    protected:
+
+        /**
+        * C++ default constructor.
+        */
+        CSatSIconConverter();
+
+    };
+
+#endif      // CSATSICONCONVERTER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/CSatSIconSubSession.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,187 @@
+/*
+* 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:  Handles the icon sub-session IPC.
+*
+*/
+
+
+#ifndef CSATSICONSUBSESSION_H
+#define CSATSICONSUBSESSION_H
+
+#include <etelsat.h>
+
+#include "CSatSSubSession.h"
+#include "MSatIconObserver.h"
+
+class MSatSIconAPI;
+class CSatSSession;
+class CFbsBitmap;
+class TSatEventMediator;
+
+/**
+*  Handles the icon commands.
+*
+*  @lib SatEngine.lib
+*  @since 3.0
+*/
+class CSatSIconSubSession : public MSatIconObserver,
+                            public CSatSSubSession
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aSession Parent session.
+        * @param aEventMediator Passes SetUpIdleMode response event.
+        */
+        static CSatSIconSubSession* NewL(
+            CSatSSession& aSession,
+            TSatEventMediator& aEventMediator );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSatSIconSubSession();
+
+    private: // New functions
+
+        /**
+        * Gets the icon info from SIM.
+        */
+        void GetIconInfo();
+
+        /**
+        * Gets the icon from SIM.
+        */
+        void GetIconInstanceL();
+
+        /**
+        * Writes to client address space. Panics the client
+        * if writing fails.
+        * @param aMessage Message, which to write.
+        * @param aParam Parameter number
+        * @param aDes Descriptor to be written.
+        */
+        void Write(
+            const RMessage2& aMessage,
+            TInt aParam,
+            const TDesC8& aDes ) const;
+
+    public: // Functions from base classes
+
+        /**
+        * From CSatSSubSession
+        * @param aFunction Function.
+        * @param aMessage IPC message.
+        */
+        void HandleCommandL( const RMessage2& aMessage );
+
+        /**
+        * From MSatIconObserver.
+        * Notification of getting icon info from SIM.
+        */
+        void NotifyGetIconInfo();
+
+        /**
+        * From MSatIconObserver.
+        * Notification of getting icon image.
+        */
+        void NotifyGetIconInstanceL();
+
+        /**
+        * From MSatIconObserver.
+        * Notification of getting icon color lookup table.
+        */
+        void NotifyGetClutL();
+
+        /**
+        * From MSatIconObserver.
+        * Notification of operation failure
+        * @param aErrorCode Reason of failure.
+        */
+        void NotifyFailure( TInt aErrorCode );
+
+        /**
+        * From MSatIconObserver.
+        * Error completion for handler
+        * @param aError Received error code
+        * @return Result of completion
+        */
+        TInt CompleteError( TInt aError ) const;
+        
+        /**
+        * Get icon fetching mode which is in synchronous or asynchronous mode.
+        * @return Icon fetching mode.
+        */
+        TBool IconFetchingMode();
+        
+        /**
+        * Notify CSatIconHandler to fetch icons from NAA synchronously or 
+        * asynchrounously.
+        * @param aMode Icon fetching is in synchronously or asynchronously
+        * @return None
+        */
+        void NotifyIconFetchingMode( TBool aMode );
+
+    private:
+
+        /**
+        * ConstrucL
+        */
+        void ConstructL();
+
+        /**
+        * C++ default constructor.
+        * @param aSession Parent session.
+        * @param aEventMediator Passes SetUpIdleMode response event.
+        */
+        CSatSIconSubSession(
+            CSatSSession& aSession,
+            TSatEventMediator& aEventMediator );
+
+        /**
+        * Delivers SetUpIdleModeText response to corresponding command handler.
+        * @param aResponse Idle mode response.
+        */
+        void SendSetUpIdleModeResponse( TInt aResponse ) const;
+
+    private:    // Data
+
+        // Interface for accessing icons in SIM.
+        MSatSIconAPI* iIconAPI;
+
+        // Bitmap instance.
+        CFbsBitmap* iBitmap;
+
+        // Message just being executed.
+        RMessage2 iMessage;
+
+        // Icon info got from SIM.
+        RSat::TIcon iIconEf;
+
+        // Icon info from client.
+        RSat::TInstanceInfoV3 iInfo;
+
+        // Icon data.
+        HBufC8* iIconData;
+
+        // Icon color lookup table.
+        HBufC8* iClut;
+
+        // Event mediator to send SetUpIdleMode response
+        TSatEventMediator& iEventMediator;
+
+    };
+
+#endif      // CSATSICONSUBSESSION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/CSatSRefreshSubSession.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,198 @@
+/*
+* 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:  Handles the refresh sub-session commands.
+*
+*/
+
+
+#ifndef CSATSREFRESHSUBSESSION_H
+#define CSATSREFRESHSUBSESSION_H
+
+#include "CSatSSubSession.h"
+#include "MSatRefreshSubSession.h"
+#include "TSatEventMediator.h"
+
+class CSatSSession;
+class MSatCommand;
+
+/**
+*  Handles the refresh commands.
+*
+*  @lib SatServer
+*  @since 2.6
+*/
+class CSatSRefreshSubSession : public CSatSSubSession,
+                               public MSatRefreshSubSession
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aSession Session
+        * @param aEventMediator Event handler
+        */
+        static CSatSRefreshSubSession* NewL(
+            CSatSSession& aSession,
+            TSatEventMediator& aEventMediator );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSatSRefreshSubSession();
+
+    public: // Functions from base classes
+
+        /**
+        * From CSatSSubSession
+        * @param aMessage Message from the client.
+        */
+        void HandleCommandL( const RMessage2& aMessage );
+
+        /**
+        * From MSatRefreshSubSession.
+        * @param aRefresh Refresh data.
+        */
+        void QueryClient( const RSat::TRefreshV2& aRefresh );
+
+        /**
+        * From MSatRefreshSubSession.
+        * @param aRefresh Refresh data.
+        */
+        void NotifyClient( const RSat::TRefreshV2& aRefresh );
+
+        /**
+        * From MSatRefreshSubSession.
+        */
+        void NotifyClientCancel();
+
+    private: // New functions
+
+        /**
+        * Handles the NotifyRefresh command from SatClient.
+        * @param aMessage Message from the client.
+        */
+        void NotifyRefreshAllowed( const RMessage2& aMessage );
+
+        /**
+        * Cancels the allow refresh.
+        * @param aMessage Message from the client.
+        */
+        void CancelNotifyAllowRefresh( const RMessage2& aMessage );
+
+        /**
+        * Handles the RefreshAllowed command from SatClient.
+        * @param aMessage Message from the client.
+        */
+        void RefreshAllowed( const RMessage2& aMessage );
+
+        /**
+        * Handles the refresh notification.
+        * @param aMessage Message from the client.
+        */
+        void NotifyRefresh( const RMessage2& aMessage );
+
+        /**
+        * Cancels the notify refresh.
+        * @param aMessage Message from the client.
+        */
+        void CancelNotifyRefresh( const RMessage2& aMessage );
+
+        /**
+        * Sends the client's completion to SatServer.
+        * @param aMessage Message from the client.
+        */
+        void CompleteRefresh( const RMessage2& aMessage );
+
+        /**
+        * Checks whether current client is interested about this refresh.
+        * @param aRefresh Refresh data.
+        */
+        TBool VerifyObservedFiles( const RSat::TRefreshV2& aRefresh ) const;
+
+        /**
+        * Timer call back for clients refresh query response timeout.
+        * @param aRefreshSubSession Reference to this class.
+        */
+        static TInt TimerQueryCallback( TAny* aRefreshSubSession );
+
+        /**
+        * Timeout handler for the client's response of refresh query.
+        */
+        void QueryTimeout();
+
+        /**
+        * Timer call back for clients refresh notify response timeout.
+        * @param aRefreshSubSession Reference to this class.
+        */
+        static TInt TimerNotifyCallback( TAny* aRefreshSubSession );
+
+        /**
+        * Timeout handler for the client's response of refresh notify.
+        */
+        void NotifyTimeout();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        * @param aSession
+        * @param aEventMediator Event handler
+        */
+        CSatSRefreshSubSession(
+            CSatSSession& aSession,
+            TSatEventMediator& aEventMediator );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private:    // Data
+
+        // Message for allow refresh.
+        RMessage2 iRefreshAllowMessage;
+
+        // Indicates if allow refresh has not been complited.
+        TBool iRefreshAllowPending;
+
+        // Messge for refresh.
+        RMessage2 iNotifyRefreshMessage;
+
+        // Indicates if refresh has not been completed.
+        TBool iNotifyRefreshPending;
+
+        // Event mediator.
+        TSatEventMediator& iEventMediator;
+
+        // Timer for securing user query.
+        CPeriodic* iQueryTimer;
+
+        // Timer for securing refresh complete.
+        CPeriodic* iNotifyTimer;
+
+        // A client has been queried to allow refresh and we are waiting
+        // for response. Enables discarding of timed out responses.
+        TBool iClientQueryPending;
+
+        // A client has been notified about refresh and we are waiting
+        // for response. Enables discarding of timed out responses.
+        TBool iClientNotifyPending;
+
+        // A client has allowed refresh and is waiting for Refesh notification.
+        // Flag is used when notificating Refresh cancel for clients waiting.
+        TBool iClientWaitingRefresh;
+
+    };
+
+#endif      // CSATSREFRESHSUBSESSION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/CSatSServer.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,290 @@
+/*
+* 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:  Server class
+*
+*/
+
+
+#ifndef CSATSSERVER_H
+#define CSATSSERVER_H
+
+#include <e32base.h>
+#include "TSatEventMediator.h"
+#include "MSatSSessions.h"
+
+class CSatCommandContainer;
+class CSatSUiClientHandler;
+class MSatUtils;
+
+// ----------------------------------------------------------------------------------------
+// Server's policy here
+// ----------------------------------------------------------------------------------------
+
+//Total number of ranges
+const TUint KSatServerCount = 14;  // 13 + 0
+
+//Definition of the ranges of IPC numbers
+const TInt satServerRanges[KSatServerCount] =
+        {
+        // Illegal service request.
+        0,  //ESatSNone,   //Range 0
+
+        /*// Server test commands
+        ESatSDisplayText,
+        ESatSNotifyTest,
+        ESatSNotifyTestCancel,
+        ESatSShutdown,*/
+        1,   // Range 1.
+
+        /*These proactive commands need no capability checling
+        Proactive commands (asynchronous)
+        ESatSProactiveDisplayText,
+        ESatSProactiveGetInkey,
+        ESatSProactiveGetInput,
+        ESatSProactiveSetUpMenu,
+        ESatSProactiveSelectItem,
+        ESatSProactivePlayTone,
+        ESatSProactiveRefresh,*/
+        5,  // Range 2.
+
+        /* This range needs capability checking, NetworkServices.
+        //ESatSProactiveSendSs,
+        ESatSProactiveSendUssd,
+        ESatSProactiveSendDtmf,
+        ESatSProactiveQuery, // for Send SM and Set Up Call
+        ESatSProactiveEvent, // for server event notification
+        ESatSProactiveSetUpCall,*/
+        12,  // Range 3.
+
+        // Envelope commands (synchronous)
+        // ESatSActiveMenuSelection,
+        18,  // Range 4
+
+        // CallControl command
+        //ESatSCallControl,
+        19, // Range 5
+
+
+        //  MoSmControl command
+        // ESatSMoSmControl,
+        20,  // Range 6
+
+        /* Command responses (synchronous)
+        ESatSProactiveDisplayTextResponse,
+        ESatSProactiveGetInkeyResponse,
+        ESatSProactiveGetInputResponse,
+        ESatSProactiveSetUpMenuResponse,
+        ESatSProactiveSelectItemResponse,
+        ESatSProactivePlayToneResponse,
+        ESatSProactiveSendSsResponse,
+        ESatSProactiveSendUssdResponse,
+        ESatSProactiveSendDtmfResponse,
+        ESatSProactiveQueryResponse,
+        ESatSProactiveEventResponse,
+        ESatSProactiveSetUpCallResponse,*/
+        21, // Range 7
+
+        // SAT UI related call control response
+        //ESatSCallControlUIResponse,
+        33,  // Range 8
+
+        // ESatSProactiveRefreshResponse,
+        34, // Range 9
+
+        // SAT UI related response
+        // ESatSMoSmControlUIResponse,
+        35,  // Range 10
+
+        /* Session indicators (for internal use)
+        ESatSOpenUiSubSession,
+        ESatSGetSIMAppStatus,
+        ESatSCloseUiSubSession,*/
+
+        36, // Range 11
+
+        /* Refresh handling
+        ESatSOpenRefreshSubSession,
+        ESatSCloseRefreshSubSession,
+        ESatSRefreshAllowed,
+        ESatSNotifyAllowRefresh,
+        ESatSNotityAllowRefreshCancel,
+        ESatSNotifyRefresh,
+        ESatSCancelNotifyRefresh,*/
+
+        39, // Range 12
+
+        /* Icon handling
+        ESatSOpenIconSubSession,
+        ESatSCloseIconSubSession,
+        ESatSGetIconInfo,
+        ESatSGetIconInstance,
+        ESatSIconInstanceGot*/
+
+        46, // Range 13
+
+        };
+
+//Policy to implement for each of the above ranges
+const TUint8 satServerElementsIndex[KSatServerCount] =
+        {
+        CPolicyServer::EAlwaysPass, // 0
+        CPolicyServer::EAlwaysPass, // 1
+        CPolicyServer::EAlwaysPass, // 2
+        0,   // Check Network Capabilites for this range
+        CPolicyServer::EAlwaysPass, // 4
+        CPolicyServer::EAlwaysPass, // 5
+        CPolicyServer::EAlwaysPass, // 6
+        CPolicyServer::EAlwaysPass, // 7
+        CPolicyServer::EAlwaysPass, // 8
+        CPolicyServer::EAlwaysPass, // 9
+        CPolicyServer::EAlwaysPass, // 10
+        CPolicyServer::EAlwaysPass, // 11
+        CPolicyServer::EAlwaysPass, // 12
+        CPolicyServer::EAlwaysPass  // 13
+        };
+
+//Specific capability checks
+const CPolicyServer::TPolicyElement satServerElements[] =
+    {
+    // policy "0"; fail call if NetworkServices not present.
+    //lint -e{778,1924} Macro can not be affected.
+        {
+        _INIT_SECURITY_POLICY_C1( ECapabilityNetworkServices ),
+        CPolicyServer::EFailClient
+        },
+    };
+
+//Package all the above together into a policy
+const CPolicyServer::TPolicy satServerPolicy =
+        {
+        CPolicyServer::EAlwaysPass, //specifies all connect attempts should pass
+        KSatServerCount, //number of ranges
+        satServerRanges,    //ranges array
+        satServerElementsIndex, //elements<->ranges index
+        satServerElements,      //array of elements
+        };
+
+// End Server's Policy
+
+/**
+*  Manages sessions
+*
+*  @lib SatServer.exe
+*  @since Series 60 3.0
+*/
+class CSatSServer : public CPolicyServer,
+                    public MSatSSessions
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CSatSServer* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSatSServer();
+
+    public: // New functions
+
+        /**
+        * Completes current message from client.
+        * @param aError Standard Symbian error code.
+        */
+        void CompleteMessage( TInt aError ) const;
+
+        /**
+        * Creates new container for sessions.
+        * @return New container.
+        */
+        CObjectCon* CreateNewContainerL();
+
+        /**
+        * Gets MSatUtils interface
+        * @return MSatUtils interface
+        */
+        MSatUtils* SatUtils();
+
+        /**
+        * Adds refresh subsession.
+        * @param aSubSession refresh subsession.
+        */
+        void AddL( const MSatRefreshSubSession* aSubSession );
+
+        /**
+        * Removes refresh subsession.
+        * @param aSubSession Sub session to be removed.
+        */
+        void Remove( const MSatRefreshSubSession* aSubSession );
+
+    public: // Functions from base classes
+
+        /**
+        * From MSatSSessions Gives ui session interface.
+        * @return Interface for ui session
+        */
+        MSatUiSession* UiSession();
+
+        /**
+        * From MSatSSessions Gives refresh subsessions.
+        * @return Pointer array containing refresh subsessions
+        */
+        const RPointerArray<MSatRefreshSubSession>& RefreshSubSessions();
+
+    private: // Functions from base classes
+
+        /**
+        * From CServer2, creates a new server session.
+        * @param aVersion Client interface version.
+        * @param aMessage 'connect' message from the client.
+        * @return Pointer to the created server session.
+        */
+        CSession2* NewSessionL(
+            const TVersion& aVersion,
+            const RMessage2& aMessage ) const;
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CSatSServer();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private: // Data
+
+        // SAT Command handler container
+        CSatCommandContainer* iCmdContainer;
+
+        // SAT Ui client handler
+        CSatSUiClientHandler* iUiHandler;
+
+        // Event mediator
+        TSatEventMediator iEventMediator;
+
+        // CObjectCon factory.
+        CObjectConIx* iObjectConIx;
+
+        // Refresh subsessions
+        RPointerArray<MSatRefreshSubSession> iRefreshSubSessions;
+
+    };
+
+#endif      // CSATSSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/CSatSSession.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,183 @@
+/*
+* 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:  The Sat Server session manages a connection to a client and
+*                handles client requests.
+*
+*/
+
+#ifndef CSATSSESSION_H
+#define CSATSSESSION_H
+
+//  INCLUDES
+#include    <e32svr.h>
+
+// FORWARD DECLARATIONS
+class TSatEventMediator;
+class CSatSServer;
+class CSatSSubSession;
+class MSatUiSession;
+class CSatSServer;
+class MSatApi;
+class MThreadDeathNotifier;
+class CSatIconHandler;
+class MSatSIconAPI;
+// CLASS DECLARATION
+
+/**
+*  CSatSSession represents the server-side session object.
+*
+*  @lib SatEngine.lib
+*  @since Series 60 3.0
+*/
+class CSatSSession : public CSession2
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aServer SatServer class
+        * @param aEventMediator Event mediator class
+        * @param aUsatApi An USat API interface
+        * @param aThreadDeathNotifier ThreadDeath notifier interface
+        */
+        static CSatSSession* NewL( CSatSServer* aServer,
+            TSatEventMediator& aEventMediator,
+            MSatApi& aUsatApi,
+            MThreadDeathNotifier& aThreadDeathNotifier );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSatSSession();
+
+    public: // Functions from base classes
+
+        /**
+        * From CSession2 Handles an incoming message.
+        * @param aMessage Handle to the client message.
+        */
+        void ServiceL( const RMessage2 &aMessage );
+
+    public: // New functions
+
+        /**
+        * Gives pointer of ui sub session interface. May be null.
+        * @return Pointer of ui subsession interface.
+        */
+        MSatUiSession* UiSubSession();
+
+        /**
+        * Closes icon sub-session.
+        * @param aMessage Handle to the client message.
+        * @return TRUE if subsession exists. Otherwise return FALSE.
+        */
+        TBool CloseSubSession( const RMessage2& aMessage );
+
+        /**
+        * Gets the sub-session using handle.
+        * @param aHandle Sub-session handle.
+        * @return Sub-session. NULL if not found.
+        */
+        CSatSSubSession* GetSubSessionFromHandle( TInt aHandle ) const;
+
+        /**
+        * Panic the client.
+        * @param aMessage The panic message
+        * @param aPanic The panic code.
+        */
+        void PanicClient( const RMessage2& aMessage, TInt aPanic ) const;
+
+        /**
+        * Notifies Thread death monitor for thread is dying
+        */
+        void NotifyThreadDeathMonitor();
+
+        /**
+        * Gets pointer to SatServer
+        * @param Pointer to SatServer
+        */
+        CSatSServer* SatServer();
+
+        /**
+        * Tells that UI Sub session is closed.
+        */
+        void UiSessionClosed();
+
+        /**
+        * Creates icon handler and returns it to icon sub session
+        * return Pointer to created icon handler
+        */
+        MSatSIconAPI* CreateIconHandlerL();
+
+    private: // New functions
+
+        /**
+        * Adds sub session to container. Sub session is deleted
+        * if leave occurs.
+        * @param aSubSession A Session that is needed to be added
+        * @param aMessage An instance of RMessage2
+        */
+        void AddSubSessionL( CSatSSubSession* aSubSession,
+            const RMessage2& aMessage );
+
+    private: // Constructors
+
+        /**
+        * ConstrucL
+        */
+        void ConstructL();
+
+        /**
+        * C++ default constructor.
+        * @param aServer SatServer class
+        * @param aEventMediator Event mediator class
+        * @param aUsatApi An USat API interface
+        * @param aThreadDeathNotifier ThreadDeath notifier interface
+        */
+        CSatSSession( CSatSServer* aServer,
+            TSatEventMediator& aEventMediator,
+            MSatApi& aSatApi,
+            MThreadDeathNotifier& aThreadDeathNotifier );
+
+    private: // Data
+
+        // A reference to the server.
+        CSatSServer* iSatServer;
+
+        // Event mediator reference
+        TSatEventMediator& iEventMediator;
+
+        // Sat api
+        MSatApi& iSatApi;
+
+        // Generates a unique handle for subsession.
+        CObjectIx* iSubSessionIx;
+
+        // Container for sub-sessions.
+        CObjectCon* iSubSessionCon;
+
+        // Interface for ui sub session
+        MSatUiSession* iUiSubSession;
+
+        // Thread death monitor notifier
+        MThreadDeathNotifier& iThreadDeathNotifier;
+
+        // Indicates is SatUiSubSession closed
+        TBool iSatUiSubSessionClosed;
+
+    };
+
+#endif      // CSATSSESSION_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/CSatSSimSubscriberId.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,127 @@
+/*
+* 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:  This is the handler for the SIM Application Toolkit
+*                to dedect the SIM card subscriber id.
+*
+*/
+
+
+#ifndef CSATSSIMSUBSCRIBERID_H
+#define CSATSSIMSUBSCRIBERID_H
+
+#include <etelsat.h>
+#include "CSatSServer.h"
+#include "MSatSSimSubscriberId.h"
+
+class TSatEventMediator;
+class CSatSActiveWrapper;
+class MSatMultiModeApi;
+
+/**
+*  This is the handler for the SIM card status.
+*  This active objects is registered to listen SIM card status,
+*  especially SIM card removed status.
+*/
+
+class CSatSSimSubscriberId : public CActive,
+                             public MSatSSimSubscriberId
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aPhone a reference to MSatMultiModeApi
+        * @param aEventMediator Event handler class
+        * @return a pointer to the newly created active object.
+        */
+        static CSatSSimSubscriberId* NewL(
+            MSatMultiModeApi& aPhone,
+            TSatEventMediator& aEventMediator );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSatSSimSubscriberId();
+
+    public: // New functions
+
+        /**
+        * Starts the handler.
+        */
+        void Start();
+
+    protected: // Functions from base classes
+
+        /**
+        * From CActive, handles the request completion.
+        */
+        void RunL();
+
+        /**
+        * From CActive, implements the cancel protocol.
+        */
+        void DoCancel();
+
+    private: // Constructors
+
+        /**
+        * C++ default constructor.
+        * @param aPhone a reference to MSatMultiModeApi.
+        * @param aEventMediator Event handler class.
+        */
+        CSatSSimSubscriberId(
+            MSatMultiModeApi& aPhone,
+            TSatEventMediator& aEventMediator );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private: // New functions
+
+        /**
+        * Starts listening for the SIM card subscriber id.
+        */
+        void DoStart();
+
+        /**
+        * Checks whether special SIM is being used.
+        * @return TBool indicating special SIM.
+        */
+        TBool IsCmccSIM() const;
+
+    private: // Data
+
+        // MSatMultiModeApi instance.
+        MSatMultiModeApi& iPhone;
+
+        // Event mediator.
+        TSatEventMediator& iEventMediator;
+
+        // Indicates whether subscriber id below is successfully read.
+        TBool iSubscriberIdValid;
+
+        // Subscriber ID data.
+        RMobilePhone::TMobilePhoneSubscriberId iSubscriberId;
+
+        // Provides asynchronous timer for thread suspension.
+        CSatSActiveWrapper* iWrapper;
+
+        // Counter to limít subscriber id read retries.
+        TInt iRetryCounter;
+
+    };
+
+#endif      // CSATSSIMSUBSCRIBERID_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/CSatSSubSession.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2004-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:  Base class for sub-sessions
+*
+*/
+
+
+
+#ifndef CSATSSUBSESSION_H
+#define CSATSSUBSESSION_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARAITION
+class CSatSSession;
+class CSatSServer;
+// CLASS DECLARATION
+
+/**
+*  Base class for sub-sessions.
+*
+*  @lib SatEngine.lib
+*  @since 2.6
+*/
+class CSatSSubSession : public CObject
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSatSSubSession();
+
+    public: // New functions
+
+        /**
+        * Handles the subsession functions. The opening and closing of
+        * sub-session is handled by CSatSSession, so this method is not
+        * called in opening or in closing of sub-session.
+        * @param aMessage IPC message from client.
+        */
+        virtual void HandleCommandL( const RMessage2& aMessage ) = 0;
+
+    protected:
+
+        /**
+        * C++ default constructor.
+        */
+        CSatSSubSession( CSatSSession& aSession );
+
+    protected: // Data
+        // Session class
+        CSatSSession& iSession;
+
+    };
+
+#endif      // CSATSSUBSESSION_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/CSatSUiClientHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,197 @@
+/*
+* 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:  CSatSUiClientHandler is responsible for handling activity
+*                with SAT Ui. For example launch UI, observe ui thread deaths
+*
+*/
+
+
+
+#ifndef CSATSUICLIENTHANDLER_H
+#define CSATSUICLIENTHANDLER_H
+
+//  INCLUDES
+#include    <e32base.h>
+
+#include    "MThreadDeathObserver.h"
+#include    "MSatSUiClientHandler.h"
+#include    "MSatEventObserver.h"
+#include    "MThreadDeathNotifier.h"
+
+// FORWARD DECLARATIONS
+class CSatThreadDeathMonitor;
+class TSatEventMediator;
+class MSatSSessions;
+class MSatShellController;
+class MSatUtils;
+
+// CLASS DECLARATION
+
+/**
+*  Class is responsible for some activity conserning to client.
+*
+*  @lib SatEngine.lib
+*  @since Series 60 3.0
+*/
+class CSatSUiClientHandler : public CBase,
+                             public MThreadDeathNotifier,
+                             public MThreadDeathObserver,
+                             public MSatSUiClientHandler,
+                             public MSatEventObserver
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aSessions Accessor for sessions
+        * @param aEventMediator Event handler class
+        */
+        static CSatSUiClientHandler* NewL(
+            MSatSSessions& aSessions,
+            TSatEventMediator& aEventMediator );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSatSUiClientHandler();
+
+    public: // New functions
+
+        /**
+        * Sets Utils interface
+        * @param aUtils Utils interface
+        */
+        void SetUtils( MSatUtils* aUtils );
+
+    public: // Functions from base classes
+
+        /**
+        * From MThreadDeathNotifier Sets thread that is observered.
+        * @param aThreadId Thread Id which death should be observered
+        */
+        void SetObserveredThread( TThreadId& aThreadId );
+
+        /**
+        * From MThreadDeathNotifier Notifies Thread death monitor.
+        */
+        void NotifyThreadDeath();
+
+        /**
+        * From MThreadDeathNotifier Start monitoring thread's death
+        */
+        void StartObservingThread();
+
+        /**
+        * From MThreadDeathObserver.
+        * Notification of observed thread death.
+        */
+        void ThreadDiedL();
+
+        /**
+        * From MThreadDeathObserver.
+        * Notification of observed thread paniced.
+        */
+        void ThreadPanicedL();
+
+        /**
+        * From MSatEventObserver. Event notification.
+        * @param aEvent An event that has been notified by TSatEventMediator
+        */
+        void Event( TInt aEvent );
+
+        /**
+        * Gives pointer to ui session interface. If pointer is NULL, then
+        * ui session is not available.
+        * @return Pointer to ui session interface.
+        */
+        MSatUiSession* UiSession();
+
+        /**
+        * Launches the SAT UI Client.
+        */
+        void LaunchSatUiL();
+
+        /**
+        * Tells if user has started the ui client.
+        * @return ETrue if user has launched the ui client.
+        */
+        TBool UiLaunchedByUser();
+
+        /**
+        * Gives pointer to MSatShellController
+        * @return Pointer to sat shell controller.
+        */
+        MSatShellController& ShellController();
+
+        /**
+        * Tells is UI closing
+        * @return Boolean value indicating is UI closing
+        */
+        TBool IsUiClosing() const;
+
+    private:
+
+        /**
+        * C++ default constructor.
+        * @param aSessions Accessor for sessions
+        * @param aEventMediator Event handler class
+        */
+        CSatSUiClientHandler(
+            MSatSSessions& aSessions,
+            TSatEventMediator& aEventMediator );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private:    // Data
+
+        // Accessor for sessions
+        MSatSSessions& iSessions;
+
+        // Thread death monitor
+        CSatThreadDeathMonitor* iThreadDeathMonitor;
+
+        // Handle to SatShellController library
+        RLibrary iSatShellCntrlLibrary;
+
+        // Interface for SatShellController.
+        MSatShellController* iSatShellCntrl;
+
+        // Event mediator
+        TSatEventMediator& iEventMediator;
+
+        // Utils interface
+        MSatUtils* iUtils;
+
+        // Is user launced the ui.
+        TBool iUiLaunchedByUser;
+
+        // Is Sat ui closing
+        TBool iSatUiClosing;
+
+        // Do we have to launch SAT Ui after it is closed
+        TBool iLaunchSatUiAfterClose;
+
+        // Thread that is closing
+        TThreadId iThread;
+
+        // Indicates if SAT UI is paniced
+        TBool iSatUiPanicked;
+    };
+
+#endif      // CSATSUICLIENTHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/CSatSUiSubSession.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,204 @@
+/*
+* 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:  Handles ui subsession
+*
+*/
+
+
+
+#ifndef CSATSUISUBSESSION_H
+#define CSATSUISUBSESSION_H
+
+//  INCLUDES
+#include    "CSatSSubSession.h"
+#include    "MSatUiSession.h"
+#include    "SatSOpcodes.h"
+#include    "SatSTypes.h"
+#include    "MSatCommand.h"
+#include    "CSatClientServiceReq.h"
+#include    "MSatEventObserver.h"
+#include    "TSatEventMediator.h"
+
+// FORWARD DECLARATIONS
+class CSatSSession;
+class MSatApi;
+
+
+// CLASS DECLARATION
+
+/**
+*  Handles ui subsession.
+*
+*  @lib SatEngine.lib
+*  @since Series 60 3.0
+*/
+class CSatSUiSubSession : public CSatSSubSession,
+                          public MSatUiSession,
+                          public MSatEventObserver
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aSession Parent session
+        * @param aSatApi SAT API Interface
+        * @param aEventMediator Event handler
+        */
+        static CSatSUiSubSession* NewL( CSatSSession& aSession,
+            MSatApi& aSatApi,
+            TSatEventMediator& aEventMediator );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSatSUiSubSession();
+
+    public: // Functions from base classes
+
+        /**
+        * From CSatSSubSession Handler for IPC messages.
+        * @param aMessage IPC message from client.
+        */
+        void HandleCommandL( const RMessage2& aMessage );
+
+        /**
+        * From MSatUiSession Closes the ui sub session.
+        */
+        void CloseUiSession();
+
+        /**
+        * From MSatUiSession Clears the screen.
+        */
+        void ClearScreen();
+
+        /**
+        * From MSatUiSession. Notification that command data is available.
+        * @param aCmdData Data to be sent to client.
+        * @param aCmdRsp Client response
+        * @param aRequest Request, where the data is sent.
+        */
+        void SendCommand(
+            TDesC8* aCmdData,
+            TDes8* aCmdRsp,
+            TSatServerRequest aRequest );
+
+        /**
+        * From MSatUiSession.Ui Event.
+        */
+        void UiEventNotification( 
+            TInt aEventId, 
+            TInt aEventStatus, 
+            TInt aEventError );
+
+        /**
+        * From MSatUiSession Queries the user.
+        * @param aCommand Command handler interface
+        */
+        void QueryUser( MSatCommand* aCommand );
+
+        /**
+        * From MSatEventObserver.
+        * @param aEvent An event that is notified
+        */
+        void Event( TInt aEvent );
+
+    protected:  // New functions
+
+        /**
+        * Sends the command data to client if the request is available.
+        * @param aRequestAvailable Indication if request is available. If
+        * data is sent aRequestAvailable will be set to EFalse.
+        * @param aData Data to be sent to client.
+        * @param aMessage Clients request message.
+        * @return Boolean value indicating was the command sent to client or not
+        */
+        TBool SendCommandDataToClient(
+            TBool& aRequestAvailable,
+            const TDesC8& aData,
+            const RMessage2& aMessage ) const;
+
+        /**
+        * Sends ESatSSmEndEvent event to UI Client
+        */
+        void SendSmsSentEventToClient();
+        
+        /**
+        * Handles UI Event notification
+        */
+        void HandleUiEventNotification();
+        /**
+        * Publish the P&S key KSatAppClosedUsingEndKey to indicate the occurred
+        * End Key action
+        */
+        void PublishSatAppClosedUsingEndKey();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        * @param aSession Parent session
+        * @param aSatApi SAT API Interface
+        * @param aEventMediator Event handler
+        */
+        CSatSUiSubSession( CSatSSession& aSession,
+            MSatApi& aSatApi,
+            TSatEventMediator& aEventMediator );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private:    // Data
+
+        // Request / Response handlers array
+        CArrayPtrFlat<CSatClientServiceReq>* iServiceRequest;
+
+        // Indicates that event request is availabe
+        TBool iEventRequestAvailable;
+
+        // Indicates that some command has issued close ui session
+        TBool iCloseUiRequested;
+
+        // Indicates that DisplayText has requested screen to be cleared
+        TBool iClearScreenRequested;
+
+        // Indicates that sms has been sent by CSendSmCmd
+        TBool iSmsSent;
+        
+        // Indicates is there event pending
+        TBool iUiEventRequested;
+
+        // Event message
+        RMessage2 iEventRequest;
+
+        // Event data
+        TSatEventV1 iEventData;
+
+        // Event data package
+        TSatEventV1Pckg iEventDataPckg;
+
+        // Sat api
+        MSatApi& iSatApi;
+
+        // Query request
+        RMessage2 iQueryRequest;
+
+        // Event mediator
+        TSatEventMediator& iEventMediator;
+    };
+
+#endif      // CSATSUISUBSESSION_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/CSatThreadDeathMonitor.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,101 @@
+/*
+* 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:  Monitors threads death and notifies an event, when thread dies
+*
+*/
+
+
+
+#ifndef CSATTHREADDEATHMONITOR_H
+#define CSATTHREADDEATHMONITOR_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class MThreadDeathObserver;
+
+// CLASS DECLARATION
+/**
+*  Monitors thread deaths and notifies an event, when one dies
+*
+*  @lib SatEngine.lib
+*  @since Series 60 2.6
+*/
+class CSatThreadDeathMonitor : public CActive
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aUtils Utils API for event notify
+        */
+        static CSatThreadDeathMonitor* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSatThreadDeathMonitor();
+
+    public: // New functions
+
+        /**
+        * Notfifies the observer, when thread dies. Cancels outstanding
+        * thread death notification, if one exists.
+        * @param aThreadId Id of thread.
+        * @param aObserver Observer of the thread death
+        */
+        void NotifyThreadDeathL(
+            const TThreadId& aThreadId,
+            MThreadDeathObserver& aObserver );
+
+    protected: // New functions
+
+        /**
+        * Issues the request of thread death.
+        */
+        void StartObservingThreadDeath();
+
+    protected:  // Functions from base classes
+
+        /**
+        * From CActive
+        */
+        void DoCancel();
+
+        /**
+        * From CActive
+        */
+        void RunL();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CSatThreadDeathMonitor();
+
+    private:    // Data
+
+        // Thread that is monitored
+        RThread iThread;
+
+        // Observer for thread death.
+        MThreadDeathObserver* iObserver;
+
+    };
+
+#endif      // CSATTHREADDEATHMONITOR_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/EnginePanic.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,44 @@
+/*
+* 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:  Declares panic function and panic codes for SatEngine
+*
+*/
+
+
+
+#ifndef ENGINEPANIC_H
+#define ENGINEPANIC_H
+
+// DATA TYPES
+enum TPanicCode
+    {
+    ESatSBadRequest,
+    ESatEngineNullPointer,
+    ESatSBadDescriptor,
+    ESatSStartServer,
+    ESatUnexpectedHandleUiResponseCall,
+    ESatUnexpectedRspPckgCall,
+    ESatUnexpectedDataPckgCall,
+    ESatUserQueryAlreadyActive,
+    // Paniced in case where BIP Data channels are used in such cases where
+    // the usage should be impossible
+    ESatBIPAccessViolation
+    };
+
+// FUNCTION PROTOTYPES
+void PanicSatEngine( TPanicCode aPanicCode );
+
+#endif      // ENGINEPANIC_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/MSatIconObserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CSatIconHandler
+*
+*/
+
+
+
+#ifndef MSATICONOBSERVER_H
+#define MSATICONOBSERVER_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// CLASS DECLARATION
+
+/**
+*  Observer for CSatIconHandler
+*
+*  @lib SatEngine.lib
+*  @since Series 60 3.0
+*/
+class MSatIconObserver
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        MSatIconObserver() {};
+
+        /**
+        * Destructor.
+        */
+        virtual ~MSatIconObserver() {};
+
+    public: // New functions
+
+        /**
+        * Notification of getting icon info from SIM.
+        */
+        virtual void NotifyGetIconInfo() = 0;
+
+        /**
+        * Notification of getting icon image.
+        */
+        virtual void NotifyGetIconInstanceL() = 0;
+
+        /**
+        * Notification of getting icon color lookup table.
+        */
+        virtual void NotifyGetClutL() = 0;
+
+        /**
+        * Notification of operation failure.
+        * @param aErrorCode Reason of failure.
+        */
+        virtual void NotifyFailure( TInt aErrorCode ) = 0;
+        
+        /**
+        * Error completion for handler
+        * @param aError Received error code
+        * @return Result of completion
+        */
+        virtual TInt CompleteError( TInt aError ) const = 0;
+
+    private:
+
+        // Prohibit copy constructor if not deriving from CBase.
+        MSatIconObserver( const MSatIconObserver& );
+
+        // Prohibit assigment operator if not deriving from CBase.
+        MSatIconObserver& operator=( const MSatIconObserver& );
+
+    };
+
+#endif      // MSATICONOBSERVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/MSatSIconAPI.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2004-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Interface for accesing icon data in SIM.
+*
+*/
+
+
+
+#ifndef MSATSICONAPI_H
+#define MSATSICONAPI_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <etelsat.h>
+#include "MSatIconObserver.h"
+
+// CLASS DECLARATION
+
+/**
+*  Interface for accessing icon data in SIM.
+*
+*  @lib SatEngine.lib
+*  @since 2.6
+*/
+class MSatSIconAPI
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Destructor.
+        */
+        virtual ~MSatSIconAPI() {};
+
+    public: // New functions
+
+        /**
+        * Gets the icon info from SIM.
+        * @param aRecordNumber Specifies the EF_IMG in SIM.
+        * @param aIconEf Contains the icon informations from SIM in returning
+        * of the method.
+        * @param aObserver Observer for icon info get completion.
+        */
+        virtual void GetIconInfo(
+            TUint8 aRecordNumber,
+            RSat::TIcon& aIconEf,
+            MSatIconObserver& aObserver ) = 0;
+
+        /**
+        * Gets the icon image.
+        * @param aInstance Informatio of the icon, which data is
+        * fetched from SIM.
+        * @param aInstance Contains the icon data from SIM in returning of the
+        * method.
+        * @param aObserver Observer for icon image get completion.
+        */
+        virtual void GetIconInstance(
+            const RSat::TInstanceInfoV3& aInstanceInfo,
+            TDes8& aInstance,
+            MSatIconObserver& aObserver ) = 0;
+
+        /**
+        * Gets color lookup table of the icon.
+        * @param aInstanceNumber Image instance number.
+        * @param aOffset Offset of the clut.
+        * @param aClut Contains the Clut of the icon in returning of the
+        * method.
+        * @param aObserver Observer for clut get completion.
+        */
+        virtual void GetClut(
+            TUint aInstanceNumber,
+            TUint aOffset,
+            TDes8& aClut,
+            MSatIconObserver& aObserver ) = 0;
+        /*
+         * Set a mode to determine whether to fetch icons from NAA syncronously
+         * or asynchronously.
+         *
+         * @param aMode Synchronous or asynchronous mode. Icons would be
+         * fetched from NAA in sychronous mode if SAT UI was closed by
+         * using the End Key. Otherwise, in asynchronous mode.
+         * @return None
+         */
+        virtual void SetIconFetchingMode( TBool aMode ) = 0;
+
+    protected:
+
+        // Constructor
+        MSatSIconAPI() {};
+
+    private:
+
+        // Prohibit copy constructor if not deriving from CBase.
+        MSatSIconAPI( const MSatSIconAPI& );
+
+        // Prohibit assigment operator if not deriving from CBase.
+        MSatSIconAPI& operator=( const MSatSIconAPI& );
+
+    };
+
+#endif      // MSATSICONAPI_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/MSatSSessions.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,79 @@
+/*
+* 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:  Accessors for different kind of sessions in SatServer
+*
+*/
+
+
+
+#ifndef MSATSSESSIONS_H
+#define MSATSSESSIONS_H
+
+//  INCLUDES
+#include <e32std.h>
+#include "MSatRefreshSubSession.h"
+
+// FORWARD DECLARATION
+class MSatUiSession;
+
+// CLASS DECLARATION
+
+/**
+*  Accessors for SatServer sessions.
+*
+*  @lib SatServer
+*  @since Series 60 3.0
+*/
+class MSatSSessions
+    {
+    protected:  // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        MSatSSessions() {};
+
+        /**
+        * Destructor.
+        */
+        virtual ~MSatSSessions() {};
+
+    public: // New functions
+
+        /**
+        * Gives ui session interface. May be NULL.
+        * @return Interface for ui session
+        */
+        virtual MSatUiSession* UiSession() = 0;
+
+        /**
+        * Gives all refresh sub sessions.
+        * @return Pointer array of MSatRefreshSubSessions
+        */
+        virtual const RPointerArray<MSatRefreshSubSession>&
+            RefreshSubSessions() = 0;
+
+    private:
+
+        // Prohibit copy constructor if not deriving from CBase.
+        MSatSSessions( const MSatSSessions& );
+
+        // Prohibit assigment operator if not deriving from CBase.
+        MSatSSessions& operator=( const MSatSSessions& );
+
+    };
+
+#endif      // MSATSSESSIONS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/MSatShellController.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,106 @@
+/*
+* 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:  This file contains the SAT Shell Controller Interface that is
+*                responsible for the actual implementation of the following
+*                functionality:
+*                - add SAT UI application to Desk (or similar)
+*                - remove SAT UI application from Desk (or similar)
+*                - bring SAT UI application to foregroud if it already is up
+*                  and running
+*                - launching the SAT UI application
+*                - launching the Browser application
+*                - resolving default access point
+*
+*/
+
+
+#ifndef MSATSHELLCONTROLLER_H
+#define MSATSHELLCONTROLLER_H
+
+#include <e32base.h>
+
+/**
+* This class is used to control adding, removing and launching of
+* the SAT UI Client application. It connects to appropriate module
+* and is used by the SAT Server.
+*
+* @lib SatEngine.lib
+* @since Series 60 2.0
+*
+*/
+
+class MSatShellController
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Destructor.
+        */
+        virtual ~MSatShellController() {};
+
+    public: // New functions
+
+        /**
+        * Adds SAT UI Client to the Application Shell (or similar).
+        * @param aName Name of the entry
+        */
+        virtual void AddSatUiL( TDesC& aName ) = 0;
+
+        /**
+        * Adds SAT UI Client to the Application Shell (or similar).
+        * @param aName Name of the entry
+        * @param aIconId Id of the icon.
+        */
+        virtual void AddSatUiL( TDesC& aName, TUint8 aIconId ) = 0;
+
+        /**
+        * Removes SAT UI Client from the Application Shell (or similar).
+        */
+        virtual void RemoveSatUiL() = 0;
+
+        /**
+        * Launches the SAT UI Client.
+        */
+        virtual void LaunchSatUiL() = 0;
+        
+        /**
+        * Bring Browser to foreground after period of time.
+        */
+        virtual void BringBrowserToForegroundAfterPeriod() = 0;
+
+        /**
+        * Bring the SAT UI Application to foreground.
+        */
+        virtual void BringSatUiToForeground() = 0;
+        
+        /**
+        * Sets SAT UI Application to background if needed.
+        */
+        virtual void SetSatUiToBackground() const = 0;
+
+        /**
+        * Launch Browser
+        * @since Series 60 2.6
+        * @param aUrl URL to be opened when launching browser.
+        * @param aAccessPointUid ID number of access point in CommDb.
+        * @return The result of the operation.
+        */
+        virtual TInt LaunchBrowserL(
+            const TDesC& aUrl,
+            TUid aAccessPointUid ) = 0;
+    };
+
+#endif      // MSATSHELLCONTROLLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/MThreadDeathNotifier.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* 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:  ThreadDeath notifier for CSatSession
+*
+*/
+
+
+
+#ifndef MTHREADDEATHNOTIFIER_H
+#define MTHREADDEATHNOTIFIER_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// CLASS DECLARATION
+
+/**
+*  Notifies CSatThreadDeathMonitor to start monitor new thread death
+*
+*  @lib SatServer
+*  @since Series 60 3.0
+*/
+class MThreadDeathNotifier
+    {
+    protected:  // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        MThreadDeathNotifier() {};
+
+        /**
+        * Destructor.
+        */
+        virtual ~MThreadDeathNotifier() {};
+
+    public: // New functions
+
+        /**
+        * Notifies Thread death monitor that thread is closing
+        */
+        virtual void NotifyThreadDeath() = 0;
+
+        /**
+        * Start monitoring thread's death
+        */
+        virtual void StartObservingThread() = 0;
+
+        /**
+        * Sets thread that is observered.
+        * @param aThreadId Thread which death should be observered
+        */
+        virtual void SetObserveredThread( TThreadId& aThread ) = 0;
+
+    private:
+
+        // Prohibit copy constructor if not deriving from CBase.
+        MThreadDeathNotifier( const MThreadDeathNotifier& );
+
+        // Prohibit assigment operator if not deriving from CBase.
+        MThreadDeathNotifier& operator=( const MThreadDeathNotifier& );
+
+    };
+
+#endif      // MTHREADDEATHNOTIFIER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/MThreadDeathObserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CSatSThreadDeathMonitor
+*
+*/
+
+
+
+#ifndef MTHREADDEATHOBSERVER_H
+#define MTHREADDEATHOBSERVER_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// CLASS DECLARATION
+
+/**
+*  Observer for CSatSThreadDeathObserver
+*
+*  @lib SatServer
+*  @since Series 60 2.6
+*/
+class MThreadDeathObserver
+    {
+    protected:  // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        MThreadDeathObserver() {};
+
+        /**
+        * Destructor.
+        */
+        virtual ~MThreadDeathObserver() {};
+
+    public: // New functions
+
+        /**
+        * Notification of observed thread death.
+        */
+        virtual void ThreadDiedL() = 0;
+
+        /**
+        * Notification of observed thread panic.
+        */
+        virtual void ThreadPanicedL() = 0;
+
+    private:
+
+        // Prohibit copy constructor if not deriving from CBase.
+        MThreadDeathObserver( const MThreadDeathObserver& );
+
+        // Prohibit assigment operator if not deriving from CBase.
+        MThreadDeathObserver& operator=( const MThreadDeathObserver& );
+
+    };
+
+#endif      // MTHREADDEATHOBSERVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/TSatBitOP.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,81 @@
+/*
+* 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:  Extracts a bits from byte row.
+*
+*/
+
+
+
+#ifndef TSATBITOP_H
+#define TSATBITOP_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// CLASS DECLARATION
+
+/**
+*  Bit manipulations
+*
+*  @lib SatEngine.lib
+*  @since 2.6
+*/
+class TSatBitOP
+    {
+    public: // New functions
+
+        /**
+        * Extracts bits from byte row.
+        * Following assumptions is made about parameters:
+        *  aBitCount is 1 to 8.
+        * @param aBitIndex Index to bit, where extraction starts. Index of
+        * MSB from aBytes[0] is 0.
+        * @param aBitCount Number of extracted bits.
+        * @param aBytes Array of bytes where bits are extracted.
+        * @return Value of extracted bits.
+        */
+        static TUint8 ExtractBits(
+            TInt aBitIndex,
+            TUint8 aBitCount,
+            const TDesC8& aBytes );
+
+        /**
+        * Creates a mask of ones, starting from aBitIndex
+        * to aBitIndex + aCount.
+        * if aMSB is 5 and aCount is 2 then the mask would be
+        * 0011 0000.
+        * @param aBitIndex. 0 means MSB and 7 is LSB.
+        * @param aCount 1 to 8.
+        * @return Mask.
+        */
+        static TUint8 CreateMask8Bit(
+            TUint8 aBitIndex,
+            TUint8 aCount );
+
+        /**
+        * Creates a mask of ones, starting from aBitIndex to aBitIndex +
+        * aCount.
+        * @param aBitIndex 0 means MSB and 15 means LSB.
+        * @param aCount 1 to 16.
+        * @return Mask of ones.
+        */
+        static TUint16 CreateMask16Bit(
+            TUint8 aBitIndex,
+            TUint8 aCount );
+
+    };
+
+#endif      // TSATBITOP_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/TSatChannelIDInfo.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,88 @@
+/*
+* 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:  Information class for Channel IDs.
+*
+*/
+
+
+#ifndef TSATCHANNELIDINFO_H
+#define TSATCHANNELIDINFO_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+// CLASS DECLARATION
+
+/**
+*  Container of Channel ID information
+*
+*  @lib SatEngine.lib
+*  @since Series 60 3.0
+*/
+class TSatChannelIdInfo
+    {
+    public:
+
+        /**
+        * Constructor.
+        * @param aChannelId Long version of channel ID
+        * @param aShort Short version of channel ID
+        */
+        TSatChannelIdInfo( TInt aChannelId, TUint8 aShort );
+
+        /**
+        * Returns long channel ID
+        * @return Long channel ID, range RSat::KChannel1-RSat::KChannel7
+        */
+        TInt ChannelId() const;
+
+        /**
+        * Returns short channel ID
+        * @return Short channel id, range 1-7
+        */
+        TUint8 ShortChannelId() const;
+
+        /**
+        * Indicates is this channel ID in use
+        * @return TBool indicating the availability of this channel ID
+        */
+        TBool IsReserved() const;
+
+        /**
+        * Reserves channel ID
+        */
+        void ReserveChannel();
+
+        /**
+        * Releases channel ID
+        */
+        void ReleaseChannel();
+
+    private:
+
+        // Long channel ID, range RSat::KChannel1 - RSat::KChannel7
+        TInt    iChannelId;
+
+        // Short channel ID, range 1 - 7
+        TUint8  iShortChannelId;
+
+        // Indicates is this channel in use of free
+        TBool   iActive;
+
+    };
+
+#endif      // TSATCHANNELIDINFO_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/TSatEventMediator.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 way to notify events and register observers
+*                for events
+*
+*/
+
+
+
+#ifndef TSATEVENTMEDIATOR_H
+#define TSATEVENTMEDIATOR_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class MSatEventObserver;
+class TSatEventsObserver;
+
+// CLASS DECLARATION
+
+/**
+*  Provides way to notify events and register observers for events.
+*  Observers are not owned by this class and therefore observers are
+*  not deleted when TSatEventMediator instance is destroyed.
+*
+*  @lib SatEngine.dll
+*  @since Series 60 3.0
+*/
+class TSatEventMediator
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        TSatEventMediator();
+
+    public: // New functions
+
+        /**
+        * Notifies possible observers who are observing the event.
+        * @param aEvent Integer identifying the event.
+        * @return None
+        */
+        void Notify( TInt aEvent );
+
+        /**
+        * Registers observer for event. Same observer will not be added
+        * more than once for one event.
+        * @param aObserver Pointer of observer instance. Panic will occur if
+        * aObserver is NULL.
+        * @param aEvent Event, which will cause the notification of observer.
+        * @return None
+        */
+        void RegisterL( MSatEventObserver* aObserver, TInt aEvent );
+
+        /**
+        * Unregisters the notification of single event.
+        * @param aObserver Observer, whom event registeration will be
+        * unregistered.
+        * @param aEvent Event, which will be unregistered.
+        * @return None
+        */
+        void Unregister( const MSatEventObserver* aObserver, TInt aEvent );
+
+        /**
+        * Unregisters the event observer.
+        * @param aObserver Observer, whom event registeration will be
+        * unregistered.
+        */
+        void Unregister( const MSatEventObserver* aObserver );
+
+        /**
+        * Resets the list of event observers. Used instead of destructor
+        */
+        void Reset();
+
+    private:  // New functions
+
+        /**
+        * Checks if aObserver is already in the list of observers.
+        * @param aObserver Observer that is checked from the list.
+        * @return Pointer of the observer, where aObserver is registered.
+        * Contains NULL pointer if aObserver is not already registered.
+        */
+        TSatEventsObserver* HasObserverInstance(
+            const MSatEventObserver* aObserver ) const;
+
+        /**
+        * Deletes all observers marked as deleted during notify loop
+        */
+        void DeleteMarkedObservers();
+
+    private:
+
+        // Prohibit copy constructor if not deriving from CBase.
+        TSatEventMediator( const TSatEventMediator& );
+
+        // Prohibit assigment operator if not deriving from CBase.
+        TSatEventMediator& operator=( const TSatEventMediator& );
+
+    private:    // Data
+
+        // event observers.
+        RPointerArray<TSatEventsObserver> iEventsObservers;
+
+        // Indicates are we notifying observers. If this flag is on,
+        // observers cannot be removed from iEventsObservers. After
+        // notify loop is done, observers can be replaced again
+        TBool iIsNotifying;
+
+        // Indicates are there any observers marked as deleted during
+        // Notify loop
+        TBool iDeletionsMarked;
+    };
+
+#endif      // TSATEVENTMEDIATOR_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/TSatEventsObserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,125 @@
+/*
+* 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:  Capsulates observer and its events
+*
+*/
+
+
+
+#ifndef TSATEVENTSOBSERVER_H
+#define TSATEVENTSOBSERVER_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// FORWARD DECLARATIONS
+class MSatEventObserver;
+
+// CLASS DECLARATION
+
+/**
+*  Capsulates observer and its events.
+*
+*  @lib SatEngine.dll
+*  @since Series 60 3.0
+*/
+class TSatEventsObserver
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        * @param aObserver Observer of events. Panic will occur if aObserver is
+        * NULL.
+        */
+        TSatEventsObserver( MSatEventObserver* aObserver );
+
+        /**
+        * Destructor.
+        */
+        virtual ~TSatEventsObserver();
+
+    public: // New functions
+
+        /**
+        * Adds event to be notified for the iObserver. Same event will
+        * added more than once.
+        * @param aEvent Source of notification for observer.
+        */
+        void AddEventL( TInt aEvent );
+
+        /**
+        * Removes the event from the observable events. If aEvent is not
+        * observable event, nothing is done.
+        * @param aEvent Source of notification for observer.
+        */
+        void RemoveEvent( TInt aEvent );
+
+        /**
+        * Checks if aEvent is already in the list of events.
+        * @param aEvent Event to be checked.
+        * @return ETrue if aEvent is in the list. Othervise EFalse.
+        */
+        TBool ObservingEvent( TInt aEvent ) const;
+
+        /**
+        * Gives the observer of the iEvents.
+        * @return Observer of the iEvents
+        */
+        MSatEventObserver* Observer();
+
+        /**
+        * Gives the number of events that has been added.
+        * @return Number of events.
+        */
+        TInt EventCount() const;
+
+        /**
+        * Marks this observer for delete
+        */
+        void MarkForDelete();
+
+        /**
+        * Indicates is this observer marked for delete
+        * @return True if marked for delete.
+        */
+        TBool IsMarkedForDelete() const;
+
+    private:
+
+        // Prohibit copy constructor if not deriving from CBase.
+        TSatEventsObserver( const TSatEventsObserver& );
+
+        // Prohibit assigment operator if not deriving from CBase.
+        TSatEventsObserver& operator=( const TSatEventsObserver& );
+
+    private:    // Data
+
+        // Events that iObserver is observing.
+        RArray<TInt> iEvents;
+
+        // Observer of events.
+        MSatEventObserver* iObserver;
+
+        // Indicates is this observer marked to be deleted.
+        // If observer is requested to delete while looping
+        // in Notify events, observer cannot be deleted, but when Notify
+        // loop is over, all observers marked as delete are deleted
+        TBool iMarkedForDelete;
+
+    };
+
+#endif      // TSATEVENTSOBSERVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/TSatQoSParser.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,134 @@
+/*
+* 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:  Maps QoS classes to correxponding Hex values
+*
+*/
+
+
+#ifndef TSATQOSPARSER_H
+#define TSATQOSPARSER_H
+
+#include <e32std.h>
+#include <etelsat.h>
+#include <etelqos.h>
+
+/**
+ *  Parses QoS Classes coming from SIM in open channel to corresponding 
+ *  values to use with RPacketQoS and vice versa.
+ *
+ *  Bearer params are in order:
+ *   0 = Precedence class
+ *   1 = Delay class
+ *   2 = Reliability class
+ *   3 = Peak throughput
+ *   4 = Mean throughput
+ *   (5 = protocol)
+ *
+ *
+ *  @lib SatEngine.lib
+ *  @since 3.0
+ */
+class TSatQoSParser
+    {
+    
+public:
+        
+    /**  Enum for Maximum bit rate */
+    enum TSatMaxBitRate
+        {
+        ESatMaxBitRateUnspecified = 0,
+        ESatMaxBitRate1 = 8,
+        ESatMaxBitRate2 = 16,
+        ESatMaxBitRate3 = 32,
+        ESatMaxBitRate4 = 64,
+        ESatMaxBitRate5 = 128,
+        ESatMaxBitRate6 = 256,
+        ESatMaxBitRate7 = 512,
+        ESatMaxBitRate8 = 1024,
+        ESatMaxBitRate9 = 2048,
+        };
+        
+    /**  Struct for converting QoS params */
+    struct TQoSRel5
+        {
+        TInt iTrafficClass;             // Traffic Class
+        TInt iTrafficHandlingPriority;  // Traffic handling priority
+        TInt iSduErrorRatio;            // SDU error ratio            
+        TInt iResidualBer;              // Residual bit error ratio
+        TInt iDeliveryErroneousSdu;     // Delivery of Erroneous SDUs
+        TInt iMaxBitRate;               // Maximum bitrate
+        TInt iMaximumSDUSize;           // Maximum SDU size
+        TInt iDeliveryOrder;            // Delivery Order
+        };
+
+// New functions
+        
+    /**
+     * Converts requested QoS classes to corresponding Hex values used
+     * by ETel Packet when requesting QoS parameters
+     * 
+     * @param aParams Requested QoS classes coming from SIM
+     * @param aResult Output QoS values in RPacketQoS::TQoSGPRSRequested
+     */
+    static void GetRequestedQoSValues(
+        RSat::TBearerParams& aParams, 
+        RPacketQoS::TQoSGPRSRequested& aResult);
+        
+    /**
+     * Converts negotiated QoS values to corresponding QoS class values used
+     * in OpenChannel terminal response.
+     * 
+     * @param aNegParams Negotiated QoS parameters
+     * @param aResult Output QoS class values in RSat::TBearerParams
+     */ 
+    static void GetNegotiatedQoSValues( 
+        const RPacketQoS::TQoSGPRSNegotiated& aNegParams, 
+        RSat::TBearerParams& aResult );
+        
+    /**
+     * Convert QoS parameters from Rel97/98 format to Rel5 format
+     * 
+     * @param aReqParams: Requested QoS parameters in Rel97/98 format
+     * @return QoS paramters in Rel5 format
+     */ 
+    static TQoSRel5 ConvertQoS( 
+        const RPacketQoS::TQoSGPRSRequested& aReqParams );
+            
+    /**
+     * Convert QoS parameters from Rel5 format to Rel97/98 format
+     * 
+     * @param aNegQoSRel5: Negotiated QoS parameters in Rel5 format
+     * @return Negotiated QoS paramters in Rel97/98 format
+     */ 
+    static RPacketQoS::TQoSGPRSNegotiated ConvertNegotiatedQoS( 
+        const TQoSRel5& aNegQoSRel5 );
+        
+private:
+
+// New functions
+        
+    /**
+     * Checks is requested index bigger than maximum lenght to prevent 
+     * array overflows
+     *
+     * @param aReqIndex Requested index
+     * @param aMaxIndex Last index, Requested cannot be bigger than this
+     * @param Retuns aReqIndex, if it's not bigger that aMaxIndex, else 0
+     */ 
+    static TInt CheckIndex( TInt aReqIndex, TInt aMaxIndex );
+    };
+
+#endif      // TSATQOSPARSER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/TUSatAPI.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,555 @@
+/*
+* 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:  Wrapper for USAT api.
+*
+*/
+
+
+
+#ifndef TUSATAPI_H
+#define TUSATAPI_H
+
+//  INCLUDES
+#include <etelsat.h>
+#include "MSatApi.h"
+
+// FORWARD DECLARATION
+class MSatMultiModeApi;
+class CSatSActiveWrapper;
+
+// CLASS DECLARATION
+
+/**
+*  Wrapper for USAT API.
+*
+*  @lib SatEngine.lib
+*  @since Series 60 3.0
+*/
+class TUSatAPI : public MSatApi
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        TUSatAPI();
+
+    public: // New functions
+
+        /**
+        * Connects to USat API.
+        * @param aPhone Reference to MSatMultiModeApi
+        * @return Error code indicating connection status
+        */
+        TInt Connect( MSatMultiModeApi& aPhone );
+
+        /**
+        * Closes the connection to USAT API.
+        */
+        void Close();
+
+    public: // From base classes
+
+        /**
+        * From MSatApi Issues notification for SetUpMenu command from USAT api.
+        * @param aStatus Request status
+        * @param aPCmd Command identifier
+        */
+        void NotifySetUpMenu(
+            TRequestStatus& aStatus,
+            TDes8& aPCmd );
+
+        /**
+        * From MSatApi Cancels SetUpMenu notification.
+        */
+        void NotifySetUpMenuCancel();
+
+        /**
+        * From MSatApi Issues notification for LanguageNotification command from USAT api.
+        * @param aStatus Request status
+        * @param aPCmd Command identifier
+        */
+        void NotifyLanguageNotification(
+            TRequestStatus& aStatus,
+            TDes8& aPCmd );
+
+        /**
+        * From MSatApi Cancels LanguageNotification notification.
+        */
+        void NotifyLanguageNotificationCancel();
+
+        /**
+        * From MSatApi Issues SetUpCall request
+        * @param aStatus Request status
+        * @param aPCmd Command identifier
+        */
+        void NotifySetUpCall(
+            TRequestStatus& aStatus,
+            TDes8& aPCmd );
+
+        /**
+        * From MSatApi Cancels the SetUpCall request
+        */
+        void NotifySetUpCallCancel();
+
+        /**
+        * From MSatApi Issues the SelectItem request.
+        * @param aStatus Request status
+        * @param aPCmd Command identifier
+        */
+        void NotifySelectItem(
+            TRequestStatus& aStatus,
+            TDes8& aPCmd );
+
+        /**
+        * From MSatApi Cancels the SelectItem request
+        */
+        void NotifySelectItemCancel();
+
+        /**
+        * From MSatApi.
+        * @param aStatus Request status
+        * @param aPCmd Command identifier
+        */
+        void NotifySendSm(
+            TRequestStatus& aStatus,
+            TDes8& aPCmd );
+
+        /**
+        * From MSatApi.
+        */
+        void NotifySendSmCancel();
+
+        /**
+        * From MSatApi
+        * @param aStatus Request status
+        * @param aData Data to be sent
+        * @param aMsgReference Reference to message
+        */
+        void SendMessageNoLogging(
+            TRequestStatus& aStatus,
+            TDes8& aData,
+            TUint16& aMsgReference ) ;
+
+        /**
+        * From MSatApi
+        */
+        void SendMessageNoLoggingCancel();
+
+        /**
+        * From MSatApi
+        * @param aStatus Request status
+        * @param aData Command identifier
+        */
+        void NotifyLaunchBrowser(
+            TRequestStatus& aStatus,
+            TDes8& aData );
+
+        /**
+        * From MSatApi
+        */
+        void NotifyLaunchBrowserCancel();
+
+        /**
+        * From MSatApi
+        * @param aStatus Request status
+        * @param aData Command identifier
+        */
+        void NotifyDisplayText(
+            TRequestStatus& aStatus,
+            TDes8& aData );
+
+        /**
+        * From MSatApi
+        */
+        void NotifyDisplayTextCancel();
+
+        /**
+        * From MSatApi
+        * @param aStatus Request status
+        * @param aData Command identifier
+        */
+        void NotifyGetInput(
+            TRequestStatus& aStatus,
+            TDes8& aData );
+
+        /**
+        * From MSatApi
+        */
+        void NotifyGetInputCancel();
+
+        /**
+        * From MSatApi
+        * @param aStatus Request status
+        * @param aData Command identifier
+        */
+        void NotifyGetInkey(
+            TRequestStatus& aStatus,
+            TDes8& aData );
+
+        /**
+        * From MSatApi
+        */
+        void NotifyGetInkeyCancel();
+
+        /**
+        * From MSatApi
+        * @param aStatus Request status
+        * @param aData Command identifier
+        */
+        void NotifyCallControl(
+            TRequestStatus& aStatus,
+            TDes8& aData );
+
+        /**
+        * From MSatApi
+        */
+        void NotifyCallControlCancel();
+
+        /**
+        * From MSatApi
+        * @param aStatus Request status
+        * @param aData Command identifier
+        */
+        void NotifyMoSmControl(
+            TRequestStatus& aStatus,
+            TDes8& aData );
+
+        /**
+        * From MSatApi
+        */
+        void NotifyMoSmControlCancel();
+
+        /**
+        * From MSatApi
+        * @param aStatus Request status
+        * @param aData Command identifier
+        */
+        void NotifySetUpEventList(
+            TRequestStatus& aStatus,
+            TDes8& aData );
+
+        /**
+        * From MSatApi
+        */
+        void NotifySetUpEventListCancel();
+
+        /**
+        * From MSatApi
+        * @param aStatus Request status
+        * @param aData Command identifier
+        */
+        void NotifySetUpIdleModeText(
+            TRequestStatus& aStatus,
+            TDes8& aData );
+
+        /**
+        * From MSatApi
+        */
+        void NotifySetUpIdleModeTextCancel();
+
+        /**
+        * From MSatApi
+        * @param aStatus Request status
+        * @param aData Command identifier
+        */
+        void NotifySendDtmf(
+            TRequestStatus& aStatus,
+            TDes8& aData );
+
+        /**
+        * From MSatApi
+        */
+        void NotifySendDtmfCancel();
+
+        /**
+        * From MSatApi
+        * @param aStatus Request status
+        * @param aData Command identifier
+        */
+        void NotifySendSs(
+            TRequestStatus& aStatus,
+            TDes8& aData );
+
+        /**
+        * From MSatApi
+        */
+        void NotifySendSsCancel();
+
+        /**
+        * From MSatApi
+        * @param aStatus Request status
+        * @param aData Command identifier
+        */
+        void NotifySendUssd(
+            TRequestStatus& aStatus,
+            TDes8& aData );
+
+        /**
+        * From MSatApi
+        */
+        void NotifySendUssdCancel();
+
+        /**
+        * From MSatApi
+        * @param aStatus Request status
+        * @param aData Command identifier
+        */
+        void NotifyPlayTone(
+            TRequestStatus& aStatus,
+            TDes8& aData );
+
+        /**
+        * From MSatApi
+        */
+        void NotifyPlayToneCancel();
+
+        /**
+        * From MSatApi
+        * @param aStatus Request status
+        * @param aData Command identifier
+        */
+        void NotifyRefreshRequired(
+            TRequestStatus& aStatus,
+            TDes8& aData );
+
+        /**
+        * From MSatApi
+        */
+        void NotifyRefreshRequiredCancel();
+
+        /**
+        * From MSatApi
+        * @param aPCkg Refresh required response package
+        */
+        void RefreshAllowed( const TDesC8& aPCkg );
+
+        /**
+        * From MSatApi
+        * @param aStatus Request status
+        * @param aData Command identifier
+        */
+        void NotifyRefresh(
+            TRequestStatus& aStatus,
+            TDes8& aData );
+
+        /**
+        * From MSatApi
+        */
+        void NotifyRefreshCancel();
+
+        /**
+        * From MSatApi Issues the SimSessionEnd request
+        * @param aStatus Request status
+        */
+        void NotifySimSessionEnd( TRequestStatus& aStatus );
+
+        /**
+        * From MSatApi Cancels the SimSessionEnd request
+        */
+        void NotifySimSessionEndCancel();
+
+        /**
+        * From MSatApi
+        * @param aStatus Request status
+        * @param aData Command identifier
+        */
+        void NotifyLocalInfo(
+            TRequestStatus& aStatus,
+            TDes8& aData );
+
+        /**
+        * From MSatApi
+        */
+        void NotifyLocalInfoCancel();
+
+        /**
+        * Issues the request
+        * @param aStatus Request status.
+        * @param aPCmd Command identifier and other relevant information
+        */
+        void NotifyOpenChannel(
+            TRequestStatus& aStatus,
+            TDes8& aPCmd );
+
+        /**
+        * Cancels the request
+        */
+        void NotifyOpenChannelCancel();
+
+        /**
+        * Issues the request
+        * @param aStatus Request status.
+        * @param aPCmd Command identifier and other relevant information
+        */
+        void NotifyCloseChannel(
+            TRequestStatus& aStatus,
+            TDes8& aPCmd );
+
+        /**
+        * Cancels the request
+        */
+        void NotifyCloseChannelCancel();
+
+        /**
+        * Issues the request
+        * @param aStatus Request status.
+        * @param aPCmd Command identifier and other relevant information
+        */
+        void NotifyGetChannelStatus(
+            TRequestStatus& aStatus,
+            TDes8& aPCmd );
+
+        /**
+        * Cancels the request
+        */
+        void NotifyGetChannelStatusCancel();
+
+        /**
+        * Issues the request
+        * @param aStatus Request status.
+        * @param aPCmd Command identifier and other relevant information
+        */
+        void NotifySendData(
+            TRequestStatus& aStatus,
+            TDes8& aPCmd );
+
+        /**
+        * Cancels the request
+        */
+        void NotifySendDataCancel();
+
+        /**
+        * Issues the request
+        * @param aStatus Request status.
+        * @param aPCmd Command identifier and other relevant information
+        */
+        void NotifyReceiveData(
+            TRequestStatus& aStatus,
+            TDes8& aPCmd );
+
+        /**
+        * Cancels the request
+        */
+        void NotifyReceiveDataCancel();
+
+        /**
+        * From MSatApi Sends menu selection to SIM.
+        * @param aMenuSelection Selected menu item
+        */
+        void SendMenuSelection( const TDes8& aMenuSelection );
+
+        /**
+        * From MSatApi Sends terminal rsp to SIM.
+        * @param aPCmd Command identifier
+        * @param aPCkg Terminal response package
+        */
+        void TerminalRsp(
+            RSat::TPCmd aPCmd,
+            const TDesC8& aPCkg );
+
+        /**
+        * From MSatApi. Gets the icon info from SIM.
+        * @param aReqStatus Request status.
+        * @param aRecordNumber Specifies the EF_IMG in SIM.
+        * @param aIconEf Contains the icon informations from SIM in returning
+        * of the method.
+        */
+        void GetIcon(
+            TRequestStatus& aReqStatus,
+            TUint8 aRecordNumber,
+            RSat::TIcon& aIconEf );
+
+        /**
+        * From MSatApi. Gets the icon image.
+        * @param aReqStatus Request status.
+        * @param aInstanceInfo Informatio of the icon, which data is
+        * fetched from SIM.
+        * @param aInstance Contains the icon data from SIM in returning of the
+        * method.
+        */
+        void GetImageInstance(
+            TRequestStatus& aReqStatus,
+            const TDesC8& aInstanceInfo,
+            TDes8& aInstance );
+
+        /**
+        * From MSatApi. Gets color lookup table of the icon.
+        * @param aReqStatus Request status.
+        * @param aInstanceNumber Image instance number.
+        * @param aOffset Offset of the clut.
+        * @param aClut Contains the Clut of the icon in returning of the
+        * method.
+        */
+        void GetClut(
+            TRequestStatus& aReqStatus,
+            TUint aInstanceNumber,
+            TUint aOffset,
+            TDes8& aClut );
+
+        /**
+        * From MSatApi Sends notify to SIM about some event using EventDownload.
+        * @param aReqStatus Request status.
+        * @param aSingleEvent Single event reported to SIM.
+        * @param aEventInfo Contains information of an event.
+        */
+        void EventDownload(
+            TRequestStatus& aReqStatus,
+            RSat::TEventList aSingleEvent,
+            const TDesC8& aEventInfo );
+
+        /**
+        * From MSatApi Indicates is RSat connected
+        * @return ETrue if RSat is connected
+        */
+        TBool IsRSatConnected() const;
+        
+        /**
+        * From MSatApi Called when all supported notifies are sent
+        * @return error code from RSat::UsatClientReadyIndication()
+        */
+        TInt UsatClientReadyIndication();
+        
+        /**
+        * From CActive
+        */
+        void RunL();
+        
+        /**
+        * From CActive
+        */
+        void DoCancel();
+        
+    private:
+
+        // Prohibit copy constructor if not deriving from CBase.
+        TUSatAPI( const TUSatAPI& );
+
+        // Prohibit assigment operator if not deriving from CBase.
+        TUSatAPI& operator=( const TUSatAPI& );
+
+    private:    // Data
+
+        // (U)SAT interface handler
+        RSat iSat;
+        // Indicates is RSat connected or not
+        TBool iRSatConnected;
+        // Active object wrapper for wait loops and asynhcronous function calls
+        CSatSActiveWrapper* iWrapper;
+
+    };
+
+#endif      // TUSATAPI_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/csatbipconnectionobserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,87 @@
+/*
+* 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 status of the GPRS connection
+*
+*/
+
+
+
+#ifndef CSATBIPCONNECTIONOBSERVER_H
+#define CSATBIPCONNECTIONOBSERVER_H
+
+
+#include    "CSatBIPUtils.h"
+
+
+/**
+ *  Observes the GPRS network status and stores current value.
+ *
+ *  @lib SatEngine.lib
+ *  @since Series 60 3.0
+ */
+class CSatBIPConnectionObserver : public CActive
+    {
+public:
+
+    /**
+     * Default constructor.
+     * @param aBipUtils Reference to BIP utils class.
+     */
+    CSatBIPConnectionObserver( CSatBIPUtils& aBipUtils );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CSatBIPConnectionObserver();
+
+    /**
+     * From CActive. Connection status changed
+     */
+    void RunL();
+
+    /**
+     * From CActive. Cancels any outgoing requests
+     */
+    void DoCancel();
+
+    /**
+     * Starts observing the connection status
+     */
+    void StartObserver();
+
+    /**
+     * Current status of the GPRS sefvice
+     * @return Current status of the GPRS service
+     */
+    RPacketService::TStatus Status() const;
+
+private:
+
+    /**
+     * Reference to CSatBIPUtils class.
+     */
+    CSatBIPUtils& iBipUtils;
+
+    /**
+     * Current status of the GPRS network
+     */
+    RPacketService::TStatus iConnectionStatus;
+
+    /**
+     * Last status of the GPRS network
+     */
+    RPacketService::TStatus iPrevConnectionStatus;
+    };
+
+#endif      // CSATBIPCONNECTIONOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/csatbipsubconneventobserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,102 @@
+/*
+* 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 of Subconnection parameters granted event
+*
+*/
+
+
+#ifndef CSATBIPSUBCONNEVENTOBSERVER_H
+#define CSATBIPSUBCONNEVENTOBSERVER_H
+
+//  INCLUDES
+#include    <e32base.h>
+#include    <es_sock.h>
+
+class   CSatBIPGPRSDataChannel;
+
+// CLASS DECLARATION
+
+/**
+ *  CSatBIPSubConnEventObserver
+ *
+ *  Observe the SubConnection parameters granted event
+ *
+ *  @lib SatEngine.lib
+ *  @since Series 60 3.2
+ */
+NONSHARABLE_CLASS( CSatBIPSubConnEventObserver ): public CActive
+    {
+public:
+// Constructor and destructor
+
+    /**
+     * Default constructor.
+     *
+     * @since S60 3.2
+     * @param aObserver GPRS data channel, which responsible for fetch negQoS 
+     *                  from SubConnection parameters granted event
+     */
+    CSatBIPSubConnEventObserver( CSatBIPGPRSDataChannel& aObserver );
+    
+    /**
+     * Destructor
+     *
+     * @since S60 3.2
+     */
+    virtual ~CSatBIPSubConnEventObserver();
+        
+// New functions
+
+    /**
+     * Starts observing granted event
+     */
+   void StartObservSubConnEvent();
+
+// From base class CActive
+
+    /**
+     * From CActive. Informs observer that granted event has been received.
+     *
+     * @since S60 3.2
+     */
+    void RunL();
+
+    /**
+     * From CActive. Cancels any outgoing requests
+     *
+     * @since S60 3.2
+     */
+    void DoCancel();
+
+private: // Data
+         
+    /**
+     * EventFilter for subconnection
+     */
+    RSubConnection::TEventFilter iEventFilter;
+        
+    /**
+     * Buffer for Sub-connection event notiifcation
+     */
+    TNotificationEventBuf iEventBuffer;
+        
+    /**
+     * Reference to class CSatBIPGPRSDataChannel.
+     * Not own.
+     */
+    CSatBIPGPRSDataChannel& iDataChannel;
+    };
+
+#endif      // CSATBIPSUBCONNEVENTOBSERVER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/csatmediatoreventprovider.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,100 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Provides events to mediator event consumer.
+*
+*/
+
+
+
+#ifndef C_CSATMEDIATOREVENTPROVIDER_H
+#define C_CSATMEDIATOREVENTPROVIDER_H
+
+
+#include <e32base.h>
+
+#include "msatmediatoreventprovider.h"
+
+class CMediatorEventProvider;
+
+/**
+ *  Mediator event provider
+ *
+ *  Provides SAT mediator events to mediator event consumer ( CoverUi )
+ *
+ *  @lib SatEngine
+ *  @since S60 v3.1
+ */
+class CSatMediatorEventProvider : public CBase,
+                                  public MSatMediatorEventProvider
+    {
+public:  
+
+    static CSatMediatorEventProvider* NewL();
+
+    virtual ~CSatMediatorEventProvider();
+
+// from base class MSatMediatorEventProvider
+
+    /**
+     * From MSatMediatorEventProvider.
+     * Raises SAT mediator event 
+     *
+     * @since S60 v3.1
+     * @param const TDesC8& ontains packaged data to mediator event consumer
+     */
+    TInt RaiseSatEvent( const TDesC8& aData );
+
+    /**
+     * From MSatMediatorEventProvider.
+     * Checks if Cover UI is supported by SAT
+     *
+     * @since S60 v3.1
+     * @return ETrue if Cover UI is supported
+     */        
+    TBool CoverUiSupported();
+
+private:
+
+    CSatMediatorEventProvider();
+
+    void ConstructL();
+        
+    /**
+     * Internal check for Cover Ui support
+     * Checks if Cover UI is supported by SAT and stores the result 
+     *
+     * @since S60 v3.1
+     */
+    void CUiSupportedL();
+
+private: // data
+    
+    /**
+     * are mediator events registered
+     */
+    TBool iRegistered;
+    
+    /**
+     * is cover UI supported
+     */
+    TBool iCoverUiSupported;
+    
+    /**
+     * pointer to Mediator client
+     * Own.
+     */    
+    CMediatorEventProvider* iEventProvider;
+        
+    };
+#endif // C_CSATMEDIATOREVENTPROVIDER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/csatmultimodeapi.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,290 @@
+/*
+* 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:  Encapsule the access to ETel MM API in sat
+*
+*/
+
+
+#ifndef CSATMULTIMODEAPI_H
+#define CSATMULTIMODEAPI_H
+
+#include <e32base.h>
+#include "msatmultimodeapi.h"
+
+class CSatSActiveWrapper;
+
+/**
+ *  Encapsule the access to ETel MM API in sat
+ *  
+ *  This class is an active object. It will submit
+ *  Etel asynchronous request and wait for response.
+ *  Clients for this class will implement the interface
+ *  in MSatETelClient which is the callback function
+ *  when CSatMultiModeApi get the ETel request response.
+ *
+ *  @lib satengine.lib
+ *  @since S60 v5.0
+ */
+class CSatMultiModeApi : public CBase,
+                         public MSatMultiModeApi
+    {
+
+public:
+    /**
+    * Two-phased constructor.
+    */
+    static CSatMultiModeApi* NewL();
+
+    /**
+    * Destructor
+    */
+    virtual ~CSatMultiModeApi();
+
+// from base class MSatMultiModeApi
+    
+    /**
+     * Gives pointer to active RMobilePhone session
+     *
+     * @return pointer to active RMobilePhone server session
+     */
+    RMobilePhone* Phone();
+
+    /**
+     * Gives reference to active Dummy RMobilePhone session
+     *
+     * @return Reference to active Dummy RMobilePhone server session
+     */
+    RMobilePhone* DummyPhone();
+
+    /**
+     * Gives pointer to active RMmCustomApi session
+     *
+     * @return pointer to active RMmCustomApi server session
+     */
+    RMmCustomAPI* CustomApi();
+
+    /**
+     * Lowers error granularity to basic errors
+     */
+    void LowerErrorGranularity();
+
+    /**
+     * Raises error granularity to extended errors
+     */
+    void RaiseErrorGranularity();
+
+    /**
+     * Access RMobilePhone::GetNetworkRegistrationStatus
+     * for the paramter information please see the etelmm.h
+     */
+    void GetNetworkRegistrationStatus( TRequestStatus& aReqStatus, 
+            RMobilePhone::TMobilePhoneRegistrationStatus& aStatus );
+    
+    /**
+     * Access RMobilePhone::NotifyNetworkRegistrationStatusChange
+     * for the paramter information please see the etelmm.h
+     */ 
+    void NotifyNetworkRegistrationStatusChange( TRequestStatus& aReqStatus,
+            RMobilePhone::TMobilePhoneRegistrationStatus& aStatus );
+
+    /**
+     * Access RMobilePhone::NotifyNetworkRegistrationStatusChange
+     * for the paramter information please see the etelmm.h
+     */ 
+    void GetSubscriberId( TRequestStatus& aReqStatus, 
+            RMobilePhone::TMobilePhoneSubscriberId& aId );
+
+    /**
+     * Access RMobilePhone::SendDTMFTones
+     * for the paramter information please see the etelmm.h
+     */ 
+    void SendDTMFTones( TRequestStatus& aReqStatus, const TDesC& aTones);   
+    
+    /**
+     * Access RMobilePhone::ContinueDTMFStringSending
+     * for the paramter information please see the etelmm.h
+     */ 
+    TInt ContinueDTMFStringSending( TBool aContinue );
+    
+    /**
+     * Access RMobilePhone::CancelAsyncRequest
+     * for the paramter information please see the etelmm.h
+     */
+    void CancelAsyncRequest(TInt aReqToCancel);
+
+    /**
+     * Access RMobilePhone::SendNetworkServiceRequestNoFdnCheck
+     * for the paramter information please see the etelmm.h
+     */
+    void SendNetworkServiceRequestNoFdnCheck( TRequestStatus& aReqStatus, 
+            const TDesC& aServiceString);
+        
+    /**
+     * Access RMobileCall::DialNoFdnCheck
+     * for the paramter information please see the etelmm.h
+     */
+    void DialNoFdnCheck( TRequestStatus& aStatus,
+            const TDesC8& aCallParams,const TDesC& aTelNumber );
+                                                        
+    /**
+     * Access RMobileUssdMessaging::SendMessageNoFdnCheck
+     * for the paramter information please see the etelmm.h
+     */
+    void SendMessageNoFdnCheck( TRequestStatus& aReqStatus,
+            const TDesC8& aMsgData, const TDesC8& aMsgAttributes );
+    /**
+     * Access RMobileCall::DialCancel
+     */
+    void DialCancel();
+
+    /**
+     * Check if there is an incoming call 
+     * @return ETrue if there is an incoming call
+     */
+    TBool IsCallIncoming();
+    
+    /**
+     * Access RMobileCall::NotifyMobileCallStatusChange
+     */
+    void NotifyMobileCallStatusChange( TRequestStatus& aReqStatus,
+                    RMobileCall::TMobileCallStatus& aStatus) ; 
+
+    /**
+     * Access RMobileCall::NotifyStatusChangeCancel
+     */
+    void NotifyCallStatusChangeCancel();
+    /**
+     * Access RMobilePhone::TerminateActiveCalls NotifyMobileCallStatusChange
+     */
+    void TerminateActiveCalls(TRequestStatus& aReqStatus);
+
+    
+    /**
+     * Access RMboileCall::GetMobileCallInfo
+     */
+    TInt GetMobileCallInfo(TDes8& aCallInfo);
+    
+    /**
+     * Access RMboileCall::DialEmergencyCall
+     */
+    virtual void DialEmergencyCall(TRequestStatus& aReqStatus, 
+                const TDesC& aNumber);
+            
+private:
+
+    /**
+    * Default C++ constructor
+    */
+    CSatMultiModeApi();
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL();
+    
+// New functions
+    /**
+     * Makes the connections to ETel Server
+     */
+    void ConnectETelServerL();
+
+    /**
+     * Loads and opens phone module
+     *
+     * @param aPhone reference to phone that is loaded
+     * @param aModuleName Name of the phone module
+     * @param aPhoneName Name of the phone
+     */
+    void LoadPhoneModuleL( RMobilePhone& aPhone, const TDesC& aModuleName,
+            const TDesC& aPhoneName );
+
+    /**
+     * Open the RMobileUssdMessaging
+     */ 
+    void LoadUssdMessagingL();
+    
+    /**
+     * Open the RMobileCall
+     */
+    TInt LoadMobileCall();
+    
+
+private: // data
+
+    /**
+     * The Etel server.
+     * Own
+     */
+    RTelServer iTelServer;
+
+    /**
+     * Used to access phone based functionality
+     * Own
+     */
+    RMobilePhone iPhone;
+
+    /**
+     * Phone module for Dummy TSY
+     * Own
+     */
+    RMobilePhone iDummyPhone;
+
+    /**
+     * RMmCustomAPI
+     * Own
+     */
+    RMmCustomAPI iCustomPhone;
+    
+    /**
+     * Line needed by iCall
+     * own
+     */
+    RMobileLine iLine;
+    
+    /**
+     * Access call based functionality
+     * own
+     */
+    RMobileCall iCall;
+    
+    /**
+     * Access USSD Messaging
+     * own
+     */
+    RMobileUssdMessaging iUssd;
+
+    /**
+     * Pointer to Active Wrapper. Used in startup
+     * Own.
+     */
+    CSatSActiveWrapper* iWrapper;
+    
+    /**
+     * Indicate if the iLine has been openned
+     */
+    TBool iLineOpened;
+
+    /**
+     * Indicate if the iCall has been openned
+     */
+    TBool iCallOpened;
+    
+    /**
+     * Indicate if the iUssd has been openned
+     */
+    TBool iUssdOpened;
+    
+    };
+
+#endif // CSATMULTIMODEAPI_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/inc/csatprofilechangeobserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,94 @@
+/*
+* 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:  Observes Profile state changes.
+*
+*/
+
+
+
+#ifndef CSATPROFILECHANGEOBSERVER_H
+#define CSATPROFILECHANGEOBSERVER_H
+
+#include <e32base.h>
+#include "MSatSystemStateObserver.h"
+
+class MSatSystemStateChangeNotifier;
+class MSatUtils;
+
+
+/**
+ *  Observes Profile status change and informs CSatCommandContainer
+ *  of a possible change.
+ *
+ *  @lib SatEngine
+ *  @since S60 3.0
+ */
+class CSatProfileChangeObserver : public CBase,
+                                  public MSatSystemStateObserver
+    {
+public:  
+
+    /**
+     * Two-phased constructor.
+     * @param aUtils Utils inteface
+     */
+    static CSatProfileChangeObserver* NewL( MSatUtils& aUtils );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CSatProfileChangeObserver();
+
+
+    /**
+     * From MSatSystemStateObserver Notifies that system state changed.
+     *
+     * @since S60 v3.0
+     * @param aValue The new value that has changed.
+     */
+    void StateChanged( const TInt aValue );
+
+private:
+
+    /**
+     * C++ default constructor.
+     * @param aUtils Utils inteface
+     */
+    CSatProfileChangeObserver( MSatUtils& aUtils );
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+private:  // Data
+
+    /**
+     * Reference to command container.
+     */
+    MSatUtils& iUtils;    
+
+    /**
+     * System state notifier.
+     */
+    MSatSystemStateChangeNotifier* iStateNotifier;
+
+
+    /**
+     * Stores the previous profile state.
+     */
+    TBool iPreviousProfile;     
+    };
+    
+#endif // CSATPROFILECHANGEOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/CSatApnHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,461 @@
+/*
+* 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:  Handles APN operations
+*
+*/
+
+// INCLUDE FILES
+#include <cmmanager.h>
+#include <cmmanagerext.h>
+#include <cmconnectionmethod.h>
+#include <cmconnectionmethodext.h>
+#include <cmconnectionmethoddef.h>
+#include <cmpluginpacketdatadef.h>
+#include <cmdestination.h>
+#include <cmmanagerdef.h>
+
+#include    "MSatUtils.h"
+#include    "CSatApnHandler.h"
+#include    "SatLog.h"
+
+const TUint32 KSatCMGranularity( 5 );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSatApnHandler::CSatApnHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatApnHandler::CSatApnHandler( MSatUtils& aUtils ) :
+    iUtils( aUtils )
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatApnHandler::CSatApnHandler calling-exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatApnHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatApnHandler* CSatApnHandler::NewL( MSatUtils& aUtils )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatApnHandler::NewL calling" )
+
+    CSatApnHandler* self = new( ELeave )CSatApnHandler( aUtils );
+    LOG( SIMPLE, "SATENGINE: CSatApnHandler::NewL exiting" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatApnHandler::Destructor
+// -----------------------------------------------------------------------------
+//
+CSatApnHandler::~CSatApnHandler()
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatApnHandler::~CSatApnHandler calling" )
+    LOG( SIMPLE,
+        "SATENGINE: CSatApnHandler::~CSatApnHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatApnHandler::GetApnInfoL
+// -----------------------------------------------------------------------------
+//
+void CSatApnHandler::GetApnInfoL(
+    const RSat::TAccessName& aName,
+    const RSat::TTextString& aUserLogin,
+    const RSat::TTextString& aUserPwd,
+    TUint32& aIapId,
+    TUint32& aNwId,
+    TBool& aApnCreated,
+    const RPacketContext::TProtocolType& aPdpType,
+    const TDesC8& aLocalAddress )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatApnHandler::GetApnInfoL calling" )
+
+
+    // First check the length of the APN
+    if ( !aName.Length() )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatApnHandler::GetApnInfoL \
+        aName.Length() == 0" )
+        User::Leave( KErrNotFound );
+        }
+
+    // Format APN
+    HBufC* formatName = FormatAPN( aName );
+
+    if ( !formatName )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatApnHandler::GetApnInfoL wrong APN name \
+            format" )
+        // APN was in false format, leave
+        User::Leave( KErrArgument );
+        }
+    CleanupStack::PushL( formatName );
+
+    // Reference params
+    TUint32 iapId( 0 );
+    TUint32 networkId( 0 );
+
+    // Find if the connection method already exists 
+    // Initialize the flags
+    TBool found = EFalse;
+    aApnCreated = EFalse;
+
+    // Create CMManager Session
+    RCmManager cmManager;
+    cmManager.OpenLC();
+
+    // Get the Connection Method list from the open CMManager session
+    RArray<TUint32> array = RArray<TUint32>( KSatCMGranularity );
+    CleanupClosePushL( array );
+
+    cmManager.ConnectionMethodL( array );
+    
+    // Go through the Connection Method list to find if there is matched one
+    HBufC* apnCM;
+
+    LOG2( SIMPLE, "SATENGINE: CSatApnHandler::GetApnInfoL, \
+                   required pdp type is %d", aPdpType )
+
+    for( TInt i = 0; ( i < array.Count() ) && !found; ++i )
+        {
+        RCmConnectionMethod cm = cmManager.ConnectionMethodL( array[i] );
+        
+        CleanupClosePushL( cm );
+        // query the APN of the Connection Method
+        apnCM = cm.GetStringAttributeL( CMManager::EPacketDataAPName );
+        CleanupStack::PushL( apnCM );
+        // query the pdpType of the Connection Method
+        TInt pdpType = cm.GetIntAttributeL( CMManager::EPacketDataPDPType );
+
+        
+        if ( ( pdpType == aPdpType ) && ( *apnCM == *formatName ) )
+            {
+            // Found the Connection Method, query the IapId and NwId
+            LOG( SIMPLE, "SATENGINE: CSatApnHandler::GetApnInfoL, \
+                          Record found" )
+
+            // Get IAP Id, Network Id
+            networkId = cm.GetIntAttributeL( CMManager::ECmNetworkId );
+            LOG2( SIMPLE, "SATENGINE: CSatApnHandler::GetApnInfoL, \
+                           networkId %d", networkId ) 
+            
+            iapId = cm.GetIntAttributeL( CMManager::ECmIapId );
+            LOG2( SIMPLE, "SATENGINE: CSatApnHandler::GetApnInfoL, \
+                           iapId %d", iapId )
+    
+            found = ETrue;
+            }
+        CleanupStack::PopAndDestroy( apnCM );
+        CleanupStack::PopAndDestroy( &cm );    
+        }        
+ 
+    CleanupStack::PopAndDestroy( &array );
+
+    if ( !found )
+        {
+        // No Connection Method found, insert a new one
+    
+        LOG( SIMPLE, "SATENGINE: CSatApnHandler::GetApnInfoL, \
+                      Record Not found, insert a new one" )
+        
+        TRAPD( insertError, InsertRecordL( *formatName, aUserLogin, 
+               aUserPwd, iapId, networkId, aPdpType, aLocalAddress ) )
+
+        if ( KErrNone == insertError )
+            {
+            // Insert OK
+            LOG( NORMAL, "SATENGINE: CSatApnHandler::GetApnInfoL, \
+                          new record inserted" )
+            aApnCreated = ETrue;
+            }
+        }
+    
+    CleanupStack::PopAndDestroy( &cmManager );
+    CleanupStack::PopAndDestroy( formatName );
+
+    // Set return values
+    aIapId = iapId;
+    aNwId = networkId;
+
+    LOG( SIMPLE, "SATENGINE: CSatApnHandler::GetApnInfoL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatApnHandler::DeleteApnL
+// -----------------------------------------------------------------------------
+//
+void CSatApnHandler::DeleteApnL( TUint32 aApnId )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatApnHandler::DeleteApnL calling" )
+
+    if ( aApnId )
+        { 
+        // Create CMManager Session
+        RCmManagerExt cmManager;
+        cmManager.OpenLC();
+        
+        // Get the connection method
+        RCmConnectionMethodExt cm;
+        cm = cmManager.ConnectionMethodL( aApnId );
+        CleanupClosePushL( cm );
+
+        cm.DeleteL();
+        LOG2( SIMPLE, "SATENGINE: CSatApnHandler::DeleteApnL, \
+                       delete the connection method %d", aApnId )
+
+        CleanupStack::PopAndDestroy( &cm );
+        CleanupStack::PopAndDestroy( &cmManager );
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatApnHandler::DeleteApnL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatApnHandler::InsertRecordL
+// -----------------------------------------------------------------------------
+//
+void CSatApnHandler::InsertRecordL(
+    const TDesC& aReqApn,
+    const RSat::TTextString& aUserLogin,
+    const RSat::TTextString& aUserPwd,
+    TUint32& aIapId,
+    TUint32& aNwId,
+    const RPacketContext::TProtocolType aPdpType,
+    const TDesC8& aLocalAddress )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatApnHandler::InsertRecordL calling" )
+
+    LOG2( NORMAL, "SATENGINE: CSatApnHandler::InsertRecordL, apn is %S", 
+        &aReqApn )
+    
+    // Create CMManager Session
+    RCmManagerExt cmManager;
+    cmManager.OpenLC();
+
+    // Create a connection method without destination. So when we can find 
+    // the connection method by going through the connection method list.
+    RCmConnectionMethodExt cm;
+    cm = cmManager.CreateConnectionMethodL( KUidPacketDataBearerType );
+    CleanupClosePushL( cm );
+    
+    // This is shown in GS in Access Point list
+    cm.SetStringAttributeL( CMManager::ECmName, iUtils.BipApnName() );    
+    // GPRS connection name
+    cm.SetStringAttributeL( CMManager::EPacketDataAPName, aReqApn );   
+    // IPv4 or IPv6
+    cm.SetIntAttributeL( CMManager::EPacketDataPDPType, aPdpType );
+
+    // Set the local IP address (if any)
+    if ( aLocalAddress.Length() )
+        {
+        LOG2( SIMPLE, "SATENGINE: CSatApnHandler::InsertRecordL, Local addr \
+            length: %i", aLocalAddress.Length() )
+        cm.SetString8AttributeL( CMManager::EPacketDataPDPAddress, 
+            aLocalAddress );
+        }
+
+    cm.SetBoolAttributeL( CMManager::ECmWapIPSecurity, EFalse );
+    cm.SetIntAttributeL( CMManager::ECmWapIPWSPOption, 
+                         CMManager::ECmWapWspOptionConnectionOriented );
+    cm.SetBoolAttributeL( CMManager::EPacketDataDisablePlainTextAuth, EFalse );
+    cm.SetBoolAttributeL( CMManager::ECmIFPromptForAuth, EFalse );
+
+    if ( aUserLogin != KNullDesC )
+        {
+        LOG2( NORMAL, "SATENGINE: CSatApnHandler::InsertRecordL, \
+            username is %S", &aUserLogin ) 
+        cm.SetStringAttributeL( CMManager::ECmIFAuthName, aUserLogin );
+
+        if ( aUserPwd != KNullDesC )
+            {
+            LOG2( NORMAL, "SATENGINE: CSatApnHandler::InsertRecordL, \
+                pwd is %S", &aUserPwd ) 
+            cm.SetStringAttributeL( CMManager::ECmIFAuthPass, aUserPwd );
+            }
+        }
+    
+    // Update the access point ID for use later.
+    cm.UpdateL();
+
+    // Get IAP Id, Network Id
+    aNwId = cm.GetIntAttributeL( CMManager::ECmNetworkId );
+    LOG2( SIMPLE, "SATENGINE: CSatApnHandler::InsertRecordL, \
+                   Nwid is %d", aNwId ) 
+    
+    aIapId = cm.GetIntAttributeL( CMManager::ECmIapId );
+    LOG2( SIMPLE, "SATENGINE: CSatApnHandler::InsertRecordL, \
+                   aIpId is %d", aIapId )
+
+    CleanupStack::PopAndDestroy( &cm );
+    CleanupStack::PopAndDestroy( &cmManager );
+
+    LOG( SIMPLE, "SATENGINE: CSatApnHandler::InsertRecordL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatApnHandler::FormatAPN
+// -----------------------------------------------------------------------------
+//
+HBufC* CSatApnHandler::FormatAPN( const RSat::TAccessName& 
+    aReqApn ) const
+    {
+    LOG( SIMPLE, "SATENGINE: CSatApnHandler::FormatAPN calling" )
+
+    // Length of the access point name
+    const TInt accessNameLength( aReqApn.Length() );
+    TInt index( 0 );
+
+    // Format APN coming from SIM. Remove length infos and add dots
+    // from the requested APN. The APN format is, for example,
+    // '4Some9accesspnt2fi' and after the format the formatted APN
+    // should be 'Some.accesspnt.fi'
+    HBufC* formatApnName = HBufC::New( aReqApn.MaxLength() );
+
+    if ( formatApnName )
+        {
+        TPtr formApn( formatApnName->Des() );
+
+        // Indicates is the APN format correct. Can be detected only in loops.
+        TBool correctFormat( ETrue );
+
+        // Loop requested APN. The first byte is always the length
+        for ( index = 0; index < accessNameLength && correctFormat; index++ )
+            {
+            // Next byte is the length of the next label
+            const TInt length( aReqApn[index] );
+
+            // Label length cannot be bigger than the length of the APN
+            if ( ( index + length ) > accessNameLength )
+                {
+                LOG( SIMPLE, "SATENGINE: CSatApnHandler::FormatAPN \
+                ( index + length ) > accessNameLength" )
+                correctFormat = EFalse;
+                }
+
+            // Append the label
+            for ( TInt j = 0; j < length && correctFormat; j++ )
+                {
+                index++; // move to next index
+                TChar next = aReqApn[index];
+                formApn.Append( next );
+                }
+
+            // Add dot to APN if not end of APN
+            if ( accessNameLength > index + 1 )
+                {
+                LOG( SIMPLE, "SATENGINE: CSatApnHandler::FormatAPN \
+                accessNameLength > index + 1" )
+                formApn.Append( '.' );
+                }
+            }
+        LOG2( SIMPLE, "SATENGINE: CSatApnHandler::FormatAPN index: %i", index )
+
+        // Check did we read all characters
+        if ( !correctFormat || ( index != accessNameLength ) )
+            {
+            // Format was not correct, return zero
+            formApn.Zero();
+            formApn.SetLength( 0 );
+            }
+        else
+            {
+            LOG( SIMPLE, "SATENGINE: CSatApnHandler::FormatAPN lower case" )
+            // Put characters to lower case
+            formApn.LowerCase();
+            }
+
+        LOG( SIMPLE, "SATENGINE: CSatApnHandler::FormatAPN exiting" )
+        }
+
+    return formatApnName;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatApnHandler::FindDefaultApL
+// -----------------------------------------------------------------------------
+//
+TUint32 CSatApnHandler::FindDefaultApL(
+        const RPacketContext::TProtocolType& aPdpType )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatApnHandler::FindDefaultApL calling" );
+    TUint32 defaultIap( 0 );
+    TInt pdpType;
+    TBool isFound( EFalse );
+
+    // create a network destination
+    RCmDestination des;
+    RCmConnectionMethod cm;
+
+    // Create CMManager Session
+    RCmManager cmManager;
+    cmManager.OpenL();
+    CleanupClosePushL( cmManager );
+
+    // Get the Connection Method list from the open CMManager session
+    RArray<TUint32> array( KSatCMGranularity );
+    CleanupClosePushL( array );
+
+    // list all available destinations' id
+    cmManager.AllDestinationsL( array );
+    for( TInt i = 0; ( i < array.Count() ) && !isFound; ++i )
+        {
+        des = cmManager.DestinationL( array[i] );
+        CleanupClosePushL( des );
+
+        if ( CMManager::ESnapPurposeInternet ==
+        des.MetadataL( CMManager::ESnapMetadataPurpose ) )
+            {
+            LOG( SIMPLE, "SATENGINE: CSatApnHandler::FindDefaultApL \
+            the fixed destination is identified as 'Internet'" );
+            for( TInt j = 0; ( j < des.ConnectionMethodCount() ) &&
+            !isFound; ++j )
+                {
+                cm = des.ConnectionMethodL( j );
+                CleanupClosePushL( cm );
+                pdpType = cm.GetIntAttributeL(
+                        CMManager::EPacketDataPDPType );
+                LOG2( SIMPLE, "SATENGINE: CSatApnHandler::FindDefaultApL \
+                        current protocol type is %d", pdpType )
+                if ( pdpType == aPdpType )
+                    {
+                    defaultIap = cm.GetIntAttributeL( CMManager::ECmIapId );
+                    isFound  = ETrue;
+                    LOG2( SIMPLE, "SATENGINE: CSatApnHandler::FindDefaultApL \
+                            default iap had been found %d", defaultIap )
+                    }
+                CleanupStack::PopAndDestroy( &cm );
+                }
+            }
+        CleanupStack::PopAndDestroy( &des );
+        }
+    CleanupStack::PopAndDestroy( &array );
+    CleanupStack::PopAndDestroy( &cmManager );
+
+    if ( !isFound )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatApnHandler: default AP not found" );
+        User::Leave( KErrNotFound );
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatApnHandler::FindDefaultApL exit" )
+    return defaultIap;
+    }
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/CSatBIPDataReceiver.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,152 @@
+/*
+* 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:  Receiver class for TCP / UDP sockets
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <es_sock.h>
+#include "CSatBIPDataReceiver.h"
+#include "CSatBIPGPRSDataChannel.h"
+#include "SatLog.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSatBIPDataReceiver::CSatBIPDataReceiver
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatBIPDataReceiver::CSatBIPDataReceiver( CSatBIPGPRSDataChannel& aObserver,  
+    RSocket& aSocket,
+    TBool aIsTcpSocket ) : CActive( EPriorityNormal ),
+    iObserver( aObserver ),
+    iSocket( aSocket ),
+    iReceiveDataLen( 0 ),
+    iRecvPckg( iReceiveDataLen )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPDataReceiver::CSatBIPDataReceiver\
+         calling-exiting" )
+    
+    iIsTcpSocket = aIsTcpSocket;
+    
+    CActiveScheduler::Add( this );
+    }
+    
+// -----------------------------------------------------------------------------
+// CSatBIPDataReceiver::~CSatBIPDataReceiver
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CSatBIPDataReceiver::~CSatBIPDataReceiver()
+    {
+    LOG( SIMPLE, 
+    "SATENGINE: CSatBIPDataReceiver::~CSatBIPDataReceiver calling" )
+    // Don't have our own pointers...
+    LOG( SIMPLE, 
+    "SATENGINE: CSatBIPDataReceiver::~CSatBIPDataReceiver exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBIPDataReceiver::RunL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+void CSatBIPDataReceiver::RunL()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPDataReceiver::RunL calling" )
+
+    LOG2( NORMAL, "  RunL with error: %i", iStatus.Int() )
+    LOG2( NORMAL, "  RunL Data received <buffer>: %i", iRecvBuffer.Length() )
+
+    // Notify observer
+    if ( KErrNone == iStatus.Int() )
+        {
+        iObserver.DataReceivedNotificationL( iRecvBuffer );
+        }    
+    else
+        {
+        iObserver.DataReceiveError( iStatus.Int() );
+        }
+    LOG( SIMPLE, "SATENGINE: CSatBIPDataReceiver::RunL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBIPDataReceiver::DoCancel
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+void CSatBIPDataReceiver::DoCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPDataReceiver::DoCancel calling" )
+    iSocket.CancelRecv();
+    LOG( SIMPLE, "SATENGINE: CSatBIPDataReceiver::DoCancel exiting" )
+    }
+    
+// -----------------------------------------------------------------------------
+// CSatBIPDataReceiver::ReceiveStoreEmptyNotification
+// -----------------------------------------------------------------------------
+//
+void CSatBIPDataReceiver::ReceiveStoreEmptyNotificationL()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPDataReceiver::ReceiveStoreEmptyNotification\
+         calling" )
+    // It doesn't matter, if this buffer is empty
+    iObserver.DataReceivedNotificationL( iRecvBuffer );
+    LOG( SIMPLE, "SATENGINE: CSatBIPDataReceiver::ReceiveStoreEmptyNotification\
+         exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBIPDataReceiver::StartReceive
+// Starts to receive data
+// -----------------------------------------------------------------------------
+//
+void CSatBIPDataReceiver::StartReceive( TInetAddr& aAddr )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPDataReceiver::StartReceive calling" )
+
+    // It may already be active
+    if ( !IsActive() )
+        {
+        // This is used only with TCP sockets
+        iReceiveDataLen = 0;
+        // Remove previously received data
+        iRecvBuffer.Zero();
+        // Check the socket type
+        if ( iIsTcpSocket )
+            {
+            LOG( SIMPLE, "SATENGINE: CSatBIPDataReceiver::StartReceive TCP" )
+            // Only TCP / Stream socket may receive one or more bytes
+            iSocket.RecvOneOrMore( iRecvBuffer, 0, iStatus, iRecvPckg );
+            }
+        else
+            {
+            LOG( SIMPLE, "SATENGINE: CSatBIPDataReceiver::StartReceive UDP" )
+            // Use different receive method with UPD / Datagram socket
+            // Destination has already been stored in iSocket during 
+            // activation, 
+            // so we don't have to tell it here.        
+            iSocket.RecvFrom( iRecvBuffer, aAddr, 0, iStatus );
+            }
+        SetActive();
+        }
+    LOG( SIMPLE, "SATENGINE: CSatBIPDataReceiver::StartReceive exiting" )
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/CSatBIPDataSender.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,150 @@
+/*
+* 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:  Sender class for TCP / UDP sockets
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <es_sock.h>
+#include "CSatBIPDataSender.h"
+#include "MSatSendDataObserver.h"
+#include "SatLog.h"
+#include "MSatBIPUtils.h"
+
+#ifdef ENABLE_SAT_LOGGING
+const TUint8 KIpAddressLogSize( 40 );
+#endif
+ 
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSatBIPDataSender::CSatBIPDataSender
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatBIPDataSender::CSatBIPDataSender( MSatSendDataObserver& aObserver, 
+    RSocket& aSocket,
+    TBool aIsTcpSocket,
+    TInt aBufferSize ) : CActive( EPriorityNormal ),
+    iObserver( aObserver ),
+    iSocket( aSocket )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPDataSender::CSatBIPDataSender\
+         calling-exiting" )
+
+    iIsTcpSocket = aIsTcpSocket;
+    iBufferSize = aBufferSize;
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBIPDataSender::~CSatBIPDataSender
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CSatBIPDataSender::~CSatBIPDataSender()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPDataSender::~CSatBIPDataSender calling" )
+    // Don't have our own pointers...
+    LOG( SIMPLE, "SATENGINE: CSatBIPDataSender::~CSatBIPDataSender exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBIPDataSender::RunL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+void CSatBIPDataSender::RunL()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPDataSender::RunL calling" )
+
+    LOG2( NORMAL, "  RunL with error: %i", iStatus.Int() )
+    LOG2( NORMAL, "  RunL <buffer_size>: %i", iBufferSize )
+    TInt errCode( MSatBIPUtils::ESatBIPSuccess );
+
+    if ( KErrNone != iStatus.Int() )
+        {
+        // Error, setting error code
+        errCode = MSatBIPUtils::ESatBIPRemoteDeviceNotReachable;
+        }
+
+    // Notify observer and empty buffer
+    iObserver.DataSentNotification( errCode, iBufferSize );
+    iSendPtr.Zero();
+    LOG( SIMPLE, "SATENGINE: CSatBIPDataSender::RunL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBIPDataSender::DoCancel
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+void CSatBIPDataSender::DoCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPDataSender::DoCancel calling" )
+    iSocket.CancelSend();
+    LOG( SIMPLE, "SATENGINE: CSatBIPDataSender::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBIPDataSender::SendData
+// Starts the send process using predefined protocol
+// -----------------------------------------------------------------------------
+//
+void CSatBIPDataSender::SendData( const TDesC8& aData, TInetAddr& aDest )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPDataSender::SendData calling" )
+    // Copy data into local buffer
+    iSendPtr.Copy( aData );
+    
+    #ifdef ENABLE_SAT_LOGGING
+    TBuf<KIpAddressLogSize> addressForLog;
+    #endif
+
+    #ifdef ENABLE_SAT_LOGGING
+    aDest.Output( addressForLog );
+    LOG2( NORMAL, 
+    "SATENGINE: CSatBIPDataSender::SendData Sending to %S", &addressForLog )
+    #endif    
+    
+    LOG2( NORMAL, "  Port number: %i", aDest.Port() )
+    LOG2( NORMAL, "  Sending %i bytes", aData.Length() )
+    if ( !IsActive() )
+        {
+        // Check protocol
+        if ( iIsTcpSocket )
+            {
+            LOG( SIMPLE, "SATENGINE: CSatBIPDataSender::SendData TCP" )
+            // When using TCP, this request completes when the data is actually
+            // sent to remote device. 
+            iSocket.Send( iSendPtr, 0, iStatus );
+            }
+        else
+            {
+            LOG( SIMPLE, "SATENGINE: CSatBIPDataSender::SendData UDP" )
+            // UDP Socket. This request completes almost immediately. 
+            // There is no
+            // way to be sure that the remote device gets the datagram.
+            iSocket.SendTo( iSendPtr, aDest, 0, iStatus );
+            }
+        SetActive();
+        }
+    LOG( SIMPLE, "SATENGINE: CSatBIPDataSender::SendData exiting" )
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/CSatBIPGPRSDataChannel.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,1692 @@
+/*
+* 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:  GPRS Data channel for BIP
+*
+*/
+
+
+#include <etelqos.h>
+#include <cmmanager.h>
+#include <cmconnectionmethod.h>
+#include <cmpluginpacketdatadef.h>
+#include <cs_subconevents.h>                    // For subconnection events
+#include <networking/qos3gpp_subconparams.h>    // For extension parameters
+#include <e32std.h>                             // TRealFormat
+#include <e32cmn.h>
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <in_sock_internal.h>                   // For KSoUdpRecvBuf contant
+#endif
+#include "CSatBIPUtils.h"
+#include "CSatBIPGPRSDataChannel.h"
+#include "SatLog.h"
+#include "EnginePanic.h"
+#include "CSatBIPDataSender.h"
+#include "CSatBIPDataReceiver.h"
+#include "MSatSendDataObserver.h"
+#include "MSatConnectionObserver.h"
+#include "TSatChannelIDInfo.h"
+#include "TSatQoSParser.h"
+#include "csatbipsubconneventobserver.h"
+#include "csatsactivewrapper.h"
+ 
+// Required GPRS parameters
+const TUint8 KReqGprsQoSParams = 6;
+// Required packet protocol type is always 02 for GPRS -> IP Protocol
+const TUint8 KReqPacketProtType = 0x02;
+// Position of the protocol type in the array
+const TUint8 KProtocolPos = 5;
+// Lengths of IP address
+const TUint8 KIPv4Length = 4;
+const TUint8 KIPv6Length = 16;
+
+#ifdef SAT_USE_DUMMY_TSY
+const TUint8 KIpAddressSize( 15 );
+const TUint8 KIpv4Length( 4 );
+const TUint8 KIpv6Length( 16 );
+const TUint8 KIpAddressA( 0 );
+const TUint KIpAddressAValue( 127 );
+const TUint8 KIpAddressB( 1 );
+const TUint KIpAddressBValue( 0 );
+const TUint8 KIpAddressC( 2 );
+const TUint KIpAddressCValue( 0 );
+const TUint8 KIpAddressD( 3 );
+const TUint KIpAddressDValueDestination( 2 );
+const TUint KIpAddressDValueLocal( 3 );
+#endif
+
+#ifdef ENABLE_SAT_LOGGING
+const TUint8 KIpAddressLogSize( 40 );
+#endif
+
+const TInt KReCheckStatusDelay = 100000; // 100ms
+const TInt KMaxAttempts = 20;            // 20*100ms= 2s 
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CSatBIPGPRSDataChannel* CSatBIPGPRSDataChannel::NewL(
+    CSatBIPUtils& aUtils,
+    RSocketServ& aSocketServer,
+    TSatChannelIdInfo& aChannelId,
+    RConnection& aConnection,
+    RSubConnection& aSubConnection )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::NewL calling" )
+
+    CSatBIPGPRSDataChannel* self = new( ELeave ) CSatBIPGPRSDataChannel( 
+        aUtils, aSocketServer, aChannelId, aConnection, aSubConnection );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::NewL exiting" )
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CSatBIPGPRSDataChannel* CSatBIPGPRSDataChannel::NewLC(
+    CSatBIPUtils& aUtils,
+    RSocketServ& aSocketServer,
+    TSatChannelIdInfo& aChannelId,
+    RConnection& aConnection,
+    RSubConnection& aSubConnection )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::NewLC calling" )
+
+    CSatBIPGPRSDataChannel* self = new ( ELeave ) CSatBIPGPRSDataChannel( 
+        aUtils, aSocketServer, aChannelId, aConnection, aSubConnection );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+
+    LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::NewLC exiting" )
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// destructor.
+// ---------------------------------------------------------------------------
+//
+CSatBIPGPRSDataChannel::~CSatBIPGPRSDataChannel()
+    {
+    LOG( SIMPLE,
+         "SATENGINE: CSatBIPGPRSDataChannel::~CSatBIPGPRSDataChannel calling" )
+
+    // Close sender
+    delete iSender;
+    
+    // Close receiver
+    delete iReceiver;
+    
+    // Close receiver
+    delete iSubConnEventObserver;
+    
+    // Close Socket
+    iSocket.Close();
+    
+    // Delete buffers
+    delete iSendStore;
+    iRcvBuffer.Zero();
+    
+    LOG( SIMPLE,
+         "SATENGINE: CSatBIPGPRSDataChannel::~CSatBIPGPRSDataChannel exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// Sets up connection
+// ---------------------------------------------------------------------------
+//
+void CSatBIPGPRSDataChannel::SetupConnectionL( 
+    const TSatBipConnectionInfo& aConnParams )
+    {
+    LOG( SIMPLE, 
+        "SATENGINE: CSatBIPGPRSDataChannel::SetupConnectionL calling" )
+
+    // Allocate Send buffer
+    iSendStore = HBufC8::NewL( aConnParams.iBufferSize );
+
+    // Store the rest of connection information
+    iConnInfo = aConnParams;
+
+    // Define used protocol
+    iUseTcpProtocol = ( RSat::ETcp == iConnInfo.iProtocol.iTransportProto );
+
+    // Set connection stage
+    iConnStage = ESatBIPClosed;
+
+    LOG( SIMPLE, 
+        "SATENGINE: CSatBIPGPRSDataChannel::SetupConnectionL exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// Opens the connection
+// ---------------------------------------------------------------------------
+//
+void CSatBIPGPRSDataChannel::ActivateConnectionL(
+    MSatConnectionObserver* aObserver )
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatBIPGPRSDataChannel::ActivateConnectionL calling" )
+    
+    TInt errCode( KErrNone );               // errCode
+    RPacketQoS::TQoSGPRSNegotiated negQoS;  // The negotiated QoS
+    
+    // If the connection has not been setup or already connecting, leave
+    if ( ESatBIPClosed != iConnStage )
+        {
+        LOG( SIMPLE,
+        "SATENGINE: CSatBIPGPRSDataChannel::ActivateConnectionL \
+        ESatBIPClosed != iConnStage" )
+        User::Leave( KErrCancel );
+        }
+
+    iConnectionObserver = aObserver;
+
+    if ( RSat::EIPv4Address == iConnInfo.iDestination.iType )
+        {
+        LOG( NORMAL, 
+             "SATENGINE: CSatBIPGPRSDataChannel::ActivateConnectionL\
+             Using IPv4" )
+        }
+    else if ( RSat::EIPv6Address == iConnInfo.iDestination.iType )
+        {
+        LOG( NORMAL, 
+             "SATENGINE: CSatBIPGPRSDataChannel::ActivateConnectionL\
+             Using IPv6" )
+        }
+    else
+        {
+        LOG( NORMAL, "  Unknown IP type" )
+        User::Leave( KErrUnknown );
+        }
+    
+    // Open connection if it is inactive
+    if ( !iUtils.IsConnectionActivated() )
+        {
+        LOG( NORMAL, 
+             "SATENGINE: CSatBIPGPRSDataChannel::ActivateConnectionL\
+             Connection is inactive, open connection " )
+        // Write the primary PDP Context QoS Parameters to CMManager
+        // before activating the primary PDP Context.  
+        WritePrimaryPDPContextQoSParamsL();
+        
+        // Open sub-session to SocketServer    
+        errCode = iConnection.Open( iSocketServ );
+        LOG2( NORMAL, 
+              "SATENGINE: CSatBIPGPRSDataChannel::ActivateConnectionL\
+              RConnection opened with code: %i", errCode )
+        User::LeaveIfError( errCode );
+        
+        // Start connection. If there are no override settings, 
+        // use default settings
+        if ( iConnInfo.iOverrideSet )
+            {
+            LOG( NORMAL, "Starting connection with override settings" )
+            TConnPrefList prefList;
+            TExtendedConnPref extPrefs;
+            
+            extPrefs.SetNoteBehaviour( 
+                    iConnInfo.iOverrideSet->NoteBehaviour() );
+            extPrefs.SetIapId( iConnInfo.iOverrideSet->IapId() );
+            prefList.AppendL( &extPrefs );
+            
+            errCode = iConnection.Start( prefList );
+            }
+        else
+            {
+            LOG( NORMAL, "Starting connection with default settings" )
+            errCode = iConnection.Start();
+            }
+        
+        LOG2( NORMAL, 
+              "SATENGINE: CSatBIPGPRSDataChannel::ActivateConnectionL\
+              RConnection started with code: %i", errCode )
+        User::LeaveIfError( errCode );
+        
+        // Erase the primary PDP Context QoS Parameters from CMManager 
+        WriteDefaultQoSParamsL();
+        
+        // Set Connection activated
+        iUtils.SetConnectionActivated( ETrue );
+        // Make sure the subconnection is inactive.
+        iUtils.SetSubConnectionActivated( EFalse );
+        }
+    else    
+        {
+        LOG( NORMAL, 
+             "SATENGINE: CSatBIPGPRSDataChannel::ActivateConnectionL\
+             Connection is active " )
+        // Connection is active, open SubConnection if it is inactive
+        if ( !iUtils.IsSubConnectionActivated() ) 
+            {
+            LOG( NORMAL, "SATENGINE: CSatBIPGPRSDataChannel::\
+            ActivateConnectionL SubConnection is inactive, open \
+            subconnection" )
+            // Open SubConnection 
+            OpenSubConnection();
+            }
+        }
+    
+    // Set up QoS values
+    SetConnQoSParamsL();
+    
+    // Open socket
+    OpenSocketL();
+    
+    // UDP Socket doesn't need ActiveObject, so we don't have to wait.
+    if ( !iUseTcpProtocol )
+        {
+        LOG( NORMAL, 
+             "SATENGINE: CSatBIPGPRSDataChannel::ActivateConnectionL\
+             UDP protocol " )
+        StartReceiveL();
+        iConnStage = ESatBIPConnected;
+        
+        // Notify ConnectionObserver
+        iConnectionObserver->ConnectionNotification( KErrNone );
+        }
+    
+    LOG( SIMPLE,
+        "SATENGINE: CSatBIPGPRSDataChannel::ActivateConnectionL exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// ends or stores the data.
+// ---------------------------------------------------------------------------
+//
+void CSatBIPGPRSDataChannel::GetNegotiatedQoSParams( 
+    RSat::TBearerParams& aResult ) const
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::NegotiatedQoSParams\
+        calling - exiting" )
+    aResult = iConnInfo.iBearerParams;
+    }
+
+// ---------------------------------------------------------------------------
+// Sends or stores the data.
+// ---------------------------------------------------------------------------
+//
+TInt CSatBIPGPRSDataChannel::SendDataL( const TDes8& aData,
+    const TBool aSendImmediately,
+    TInt& aFreeBufferSize,
+    MSatSendDataObserver* aObserver )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::SendDataL calling" )
+
+    TInt errCode( MSatBIPUtils::ESatBIPSuccess );
+    CSatSActiveWrapper* delay = NULL;
+    TInt numberOfTries( 1 );
+    // Check status of connection
+    TBool suspended( RPacketService::EStatusSuspended == 
+        iUtils.ConnectionStatus() );
+
+    // Check that does the data fit in buffer
+    const TInt bufsize( iSendStore->Length() );
+
+    LOG2( NORMAL,
+        "SATENGINE: CSatBIPGPRSDataChannel::SendDataL iSendBuffer size: %i",
+        bufsize )
+    LOG2( NORMAL,
+        "SATENGINE: CSatBIPGPRSDataChannel::SendDataL aData size: %i",
+        aData.Length() )
+    if ( suspended )
+        {
+        // for async wait
+        delay = new ( ELeave ) CSatSActiveWrapper();
+        }
+    
+    while ( suspended && KMaxAttempts >= numberOfTries ) 
+        {
+        // In cases of SMS or Call suspend the pdp context, we need to 
+        // evaluate the status of context after a small delay
+        LOG2( NORMAL, "SATENGINE: CSatBIPGPRSDataChannel::SendDataL, wait, %d "\
+            , numberOfTries )
+        delay->After( KReCheckStatusDelay );
+        suspended = RPacketService::EStatusSuspended == iUtils.ConnectionStatus();
+        numberOfTries++;
+        }
+    
+    delete delay;
+    delay = NULL;
+            
+    if ( suspended && aSendImmediately )
+        {
+        LOG( NORMAL, "SATENGINE: CSatBIPGPRSDataChannel::SendDataL \
+            Connection suspended" )
+        errCode = MSatBIPUtils::ESatBIPServiceError;
+        }
+    else if ( iConnInfo.iBufferSize < ( aData.Length() + bufsize ) )
+        {
+        LOG( NORMAL,
+            "SATENGINE: CSatBIPGPRSDataChannel::SendDataL Buffer overflow" )
+        errCode = MSatBIPUtils::ESatBIPReqBufSizeNotAvail;
+        }
+    else
+        {
+
+        // Append data to send buffer
+        TPtr8 ptr = iSendStore->Des();
+        ptr.Append( aData );
+
+        // Send immediately, if required
+        if ( aSendImmediately )
+            {
+            LOG( NORMAL,
+                "SATENGINE: CSatBIPGPRSDataChannel::SendDataL Sending data" )
+
+            // If Sender object is NULL, create it
+            if ( !iSender && aObserver )
+                {
+                LOG( NORMAL, "SATENGINE: CSatBIPGPRSDataChannel::SendDataL \
+                create iSender" )
+                iSender = new ( ELeave ) CSatBIPDataSender(
+                        *aObserver, iSocket, iUseTcpProtocol,
+                        iConnInfo.iBufferSize );
+                }
+
+            if ( iSender )
+                {
+                LOG( NORMAL, "SATENGINE: CSatBIPGPRSDataChannel::SendDataL \
+                iSender true" )
+                // Send data
+                iSender->SendData( ptr, iDestAddr );
+
+                // Remove data from buffer.
+                iSendStore = HBufC8::NewL( iConnInfo.iBufferSize );
+                }
+            }
+        }
+
+    // Place the number of bytes of empty space in the buffer to aFreeBufferSize
+    aFreeBufferSize = ( iConnInfo.iBufferSize - iSendStore->Length() );
+
+    LOG2( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::SendDataL exiting, \
+          errCode: %d", errCode )
+    return errCode;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns the received data in param aData
+// ---------------------------------------------------------------------------
+//
+TInt CSatBIPGPRSDataChannel::ReceiveDataL( TDes8& aData,
+    const TInt aBytesToRead, TInt& aAvailableBytes )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::ReceiveDataL calling" )
+
+    TInt errCode( MSatBIPUtils::ESatBIPSuccess );
+
+    // Number of bytes to return, may not be the same as requested
+    TInt bytesToReturn( aBytesToRead );
+
+    const TInt bytesAvail( iRcvBuffer.Length() );
+
+    // Compare the number of bytes received and the number of bytes requested.
+    if ( bytesToReturn > bytesAvail )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::ReceiveDataL \
+        bytesToReturn > bytesAvail" )
+        // There are no requested bytes availabe, we return all we have.
+        errCode = MSatBIPUtils::ESatBIPReqBufSizeNotAvail;
+        bytesToReturn = bytesAvail;
+        }
+
+    LOG2( NORMAL, "  ReceiveDataL: Data available for receive: %i", bytesAvail )
+
+    // Put the data into param aData.
+    aData = iRcvBuffer.Left( bytesToReturn );
+    // Remove read data from receive store
+    iRcvBuffer.Delete( 0, bytesToReturn );
+    // Put the number of unread bytes into param aAvailableBytes.
+    aAvailableBytes = iRcvBuffer.Length();
+    
+    LOG2( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::ReceiveDataL \
+          aAvailableBytes: %d", aAvailableBytes )
+    // Notify receiver if store is empty to get the next datagram in UDP sockets
+    if ( ( 0 == aAvailableBytes ) && iReceiver )
+        {
+        iReceiver->ReceiveStoreEmptyNotificationL();
+        }
+
+    LOG2( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::ReceiveDataL exiting. \
+          errCode: %d", errCode )
+    return errCode;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns the identifier of this channel
+// ---------------------------------------------------------------------------
+//
+TInt CSatBIPGPRSDataChannel::ChannelId() const
+    {
+    LOG2( SIMPLE,
+    "SATENGINE: CSatBIPGPRSDataChannel::ChannelId calling - exiting,\
+    ChannelId: %i", iChannelId.ChannelId() )
+    return iChannelId.ChannelId();
+    }
+
+// ---------------------------------------------------------------------------
+// Returns the identifier of this channel. This function is used only when
+// generating ChannelStatus TLV object
+// ---------------------------------------------------------------------------
+//
+TUint8 CSatBIPGPRSDataChannel::ChannelStatusChannelId() const
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatBIPGPRSDataChannel::ChannelStatusChannelId calling" )
+
+    TUint8 channelId( iChannelId.ShortChannelId() );
+
+    LOG2( SIMPLE,
+        "SATENGINE: CSatBIPGPRSDataChannel::ChannelStatusChannelId exiting \
+        with channel id: %i", channelId )
+    return channelId;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns the status of this data channel
+// ---------------------------------------------------------------------------
+//
+TInt CSatBIPGPRSDataChannel::Status() const
+    {
+    LOG2( SIMPLE, 
+    "SATENGINE: CSatBIPGPRSDataChannel::Status calling - exiting,\
+    iChannelStatus: %i", iChannelStatus )
+    return iChannelStatus;
+    }
+
+// ---------------------------------------------------------------------------
+// Closes this data channel
+// ---------------------------------------------------------------------------
+//
+void CSatBIPGPRSDataChannel::CloseChannel()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::CloseChannel calling" )
+
+    if ( ESatBIPConnected == iConnStage ||
+         ESatBIPCancelled == iConnStage )
+        {
+        LOG( NORMAL, "SATENGINE: CSatBIPGPRSDataChannel::CloseChannel \
+            Channel is connected" )
+        CancelAll();
+        // Close socket
+        iSocket.Close();
+
+        iConnStage = ESatBIPClosed;
+        }
+    else if ( iConnStage == ESatBIPConnect &&
+              iUseTcpProtocol )
+        {
+        LOG( NORMAL, "SATENGINE: CSatBIPGPRSDataChannel::CloseChannel \
+            Channel is connecting" )
+        // If Channel is connecting and protocol is TCP,
+        // have to call Cancel instead of CancelAll since this is an active
+        // object in this situation
+        Cancel();
+        // Close socket
+        iSocket.Close();
+        
+        iConnStage = ESatBIPClosed;
+        }
+    else
+        {
+        LOG( NORMAL, "SATENGINE: CSatBIPGPRSDataChannel::CloseChannel \
+            Channel already closed" )
+        }
+
+    // Release channel ID
+    iChannelId.ReleaseChannel();
+
+    LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::CloseChannel exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// Performs cancel actions.
+// ---------------------------------------------------------------------------
+//
+void CSatBIPGPRSDataChannel::CancelAll()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::CancelAll calling" )
+
+    // Cancel all activity in sockets
+    if ( iConnStage == ESatBIPConnected )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::CancelAll \
+        iConnStage == ESatBIPConnected" )
+        // Cancel sender
+        if ( iSender )
+            {
+            LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::CancelAll \
+            cancel iSender" )
+            iSender->Cancel();
+            }
+
+        // Cancel receiver
+        if ( iReceiver )
+            {
+            LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::CancelAll \
+            cancel iReceiver" )
+            iReceiver->Cancel();
+            }
+
+        // Cancel all actions
+        iSocket.CancelAll();
+        // Link dropped, when socket cancels all
+        iChannelStatus = MSatBIPUtils::ESatLinkDropped;
+        iConnStage = ESatBIPCancelled;
+        }
+    else if ( iConnStage == ESatBIPConnect )
+        {
+        LOG( NORMAL, "SATENGINE: CSatBIPGPRSDataChannel::CancelAll \
+            Cancelling connect" )
+        // Cancel connection negotiations
+        iSocket.CancelConnect();
+        iConnStage = ESatBIPCancelled;
+        }
+    else
+        {
+        LOG( NORMAL, "SATENGINE: CSatBIPGPRSDataChannel::CancelAll \
+            Channel already cancelled or closed" )
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::CancelAll exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// Returns the status of this data channel
+// ---------------------------------------------------------------------------
+//
+TBool CSatBIPGPRSDataChannel::IsContextActive() const
+    {
+    LOG2( SIMPLE,
+    "SATENGINE: CSatBIPGPRSDataChannel::IsContextActive calling - exiting,\
+    return: %d", ESatBIPConnected == iConnStage )
+    return ESatBIPConnected == iConnStage;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns the status of this data channel
+// ---------------------------------------------------------------------------
+//
+const MSatBIPDataChannel::TSatBipConnectionInfo& CSatBIPGPRSDataChannel::ConnInfo() const
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatBIPGPRSDataChannel::ConnInfo calling - exiting" )
+    return iConnInfo;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBIPGPRSDataChannel::StopUdpSocket
+// -----------------------------------------------------------------------------
+//
+void CSatBIPGPRSDataChannel::StopUdpSocket()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::StopUdpSocket calling" )
+    
+    if ( !iUseTcpProtocol )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::StopUdpSocket UDP" )
+    iSocket.Close();
+    }
+        
+    LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::StopUdpSocket exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// From CActive
+// ---------------------------------------------------------------------------
+//
+void CSatBIPGPRSDataChannel::RunL()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::RunL calling " )
+
+    if ( KErrNone == iStatus.Int() )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::RunL \
+        KErrNone == iStatus.Int() " )
+        // Check connection stage
+        switch ( iConnStage )
+            {
+            case ESatBIPConnect:
+                {
+                LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::RunL \
+                    Connect OK" )
+                    
+                // Start receiving data
+                StartReceiveL();
+                iConnStage = ESatBIPConnected;
+                // Notify ConnectionObserver
+                iConnectionObserver->ConnectionNotification( KErrNone );
+                break;
+                }
+
+            case ESatBIPCancelled:
+                {
+                LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::RunL \
+                    Connection Cancelled" )
+                // Notify ConnectionObserver
+                iConnectionObserver->ConnectionNotification( KErrCancel );
+                break;
+                }
+
+            default:
+                {
+                LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::RunL default" )
+                PanicSatEngine( ESatBIPAccessViolation );
+                }
+            }
+        }
+    else
+        {
+        // Notify ConnectionObserver with error
+        iConnectionObserver->ConnectionNotification( iStatus.Int() );
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::RunL exiting " )
+    }
+
+// ---------------------------------------------------------------------------
+// DoCancel
+// ---------------------------------------------------------------------------
+//
+void CSatBIPGPRSDataChannel::DoCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::DoCancel calling" )
+
+    CancelAll();
+
+    LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::DoCancel calling" )
+    }
+
+// ---------------------------------------------------------------------------
+// RunError
+// ---------------------------------------------------------------------------
+//
+TInt CSatBIPGPRSDataChannel::RunError( TInt aError )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::RunError calling" )
+
+    if ( iConnectionObserver )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::RunError \
+        iConnectionObserver true" )
+        iConnectionObserver->ConnectionNotification( aError );
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::RunError calling" )
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// Stores received data into buffer.
+// ---------------------------------------------------------------------------
+//
+void CSatBIPGPRSDataChannel::DataReceivedNotificationL( const TDesC8& aData )
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatBIPGPRSDataChannel::DataReceivedNotification calling" )
+
+    // Check do we have to report data receive
+    const TInt bufsize( iRcvBuffer.Length() );
+#ifdef ENABLE_SAT_LOGGING
+    TBuf<KIpAddressLogSize> addressForLog;
+#endif
+    // LOG values
+    LOG2( NORMAL, "SATENGINE: CSatBIPGPRSDataChannel::RunL\
+        ReceiveStore length: %i", bufsize )
+
+    // In UDP context, we can store only one datagram at a time. If there is
+    // previous datagram in store, we'll have to wait for the UICC to get all
+    // before storing the netx datagram and to start receive again. If there are
+    // more than one datagrams pending, they are stored in RSockets queue.
+    if ( bufsize == 0 || RSat::ETcp == iConnInfo.iProtocol.iTransportProto )
+        {
+#ifdef ENABLE_SAT_LOGGING
+        iSourceAddr.Output( addressForLog );
+        LOG2( NORMAL, "SATENGINE: CSatBIPGPRSDataChannel::RunL\
+            Received data length: %i", aData.Length() )
+        LOG2( NORMAL, "SATENGINE: CSatBIPGPRSDataChannel::RunL\
+            Received from address: %S", &addressForLog )
+        LOG2( NORMAL, "SATENGINE: CSatBIPGPRSDataChannel::RunL\
+            Received from port: %i", iSourceAddr.Port() )
+#endif
+        // Store data, if it fits into store, else, do not receive until store
+        // is empty.
+        if ( KSatBIPMinReceiveBufferSize >= ( aData.Length() + bufsize ) )
+            {
+            LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::\
+                 DataReceivedNotification store data" )
+            iRcvBuffer.Append( aData );
+
+            // It is possible that aData is empty, because this function 
+            // is called
+            // every time when SIM gets the final bytes from ReceiveStore.
+            if ( 0 == bufsize && aData.Length() > 0 )
+                {
+                LOG( SIMPLE,
+                "SATENGINE: CSatBIPGPRSDataChannel::DataReceivedNotification \
+                aData.Length() > 0" )
+                // If the store is empty, send event download
+                iUtils.DataAvailable( ChannelId(), aData.Length() );
+                }
+
+            // Start to receive again. This should never leave, because Receiver
+            // object is already created.
+            StartReceiveL();
+            }
+        }
+
+    LOG( SIMPLE,
+        "SATENGINE: CSatBIPGPRSDataChannel::DataReceivedNotification exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// Error while receiving data
+// ---------------------------------------------------------------------------
+//
+void CSatBIPGPRSDataChannel::DataReceiveError( TInt aError )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::DataReceiveError calling" )
+
+    if ( KErrCancel != aError ) // Don't do anything if cancelled
+        {
+        LOG2( NORMAL, "SATENGINE: CSatBIPGPRSDataChannel::DataReceiveError\
+             Error: %i", aError )
+        // Report error
+        iConnStage = ESatBIPCancelled; 
+        iChannelStatus = MSatBIPUtils::ESatLinkDropped;
+        iUtils.ChannelStatus( ChannelId(), iChannelStatus );
+        }
+    else
+        {
+        // Cancelled
+        LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::DataReceiveError\
+            Receive has been cancelled cancelled" )
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::DataReceiveError exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CSatBIPGPRSDataChannel::CSatBIPGPRSDataChannel( CSatBIPUtils& aUtils,
+    RSocketServ& aSocketServer,
+    TSatChannelIdInfo& aChannelId,
+    RConnection& aConnection,
+    RSubConnection& aSubConnection) :
+    CActive( EPriorityStandard ),
+    iUtils( aUtils ),
+    iSocketServ( aSocketServer ),
+    iChannelId( aChannelId ),
+    iConnection( aConnection ),
+    iSubConnection( aSubConnection )
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatBIPGPRSDataChannel::CSatBIPGPRSDataChannel calling" )
+
+    CActiveScheduler::Add( this );
+
+    LOG( SIMPLE,
+        "SATENGINE: CSatBIPGPRSDataChannel::CSatBIPGPRSDataChannel exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CSatBIPGPRSDataChannel::ConstructL()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::ConstructL calling" )
+
+    iChannelStatus = MSatBIPUtils::ESatNoFurtherInformation;
+    
+    LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::ConstructL exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// Opens and connects / binds Socket
+// ---------------------------------------------------------------------------
+//
+void CSatBIPGPRSDataChannel::OpenSocketL()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::OpenSocketL calling" )
+
+    TInt errCode( KErrNone );
+
+    // Define Destination address
+    // Create InetAddress to hold remote device information
+    LOG2( NORMAL, "SATENGINE: CSatBIPGPRSDataChannel::OpenSocketL\
+         Port from SIM: %d", iConnInfo.iProtocol.iPrtNumber )
+
+    // Remote server's IP Address
+#ifdef SAT_USE_DUMMY_TSY
+    TBuf8<RSat::KPcktAddressMaxSize> destAddr( RSat::KPcktAddressMaxSize );
+    
+    // KAfInet or KAfInet6
+    if ( RSat::EIPv6Address == iConnInfo.iDestination.iType )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::OpenSocketL IPv6" )
+        // 0:0:0:0:0:0:0:2 is equivalent to 127, 0, 0, 2
+        for ( TInt ndx = 0 ; ndx < KIpAddressSize ; ndx++ )
+            {
+            destAddr[ndx] = 0;
+            }
+        destAddr[KIpAddressSize] = KIpAddressDValueDestination;
+        destAddr.SetLength( KIpv6Length );
+        }
+    else //ipv4
+        {
+        LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::OpenSocketL IPv4" )
+        destAddr[KIpAddressA] = KIpAddressAValue;
+        destAddr[KIpAddressB] = KIpAddressBValue;
+        destAddr[KIpAddressC] = KIpAddressCValue;
+        destAddr[KIpAddressD] = KIpAddressDValueDestination;
+        destAddr.SetLength( KIpv4Length );
+        }
+    iDestAddr = DestAddress( destAddr );
+#else
+    iDestAddr = DestAddress( iConnInfo.iDestination.iAddress );
+#endif // SAT_USE_DUMMY_TSY
+    
+    LOG( NORMAL, "SATENGINE: CSatBIPGPRSDataChannel::OpenSocketL\
+         Complete defining destination address" )
+    
+    iSourceAddr = iDestAddr;
+    
+    TUint socketType( KSockStream );
+    TUint protocol( KProtocolInetTcp );
+    
+    // Check is it UDP or TCP
+    if ( !iUseTcpProtocol )
+        {
+        LOG( NORMAL, "SATENGINE: CSatBIPGPRSDataChannel::OpenSocketL\
+            Opening UDP datagram socket" )
+        socketType = KSockDatagram;
+        protocol = KProtocolInetUdp;
+        }
+    else
+        {
+        LOG( NORMAL, "SATENGINE: CSatBIPGPRSDataChannel::OpenSocketL\
+            Opening TCP stream socket" )
+        }
+        
+    // Open socket
+    if ( iUtils.IsSubConnectionActivated() )
+        {
+        LOG( NORMAL, "SATENGINE: CSatBIPGPRSDataChannel::OpenSocketL\
+        using subconnection" )
+        errCode = iSocket.Open( iSocketServ, KAfInet, socketType,
+            protocol, iSubConnection );
+        }
+    else
+        {
+        LOG( NORMAL, "SATENGINE: CSatBIPGPRSDataChannel::OpenSocketL\
+        using connection" )
+        errCode = iSocket.Open( iSocketServ, KAfInet, socketType,
+            protocol, iConnection );
+        }
+        
+    // Check socket activation
+    LOG2( NORMAL, "SATENGINE: CSatBIPGPRSDataChannel::OpenSocketL\
+        Socket opened with code: %i", errCode )
+    User::LeaveIfError( errCode );
+    
+    // Define local address. Local port is obtained automatically
+    TInetAddr localAddress( KInetPortAny );
+    
+#ifdef SAT_USE_DUMMY_TSY
+        // win2000 doesn't support IPv6, so force to IPv4
+        localAddress.SetFamily( KAfInet );
+        // KAfInet or KAfInet6
+        if ( RSat::EIPv6Address == iConnInfo.iDestination.iType )
+            {
+            LOG( NORMAL, "SATENGINE: CSatBIPGPRSDataChannel::OpenSocketL\
+                IPv6" )
+            // 0:0:0:0:0:0:0:3 is equivalent to 127, 0, 0, 3
+            TIp6Addr ip6Adrr;
+            
+            for ( TInt index = 0 ; index < KIpAddressSize ; index++ )
+                {
+                ip6Adrr.u.iAddr8[index] = 0;
+                }
+                
+            ip6Adrr.u.iAddr8[KIpAddressSize] = KIpAddressDValueLocal;
+            localAddress.SetAddress( ip6Adrr );
+            }
+        else //ipv4
+            {
+            LOG( NORMAL, "SATENGINE: CSatBIPGPRSDataChannel::OpenSocketL\
+                IPv4" )
+            localAddress.SetAddress( INET_ADDR(
+                KIpAddressAValue,
+                KIpAddressBValue,
+                KIpAddressCValue,
+                KIpAddressDValueLocal ) );
+            }
+#else
+    // Check does the SIM provide a local address
+    if ( 0 < iConnInfo.iSource.iAddress.Length() )
+        {
+        LOG( NORMAL, "SATENGINE: CSatBIPGPRSDataChannel::OpenSocketL\
+            Setting pre-defined local address" )
+        localAddress = DestAddress( iConnInfo.iSource.iAddress );
+        localAddress.SetPort( KInetPortAny );
+        }
+    else
+        {
+        LOG( NORMAL, "SATENGINE: CSatBIPGPRSDataChannel::OpenSocketL\
+            Setting automatic local address" )
+        // Unspecified. Local address is obtained automatically.
+        localAddress.SetFamily( KAFUnspec );
+        }
+#endif       
+    LOG( NORMAL, "SATENGINE: CSatBIPGPRSDataChannel::OpenSocketL\
+        Bind local address" )
+    errCode = iSocket.Bind( localAddress );  
+        
+    // Check what was the response from "Bind"
+    if ( KErrNone == errCode )
+        {
+        // Set status to indicate that connection attempt ongoing
+        iConnStage = ESatBIPConnect;
+        
+        if ( iUseTcpProtocol )
+            {
+            // Connect the socket
+            iSocket.Connect( iDestAddr, iStatus );
+            SetActive();
+            }
+        else
+            {
+            // This option redefines the receive buffer size
+            iSocket.SetOpt( KSoUdpRecvBuf, KSolInetUdp, 
+                KSatBIPMinReceiveBufferSize );
+            // Connect the socket
+            iSocket.Connect( iDestAddr, iStatus );
+            // UDP sockets dont need active object
+            User::WaitForRequest( iStatus );
+            LOG2( NORMAL, "SATENGINE: CSatBIPGPRSDataChannel::OpenSocketL\
+                UDP Socket connect status  %i", iStatus.Int() )
+            }
+        }
+    else
+        {
+        // Send Terminal Response indicating that static address allocation
+        // could not be done (KErrNotFound) or Bind failed for some other 
+        // reason
+        LOG2( NORMAL, "SATENGINE: CSatBIPGPRSDataChannel::OpenSocketL\
+            Bind error:  %i", errCode )
+        iConnectionObserver->ConnectionNotification( errCode );
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::OpenSocketL exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// Opens SubConnection and attaches socket into it
+// ---------------------------------------------------------------------------
+//
+void CSatBIPGPRSDataChannel::OpenSubConnection()
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatBIPGPRSDataChannel::OpenSubConnection calling" )
+    
+    TInt errCode( KErrNone );
+    
+    // Create SubConnection. This is mandatory for multiple PDP Context support
+    LOG( NORMAL, "SATENGINE: CSatBIPGPRSDataChannel::OpenSubConnection\
+        Opening Sub-connection" )
+    
+    errCode = iSubConnection.Open( iSocketServ, RSubConnection::ECreateNew, 
+                                   iConnection );
+    
+    LOG2( NORMAL, "SATENGINE: CSatBIPGPRSDataChannel::OpenSubConnection\
+        RSubConnection opened with code: %i", errCode )
+    
+    if ( KErrNone != errCode )
+        {
+        // No subconnections, Affects on sockets
+        LOG( NORMAL, "SATENGINE: CSatBIPGPRSDataChannel::OpenSubConnection\
+                RSubConnection is opened incorrectly" )
+        iSubConnection.Close();
+        iUtils.SetSubConnectionActivated( EFalse );
+        }
+    else 
+        {
+        LOG( NORMAL, "SATENGINE: CSatBIPGPRSDataChannel::OpenSubConnection\
+                RSubConnection is opened correctly" )
+        iUtils.SetSubConnectionActivated( ETrue );
+        }
+        
+    LOG( SIMPLE,
+        "SATENGINE: CSatBIPGPRSDataChannel::OpenSubConnection exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// Sets QoS parameters to active SubConnection
+// ---------------------------------------------------------------------------
+//
+void CSatBIPGPRSDataChannel::SetSubConQoSParamsL()
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatBIPGPRSDataChannel::SetSubConQoSParamsL calling" )
+    
+    const TInt paramLength( iConnInfo.iBearerParams.Length() );
+    TInt errCode( KErrNone );
+
+    LOG2( NORMAL, "  QoS Parameters length: %i", paramLength )
+
+    // GPRS requires 6 parameters from SIM
+    if ( KReqGprsQoSParams == paramLength )
+        {
+        // Check that is packet protocol valid, ie. IP protocol
+        if ( KReqPacketProtType != iConnInfo.iBearerParams[KProtocolPos] )
+            {
+            LOG( NORMAL, 
+                "SATENGINE: CSatBIPGPRSDataChannel::SetSubConQoSParamsL\
+                Requested packet protocol is not valid" )
+            User::Leave( KErrNotSupported );
+            }
+        }
+    else
+        {
+        LOG( NORMAL, 
+            "SATENGINE: CSatBIPGPRSDataChannel::SetSubConQoSParamsL\
+            Requested packet protocol is valid, not support" )
+        User::Leave( KErrNotSupported );
+        }
+
+    // Creating and setting properties for a sub-connection
+    // Create a parameter bundle and add to the cleanup stack
+    RSubConParameterBundle parameterBundle;
+    CleanupClosePushL( parameterBundle );
+        
+    // Create a family owned by parameterBundle
+    CSubConParameterFamily* parameterFamily = 
+        CSubConParameterFamily::NewL( parameterBundle, KSubConQoSFamily );
+    
+    // Create extension paramset(Rel5) owned by parameterFamily
+    CSubConQosR5ParamSet* requestedQoSRel5 = 
+        CSubConQosR5ParamSet::NewL( *parameterFamily, 
+                                    CSubConParameterFamily::ERequested );
+    
+    if( requestedQoSRel5 )
+        {
+        RPacketQoS::TQoSGPRSRequested reqQoS;
+        TSatQoSParser::GetRequestedQoSValues( iConnInfo.iBearerParams, 
+            reqQoS );
+        TSatQoSParser::TQoSRel5 qosRel5 = TSatQoSParser::ConvertQoS( reqQoS );
+        // Set some requested QoS values
+        requestedQoSRel5->SetTrafficClass( 
+            static_cast<RPacketQoS::TTrafficClass>( qosRel5.iTrafficClass ) );
+        requestedQoSRel5->SetTrafficHandlingPriority( 
+            static_cast<RPacketQoS::TTrafficHandlingPriority>( 
+                qosRel5.iTrafficHandlingPriority ) );
+        requestedQoSRel5->SetSDUErrorRatio( 
+            static_cast<RPacketQoS::TSDUErrorRatio>( qosRel5.iSduErrorRatio ) );
+        requestedQoSRel5->SetResidualBitErrorRatio( 
+            static_cast<RPacketQoS::TBitErrorRatio>( qosRel5.iResidualBer ) );
+        requestedQoSRel5->SetErroneousSDUDelivery( 
+            static_cast<RPacketQoS::TErroneousSDUDelivery>( 
+                qosRel5.iDeliveryErroneousSdu ) );
+        requestedQoSRel5->SetMaxBitrateUplink( qosRel5.iMaxBitRate );
+        requestedQoSRel5->SetMaxBitrateDownlink( qosRel5.iMaxBitRate );
+        requestedQoSRel5->SetMaxSduSize( qosRel5.iMaximumSDUSize );
+        requestedQoSRel5->SetDeliveryOrder( 
+            static_cast<RPacketQoS::TDeliveryOrder>( qosRel5.iDeliveryOrder ) );
+        LOG( SIMPLE, 
+            "SATENGINE: CSatBIPGPRSDataChannel::SetSubConQoSParamsL\
+            Setting requested QoS values for subconn" )
+        
+        // Start observing granted event.
+        if( !iSubConnEventObserver )
+            {
+            LOG( SIMPLE, 
+            "SATENGINE: CSatBIPGPRSDataChannel::SetSubConQoSParamsL\
+            iSubConnEventObserver false" )
+            iSubConnEventObserver = 
+                new ( ELeave ) CSatBIPSubConnEventObserver( *this );
+            }
+        iSubConnEventObserver->StartObservSubConnEvent();
+        
+        // Set parameters
+        errCode = iSubConnection.SetParameters( parameterBundle );
+        LOG2( NORMAL, 
+            "SATENGINE: CSatBIPGPRSDataChannel::SetSubConQoSParamsL\
+	        calling iSubConnection.SetParameters (parameterBundle) = %d", 
+	        errCode )
+        }
+    else
+        {
+        LOG( SIMPLE,
+            "SATENGINE: CSatBIPGPRSDataChannel::SetSubConQoSParamsL\
+            Can't create CSubConQosR5ParamSet" )
+        errCode = KErrNotSupported;
+        }
+    
+    // Pop and close parameterBundle
+    CleanupStack::PopAndDestroy();
+    
+    User::LeaveIfError( errCode );
+        
+    LOG( SIMPLE,
+        "SATENGINE: CSatBIPGPRSDataChannel::SetSubConQoSParamsL exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// Starts to receive data from Socket
+// ---------------------------------------------------------------------------
+//
+void CSatBIPGPRSDataChannel::StartReceiveL()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::StartReceiveL calling" )
+
+    // If receiver is NULL, create it
+    if ( NULL == iReceiver )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::StartReceiveL \
+        create iReceiver" )
+        iReceiver = new ( ELeave ) CSatBIPDataReceiver(
+            *this, iSocket, iUseTcpProtocol );
+        }
+
+    // Tell receiver to start receive
+    iReceiver->StartReceive( iSourceAddr );
+
+    LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::StartReceiveL exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// Defines address
+// ---------------------------------------------------------------------------
+//
+TInetAddr CSatBIPGPRSDataChannel::DestAddress( const TPtrC8& aAddr )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::DestAddress calling" )
+
+    TInetAddr destinationAddress;
+
+    const TInt addLength( aAddr.Length() );
+    LOG2( NORMAL, "  Address length is %i", addLength )
+
+#ifdef ENABLE_SAT_LOGGING
+    TBuf<KIpAddressLogSize> addressForLog;
+#endif
+    // Check IPv4 address
+    if ( KIPv4Length == addLength )
+        {
+        TInt index = 0;
+        TUint8 first( aAddr[index++] );
+        TUint8 second( aAddr[index++] );
+        TUint8 third( aAddr[index++] );
+        TUint8 fourth( aAddr[index++] );
+
+        // This macro creates IPAddress into TUint32 format.
+        //lint -e{1924} Problem inside epoc macro, nothing to do.
+        destinationAddress = TInetAddr( INET_ADDR( first, second, third, fourth ),
+            iConnInfo.iProtocol.iPrtNumber );
+        destinationAddress.SetFamily( KAfInet );
+#ifdef ENABLE_SAT_LOGGING
+        destinationAddress.Output( addressForLog );
+        LOG2( NORMAL, "  Using IPv4, Address is %S", &addressForLog )
+#endif
+        }
+    // Check IPv6 address
+    else if ( KIPv6Length == addLength )
+        {
+        TIp6Addr ip6Adrr;
+        for ( TInt index = 0 ; index < addLength ; index++ )
+            {
+            ip6Adrr.u.iAddr8[index] = aAddr[index];
+            }
+
+        destinationAddress = TInetAddr( ip6Adrr, iConnInfo.iProtocol.iPrtNumber );
+        destinationAddress.SetFamily( KAfInet6 );
+#ifdef ENABLE_SAT_LOGGING
+        destinationAddress.Output( addressForLog );
+        LOG2( NORMAL, "  Using IPv6, Address is %S", &addressForLog )
+#endif
+#ifdef SAT_USE_DUMMY_TSY
+        // Using Dummy TSY, overwriting IPv6 address to IPv4 since
+        // Windows 2000 doesn't support IPv6
+        destinationAddress.ConvertToV4();
+        destinationAddress.SetFamily( KAfInet );
+#ifdef ENABLE_SAT_LOGGING
+        destinationAddress.Output( addressForLog );
+        LOG2( NORMAL, "  Converted IPv6 address to IPv4,\
+             Address is %S", &addressForLog )
+#endif
+        destinationAddress.SetAddress( INET_ADDR(
+            KIpAddressAValue,
+            KIpAddressBValue,
+            KIpAddressCValue,
+            KIpAddressDValueDestination ) );
+#ifdef ENABLE_SAT_LOGGING
+        destinationAddress.Output( addressForLog );
+        LOG2( NORMAL, "  Overwrited IPv4 localhost,\
+             Address is %S", &addressForLog )
+#endif
+#endif //SAT_USE_DUMMY_TSY
+        }
+    else // Invalid IP address length
+        {
+        LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::DestAddress \
+        invalid IP address" )
+        destinationAddress = TInetAddr( 0 , 0 );
+        destinationAddress.SetFamily( KAFUnspec );
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::DestAddress exiting" )
+    return destinationAddress;
+    }
+
+// ---------------------------------------------------------------------------
+// Write Primary PDP Context QoS parameters to RCmManager
+// ---------------------------------------------------------------------------
+//
+void CSatBIPGPRSDataChannel::WritePrimaryPDPContextQoSParamsL()
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatBIPGPRSDataChannel::WritePrimaryPDPContextQoSParamsL \
+        calling" )
+
+    if ( iConnInfo.iOverrideSet )
+        {
+        LOG( SIMPLE,
+        "SATENGINE: CSatBIPGPRSDataChannel::WritePrimaryPDPContextQoSParamsL \
+        iConnInfo.iOverrideSet true" )
+        
+        TUint32 iapId( iConnInfo.iOverrideSet->IapId() );
+        LOG2( SIMPLE, 
+              "SATENGINE: CSatBIPGPRSDataChannel::WritePrimaryPDPContextQoSParamsL \
+              IAP id = %d", iapId )
+        
+        RPacketQoS::TQoSGPRSRequested reqQoS;
+        TSatQoSParser::GetRequestedQoSValues( iConnInfo.iBearerParams, 
+            reqQoS );
+        TSatQoSParser::TQoSRel5 qosRel5 = TSatQoSParser::ConvertQoS( reqQoS );    
+        
+        RCmManager cmManager;
+        cmManager.OpenLC();
+
+        RCmConnectionMethod cm = cmManager.ConnectionMethodL( iapId );
+        CleanupClosePushL( cm );
+        
+        // Requested traffic class.
+        // Type of application for which the UMTS bearer service is optimised
+        cm.SetIntAttributeL( CMManager::EGPRSReqTrafficClass, 
+                             qosRel5.iTrafficClass );
+        LOG2( SIMPLE, "  EGPRSReqTrafficClass:    0x%x", 
+              qosRel5.iTrafficClass )
+        
+        // Requested traffic handling priority.                     
+        // Specifies the relative importance for handling of all SDUs belonging
+        // to the UMTS bearer compared to the SDUs of other bearers.
+        cm.SetIntAttributeL( CMManager::EGPRSReqTrafficHandlingPriority, 
+                             qosRel5.iTrafficHandlingPriority );
+        LOG2( SIMPLE, "  EGPRSReqTrafficHandlingPriority:    0x%x", 
+              qosRel5.iTrafficHandlingPriority )                
+        
+        // Requested target SDU error ratio.
+        // Indicates the fraction of SDUs lost or detected as erroneous.               
+        cm.SetIntAttributeL( CMManager::EGPRSReqSDUErrorRatio, 
+                             qosRel5.iSduErrorRatio );
+        LOG2( SIMPLE, "  EGPRSReqSDUErrorRatio:    0x%x", 
+              qosRel5.iSduErrorRatio )                         
+                             
+        // Requested target Bit error ratio.
+        // Indicates the undetected bit error ratio in the delivered SDU.
+        cm.SetIntAttributeL( CMManager::EGPRSReqBER, 
+                             qosRel5.iResidualBer);
+        LOG2( SIMPLE, "  EGPRSReqBER:    0x%x", 
+              qosRel5.iResidualBer )                          
+              
+        // Requested value for erroneous SDU delivery. 
+        // Indicates whether SDUs detected as erroneous shall be
+        // delivered or discarded
+        cm.SetIntAttributeL( CMManager::EGPRSReqDeliverErroneousSDU, 
+                             qosRel5.iDeliveryErroneousSdu );
+        LOG2( SIMPLE, "  EGPRSReqDeliverErroneousSDU:    0x%x", 
+              qosRel5.iDeliveryErroneousSdu )
+        
+        // Requested maximum bit rates on downlink.                     
+        cm.SetIntAttributeL( CMManager::EGPRSReqMaxDownlinkRate, 
+                             qosRel5.iMaxBitRate );
+        LOG2( SIMPLE, "  EGPRSReqMaxDownlinkRate:    0x%x", 
+              qosRel5.iMaxBitRate )
+        
+        // Requested maximum bit rates on uplink      
+        cm.SetIntAttributeL( CMManager::EGPRSReqMaxUplinkRate, 
+                             qosRel5.iMaxBitRate );
+        LOG2( SIMPLE, "  EGPRSReqMaxUplinkRate:    0x%x", 
+              qosRel5.iMaxBitRate )       
+        
+        // Request maximum SDU size.
+        // The maximum SDU size for which the network shall 
+        // satisfy the negotiated QoS
+        cm.SetIntAttributeL( CMManager::EGPRSReqMaxSDUSize, 
+                             qosRel5.iMaximumSDUSize );
+        LOG2( SIMPLE, "  EGPRSReqMaxSDUSize:    0x%x", 
+              qosRel5.iMaximumSDUSize )
+        
+        // Requested value for sequential SDU delivery.
+        // Indicates whether the UMTS bearer shall provide 
+        // in-sequence SDU delivery or not.
+        cm.SetIntAttributeL( CMManager::EGPRSReqDeliveryOrder, 
+                             qosRel5.iDeliveryOrder );
+        LOG2( SIMPLE, "  EGPRSReqDeliveryOrder:    0x%x", 
+              qosRel5.iDeliveryOrder )
+
+        cm.UpdateL();
+        
+        CleanupStack::PopAndDestroy( &cm );
+        CleanupStack::PopAndDestroy( &cmManager );
+        }
+   
+    LOG( SIMPLE,
+        "SATENGINE: CSatBIPGPRSDataChannel::WritePrimaryPDPContextQoSParamsL \
+        exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// Write default QoS Parameters to RCmManager
+// ---------------------------------------------------------------------------
+//
+void CSatBIPGPRSDataChannel::WriteDefaultQoSParamsL()
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatBIPGPRSDataChannel::WriteDefaultQoSParamsL \
+        calling" )
+        
+    if ( iConnInfo.iOverrideSet )
+        {
+        LOG( SIMPLE,
+        "SATENGINE: CSatBIPGPRSDataChannel::WriteDefaultQoSParamsL \
+        iConnInfo.iOverrideSet true" );
+        TUint32 iapId( iConnInfo.iOverrideSet->IapId() ); 
+        LOG2( SIMPLE, 
+              "SATENGINE: CSatBIPGPRSDataChannel::WriteDefaultQoSParamsL \
+              IAP id = %d", iapId )        
+        
+        RCmManager cmManager;
+        cmManager.OpenLC();
+
+        RCmConnectionMethod cm = cmManager.ConnectionMethodL( iapId );
+        CleanupClosePushL( cm );
+        
+        cm.SetIntAttributeL( CMManager::EGPRSReqTrafficClass, 
+                             RPacketQoS::ETrafficClassUnspecified );
+                             
+        cm.SetIntAttributeL( CMManager::EGPRSReqTrafficHandlingPriority, 
+                             RPacketQoS::ETrafficPriorityUnspecified );
+                             
+        cm.SetIntAttributeL( CMManager::EGPRSReqSDUErrorRatio, 
+                             RPacketQoS::ESDUErrorRatioUnspecified );
+                             
+        cm.SetIntAttributeL( CMManager::EGPRSReqBER, 
+                             RPacketQoS::EBERUnspecified );
+        
+        cm.SetIntAttributeL( CMManager::EGPRSReqDeliverErroneousSDU, 
+                             RPacketQoS::EErroneousSDUDeliveryUnspecified );
+                             
+        cm.SetIntAttributeL( CMManager::EGPRSReqMaxDownlinkRate, 0 );
+        
+        cm.SetIntAttributeL( CMManager::EGPRSReqMaxUplinkRate, 0 );
+        
+        cm.SetIntAttributeL( CMManager::EGPRSReqMaxSDUSize, 0 );
+        
+        cm.SetIntAttributeL( CMManager::EGPRSReqDeliveryOrder, 
+                             RPacketQoS::EDeliveryOrderUnspecified );
+
+        LOG( SIMPLE,
+        "SATENGINE: CSatBIPGPRSDataChannel::WriteDefaultQoSParamsL \
+        set default QoS params" );
+
+        cm.UpdateL();
+        
+        CleanupStack::PopAndDestroy( &cm );
+        CleanupStack::PopAndDestroy( &cmManager );
+        }
+    
+    LOG( SIMPLE,
+        "SATENGINE: CSatBIPGPRSDataChannel::WriteDefaultQoSParamsL \
+        exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// Set QoS for connection or subconnection
+// ---------------------------------------------------------------------------
+//
+void CSatBIPGPRSDataChannel::SetConnQoSParamsL()
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatBIPGPRSDataChannel::SetConnQoSParamsL calling" )
+    
+    RPacketQoS::TQoSGPRSNegotiated negQoS;  // The negotiated QoS
+    
+    // If using Dummy TSY, set the negotiated QoS directly by hard-codes,
+    // otherwise, fetch negotiated QoS for primary context(by ETel API), set QoS
+    // for secondary context. 
+#ifdef SAT_USE_DUMMY_TSY    
+    // Set the negotiated QoS directly if using Dummy TSY
+    LOG( NORMAL, "SATENGINE: CSatBIPGPRSDataChannel::ActivateConnectionL\
+        don't need to set qos for dummy tsy" )
+    negQoS.iPrecedence = RPacketQoS::EPriorityHighPrecedence;
+    negQoS.iDelay = RPacketQoS::EDelayClass4;
+    negQoS.iReliability = RPacketQoS::EReliabilityClass3;
+    negQoS.iPeakThroughput = RPacketQoS::EPeakThroughput256000;
+    negQoS.iMeanThroughput = RPacketQoS::EUnspecifiedMeanThroughput;
+    TSatQoSParser::GetNegotiatedQoSValues( negQoS, iConnInfo.iBearerParams );
+    // Set last bearer param to IP Protocol
+    iConnInfo.iBearerParams[KProtocolPos] = KReqPacketProtType;     
+#else   // Set QoS for channels
+    if ( iUtils.IsSubConnectionActivated() ) 
+        {
+        // Set QoS params, granted QoS will be fetched after connected
+         LOG( NORMAL, "SATENGINE: CSatBIPGPRSDataChannel::ActivateConnectionL\
+                Set QoS values for SubConnection" )
+        SetSubConQoSParamsL();
+        }
+    else
+        {
+        // Primary PDP Context need to be fetched by ETel API
+         RPacketQoS::TQoSGPRSRequested reqQoS;
+         TSatQoSParser::GetRequestedQoSValues( iConnInfo.iBearerParams, 
+            reqQoS );
+        negQoS = iUtils.ProposeQoSParametersL( reqQoS );
+        TSatQoSParser::GetNegotiatedQoSValues( negQoS, 
+            iConnInfo.iBearerParams );
+        // Set last bearer param to IP Protocol
+        iConnInfo.iBearerParams[KProtocolPos] = KReqPacketProtType;      
+        }
+#endif
+        
+    LOG( SIMPLE,
+        "SATENGINE: CSatBIPGPRSDataChannel::SetConnQoSParamsL exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// GetSubConQoSR5ParamsFromEvent
+// ---------------------------------------------------------------------------
+//
+TInt CSatBIPGPRSDataChannel::GetSubConQoSR5ParamsFromEvent(
+    CSubConNotificationEvent& aEvent, 
+    TSatQoSParser::TQoSRel5& aNegQoSRel5 )
+    {
+    LOG( SIMPLE, 
+        "SATENGINE: CSatBIPGPRSDataChannel::GetSubConQoSR5ParamsFromEvent \
+        calling" )
+    TInt errCode( KErrNone );
+    
+    CSubConGenEventParamsGranted* grantedEvent = 
+        static_cast<CSubConGenEventParamsGranted*>( &aEvent );
+    
+    TInt extSetNum = grantedEvent->GetNumExtensionSets();
+    LOG2( NORMAL, 
+        "SATENGINE: GetSubConQoSR5ParamsFromEvent extSetNum :%d ", extSetNum )
+                 
+    const CSubConExtensionParameterSet* grantedExtParams = 
+        grantedEvent->GetExtensionSet( extSetNum-1 );
+    
+    if ( grantedExtParams )
+        {
+        CSubConQosR5ParamSet* paramSet;
+        paramSet = ( CSubConQosR5ParamSet* )grantedExtParams;
+        
+        if ( paramSet )
+            {
+            aNegQoSRel5.iTrafficClass = paramSet->GetTrafficClass();
+            aNegQoSRel5.iTrafficHandlingPriority =
+                paramSet->GetTrafficHandlingPriority();
+            aNegQoSRel5.iSduErrorRatio = paramSet->GetSDUErrorRatio();
+            aNegQoSRel5.iResidualBer = paramSet->GetResidualBitErrorRatio();
+            aNegQoSRel5.iDeliveryErroneousSdu = 
+                paramSet->GetErroneousSDUDelivery();
+            aNegQoSRel5.iMaxBitRate = Max( paramSet->GetMaxBitrateUplink(),
+                                        paramSet->GetMaxBitrateDownlink() );
+            aNegQoSRel5.iMaximumSDUSize = paramSet->GetMaxSduSize();
+            aNegQoSRel5.iDeliveryOrder = paramSet->GetDeliveryOrder();
+                
+            LOG2( SIMPLE, "Negotiated TrafficClass: %d", 
+                aNegQoSRel5.iTrafficClass )
+            LOG2( SIMPLE, "Negotiated TrafficHandlingPriority: %d", 
+                aNegQoSRel5.iTrafficHandlingPriority )
+            LOG2( SIMPLE, "Negotiated SDUErrorRatio: %d", 
+                aNegQoSRel5.iSduErrorRatio )
+            LOG2( SIMPLE, "Negotiated ResidualBitErrorRatio: %d", 
+                aNegQoSRel5.iResidualBer )
+            LOG2( SIMPLE, "Negotiated ErroneousSDUDelivery: %d", 
+                aNegQoSRel5.iDeliveryErroneousSdu )
+            LOG2( SIMPLE, "Negotiated Maxbitrate: %d", 
+                aNegQoSRel5.iMaxBitRate )
+            LOG2( SIMPLE, "Negotiated MaximumSDUSize: %d", 
+                aNegQoSRel5.iMaximumSDUSize )
+            LOG2( SIMPLE, "Negotiated DeliveryOrder: %d", 
+                aNegQoSRel5.iDeliveryOrder )
+            }
+        else
+            {
+            LOG( NORMAL, "SATENGINE: GetSubConQoSR5ParamsFromEvent\
+                Can't get CSubConQosR5ParamSet " )
+            errCode = KErrNotSupported;
+            }
+        }
+    else
+        {
+        LOG( NORMAL, "SATENGINE: GetSubConQoSR5ParamsFromEvent\
+                Can't get granted CSubConExtensionParameterSet " )
+        errCode = KErrNotSupported;
+        }
+     
+    LOG2( SIMPLE,
+        "SATENGINE: CSatBIPGPRSDataChannel::GetSubConQoSR5ParamsFromEvent \
+        exiting, errCode: %d", errCode )
+    return errCode;
+    }
+    
+// ---------------------------------------------------------------------------
+// GrantedEventReceivedL
+// ---------------------------------------------------------------------------
+//   
+void CSatBIPGPRSDataChannel::GrantedEventReceivedL( 
+    const TNotificationEventBuf& aEventBuffer )
+    {
+    LOG( SIMPLE, 
+        "SATENGINE: CSatBIPGPRSDataChannel::GrantedEventReceivedL calling" )
+    TInt errCode( KErrNone );
+    RPacketQoS::TQoSGPRSNegotiated negQoS;
+    
+    // Exacting information from receieved events
+	CSubConNotificationEvent* event = 
+        CSubConNotificationEvent::NewL( aEventBuffer );
+        
+    if ( KSubConnGenericEventsImplUid == event->GroupId() )
+        {
+        LOG( NORMAL, "SATENGINE: GrantedEventReceivedL \
+            event->GroupId() == KSubConnGenericEventsImplUid" )
+        TSatQoSParser::TQoSRel5 negQoSRel5;
+                
+        switch ( event->Id() )
+            {
+            case KSubConGenericEventParamsGranted:
+                {
+                LOG( NORMAL, 
+                    "SATENGINE: GrantedEventReceivedL Request granted" )
+                      
+                // Get the granted param set from event
+                errCode = GetSubConQoSR5ParamsFromEvent( *event, negQoSRel5 );
+                LOG2( NORMAL, 
+                       "SATENGINE: GetSubConQoSR5ParamsFromEvent errCode %d ", 
+                       errCode )
+                User::LeaveIfError( errCode );
+                break;
+                }
+            case KSubConGenericEventParamsRejected:
+                {
+                LOG( NORMAL, 
+                        "SATENGINE: GrantedEventReceivedL Request Rejected" )
+                        
+                CSubConGenEventParamsRejected* rejectedEvent = 
+                     static_cast<CSubConGenEventParamsRejected*>( event );
+                errCode = rejectedEvent->Error();
+                     
+                LOG2( NORMAL, 
+                        "SATENGINE: GrantedEventReceivedL\
+	                        rejectedEvent->Error() = %d", errCode )
+	            User::LeaveIfError( errCode );
+	            break;
+                }
+            default:
+                {
+                LOG( NORMAL, 
+                    "SATENGINE: GrantedEventReceivedL. EventId \
+                    not in KSubConGenericEventParamsRejected/Granted " )
+                // Do nothing
+                break;
+                }
+            }                
+        // convert negQoSRel5 to negQoS
+        negQoS = TSatQoSParser::ConvertNegotiatedQoS( negQoSRel5 );
+                             
+        TSatQoSParser::GetNegotiatedQoSValues( negQoS, 
+            iConnInfo.iBearerParams );
+                
+        // Set last bearer param to IP Protocol
+        iConnInfo.iBearerParams[KProtocolPos] = KReqPacketProtType;
+        }
+
+    LOG( SIMPLE, 
+        "SATENGINE: CSatBIPGPRSDataChannel::GrantedEventReceivedL exiting" )
+    }
+    
+// ---------------------------------------------------------------------------
+// Returns sub connection
+// ---------------------------------------------------------------------------
+//
+RSubConnection& CSatBIPGPRSDataChannel::SubConnection() const
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::SubConnection\
+        calling - exiting" )
+    return iSubConnection;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/CSatBIPUtils.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,937 @@
+/*
+* 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:  Utility class for BIP
+*
+*/
+
+
+#include <es_sock.h>
+#include <etelqos.h>
+#include "SatLog.h"
+#include "CSatBIPUtils.h"
+#include "CSatBIPGPRSDataChannel.h"
+#include "csatbipconnectionobserver.h"
+#include "MSatBIPDataChannel.h"
+#include "MSatBIPChannelStatusObserver.h"
+#include "MSatBIPDataAvailableObserver.h"
+//lint -e766 Used inside TRAP macro, lint misfunction.
+#include "EnginePanic.h"
+#include "TSatChannelIDInfo.h"
+#include "MSatUtils.h"
+#include "CSatApnHandler.h"
+#include "csatsactivewrapper.h"
+#include "msatmultimodeapi.h"
+
+const TInt KPDPContextPos( 7 );
+const TInt KMaxAvailChannels( 7 );
+const TInt8 KProposeQoSParametersPop( 2 );
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CSatBIPUtils* CSatBIPUtils::NewL( MSatUtils& aUtils )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::NewL calling" )
+
+    CSatBIPUtils* self = new ( ELeave ) CSatBIPUtils( aUtils );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::NewL exiting" )
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CSatBIPUtils::~CSatBIPUtils()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::~CSatBIPUtils calling" )
+
+    // Close all data channels
+    if ( iDataChannels )
+        {
+        iDataChannels->ResetAndDestroy();
+        }
+    delete iDataChannels;
+
+    if ( iChannelIds )
+        {
+        iChannelIds->ResetAndDestroy();
+        }
+    delete iChannelIds;
+    
+    delete iChannelId;
+    
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::~CSatBIPUtils\
+            Close connection and subconnection" )
+    iSubConnection.Close();
+    iConnection.Close();
+    iSocketServer.Close();
+    iPacketService.Close();
+    
+    delete iApnHandler;
+
+    if ( iWrapper )
+        {
+        iWrapper->CancelWrapper();
+        delete iWrapper;
+        iWrapper = NULL;
+        }
+
+    if ( iConnObserver )
+        {
+        iConnObserver->Cancel();
+        delete iConnObserver;
+        iConnObserver = NULL;
+        }
+
+    iDataAvailableObserver = NULL;
+    iChannelStatusObserver = NULL;
+
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::~CSatBIPUtils exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// Handles event
+// ---------------------------------------------------------------------------
+//
+void CSatBIPUtils::Event( TInt aEvent )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::Event calling" )
+
+    // Check event
+    if ( MSatUtils::ECommandCancelled == aEvent ||
+         MSatUtils::ECancelledUsingEndKey == aEvent )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatBIPUtils::Event check event" )
+        if ( iDataChannels )
+            {
+            const TInt channelCount( iDataChannels->Count() );
+            LOG2( SIMPLE, "SATENGINE: CSatBIPUtils::Event channelCount: %d",
+                  channelCount )
+            // Cancel all channels
+            for ( TInt index = 0; index < channelCount; index++ )
+                {
+                MSatBIPDataChannel* channel = iDataChannels->At( index );
+                __ASSERT_ALWAYS( channel,
+                    PanicSatEngine( ESatEngineNullPointer ) );
+                channel->CancelAll();
+                }
+            }
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::Event exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// Creates new data channel
+// ---------------------------------------------------------------------------
+//
+MSatBIPDataChannel* CSatBIPUtils::CreateChannelL(
+    const TSatBearerType aBearerType, TInt& aErrCode )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::CreateChannelL calling" )
+
+    TInt errCode( MSatBIPUtils::ESatBIPNoChannelAvail );
+    MSatBIPDataChannel* channel = NULL;
+
+    // Get available channel ID
+    TSatChannelIdInfo* channelId( AvailableChannelID() );
+
+    // Check is the channel available
+    if ( channelId )
+        {
+        // Create the right type of data channel
+        if ( MSatBIPUtils::ESatGPRS == aBearerType )
+            {
+            LOG( NORMAL, 
+            "SATENGINE: CSatBIPUtils::CreateChannelL ESatGPRS" )
+            // New GPRS data channel
+            channel = CSatBIPGPRSDataChannel::NewLC( *this, iSocketServer,
+                *channelId, iConnection, iSubConnection );
+            // Reserve channel ID
+            channelId->ReserveChannel();
+            // Add data channel to list
+            iDataChannels->AppendL( channel );
+            // Remove from CleanupStack
+            CleanupStack::Pop( /* channel */ );
+            // Return code
+            errCode = MSatBIPUtils::ESatBIPSuccess;
+
+#ifndef SAT_USE_DUMMY_TSY
+            // Start connection observer
+            if ( !iConnObserver )
+                {
+                LOG( NORMAL, " Starting connection observer" )
+                iConnObserver = 
+                    new ( ELeave ) CSatBIPConnectionObserver( *this );
+                iConnObserver->StartObserver();
+                }
+#endif
+            }
+        else
+            {
+            // Others that GPRS are not yet supported
+            LOG( NORMAL, 
+                "SATENGINE: CSatBIPUtils::CreateChannelL Not supported" )
+            errCode = MSatBIPUtils::ESatBIPNoChannelAvail;
+            }
+        }
+    else
+        {
+        // Channel IDs not available
+        LOG( NORMAL, 
+            "SATENGINE: CSatBIPUtils::CreateChannelL Not available" )
+        errCode = MSatBIPUtils::ESatBIPNoChannelAvail;
+        }
+
+    // Assign completion code
+    aErrCode = errCode;
+
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::CreateChannelL exiting" )
+    return channel;
+    }
+
+// ---------------------------------------------------------------------------
+// Closes the data channel
+// ---------------------------------------------------------------------------
+//
+TInt CSatBIPUtils::CloseChannel( const TInt aChannelId )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::CloseChannel calling" )
+
+    TInt errCode( MSatBIPUtils::ESatBIPChannelIdNotValid );
+
+    TInt index( 0 );
+    TBool channelClosed( EFalse );
+
+    // Loop the list of data channels and close the correct one.
+    while ( index < iDataChannels->Count() && !channelClosed )
+        {
+        MSatBIPDataChannel* channel = iDataChannels->At( index );
+        __ASSERT_ALWAYS( channel, PanicSatEngine( ESatEngineNullPointer ) );
+
+        if ( channel->ChannelId() == aChannelId )
+            {
+            LOG( SIMPLE, "SATENGINE: CSatBIPUtils::CloseChannel \
+            channel->ChannelId() == aChannelId" )
+             // Makes next data channel creation possible
+            iDataChannelActivated = EFalse;
+            // Channel found, close it and return Success.
+            channel->CloseChannel();
+            // Delete data channel
+            iDataChannels->Delete( index );
+            delete channel;
+            errCode = MSatBIPUtils::ESatBIPSuccess;
+            channelClosed = ETrue;
+            }
+        // Goto next channel
+        index++;
+        }
+    LOG2( SIMPLE, "SATENGINE: CSatBIPUtils::CloseChannel index: %d", index )
+
+    // Free the space left in possible Delete call.
+    iDataChannels->Compress();
+    
+    // Close connections if there're no active channels
+    if ( !IsContextActive() )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatBIPUtils::CloseChannel\
+            Close connection and subconnection" )
+        iSubConnection.Close();
+        SetSubConnectionActivated( EFalse );
+        iConnection.Close();
+        SetConnectionActivated( EFalse );
+        
+        if ( iConnObserver )
+            {
+            iConnObserver->Cancel();
+            delete iConnObserver;
+            iConnObserver = NULL;
+            }
+        LOG( SIMPLE, "SATENGINE: CSatBIPUtils::CloseChannel\
+            Close iPacketService" )
+        iPacketService.Close();
+        iPacketServiceActive = EFalse;
+        }
+    
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::CloseChannel exiting" )
+    return errCode;
+    }
+
+// ---------------------------------------------------------------------------
+// Closes all data channels
+// ---------------------------------------------------------------------------
+//
+void CSatBIPUtils::CloseAllChannels()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::CloseAllChannels calling" )
+    LOG2( SIMPLE, "SATENGINE: CSatBIPUtils::CloseAllChannels \
+          channelcount: %d", iChannelIds->Count() )
+    // Loop the list of data channels and close the correct one.
+    for ( TInt i = 0; i < iChannelIds->Count(); i++ )
+        {
+        TSatChannelIdInfo* id = iChannelIds->At( i );
+        // If channel is reserved -> Close it
+        if ( id->IsReserved() )
+            {
+            LOG( SIMPLE, "SATENGINE: CSatBIPUtils::CloseAllChannels \
+            id->IsReserved()" )
+            CloseChannel( id->ChannelId() );
+            }
+        }
+    
+    // Close subsession to socket server
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::CloseAllChannels\
+            Close connection and subconnection" )
+    iSubConnection.Close();
+    SetSubConnectionActivated( EFalse );
+    iConnection.Close();
+    SetConnectionActivated( EFalse );
+    
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::CloseAllChannels exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// Returns the correct data channel
+// ---------------------------------------------------------------------------
+//
+MSatBIPDataChannel* CSatBIPUtils::DataChannel( const TInt aChannelId,
+            TInt& aErrCode )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::DataChannel calling" )
+
+    // If the channel cannot be found, returns channel not valid error code
+    TInt errCode( MSatBIPUtils::ESatBIPChannelIdNotValid );
+    MSatBIPDataChannel* channel = NULL;
+    TBool found( EFalse );
+    TInt index( 0 );
+
+    // Loop the list of data channels and return the correct one.
+    while ( index < iDataChannels->Count() && !found )
+        {
+        channel = iDataChannels->At( index );
+        __ASSERT_ALWAYS( channel, PanicSatEngine( ESatEngineNullPointer ) );
+        // Compare channel ID's
+        if ( channel->ChannelId() == aChannelId )
+            {
+            LOG( SIMPLE, "SATENGINE: CSatBIPUtils::DataChannel \
+            channel->ChannelId() == aChannelId" )
+            // Channel found
+            found = ETrue;
+            if ( channel->IsContextActive() )
+                {
+                LOG( SIMPLE, "SATENGINE: CSatBIPUtils::DataChannel \
+                IsContextActive" )
+                // Channel found and it is active
+                errCode = MSatBIPUtils::ESatBIPSuccess;
+                }
+            else
+                {
+                // Channel found but it is closed
+                errCode = MSatBIPUtils::ESatBIPChannelClosed;
+                }
+            }
+        index++;
+        }
+    LOG2( SIMPLE, "SATENGINE: CSatBIPUtils::DataChannel \
+          index: %d", index )
+    // Assign completion code to param
+    aErrCode = errCode;
+
+    LOG2( SIMPLE,
+        "SATENGINE: CSatBIPUtils::DataChannel exiting with return code %d",
+        errCode )
+    return channel;
+    }
+
+// ---------------------------------------------------------------------------
+// Generates TChannelStatus object
+// ---------------------------------------------------------------------------
+//
+RSat::TChannelStatus CSatBIPUtils::GenerateChannelStatusL(
+    const TInt aChannelId, TInt aStatus )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::GenerateChannelStatusL calling" )
+
+    // ChannelStatus's first byte contains channel ID and pdp context status,
+    // second byte contains information. values can be '00' or '05'
+    RSat::TChannelStatus channelStatus;
+    TInt err( MSatBIPUtils::ESatBIPNoChannelAvail );
+
+    // Used to check the PDP context state
+    MSatBIPDataChannel* dataChannel = DataChannel( aChannelId, err );
+
+    // If channel is not active, status is still needed
+    if ( ESatBIPSuccess == err || ESatBIPChannelClosed == err )
+        {
+        // Generate the first byte
+        TUint8 channelId( 0 );   // last 3 bits.
+        TUint8 pdpContext( 0 );  // first bit
+        TUint8 firstByte( 0 );    // First byte
+
+        // Channel ID. Bits 6 to 8.
+        channelId = dataChannel->ChannelStatusChannelId();
+
+        // If PDP Context is active, first bit is 1
+        if ( dataChannel->IsContextActive() )
+            {
+            LOG( SIMPLE, "SATENGINE: CSatBIPUtils::GenerateChannelStatusL \
+            dataChannel IsContextActive" )
+            pdpContext = 1 << KPDPContextPos;
+            }
+
+        // We don't need data channel anymore
+        dataChannel = NULL;
+
+        // All the information for the first byte is gathered
+        firstByte = static_cast<TUint8>( pdpContext ^ channelId );
+        channelStatus.Append( firstByte );
+        // Second byte should go straigth
+        channelStatus.Append( aStatus );
+        // LOG values
+        LOG2( NORMAL,
+            "SATENGINE: CSatBIPUtils::GenerateChannelStatusL First byte: %b",
+            firstByte )
+        LOG2( NORMAL,
+            "SATENGINE: CSatBIPUtils::GenerateChannelStatusL Second byte: %b",
+            aStatus )
+        }
+    else
+        {
+        LOG2( NORMAL, "SATENGINE: CSatBIPUtils::GenerateChannelStatusL \
+            Data channel not found: %i", err )
+        User::LeaveIfError( KErrNotFound );
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::GenerateChannelStatusL exiting" )
+    return channelStatus;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns the interface reference to APN handler
+// ---------------------------------------------------------------------------
+//
+MSatApnHandler& CSatBIPUtils::ApnHandler()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::ApnHandler calling" )
+
+    // Assert, Apn handler cannot be NULL
+    __ASSERT_ALWAYS( iApnHandler, PanicSatEngine( ESatEngineNullPointer ) );
+
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::ApnHandler exiting" )
+    return *iApnHandler;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns the state of the PDP Context
+// ---------------------------------------------------------------------------
+//
+TBool CSatBIPUtils::IsContextActive()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::IsContextActive calling" )
+
+    TBool retVal( EFalse );
+    TInt index( 0 );
+    
+    // Loop the list of data channels and end if active channel is found
+    while ( index < iDataChannels->Count() && !retVal )
+        {
+        MSatBIPDataChannel* channel = iDataChannels->At( index );
+        __ASSERT_ALWAYS( channel, PanicSatEngine( ESatEngineNullPointer ) );
+        retVal = channel->IsContextActive();
+        // Goto next channel
+        index++;
+        }
+    LOG2( SIMPLE, "SATENGINE: CSatBIPUtils::IsContextActive \
+          index: %d", index )
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::IsContextActive exiting" )
+    return retVal;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns the array of data channels
+// ---------------------------------------------------------------------------
+//
+CArrayPtrFlat<MSatBIPDataChannel>* CSatBIPUtils::DataChannels()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::DataChannels calling - exiting" )
+    return iDataChannels;
+    }
+
+// ---------------------------------------------------------------------------
+// Request to notify when data is available
+// ---------------------------------------------------------------------------
+//
+void CSatBIPUtils::NotifyDataAvailable(
+    MSatBIPDataAvailableObserver* aObserver )
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatBIPUtils::NotifyDataAvailable calling - exiting" )
+    iDataAvailableObserver = aObserver;
+    }
+
+// ---------------------------------------------------------------------------
+// Request to notify when an error occurs in data channel
+// ---------------------------------------------------------------------------
+//
+void CSatBIPUtils::NotifyChannelStatus(
+    MSatBIPChannelStatusObserver* aObserver )
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatBIPUtils::NotifyChannelStatus calling - exiting" )
+    iChannelStatusObserver = aObserver;
+    }
+
+// ---------------------------------------------------------------------------
+// Cancels the DataAvailable request
+// ---------------------------------------------------------------------------
+//
+void CSatBIPUtils::CancelDataAvailable()
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatBIPUtils::CancelDataAvailable calling - exiting" )
+    iDataAvailableObserver = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// Cancels the ChannelStatus request
+// ---------------------------------------------------------------------------
+//
+void CSatBIPUtils::CancelChannelStatus()
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatBIPUtils::CancelChannelStatus calling - exiting" )
+    iChannelStatusObserver = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// DataAvailable event. Notifies observer.
+// ---------------------------------------------------------------------------
+//
+void CSatBIPUtils::DataAvailable( const TInt aChannelId, const TInt aLength )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::DataAvailable calling" )
+
+    // If there is an active request for this event, notify observer.
+    if ( iDataAvailableObserver )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatBIPUtils::DataAvailable \
+        iDataAvailableObserver true" )
+        iDataAvailableObserver->DataAvailable( aChannelId, aLength );
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::DataAvailable exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// ChannelStatus event. Notifies observer.
+// ---------------------------------------------------------------------------
+//
+void CSatBIPUtils::ChannelStatus( const TInt aChannelId, const TInt aStatus )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::ChannelStatus calling" )
+
+    // If there is an active request for this event, notify observer.
+    if ( iChannelStatusObserver )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatBIPUtils::ChannelStatus \
+        iChannelStatusObserver true" )
+        iChannelStatusObserver->ChannelStatus( aChannelId, aStatus );
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::ChannelStatus exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CSatBIPUtils::CSatBIPUtils( MSatUtils& aUtils ) :
+    iChannelId( NULL ),
+    iUtils( aUtils )
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatBIPUtils::CSatBIPUtils calling-exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+void CSatBIPUtils::ConstructL()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::ConstructL calling" )
+
+    // Create array for the data channels.
+    iDataChannels =
+        new ( ELeave ) CArrayPtrFlat<MSatBIPDataChannel>( KMaxAvailChannels );
+
+    // Create array for Channel ID infos
+    iChannelIds =
+        new ( ELeave ) CArrayPtrFlat<TSatChannelIdInfo>( KMaxAvailChannels );
+
+    TUint8 index = 1;
+    
+    iChannelId = new ( ELeave ) TSatChannelIdInfo( RSat::KChannel1, index++ );
+    iChannelIds->AppendL( iChannelId );
+    iChannelId = NULL;
+    
+    iChannelId = new ( ELeave ) TSatChannelIdInfo( RSat::KChannel2, index++ );
+    iChannelIds->AppendL( iChannelId );
+    iChannelId = NULL;
+    
+    iChannelId = new ( ELeave ) TSatChannelIdInfo( RSat::KChannel3, index++ );
+    iChannelIds->AppendL( iChannelId );
+    iChannelId = NULL;
+    
+    iChannelId = new ( ELeave ) TSatChannelIdInfo( RSat::KChannel4, index++ );
+    iChannelIds->AppendL( iChannelId );
+    iChannelId = NULL;
+    
+    iChannelId = new ( ELeave ) TSatChannelIdInfo( RSat::KChannel5, index++ );
+    iChannelIds->AppendL( iChannelId );
+    iChannelId = NULL;
+    
+    iChannelId = new ( ELeave ) TSatChannelIdInfo( RSat::KChannel6, index++ );
+    iChannelIds->AppendL( iChannelId );
+    iChannelId = NULL;
+    
+    iChannelId = new ( ELeave ) TSatChannelIdInfo( RSat::KChannel7, index++ );
+    iChannelIds->AppendL( iChannelId );
+    iChannelId = NULL;
+    
+    // Regiseter to listen events
+    iUtils.RegisterL( this, MSatUtils::ECommandCancelled );
+    iUtils.RegisterL( this, MSatUtils::ECancelledUsingEndKey );
+
+    // Connect to Socket Server
+    User::LeaveIfError( iSocketServer.Connect() );
+    iPacketServiceActive = EFalse;
+    iApnHandler = CSatApnHandler::NewL( iUtils );
+
+    iWrapper = new ( ELeave ) CSatSActiveWrapper;
+    
+    SetConnectionActivated( EFalse );
+    SetSubConnectionActivated( EFalse );
+
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::ConstructL exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// Returns next available channel ID
+// ---------------------------------------------------------------------------
+//
+TSatChannelIdInfo* CSatBIPUtils::AvailableChannelID()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::AvailableChannelID calling" )
+
+    TSatChannelIdInfo* channelId = NULL;
+
+    TInt index( 0 );
+    TBool idFound( EFalse );
+
+    // Loop channel IDs
+    while ( index < iChannelIds->Count() && !idFound )
+        {
+        channelId = iChannelIds->At( index );
+        // If channel is free, take it
+        if ( !channelId->IsReserved() )
+            {
+            LOG( SIMPLE, "SATENGINE: CSatBIPUtils::AvailableChannelID \
+            channel free" )
+            idFound = ETrue;
+            }
+         // goto next channel
+        index++;
+        }
+    LOG2( SIMPLE, "SATENGINE: CSatBIPUtils::AvailableChannelID \
+          index: %d", index )
+    if ( !idFound )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatBIPUtils::AvailableChannelID \
+        idFound false" )
+        // If not found, return NULL
+        channelId = NULL;
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::AvailableChannelID exiting" )
+    return channelId;
+    }
+
+// ---------------------------------------------------------------------------
+// Blocks synchronous requests
+// ---------------------------------------------------------------------------
+//
+RPacketQoS::TQoSGPRSNegotiated CSatBIPUtils::ProposeQoSParametersL(
+    const RPacketQoS::TQoSGPRSRequested& aQoSParams )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::ProposeQoSParametersL calling" )
+
+    // Number of contexts
+    TInt count( ContextCount() ); // Get the number of contexts
+    // QoS profile name
+    TName profName;
+    // Handle to the actual context
+    RPacketContext packetContext;
+    // QoS session
+    RPacketQoS qos;
+    // Context info
+    RPacketService::TContextInfo info;
+    // Error value for asynchronous calls
+    TInt statusError( KErrNone );
+
+    if ( count > 0 ) // At least one context found
+        {
+        // Get the last contexts info
+        iPacketService.GetContextInfo( 
+            iWrapper->RequestStatus(), count - 1, info );
+
+        statusError = iWrapper->SetActiveAndWait(); // Wait for completion
+        LOG2( SIMPLE, "     ContextInfo iActiveStatus: %i", statusError )
+        LOG2( SIMPLE, "     ContextInfo CntxStatus: %i", info.iStatus )
+        // Leave point
+        User::LeaveIfError( statusError );
+        }
+    else
+        {
+        // Didn't find any contexts
+        User::Leave( KErrNotFound );
+        }
+
+    // Get the context by name
+    LOG( SIMPLE, "     Open existing context" )
+    User::LeaveIfError(
+        packetContext.OpenExistingContext( iPacketService, info.iName ) );
+
+    CleanupClosePushL( packetContext );
+
+    // Get the QoS Profile
+    LOG( SIMPLE, "     Get QoS Profile name" )
+    User::LeaveIfError( packetContext.GetProfileName( profName ) );
+
+    // Get the instance of the QoS profile
+    if ( profName.Length() > 0 )
+        {
+        LOG( SIMPLE, "     Open existing QoS profile" )
+        User::LeaveIfError( qos.OpenExistingQoS( packetContext, profName ) );
+        }
+
+    CleanupClosePushL( qos );
+
+    TPckg<RPacketQoS::TQoSGPRSRequested> qosPckg( aQoSParams );
+
+    qos.SetProfileParameters( iWrapper->RequestStatus(), qosPckg );
+
+    User::LeaveIfError( iWrapper->SetActiveAndWait() ); // Wait for completion
+
+    // Get negotioted parameters
+    RPacketQoS::TQoSGPRSNegotiated negParams;
+    TPckg<RPacketQoS::TQoSGPRSNegotiated> negPckg( negParams );
+    qos.GetProfileParameters( iWrapper->RequestStatus(), negPckg );
+
+    User::LeaveIfError( iWrapper->SetActiveAndWait() ); // Wait for completion
+
+    LOG2( SIMPLE, "     GetNegQoSParams Status: %i", statusError )
+    LOG2( SIMPLE, "     GetNegQoSParams Reliability: %i", 
+          negParams.iReliability )
+    LOG2( SIMPLE, "     GetNegQoSParams Precedence: %i", 
+          negParams.iPrecedence )
+    LOG2( SIMPLE, "     GetNegQoSParams Delay: %i", negParams.iDelay )
+    LOG2( SIMPLE, "     GetNegQoSParams Peak: %i", negParams.iPeakThroughput )
+    LOG2( SIMPLE, "     GetNegQoSParams Mean: %i", negParams.iMeanThroughput )
+
+    // Cleaning and closing: packetContext, qos
+    CleanupStack::PopAndDestroy( KProposeQoSParametersPop );
+
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::ProposeQoSParametersL exiting" )
+    return negParams;
+    }
+
+// ---------------------------------------------------------------------------
+// Opens session to GPRS Service
+// ---------------------------------------------------------------------------
+//
+TInt CSatBIPUtils::GprsService()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::GprsService calling" )
+
+    TInt ret( KErrNone );
+    if ( !iPacketServiceActive )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatBIPUtils::GprsService \
+        iPacketServiceActive false" )
+        ret = iPacketService.Open( *( iUtils.MultiModeApi().Phone() ) );
+        iPacketServiceActive = ETrue;
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::GprsService exiting" )
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// Gives reference to RPacketService
+// ---------------------------------------------------------------------------
+//
+RPacketService& CSatBIPUtils::PacketService()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::PacketService calling" )
+
+    GprsService();
+
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::PacketService exiting" )
+    return iPacketService;
+    }
+
+// ---------------------------------------------------------------------------
+// CSatBIPUtils::ConnectionStatus
+// ---------------------------------------------------------------------------
+//
+RPacketService::TStatus CSatBIPUtils::ConnectionStatus() const
+    {
+    LOG( NORMAL,
+        "SATENGINE: CSatBIPUtils::ConnectionStatus calling" )
+
+#ifndef SAT_USE_DUMMY_TSY
+    RPacketService::TStatus status( RPacketService::EStatusSuspended );
+#else
+    RPacketService::TStatus status( RPacketService::EStatusActive );
+#endif
+
+    if ( iConnObserver )
+        {
+        LOG( NORMAL,
+        "SATENGINE: CSatBIPUtils::ConnectionStatus iConnObserver true" )
+        status = iConnObserver->Status();
+        }
+
+    LOG( NORMAL,
+        "SATENGINE: CSatBIPUtils::ConnectionStatus exiting" )
+    return status;
+    }
+
+// ---------------------------------------------------------------------------
+// CSatBIPUtils::StopUdpLink
+// ---------------------------------------------------------------------------
+//
+void CSatBIPUtils::StopUdpLink()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::StopUdpLink  calling" )
+    if ( iDataChannels )
+        {
+        const TInt channelCount( iDataChannels->Count() );
+        LOG2( SIMPLE, "SATENGINE: CSatBIPUtils::StopUdpLink \
+          channelCount: %d", channelCount )
+        // Cancel all channels
+        for ( TInt index = 0; index < channelCount; index++ )
+            {
+            MSatBIPDataChannel* channel = iDataChannels->At( index );
+            __ASSERT_ALWAYS( channel,
+                PanicSatEngine( ESatEngineNullPointer ) );
+            channel->StopUdpSocket();
+            }
+        }
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::StopUdpLink exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// Synchronous request complete
+// ---------------------------------------------------------------------------
+//
+TInt CSatBIPUtils::ContextCount()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::ContextCount calling" )
+
+    // Number of contexts
+    TInt count( 0 );
+    TInt maxAllowed( 0 );
+
+    // Init PacketService
+    TInt error( GprsService() );
+
+    if ( KErrNone == error )
+        {
+        // Enumerate contexts
+        iPacketService.EnumerateContexts( 
+            iWrapper->RequestStatus(), count, maxAllowed );
+        error = iWrapper->SetActiveAndWait(); // Wait for completion
+        LOG2( SIMPLE, "     EnumContexts Status: %i", error )
+        LOG2( SIMPLE, "     EnumContexts Count: %i", count )
+        LOG2( SIMPLE, "     EnumContexts MaxAllowed: %i", maxAllowed )
+        // Check status
+        if ( KErrNone != error )
+            {
+            LOG( SIMPLE, "SATENGINE: CSatBIPUtils::ContextCount \
+            KErrNone != error" )
+            count = 0;
+            }
+        }
+
+    LOG2( SIMPLE, "SATENGINE: CSatBIPUtils::ContextCount exiting: %i", count )
+    return count;
+    }
+
+// ---------------------------------------------------------------------------
+// CSatBIPUtils::SetConnectionActivated()
+// ---------------------------------------------------------------------------
+//
+void CSatBIPUtils::SetConnectionActivated( TBool aSet )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::SetConnectionActivated calling" )
+    iConnectionActivated = aSet;
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::SetConnectionActivated exiting" )
+    }
+    
+// ---------------------------------------------------------------------------
+// CSatBIPUtils::IsConnectionActivated()
+// ---------------------------------------------------------------------------
+//
+TBool CSatBIPUtils::IsConnectionActivated()
+    {
+    LOG( SIMPLE, 
+        "SATENGINE: CSatBIPUtils::IsConnectionActivated calling-exiting" )
+    return iConnectionActivated;
+    }
+
+// ---------------------------------------------------------------------------
+// CSatBIPUtils::SetSubConnectionActivated()
+// ---------------------------------------------------------------------------
+//
+void CSatBIPUtils::SetSubConnectionActivated( TBool aSet )
+    {
+    LOG( SIMPLE, 
+        "SATENGINE: CSatBIPUtils::SetSubConnectionActivated calling" )
+    iSubConnectionActivated = aSet;
+    LOG( SIMPLE, 
+        "SATENGINE: CSatBIPUtils::SetSubConnectionActivated exiting" )
+    }
+    
+// ---------------------------------------------------------------------------
+// CSatBIPUtils::IsSubConnectionActivated()
+// ---------------------------------------------------------------------------
+//
+TBool CSatBIPUtils::IsSubConnectionActivated()
+    {
+    LOG( SIMPLE, 
+        "SATENGINE: CSatBIPUtils::IsSubConnectionActivated calling-exiting" )
+    return iSubConnectionActivated;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/CSatClientServiceReq.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,298 @@
+/*
+* 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:  Handles client requests.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CSatClientServiceReq.h"
+#include    "MSatUtils.h"
+#include    "MSatSUiClientHandler.h"
+#include    "EnginePanic.h"
+#include    "SatLog.h"
+
+_LIT( KTxtServer, "SatServer" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSatClientServiceReq::CSatClientServiceReq
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatClientServiceReq::CSatClientServiceReq(
+    TSatServerRequest aRequest,
+    TSatServerRequest aResponse,
+    MSatCommand* aCommand,
+    MSatUtils& aUtils ) :
+    iHandledRequest( aRequest ),
+    iHandledResponse( aResponse ),
+    iResponseObserver( aCommand ),
+    iUtils( aUtils )
+    {
+    LOG( SIMPLE, "SATENGINE: \
+        CSatClientServiceReq::CSatClientServiceReq calling-exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatClientServiceReq::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatClientServiceReq* CSatClientServiceReq::NewL(
+    TSatServerRequest aRequest,
+    TSatServerRequest aResponse,
+    MSatCommand* aCommand,
+    MSatUtils& aUtils )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatClientServiceReq::NewL calling-exiting" )
+    return new ( ELeave ) CSatClientServiceReq(
+        aRequest, aResponse, aCommand, aUtils );
+    }
+
+
+// Destructor
+CSatClientServiceReq::~CSatClientServiceReq()
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatClientServiceReq::~CSatClientServiceReq calling" )
+
+    iResponseObserver = NULL;
+    iCmdData = 0;
+    iCmdRsp = 0;
+
+    LOG( SIMPLE,
+        "SATENGINE: CSatClientServiceReq::~CSatClientServiceReq exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatClientServiceReq::HandleCommand
+// Handles the SIM command. If client has not yet requested service for this
+// SIM command, command is stored for later use.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CSatClientServiceReq::HandleCommand(
+    TDesC8* aCmdData, // Data to be sent to client.
+    TDes8* aCmdRsp, // Client is response is written to this.h
+    TSatServerRequest aRequest ) // Command from SIM
+    {
+    LOG( DETAILED, "SATENGINE: CSatClientServiceReq::HandleCommand calling" )
+
+    __ASSERT_ALWAYS( iResponseObserver,
+        PanicSatEngine( ESatEngineNullPointer ) );
+
+    TBool handled( EFalse );
+    // Handle the command here if the request op codes match.
+    if ( iHandledRequest == aRequest )
+        {
+        LOG( DETAILED, "SATENGINE: CSatClientServiceReq::HandleCommand \
+             request op codes match" )
+        // Store the descriptors
+        iCmdData = aCmdData;
+        iCmdRsp = aCmdRsp;
+
+        handled = ETrue;
+
+        // Is the client already waiting for the command
+        if ( iRequestPending )
+            {
+            LOG( DETAILED, "SATENGINE: CSatClientServiceReq::HandleCommand \
+                 RequestPending" )
+            // Request is served.
+            iRequestPending = EFalse;
+            SendDataToClient();
+            }
+        else
+            {
+            LOG( DETAILED, "SATENGINE: CSatClientServiceReq::HandleCommand \
+                 no RequestPending" )
+            // Client request was not available, so command is waiting for
+            // client request.
+            iCmdPending = ETrue;
+            }
+        }
+
+    LOG( DETAILED, "SATENGINE: CSatClientServiceReq::HandleCommand exiting" )
+    return handled;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatClientServiceReq::HandleRequest
+// Handles the client's request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CSatClientServiceReq::HandleRequest(
+    const RMessage2& aRequest ) // Request from client.
+    {
+    LOG( DETAILED, "SATENGINE: CSatClientServiceReq::HandleRequest calling" )
+
+    TBool handled( EFalse );
+
+    // Is the request handled here.
+    const TInt request( aRequest.Function() );
+    if ( request == iHandledRequest )
+        {
+        LOG( DETAILED, "SATENGINE: CSatClientServiceReq::HandleRequest \
+             handle request" )
+        handled = ETrue;
+        iRequest = aRequest;
+
+        // Is the command waiting for client.
+        if ( iCmdPending )
+            {
+            LOG( DETAILED, "SATENGINE: CSatClientServiceReq::HandleRequest \
+            iCmdPending" )
+            iCmdPending = EFalse;
+            SendDataToClient();
+            }
+        else
+            {
+            // Command has not yet arrived from SIM, so
+            // wait for the command.
+            iRequestPending = ETrue;
+            }
+        }
+    // Is the response handled here.
+    else if ( request == iHandledResponse )
+        {
+        LOG( DETAILED, "SATENGINE: CSatClientServiceReq::HandleRequest \
+             handle response" )
+        handled = ETrue;
+
+        TRAPD( res, aRequest.ReadL( 0, *iCmdRsp ) );
+
+        // Send the response further only if IPC succeeded.
+        if ( KErrNone != res )
+            {
+            LOG( DETAILED, "SATENGINE: CSatClientServiceReq::HandleRequest \
+            KErrNone != res" )
+            iRequest.Panic( KTxtServer, ESatSBadDescriptor );
+            }
+
+        // Release client first, then handle the response
+        aRequest.Complete( KErrNone );
+        // Notify command that response is available.
+        iResponseObserver->ClientResponse();
+        }
+    else
+        {
+        }
+
+    LOG( DETAILED, "SATENGINE: CSatClientServiceReq::HandleRequest exiting" )
+    return handled;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatClientServiceReq::SendDataToClient
+// Writes the data to client address space and completes the iRequest.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatClientServiceReq::SendDataToClient()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatClientServiceReq::SendDataToClient calling" )
+
+    TRAPD( res,iRequest.WriteL( 0, *iCmdData ) );
+    LOG2( SIMPLE, "SATENGINE: CSatClientServiceReq::SendDataToClient res: %d",
+          res )
+    if ( KErrNone != res )
+        {
+        iRequest.Panic( KTxtServer, ESatSBadDescriptor );
+        }
+
+    iRequest.Complete( KErrNone );
+
+    // If UI is not launched by user, make sure UI is in foreground
+    if ( !iUtils.SatUiHandler().UiLaunchedByUser() )
+        {
+        LOG( SIMPLE, 
+        "SATENGINE: CSatClientServiceReq::SendDataToClient \
+        EBringSatUiToForeGround" )
+        iUtils.NotifyEvent( MSatUtils::EBringSatUiToForeGround );
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatClientServiceReq::SendDataToClient exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatClientServiceReq::IsMyRequest
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CSatClientServiceReq::IsMyRequest( const TSatServerRequest aRequest )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatClientServiceReq::IsMyRequest calling" )
+    TBool myRequest( EFalse );
+
+    if ( iHandledRequest == aRequest )
+        {
+        LOG( SIMPLE,
+            "SATENGINE: CSatClientServiceReq::IsMyRequest" )
+
+        myRequest = ETrue;
+        }
+    LOG2( SIMPLE, "SATENGINE: CSatClientServiceReq::IsMyRequest exiting, \
+          return: %d", myRequest )
+    return myRequest;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatClientServiceReq::SetCommandHandler
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatClientServiceReq::SetCommandHandler( MSatCommand* aCommand )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatClientServiceReq::SetCommandHandler calling" )
+
+    iResponseObserver = aCommand;
+
+    LOG( SIMPLE, "SATENGINE: CSatClientServiceReq::SetCommandHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatClientServiceReq::Reset
+// Resets member data
+// -----------------------------------------------------------------------------
+//
+void CSatClientServiceReq::Reset()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatClientServiceReq::Reset calling" )
+
+    // Check is request pending
+    if ( !iRequestPending )
+        {
+        // Request not pending meaning that command is executing.
+        // Send client response to prevent SIM to lock
+        LOG( NORMAL, " Request is not pending" )
+        // Notify command that response is available.
+        iResponseObserver->ClientResponse();
+        }
+
+    // Clean data
+    iCmdData = NULL;
+    iCmdRsp = NULL;
+    iCmdPending = EFalse;
+    iRequestPending = EFalse;
+    // We don't reset iResponseObserver
+
+    LOG( SIMPLE, "SATENGINE: CSatClientServiceReq::Reset exiting" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/CSatCommandContainer.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,1177 @@
+/*
+* 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:  Contains SAT commands.
+*
+*/
+
+
+
+#include    <f32file.h>
+#include    <barsc.h>
+#include    <bautils.h>
+#include    <SatServer.rsg>
+#include    <ecom.h>
+#include    <e32property.h>
+#include    <data_caging_path_literals.hrh>
+#include    <startupdomainpskeys.h>
+#include    <satdomainpskeys.h>
+
+#include    "MSatSystemState.h"
+#include    "TSatSystemStateFactory.h"
+#include    "MSatSystemStateChangeNotifier.h"
+#include    "CSatCommandContainer.h"
+//lint -e766 Used inside TRAP macro, lint misfunction.
+#include    "EnginePanic.h"
+#include    "TUSatAPI.h"
+#include    "MSatSSessions.h"
+#include    "MSatShellController.h"
+#include    "SatServer.hrh"
+#include    "SatLog.h"
+#include    "MSatSUiClientHandler.h"
+#include    "CSatClientServiceReq.h"
+#include    "CSatEventMonitorContainer.h"
+#include    "CSatSAPChangeObserver.h"
+#include    "CSatSSimSubscriberId.h"
+#include    "CSatBIPUtils.h"
+#include    "TSatExtErrorUtils.h"
+#include    "MSatUiSession.h"
+#include    "csatmediatoreventprovider.h"
+#include    "csatprofilechangeobserver.h"
+#include    "SATInternalPSKeys.h"
+#include    "csatmultimodeapi.h"
+#include    "csatsactivewrapper.h"
+
+// Drive letter for resource file
+_LIT( KResourceDrive, "Z:" );
+// SatServer's resource file
+_LIT( KSatServerRsc, "SatServer.rsc" );
+
+
+const TUid KSatInterfaceDefinitionUid = { 0x1000f001 };
+const TInt KSizeOfBuf = 50;
+
+const TInt8 KCreateSatAppNamePop( 2 );
+
+// Important plugins UIDs. These are started on startup
+// Implementation UID is from the <plugin>.rss
+const TUid KSetUpEventListUid = { 0x10202993 };
+
+// ======== LOCAL FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// CleanupPointerArray
+// Cleanup RPointerArray objects by using the cleanup stack. Function will be 
+// called when application leaves while a RPointerArray object still alive, 
+// or when CleanupStack::PopAndDestroy is explicitly called to release a 
+// RPointerArray. See CleanupStack::PushL( TCleanupItem ) for more details.
+// -----------------------------------------------------------------------------
+//
+static void CleanupPointerArray( TAny* aArray )
+    {
+    LOG2( NORMAL, "SATENGINE: CSatCommandContainer::CleanupPointerArray \
+        calling array = 0x%08x", aArray )
+    
+    RImplInfoPtrArray* array = reinterpret_cast<RImplInfoPtrArray*>( aArray );
+    if ( array )
+        {
+        array->ResetAndDestroy();
+        }
+    
+    LOG( NORMAL, "SATENGINE: CSatCommandContainer::CleanupPointerArray \
+        exiting" )
+    }
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatCommandContainer* CSatCommandContainer::NewL(
+    MSatSSessions& aSessions,
+    TSatEventMediator& aEventMediator,
+    MSatSUiClientHandler& aSatUiHandler )
+    {
+    LOG( NORMAL, "SATENGINE: CSatCommandContainer::NewL calling" )
+
+    CSatCommandContainer* self =
+        new ( ELeave ) CSatCommandContainer(
+            aSessions,
+            aEventMediator,
+            aSatUiHandler );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( NORMAL, "SATENGINE: CSatCommandContainer::NewL exiting" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::~CSatCommandContainer
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CSatCommandContainer::~CSatCommandContainer()
+    {
+    LOG( NORMAL,
+        "SATENGINE: CSatCommandContainer::~CSatCommandContainer calling" )
+
+    // Stop and Delete all command handlers
+    StopCommandHandlers();
+
+    if ( iUSatAPI )
+        {
+        iUSatAPI->Close();
+        delete iUSatAPI;
+        iUSatAPI = NULL;
+        }
+
+    if ( iServiceReqs )
+        {
+        iServiceReqs->Reset();
+        delete iServiceReqs;
+        iServiceReqs = NULL;
+        }
+
+    delete iSatAppName;
+    delete iSystemState;
+    delete iBipUtils;
+    delete iSatMediatorEvent;    
+    delete iMultiModeApi;
+    
+    delete iSapObserver;
+    delete iProfileObserver;
+
+    delete iSimSubscriberId;
+    delete iEventMonitors;
+
+    delete iCmdHandlers;
+    delete iStartupChangeObserver;
+
+    LOG( NORMAL,
+        "SATENGINE: CSatCommandContainer::~CSatCommandContainer exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::StartCommandHandlersL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatCommandContainer::StartCommandHandlersL()
+    {
+    LOG( NORMAL,
+        "SATENGINE: CSatCommandContainer::StartCommandHandlersL calling" )
+
+    // If in startup phase, start the rest of the commands
+    if ( iStartupPhase )
+        {
+        LOG( NORMAL, "SATENGINE: CSatCommandContainer::StartCommandHandlersL \
+             in startup phase" )
+        // Create command handlers.
+        RImplInfoPtrArray satCommandImplementations;
+        CleanupStack::PushL( 
+            TCleanupItem( CleanupPointerArray, &satCommandImplementations ) );
+        REComSession::ListImplementationsL( KSatInterfaceDefinitionUid,
+            satCommandImplementations );
+
+        // Container for commands
+        const TInt cmdCount( satCommandImplementations.Count() );
+        LOG2( NORMAL, "SATENGINE: CSatCommandContainer::StartCommandHandlersL \
+            Command handler count: %d", cmdCount )
+
+        // Check are there any command implementations
+        if ( cmdCount > 0 )
+            {
+            // Check array. Should not be NULL as it is started earlier
+            if ( !iCmdHandlers )
+                {
+                LOG( NORMAL, "SATENGINE: CSatCommandContainer::\
+                StartCommandHandlersL iCmdHandlers false" )
+                iCmdHandlers = new ( ELeave )
+                    CArrayPtrFlat<CSatCommandHandler>( cmdCount );
+                }
+
+            // Add all found command handlers to list
+            for ( TInt i = 0; i < cmdCount; i++ )
+                {
+                const TUid KImplementationUid(
+                    satCommandImplementations[i]->ImplementationUid() );
+
+                // Check important command handlers. They are already started
+                if ( KImplementationUid != KSetUpEventListUid )
+                    {
+                    CSatCommandHandler* cmd =
+                        CSatCommandHandler::NewL( KImplementationUid, this );
+                    cmd->Start();
+                    CleanupStack::PushL( cmd );
+                    iCmdHandlers->AppendL( cmd );
+                    CleanupStack::Pop( cmd );
+                    }
+                }
+            }
+        CleanupStack::PopAndDestroy( &satCommandImplementations );
+        
+        // Notify TSY about readiness i.e. all nofies are sent
+        // Done only once in startup phase
+        TInt ret = iUSatAPI->UsatClientReadyIndication();
+        LOG2( NORMAL, "SATENGINE: UsatClientReadyIndication() gives %d", ret )
+        }
+
+    // Else check that there are no command handlers created and
+    // BT SAP is not active
+    else if ( !iCmdHandlers && !( SystemState().IsBtSapActive() ) )
+        {
+        LOG( NORMAL, "SATENGINE: CSatCommandContainer::StartCommandHandlersL \
+             no command handlers created and BT SAP is not active" )
+        // This is the case when
+        // SAP is first enabled and then disabled
+        if ( !iUSatAPI->IsRSatConnected() )
+            {
+            User::LeaveIfError( iUSatAPI->Connect( *iMultiModeApi ) );
+            }
+
+        // Create command handlers.
+        RImplInfoPtrArray satCommandImplementations;
+        CleanupStack::PushL( 
+            TCleanupItem( CleanupPointerArray, &satCommandImplementations ) );
+        REComSession::ListImplementationsL( KSatInterfaceDefinitionUid,
+            satCommandImplementations );
+
+        // Container for commands
+        const TInt cmdCount( satCommandImplementations.Count() );
+        LOG2( NORMAL, "SATENGINE: CSatCommandContainer::StartCommandHandlersL \
+            Command handler count: %d", cmdCount )
+
+        // Check are there any command implementations
+        if ( cmdCount > 0 )
+            {
+            iCmdHandlers =
+                new ( ELeave ) CArrayPtrFlat<CSatCommandHandler>( cmdCount );
+
+            // Add all found command handlers to list
+            for ( TInt i = 0; i < cmdCount; i++ )
+                {
+                const TUid KImplementationUid(
+                    satCommandImplementations[i]->ImplementationUid() );
+                CSatCommandHandler* cmd =
+                    CSatCommandHandler::NewL( KImplementationUid, this );
+                cmd->Start();
+                CleanupStack::PushL( cmd );
+                iCmdHandlers->AppendL( cmd );
+                CleanupStack::Pop( cmd );
+                }
+            }
+        else
+            {
+            LOG( NORMAL, "SATENGINE: CSatCommandContainer::\
+            StartCommandHandlersL No commands found" )
+            // No commands, remove SAT Icon from shell
+            iSatUiHandler.ShellController().RemoveSatUiL();
+            }
+        CleanupStack::PopAndDestroy( &satCommandImplementations );
+        }
+    else
+        {
+        LOG( NORMAL, " Not starting any command handlers" )
+        }
+
+    // Create SAP State observer.
+    if ( !iSapObserver )
+        {
+        LOG( NORMAL, "SATENGINE: CSatCommandContainer::StartCommandHandlersL \
+        iSapObserver false" )
+        // Create SAP change observer only if there are command handlers.
+        iSapObserver = CSatSAPChangeObserver::NewL( *this );
+        }
+
+    // Create Profile change observer.
+    if ( !iProfileObserver )
+        {
+        LOG( NORMAL, "SATENGINE: CSatCommandContainer::StartCommandHandlersL \
+        iProfileObserver false" )
+        iProfileObserver = CSatProfileChangeObserver::NewL( *this );
+        }
+
+    LOG( NORMAL,
+        "SATENGINE: CSatCommandContainer::StartCommandHandlersL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::StopCommandHandlersL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatCommandContainer::StopCommandHandlers()
+    {
+    LOG( NORMAL,
+        "SATENGINE: CSatCommandContainer::StopCommandHandlers calling" )
+
+    if ( iCmdHandlers )
+        {
+         // Remove every command handler from event observers
+        const TInt count( iCmdHandlers->Count() );
+        LOG2( NORMAL, "SATENGINE: CSatCommandContainer::StopCommandHandlers \
+              Command handler count: %d", count )
+        for ( TInt j = 0; j < count; j++ )
+            {
+            CSatCommandHandler* cmd = iCmdHandlers->At( j );
+            UnregisterEventObserver( cmd );
+            }
+
+        // Delete command handlers
+        iCmdHandlers->ResetAndDestroy();
+
+        delete iCmdHandlers;
+        iCmdHandlers = NULL;
+        }
+
+    // This must be called when all ECom Plug-Ins has been deleted. Otherwise
+    // there might be memory leaks.
+    REComSession::FinalClose();
+
+    // Reset ClientService request handlers since there are no command handlers
+    // to handle client responses. If SAT UI / Proactive command is executing
+    // while Bluetooth SAP is enabled, SAT UI sends ClientResponse and that must
+    // be preveted
+    if ( iServiceReqs )
+        {
+        iServiceReqs->Reset();
+        }
+
+    // Close all reserved BIP Data channels
+    if ( iBipUtils )
+        {
+        LOG( NORMAL, "SATENGINE: CSatCommandContainer::StopCommandHandlers \
+        iBipUtils true" )
+        iBipUtils->CloseAllChannels();
+        }
+
+    // Cancel all event monitors
+    if ( iEventMonitors )
+        {
+        LOG( NORMAL, "SATENGINE: CSatCommandContainer::StopCommandHandlers \
+        iEventMonitors true" )
+        iEventMonitors->CancelAllMonitors();
+        }
+
+#ifdef SAT_USE_DUMMY_TSY
+    // Close ATSY. This is needed when testin BT SAP in emulator
+    if ( iUSatAPI )
+        {
+        iUSatAPI->Close();
+        }
+#endif
+
+    LOG( NORMAL,
+        "SATENGINE: CSatCommandContainer::StopCommandHandlers exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::Event
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatCommandContainer::Event( TInt aEvent )
+    {
+    LOG( NORMAL, "SATENGINE: CSatCommandContainer::Event calling" )
+
+    if ( MSatUtils::ECmccSimDetected == aEvent )
+        {
+        LOG( NORMAL, "SATENGINE:   Event: ECmccSimDetected" )
+        iIsCmccSim = ETrue;
+
+        // Update default name read in ConstructL.
+        TRAPD( err, CreateSatAppNameL( R_QTN_SAT_CMCC_TITLE ) );
+        LOG2( NORMAL, "SATENGINE:   Error: %i", err )
+        if ( KErrNone == err )
+            {
+            // Notify application name update.
+            NotifyEvent( EApplNameUpdated );
+            }
+        }
+    else if ( MSatUtils::ESatUiClosed == aEvent )
+        {
+        LOG( NORMAL, "SATENGINE:   Event: ESatUiClosed" )
+        // Reset service requests. If this is not done,
+        // Some command may try to send data to UiClient,
+        // even if there is no request.
+        const TInt reqs( iServiceReqs->Count() );
+        LOG2( NORMAL, "SATENGINE: CSatCommandContainer::Event reqs: %i", 
+              reqs )
+        for ( TInt i = 0; i < reqs; i++ )
+            {
+            iServiceReqs->At( i )->Reset();
+            }
+        }
+    else
+        {
+        LOG( NORMAL, "SATENGINE:   Unexpected event" )
+        }
+
+    LOG( NORMAL, "SATENGINE: CSatCommandContainer::Event exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::NotifyUiEvent
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatCommandContainer::NotifyUiEvent(
+    TInt aEventId, TInt aEventStatus, TInt aEventError )
+    {
+    LOG( NORMAL, "SATENGINE: CSatCommandContainer::NotifyUiEvent calling" )
+
+    MSatUiSession* session = iSatUiHandler.UiSession();
+    if ( session )
+        {
+        LOG( NORMAL, "SATENGINE: CSatCommandContainer::NotifyUiEvent \
+        session" )
+        session->UiEventNotification( aEventId, aEventStatus, aEventError );
+        session = NULL;
+        }
+
+    LOG( NORMAL, "SATENGINE: CSatCommandContainer::NotifyUiEvent exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::USatAPI
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+MSatApi& CSatCommandContainer::USatAPI()
+    {
+    LOG( DETAILED, "SATENGINE: CSatCommandContainer::USatAPI calling" )
+
+    __ASSERT_ALWAYS( iUSatAPI, PanicSatEngine( ESatEngineNullPointer ) );
+
+    LOG( DETAILED, "SATENGINE: CSatCommandContainer::USatAPI exiting" )
+    return *iUSatAPI;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::SystemState
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+MSatSystemState& CSatCommandContainer::SystemState()
+    {
+    LOG( NORMAL,
+        "SATENGINE: CSatCommandContainer::SystemState calling-exiting" )
+    return *iSystemState;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::SatUiHandler
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+MSatSUiClientHandler& CSatCommandContainer::SatUiHandler()
+    {
+    LOG( NORMAL,
+        "SATENGINE: CSatCommandContainer::SatUiHandler calling-exiting" )
+    return iSatUiHandler;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::RegisterL
+// Forwards the registeration to TSatEventMediator
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatCommandContainer::RegisterL(
+    MSatEventObserver* aObserver, // Event observer
+    TSatEvent aEvent ) // Event which is observerd
+    {
+    LOG( NORMAL, "SATENGINE: CSatCommandContainer::RegisterL calling" )
+
+    iEventMediator.RegisterL( aObserver, aEvent );
+
+    LOG( NORMAL, "SATENGINE: CSatCommandContainer::RegisterL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::NotifyEvent
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatCommandContainer::NotifyEvent( TSatEvent aEvent )
+    {
+    LOG( NORMAL, "SATENGINE: CSatCommandContainer::NotifyEvent calling" )
+
+    iEventMediator.Notify( aEvent );
+
+    LOG( NORMAL, "SATENGINE: CSatCommandContainer::NotifyEvent exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::UnregisterEvent
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatCommandContainer::UnregisterEvent(
+    MSatEventObserver* aObserver, // Observer of the event
+    TSatEvent aEvent ) // Event
+    {
+    LOG( NORMAL, "SATENGINE: CSatCommandContainer::UnregisterEvent calling" )
+
+    iEventMediator.Unregister( aObserver, aEvent );
+
+    LOG( NORMAL, "SATENGINE: CSatCommandContainer::UnregisterEvent exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::UnregisterEvent
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatCommandContainer::UnregisterEventObserver(
+    MSatEventObserver* aObserver )
+    {
+    LOG( NORMAL,
+        "SATENGINE: CSatCommandContainer::UnregisterEventObserver calling" )
+
+    iEventMediator.Unregister( aObserver );
+
+    LOG( NORMAL,
+        "SATENGINE: CSatCommandContainer::UnregisterEventObserver exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::NumberOfExecutingCommandHandlers
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CSatCommandContainer::NumberOfExecutingCommandHandlers()
+    {
+    LOG( NORMAL,
+        "SATENGINE: CSatCommandContainer::NumberOfExecutingCommandHandlers \
+        calling" )
+
+    TInt result( 0 );
+    TInt count( 0 );
+    if ( iCmdHandlers )
+        {
+        LOG( NORMAL,
+        "SATENGINE: CSatCommandContainer::NumberOfExecutingCommandHandlers \
+        iCmdHandlers true" )
+        // Gets the count of command handlers
+        // if the list is already available.
+        count = iCmdHandlers->Count();
+        }
+    LOG2( NORMAL, "CSatCommandContainer::NumberOfExecutingCommandHandlers \
+          count: %i", count )
+    for ( TInt i = 0; i < count; i++ )
+        {
+        CSatCommandHandler* handler = iCmdHandlers->At( i );
+        __ASSERT_ALWAYS( handler, PanicSatEngine( ESatEngineNullPointer ) );
+
+        // If command handler is not active then it has received command
+        // from sim.
+        if ( handler->IsCommandExecuting() )
+            {
+            result++;
+            }
+        }
+
+    LOG2( NORMAL,
+        "SATENGINE: CSatCommandContainer::NumberOfExecutingCommandHandlers \
+        exiting: %i", result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::SatAppName
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+const TDesC& CSatCommandContainer::SatAppName() const
+    {
+    LOG( NORMAL, "SATENGINE: CSatCommandContainer::SatAppName calling-exiting" )
+    return *iSatAppName;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::BipApnName
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+const TDesC& CSatCommandContainer::BipApnName() const
+    {
+    LOG( NORMAL, "SATENGINE: CSatCommandContainer::BipApnName calling-exiting" )
+    return iSatBipName;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::RestoreSatAppNameL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatCommandContainer::RestoreSatAppNameL()
+    {
+    LOG( NORMAL, "SATENGINE: CSatCommandContainer::RestoreSatAppNameL calling" )
+    if ( !iIsCmccSim )
+        {
+        LOG( NORMAL,
+            "SATENGINE: CSatCommandContainer::RestoreSatAppNameL name reset" )
+        CreateSatAppNameL( R_QTN_SAT_LOG_TITLE );
+        }
+    LOG( NORMAL, "SATENGINE: CSatCommandContainer::RestoreSatAppNameL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::SetSatAppNameL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatCommandContainer::SetSatAppNameL(
+    const TDesC& aName ) // New sat app name
+    {
+    LOG( NORMAL, "SATENGINE: CSatCommandContainer::SetSatAppNameL calling" )
+
+    if ( !iIsCmccSim )
+        {
+        LOG( NORMAL, "SATENGINE: CSatCommandContainer::SetSatAppNameL \
+        iIsCmccSim false" )
+        HBufC* temp = aName.AllocL();
+        delete iSatAppName;
+        iSatAppName = temp;
+        }
+
+    LOG( NORMAL, "SATENGINE: CSatCommandContainer::SetSatAppNameL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::RefreshSubSessions
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+const RPointerArray<MSatRefreshSubSession>&
+    CSatCommandContainer::RefreshSubSessions()
+    {
+    LOG( NORMAL,
+        "SATENGINE: CSatCommandContainer::RefreshSubSessions calling-exiting" )
+    return iSessions.RefreshSubSessions();
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::RegisterServiceRequestL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatCommandContainer::RegisterServiceRequestL(
+    TSatServerRequest aRequest,
+    TSatServerRequest aResponse,
+    MSatCommand* aCommand )
+    {
+    LOG( NORMAL,
+        "SATENGINE: CSatCommandContainer::RegisterServiceRequestL calling" )
+
+    // First, check is there service request handler already with the same
+    // request.If it exists, change command handler
+    const TInt reqs( iServiceReqs->Count() );
+    TBool requestHandled( EFalse );
+    LOG2( NORMAL, "CSatCommandContainer::RegisterServiceRequestL \
+          reqs: %i", reqs )
+    for ( TInt i = 0; i < reqs; i++ )
+        {
+        CSatClientServiceReq* req = iServiceReqs->At( i );
+        __ASSERT_ALWAYS( req, PanicSatEngine( ESatEngineNullPointer ) );
+
+        if ( req->IsMyRequest( aRequest ) )
+            {
+            req->SetCommandHandler( aCommand );
+            requestHandled = ETrue;
+            i = reqs; // to end for-loop
+            }
+        }
+
+    // Check was service request found
+    if ( !requestHandled )
+        {
+        LOG( NORMAL, "SATENGINE: CSatCommandContainer::\
+        RegisterServiceRequestL requestHandled false" )
+        // Not found, add new
+        CSatClientServiceReq* servReq = CSatClientServiceReq::NewL( 
+            aRequest, aResponse, aCommand, *this );
+        CleanupStack::PushL( servReq );
+        iServiceReqs->AppendL( servReq );
+        CleanupStack::Pop( servReq );
+        }
+
+    LOG( NORMAL,
+        "SATENGINE: CSatCommandContainer::RegisterServiceRequestL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::ServiceRequests
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CArrayPtrFlat<CSatClientServiceReq>*
+    CSatCommandContainer::ServiceRequests()
+    {
+    LOG( NORMAL,
+        "SATENGINE: CSatCommandContainer::ServiceRequests calling-exiting" )
+    return iServiceReqs;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::EventMonitors
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+MSatEventMonitorContainer* CSatCommandContainer::EventMonitors()
+    {
+    LOG( NORMAL,
+        "SATENGINE: CSatCommandContainer::EventMonitors calling-exiting" )
+    return iEventMonitors;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::SimSubscriberId
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+MSatSSimSubscriberId& CSatCommandContainer::SimSubscriberId()
+    {
+    LOG( NORMAL,
+        "SATENGINE: CSatCommandContainer::SimSubscriberId calling-exiting" )
+    return *iSimSubscriberId;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::BipUtils
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+MSatBIPUtils& CSatCommandContainer::BipUtils()
+    {
+    LOG( NORMAL,
+        "SATENGINE: CSatCommandContainer::BipUtils calling-exiting" )
+    return *CreateAndGetBIPUtils();
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::BipEventNotifier
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+MSatBIPEventNotifier& CSatCommandContainer::BipEventNotifier()
+    {
+    LOG( NORMAL,
+        "SATENGINE: CSatCommandContainer::BipEventNotifier calling-exiting" )
+    return *CreateAndGetBIPUtils();
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::MultiModeApi
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+MSatMultiModeApi& CSatCommandContainer::MultiModeApi()
+    {
+    LOG( NORMAL,
+        "SATENGINE: CSatCommandContainer::MultiModeApi calling-exiting" )
+    return *iMultiModeApi;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::CustomApi
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+RMmCustomAPI* CSatCommandContainer::CustomApi()
+    {
+    LOG( NORMAL,
+        "SATENGINE: CSatCommandContainer::CustomApi calling-exiting" )
+    return iMultiModeApi->CustomApi();
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::RaiseSatEvent
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CSatCommandContainer::RaiseSatEvent( const TDesC8& aData )
+    {
+    LOG( NORMAL, "SATENGINE: CSatCommandContainer::RaiseSatEvent calling" )
+
+    CSatMediatorEventProvider* medEvent =
+        CreateAndGetSatMediatorEventProvider();
+    TInt retVal( KErrNone );
+    if ( medEvent )
+        {
+        LOG( NORMAL, "SATENGINE: CSatCommandContainer::RaiseSatEvent \
+        medEvent true" )
+        retVal = medEvent->RaiseSatEvent( aData );
+        }
+
+    LOG2( NORMAL,"SATENGINE: CSatCommandContainer::RaiseSatEvent exiting, \
+          retVal: %d", retVal )
+    return retVal;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::CoverUiSupported()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CSatCommandContainer::CoverUiSupported()
+    {
+    LOG( NORMAL, "SATENGINE: CSatCommandContainer::CoverUiSupported calling" )
+
+    CSatMediatorEventProvider* medEvent = CreateAndGetSatMediatorEventProvider();
+    TBool supported( EFalse );
+    if ( medEvent )
+        {
+        LOG( NORMAL, "SATENGINE: CSatCommandContainer::CoverUiSupported \
+        medEvent true" )
+        supported = medEvent->CoverUiSupported();
+        }
+
+    LOG2( NORMAL, "SATENGINE: CSatCommandContainer::CoverUiSupported exiting,\
+          supported: %d", supported )
+    return supported;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::CreateAsyncToSyncHelperL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+MSatAsyncToSync* CSatCommandContainer::CreateAsyncToSyncHelper()
+    {
+    MSatAsyncToSync* wrapper = new CSatSActiveWrapper();
+    LOG( NORMAL, "SATENGINE: CSatCommandContainer::\
+            CreateAsyncToSyncHelperL calling - exiting" )
+    return wrapper;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::StateChanged
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatCommandContainer::StateChanged( const TInt aValue )
+    {
+    LOG( NORMAL, "SATENGINE: CSatCommandContainer::StateChanged calling" )
+    CheckStartupState( aValue );
+    LOG( NORMAL, "SATENGINE: CSatCommandContainer::StateChanged exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::CSatCommandContainer
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatCommandContainer::CSatCommandContainer(
+    MSatSSessions& aSessions,
+    TSatEventMediator& aEventMediator,
+    MSatSUiClientHandler& aSatUiHandler ) :
+    iSessions( aSessions ),
+    iEventMediator( aEventMediator ),
+    iSatUiHandler( aSatUiHandler ),
+    iSatMediatorEvent( NULL )
+    {
+    LOG( NORMAL,
+       "SATENGINE: CSatCommandContainer::CSatCommandContainer calling-exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSatCommandContainer::ConstructL()
+    {
+    LOG( NORMAL, "SATENGINE: CSatCommandContainer::ConstructL calling" )
+
+    iIsCmccSim = EFalse;
+    CreateSatAppNameL( R_QTN_SAT_LOG_TITLE );
+
+    // Register for ui events in order to keep track if user or command
+    // has launched the ui.
+    iEventMediator.RegisterL( this, MSatUtils::ESatUiClosed );
+    iEventMediator.RegisterL( this, MSatUtils::ECmccSimDetected );
+
+    // Set these pointers to NULL because their value is checked
+    // before initialization...
+    iSapObserver = NULL;
+    iCmdHandlers = NULL;
+    iProfileObserver = NULL;
+
+    // Create pointer array for service request handlers
+    iServiceReqs = new( ELeave )CArrayPtrFlat<CSatClientServiceReq>( 1 );
+
+    iMultiModeApi = CSatMultiModeApi::NewL();
+    
+    // By default, we use extended errors
+    iMultiModeApi->RaiseErrorGranularity();
+
+    iUSatAPI = new( ELeave )TUSatAPI();
+    TInt error = iUSatAPI->Connect( *iMultiModeApi );
+
+    // Create SystemState.
+    iSystemState = 
+            TSatSystemStateFactory::CreateSystemStateL( *iMultiModeApi );
+
+    // Create event monitor container.
+    iEventMonitors = CSatEventMonitorContainer::NewL( *iUSatAPI, *this );
+
+    // Check did the conneciton to phone passed.
+    if ( KErrNone == error )
+        {
+        LOG( NORMAL, "SATENGINE: CSatCommandContainer::ConstructL connection \
+             to phone" )
+        iStartupPhase = ETrue;
+        // Start important plugins
+        StartImportantCommandHandlersL();
+
+        // Start listening system's state
+        iStartupChangeObserver =
+            TSatSystemStateFactory::CreateStartupChangeNotifierL( *this );
+        CheckStartupState( iStartupChangeObserver->GetValueInt() );
+
+        if ( iStartupPhase )
+            {
+            LOG( NORMAL, "SATENGINE: CSatCommandContainer::ConstructL \
+            iStartupPhase true" )
+            iStartupChangeObserver->NotifyChangeL();
+            }
+
+        }
+
+    // Create Subscriber id handler.
+    iSimSubscriberId = 
+              CSatSSimSubscriberId::NewL( *iMultiModeApi, iEventMediator );
+    iSimSubscriberId->Start();
+
+    // Create SatMediatorEventProvider. Will register SAT Cover UI events
+    // if cover UI is supported.
+    CreateAndGetSatMediatorEventProvider();
+
+    TSecurityPolicy readPolicy( ECapabilityReadUserData );
+    TSecurityPolicy writePolicy( ECapabilityWriteUserData );
+
+    // Define properties in P&S key for icon support
+    error = RProperty::Define( KPSUidSatServerInternal,
+        KSatAppClosedUsingEndKey, RProperty::EInt, readPolicy, writePolicy );
+        
+    LOG2( NORMAL, "CSatUiActionPerformer::ConstructL \
+        define KSatAppClosedUsingEndKey and return: %d", error )
+    
+    // Publish P&S key for icon support
+    error = RProperty::Set( KPSUidSatServerInternal, KSatAppClosedUsingEndKey,
+        KSatAppTerminatedNormal );
+    
+    LOG2( SIMPLE, "SATENGINE: CSatCommandContainer::ConstructL \
+          P&S key: %i", KSatAppTerminatedNormal )
+        
+    LOG2( NORMAL, "CSatUiActionPerformer::ConstructL \
+        publish KSatAppClosedUsingEndKey and return: %d", error )
+    LOG( NORMAL, "SATENGINE: CSatCommandContainer::ConstructL exiting" )
+    }
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::CreateSatAppNameL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatCommandContainer::CreateSatAppNameL( const TInt aResourceId )
+    {
+    LOG( NORMAL, "SATENGINE: CSatCommandContainer::CreateSatAppNameL calling" )
+
+    // Open the RFs session.
+    RFs fs;
+
+    User::LeaveIfError( fs.Connect() );
+
+    // Push close operation in tbe cleanup stack
+    CleanupClosePushL( fs );
+
+    RResourceFile resFile;
+    // Backslashes are already defined in resource file, not needed here.
+    TBuf<KSizeOfBuf> buf( KResourceDrive );
+    buf.Append( KDC_RESOURCE_FILES_DIR );
+    buf.Append( KSatServerRsc );
+
+    TFileName fileName( buf );
+
+    BaflUtils::NearestLanguageFile( fs, fileName );
+
+    // Open the resource file
+    resFile.OpenL( fs, fileName );
+
+    // Push close operation in the cleanup stack
+    CleanupClosePushL( resFile );
+
+    resFile.ConfirmSignatureL( ESatSResourceSignature );
+
+    // Reads a resource structure with memory allocation.
+    HBufC8* dataBuffer = resFile.AllocReadLC( aResourceId );
+
+    TResourceReader resReader;
+    resReader.SetBuffer( dataBuffer );
+
+    // Reads a string with memory allocation
+    iSatAppName = resReader.ReadHBufCL();
+    iSatBipName.Copy( SatAppName() );
+
+    // dataBuffer
+    CleanupStack::PopAndDestroy( dataBuffer );
+    // resFile, Calls resFile.Close()
+    // fs, Calls fs.Close
+    CleanupStack::PopAndDestroy( KCreateSatAppNamePop );
+
+    LOG( NORMAL, "SATENGINE: CSatCommandContainer::CreateSatAppNameL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::CreateAndGetBIPUtilsL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CSatBIPUtils* CSatCommandContainer::CreateAndGetBIPUtils()
+    {
+    LOG( NORMAL,
+        "SATENGINE: CSatCommandContainer::CreateAndGetBIPUtils calling" )
+    // If pointer is null, create new
+    if ( !iBipUtils )
+        {
+        LOG( NORMAL, "SATENGINE: CSatCommandContainer::CreateAndGetBIPUtilsL \
+            Creating BIP Utils" )
+        // TRAP this, We will panic, if this is NULL
+        TInt err( KErrNone );
+        TRAP( err, iBipUtils = CSatBIPUtils::NewL( *this ) );
+        LOG2( NORMAL, "SATENGINE: CSatCommandContainer::\
+                CreateAndGetBIPUtilsL BIP Utils creation status: %i", err )
+        }
+
+    __ASSERT_ALWAYS( iBipUtils, PanicSatEngine( ESatEngineNullPointer ) );
+
+    LOG( NORMAL,
+        "SATENGINE: CSatCommandContainer::CreateAndGetBIPUtils exiting" )
+    return iBipUtils;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::CreateAndGetMediatorEventProvider
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CSatMediatorEventProvider* CSatCommandContainer::
+                                        CreateAndGetSatMediatorEventProvider()
+    {
+    LOG( NORMAL,
+        "SATENGINE: CSatCommandContainer::CreateAndGetSatMediatorEventProvider \
+        calling" )
+
+    // If pointer is null, create new
+    if ( !iSatMediatorEvent )
+        {
+        LOG( NORMAL, "SATENGINE: CSatCommandContainer::\
+                        CreateAndGetSatMediatorEventProvider \
+                            Creating CreateAndGetSatMediatorEventProvider" )
+        // TRAP this, We will panic, if this is NULL
+        TInt err( KErrNone );
+        TRAP( err, iSatMediatorEvent = CSatMediatorEventProvider::NewL() );
+        LOG2( NORMAL, "SATENGINE: CSatCommandContainer::\
+            CreateAndGetCSatMediatorEventProvider status: %i", err )
+        }
+
+    __ASSERT_ALWAYS(
+        iSatMediatorEvent, PanicSatEngine( ESatEngineNullPointer ) );
+
+    LOG( NORMAL,
+        "SATENGINE: CSatCommandContainer::CreateAndGetSatMediatorEventProvider \
+        exiting" )
+    return iSatMediatorEvent;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::StartImportantCommandHandlersL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatCommandContainer::StartImportantCommandHandlersL()
+    {
+    LOG( NORMAL, "SATENGINE: CSatCommandContainer::\
+        StartImportantCommandHandlersL calling" )
+
+    // Create command handlers.
+    RImplInfoPtrArray satCommandImplementations;
+    CleanupStack::PushL( 
+        TCleanupItem( CleanupPointerArray, &satCommandImplementations ) );
+    REComSession::ListImplementationsL( KSatInterfaceDefinitionUid,
+        satCommandImplementations );
+    
+    // Container for commands
+    const TInt cmdCount( satCommandImplementations.Count() );
+    LOG2( NORMAL, "SATENGINE: CSatCommandContainer::\
+        StartImportantCommandHandlersL Command handler count: %d", cmdCount )
+
+    // Check are there any command implementations
+    if ( cmdCount > 0 )
+        {
+        iCmdHandlers
+            = new ( ELeave ) CArrayPtrFlat<CSatCommandHandler>( cmdCount );
+
+        CSatCommandHandler* setUpEventListCmd = NULL;
+        // Add all important command handlers to list.
+
+        // This will return KErrNotFound if the implementation is not included
+        // in configurations
+        TRAPD( err, setUpEventListCmd =
+            CSatCommandHandler::NewL( KSetUpEventListUid, this ) );
+
+        // Check does the command exist.
+        if ( setUpEventListCmd && KErrNone == err )
+            {
+            LOG( NORMAL, "SATENGINE: CSatCommandContainer::\
+            StartImportantCommandHandlersL KErrNone == err" )
+            setUpEventListCmd->Start();
+            CleanupStack::PushL( setUpEventListCmd );
+            iCmdHandlers->AppendL( setUpEventListCmd );
+            CleanupStack::Pop( setUpEventListCmd );
+            }
+        }
+    
+    CleanupStack::PopAndDestroy( &satCommandImplementations );
+    LOG( NORMAL, "SATENGINE: CSatCommandContainer::\
+        StartImportantCommandHandlersL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandContainer::CheckStartupState
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatCommandContainer::CheckStartupState( const TInt aValue )
+    {
+    LOG2( NORMAL, "SATENGINE: CSatCommandContainer::CheckStartupState calling\
+        with value %d", aValue )
+    if ( ESwStateNormalRfOn == aValue )
+        {
+        TRAP_IGNORE( StartCommandHandlersL() )
+        iStartupChangeObserver->CancelNotify();
+        // Startup phase is over
+        iStartupPhase = EFalse;
+        }
+    LOG( NORMAL, "SATENGINE: CSatCommandContainer::CheckStartupState exiting" )
+    }
+
+// End Of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/CSatCommandHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,336 @@
+/*
+* 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 for handling SAT commands.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <ecom.h>
+#include    "MSatSystemState.h"
+#include    "CSatCommandHandler.h"
+#include    "MSatUtils.h"
+#include    "MSatApi.h"
+#include    "EnginePanic.h"
+#include    "MSatSUiClientHandler.h"
+#include    "SatLog.h"
+
+// Small delay for giving UI time to launch before starting to handle
+// pending command
+const TInt KTimerDelay =  100000;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSatCommandHandler::CSatCommandHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CSatCommandHandler::CSatCommandHandler() :
+    CActive( EPriorityStandard )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatCommandHandler::CSatCommandHandler calling" )
+
+    CActiveScheduler::Add( this );
+
+    LOG( SIMPLE, "SATENGINE: CSatCommandHandler::CSatCommandHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandHandler::BaseConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CSatCommandHandler::BaseConstructL( MSatUtils* aPtr )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatCommandHandler::BaseConstructL calling" )
+
+    __ASSERT_ALWAYS( aPtr, PanicSatEngine( ESatEngineNullPointer ) );
+    iUtils = aPtr;
+
+    LOG( SIMPLE, "SATENGINE: CSatCommandHandler::BaseConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatCommandHandler* CSatCommandHandler::NewL(
+    const TUid& aImplUid,
+    MSatUtils* aUtils )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatCommandHandler::NewL calling" )
+
+    __ASSERT_ALWAYS( aUtils, PanicSatEngine( ESatEngineNullPointer ) );
+
+    TAny* ptr = REComSession::CreateImplementationL( aImplUid,
+        _FOFF( CSatCommandHandler, iDtorIDKey ), aUtils );
+
+    LOG( SIMPLE, "SATENGINE: CSatCommandHandler::NewL exiting" )
+    return reinterpret_cast<CSatCommandHandler*>( ptr );
+    }
+
+// Destructor
+EXPORT_C CSatCommandHandler::~CSatCommandHandler()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatCommandHandler::~CSatCommandHandler calling" )
+
+    iUtils = NULL;
+    REComSession::DestroyedImplementation( iDtorIDKey );
+
+    LOG( SIMPLE, "SATENGINE: CSatCommandHandler::~CSatCommandHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandHandler::Start
+// Starts the waiting of SAT command, if not already active.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CSatCommandHandler::Start()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatCommandHandler::Start calling" )
+
+    if ( !IsActive() )
+        {
+        LOG( DETAILED, "SATENGINE: CSatCommandHandler::Start set active" )
+        // Child class issues the request.
+        IssueUSATRequest( iStatus );
+        SetActive();
+
+        // Not executing
+        iIsExecuting = EFalse;
+        iWaitingUiLaunch = EFalse;
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatCommandHandler::Start exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandHandler::DoHandleCommand
+// Handles the SAT command, which has been notified from USAT api.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CSatCommandHandler::DoHandleCommand()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatCommandHandler::DoHandleCommand calling" )
+
+    if ( CommandAllowed() )
+        {
+        iUtils->NotifyEvent( MSatUtils::EDestroySimSessionEndTimer );
+        if ( NeedUiSession() )
+            {
+            // If ui session is not availabe, SATUI has to be
+            // launched.
+            if ( NULL == iUtils->SatUiHandler().UiSession() )
+                {
+                LOG( SIMPLE, "SATENGINE: CSatCommandHandler::DoHandleCommand \
+                     uisession not available" )
+                TRAPD( err, iUtils->RegisterL(
+                    this, MSatUtils::ESatUiLaunched );
+
+                    // Try to launch the ui client.
+                    iUtils->SatUiHandler().LaunchSatUiL();
+                    ); // End of TRAPD
+
+                if ( KErrNone != err )
+                    {
+                    LOG( SIMPLE, "SATENGINE: CSatCommandHandler::\
+                    DoHandleCommand KErrNone != err" )
+                    // Ui launch failed, unregister event
+                    iUtils->UnregisterEvent( this, MSatUtils::ESatUiLaunched );
+
+                    // Notify derived class that ui launch failed.
+                    UiLaunchFailed();
+                    }
+                else 
+                    { 
+                    LOG( SIMPLE,  
+                    "SATENGINE: CSatCommandHandler::DoHandleCommand iWaitingUiLaunch")
+                    iWaitingUiLaunch = ETrue; 
+                    }
+                }
+            else
+                {
+                LOG( SIMPLE, "SATENGINE: CSatCommandHandler::DoHandleCommand \
+                     uisession available" )
+                // client session is available handle the command.
+                HandleCommand();
+                }
+            }
+        else
+            {
+            LOG( SIMPLE, "SATENGINE: CSatCommandHandler::DoHandleCommand \
+                 don't need uisession" )
+            // Command does not need ui client, so handle the command.
+            HandleCommand();
+            }
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatCommandHandler::DoHandleCommand exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandHandler::ClientResponse
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CSatCommandHandler::ClientResponse()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatCommandHandler::ClientResponse panic" )
+    PanicSatEngine( ESatUnexpectedHandleUiResponseCall );
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandHandler::Event
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CSatCommandHandler::Event( TInt aEvent )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatCommandHandler::Event calling" )
+
+    if ( MSatUtils::ESatUiLaunched == aEvent )
+        {
+        iUtils->UnregisterEvent( this, MSatUtils::ESatUiLaunched );
+        // Check is command still waiting UI to start
+        if ( !IsActive() )
+            {
+            LOG( SIMPLE, "SATENGINE: CSatCommandHandler::Event waiting UI" )
+            // Start timer to give UI some time to execute
+            iWaitingUiLaunch = ETrue;
+            iDelayTimer.CreateLocal();
+            iDelayTimer.After( iStatus, KTimerDelay );
+            SetActive();
+            }
+        else
+            {
+            LOG( SIMPLE, "SATENGINE: CSatCommandHandler::Event close UI" )
+            // UI is launched but command is not executing. UI must be closed.
+            iUtils->NotifyEvent( MSatUtils::ESessionTerminatedByUser );
+            }
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatCommandHandler::Event exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandHandler::TerminalRsp
+// Sends the terminal response to the SIM and renews the sat request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CSatCommandHandler::TerminalRsp(
+    RSat::TPCmd aPCmd, // Identifies the command sending terminal rsp.
+    const TDesC8& aRsp ) // Data package of the response
+    {
+    LOG( SIMPLE, "SATENGINE: CSatCommandHandler::TerminalRsp calling" )
+
+    iUtils->NotifyEvent( MSatUtils::EDelaySimSessionEnd );
+    iUtils->USatAPI().TerminalRsp( aPCmd, aRsp );
+    Start();
+
+    LOG( SIMPLE, "SATENGINE: CSatCommandHandler::TerminalRsp exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandHandler::RunL
+// If request is completed without error, starts handling the command.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CSatCommandHandler::RunL()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatCommandHandler::RunL calling" )
+    LOG2( SIMPLE,
+            "SATENGINE:   RunL status: %d", iStatus.Int() )
+    if ( iWaitingUiLaunch )
+        {
+        LOG( NORMAL, "  UI is launched. Starting to handle command" )
+        iWaitingUiLaunch = EFalse;
+        iDelayTimer.Close();
+        HandleCommand();
+        }
+    else if ( KErrNone == iStatus.Int() )
+        {
+        // Executing only, if really executing
+        iIsExecuting = ETrue;
+        DoHandleCommand();
+        }
+    else if ( KErrNotSupported != iStatus.Int() )
+        {        
+        Start();
+        }
+    else
+        {
+        LOG( SIMPLE, "SATENGINE:   Request was unsupported" )
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatCommandHandler::RunL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandHandler::IsPhoneInIdleState
+// Returns ETrue if using Dummy TSY
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool CSatCommandHandler::IsPhoneInIdleState()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatCommandHandler::IsPhoneInIdleState calling" )
+    TBool isIdle( EFalse );
+
+    TRAPD( err, ( isIdle = iUtils->SystemState().IsPhoneInIdleStateL() ) );
+
+    if ( KErrNone != err )
+        {
+        LOG( SIMPLE, 
+        "SATENGINE: CSatCommandHandler::IsPhoneInIdleState KErrNone != err" )
+        isIdle = EFalse;
+        }
+
+    LOG2( SIMPLE, "SATENGINE: CSatCommandHandler::IsPhoneInIdleState \
+          exiting, isIdle: %d", isIdle )
+    return isIdle;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandHandler::Panic
+// Gives a panic.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CSatCommandHandler::Panic(
+    const TDesC& aCategory, TInt aReason ) const
+    {
+    LOG( SIMPLE, "SATENGINE: CSatCommandHandler::Panic" )
+    User::Panic( aCategory, aReason );
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCommandHandler::IsCommandExecuting
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool CSatCommandHandler::IsCommandExecuting() const
+    {
+    LOG( DETAILED, "SATENGINE: CSatCommandHandler::IsCommandExecuting" )
+    return iIsExecuting;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/CSatEventMonitorContainer.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,748 @@
+/*
+* 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:  Container of event monitor classes
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <f32file.h>
+#include    <syslangutil.h>
+#include    "MSatEventMonitor.h"
+#include    "MSatUtils.h"
+#include    "MSatBIPUtils.h"
+#include    "MSatSystemState.h"
+#include    "TSatEventMonitorFactory.h"
+#include    "CSatEventMonitorContainer.h"
+//lint -e766 Used inside TRAP macro, lint misfunction.
+#include    "EnginePanic.h"
+#include    "TUSatAPI.h"
+#include    "SatSOpcodes.h"
+#include    "SatLog.h"
+
+// CONSTANTS
+const TUint KLangTextSize( 2 );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSatEventMonitorContainer::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatEventMonitorContainer* CSatEventMonitorContainer::NewL(
+    TUSatAPI& aUsatAPI,
+    MSatUtils& aSatUtils )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatEventMonitorContainer::NewL calling" )
+
+    CSatEventMonitorContainer* self =
+        new( ELeave )CSatEventMonitorContainer( aUsatAPI, aSatUtils );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( /* self */ );
+
+    LOG( SIMPLE, "SATENGINE: CSatEventMonitorContainer::NewL exiting" )
+    return self;
+    }
+
+// Destructor
+CSatEventMonitorContainer::~CSatEventMonitorContainer()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatEventMonitorContainer::\
+        ~CSatEventMonitorContainer calling" )
+
+    iEventMonitors = NULL;
+
+    LOG( SIMPLE, "SATENGINE: CSatEventMonitorContainer::\
+        ~CSatEventMonitorContainer exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatEventMonitorContainer::Event
+// From MSatEventObserver
+// -----------------------------------------------------------------------------
+//
+void CSatEventMonitorContainer::Event( TInt aEvent )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatEventMonitorContainer::Event calling" )
+
+    //lint -e{961} else block meaningless, event handled elsewhere.
+    if ( MSatUtils::EBipCommandExecuting == aEvent )
+        {
+        LOG( SIMPLE, "EventMonitor: BIP Command Executing" )
+        iBipExecuting = ETrue;
+        }
+    else if ( MSatUtils::EBipCommandDoneExecuting == aEvent )
+        {
+        LOG( SIMPLE, "EventMonitor: BIP Command NOT executing" )
+        iBipExecuting = EFalse;
+
+        if ( iEventPending )
+            {
+            iEventPending = EFalse;
+            LOG( SIMPLE, "EventMonitor: Executing pending envelope" )
+            EventDownload( iPendingEvent, iPendingFirstArg, iPendingSecondArg );
+            }
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatEventMonitorContainer::Event exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatEventMonitorContainer::SetUpEventMonitors
+// Updates all event monitors in list.
+// -----------------------------------------------------------------------------
+//
+TInt CSatEventMonitorContainer::SetUpEventMonitors( TUint aEvents )
+    {
+    LOG2( SIMPLE,
+        "SATENGINE: CSatEventMonitorContainer::SetUpEventMonitors calling %d",
+        aEvents )
+    const TInt monitorCount( iEventMonitors->Count() );
+    TInt errCode = KErrNotSupported;
+    LOG2( SIMPLE, "SATENGINE: CSatEventMonitorContainer::SetUpEventMonitors \
+          monitorCount: %i", monitorCount )
+    // Check is events supported
+    if ( EventsSupported( aEvents ) )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatEventMonitorContainer::\
+        SetUpEventMonitors events supported" )
+        // Update all monitors from list
+        for ( TInt index = 0; index < monitorCount; index++ )
+            {
+            MSatEventMonitor* monitor = iEventMonitors->At( index );
+            __ASSERT_ALWAYS( monitor, PanicSatEngine( ESatEngineNullPointer ) );
+            // Update monitor
+            errCode = monitor->UpdateMonitor( aEvents );
+
+            if ( KErrNone != errCode )
+                {
+                LOG( SIMPLE, "SATENGINE: CSatEventMonitorContainer::\
+                SetUpEventMonitors KErrNone != errCode" )
+                // Error, cancel all monitors and end this loop
+                CancelAllMonitors();
+                index = monitorCount;
+                }
+            }
+        }
+
+    LOG2( SIMPLE,
+        "SATENGINE: CSatEventMonitorContainer::SetUpEventMonitors exiting %d",
+        errCode )
+
+    return errCode;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatEventMonitorContainer::CancelAllMonitors
+// Cancels all monitors in list.
+// -----------------------------------------------------------------------------
+//
+TInt CSatEventMonitorContainer::CancelAllMonitors()
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatEventMonitorContainer::CancelAllMonitors calling" )
+
+    const TInt monitorCount( iEventMonitors->Count() );
+    LOG2( SIMPLE, "SATENGINE: CSatEventMonitorContainer::CancelAllMonitors \
+          monitorCount: %i", monitorCount )
+    // Cancel all monitors from list
+    for ( TInt index = 0; index < monitorCount; index++ )
+        {
+        MSatEventMonitor* monitor = iEventMonitors->At( index );
+        __ASSERT_ALWAYS( monitor, PanicSatEngine( ESatEngineNullPointer ) );
+        // Cancel monitor
+        monitor->CancelMonitor();
+        }
+
+    LOG( SIMPLE,
+        "SATENGINE: CSatEventMonitorContainer::CancelAllMonitors exiting" )
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatEventMonitorContainer::LanguageSettingL
+// Resolves language ID
+// -----------------------------------------------------------------------------
+//
+void CSatEventMonitorContainer::LanguageSettingL( TInt& aLanguage )
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatEventMonitorContainer::LanguageSettingL calling" )
+
+    // Automatic Language setting is detected as 0.
+    // There is no header file for this. This is only needed here.
+    const TInt KAutomaticLanguageSetting( 0 );
+
+    // Special treatment for automatic language setting.
+    if ( KAutomaticLanguageSetting == aLanguage )
+        {
+        // Automatic language setting - Tries to take preferred
+        // language from SIM card.
+
+        // The following operations need a file server session.
+        RFs fileServerSession;
+        User::LeaveIfError( fileServerSession.Connect() );
+        CleanupClosePushL( fileServerSession );
+
+        // Automatic language setting
+        // 1) look for SIM Preferred Language
+        // 2) look if language is supported in phone
+        //
+
+        // Preferred language from SIM (Symbian coding).
+        TInt simPreferredLanguageSymbianCoding;
+
+        // Fetch SIM preferred language (Symbian coding) and see if it is
+        // supported
+        if ( KErrNone == SysLangUtil::RestoreSIMLanguage
+                ( simPreferredLanguageSymbianCoding, &fileServerSession )
+             && SysLangUtil::IsValidLanguage
+                ( simPreferredLanguageSymbianCoding, &fileServerSession ) )
+            {
+            aLanguage = simPreferredLanguageSymbianCoding;
+            LOG2( SIMPLE, "SATENGINE: CSatEventMonitorContainer::\
+                LanguageSettingL SIM preferred language is supported %d",
+                aLanguage )
+            }
+        else
+            {
+            // Either there is no SIM preferred language, or the SIM preferred
+            // language is not supported. Then default language is used.
+            SysLangUtil::GetDefaultLanguage( aLanguage, &fileServerSession );
+            LOG( SIMPLE, "SATENGINE: CSatEventMonitorContainer::\
+                LanguageSettingL No SIM preferred language" )
+            }
+
+        CleanupStack::PopAndDestroy(); // fileServerSession
+        }
+
+    LOG( SIMPLE,
+        "SATENGINE: CSatEventMonitorContainer::LanguageSettingL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatEventMonitorContainer::EventDownload
+// Called when an event occurs. Handles that event and possibly sends
+// event download to SIM.
+// -----------------------------------------------------------------------------
+//
+void CSatEventMonitorContainer::EventDownload(
+    RSat::TEventList aSingleEvent, TInt aFirstArg, TInt aSecArg )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatEventMonitorContainer::EventDownload calling" )
+
+    //lint -e{961} Else block meaningless
+    if ( ( iBipExecuting || IsActive() ) && !iEventPending )
+        {
+        LOG( NORMAL, "EventMonitor: EventDownload BIP Command Executing" )
+        // If there is event download currently active, we cannot send next
+        // event download, so we have to store this event.
+        iPendingEvent = aSingleEvent;
+        iPendingFirstArg = aFirstArg;
+        iPendingSecondArg = aSecArg;
+        iEventPending = ETrue;
+        }
+    else if ( !iEventPending )
+        {
+        // No pending events, we can execute
+        switch ( aSingleEvent )
+            {
+            case RSat::KLanguageSelection:
+                {
+                LOG( NORMAL, "SATENGINE:   Event LanguageSelection" )
+                LanguageSelectionEvent( aFirstArg );
+                break;
+                }
+
+            case RSat::KBrowserTermination:
+                {
+                LOG( NORMAL, "SATENGINE:   Event BrowserTermination" )
+                BrowserTerminationEvent( aFirstArg );
+                break;
+                }
+
+            case RSat::KDataAvailable:
+                {
+                LOG( NORMAL, "SATENGINE:   Event DataAvailable" )
+                DataAvailableEvent( aFirstArg, aSecArg );
+                break;
+                }
+
+            case RSat::KChannelStatus:
+                {
+                LOG( NORMAL, "SATENGINE:   Event ChannelStatus" )
+                ChannelStatusEvent( aFirstArg, aSecArg );
+                break;
+                }
+
+            // These events does not have any data to be sent
+            // to SIM
+            case RSat::KUserActivity:
+            case RSat::KIdleScreenAvailable:
+                {
+                LOG( NORMAL, "SATENGINE:   Event UserActivity/IdleScreen" )
+                RSat::TEventDownloadBaseV2 eventDownload;
+                RSat::TEventDownloadBaseV2Pckg eventDownloadPckg(
+                    eventDownload );
+                eventDownload.iDataAvailable = EFalse;
+                iSat.EventDownload( iStatus, aSingleEvent, eventDownloadPckg );
+                iRemovableSingleEvent = aSingleEvent;
+                break;
+                }
+
+            default:
+                {
+                LOG( NORMAL, "SATENGINE:   BadRequest" )
+                __ASSERT_DEBUG( EFalse, PanicSatEngine( ESatSBadRequest ) );
+                }
+            }
+
+        SetActive();
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatEventMonitorContainer::EventDownload exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatEventMonitorContainer::BipUtils
+// Returns the interface for BIP Utils
+// -----------------------------------------------------------------------------
+//
+MSatBIPEventNotifier& CSatEventMonitorContainer::BipNotifier()
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatEventMonitorContainer::BipUtils calling-exiting" )
+    return iSatUtils.BipEventNotifier();
+    }
+
+// -----------------------------------------------------------------------------
+// CSatEventMonitorContainer::SimRemoved
+// Updates event monitor list
+// -----------------------------------------------------------------------------
+//
+void CSatEventMonitorContainer::SimRemoved()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatEventMonitorContainer::SimRemoved calling" )
+
+    // If SIM is removed, all monitors must be cancelled.
+    CancelAllMonitors();
+
+    LOG( SIMPLE, "SATENGINE: CSatEventMonitorContainer::SimRemoved exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatEventMonitorContainer::GetLanguageString
+// Gets the ISO639 language code.
+// -----------------------------------------------------------------------------
+//
+void CSatEventMonitorContainer::GetLanguageString( const TInt aId, TDes& aText )
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatEventMonitorContainer::GetLanguageString calling" )
+
+    aText = KNullDesC;
+    TBuf<KLangTextSize> lanText;
+    lanText.Copy( KNullDesC );
+
+    // Number of Symbian languages.
+    TInt count( KNUMLANGSTRINGS );
+    // Index for searching loop.
+    TInt i( 0 );
+    // Language structure for searching loop.
+    SLangString language( KLangStrings[i] );
+
+    // Loop languages until one is found
+    do  {
+        language = KLangStrings[i];
+        // Finds the appropriate language and gives a code for that.
+        if ( language.iId == aId )
+            {
+            LOG( SIMPLE, "SATENGINE: CSatEventMonitorContainer::\
+            GetLanguageString language.iId == aId" )
+            // Current language code in the loop is appended to reference.
+            lanText.Append(
+                *( language.iString ) << 8 | *( language.iString + 1 ) );
+            }
+        i++;
+        }
+        while ( ( i <= count ) && ( language.iId != aId ) );
+
+    aText.Copy( lanText );
+    LOG2( SIMPLE,
+    "SATENGINE: CSatEventMonitorContainer::GetLanguageString aId: %i", aId )
+    LOG2( SIMPLE,
+    "SATENGINE: CSatEventMonitorContainer::GetLanguageString aId: %S",
+    &aText )
+    LOG( SIMPLE,
+        "SATENGINE: CSatEventMonitorContainer::GetLanguageString exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatEventMonitorContainer::RunL
+// From CActive
+// -----------------------------------------------------------------------------
+//
+void CSatEventMonitorContainer::RunL()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatEventMonitorContainer::RunL calling" )
+
+    if ( KErrCancel != iRemovableSingleEvent )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatEventMonitorContainer::RunL \
+        KErrCancel != iRemovableSingleEvent" )
+        //Remove event from list as these are not continuous events
+        RemoveSingleEvent(
+            static_cast<RSat::TEventList>( iRemovableSingleEvent ) );
+        iRemovableSingleEvent = KErrCancel;
+        }
+
+    // Check the request status
+    if ( KErrNone != iStatus.Int() )
+        {
+        LOG2( SIMPLE,
+            "SATENGINE: CSatEventMonitorContainer::RunL with value %d",
+            iStatus.Int() )
+        }
+
+    // If there are events pending, send now
+    if ( iEventPending )
+        {
+        LOG( SIMPLE,
+            "SATENGINE: CSatEventMonitorContainer::RunL Sending pending event" )
+        iEventPending = EFalse;
+
+        // Send event
+        EventDownload( iPendingEvent, iPendingFirstArg, iPendingSecondArg );
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatEventMonitorContainer::RunL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatEventMonitorContainer::DoCancel
+// From CActive
+// -----------------------------------------------------------------------------
+//
+void CSatEventMonitorContainer::DoCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatEventMonitorContainer::DoCancel calling" )
+
+    CancelAllMonitors();
+
+    LOG( SIMPLE, "SATENGINE: CSatEventMonitorContainer::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatEventMonitorContainer::CSatEventMonitorContainer
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatEventMonitorContainer::CSatEventMonitorContainer( TUSatAPI& aUsatAPI,
+    MSatUtils& aSatUtils ) :
+    CActive ( CActive::EPriorityStandard ),
+    iSat( aUsatAPI ),
+    iSatUtils( aSatUtils )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatEventMonitorContainer::\
+        CSatEventMonitorContainer calling" )
+
+    CActiveScheduler::Add( this );
+
+    LOG( SIMPLE, "SATENGINE: CSatEventMonitorContainer::\
+        CSatEventMonitorContainer exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatEventMonitorContainer::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSatEventMonitorContainer::ConstructL()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatEventMonitorContainer::ConstructL calling" )
+
+    iEventMonitors = TSatEventMonitorFactory::CreateEventMonitorsL( *this );
+    iRemovableSingleEvent = KErrCancel;
+
+    iSatUtils.RegisterL( this, MSatUtils::EBipCommandExecuting );
+    iSatUtils.RegisterL( this, MSatUtils::EBipCommandDoneExecuting );
+
+    LOG( SIMPLE, "SATENGINE: CSatEventMonitorContainer::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatEventMonitorContainer::LanguageSelectionEvent
+// Handles LanguageSelection event and sends event download
+// -----------------------------------------------------------------------------
+//
+void CSatEventMonitorContainer::LanguageSelectionEvent( TInt aLanguageId )
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatEventMonitorContainer::LanguageSelectionEvent calling" )
+
+    // Special event download package,
+    // used exclusively for Language Selection events
+    RSat::TLanguageSelectionEventV2 languageDownload;
+    RSat::TLanguageSelectionEventV2Pckg languageDownloadPckg(
+        languageDownload );
+    languageDownload.iDataAvailable = EFalse;
+
+    // Resolve Language ID
+    TRAPD( err, LanguageSettingL( aLanguageId ) );
+    LOG2( SIMPLE, "SATENGINE: CSatEventMonitorContainer::\
+          LanguageSelectionEvent err: %i", err )
+    if ( KErrNone == err )
+        {
+        // Get Language string
+        TBuf<1> languageTxt;
+        GetLanguageString( aLanguageId, languageTxt );
+
+        // If language is found, put it to event download information
+        if ( languageTxt.Length() != 0 )
+            {
+            LOG( SIMPLE,
+            "SATENGINE: CSatEventMonitorContainer::LanguageSelectionEvent \
+            languageTxt.Length() != 0" )
+
+            // Language selection event does have data.
+            languageDownload.iDataAvailable = ETrue;
+
+            // Integer argument is interpreted as language code.
+            languageDownload.iLanguage =
+                static_cast<TUint16>( languageTxt[0] );
+            }
+        }
+
+    // Send EventDownload to SIM
+    iSat.EventDownload(
+        iStatus,
+        RSat::KLanguageSelection,
+        languageDownloadPckg );
+
+    LOG( SIMPLE,
+        "SATENGINE: CSatEventMonitorContainer::LanguageSelectionEvent exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatEventMonitorContainer::BrowserTerminationEvent
+// Handles browser termination event and sends event download
+// -----------------------------------------------------------------------------
+//
+void CSatEventMonitorContainer::BrowserTerminationEvent( TInt aCause )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatEventMonitorContainer::\
+        BrowserTerminationEvent calling" )
+
+    // Special event download package,
+    // used exclusively for Browser termination events.
+    RSat::TBrowserTerminationEventV2 browserTermination;
+    RSat::TBrowserTerminationEventV2Pckg browserTerminationPckg(
+        browserTermination );
+
+    // Language selection event does have data.
+    browserTermination.iDataAvailable = ETrue;
+
+    // Browser termination event does have data.
+    browserTermination.iCause =
+        static_cast<RSat::TBrowserTerminationCause>( aCause );
+
+    // Send event download
+    iSat.EventDownload(
+        iStatus,
+        RSat::KBrowserTermination,
+        browserTerminationPckg );
+
+    LOG( SIMPLE, "SATENGINE: CSatEventMonitorContainer::\
+        BrowserTerminationEvent exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatEventMonitorContainer::DataAvailableEvent
+// Handles DataAvailable event and sends event download
+// -----------------------------------------------------------------------------
+//
+void CSatEventMonitorContainer::DataAvailableEvent(
+    const TInt aChannelId, const TInt aLength )
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatEventMonitorContainer::DataAvailableEvent calling" )
+
+    RSat::TDataAvailableEventV2 dataAvailable;
+    RSat::TDataAvailableEventV2Pckg dataAvailablePckg( dataAvailable );
+    RSat::TChannelStatus status;
+
+    // BIP Utils will generate channel status
+    TRAPD( err,
+        status = iSatUtils.BipUtils().GenerateChannelStatusL( aChannelId, 0 ) );
+
+    // Check error
+    LOG2( SIMPLE, "SATENGINE: CSatEventMonitorContainer::\
+            DataAvailableEvent ChannelStatus failed: %i", err )    
+    if ( KErrNone == err )
+        {
+        // Put the parameters to data package
+        dataAvailable.iDataAvailable = ETrue;
+        // If received more than 0xFF, we return 0xFF, because that iLength can
+        // contain only one byte.
+        TInt8 length( 0 );
+
+        if ( KSatBIPMoreThanMaxSize < aLength )
+            {
+            LOG( SIMPLE, "SATENGINE: CSatEventMonitorContainer::\
+            DataAvailableEvent KSatBIPMoreThanMaxSize < aLength" )
+            length = static_cast<TInt8>( KSatBIPMoreThanMaxSize );
+            }
+        else
+            {
+            length = static_cast<TInt8>( aLength );
+            }
+
+        dataAvailable.iLength = length;
+        dataAvailable.iStatus = status;
+        // Send EventDownload to SIM
+        iSat.EventDownload(
+            iStatus,
+            RSat::KDataAvailable,
+            dataAvailablePckg );
+        }
+
+    LOG( SIMPLE,
+        "SATENGINE: CSatEventMonitorContainer::DataAvailableEvent exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatEventMonitorContainer::ChannelStatusEvent
+// Handles ChannelStatus event and sends event download
+// -----------------------------------------------------------------------------
+//
+void CSatEventMonitorContainer::ChannelStatusEvent( const TInt aChannelId,
+    const TInt aStatus )
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatEventMonitorContainer::ChannelStatusEvent calling" )
+
+    RSat::TChannelStatusEventV2 channelStatus;
+    RSat::TChannelStatusEventV2Pckg channelStatusPckg( channelStatus );
+    RSat::TChannelStatus status;
+
+    // BIP Utils will generate channel status
+    TRAPD( err, status = iSatUtils.BipUtils().GenerateChannelStatusL(
+        aChannelId, aStatus ) );
+
+    // Check error
+    LOG2( NORMAL, "SATENGINE: CSatEventMonitorContainer::\
+            ChannelStatusEvent ChannelStatus failed: %i", err )    
+    if ( KErrNone == err )
+        {
+
+        LOG2( SIMPLE, "SatServer, ChannelStatus envelope: %b", status[0] )
+        // Put the parameters to data package
+        channelStatus.iDataAvailable = ETrue;
+        channelStatus.iStatus = status;
+        // Send EventDownload to SIM
+        iSat.EventDownload(
+            iStatus,
+            RSat::KChannelStatus,
+            channelStatusPckg );
+        }
+
+    LOG( SIMPLE,
+        "SATENGINE: CSatEventMonitorContainer::ChannelStatusEvent exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatEventMonitorContainer::EventsSupported
+// Checks whether aEvents contains supported events only.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CSatEventMonitorContainer::EventsSupported( TUint aEvents ) const
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatEventMonitorContainer::EventsSupported calling" )
+
+    // Events supported and handled by this class.
+    const TUint eventsSupported =
+        RSat::KUserActivity | RSat::KIdleScreenAvailable |
+        RSat::KLanguageSelection | RSat::KBrowserTermination |
+        RSat::KDataAvailable | RSat::KChannelStatus;
+
+    // If aEvents has even one event that is not supported (not found from
+    // eventsSuported), then EventsSupported returns EFalse.
+
+    // First the eventsSupported is masked and bits are inverted. Then that mask
+    // is compared to aEvents and if there is even one bit that is not supposed
+    // to be there, function returns EFalse.
+
+    const TBool supported( !( ~( eventsSupported ) & aEvents ) );
+
+    LOG2( SIMPLE,
+        "SATENGINE: CSatEventMonitorContainer::EventsSupported returning %i",
+        supported )
+    return supported;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatEventMonitorContainer::WriteLanguageSelectionTime
+// Sets time delay before reboot.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CSatEventMonitorContainer::WriteLanguageSelectionTime( TInt aTime )
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatEventMonitorContainer::WriteLanguageSelectionTime \
+         calling-exiting" )
+    return iSatUtils.SystemState().WriteLanguageSelectionTime( aTime );
+    }
+
+// -----------------------------------------------------------------------------
+// CSatEventMonitorContainer::RemoveSingleEvent
+// Removes single event from list
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatEventMonitorContainer::RemoveSingleEvent(
+    RSat::TEventList aSingleEvent )
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatEventMonitorContainer::RemoveSingleEvent calling" )
+
+    const TInt monitorCount( iEventMonitors->Count() );
+    LOG2( SIMPLE, "SATENGINE: CSatEventMonitorContainer::RemoveSingleEvent \
+          monitorCount: %i", monitorCount )
+
+    // Cancel all monitors from list
+    for ( TInt index = 0; index < monitorCount; index++ )
+        {
+        MSatEventMonitor* monitor = iEventMonitors->At( index );
+        __ASSERT_ALWAYS( monitor, PanicSatEngine( ESatEngineNullPointer ) );
+
+        if ( monitor->IsMonitoringEvent( aSingleEvent ) )
+            {
+            // Cancel monitor
+            monitor->CancelMonitor();
+            }
+        }
+
+    LOG( SIMPLE,
+        "SATENGINE: CSatEventMonitorContainer::RemoveSingleEvent exiting" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/CSatIconHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,390 @@
+/*
+* Copyright (c) 2004-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Interface for accessing icon data in SIM.
+*
+*/
+
+
+#include    "TUSatAPI.h"
+#include    "MSatIconObserver.h"
+#include    "CSatIconHandler.h"
+#include    "SatLog.h"
+#include    "EnginePanic.h"
+#include    "csatsactivewrapper.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSatIconHandler::CSatIconHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatIconHandler::CSatIconHandler(
+    MSatApi& aSatApi ) :
+    CActive( EPriorityStandard ),
+    MSatSIconAPI(),
+    iSatApi( aSatApi ),
+    iGetIconInfoActive( EFalse ),
+    iGetIconInstanceActive( EFalse ),
+    iGetClutActive( EFalse ),
+    iSyncIconFetching( EFalse )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatIconHandler::CSatIconHandler calling" )
+
+    CActiveScheduler::Add( this );
+
+    LOG( SIMPLE, "SATENGINE: CSatIconHandler::CSatIconHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatIconHandler::~CSatIconHandler()
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CSatIconHandler::~CSatIconHandler()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatIconHandler::~CSatIconHandler calling" )
+
+    iObserver = NULL;
+
+    LOG( SIMPLE, "SATENGINE: CSatIconHandler::~CSatIconHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatIconHandler::GetIconInfo
+// Gets the icon info from SIM through USAT-API.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatIconHandler::GetIconInfo(
+    TUint8 aRecordNumber,
+    RSat::TIcon& aIconEf,
+    MSatIconObserver& aObserver )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatIconHandler::GetIconInfo calling" )
+
+    iObserver = &aObserver;
+
+    // Check is RSat connected
+    if ( iSatApi.IsRSatConnected() )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatIconHandler::GetIconInfo connected" )
+        iSatApi.GetIcon( iStatus, aRecordNumber, aIconEf );
+        iGetIconInfoActive = ETrue;
+        SetActive();
+        }
+    else
+        {
+        LOG( SIMPLE, "SATENGINE: CSatIconHandler::GetIconInfo Not connected" )
+        iObserver->NotifyFailure( KErrDisconnected );
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatIconHandler::GetIconInfo exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatIconHandler::GetIconInstance
+// Gets the icon data from SIM through USAT-API.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatIconHandler::GetIconInstance(
+    const RSat::TInstanceInfoV3& aInstanceInfo,
+    TDes8& aInstance,
+    MSatIconObserver& aObserver )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatIconHandler::GetIconInstance calling" )
+
+    iObserver = &aObserver;
+
+    // Check is RSat connected
+    if ( iSatApi.IsRSatConnected() )
+        {
+        LOG( SIMPLE,
+            "SATENGINE: CSatIconHandler::GetIconInstance connected" )
+        #ifndef __WINS__
+            RSat::TInstanceInfoV3Pckg instanceInfoPckg( aInstanceInfo );
+            if ( !iSyncIconFetching )
+                {
+                LOG( SIMPLE, "SATENGINE: CSatIconHandler::GetIconInstance \
+                     iSyncIconFetching false" )
+                iSatApi.GetImageInstance( 
+                    iStatus, instanceInfoPckg, aInstance );
+                iGetIconInstanceActive = ETrue;
+                SetActive();
+                }
+            else
+                {
+                CSatSActiveWrapper* wrapper = NULL;
+                wrapper = new CSatSActiveWrapper();
+                TInt error( KErrNoMemory );
+                if ( wrapper )
+                    {
+                    LOG( SIMPLE, "SATENGINE: CSatIconHandler::GetIconInstance\
+                    wrapper" )
+                    iSatApi.GetImageInstance( wrapper->RequestStatus(),
+                        instanceInfoPckg, aInstance );
+                    error = wrapper->SetActiveAndWait();
+                    delete wrapper;
+                    wrapper = NULL;
+                    }
+
+                LOG2(
+                    SIMPLE,
+                    "SATENGINE: CSatIconHandler::GetIconInstance iStatus: %i",
+                     error )
+                if ( KErrNone != error )
+                    {
+                    iObserver->NotifyFailure( error );
+                    }
+                else
+                    {
+                    TRAP_IGNORE( iObserver->NotifyGetIconInstanceL(); );
+                    }
+                }
+        #else
+            CSatSActiveWrapper* wrapper = NULL;
+            wrapper = new CSatSActiveWrapper();
+            TInt error( KErrNoMemory );
+            if ( wrapper )
+                {
+                LOG( SIMPLE, "SATENGINE: CSatIconHandler::GetIconInstance\
+                wrapper true" )
+                RSat::TInstanceInfoV3Pckg instanceInfoPckg( aInstanceInfo );
+                iSatApi.GetImageInstance( wrapper->RequestStatus(),
+                    instanceInfoPckg, aInstance );
+                error = wrapper->SetActiveAndWait();
+                delete wrapper;
+                wrapper = NULL;
+                }
+
+            LOG2(
+                SIMPLE,
+                "SATENGINE: CSatIconHandler::GetIconInstance iStatus: %i",
+                 error )
+            if ( KErrNone != error )
+                {
+                iObserver->NotifyFailure( error );
+                }
+            else
+                {
+                TRAP_IGNORE( iObserver->NotifyGetIconInstanceL(); );
+                }
+        #endif
+
+        }
+    else
+        {
+        LOG( SIMPLE,
+            "SATENGINE: CSatIconHandler::GetIconInstance not connected" )
+        iObserver->NotifyFailure( KErrDisconnected );
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatIconHandler::GetIconInstance exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatIconHandler::GetClut
+// Gets the Clut from SIM through USAT-API.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatIconHandler::GetClut(
+    TUint aInstanceNumber,
+    TUint aOffset,
+    TDes8& aClut,
+    MSatIconObserver& aObserver )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatIconHandler::GetClut calling" )
+
+    iObserver = &aObserver;
+    // Check is RSat connected
+    if ( iSatApi.IsRSatConnected() )
+        {
+        LOG( SIMPLE,
+            "SATENGINE: CSatIconHandler::GetClut connected" )
+        #ifndef __WINS__
+            if ( !iSyncIconFetching )
+                {
+                LOG( SIMPLE, "SATENGINE: CSatIconHandler::GetClut \
+                     iSyncIconFetching false" )
+                iSatApi.GetClut( iStatus, aInstanceNumber, aOffset, aClut );
+                iGetClutActive = ETrue;
+                SetActive();
+                }
+            else
+                {
+                CSatSActiveWrapper* wrapper = NULL;
+                wrapper = new CSatSActiveWrapper();
+                TInt error( KErrNoMemory );
+                if ( wrapper )
+                    {
+                    LOG( SIMPLE, "SATENGINE: CSatIconHandler::GetClut\
+                    wrapper" )
+                    iSatApi.GetClut( wrapper->RequestStatus(),
+                        aInstanceNumber, aOffset, aClut );
+                    error = wrapper->SetActiveAndWait();
+                    delete wrapper;
+                    wrapper = NULL;
+                    }
+
+                LOG2(
+                    SIMPLE,
+                    "SATENGINE: CSatIconHandler::GetClut iStatus: %i", error )
+                if ( KErrNone != error )
+                    {
+                    iObserver->NotifyFailure( error );
+                    }
+                else
+                    {
+                    TRAP_IGNORE( iObserver->NotifyGetClutL(); );
+                    }
+                }
+        #else
+            CSatSActiveWrapper* wrapper = NULL;
+            wrapper = new CSatSActiveWrapper();
+            TInt error( KErrNoMemory );
+            if ( wrapper )
+                {
+                LOG( SIMPLE, "SATENGINE: CSatIconHandler::GetClut\
+                wrapper true" )
+                iSatApi.GetClut( wrapper->RequestStatus(), aInstanceNumber,
+                    aOffset, aClut );
+                error = wrapper->SetActiveAndWait();
+                delete wrapper;
+                wrapper = NULL;
+                }
+
+            LOG2(
+                SIMPLE,
+                "SATENGINE: CSatIconHandler::GetClut iStatus: %i", error )
+            if ( KErrNone != error )
+                {
+                iObserver->NotifyFailure( error );
+                }
+            else
+                {
+                TRAP_IGNORE( iObserver->NotifyGetClutL(); );
+                }
+        #endif
+
+        }
+    else
+        {
+        LOG( SIMPLE, "SATENGINE: CSatIconHandler::GetClut Not connected" )
+        iObserver->NotifyFailure( KErrDisconnected );
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatIconHandler::GetClut exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatIconHandler::DoCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatIconHandler::DoCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatIconHandler::DoCancel calling" )
+
+    // Complete the request with cancel code.
+    iObserver->NotifyFailure( KErrCancel );
+
+    LOG( SIMPLE, "SATENGINE: CSatIconHandler::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatIconHandler::RunL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatIconHandler::RunL()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatIconHandler::RunL calling" )
+    LOG2( SIMPLE,
+            "SATENGINE: CSatIconHandler::RunL error: %i", iStatus.Int() )
+    if ( KErrNone == iStatus.Int() )
+        {
+        if ( iGetIconInfoActive )
+            {
+            LOG( NORMAL, "SATENGINE:   iGetIconInfoActive" )
+            iGetIconInfoActive = EFalse;
+            iObserver->NotifyGetIconInfo();
+            }
+
+        else if ( iGetIconInstanceActive )
+            {
+            LOG( NORMAL, "SATENGINE:   iGetIconInstanceActive" )
+            iGetIconInstanceActive = EFalse;
+            iObserver->NotifyGetIconInstanceL();
+            }
+
+        else if ( iGetClutActive )
+            {
+            LOG( NORMAL, "SATENGINE:   iGetClutActive" )
+            iGetClutActive = EFalse;
+            iObserver->NotifyGetClutL();
+            }
+
+        else
+            {
+            LOG( SIMPLE, "SATENGINE:   Unexpected RunL" )
+            PanicSatEngine( ESatSBadRequest );
+            }
+        }
+    else
+        {        
+        iObserver->NotifyFailure( iStatus.Int() );
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatIconHandler::RunL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatIconHandler::RunError
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CSatIconHandler::RunError( TInt aError )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatIconHandler::RunError calling" )
+
+    // If leave happened before completion of iMessage, we do it now
+    TInt err = iObserver->CompleteError( aError );
+    // If completed succesfully, aError is sent forward in completion.
+    // If not, we should return aError forward
+    if ( KErrNone != err )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatIconHandler::RunError KErrNone != err" )
+        err = aError;
+        }
+
+    LOG2( SIMPLE, "SATENGINE: CSatIconHandler::RunError exiting, err: %i",
+          err )
+    return err;
+    }
+// -----------------------------------------------------------------------------
+// Set a mode to determine whether to fetch icons from NAA syncronously or 
+// asynchronously.
+// -----------------------------------------------------------------------------
+//
+void CSatIconHandler::SetIconFetchingMode( TBool aMode )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatIconHandler::SetIconFetchingMode calling" )
+
+    iSyncIconFetching = aMode;
+
+    LOG( SIMPLE, "SATENGINE: CSatIconHandler::SetIconFetchingMode exiting" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/CSatSAPChangeObserver.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,149 @@
+/*
+* 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:  Observes SIM Access Profile status changes.
+*
+*/
+
+
+#include    <MSatShellController.h>
+#include    <BTSapDomainPSKeys.h>
+#include    "MSatUiSession.h"
+#include    "MSatSUiClientHandler.h"
+#include    "TSatSystemStateFactory.h"
+#include    "MSatSystemStateChangeNotifier.h"
+#include    "CSatSAPChangeObserver.h"
+#include    "SatLog.h"
+#include    "CSatCommandContainer.h"
+#include    "CSatSUiClientHandler.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatSAPChangeObserver::CSatSAPChangeObserver(
+    CSatCommandContainer& aContainer ) :
+    iContainer( aContainer )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSAPChangeObserver::CSatSAPChangeObserver\
+         calling-exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatSAPChangeObserver* CSatSAPChangeObserver::NewL(
+    CSatCommandContainer& aContainer )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSAPChangeObserver::NewL calling" )
+
+    CSatSAPChangeObserver* self =
+        new ( ELeave ) CSatSAPChangeObserver( aContainer );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "SATENGINE: CSatSAPChangeObserver::NewL exiting" )
+    return self;
+    }
+
+
+// Destructor
+CSatSAPChangeObserver::~CSatSAPChangeObserver()
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatSAPChangeObserver::~CSatSAPChangeObserver calling" )
+
+    if ( iStateNotifier )
+        {
+        iStateNotifier->CancelNotify();
+        delete iStateNotifier;
+        iStateNotifier = NULL;
+        }
+
+    LOG( SIMPLE,
+        "SATENGINE: CSatSAPChangeObserver::~CSatSAPChangeObserver exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+void CSatSAPChangeObserver::ConstructL()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSAPChangeObserver::ConstructL calling" )
+
+    iStateNotifier =
+        TSatSystemStateFactory::CreateSIMAccessProfileChangeNotifierL( *this );
+    // Start observer immediately
+    iStateNotifier->NotifyChangeL();
+
+    LOG( SIMPLE, "SATENGINE: CSatSAPChangeObserver::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+void CSatSAPChangeObserver::StateChanged( const TInt aValue )
+    {
+    LOG2( SIMPLE,
+        "SATENGINE: CSatSAPChangeObserver::StateChanged calling with value %d",
+        aValue )
+
+    TInt error( KErrNone );
+
+    // If value is true, stop all command handlers and remove
+    // SAT Icon from Application Shell.
+    if ( EBTSapConnecting == aValue ||
+         EBTSapConnected == aValue )
+        {
+        // SIM Access Profile activated.
+        // Notify listeners about SAT UI icon removing from Application Shell.
+        // This should be notified before command handlers are stopped.
+        iContainer.NotifyEvent( MSatUtils::ERemoveSatUiCalled );
+
+        // Then stop command handlers and remove SAT UI from Application Shell.
+        iContainer.StopCommandHandlers();
+        }
+    else if ( EBTSapNotConnected == aValue )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatSAPChangeObserver::StateChanged \
+             EBTSapNotConnected" )
+        // Start command handlers
+        TRAP( error,
+            iContainer.StartCommandHandlersL();
+            ); // End of TRAP
+
+        if ( KErrNone != error )
+            {
+            LOG2( SIMPLE, "SATENGINE: CSatSAPChangeObserver::StateChanged \
+                failed to recover from SAP: %i", error )
+            }
+
+        // Notify listeners about SAT UI icon adding.
+        iContainer.NotifyEvent( MSatUtils::EAddSatUiCalled );
+        }
+    else
+        {
+        LOG( SIMPLE, "SATENGINE:   Unexpected value" )
+        }
+    
+    LOG2( SIMPLE, "SATENGINE: CSatSAPChangeObserver::StateChanged exiting, \
+          error: %d",error )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/CSatSBasicIconConverter.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,173 @@
+/*
+* 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:  Converts basic icon to CFbsBitmap
+*
+*/
+
+
+#include    <fbs.h>
+#include    <gdi.h>
+#include    "CSatSBasicIconConverter.h"
+#include    "TSatBitOP.h"
+#include    "SatLog.h"
+
+// Black&white icon uses 1 bpp.
+const TUint8 KBpp = 1;
+
+// Black&white icon header size is 2.
+const TUint8 KHeaderSize( 2 );
+
+// Value of icon data, which means that pixel is lit.
+const TInt KPixelIsLit = 1;
+const TUint KBitCount( 8 );
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// CSatSBasicIconConverter::CSatSBasicIconConverter
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatSBasicIconConverter::CSatSBasicIconConverter() :
+CSatSIconConverter()
+    {
+    LOG( SIMPLE, "SATENGINE: \
+        CSatSBasicIconConverter::CSatSBasicIconConverter calling - exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSBasicIconConverter::ConvertL
+// Converts the basic icon format (ETSI TS 131 102 V4.10.0) to CFbsBitmap
+// The format of aData has to be following:
+//  1st byte:           Image width
+//  2nd byte:           Image height
+//  3rd byte to end:    Image body.
+// Image body has to be in following format:
+//  Bit 8:  1st pixel
+//  Bit 7:  2nd pixel
+//  Bit 6:  3rd pixel
+//  etc...
+//
+// Clut is not needed for converting basic icon.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CFbsBitmap* CSatSBasicIconConverter::ConvertL(
+    const TDesC8& aData,
+    const TDesC8& /*aClut*/ ) const
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSBasicIconConverter::ConvertL calling" )
+
+    CheckDataValidityL( aData );
+    const TUint8 width( aData[0] );
+    const TUint8 height( aData[1] );
+
+    // Create black and white bitmap.
+    CFbsBitmap* bitmap = CreateBitmapL( width, height, EGray2 );
+
+    // Extract the header information away from icon data.
+    const TPtrC8 iconData(
+        aData.Mid( KHeaderSize, aData.Length() - KHeaderSize ) );
+
+    TBitmapUtil bitmapUtil( bitmap );
+    bitmapUtil.Begin( TPoint( 0, 0 ) );
+    TInt x( 0 );
+    TInt y( 0 );
+    // Convert the icon data.
+    for ( y = 0; y < height; y++ )
+        {
+        bitmapUtil.SetPos( TPoint( 0, y ) );
+        for ( x = 0; x < width; x++ )
+            {
+            const TInt startingBit( y * width + x );
+            const TUint8 color =
+                TSatBitOP::ExtractBits( startingBit, KBpp, iconData );
+
+            if ( KPixelIsLit == color )
+                {
+                // Black is lit pixel.
+                bitmapUtil.SetPixel( KRgbBlack.Value() );
+                }
+            else
+                {
+                // White means no pixel.
+                bitmapUtil.SetPixel( KRgbWhite.Value() );
+                }
+
+            bitmapUtil.IncXPos();
+            }
+        }
+
+    bitmapUtil.End();
+    LOG3( SIMPLE,"SATENGINE: CSatSBasicIconConverter::ConvertL, \
+          x: %d, y: %d", x, y )
+    LOG( SIMPLE, "SATENGINE: CSatSBasicIconConverter::ConvertL exiting" )
+    return bitmap;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSBasicIconConverter::CheckDataValidityL
+// Checks that icon data has valid length.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatSBasicIconConverter::CheckDataValidityL( const TDesC8& aData ) const
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatSBasicIconConverter::CheckDataValidityL calling" )
+
+    TInt err( KErrNone );
+
+    // Is there at least width and height in aData.
+    const TInt dataLength( aData.Length() );
+
+    if ( dataLength > KHeaderSize )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatSBasicIconConverter::CheckDataValidityL \
+             dataLength bigger than KHeaderSize" )
+        const TUint8 width( aData[0] );
+        const TUint8 height( aData[1] );
+
+        // Width and height does not belong to image body.
+        const TInt imageBodyLength( dataLength - KHeaderSize );
+
+        // Check that image body has at least as many
+        // bits than width and height succest. There might
+        // be more bits because the actual size of the image
+        // body may occupie only couple bits from
+        // last byte in image body.
+        const TInt bitsInImageBody( imageBodyLength * KBitCount );
+        const TInt bitsExpectedInImageBody( width * height );
+
+        if ( bitsInImageBody < bitsExpectedInImageBody )
+            {
+            LOG( SIMPLE, "SATENGINE: CSatSBasicIconConverter::\
+            CheckDataValidityL bitsInImageBody < bitsExpectedInImageBody" )
+            err = KErrCorrupt;
+            }
+        }
+    else
+        {
+        LOG( SIMPLE, "SATENGINE: CSatSBasicIconConverter::CheckDataValidityL \
+             dataLength less than KHeaderSize" )
+        err = KErrCorrupt;
+        }
+
+    User::LeaveIfError( err );
+    LOG( SIMPLE,
+        "SATENGINE: CSatSBasicIconConverter::CheckDataValidityL exiting" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/CSatSColorIconConverter.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,209 @@
+/*
+* 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:  Converts color icon to CFbsBitmap
+*
+*/
+
+
+#include    <gdi.h>
+#include    <fbs.h>
+#include    "CSatSColorIconConverter.h"
+#include    "TSatBitOP.h"
+#include    "SatLog.h"
+
+const TInt KHeaderSize = 6;
+const TInt KClutEntrySize = 3;
+const TInt KRedShift = 16;
+const TInt KGreenShift = 8;
+const TInt KPixelSize = 8;
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// CSatSColorIconConverter::CSatSColorIconConverter
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatSColorIconConverter::CSatSColorIconConverter()
+    {
+    LOG( SIMPLE, "SATENGINE: \
+        CSatSColorIconConverter::CSatSColorIconConverter calling - exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSColorIconConverter::CheckDataValidityL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatSColorIconConverter::CheckDataValidityL(
+    const TDesC8& aData ) const
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatSColorIconConverter::CheckDataValidityL calling" )
+    TInt err( KErrNone );
+    const TInt dataLength( aData.Length() );
+
+    if ( dataLength >= KHeaderSize )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatSColorIconConverter::CheckDataValidityL \
+             dataLength bigger than KHeaderSize" )
+        const TInt width( aData[0] );
+        const TInt height( aData[1] );
+        const TInt bpp( aData[2] );
+
+        if ( dataLength < ( width * height * bpp / KPixelSize + KHeaderSize ) )
+            {
+            LOG( SIMPLE, "SATENGINE: CSatSColorIconConverter::\
+            CheckDataValidityL KErrCorrupt" )
+            err = KErrCorrupt;
+            }
+        }
+
+    else
+        {
+        LOG( SIMPLE, "SATENGINE: CSatSColorIconConverter::CheckDataValidityL \
+             dataLength less than KHeaderSize" )
+        err = KErrCorrupt;
+        }
+
+    User::LeaveIfError( err );
+    LOG( SIMPLE,
+        "SATENGINE: CSatSColorIconConverter::CheckDataValidityL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSColorIconConverter::CheckClutValidityL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatSColorIconConverter::CheckClutValidityL(
+    const TDesC8& aData,
+    const TDesC8& aClut ) const
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatSColorIconConverter::CheckClutValidityL calling" )
+    const TInt clutEntries( aData[3] );
+    const TInt expectedClutLength( clutEntries * KClutEntrySize );
+
+    if ( aClut.Length() < expectedClutLength )
+        {
+        LOG( SIMPLE,
+        "SATENGINE: CSatSColorIconConverter::CheckClutValidityL KErrCorrupt" )
+        User::Leave( KErrCorrupt );
+        }
+
+    LOG( SIMPLE,
+        "SATENGINE: CSatSColorIconConverter::CheckClutValidityL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSColorIconConverter::ConvertL
+// Converts color icon to CFbsBitamp.
+//
+// aData has following format( ETSI TS 131 102 V4.10.0 ).
+//  1 byte:         Icon width
+//  2 byte:         Icon height
+//  3 byte:         Bits per raster image point. (1 to 8)
+//  7 to end byte:  Image body.
+//
+// The image body has following format.
+//
+//   Byte 1     Byte 2
+//  1001 1100 1110 1100 ....
+//
+// If the Bits per pixel ratio is 3 then
+// 1st raster point CLUT reference is 100
+// 2nd ------------ "" -------------- 111
+// 3rd ------------ "" -------------- 001
+// 4th ------------ "" -------------- 110
+// etc...
+//
+// One CLUT entry is 3 bytes and each byte defines the intensity of color (RGB).
+// The CLUT is in following format:
+// 1st CLUT entry
+//      1 byte Red color intensity
+//      2 byte Green color intensity
+//      3 byte Blue color intensity
+// 2nd CLUT entry
+//      4 byte Red color intensity
+//      5 byte Green color intensity
+//      6 byte Blue color intensity
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CFbsBitmap* CSatSColorIconConverter::ConvertL(
+    const TDesC8& aData,
+    const TDesC8& aClut ) const
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSColorIconConverter::ConvertL calling" )
+
+    // Check that data is valid.
+    CheckDataValidityL( aData );
+    CheckClutValidityL( aData, aClut );
+
+    const TUint8 width( aData[0] );
+    const TUint8 height( aData[1] );
+
+    // Create the bitmap
+    CFbsBitmap* bitmap = CreateBitmapL( width, height, EColor16M );
+
+    // Separate the header from image body.
+    const TPtrC8 iconData(
+        aData.Mid( KHeaderSize, aData.Length() - KHeaderSize ) );
+
+    const TUint8 bpp( aData[2] );
+    TBitmapUtil bitmapUtil( bitmap );
+    bitmapUtil.Begin( TPoint( 0, 0 ) );
+    TInt x(0);
+    TInt y(0);
+    // Go through the image body to convert the data.
+    for ( y = 0; y < height; y++ )
+        {
+        bitmapUtil.SetPos( TPoint( 0, y ) );
+
+        for ( x = 0; x < width; x++ )
+            {
+            // Calculate the starting bit index of current pixel
+            // location.
+            const TInt startBit( ( y * width + x ) * bpp );
+
+            // Get the entry from icon data.
+            const TUint8 clutReference(
+                TSatBitOP::ExtractBits( startBit, bpp, iconData ) );
+
+            // clut entry is 3 bytes long and therefore the start of
+            // the clut entry is multiplied with 3.
+            const TInt clutEntryPoint( clutReference * KClutEntrySize );
+
+            // Take the color intensities from clut entry.
+            const TUint red( aClut[clutEntryPoint] );
+            const TUint green( aClut[clutEntryPoint + 1] );
+            const TUint blue( aClut[clutEntryPoint + 2] );
+
+            // Cannot use TRgb here, because of different interpration of
+            // r,g,b order than bitmapUtil.
+            bitmapUtil.SetPixel(
+                red << KRedShift | green << KGreenShift | blue );
+
+            bitmapUtil.IncXPos();
+            }
+        }
+    LOG3( SIMPLE,"SATENGINE: CSatSColorIconConverter::ConvertL, \
+          x: %d, y: %d", x, y )
+    bitmapUtil.End();
+
+    LOG( SIMPLE, "SATENGINE: CSatSColorIconConverter::ConvertL exiting" )
+    return bitmap;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/CSatSIconConverter.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,96 @@
+/*
+* 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:  Base class for converters.
+*
+*/
+
+
+#include    <fbs.h>
+#include    "CSatSIconConverter.h"
+#include    "CSatSBasicIconConverter.h"
+#include    "CSatSColorIconConverter.h"
+#include    "SatLog.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// CSatSIconConverter::CSatSIconConverter
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatSIconConverter::CSatSIconConverter()
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatSIconConverter::CSatSIconConverter calling - exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSIconConverter::CreateConverterL
+// Factory method for creating converter.
+// -----------------------------------------------------------------------------
+//
+CSatSIconConverter* CSatSIconConverter::CreateConverterL(
+    const RSat::TImageCoding& aCoding )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSIconConverter::CreateConverterL calling" )
+
+    CSatSIconConverter* converter = NULL;
+    LOG2( SIMPLE, "SATENGINE: CSatSIconConverter::CreateConverterL \
+          aCoding: %d", aCoding )
+    switch ( aCoding )
+        {
+        case RSat::KBasic:
+            {
+            converter = new( ELeave )CSatSBasicIconConverter();
+            break;
+            }
+
+        case RSat::KColour:
+            {
+            converter = new( ELeave )CSatSColorIconConverter();
+            break;
+            }
+
+        default:
+            {
+            User::Leave( KErrNotSupported );
+            }
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatSIconConverter::CreateConverterL exiting" )
+    return converter;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSIconConverter::CreateBitmapL
+// Creates the bitmap.
+// -----------------------------------------------------------------------------
+//
+CFbsBitmap* CSatSIconConverter::CreateBitmapL(
+    TUint8 aWidth,
+    TUint8 aHeight,
+    TDisplayMode aDisplayMode ) const
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSIconConverter::CreateBitmapL calling" )
+
+    CFbsBitmap* bitmap = new( ELeave )CFbsBitmap();
+    CleanupStack::PushL( bitmap );
+    User::LeaveIfError(
+        bitmap->Create( TSize( aWidth, aHeight ), aDisplayMode ) );
+    CleanupStack::Pop( bitmap );
+
+    LOG( SIMPLE, "SATENGINE: CSatSIconConverter::CreateBitmapL exiting" )
+    return bitmap;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/CSatSIconSubSession.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,624 @@
+/*
+* 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:  Handles the icon sub-session IPC.
+*
+*/
+
+
+#include    <fbs.h>
+#include    <rsatservice.h>
+#include    <e32property.h>
+
+#include    "tsatinternaliconinfo.h"
+#include    "SATInternalPSKeys.h"
+#include    "CSatSIconSubSession.h"
+#include    "MSatSIconAPI.h"
+#include    "SatSOpcodes.h"
+#include    "CSatSSession.h"
+#include    "CSatSIconConverter.h"
+#include    "EnginePanic.h"
+#include    "SatLog.h"
+#include    "TSatEventMediator.h"
+#include    "MSatUtils.h"
+
+const TUint8 KClutEntrySize = 3;
+const TUint KDefaultNumberOfClutEntries = 256;
+const TUint8 KColourDepthByte = 4;
+const TUint8 KNumberOfCLUTByte = KColourDepthByte + 1;
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// CSatSIconSubSession::CSatSIconSubSession
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatSIconSubSession::CSatSIconSubSession(
+    CSatSSession& aSession,
+    TSatEventMediator& aEventMediator ) :
+    CSatSSubSession( aSession ),
+    iEventMediator( aEventMediator )
+    {
+    LOG( SIMPLE, "SATENGINE: \
+        CSatSIconSubSession::CSatSIconSubSession calling - exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSIconSubSession::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatSIconSubSession* CSatSIconSubSession::NewL(
+    CSatSSession& aSession,
+    TSatEventMediator& aEventMediator )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::NewL calling" )
+
+    CSatSIconSubSession* self =
+        new( ELeave ) CSatSIconSubSession( aSession, aEventMediator );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( /* self */ );
+
+    LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::NewL exiting" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSIconSubSession::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CSatSIconSubSession::ConstructL()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::ConstructL calling" )
+
+    iIconAPI = iSession.CreateIconHandlerL();
+
+    LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSIconSubSession::~CSatSIconSubSession
+// -----------------------------------------------------------------------------
+//
+CSatSIconSubSession::~CSatSIconSubSession()
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatSIconSubSession::~CSatSIconSubSession calling" )
+        
+    delete iBitmap;
+    delete iIconAPI;
+    delete iClut;
+    delete iIconData;
+
+    LOG( SIMPLE,
+        "SATENGINE: CSatSIconSubSession::~CSatSIconSubSession exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSIconSubSession::GetIconInfo
+// Gets the icon info from SIM.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatSIconSubSession::GetIconInfo()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::GetIconInfo calling" )
+
+    // Read the recordnumber from client.
+    TUint8 recordNumber( 0 );
+    TPckg<TUint8> recordPckg( recordNumber );
+    TRAPD( err, iMessage.ReadL( 0, recordPckg ) );
+    LOG2( SIMPLE, "SATENGINE: CSatSIconSubSession::GetIconInfo \
+          err: %i", err )
+    if ( KErrNone == err )
+        {
+        // Start getting the icon info from SIM.
+        iIconEf.SetLength( NULL );
+        iIconAPI->GetIconInfo( recordNumber, iIconEf, *this );
+        }
+    else
+        {
+        iSession.PanicClient( iMessage, ESatSBadDescriptor );
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::GetIconInfo exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSIconSubSession::NotifyGetIconInfo
+// Notification from icon observer
+// -----------------------------------------------------------------------------
+//
+void CSatSIconSubSession::NotifyGetIconInfo()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::NotifyGetIconInfo calling" )
+
+    // Send the icon info data got to client.
+    TPckg<RSat::TIcon> infoPckg( iIconEf );    
+    Write( iMessage, 1, infoPckg );
+    iMessage.Complete( KErrNone );
+
+    LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::NotifyGetIconInfo exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSIconSubSession::GetIconInstanceL
+// Gets the icon from SIM.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatSIconSubSession::GetIconInstanceL()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::GetIconInstanceL calling" )
+
+    TSatInternalIconInfo info;
+    // Read the icon info from client.
+    TSatInternalIconInfoPckg infoPckg( info );
+    TRAPD( err, iMessage.ReadL( 0, infoPckg ) );
+
+    iInfo.iInstanceNumber = info.iFileIdentifier;
+    iInfo.iOffset = info.iOffset;
+    iInfo.iLength = info.iLength;
+
+    if ( TSatInternalIconInfo::EBasic == info.iCodingScheme )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::GetIconInstanceL \
+             basic CodingScheme" )
+        iInfo.iCoding = RSat::KBasic;
+        }
+    else
+        {
+        LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::GetIconInstanceL \
+             colour CodingScheme" )
+        iInfo.iCoding = RSat::KColour;
+        }
+
+    iInfo.iImgWidth = static_cast<TUint8>( info.iWidth );
+    iInfo.iImgHeight = static_cast<TUint8>( info.iHeight );
+    iInfo.iFileId = info.iFileIdentifier;
+    LOG2( SIMPLE, "SATENGINE: CSatSIconSubSession::GetIconInstanceL \
+          err: %i", err )
+    if ( KErrNone == err )
+        {
+        // Create buffer for the icon data.
+        iIconData = HBufC8::NewL( iInfo.iLength );
+        TPtr8 iconDataPtr( iIconData->Des() );
+
+        // Start getting the icon data from SIM.
+        iIconAPI->GetIconInstance( iInfo, iconDataPtr, *this );
+        }
+    else
+        {
+        iSession.PanicClient( iMessage, ESatSBadDescriptor );
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::GetIconInstanceL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSIconSubSession::NotifyGetIconInstanceL
+// Notification from icon observer
+// -----------------------------------------------------------------------------
+//
+void CSatSIconSubSession::NotifyGetIconInstanceL()
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatSIconSubSession::NotifyGetIconInstanceL calling" )
+
+    LOG2( NORMAL, "SATENGINE: CSatSIconSubSession::NotifyGetIconInstanceL \
+          infoLength: %x", iInfo.iLength )
+
+    LOG2( NORMAL, "SATENGINE: CSatSIconSubSession::NotifyGetIconInstanceL \
+          dataLength: %x", iIconData->Length() )
+
+    // Get the CLUT and convert the icon data to bitmap.
+
+    // basic icon has empty CLUT
+    if ( RSat::KBasic == iInfo.iCoding )
+        {
+        // For the basi icon the length from the icon info and icon data
+        // body should have the same length but for the clore icon the
+        // length not always same.
+        if ( iInfo.iLength == iIconData->Length() )
+            {
+            LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \
+             get the basic clut" )
+            // Basic icon does not have CLUT.
+            iClut = KNullDesC8().AllocL();
+            // Complete icon.
+            NotifyGetClutL();
+            }
+        else
+            {
+            LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \
+                notify failure basic" )
+            NotifyFailure( KErrCorrupt );
+            }
+        }
+    else // color icon
+        {
+        LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \
+             others" )
+        TPtr8 iconDataPtr( iIconData->Des() );
+
+        if ( iconDataPtr.Length() >= KNumberOfCLUTByte + 1 )
+            {
+            // Create buffer for clut. Each clut entry contains
+            // intensity of red, green and blue. The value of 0 is
+            // interpreted as 256 clut entries. (ETSI TS 131 102 V4.10.0).
+            TInt numberOfClutEntries( iconDataPtr[KClutEntrySize] );
+            LOG2( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \
+                  numberOfClutEntries: %i", numberOfClutEntries )
+            if ( 0 == numberOfClutEntries )
+                {
+                numberOfClutEntries = KDefaultNumberOfClutEntries;
+                }
+    
+            // Start getting the icon color lookup table from SIM.
+            TInt length = numberOfClutEntries * KClutEntrySize;
+            // In some situation the length we get from the icon information
+            // includes the length of the CLUT and some time it doesn't
+            // Both situation a valid.
+            if ( ( iInfo.iLength == iIconData->Length() )
+                 || ( iInfo.iLength == iIconData->Length() + length ) )  
+                {
+                iClut = HBufC8::NewL( length );
+    
+                LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \
+                     get clut" )
+                const TUint offset( iconDataPtr[KColourDepthByte] << 8 |
+                    iconDataPtr[KNumberOfCLUTByte] );
+                TPtr8 clutPtr( iClut->Des() );
+                iIconAPI->GetClut(
+                    iInfo.iInstanceNumber, offset, clutPtr, *this );
+                }
+            else
+                {
+                LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \
+                     others notify failure" )
+                NotifyFailure( KErrCorrupt );
+                }
+            }
+        else
+            {
+            LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \
+                 others notify failure" )
+            NotifyFailure( KErrCorrupt );
+            }
+        }
+
+    LOG( SIMPLE,
+        "SATENGINE: CSatSIconSubSession::NotifyGetIconInstanceL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSIconSubSession::NotifyGetClutL
+// Notification from icon observer
+// -----------------------------------------------------------------------------
+//
+void CSatSIconSubSession::NotifyGetClutL()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::NotifyGetClutL calling" )
+
+    // Create icon converter.
+    CSatSIconConverter* converter =
+        CSatSIconConverter::CreateConverterL(
+            static_cast<RSat::TImageCoding>( iInfo.iCoding ) );
+    CleanupStack::PushL( converter );
+
+    if ( NULL != iBitmap )
+        {
+        delete iBitmap; // Delete the bitmap
+        iBitmap = NULL;
+        }
+
+    iBitmap = converter->ConvertL( *iIconData, *iClut );
+
+    // Send the bitmap handle to client.
+    TPckg<TInt> handlePckg( iBitmap->Handle() );
+    Write( iMessage, 1, handlePckg );
+
+    CleanupStack::PopAndDestroy( converter );
+
+        delete iClut;
+        iClut = NULL;
+        
+        delete iIconData;
+        iIconData = NULL;
+
+    iMessage.Complete( KErrNone );
+    LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::NotifyGetClutL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSIconSubSession::NotifyFailure
+// Notification from icon observer
+// -----------------------------------------------------------------------------
+//
+void CSatSIconSubSession::NotifyFailure( TInt errorCode )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::NotifyFailure calling" )
+
+    if ( NULL != iMessage.Handle() )
+        {
+        LOG(
+            SIMPLE,
+            "SATENGINE: CSatSIconSubSession::NotifyFailure Message!" )
+        iMessage.Complete( errorCode );
+        }
+    else
+        {
+        LOG(
+            SIMPLE,
+            "SATENGINE: CSatSIconSubSession::NotifyFailure No Message!" )
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::NotifyFailure exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSIconSubSession::HandleCommandL
+// Handles the icon sub-session requests.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatSIconSubSession::HandleCommandL( const RMessage2& aMessage )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::HandleCommandL calling" )
+
+    switch ( aMessage.Function() )
+        {
+        case ESatSGetIconInfo:
+            {
+            LOG( NORMAL, "SATENGINE:   ESatSGetIconInfo" )
+            if ( NULL != iMessage.Handle() )
+                {
+                LOG( SIMPLE,
+                    "SATENGINE:   Request already pending (GetIconInfo)" )
+                iSession.PanicClient( aMessage, ESatSBadRequest );
+                }
+            else
+                {
+                LOG( SIMPLE,
+                    "SATENGINE:   Request handling (GetIconInfo)" )
+                iMessage = aMessage;
+                GetIconInfo();
+                }
+            break;
+            }
+
+        case ESatSGetIconInstance:
+            {
+            LOG( NORMAL, "SATENGINE:   ESatSGetIconInstance" )
+            TBool mode = IconFetchingMode();
+            
+            NotifyIconFetchingMode( mode );
+                        
+            if ( NULL != iMessage.Handle() )
+                {
+                LOG( SIMPLE,
+                    "SATENGINE:   Request already pending (GetIconInstance)" )
+                iSession.PanicClient( aMessage, ESatSBadRequest );
+                }
+            else
+                {
+                LOG( SIMPLE,
+                    "SATENGINE:   Request handling (GetIconInstance)" )
+                iMessage = aMessage;
+                GetIconInstanceL();
+                }
+            break;
+            }
+
+        // Client issues ESatSIconInstanceGot when the client
+        // has duplicated the icon and then the bitmap can be
+        // deleted.
+        case ESatSIconInstanceGot:
+            {
+            LOG( NORMAL, "SATENGINE:   ESatSIconInstanceGot" )
+            // Free the bitmap.
+            delete iBitmap;
+            iBitmap = NULL;
+            aMessage.Complete( KErrNone );
+            break;
+            }
+
+        // Response for SetUpIdleModeText
+        case ESatSIdleModeResponse:
+            {
+            LOG( NORMAL, "SATENGINE:   ESatSIdleModeResponse" )
+            // Send the response to Proactive SetUpIdleModeText handler
+            SendSetUpIdleModeResponse( aMessage.Int0() );
+            aMessage.Complete( KErrNone );
+            break;
+            }
+
+        default:
+            {
+            LOG( SIMPLE, "SATENGINE:   Bad function - default" )
+            iSession.PanicClient( aMessage, ESatSBadRequest );
+            }
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::HandleCommandL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSIconSubSession::SendSetUpIdleModeResponse
+// Notification from icon observer
+// -----------------------------------------------------------------------------
+//
+void CSatSIconSubSession::SendSetUpIdleModeResponse( TInt aResponse ) const
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatSIconSubSession::SendSetUpIdleModeResponse calling" )
+
+    // Send the response through Event handling procedure.
+    switch ( aResponse )
+        {
+        case RSatService::ESATIdleSuccess:
+            {
+            LOG( NORMAL, "SATENGINE:   Success" )
+            iEventMediator.Notify(
+                MSatUtils::EIdleModeResponseSuccess );
+            break;
+            }
+
+        case RSatService::ESATIdleSuccessRequestedIconNotDisplayed:
+            {
+            LOG( NORMAL, "SATENGINE:   Success no icon" )
+            iEventMediator.Notify(
+                MSatUtils::EIdleModeResponseSuccessNoIcon );
+            break;
+            }
+
+        case RSatService::ESATIdleMeUnableToProcessCmd:
+            {
+            LOG( NORMAL, "SATENGINE:   Unable to process" )
+            iEventMediator.Notify(
+                MSatUtils::EIdleModeResponseUnableToProcess );
+            break;
+            }
+
+        case RSatService::ESATIdleCmdBeyondMeCapabilities:
+            {
+            LOG( NORMAL, "SATENGINE:   Beyond capabilities" )
+            iEventMediator.Notify(
+                MSatUtils::EIdleModeResponseBeyondCapabilities );
+            break;
+            }
+
+        default:
+            {
+            LOG( NORMAL, "SATENGINE:   Unknown response" )
+            break;
+            }
+        }
+
+    LOG( SIMPLE,
+        "SATENGINE: CSatSIconSubSession::SendSetUpIdleModeResponse exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSIconSubSession::Write
+// Writes descriptor to client address space and panics the client if
+// writing fails.
+// -----------------------------------------------------------------------------
+//
+void CSatSIconSubSession::Write( const RMessage2& aMessage,
+                                 TInt aParam,
+                                 const TDesC8& aDes ) const
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::Write calling" )
+
+    TRAPD( err, aMessage.WriteL( aParam, aDes ) );
+    LOG2( SIMPLE, "SATENGINE: CSatSIconSubSession::Write \
+          err: %i", err )
+    if ( KErrNone != err )
+        {
+        iSession.PanicClient( aMessage, ESatSBadDescriptor );
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::Write exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSIconSubSession::CompleteError
+// Completion of iMessage for handler
+// -----------------------------------------------------------------------------
+//
+TInt CSatSIconSubSession::CompleteError( TInt aError ) const
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::CompleteError calling" )
+    TInt err( KErrCompletion );
+
+    if ( NULL != iMessage.Handle() )
+        {
+        iMessage.Complete( aError );
+        LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::CompleteError iMessage \
+            completed" )
+        err = KErrNone;
+        }
+
+    LOG2( SIMPLE, "SATENGINE: CSatSIconSubSession::CompleteError exiting, \
+          err: %i", err )
+    return err;
+    }
+// -----------------------------------------------------------------------------
+// Get icon fetching mode which is in synchronous or asynchronous mode.
+// -----------------------------------------------------------------------------
+TBool CSatSIconSubSession::IconFetchingMode()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::IconFetchingMode calling" )
+
+    TInt cancelledUsingEndKey( 0 );
+    TBool isSyncMode( EFalse );
+    
+    TInt error = RProperty::Get( KPSUidSatServerInternal,
+        KSatAppClosedUsingEndKey, cancelledUsingEndKey );
+    
+    LOG2( SIMPLE, "SATENGINE: CSatSIconSubSession::IconFetchingMode \
+          P&S key: %i", cancelledUsingEndKey )
+        
+    LOG2( NORMAL,
+        "SATENGINE: CSatSIconSubSession::IconFetchingMode \
+        subscribe KSatUiCancelledUsingEndKey and return: %d", error )
+            
+    if ( cancelledUsingEndKey )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::IconFetchingMode \
+             cancell UsingEndKey" )
+        isSyncMode = ETrue;
+        }
+    else
+        {
+        LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::IconFetchingMode \
+             don't cancell UsingEndKey" )
+        isSyncMode = EFalse;
+        }
+        
+    LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::IconFetchingMode exiting" )
+
+    return isSyncMode;
+    }
+    
+// -----------------------------------------------------------------------------
+// Notify CSatIconHandler to fetch icons from NAA synchronously or
+// asynchrounously.
+// -----------------------------------------------------------------------------
+void CSatSIconSubSession::NotifyIconFetchingMode( TBool aMode )
+    {
+    LOG( SIMPLE, 
+        "SATENGINE: CSatSIconSubSession::NotifyIconFetchingMode calling" )
+
+    iIconAPI->SetIconFetchingMode( aMode );
+
+    if ( aMode )
+        {
+        TInt error = RProperty::Set( KPSUidSatServerInternal,
+            KSatAppClosedUsingEndKey, KSatAppTerminatedNormal );
+        LOG2( SIMPLE,"CSatSIconSubSession::NotifyIconFetchingMode \
+              P&S key: %i", KSatAppTerminatedNormal )
+            
+        LOG2( NORMAL,
+            "SATENGINE: CSatSIconSubSession::NotifyIconFetchingMode \
+            publish KSatUiCancelledUsingEndKey and return: %d", error )
+        }
+
+    LOG( SIMPLE, 
+        "SATENGINE: CSatSIconSubSession::NotifyIconFetchingMode exiting" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/CSatSRefreshSubSession.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,771 @@
+/*
+* 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:  Handles the refresh sub-session IPC.
+*
+*/
+
+
+#include    <e32base.h>
+#include    "MSatUtils.h"
+#include    "CSatSRefreshSubSession.h"
+#include    "SatSOpcodes.h"
+#include    "CSatSSession.h"
+#include    "EnginePanic.h"
+#include    "CSatSServer.h"
+#include    "SatLog.h"
+
+const TInt KClientQueryDelay = 1000000; // 1 second.
+const TInt KClientNotifyDelay = 60000000; // 1 minute.
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// CSatSRefreshSubSession::CSatSRefreshSubSession
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatSRefreshSubSession::CSatSRefreshSubSession(
+    CSatSSession& aSession,
+    TSatEventMediator& aEventMediator ) :
+    CSatSSubSession( aSession ),
+    iEventMediator( aEventMediator ),
+    iClientQueryPending( EFalse ),
+    iClientNotifyPending( EFalse ),
+    iClientWaitingRefresh( EFalse )
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatSRefreshSubSession::CSatSRefreshSubSession \
+        calling - exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSRefreshSubSession::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSatSRefreshSubSession::ConstructL()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::ConstructL calling" )
+
+    CSatSServer* server =
+        const_cast<CSatSServer*>(
+            static_cast<const CSatSServer*>( iSession.Server() ) );
+    server->AddL( this );
+
+    LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSRefreshSubSession::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatSRefreshSubSession* CSatSRefreshSubSession::NewL(
+    CSatSSession& aSession,
+    TSatEventMediator& aEventMediator )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::NewL calling" )
+
+    CSatSRefreshSubSession* self =
+        new( ELeave ) CSatSRefreshSubSession( aSession, aEventMediator );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::NewL exiting" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSRefreshSubSession::~CSatSRefreshSubSession()
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CSatSRefreshSubSession::~CSatSRefreshSubSession()
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatSRefreshSubSession::~CSatSRefreshSubSession calling" )
+
+    CSatSServer* server =
+        const_cast<CSatSServer*>(
+            static_cast<const CSatSServer*>( iSession.Server() ) );
+    server->Remove( this );
+
+    // Remove Client Query timer.
+    if ( iQueryTimer )
+        {
+        iQueryTimer->Cancel();
+        delete iQueryTimer;
+        iQueryTimer = NULL;
+        }
+
+    // Remove Client Notify timer.
+    if ( iNotifyTimer )
+        {
+        iNotifyTimer->Cancel();
+        delete iNotifyTimer;
+        iNotifyTimer = NULL;
+        }
+
+    LOG( SIMPLE,
+        "SATENGINE: CSatSRefreshSubSession::~CSatSRefreshSubSession exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSRefreshSubSession::HandleCommandL
+// Handles the refresh sub-session requests.
+// -----------------------------------------------------------------------------
+//
+void CSatSRefreshSubSession::HandleCommandL( const RMessage2& aMessage )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::HandleCommandL calling" )
+
+    switch ( aMessage.Function() )
+        {
+        case ESatSRefreshAllowed:
+            {
+            LOG( NORMAL, "SATENGINE:   Command: ESatSRefreshAllowed" )
+            // Client's response to refresh query.
+            RefreshAllowed( aMessage );
+            break;
+            }
+
+        case ESatSNotifyAllowRefresh:
+            {
+            LOG( NORMAL, "SATENGINE:   Command: ESatSNotifyAllowRefresh" )
+            // Client is ready for refresh query.
+            NotifyRefreshAllowed( aMessage );
+            break;
+            }
+
+        case ESatSNotityAllowRefreshCancel:
+            {
+            LOG( NORMAL, "SATENGINE:   Command: ESatSNotityAllowRefreshCancel" )
+            // Client cancels the refresh query.
+            CancelNotifyAllowRefresh( aMessage );
+            break;
+            }
+
+        case ESatSNotifyRefresh:
+            {
+            LOG( NORMAL, "SATENGINE:   Command: ESatSNotifyRefresh" )
+            // Client is ready for refresh.
+            NotifyRefresh( aMessage );
+            break;
+            }
+
+        case ESatSCancelNotifyRefresh:
+            {
+            LOG( NORMAL, "SATENGINE:   Command: ESatSCancelNotifyRefresh" )
+            // Client cancels the refresh.
+            CancelNotifyRefresh( aMessage );
+            break;
+            }
+
+        case ESatSRefreshEFRead:
+            {
+            LOG( NORMAL, "SATENGINE:   Command: ESatSRefreshEFRead" )
+            // Client has completed refresh.
+            CompleteRefresh( aMessage );
+            break;
+            }
+
+        default:
+            {
+            LOG( NORMAL, "SATENGINE:   Unexpected command: ggg" )
+            // A wrong message was sent.
+            iSession.PanicClient( aMessage, ESatSBadDescriptor );
+            }
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::HandleCommandL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSRefreshSubSession::RefreshAllowed
+// Sends the client's response of refresh query to SatServer.
+// -----------------------------------------------------------------------------
+//
+void CSatSRefreshSubSession::RefreshAllowed( const RMessage2& aMessage )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::RefreshAllowed calling" )
+
+    // Handle reply only when we are waiting for it.
+    // It is possible, that query has timed out and we got a late response.
+    if ( iClientQueryPending )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::RefreshAllowed \
+        iClientQueryPending true" )
+        iClientQueryPending = EFalse;
+
+        // Stop timer, client replied.
+        if ( iQueryTimer )
+            {
+            LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::RefreshAllowed \
+            iQueryTimer true" )
+            iQueryTimer->Cancel();
+            }
+
+        TBool allow( EFalse );
+        TPckg<TBool> allowPckg( allow );
+        TRAPD( err, aMessage.ReadL( 0, allowPckg ) );
+        LOG2( SIMPLE, "SATENGINE: CSatSRefreshSubSession::RefreshAllowed \
+              err: %i", err )
+        if ( KErrNone == err )
+            {
+            //lint -e{774} Allow updated through allowPckg in ReadL.
+            if ( allow )
+                {
+                LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::\
+                     RefreshAllowed allow refresh" )
+                iEventMediator.Notify( MSatUtils::ERefreshAllowed );
+                iClientWaitingRefresh = ETrue;
+                }
+            else
+                {
+                LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::\
+                     RefreshAllowed don't allow refresh" )
+                iEventMediator.Notify( MSatUtils::ERefreshNotAllowed );
+                }
+            }
+        else
+            {
+            iSession.PanicClient( aMessage, ESatSBadDescriptor );
+            }
+        }
+
+    aMessage.Complete( KErrNone );
+
+    LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::RefreshAllowed exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSRefreshSubSession::NotifyRefresh
+// Stores the NotifyRefresh request information for later completion.
+// -----------------------------------------------------------------------------
+//
+void CSatSRefreshSubSession::NotifyRefresh( const RMessage2& aMessage )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::NotifyRefresh calling" )
+
+    if ( !iNotifyRefreshPending )
+        {
+        iNotifyRefreshPending = ETrue;
+        iNotifyRefreshMessage = aMessage;
+        }
+    else
+        {
+        LOG( SIMPLE, "SATENGINE:   Request already received" )
+        aMessage.Complete( KErrInUse );
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::NotifyRefresh exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSRefreshSubSession::CancelNotifyRefresh
+// Cancels the refresh notification
+// -----------------------------------------------------------------------------
+//
+void CSatSRefreshSubSession::CancelNotifyRefresh( const RMessage2& aMessage )
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatSRefreshSubSession::CancelNotifyRefresh calling" )
+
+    if ( iNotifyRefreshPending )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::CancelNotifyRefresh\
+        iNotifyRefreshPending true" )
+        iNotifyRefreshPending = EFalse;
+        iNotifyRefreshMessage.Complete( KErrCancel );
+        }
+
+    aMessage.Complete( KErrNone );
+
+    LOG( SIMPLE,
+        "SATENGINE: CSatSRefreshSubSession::CancelNotifyRefresh exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSRefreshSubSession::NotifyRefreshAllowed
+// Storest the refresh notification for later completion
+// -----------------------------------------------------------------------------
+//
+void CSatSRefreshSubSession::NotifyRefreshAllowed( const RMessage2& aMessage )
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatSRefreshSubSession::NotifyRefreshAllowed calling" )
+
+    if ( !iRefreshAllowPending )
+        {
+        iRefreshAllowPending = ETrue;
+        iRefreshAllowMessage = aMessage;
+        }
+    else
+        {
+        LOG( SIMPLE, "SATENGINE:   Request already received" )
+        aMessage.Complete( KErrInUse );
+        }
+
+    LOG( SIMPLE,
+        "SATENGINE: CSatSRefreshSubSession::NotifyRefreshAllowed exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSRefreshSubSession::CancelNotifyAllowRefresh
+// Cancels the refresh notification.
+// -----------------------------------------------------------------------------
+//
+void CSatSRefreshSubSession::CancelNotifyAllowRefresh(
+    const RMessage2& aMessage )
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatSRefreshSubSession::CancelNotifyAllowRefresh calling" )
+
+    if ( iRefreshAllowPending )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::\
+        CancelNotifyAllowRefresh iRefreshAllowPending true" )
+        iRefreshAllowPending = EFalse;
+        iRefreshAllowMessage.Complete( KErrCancel );
+        }
+
+    aMessage.Complete( KErrNone );
+
+    LOG( SIMPLE,
+        "SATENGINE: CSatSRefreshSubSession::CancelNotifyAllowRefresh exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSRefreshSubSession::CompleteRefresh
+// Sends the client's completion to SatServer.
+// -----------------------------------------------------------------------------
+//
+void CSatSRefreshSubSession::CompleteRefresh( const RMessage2& aMessage )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::CompleteRefresh calling" )
+
+    // Handle completion only when we are waiting for it.
+    // It is possible, that it has timed out and we got a late response.
+    if ( iClientNotifyPending )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::CompleteRefresh \
+        iClientNotifyPending true" )
+        iClientNotifyPending = EFalse;
+
+        // Stop timer, client replied.
+        if ( iNotifyTimer )
+            {
+            LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::CompleteRefresh \
+            iNotifyTimer true" )
+            iNotifyTimer->Cancel();
+            }
+
+        TBool additionEFRead( EFalse );
+        TPckg<TBool> additionEFReadPckg( additionEFRead );
+        TRAPD( err, aMessage.ReadL( 0, additionEFReadPckg ) );
+        if ( KErrNone == err )
+            {
+            //lint -e{774} additionEFRead updated through additionEFReadPckg.
+            if ( additionEFRead )
+                {
+                LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::\
+                     CompleteRefresh additionEFRead true" )
+                iEventMediator.Notify( MSatUtils::ERefreshAdditionalEFRead );
+                }
+            else
+                {
+                LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::\
+                     CompleteRefresh additionEFRead false" )
+                iEventMediator.Notify( MSatUtils::ERefreshEFRead );
+                }
+            }
+        else
+            {
+            LOG( SIMPLE, "SATENGINE:   Bad descriptor" )
+            iEventMediator.Notify( MSatUtils::ERefreshEFRead );
+            }
+        }
+
+    aMessage.Complete( KErrNone );
+
+    LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::CompleteRefresh exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSRefreshSubSession::QueryClient
+// Notifies the client that response for refresh query has to be made.
+// -----------------------------------------------------------------------------
+//
+void CSatSRefreshSubSession::QueryClient(
+    const RSat::TRefreshV2& aRefresh )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::QueryClient calling" )
+    TBool allowRefreshNow( ETrue );
+
+    if ( iRefreshAllowPending )
+        {
+        if ( VerifyObservedFiles( aRefresh ) )
+            {
+            // Write the refresh information to client.
+            TPckg<RSat::TRefreshFileList> fileListPckg( aRefresh.iFileList );
+            TPckg<RSat::TRefreshType> typePckg( aRefresh.iType );
+
+            TRAPD(
+                err,
+                iRefreshAllowMessage.WriteL( 0, fileListPckg );
+                iRefreshAllowMessage.WriteL( 1, typePckg ); )
+
+            if ( KErrNone == err )
+                {
+                LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::QueryClient \
+                KErrNone == err" )
+                iRefreshAllowPending = EFalse;
+                iRefreshAllowMessage.Complete( err );
+                iClientQueryPending = ETrue;
+                allowRefreshNow = EFalse;
+
+                // Start timer to prevent jam, when client will not reply.
+                if ( iQueryTimer )
+                    {
+                    LOG( SIMPLE, "CSatSRefreshSubSession::QueryClient \
+                         iQueryTimer true" )
+                    iQueryTimer->Cancel();
+                    }
+                else
+                    {
+                    // Create Client Query timer when first time used.
+                    TRAP(
+                        err,
+                        iQueryTimer =
+                            CPeriodic::NewL( CActive::EPriorityStandard ); )
+                    }
+
+                if ( ( KErrNone == err ) && iQueryTimer )
+                    {
+                    LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::\
+                    QueryClient start iQueryTimer" )
+                    TCallBack callback( TimerQueryCallback, this );
+                    iQueryTimer->Start(
+                        KClientQueryDelay,
+                        KClientQueryDelay,
+                        callback );
+                    }
+                }
+            else
+                {
+                LOG2( SIMPLE, "SATENGINE:   QueryClient error: %i", err )
+                }
+            }
+        }
+
+    if ( allowRefreshNow )
+        {
+        LOG( SIMPLE, "CSatSRefreshSubSession::QueryClient \
+        allowRefreshNow true" )
+        iEventMediator.Notify( MSatUtils::ERefreshAllowed );
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::QueryClient exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSRefreshSubSession::NotifyClient
+// Notifies the client that refresh has happened.
+// -----------------------------------------------------------------------------
+//
+void CSatSRefreshSubSession::NotifyClient(
+    const RSat::TRefreshV2& aRefresh )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::NotifyClient calling" )
+    TBool completeRefreshNow( ETrue );
+
+    if ( iNotifyRefreshPending && iClientWaitingRefresh )
+        {
+        TPckg<RSat::TRefreshFileList> fileListPckg( aRefresh.iFileList );
+
+        #ifdef ENABLE_SAT_LOGGING
+        TInt fileCount ( aRefresh.iFileList.Length() );
+        LOG2( NORMAL, "SATENGINE:   Refresh file count: %d", fileCount )
+        for ( TInt fileIndex = 0; fileIndex < fileCount; fileIndex++ )
+            {
+            LOG2( NORMAL, "SATENGINE:     Refresh file : %x",
+                aRefresh.iFileList[ fileIndex ] )
+            }
+        #endif
+
+        TPckg<RSat::TRefreshType> typePckg( aRefresh.iType );
+
+        TRAPD(
+            err,
+            iNotifyRefreshMessage.WriteL( 0, fileListPckg );
+            iNotifyRefreshMessage.WriteL( 1, typePckg ); )
+
+        LOG2( SIMPLE, "SATENGINE:   NotifyClient error: %i", err )
+        if ( KErrNone == err )
+            {
+            // ESimReset confirmation will not be waited.
+            if ( RSat::ESimReset != aRefresh.iType )
+                {
+                LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::NotifyClient\
+                RSat::ESimReset != aRefresh.iType" )
+                iClientNotifyPending = ETrue; // Waiting client
+                completeRefreshNow = EFalse; // Client must complete this
+
+                // Start timer to prevent jam, when client will not restart.
+                if ( iNotifyTimer )
+                    {
+                    LOG( SIMPLE, "CSatSRefreshSubSession::NotifyClient \
+                         iNotifyTimer true" )
+                    iNotifyTimer->Cancel();
+                    }
+                else
+                    {
+                    // Create Client Notify timer when first time used.
+                    TRAP(
+                        err,
+                        iNotifyTimer =
+                            CPeriodic::NewL( CActive::EPriorityStandard ); )
+                    }
+
+                if ( ( KErrNone == err ) && iNotifyTimer )
+                    {
+                    LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::\
+                    NotifyClient start iNotifyTimer" )
+                    TCallBack callback( TimerNotifyCallback, this );
+                    iNotifyTimer->Start(
+                        KClientNotifyDelay,
+                        KClientNotifyDelay,
+                        callback );
+                    }
+                }
+            }
+
+        iNotifyRefreshPending = EFalse;
+        iClientWaitingRefresh = EFalse;
+        iNotifyRefreshMessage.Complete( err );
+        }
+
+    if ( completeRefreshNow )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::NotifyClient \
+        completeRefreshNow true" )
+        iEventMediator.Notify( MSatUtils::ERefreshEFRead );
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::NotifyClient exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSRefreshSubSession::NotifyClientCancel
+// Notifies the client that refresh has been cancelled.
+// -----------------------------------------------------------------------------
+//
+void CSatSRefreshSubSession::NotifyClientCancel()
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatSRefreshSubSession::NotifyClientCancel calling" )
+
+    // Notify only clients having accepted Refresh and waiting it.
+    if ( iNotifyRefreshPending && iClientWaitingRefresh )
+        {
+        LOG( SIMPLE,
+        "SATENGINE: CSatSRefreshSubSession::NotifyClientCancel wait refresh" )
+        RSat::TRefreshFileList fileList;
+        fileList.Zero();
+        TPckg<RSat::TRefreshFileList> fileListPckg( fileList );
+        TPckg<RSat::TRefreshType> typePckg( RSat::ERefreshTypeNotSet );
+        iNotifyRefreshPending = EFalse;
+        iClientWaitingRefresh = EFalse;
+
+        TRAPD(
+            err,
+            iNotifyRefreshMessage.WriteL( 0, fileListPckg );
+            iNotifyRefreshMessage.WriteL( 1, typePckg ) );
+        
+        LOG2( SIMPLE, "SATENGINE: CSatSRefreshSubSession::NotifyClientCancel error: %i", err )
+
+        iNotifyRefreshMessage.Complete( err );
+        }
+
+    LOG( SIMPLE,
+        "SATENGINE: CSatSRefreshSubSession::NotifyClientCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSRefreshSubSession::VerifyObservedFiles
+// Checks whether current client is interested about this refresh.
+// -----------------------------------------------------------------------------
+//
+TBool CSatSRefreshSubSession::VerifyObservedFiles(
+    const RSat::TRefreshV2& aRefresh ) const
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatSRefreshSubSession::VerifyObservedFiles calling" )
+    TBool isObserved( ETrue );
+
+    // Only pure file refresh is checked.
+    if ( RSat::EFileChangeNotification == aRefresh.iType )
+        {
+        // Fetch observed files from clients message.
+        RSat::TRefreshFileList observedFiles;
+        observedFiles.Zero();
+        TPckg<RSat::TRefreshFileList> observedPckg( observedFiles );
+        TRAPD( err, iRefreshAllowMessage.ReadL( 0, observedPckg ) );
+        LOG2( SIMPLE, "SATENGINE:   ReadL failed: %i", err )
+        if ( KErrNone == err )
+            {
+            TInt observeFileCount( observedFiles.Length() );
+            LOG2( SIMPLE, "SATENGINE: CSatSRefreshSubSession::\
+                  VerifyObservedFiles observeFileCount: %i", observeFileCount )
+            if ( observeFileCount > 0 )
+                {
+                LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::\
+                VerifyObservedFiles observeFileCount > 0" )
+                // Observed files found, check whether any of them has been
+                // updated.
+                isObserved = EFalse;
+                for ( TInt fileIndex = 0;
+                      ( fileIndex < observeFileCount ) && !isObserved;
+                      fileIndex++ )
+                    {
+                    if ( KErrNotFound !=
+                         aRefresh.iFileList.Locate(
+                            observedFiles[ fileIndex ] ) )
+                        {
+                        isObserved = ETrue;
+                        LOG( SIMPLE, "SATENGINE:   Observed file found" )
+                        }
+                    }
+                }
+            }
+        }
+
+    LOG( SIMPLE,
+        "SATENGINE: CSatSRefreshSubSession::VerifyObservedFiles exiting" )
+    return isObserved;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSRefreshSubSession::TimerQueryCallback
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CSatSRefreshSubSession::TimerQueryCallback(
+    TAny* aRefreshSubSession )
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatSRefreshSubSession::TimerQueryCallback calling" )
+
+    CSatSRefreshSubSession* handler =
+        static_cast<CSatSRefreshSubSession*>( aRefreshSubSession );
+
+    if ( handler )
+        {
+        LOG( SIMPLE,
+        "SATENGINE: CSatSRefreshSubSession::TimerQueryCallback handler true" )
+        handler->QueryTimeout();
+        }
+
+    LOG( SIMPLE,
+        "SATENGINE: CSatSRefreshSubSession::TimerQueryCallback exiting" )
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSRefreshSubSession::QueryTimeout
+// Timeout handler for the client's response of refresh query.
+// -----------------------------------------------------------------------------
+//
+void CSatSRefreshSubSession::QueryTimeout()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::QueryTimeout calling" )
+
+    if ( iQueryTimer )
+        {
+        LOG( SIMPLE,
+        "SATENGINE: CSatSRefreshSubSession::QueryTimeout iQueryTimer true" )
+        iQueryTimer->Cancel();
+        }
+
+    // Handle reply timeout only when we are waiting for it.
+    if ( iClientQueryPending )
+        {
+        LOG( SIMPLE,
+        "SATENGINE: CSatSRefreshSubSession::QueryTimeout \
+        iClientQueryPending true" )
+        iClientQueryPending = EFalse;
+        iEventMediator.Notify( MSatUtils::ERefreshAllowed );
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::QueryTimeout exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSRefreshSubSession::TimerNotifyCallback
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CSatSRefreshSubSession::TimerNotifyCallback(
+    TAny* aRefreshSubSession )
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatSRefreshSubSession::TimerNotifyCallback calling" )
+
+    CSatSRefreshSubSession* handler =
+        static_cast<CSatSRefreshSubSession*>( aRefreshSubSession );
+
+    if ( handler )
+        {
+        LOG( SIMPLE,
+        "SATENGINE: CSatSRefreshSubSession::TimerNotifyCallback handler" )
+        handler->NotifyTimeout();
+        }
+
+    LOG( SIMPLE,
+        "SATENGINE: CSatSRefreshSubSession::TimerNotifyCallback exiting" )
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSRefreshSubSession::NotifyTimeout
+// Timeout handler for the client's response of refresh query.
+// -----------------------------------------------------------------------------
+//
+void CSatSRefreshSubSession::NotifyTimeout()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::NotifyTimeout calling" )
+
+    if ( iNotifyTimer )
+        {
+        LOG( SIMPLE, 
+        "SATENGINE: CSatSRefreshSubSession::NotifyTimeout iNotifyTimer true" )
+        iNotifyTimer->Cancel();
+        }
+
+    // Handle reply timeout only when we are waiting for it.
+    if ( iClientNotifyPending )
+        {
+        LOG( SIMPLE, 
+        "SATENGINE: CSatSRefreshSubSession::NotifyTimeout \
+        iClientNotifyPending" )
+        iClientNotifyPending = EFalse;
+        // On timeout we should assume no EFs read, as most typical for S60.
+        iEventMediator.Notify( MSatUtils::ERefreshEFRead );
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatSRefreshSubSession::NotifyTimeout exiting" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/CSatSScheduler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -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:  This is the active scheduler of the SAT Server.
+*
+*/
+
+
+
+//  INCLUDES
+#include    <e32svr.h>             // RDebug
+#include    "CSatSScheduler.h"
+#include    "CSatSServer.h"
+#include    "SatLog.h"
+
+// ================= MEMBER FUNCTIONS ==========================================
+
+// The class constructor.
+EXPORT_C CSatSScheduler::CSatSScheduler()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSScheduler::SetServer calling - exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSScheduler::SetServer
+// Gives a pointer of the current CSatSServer instance to the scheduler.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CSatSScheduler::SetServer( CSatSServer* aServer )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSScheduler::SetServer calling" )
+    iServer = aServer;
+    LOG( SIMPLE, "SATENGINE: CSatSScheduler::SetServer exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSScheduler::Error
+// Overridden to handle leaves in request functions and unexpected situations.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatSScheduler::Error( TInt aError ) const
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSScheduler::Error calling" )
+    LOG2( SIMPLE, "SATENGINE: CSatSScheduler::Error aError=%d", aError )
+
+    if ( iServer )
+        {
+        if ( iServer->IsActive() )
+            {
+            LOG( SIMPLE, "SATENGINE: CSatSScheduler::Error iServer active" )
+            __DEBUGGER()
+            }
+        else
+            {
+            // Relay the error code to the client and restart the server.
+            LOG( SIMPLE, "SATENGINE: CSatSScheduler::Error iServer not active" )
+            iServer->CompleteMessage( aError );
+            iServer->ReStart();
+            }        
+        }
+   
+    LOG( SIMPLE, "SATENGINE: CSatSScheduler::Error exiting" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/CSatSServer.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,255 @@
+/*
+* 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:  Manages the sessions.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CSatSServer.h"
+#include    "SatSOpcodes.h"
+#include    "CSatCommandContainer.h"
+#include    "CSatSSession.h"
+#include    "SatLog.h"
+#include    "SatServerFactory.h"
+#include    "CSatSUiClientHandler.h"
+//lint -e766 Used inside TRAP macro, lint misfunction.
+#include    "EnginePanic.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSatSServer::CSatSServer
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatSServer::CSatSServer() :
+CPolicyServer( EPriorityHigh, satServerPolicy, ESharableSessions )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSServer::CSatSServer calling-exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSServer::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSatSServer::ConstructL()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSServer::ConstructL calling" )
+
+    iObjectConIx = CObjectConIx::NewL();
+    iUiHandler = CSatSUiClientHandler::NewL( *this, iEventMediator );
+    iCmdContainer = CSatCommandContainer::NewL(
+        *this, iEventMediator, *iUiHandler );
+
+    iUiHandler->SetUtils( iCmdContainer );
+
+    const TInt err( Start( KSatServerName ) );
+    __ASSERT_ALWAYS( err == KErrNone, PanicSatEngine( ESatSStartServer ) );
+
+    LOG( SIMPLE, "SATENGINE: CSatSServer::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSServer::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatSServer* CSatSServer::NewL()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSServer::NewL calling" )
+    CSatSServer* self = new( ELeave ) CSatSServer();
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "SATENGINE: CSatSServer::NewL exiting" )
+    return self;
+    }
+
+// Destructor
+CSatSServer::~CSatSServer()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSServer::~CSatSServer calling" )
+
+    iEventMediator.Reset();
+
+    iRefreshSubSessions.Close();
+    delete iCmdContainer;
+    delete iUiHandler;
+    delete iObjectConIx;
+
+    LOG( SIMPLE, "SATENGINE: CSatSServer::~CSatSServer exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSServer::CompleteMessage
+// Completes current message from client with an error code.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatSServer::CompleteMessage(
+    TInt aError ) const// Error code, which is used to complete the message.
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSServer::CompleteMessage calling" )
+
+    Message().Complete( aError );
+
+    LOG( SIMPLE, "SATENGINE: CSatSServer::CompleteMessage exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSServer::CreateNewContainerL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+CObjectCon* CSatSServer::CreateNewContainerL()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSServer::CreateNewContainerL calling" )
+
+    CObjectCon* objCon = iObjectConIx->CreateL();
+
+    LOG( SIMPLE, "SATENGINE: CSatSServer::CreateNewContainerL exiting" )
+    return objCon;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSServer::AddL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CSatSServer::AddL( const MSatRefreshSubSession* aSubSession )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSServer::AddL calling" )
+
+    User::LeaveIfError( iRefreshSubSessions.Append( aSubSession ) );
+
+    LOG( SIMPLE, "SATENGINE: CSatSServer::AddL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSServer::Remove
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CSatSServer::Remove( const MSatRefreshSubSession* aSubSession )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSServer::Remove calling" )
+    const TInt index( iRefreshSubSessions.Find( aSubSession ) );
+
+    if ( KErrNotFound != index )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatSServer::Remove KErrNotFound != index" )
+        iRefreshSubSessions.Remove( index );
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatSServer::Remove exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSServer::NewSessionL
+// Creates new session if the clients version number matches with server
+// version number.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CSession2* CSatSServer::NewSessionL(
+    const TVersion& aVersion, // Clients version of the server
+    const RMessage2& /*aMessage*/ ) const // Message
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSServer::NewSessionL calling" )
+
+    // Check we're the right version.
+    TVersion satVersionInformation( KSatServerMajorVersionNumber,
+        KSatServerMinorVersionNumber,KSatServerBuildVersionNumber );
+
+    if ( !User::QueryVersionSupported( satVersionInformation, aVersion ) )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatSServer::NewSessionL KErrNotSupported" )
+        User::Leave( KErrNotSupported );
+        }
+
+    // Create a new session.
+    CSatSSession* session =
+        CSatSSession::NewL( const_cast<CSatSServer*>( this ),
+            const_cast<TSatEventMediator&>( iEventMediator ),
+            const_cast<MSatApi&>( iCmdContainer->USatAPI() ),
+            *iUiHandler );
+
+    LOG( SIMPLE, "SATENGINE: CSatSServer::NewSessionL exiting" )
+    return session;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSServer::UiSession
+// Getter for ui session
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+MSatUiSession* CSatSServer::UiSession()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSServer::UiSession calling" )
+    MSatUiSession* result = NULL;
+
+    //lint -e{1757} Post increment acceptable here.
+    for ( iSessionIter.SetToFirst();
+          iSessionIter.operator CSession2*() && ( !result );
+          iSessionIter++ )
+        {
+        CSatSSession* session =
+            static_cast<CSatSSession*>( iSessionIter.operator CSession2*() );
+
+        // Has session ui subsession
+        result = session->UiSubSession();
+        }
+
+    if ( NULL != result )
+        {
+        LOG( SIMPLE,
+            "SATENGINE: CSatSServer::UiSession exiting (Ui session found)" )
+        }
+    else
+        {
+        LOG( SIMPLE,
+            "SATENGINE: CSatSServer::UiSession exiting (Ui session not found)" )
+        }
+    LOG( SIMPLE, "SATENGINE: CSatSServer::UiSession exiting" )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSServer::RefreshSubSessions
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+const RPointerArray<MSatRefreshSubSession>&
+    CSatSServer::RefreshSubSessions()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSServer::RefreshSubSessions calling-exiting" )
+    return iRefreshSubSessions;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSServer::SatUtils
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+MSatUtils* CSatSServer::SatUtils()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSServer::SatUtils calling-exiting" )
+    return iCmdContainer;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/CSatSSession.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,433 @@
+/*
+* 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:  The Sat Server session manages a connection to a client and
+*                handles client requests.
+*
+*/
+
+
+#include    <fbs.h>
+#include    "MSatUtils.h"
+#include    "CSatIconHandler.h"
+#include    "CSatSSession.h"
+#include    "CSatSUiSubSession.h"
+#include    "CSatSServer.h"
+#include    "EnginePanic.h"
+#include    "SatLog.h"
+#include    "TSatEventMediator.h"
+#include    "SatSOpcodes.h"
+#include    "MSatApi.h"
+#include    "MSatUtils.h"
+#include    "CSatSRefreshSubSession.h"
+#include    "MThreadDeathNotifier.h"
+#include    "CSatSIconSubSession.h"
+
+const TUint8 KHandleParam( 3 );
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// Class constructor
+// -----------------------------------------------------------------------------
+//
+CSatSSession::CSatSSession(
+    CSatSServer* aServer,
+    TSatEventMediator& aEventMediator,
+    MSatApi& aSatApi,
+    MThreadDeathNotifier& aThreadDeathNotifier ) :
+    CSession2(),
+    iSatServer( aServer ),
+    iEventMediator( aEventMediator ),
+    iSatApi( aSatApi ),
+    iThreadDeathNotifier( aThreadDeathNotifier )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSSession::CSatSSession calling-exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Two-phased constructor
+// -----------------------------------------------------------------------------
+//
+CSatSSession* CSatSSession::NewL(
+    CSatSServer* aServer,
+    TSatEventMediator& aEventMediator,
+    MSatApi& aSatApi,
+    MThreadDeathNotifier& aThreadDeathNotifier )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSSession::NewL calling" )
+
+    // Perform construction.
+    CSatSSession* self =
+        new ( ELeave ) CSatSSession(
+            aServer,
+            aEventMediator,
+            aSatApi,
+            aThreadDeathNotifier );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "SATENGINE: CSatSSession::NewL exiting" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CSatSSession::~CSatSSession()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSSession::~CSatSSession calling" )
+
+    delete iSubSessionIx;
+    delete iSubSessionCon;
+
+    iSatServer = NULL;
+    iUiSubSession = NULL;
+
+    LOG( SIMPLE, "SATENGINE: CSatSSession::~CSatSSession exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSSession::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CSatSSession::ConstructL()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSSession::ConstructL calling" )
+
+    iSubSessionCon = iSatServer->CreateNewContainerL();
+    iSubSessionIx = CObjectIx::NewL();
+
+    LOG( SIMPLE, "SATENGINE: CSatSSession::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSSession::UiSubSession
+// -----------------------------------------------------------------------------
+//
+MSatUiSession* CSatSSession::UiSubSession()
+    {
+    LOG( DETAILED, "SATENGINE: CSatSSession::UiSubSession calling" )
+
+    MSatUiSession* session = iUiSubSession;
+
+    LOG( DETAILED, "SATENGINE: CSatSSession::UiSubSession exiting" )
+    return session;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSSession::CloseSubSession
+// -----------------------------------------------------------------------------
+TBool CSatSSession::CloseSubSession( const RMessage2& aMessage )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSSession::CloseSubSession calling" )
+
+    // If subssession exists, return TRUE. Otherwise, return FALSE
+    TInt result = ETrue;
+    // Read the handle from client.
+    const TInt handle( aMessage.Int3() );
+
+    // Check that subsession exists before deleting the subsession
+    if ( iSubSessionIx->At( handle ) )
+        {
+        LOG(
+        SIMPLE, "SATENGINE: CSatSSession::CloseSubSession subsession exists" )
+        // Delete the sub-session.
+        iSubSessionIx->Remove( handle );
+        }
+    else
+        {
+        LOG( SIMPLE, 
+        "SATENGINE: CSatSSession::CloseSubSession subsession doesn't exist" )
+        // Sub-session handle was not valid.
+        PanicClient( aMessage, ESatSBadDescriptor );
+        result = EFalse;
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatSSession::CloseSubSession exiting" )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSSession::GetSubSessionFromHandle
+// Returns the subsession which handle is aHandle.
+// -----------------------------------------------------------------------------
+CSatSSubSession* CSatSSession::GetSubSessionFromHandle( TInt aHandle ) const
+    {
+    LOG( DETAILED, "SATENGINE: CSatSSession::GetSubSessionFromHandle calling" )
+
+    CSatSSubSession* session =
+        static_cast<CSatSSubSession*>( iSubSessionIx->At( aHandle ) );
+
+    LOG( DETAILED, "SATENGINE: CSatSSession::GetSubSessionFromHandle exiting" )
+    return session;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSSession::AddSubSessionL
+// -----------------------------------------------------------------------------
+void CSatSSession::AddSubSessionL(
+    CSatSSubSession* aSubSession,
+    const RMessage2& aMessage )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSSession::AddSubSessionL calling" )
+
+    __ASSERT_ALWAYS( aSubSession, PanicSatEngine( ESatEngineNullPointer ) );
+
+    CleanupStack::PushL( aSubSession );
+    iSubSessionCon->AddL( aSubSession );
+    const TInt handle( iSubSessionIx->AddL( aSubSession ) );
+    CleanupStack::Pop( aSubSession );
+
+    // Send the handle to client.
+    TPckg<TInt> handlePckg( handle );
+    TRAPD( err, aMessage.WriteL( KHandleParam, handlePckg ) );
+
+    if ( KErrNone != err )
+        {
+        // Remove the handle, will also cause destruction
+        // of session.
+        iSubSessionIx->Remove( handle );
+        LOG2( SIMPLE, 
+        "SATENGINE: CSatSSession::AddSubSessionL panic: %i", err )
+        PanicClient( aMessage, ESatSBadDescriptor );
+        User::Leave( err ); 
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatSSession::AddSubSessionL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSSession::ServiceL
+// Dispatches the commands to their appropriate handlers. For asynchronous
+// messages, the message object is save for future processing.
+// -----------------------------------------------------------------------------
+//
+void CSatSSession::ServiceL( const RMessage2& aMessage )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSSession::ServiceL calling" )
+
+    if ( !aMessage.HasCapability( ECapabilityReadDeviceData ) )
+        {
+        // Legal client should at least have ReadDeviceData capability
+        LOG( SIMPLE, "SATENGINE: CSatSSession::ServiceL client \
+        has no ReadDeviceData capability. Panic it" )
+        PanicClient( aMessage, ESatSBadDescriptor );
+        }
+    else
+        {
+        // Client has enough capability
+        
+        LOG2( NORMAL, "SATENGINE: CSatSSession::ServiceL \
+              aMessage.Function is %d", aMessage.Function() )
+
+        switch ( aMessage.Function() )
+            {
+            //  Ui Sub-session indicator.
+            case ESatSOpenUiSubSession:
+                {
+                LOG( SIMPLE, 
+                "SATENGINE: CSatSSession::ServiceL ESatSOpenUiSubSession" )
+                CSatSUiSubSession* subsession = CSatSUiSubSession::NewL(
+                    *this,
+                    iSatApi,
+                    iEventMediator );
+
+                TRAPD( err, AddSubSessionL( subsession, aMessage ) );
+                if ( KErrNone == err )
+                    {
+                    // Store the ui clients thread handle.
+                    RThread uiClientThread;
+                    User::LeaveIfError( aMessage.Client( uiClientThread ) );
+
+                    iUiSubSession = subsession;
+
+                    // Start observing threads state
+                    TThreadId threadId = uiClientThread.Id();
+                    iThreadDeathNotifier.SetObserveredThread( threadId );
+                    iThreadDeathNotifier.StartObservingThread();
+                    uiClientThread.Close();
+
+                    // Complete message before notifying SAT Server since notifying may
+                    // be very time consuming operation dependening on the situation
+                    aMessage.Complete( KErrNone );
+
+                    // Event has to be send after the iUiSubSession has been set.
+                    // Otherwise NULL pointer error in commandhandlers.
+                    iEventMediator.Notify( MSatUtils::ESatUiLaunched );
+                    }
+                break;
+                }
+
+            case ESatSOpenRefreshSubSession:
+                {
+                LOG( SIMPLE, 
+                "SATENGINE: CSatSSession::ServiceL ESatSOpenRefreshSubSession" )
+                CSatSRefreshSubSession* subsession = CSatSRefreshSubSession::NewL(
+                    *this,
+                    iEventMediator );
+                
+                TRAPD( err, AddSubSessionL( subsession, aMessage ) );
+                if ( KErrNone == err )
+                    {
+                    aMessage.Complete( KErrNone );
+                    }
+                break;
+                }
+
+            case ESatSOpenIconSubSession:
+                {
+                LOG( SIMPLE, 
+                "SATENGINE: CSatSSession::ServiceL ESatSOpenIconSubSession" )
+                CSatSIconSubSession* subsession = CSatSIconSubSession::NewL(
+                    *this,
+                    iEventMediator );
+
+                TRAPD( err, AddSubSessionL( subsession, aMessage ) );
+                if ( KErrNone == err )
+                    {
+                    aMessage.Complete( KErrNone );
+                    }
+                break;
+                }
+
+            case ESatSCloseUiSubSession:
+                {
+                LOG( SIMPLE, 
+                "SATENGINE: CSatSSession::ServiceL ESatSCloseUiSubSession" )
+                iEventMediator.Notify( MSatUtils::ESatUiClosed );
+                iSatUiSubSessionClosed = ETrue;
+                iUiSubSession = NULL;
+                if ( CloseSubSession( aMessage ) )
+                    {
+                    aMessage.Complete( KErrNone );
+                    }
+                break;
+                }
+
+            case ESatSCloseRefreshSubSession:
+                {
+                LOG( SIMPLE, 
+                "SATENGINE: CSatSSession::ServiceL ESatSCloseRefreshSubSession" )
+                if ( CloseSubSession( aMessage ) )
+                    {
+                    aMessage.Complete( KErrNone );
+                    }
+                break;
+                }
+
+            case ESatSCloseIconSubSession:
+                {
+                LOG( SIMPLE, 
+                "SATENGINE: CSatSSession::ServiceL ESatSCloseIconSubSession" )
+                if ( CloseSubSession( aMessage ) )
+                    {
+                    aMessage.Complete( KErrNone );
+                    }
+                break;
+                }
+
+            default:
+                {
+                LOG( SIMPLE, "SATENGINE: CSatSSession::ServiceL others" )
+                CSatSSubSession* subsession =
+                    GetSubSessionFromHandle( aMessage.Int3() );
+
+                if ( NULL != subsession )
+                    {
+                    LOG( SIMPLE, 
+                    "SATENGINE: CSatSSession::ServiceL NULL != subsession" )
+                    subsession->HandleCommandL( aMessage );
+                    }
+                else
+                    {
+                    PanicClient( aMessage, ESatSBadDescriptor );
+                    }
+                }
+            }
+        }
+        LOG( SIMPLE, "SATENGINE: CSatSSession::ServiceL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSSession::PanicClient
+// Panics the client.
+// -----------------------------------------------------------------------------
+//
+void CSatSSession::PanicClient( const RMessage2& aMessage, TInt aPanic ) const
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSSession::PanicClient calling" )
+
+    _LIT( KTxtServer, "SatS server" );
+    aMessage.Panic( KTxtServer, aPanic );
+
+    LOG( SIMPLE, "SATENGINE: CSatSSession::PanicClient exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSSession::NotifyThreadDeathMonitor
+// Notifies ThreadDeathMonitor for thread is dying
+// -----------------------------------------------------------------------------
+//
+void CSatSSession::NotifyThreadDeathMonitor()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSSession::NotifyThreadDeathMonitor calling" )
+
+    iThreadDeathNotifier.NotifyThreadDeath();
+
+    LOG( SIMPLE, "SATENGINE: CSatSSession::NotifyThreadDeathMonitor exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSSession::SatServer
+// Returns pointer to SatServer - class
+// -----------------------------------------------------------------------------
+//
+CSatSServer* CSatSSession::SatServer()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSSession::SatServer calling-exiting" )
+    return iSatServer;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSSession::UiSessionClosed
+// Notifies SatEngine that UI session has closed
+// -----------------------------------------------------------------------------
+//
+void CSatSSession::UiSessionClosed()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSSession::UiSessionClosed calling" )
+
+    if ( !iSatUiSubSessionClosed )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatSSession::UiSessionClosed close satui" )
+        iEventMediator.Notify( MSatUtils::ESatUiClosed );
+        iSatUiSubSessionClosed = ETrue;
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatSSession::UiSessionClosed exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSSession::CreateIconHandlerL
+// Creates and returns CSatIconHandler
+// -----------------------------------------------------------------------------
+//
+MSatSIconAPI* CSatSSession::CreateIconHandlerL()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSSession::CreateIconHandlerL calling-exiting" )
+    return new( ELeave ) CSatIconHandler( iSatApi );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/CSatSSimSubscriberId.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,268 @@
+/*
+* Copyright (c) 2004-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This is the handler for the SIM Application Toolkit to detect
+*                the SIM card subscriber ID.
+*
+*/
+
+
+#include    <e32base.h>
+#include    <e32svr.h>
+#include    "msatmultimodeapi.h"
+#include    "MSatUtils.h"
+#include    "CSatSSimSubscriberId.h"
+#include    "TSatEventMediator.h"
+#include    "csatsactivewrapper.h"
+#include    "SatLog.h"
+
+// MCC and MNC values can be found from numbering plans
+const TInt KMinImsiLength( 5 );         // MNC + MNC consists of five numbers
+const TInt KTimeBeforeRetry( 500000 );  // 0.5 seconds.
+const TInt KMaxRetry( 20 );
+
+// Special IMSI
+_LIT( KCmccImsiIdentity1, "46000" );
+_LIT( KCmccImsiIdentity2, "46002" );
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// CSatSSimSubscriberId::CSatSSimSubscriberId
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatSSimSubscriberId::CSatSSimSubscriberId(
+    MSatMultiModeApi& aPhone,
+    TSatEventMediator& aEventMediator ) :
+    CActive( EPriorityStandard ),
+    iPhone( aPhone ),
+    iEventMediator( aEventMediator ),
+    iSubscriberIdValid( EFalse ),
+    iRetryCounter( 0 )
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatSSimSubscriberId::CSatSSimSubscriberId calling" )
+
+    // Add to active scheduler.
+    CActiveScheduler::Add( this );
+
+    LOG( SIMPLE,
+        "SATENGINE: CSatSSimSubscriberId::CSatSSimSubscriberId exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSSimSubscriberId::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSatSSimSubscriberId::ConstructL()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSSimSubscriberId::ConstructL calling" )
+
+    // Used to suspends the current thread until a 0.5 seconds
+    // interval has expired.
+    iWrapper = new ( ELeave ) CSatSActiveWrapper();
+
+    LOG( SIMPLE, "SATENGINE: CSatSSimSubscriberId::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSSimSubscriberId::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatSSimSubscriberId* CSatSSimSubscriberId::NewL(
+    MSatMultiModeApi& aPhone,
+    TSatEventMediator& aEventMediator )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSSimSubscriberId::NewL calling" )
+
+    // Perform construction.
+    CSatSSimSubscriberId* self = new ( ELeave ) CSatSSimSubscriberId(
+        aPhone,
+        aEventMediator );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "SATENGINE: CSatSSimSubscriberId::NewL exiting" )
+    return self;
+    }
+
+
+// Destructor
+CSatSSimSubscriberId::~CSatSSimSubscriberId()
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatSSimSubscriberId::~CSatSSimSubscriberId calling" )
+
+    if ( iWrapper )
+        {
+        iWrapper->CancelWrapper();
+        delete iWrapper;
+        iWrapper = NULL;
+        }
+
+    // Cancel any outstanding requests.
+    Cancel();
+
+    LOG( SIMPLE,
+        "SATENGINE: CSatSSimSubscriberId::~CSatSSimSubscriberId exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSSimSubscriberId::Start
+// Starts the handler initially.
+// -----------------------------------------------------------------------------
+//
+void CSatSSimSubscriberId::Start()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSSimSubscriberId::Start calling" )
+
+    iRetryCounter = KMaxRetry;
+    DoStart();
+
+    LOG( SIMPLE, "SATENGINE: CSatSSimSubscriberId::Start exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSSimSubscriberId::DoStart
+// Starts the handler.
+// -----------------------------------------------------------------------------
+//
+void CSatSSimSubscriberId::DoStart()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSSimSubscriberId::DoStart calling" )
+
+    if ( !IsActive() )
+        {
+        iSubscriberIdValid = EFalse;
+        iPhone.GetSubscriberId( iStatus, iSubscriberId );
+        LOG( SIMPLE, "SATENGINE:   GetSubscriberId called" )
+        SetActive();
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatSSimSubscriberId::DoStart exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSSimSubscriberId::RunL
+// Handles the command.
+// -----------------------------------------------------------------------------
+//
+void CSatSSimSubscriberId::RunL()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSSimSubscriberId::RunL calling" )
+
+    // Check the status of the asnychronous operation.
+    TInt status( iStatus.Int() );
+    if ( KErrNone == status )
+        {
+        // Indicate id successfully read.
+        iSubscriberIdValid = ETrue;
+
+        // Handle special SIM.
+        if ( IsCmccSIM() )
+            {
+            LOG( SIMPLE, "SATENGINE: CSatSSimSubscriberId::RunL Cmcc SIM" )
+            // Activate SetUpMenuHandler for special SIM.
+            iEventMediator.Notify( MSatUtils::ECmccSimDetected );
+            }
+        }
+    else if ( ( KErrServerBusy == status ) ||
+              ( KErrNotFound == status ) )
+        {
+        LOG2( SIMPLE,
+            "SATENGINE: CSatSSimSubscriberId::RunL Server busy (%d)", status )
+
+        if ( iRetryCounter > 0 )
+            {
+            LOG( SIMPLE, "SATENGINE: CSatSSimSubscriberId::RunL \
+            iRetryCounter > 0" )
+            iRetryCounter--;
+
+            // Restart subscriber ID reading after short period of time.
+            if ( iWrapper )
+                {
+                LOG( SIMPLE, "SATENGINE: CSatSSimSubscriberId::RunL \
+                iWrapper true" )
+                iWrapper->After( KTimeBeforeRetry );
+                }
+
+            DoStart();
+            }
+        }
+    else
+        {
+        LOG2( SIMPLE,
+            "SATENGINE: CSatSSimSubscriberId::RunL error: %d", status )
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatSSimSubscriberId::RunL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSSimSubscriberId::DoCancel
+// Cancels the pending request.
+// -----------------------------------------------------------------------------
+//
+void CSatSSimSubscriberId::DoCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSSimSubscriberId::DoCancel calling" )
+
+    // Cancel an outstanding request.
+    iPhone.CancelAsyncRequest( EMobilePhoneGetSubscriberId );
+
+    LOG( SIMPLE, "SATENGINE: CSatSSimSubscriberId::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSSimSubscriberId::IsCmccSIM
+// Check if the used SIM card is special SIM
+// -----------------------------------------------------------------------------
+//
+TBool CSatSSimSubscriberId::IsCmccSIM() const
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSSimSubscriberId::IsCmccSIM calling" )
+    TBool isCmcc( EFalse );
+
+    // Check validity.
+    if ( iSubscriberIdValid )
+        {
+        if ( iSubscriberId.Length() >= KMinImsiLength )
+            {
+            LOG( SIMPLE, "SATENGINE: \
+            CSatSSimSubscriberId::IsCmccSIM length valid" )
+            isCmcc = (
+                ( iSubscriberId.Left( KMinImsiLength ).
+                    Compare( KCmccImsiIdentity1 ) == KErrNone ) ||
+                ( iSubscriberId.Left( KMinImsiLength ).
+                    Compare( KCmccImsiIdentity2 ) == KErrNone ) );
+            }
+        }
+
+    else
+        {
+        LOG( SIMPLE, "SATENGINE: CSatSSimSubscriberId::IsCmccSIM Not valid" )
+        }
+
+    LOG2(
+        SIMPLE,
+        "SATENGINE: CSatSSimSubscriberId::IsCmccSIM exiting: %i",
+        isCmcc )
+
+    return isCmcc;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/CSatSSubSession.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* 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:  Base class for sub-sessions.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CSatSSubSession.h"
+#include    "CSatSServer.h"
+#include    "CSatSSession.h"
+#include    "SatLog.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSatSSubSession::CSatSSubSession
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatSSubSession::CSatSSubSession( CSatSSession& aSession ) :
+    CObject(),
+    iSession( aSession )
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatSSubSession::CSatSSubSession calling-exiting" )
+    }
+
+// Destructor
+CSatSSubSession::~CSatSSubSession()
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatSSubSession::~CSatSSubSession calling-exiting" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/CSatSUiClientHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,364 @@
+/*
+* 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 some UI Client activity
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CSatSUiClientHandler.h"
+//lint -e766 Used inside TRAP macro, lint misfunction.
+#include    "EnginePanic.h"
+#include    "MSatSSessions.h"
+#include    "MSatShellController.h"
+#include    "CSatThreadDeathMonitor.h"
+#include    "SatLog.h"
+#include    "MSatUtils.h"
+#include    "TSatEventMediator.h"
+
+// CONSTANTS
+_LIT( KShellControllerDll, "SatShellCntrl.dll" ); // ShellController dll
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSatSUiClientHandler::CSatSUiClientHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatSUiClientHandler::CSatSUiClientHandler(
+    MSatSSessions& aSessions,
+    TSatEventMediator& aEventMediator ) :
+    iSessions( aSessions ),
+    iEventMediator( aEventMediator ),
+    iUiLaunchedByUser( EFalse ),
+    iSatUiClosing( EFalse ),
+    iLaunchSatUiAfterClose( EFalse ),
+    iSatUiPanicked( EFalse )
+    {
+    LOG( SIMPLE, "SATENGINE: \
+        CSatSUiClientHandler::CSatSUiClientHandler calling - exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSUiClientHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSatSUiClientHandler::ConstructL()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSUiClientHandler::ConstructL calling" )
+
+    // Create thread death monitor
+    iThreadDeathMonitor = CSatThreadDeathMonitor::NewL();
+
+    iEventMediator.RegisterL( this, MSatUtils::ESatUiLaunched );
+    iEventMediator.RegisterL( this, MSatUtils::EBringSatUiToForeGround );
+
+    // Load SatShellController
+    // Create the UI handler instance
+    User::LeaveIfError( iSatShellCntrlLibrary.Load( KShellControllerDll ) );
+
+    // creating the class...
+    TLibraryFunction uiControllerFactory = iSatShellCntrlLibrary.Lookup( 1 );
+
+    iSatShellCntrl =
+        reinterpret_cast<MSatShellController*>( uiControllerFactory() );
+
+    LOG( SIMPLE, "SATENGINE: CSatSUiClientHandler::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSUiClientHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatSUiClientHandler* CSatSUiClientHandler::NewL(
+    MSatSSessions& aSessions,
+    TSatEventMediator& aEventMediator )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSUiClientHandler::NewL calling" )
+
+    CSatSUiClientHandler* self =
+        new( ELeave ) CSatSUiClientHandler( aSessions, aEventMediator );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "SATENGINE: CSatSUiClientHandler::NewL exiting" )
+    return self;
+    }
+
+
+// Destructor
+CSatSUiClientHandler::~CSatSUiClientHandler()
+    {
+    LOG( SIMPLE,
+         "SATENGINE: CSatSUiClientHandler::~CSatSUiClientHandler calling" )
+
+    iUtils = NULL;
+    delete iSatShellCntrl;
+    delete iThreadDeathMonitor;
+    iSatShellCntrlLibrary.Close();
+
+    LOG( SIMPLE,
+         "SATENGINE: CSatSUiClientHandler::~CSatSUiClientHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSUiClientHandler::SetUtils
+// Sets Sat Utils interface
+// -----------------------------------------------------------------------------
+//
+void CSatSUiClientHandler::SetUtils( MSatUtils* aUtils )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSUiClientHandler::SetUtils calling" )
+
+    iUtils = aUtils;
+
+    LOG( SIMPLE, "SATENGINE: CSatSUiClientHandler::SetUtils exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSUiClientHandler::ThreadDiedL
+// Notification from Thread death monitor
+// -----------------------------------------------------------------------------
+//
+void CSatSUiClientHandler::ThreadDiedL()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSUiClientHandler::ThreadDiedL calling" )
+
+    // Sat UI Thread has died.
+    iSatUiClosing = EFalse;
+    iUiLaunchedByUser = EFalse;
+
+    // Check is there LaunchUi request active.
+    if ( iLaunchSatUiAfterClose )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatSUiClientHandler::ThreadDiedL \
+        iLaunchSatUiAfterClose true" )
+        iLaunchSatUiAfterClose = EFalse;
+        LaunchSatUiL();
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatSUiClientHandler::ThreadDiedL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSUiClientHandler::ThreadPanicedL
+// Notification from Thread death monitor
+// -----------------------------------------------------------------------------
+//
+void CSatSUiClientHandler::ThreadPanicedL()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSUiClientHandler::ThreadDiedL calling" )
+
+    iSatUiPanicked = ETrue;
+    ThreadDiedL();
+
+    LOG( SIMPLE, "SATENGINE: CSatSUiClientHandler::ThreadDiedL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSUiClientHandler::Event
+// Event notified
+// -----------------------------------------------------------------------------
+//
+void CSatSUiClientHandler::Event( TInt aEvent )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSUiClientHandler::Event calling" )
+
+    //lint -e{961} Other events do not need to be handled here
+    if ( MSatUtils::ESatUiLaunched == aEvent )
+        {
+        iSatUiPanicked = EFalse;
+        // Ui is not launced by user, if there are executing commands when
+        // ui launch event has arrived.
+        const TInt activeCommands( iUtils->NumberOfExecutingCommandHandlers() );
+        LOG2( SIMPLE, "SATENGINE: CSatSUiClientHandler::Event \
+              activeCommands: %i", activeCommands )
+        if ( activeCommands > 0 )
+            {
+            iUiLaunchedByUser = EFalse;
+            // Bring to foreground. This will complete the SAT UI cosntruction.
+            ShellController().BringSatUiToForeground();
+            }
+        else
+            {
+            iUiLaunchedByUser = ETrue;
+            }
+        }
+    else if ( MSatUtils::EBringSatUiToForeGround == aEvent )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatSUiClientHandler::Event bring SAT UI \
+             to foreground" )
+        // If UI is not launched by user, bring SAT UI to foreground when 
+        // needed.
+        if ( !iUiLaunchedByUser )
+            {
+            LOG( SIMPLE, "SATENGINE: CSatSUiClientHandler::Event \
+            iUiLaunchedByUser false" )
+            ShellController().BringSatUiToForeground();
+            }
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatSUiClientHandler::Event exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSUiClientHandler::NotifyThreadDeath
+// Notifies Thread death monitor
+// -----------------------------------------------------------------------------
+//
+void CSatSUiClientHandler::NotifyThreadDeath()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSUiClientHandler::NotifyThreadDeath calling" )
+
+    iSatUiClosing = ETrue;
+    iUiLaunchedByUser = EFalse;
+
+    LOG( SIMPLE, "SATENGINE: CSatSUiClientHandler::NotifyThreadDeath exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSUiClientHandler::StartObservingThread
+// Notifies Thread death monitor
+// -----------------------------------------------------------------------------
+//
+void CSatSUiClientHandler::StartObservingThread()
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatSUiClientHandler::StartObservingThread calling" )
+
+    TInt err( KErrNone );
+    TRAP( err, iThreadDeathMonitor->NotifyThreadDeathL( iThread, *this ) );
+    if ( KErrNone != err )
+        {
+        LOG2( NORMAL, "SATENGINE: \
+            CSatSUiClientHandler::NotifyThreadDeath error: %i", err )
+        iThreadDeathMonitor->Cancel();
+        }
+
+    LOG( SIMPLE,
+        "SATENGINE: CSatSUiClientHandler::StartObservingThread exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSUiClientHandler::SetObserveredThread
+// Notifies Thread death monitor
+// -----------------------------------------------------------------------------
+//
+void CSatSUiClientHandler::SetObserveredThread( TThreadId& aThreadId )
+    {
+    LOG( SIMPLE,
+         "SATENGINE: CSatSUiClientHandler::SetObserveredThread calling" )
+
+    iThread = aThreadId;
+
+    LOG( SIMPLE,
+         "SATENGINE: CSatSUiClientHandler::SetObserveredThread exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSUiClientHandler::UiSession
+// Returns UI session
+// -----------------------------------------------------------------------------
+//
+MSatUiSession* CSatSUiClientHandler::UiSession()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSUiClientHandler::UiSession calling" )
+
+    MSatUiSession* session = NULL;
+
+    // If SAT UI is closing, return null, even if session is not null
+    if ( !iSatUiClosing && !iSatUiPanicked )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatSUiClientHandler::UiSession session \
+        not null" )
+        session = iSessions.UiSession();
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatSUiClientHandler::UiSession exiting" )
+    return session;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSUiClientHandler::LaunchSatUiL
+// Launches Sat UI
+// -----------------------------------------------------------------------------
+//
+void CSatSUiClientHandler::LaunchSatUiL()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSUiClientHandler::LaunchSatUiL calling" )
+
+    // If ui client application is closing, we have to wait for the
+    // closing and launch ui client after it.
+    if ( iSatUiClosing )
+        {
+        LOG( NORMAL, "SATENGINE: CSatSUiClientHandler::LaunchSatUiL \
+             UI IS CLOSING DOWN -> WAIT UI THREAD DEATH" )
+        iLaunchSatUiAfterClose = ETrue;
+        }
+    else
+        {
+        LOG( NORMAL, "SATENGINE: CSatSUiClientHandler::LaunchSatUiL \
+             LAUNCHING SAT UI" )
+        ShellController().LaunchSatUiL();
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatSUiClientHandler::LaunchSatUiL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSUiClientHandler::UiLaunchedByUser
+// Is UI Launched by user
+// -----------------------------------------------------------------------------
+//
+TBool CSatSUiClientHandler::UiLaunchedByUser()
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatSUiClientHandler::UiLaunchedByUser calling - exiting" )
+    return iUiLaunchedByUser;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSUiClientHandler::ShellController
+// Returns SatShellController from UI side
+// -----------------------------------------------------------------------------
+//
+MSatShellController& CSatSUiClientHandler::ShellController()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSUiClientHandler::ShellController calling" )
+
+    __ASSERT_ALWAYS( iSatShellCntrl, PanicSatEngine( ESatEngineNullPointer ) );
+
+    LOG( SIMPLE, "SATENGINE: CSatSUiClientHandler::ShellController exiting" )
+    return *iSatShellCntrl;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSUiClientHandler::ShellController
+// Returns SatShellController from UI side
+// -----------------------------------------------------------------------------
+//
+TBool CSatSUiClientHandler::IsUiClosing() const
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSUiClientHandler::IsUiClosing call - exit" )
+    return iSatUiClosing;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/CSatSUiSubSession.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,563 @@
+/*
+* 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:  Ui sub session.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32property.h>
+#include    <satdomainpskeys.h>
+
+#include    "CSatSUiSubSession.h"
+#include    "CSatSSession.h"
+#include    "CSatSServer.h"
+#include    "CSatCommandHandler.h"
+#include    "CSatCommandContainer.h"
+#include    "MSatApi.h"
+#include    "EnginePanic.h"
+#include    "SatLog.h"
+#include    "SATInternalPSKeys.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSatSUiSubSession::CSatSUiSubSession
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+//lint -e{1403, 1769} Can not be initialized, harmless.
+CSatSUiSubSession::CSatSUiSubSession(
+    CSatSSession& aSession,
+    MSatApi& aSatApi,
+    TSatEventMediator& aEventMediator ) // Session
+    :
+    CSatSSubSession( aSession ),
+    iEventData(),
+    iEventDataPckg( iEventData ),
+    iSatApi( aSatApi ),
+    iEventMediator( aEventMediator )
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatSUiSubSession::CSatSUiSubSession calling - exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSUiSubSession::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSatSUiSubSession::ConstructL()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSUiSubSession::ConstructL calling" )
+
+    iEventMediator.RegisterL( this, MSatUtils::ESmsSent );
+
+    // Get registered service requests from MSatUtils.
+    iServiceRequest = iSession.SatServer()->SatUtils()->ServiceRequests();
+
+    LOG( SIMPLE, "SATENGINE: CSatSUiSubSession::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSUiSubSession::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatSUiSubSession* CSatSUiSubSession::NewL(
+    CSatSSession& aSession,
+    MSatApi& aSatApi,
+    TSatEventMediator& aEventMediator )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSUiSubSession::NewL calling" )
+
+    CSatSUiSubSession* self =
+        new( ELeave ) CSatSUiSubSession( aSession, aSatApi, aEventMediator );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "SATENGINE: CSatSUiSubSession::NewL exiting" )
+    return self;
+    }
+
+// Destructor
+CSatSUiSubSession::~CSatSUiSubSession()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSUiSubSession::~CSatSUiSubSession calling" )
+
+    iServiceRequest = NULL;
+
+    // Unregister to listen events
+    iEventMediator.Unregister( this );
+
+    // Inform session that UI Session is closed.
+    // Session tells to container of iServiceRequest to reset
+    // request handlers.
+    iSession.UiSessionClosed();
+
+    LOG( SIMPLE, "SATENGINE: CSatSUiSubSession::~CSatSUiSubSession exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSUiSubSession::HandleCommandL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatSUiSubSession::HandleCommandL(
+    const RMessage2& aMessage ) // Message from ui client.
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSUiSubSession::HandleCommandL calling" )
+    LOG2( SIMPLE, "SATENGINE: CSatSUiSubSession::HandleCommandL \
+          command: %i", aMessage.Function() )
+    switch ( aMessage.Function() )
+        {
+        // Ui client is ready to handle setupmenu command.
+        case ESatSProactiveSetUpMenu:
+            {
+            // Notifies that SetUpMenu command has been made because SAT Client
+            // side application is returning to the main menu after SelectItem.
+            // For example: Next action is LaunchBrowser command and after
+            // Browser is launched then SAT Client side application has been
+            // opened top of Browser. In some cases SAT client side application
+            // stays topmost.
+            iEventMediator.Notify( MSatUtils::ESetUpMenuRequested );
+            // This service request is handled also like commands listed below.
+            }
+            //lint -fallthrough intended here
+        case ESatSProactiveDisplayText:
+        case ESatSProactiveGetInkey:
+        case ESatSProactiveGetInput:
+        case ESatSProactiveSelectItem:
+        case ESatSProactivePlayTone:
+        case ESatSProactiveRefresh:
+        case ESatSProactiveDisplayTextResponse:
+        case ESatSProactiveGetInkeyResponse:
+        case ESatSProactiveGetInputResponse:
+        case ESatSProactiveSelectItemResponse:
+        case ESatSProactivePlayToneResponse:
+        case ESatSProactiveQuery:
+        case ESatSProactiveQueryResponse:
+        case ESatSProactiveNotification:
+        case ESatSProactiveNotificationResponse:
+            {
+            const TInt count( iServiceRequest->Count() );
+            TBool requestHandled( EFalse );
+            TInt index( 0 );
+            // Loop until request is handled or no request handler found.
+            while ( !requestHandled && index < count )
+                {
+                requestHandled = iServiceRequest->At( index )->
+                    HandleRequest( aMessage );
+                index++;
+                }
+            LOG2( SIMPLE, "SATENGINE: CSatSUiSubSession::HandleCommandL \
+                  index: %i", index )
+            break;
+            }
+
+        // Menu selection envelope.
+        case ESatSActiveMenuSelection:
+            {
+            LOG( SIMPLE, "SATENGINE: CSatSUiSubSession: MenuSelection" )
+            // Declare the IPC data structures.
+            RSat::TMenuSelectionV1 menuSelection;
+            RSat::TMenuSelectionV1Pckg menuSelectionPckg( menuSelection );
+
+            // Perform the IPC transfer of response data.
+            TRAPD( res, aMessage.ReadL( 0, menuSelectionPckg ) );
+
+            // Send the response further only if IPC succeeded.
+            if ( KErrNone != res )
+                {
+                LOG( SIMPLE, "SATENGINE: CSatSUiSubSession: KErrNone != res" )
+                iSession.PanicClient( aMessage, ESatSBadDescriptor );
+                }
+            iSatApi.SendMenuSelection( menuSelectionPckg );
+
+            // Complete the client request.
+            aMessage.Complete( KErrNone );
+            LOG( SIMPLE,
+                "SATENGINE: CSatSUiSubSession::HandleCommandL exiting" )
+            return;
+            }
+
+        case ESatSProactiveEvent:
+            {
+            LOG( SIMPLE, "SATENGINE: CSatSUiSubSession: Event" )
+            iEventRequest = aMessage;
+            iEventRequestAvailable = ETrue;
+            if ( iCloseUiRequested )
+                {
+                LOG( SIMPLE,
+                    "SATENGINE: CSatSUiSubSession::HandleCommandL closeui" )
+                CloseUiSession();
+                }
+            else if ( iSmsSent )
+                {
+                LOG( SIMPLE,
+                    "SATENGINE: CSatSUiSubSession::HandleCommandL smssent" )
+                SendSmsSentEventToClient();
+                }
+            else if ( iClearScreenRequested )
+                {
+                LOG( SIMPLE, "SATENGINE: CSatSUiSubSession::HandleCommandL \
+                     clearscreen" )
+                ClearScreen();
+                }
+            else if ( iUiEventRequested )
+                {
+                LOG( SIMPLE, "SATENGINE: CSatSUiSubSession::HandleCommandL \
+                     UiEventRequested" )
+                HandleUiEventNotification();
+                }
+            else
+                {
+                LOG( SIMPLE, "SATENGINE:   Event request available" )
+                }
+
+            break;
+            }
+
+        case ESatSProactiveEventResponse:
+            {
+            LOG( SIMPLE, "SATENGINE: CSatSUiSubSession: EventResponse" )
+            // Declare the IPC data structures.
+            TSatEventV1 eventRsp;
+            //lint -e{603} eventRsp read through eventRspPckg in ReadL.
+            TSatEventV1Pckg eventRspPckg( eventRsp );
+
+            // Perform the IPC transfer of response data.
+            TRAPD( res, aMessage.ReadL( 0, eventRspPckg ) );
+            if ( KErrNone != res )
+                {
+                LOG( SIMPLE, "SATENGINE: CSatSUiSubSession::HandleCommandL \
+                     read response data error" )
+                iSession.PanicClient( aMessage, ESatSBadDescriptor );
+                }
+            else
+                {
+                LOG( SIMPLE, "SATENGINE: CSatSUiSubSession::HandleCommandL \
+                     no error" )
+                aMessage.Complete( KErrNone );
+                }
+            break;
+            }
+
+        case ESatSSessionTerminated:
+            {
+            LOG( SIMPLE, "SATENGINE: CSatSUiSubSession: SessionTerminated" )
+            TSatTermination temp;
+            //lint -e{603} temp read through tempPckg in ReadL.
+            TSatTerminationPckg tempPckg ( temp );
+            TRAPD( res, aMessage.ReadL( 0, tempPckg ) );
+            if ( KErrNone != res )
+                {
+                LOG( SIMPLE, "SATENGINE: CSatSUiSubSession::HandleCommandL \
+                     read tempPckg error" )
+                iSession.PanicClient( aMessage, ESatSBadDescriptor );
+                }
+            else
+                {
+                LOG2( SIMPLE, "SATENGINE: CSatSUiSubSession::HandleCommandL \
+                      temp.type: %i", temp.type )
+                switch ( temp.type )
+                    {
+                    case ETerminatedByCancel:
+                        {
+                        iEventMediator.Notify(
+                            MSatUtils::ECommandCancelled );
+                        break;
+                        }
+                    case ETerminatedByEndKey:
+                        {
+                        iEventMediator.Notify(
+                            MSatUtils::ECancelledUsingEndKey );
+
+                        PublishSatAppClosedUsingEndKey();
+                            
+                        // Inform session that UI Session is closed.
+                        // Session is not actually closed yet but this prevents
+                        // sending data through this session.
+                        // Notify thread death monitor
+                        iSession.NotifyThreadDeathMonitor();
+                        break;
+                        }
+                    default:
+                        {
+                        LOG( SIMPLE, "SATENGINE:   Unknown termination type" )
+                        }
+                    }
+                }
+            // Complete the client request.
+            aMessage.Complete( KErrNone );
+            break;
+            }
+
+        default:
+            {
+            LOG( SIMPLE, "  Unhandled command")
+            }
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatSUiSubSession::HandleCommandL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSUiSubSession::CloseUiSession
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatSUiSubSession::CloseUiSession()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSUiSubSession::CloseUiSession calling" )
+
+    // Set request flag to ETrue. Updated when command is successfully sent.
+    iCloseUiRequested = ETrue;
+
+    // Notify thread death monitor
+    iSession.NotifyThreadDeathMonitor();
+
+    iEventData.iEvent = ESatSCloseSatUiAppEvent;
+
+    const TBool commandSent( SendCommandDataToClient( iEventRequestAvailable,
+                             iEventDataPckg,
+                             iEventRequest ) );
+
+    if ( commandSent )
+        {
+        LOG( SIMPLE, 
+        "SATENGINE: CSatSUiSubSession::CloseUiSession commandSent" )
+        // If command was sent, set flag to false, so when next Event request
+        // arrives, command data is not sent.
+        iCloseUiRequested = EFalse;
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatSUiSubSession::CloseUiSession exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSUiSubSession::ClearScreen
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatSUiSubSession::ClearScreen()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSUiSubSession::ClearScreen calling" )
+
+    // Set request flag to ETrue. Updated when command is successfully sent.
+    iClearScreenRequested = ETrue;
+
+    iEventData.iEvent = ESatSClearScreenEvent;
+
+    const TBool commandSent( SendCommandDataToClient( iEventRequestAvailable,
+                             iEventDataPckg,
+                             iEventRequest ) );
+
+    if ( commandSent )
+        {
+        LOG( SIMPLE, 
+        "SATENGINE: CSatSUiSubSession::ClearScreen commandSent" )
+        // If command was sent, set flag to false, so when next Event request
+        // arrives, command data is not sent.
+        iClearScreenRequested = EFalse;
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatSUiSubSession::ClearScreen exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSUiSubSession::UiEventNotification
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatSUiSubSession::UiEventNotification(
+    TInt aEventId, TInt aEventStatus, TInt aEventError )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSUiSubSession::UiEventNotification calling" )
+
+    // Set request flag to ETrue. Updated when command is successfully sent.
+    iUiEventRequested = ETrue;
+    iEventData.iEvent = static_cast< TSatSEvent >( aEventId );
+    iEventData.iStatus = static_cast< TSatSEventStatus >( aEventStatus );
+    iEventData.iError = aEventError;
+
+    HandleUiEventNotification();
+
+    LOG( SIMPLE, "SATENGINE: CSatSUiSubSession::UiEventNotification exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSUiSubSession::HandleUiEventNotification
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatSUiSubSession::HandleUiEventNotification()
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatSUiSubSession::HandleUiEventNotification calling" )
+
+    // Send Command to client
+    const TBool commandSent( SendCommandDataToClient( iEventRequestAvailable,
+                             iEventDataPckg,
+                             iEventRequest ) );
+
+    // Check the status of command sending
+    if ( commandSent )
+        {
+        LOG( SIMPLE, 
+        "SATENGINE: CSatSUiSubSession::HandleUiEventNotification commandSent" )
+        // If command was sent, set flag to false, so when next Event request
+        // arrives, command data is not sent.
+        iUiEventRequested = EFalse;
+        }
+
+    LOG( SIMPLE,
+        "SATENGINE: CSatSUiSubSession::HandleUiEventNotification exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSUiSubSession::SendCommand
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatSUiSubSession::SendCommand(
+    TDesC8* aCmdData, // Data from SIM.
+    TDes8* aCmdRsp, // Response.
+    TSatServerRequest aRequest ) // Request, which the aData is sent.
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSUiSubSession::SendCommand calling" )
+
+    const TInt count( iServiceRequest->Count() );
+    TBool requestHandled( EFalse );
+    TInt index( 0 );
+
+    // Loop until request is handled or no request handler found.
+    while ( !requestHandled && ( index < count ) )
+        {
+        requestHandled = iServiceRequest->At( index )->HandleCommand(
+            aCmdData, aCmdRsp, aRequest );
+        index++;
+        }
+    LOG2( SIMPLE, "SATENGINE: CSatSUiSubSession::SendCommand \
+          index: %i", index )
+    LOG( SIMPLE, "SATENGINE: CSatSUiSubSession::SendCommand exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSUiSubSession::Event
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatSUiSubSession::Event( TInt aEvent )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSUiSubSession::Event calling" )
+
+    if ( MSatUtils::ESmsSent == aEvent )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatSUiSubSession::Event ESmsSent" )
+        iSmsSent = ETrue;
+        SendSmsSentEventToClient();
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatSUiSubSession::Event exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSUiSubSession::SendCommandDataToClient
+// Writes descriptor to clients address space and
+// completes the request.
+// -----------------------------------------------------------------------------
+//
+TBool CSatSUiSubSession::SendCommandDataToClient(
+    TBool& aRequestAvailable, // Is request available
+    const TDesC8& aData, // Data to be sent to client
+    const RMessage2& aMessage ) const // Message of the request
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatSUiSubSession::SendCommandDataToClient calling" )
+
+    TBool commandSent( EFalse );
+
+    // Is ui client ready to receive the command data.
+    if ( aRequestAvailable )
+        {
+        LOG( SIMPLE, "SATENGINE: SendCommandDataToClient: Sending to Client" )
+        TRAPD( res, aMessage.WriteL( 0, aData ) );
+        if ( KErrNone != res )
+            {
+            LOG( SIMPLE, 
+            "SATENGINE: SendCommandDataToClient: KErrNone != res" )
+            iSession.PanicClient( aMessage, ESatSBadDescriptor );
+            }
+        aMessage.Complete( KErrNone );
+        aRequestAvailable = EFalse;
+        commandSent = ETrue;
+        }
+
+    LOG( SIMPLE,
+        "SATENGINE: CSatSUiSubSession::SendCommandDataToClient exiting" )
+    return commandSent;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSUiSubSession::SendSmsSentEventToClient
+// -----------------------------------------------------------------------------
+//
+void CSatSUiSubSession::SendSmsSentEventToClient()
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatSUiSubSession::SendSmsSentEventToClient calling" )
+
+    iEventData.iEvent = ESatSSmEndEvent;
+    const TBool commandSent( SendCommandDataToClient( iEventRequestAvailable,
+        iEventDataPckg, iEventRequest ) );
+
+    if ( commandSent )
+        {
+        LOG( SIMPLE, 
+        "SATENGINE: CSatSUiSubSession::SendSmsSentEventToClient commandSent" )
+        // If command was sent, set flag to false, so when next Event request
+        // arrives, command data is not sent.
+        iSmsSent = EFalse;
+        }
+
+    LOG( SIMPLE,
+        "SATENGINE: CSatSUiSubSession::SendSmsSentEventToClient exiting" )
+    }
+    
+// -----------------------------------------------------------------------------
+// Publish the P&S key KSatAppClosedUsingEndKey to indicate the occurred
+// End Key action
+// -----------------------------------------------------------------------------
+//
+void CSatSUiSubSession::PublishSatAppClosedUsingEndKey()
+    {
+    LOG( SIMPLE,
+        "SATENGINE:CSatSUiSubSession::PublishSatAppClosedUsingEndKey calling" )
+
+    TInt error = RProperty::Set( KPSUidSatServerInternal,
+        KSatAppClosedUsingEndKey, KSatAppTerminatedUsingEndKey );
+    LOG2( SIMPLE, "CSatSUiSubSession::PublishSatAppClosedUsingEndKey \
+          P&S key: %i", KSatAppTerminatedUsingEndKey )    
+    LOG2(NORMAL, 
+        "SATENGINE: CSatSUiSubSession::PublishSatAppClosedUsingEndKey -  \
+        publish KSapAppClosedUsingEndKey and return: %d ", error );
+
+    LOG( SIMPLE,
+        "SATENGINE:CSatSUiSubSession::PublishSatAppClosedUsingEndKey exiting" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/CSatThreadDeathMonitor.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,153 @@
+/*
+* 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:  Monitors threads death and notifies an event, when thread dies
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CSatThreadDeathMonitor.h"
+#include    "MThreadDeathObserver.h"
+#include    "SatLog.h"
+#include    "MSatUtils.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSatThreadDeathMonitor::CSatThreadDeathMonitor
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatThreadDeathMonitor::CSatThreadDeathMonitor() : CActive( EPriorityStandard )
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatThreadDeathMonitor::CSatThreadDeathMonitor calling" )
+
+    CActiveScheduler::Add( this );
+
+    LOG( SIMPLE,
+        "SATENGINE: CSatThreadDeathMonitor::CSatThreadDeathMonitor exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatThreadDeathMonitor::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatThreadDeathMonitor* CSatThreadDeathMonitor::NewL()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatThreadDeathMonitor::NewL calling" )
+    CSatThreadDeathMonitor* deathMonitor = new( ELeave ) CSatThreadDeathMonitor;
+    LOG( SIMPLE, "SATENGINE: CSatThreadDeathMonitor::NewL exiting" )
+    return deathMonitor;
+    }
+
+
+// Destructor
+CSatThreadDeathMonitor::~CSatThreadDeathMonitor()
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatThreadDeathMonitor::~CSatThreadDeathMonitor calling" )
+    Cancel();
+    iThread.Close();
+    iObserver = NULL;
+    LOG( SIMPLE, 
+        "SATENGINE: CSatThreadDeathMonitor::~CSatThreadDeathMonitor exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatThreadDeathMonitor::NotifyThreadDeathL
+// Prepares to notify observer of threads death
+// -----------------------------------------------------------------------------
+//
+void CSatThreadDeathMonitor::NotifyThreadDeathL(
+                                 const TThreadId& aThreadId,
+                                 MThreadDeathObserver& aObserver )
+    {
+
+    LOG( SIMPLE,
+        "SATENGINE: CSatThreadDeathMonitor::NotifyThreadDeathL calling" )
+    Cancel();
+
+    iThread.Close();
+
+    User::LeaveIfError( iThread.Open( aThreadId ) );
+
+    iObserver = &aObserver;
+    StartObservingThreadDeath();
+    LOG( SIMPLE,
+        "SATENGINE: CSatThreadDeathMonitor::NotifyThreadDeathL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatThreadDeathMonitor::StartObservingThreadDeath
+// Logons to thread and starts observing it's state
+// -----------------------------------------------------------------------------
+//
+void CSatThreadDeathMonitor::StartObservingThreadDeath()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatThreadDeathMonitor::\
+            StartObservingThreadDeath calling" )
+    iThread.Logon( iStatus );
+    SetActive();
+    LOG( SIMPLE, "SATENGINE: CSatThreadDeathMonitor::\
+            StartObservingThreadDeath exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatThreadDeathMonitor::DoCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatThreadDeathMonitor::DoCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatThreadDeathMonitor::DoCancel calling" )
+    iThread.LogonCancel( iStatus );
+    LOG( SIMPLE, "SATENGINE: CSatThreadDeathMonitor::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatThreadDeathMonitor::RunL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatThreadDeathMonitor::RunL()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatThreadDeathMonitor::RunL calling" )
+
+    const TExitType exitType( iThread.ExitType() );
+
+    if ( EExitPending == exitType ) // If thread is still alive, restart
+        {
+        LOG( SIMPLE, " Thread is still alive" )
+        StartObservingThreadDeath();
+        }
+    else if ( EExitPanic == exitType )
+        {
+        LOG( SIMPLE, " Thread has panicked" )
+        iThread.Close();
+        iObserver->ThreadPanicedL();
+        }
+    else
+        {
+        LOG( SIMPLE, " Thread is dead" )
+        iThread.Close();
+        iObserver->ThreadDiedL();
+        }
+    LOG( SIMPLE, "SATENGINE: CSatThreadDeathMonitor::RunL exiting" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/Panic.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,41 @@
+/*
+* 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:  Panic function implementation
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32std.h>
+#include    "EnginePanic.h"
+#include    "SatLog.h"
+
+// CONSTANTS
+_LIT( KSatEnginePanic, "SatEngine" );
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// PanicSatEngine
+// Panics the engine.
+// -----------------------------------------------------------------------------
+//
+void PanicSatEngine( TPanicCode aPanicCode ) // Panic code
+    {
+    LOG( SIMPLE, "SATENGINE: PanicSatEngine panic" )
+    User::Panic( KSatEnginePanic, aPanicCode );
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/SatServer.hrh	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,22 @@
+/*
+* Copyright (c) 2003-2005 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource header file for SatServer.
+*
+*/
+
+
+// SatServer Resource file signature
+#define ESatSResourceSignature 74
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/SatServer.rss	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* 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:  This file contains all the resources for the module.
+*
+*/
+
+
+NAME    SATS
+
+#include <uikon.rh>
+
+#include "SatServer.hrh"
+#include <satserver.loc>
+
+RESOURCE RSS_SIGNATURE { signature = ESatSResourceSignature; }
+
+/******************* Localized texts **********************/
+
+// -----------------------------------------------------------------------------
+// r_sats_ti_log_title
+// Defines localized text
+// -----------------------------------------------------------------------------
+//
+RESOURCE LBUF r_qtn_sat_log_title
+    {
+    txt = qtn_sat_log_title;
+    }
+
+RESOURCE LBUF r_qtn_sat_cmcc_title
+    {
+    txt = qtn_sat_cmcc_title;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/TSatBitOP.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,142 @@
+/*
+* 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:  Bit manipulator.
+*
+*/
+
+
+#include    "TSatBitOP.h"
+#include    "SatLog.h"
+
+const TUint8 KBitsInByte( 8 );
+const TUint8 KBitsInWord( 16 );
+const TUint8 KHighBitInByte( 7 );
+const TUint8 KHighBitInWord( 15 );
+
+// -----------------------------------------------------------------------------
+// Extracts bits from bit sequence. First bit is 0 index.
+// The lsb of extracted bits is set to 0 bit.
+// -----------------------------------------------------------------------------
+//
+TUint8 TSatBitOP::ExtractBits(
+    TInt aBitIndex,
+    TUint8 aBitCount,
+    const TDesC8& aBytes )
+    {
+    LOG( DETAILED, "SATENGINE: TSatBitOP::ExtractBits calling" )
+
+    // Calculate the byte where aBitIndex is pointing.
+    const TInt byteIndex( static_cast<TInt>( aBitIndex / KBitsInByte ) );
+    if ( byteIndex > 0 ) // aBitIndex is pointing other than first byte.
+        {
+        LOG( DETAILED, "SATENGINE: TSatBitOP::ExtractBits byteIndex > 0" )
+        // Change the aBitIndex to point the bits 0 to 7, because
+        // we know which byte it is indexing.
+        aBitIndex -= byteIndex * KBitsInByte;
+        }
+
+    TUint8 result( 0 );
+    // Check if the bits to be extracted is in two bytes.
+    // ie. Part of the bits is in one byte and another
+    // part is in the following byte.
+    const TUint8 lastBit( static_cast<TUint8>( aBitIndex + aBitCount ) );
+    LOG2( DETAILED, "SATENGINE: TSatBitOP::ExtractBits lastBit: %i", lastBit )
+    if ( lastBit > KBitsInByte )
+        {
+        // The bits to be extracted reside in two bytes.
+
+        // Take the bytes.
+        const TUint16 word( static_cast<TUint16>(
+            ( aBytes[byteIndex] << KBitsInByte ) + aBytes[byteIndex + 1] ) );
+
+        // Create the mask, which extracts the bits.
+        const TUint16 mask(
+            CreateMask16Bit( static_cast<TUint8>( aBitIndex ), aBitCount ) );
+
+        // Extract the bits from the word.
+        // Result will be shifted so that the lsb bit of the extracted bits
+        // will be in bit 0.
+        result =
+            static_cast<TUint8>( ( word & mask ) >> ( KBitsInWord - lastBit ) );
+        }
+    else
+        {
+        // Bits can be extracted from single byte.
+
+        // Create the mask.
+        const TUint8 mask(
+            CreateMask8Bit( static_cast<TUint8>( aBitIndex ), aBitCount ) );
+
+        const TUint8 byte( aBytes[byteIndex] );
+
+        // Mask the bits and move the lsb of the extracted bits to 0 bit.
+        // Result will be shifted so that the lsb bit of the extracted bits
+        // will be in bit 0.
+        result =
+            static_cast<TUint8>( ( byte & mask ) >> ( KBitsInByte - lastBit ) );
+        }
+
+    LOG( DETAILED, "SATENGINE: TSatBitOP::ExtractBits exiting" )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// Creates a 8-bit mask of ones.
+// -----------------------------------------------------------------------------
+//
+TUint8 TSatBitOP::CreateMask8Bit( TUint8 aBitIndex, TUint8 aCount )
+    {
+    LOG( DETAILED, "SATENGINE: TSatBitOP::CreateMask8Bit calling" )
+
+    // Change aBitIndex to use normal indexing of bits, because
+    // 0 in aBitIndex means MSB.
+    aBitIndex = static_cast<TUint8>( KHighBitInByte - aBitIndex );
+
+    TUint8 result( 0 );
+    TInt i ( 0 );
+    for ( i = 0; i < aCount; i++ )
+        {
+        result |= static_cast<TUint8>( 1 << aBitIndex );
+        aBitIndex--;
+        }
+    LOG2( DETAILED, "SATENGINE: TSatBitOP::CreateMask8Bit i: %i", i )
+    LOG2( DETAILED, "SATENGINE: TSatBitOP::CreateMask8Bit exiting, \
+          result: %i", result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// Creates a 16-bit mask of ones.
+// -----------------------------------------------------------------------------
+//
+TUint16 TSatBitOP::CreateMask16Bit( TUint8 aBitIndex, TUint8 aCount )
+    {
+    LOG( DETAILED, "SATENGINE: TSatBitOP::CreateMask16Bit calling" )
+
+    // Change aBitIndex to use normal indexing of bits, because
+    // 0 in aBitIndex means MSB.
+    aBitIndex = static_cast<TUint8>( KHighBitInWord - aBitIndex );
+
+    TUint16 result( 0 );
+    TInt i ( 0 );
+    for ( i = 0;  i < aCount; i++ )
+        {
+        result |= static_cast<TUint16>( 1 << aBitIndex );
+        aBitIndex--;
+        }
+    LOG2( DETAILED, "SATENGINE: TSatBitOP::CreateMask16Bit i: %i", i )
+    LOG2( DETAILED, "SATENGINE: TSatBitOP::CreateMask16Bit exiting, \
+          result: %i", result )
+    return result;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/TSatChannelIDInfo.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -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:  Information class for Channel IDs.
+*
+*/
+
+
+#include "TSatChannelIDInfo.h"
+#include "SatLog.h"
+
+// -----------------------------------------------------------------------------
+// TSatChannelIdInfo::TSatChannelIdInfo
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+TSatChannelIdInfo::TSatChannelIdInfo( TInt aChannelId, TUint8 aShort ) :
+    iChannelId( aChannelId ),
+    iShortChannelId( aShort ),
+    iActive( EFalse )
+    {
+    LOG( SIMPLE, "SATENGINE: TSatChannelIdInfo::TSatChannelIdInfo \
+        calling-exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TSatChannelIdInfo::ChannelId
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt TSatChannelIdInfo::ChannelId() const
+    {
+    LOG2( SIMPLE, "SATENGINE: TSatChannelIdInfo::ChannelId \
+        calling-exiting with: %i", iChannelId )
+    return iChannelId;
+    }
+
+// -----------------------------------------------------------------------------
+// TSatChannelIdInfo::ShortChannelId
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUint8 TSatChannelIdInfo::ShortChannelId() const
+    {
+    LOG2( SIMPLE, "SATENGINE: TSatChannelIdInfo::ShortChannelId \
+        calling-exiting with: %i", iShortChannelId )
+    return iShortChannelId;
+    }
+ 
+// -----------------------------------------------------------------------------
+// TSatChannelIdInfo::IsReserved
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool TSatChannelIdInfo::IsReserved() const
+    {
+    LOG2( SIMPLE, "SATENGINE: TSatChannelIdInfo::IsReserved \
+        calling-exiting with: %i", iActive )
+    return iActive;
+    }
+
+// -----------------------------------------------------------------------------
+// TSatChannelIdInfo::ReserveChannel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TSatChannelIdInfo::ReserveChannel()
+    {
+    LOG( SIMPLE, "SATENGINE: TSatChannelIdInfo::ReserveChannel \
+        calling-exiting" )
+    iActive = ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// TSatChannelIdInfo::ReleaseChannel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TSatChannelIdInfo::ReleaseChannel()
+    {
+    LOG( SIMPLE, "SATENGINE: TSatChannelIdInfo::ReleaseChannel \
+        calling-exiting" )
+    iActive = EFalse;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/TSatEventMediator.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,346 @@
+/*
+* 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 way to notify events and register observers
+*                for events
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "TSatEventMediator.h"
+#include    "TSatEventsObserver.h"
+//lint -e766 Used inside TRAP macro, lint misfunction.
+#include    "EnginePanic.h"
+#include    "MSatEventObserver.h"
+#include    "SatLog.h"
+
+// FORWARD DECLARE
+class MSatEventObserver;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TSatEventMediator::TSatEventMediator
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+TSatEventMediator::TSatEventMediator() :
+    iEventsObservers(),
+    iIsNotifying( EFalse ),
+    iDeletionsMarked( EFalse )
+    {
+    LOG( SIMPLE,
+        "SATENGINE: TSatEventMediator::TSatEventMediator calling - exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TSatEventMediator::Reset
+// Replaces destructor since T classes cannot have one
+// -----------------------------------------------------------------------------
+//
+void TSatEventMediator::Reset()
+    {
+    LOG( SIMPLE, "SATENGINE: TSatEventMediator::Reset calling" )
+
+    iEventsObservers.ResetAndDestroy();
+
+    LOG( SIMPLE, "SATENGINE: TSatEventMediator::Reset exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TSatEventMediator::Notify
+// All observers, who are registered to get the notification of aEvent, are
+// notified
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TSatEventMediator::Notify(
+    TInt aEvent ) // Event
+    {
+    LOG( DETAILED, "SATENGINE: TSatEventMediator::Notify calling" )
+
+    // Go through the list of observers and call notify for observers who are
+    // observing aEvent.
+
+    // Set the flag on. No one can remove observers when this flag is on
+    iIsNotifying = ETrue;
+
+    TInt count( iEventsObservers.Count() );
+    LOG2( DETAILED, "SATENGINE: TSatEventMediator::Notify observers \
+          count: %d", count )
+    for ( TInt i = 0; i < count; i++ )
+        {
+        TSatEventsObserver* eventsObserver =
+            iEventsObservers[i];
+        __ASSERT_ALWAYS( eventsObserver,
+            PanicSatEngine( ESatEngineNullPointer ) );
+
+        if ( eventsObserver->ObservingEvent( aEvent ) )
+            {
+            MSatEventObserver* observer =
+                eventsObserver->Observer();
+
+            if ( observer )
+                {
+                LOG( DETAILED, "TSatEventMediator::Notify observer found" )
+                // Observer found, notify it
+                observer->Event( aEvent );
+
+                // Check is iEventObservers list changed. Some observers might
+                // remove themselves and notify a new event (new Notify loop)
+                // and marked observers are deleted there. When it comes back 
+                // here iEventsObserver has changed           
+                if ( count > iEventsObservers.Count() )
+                    {
+                    LOG( DETAILED, "TSatEventMediator::Notify \
+                    count > iEventsObservers.Count()" )
+                    TInt newCount( iEventsObservers.Count() );
+                    i = i - ( count - newCount );
+                    count = newCount;
+                    }
+                }
+            else
+                {
+                LOG( DETAILED, "TSatEventMediator::Notify observer not found" )
+                // Found NULL observer -> Mark fo deleted. This is deleted after
+                // this notification loop
+                eventsObserver->RemoveEvent( aEvent );
+                eventsObserver->MarkForDelete();
+                }
+            }
+        }
+
+    // Set the flag off. Now observers can be removed
+    iIsNotifying = EFalse;
+
+    // Check was there any deletions during notify loop
+    if ( iDeletionsMarked )
+        {
+        LOG( DETAILED, "TSatEventMediator::Notify iDeletionsMarked true" )
+        // Delete marked observers
+        DeleteMarkedObservers();
+        iDeletionsMarked = EFalse;
+        }
+
+    LOG( DETAILED, "SATENGINE: TSatEventMediator::Notify exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TSatEventMediator::RegisterL
+// Registers observer for getting the event when event is notified using
+// Notify( TInt aEvent ).
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TSatEventMediator::RegisterL(
+    MSatEventObserver* aObserver, // Observer of aEvent.
+    TInt aEvent ) // Event, which will be trigger of notification.
+    {
+    LOG( SIMPLE, "SATENGINE: TSatEventMediator::RegisterL calling" )
+
+    __ASSERT_ALWAYS( aObserver, PanicSatEngine( ESatEngineNullPointer ) );
+    // Check if aObserver instance is already registered, so that we dont
+    // create a new TSatEventsObserver entry in to the iEventsObserver list.
+    TSatEventsObserver* eventsObserver = HasObserverInstance( aObserver );
+
+    if ( NULL != eventsObserver )
+        {
+        LOG( SIMPLE, "SATENGINE: TSatEventMediator::RegisterL eventsObserver \
+             not NULL" )
+        // Add the event for the observer.
+        eventsObserver->AddEventL( aEvent );
+        }
+    else
+        {
+        LOG( SIMPLE, "SATENGINE: TSatEventMediator::RegisterL eventsObserver \
+             NULL" )
+        // Observer is registering for the first time.
+        eventsObserver = new( ELeave )TSatEventsObserver( aObserver );
+        CleanupStack::PushL( eventsObserver );
+        eventsObserver->AddEventL( aEvent );
+        User::LeaveIfError( iEventsObservers.Append( eventsObserver ) );
+        CleanupStack::Pop( eventsObserver );
+        }
+
+    LOG( SIMPLE, "SATENGINE: TSatEventMediator::RegisterL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TSatEventMediator::Unregister
+// Removes aEvent from aObservers observable events.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TSatEventMediator::Unregister(
+    const MSatEventObserver* aObserver, // Observer of aEvent.
+    TInt aEvent ) // Event, which the observer is observing.
+    {
+    LOG( SIMPLE, "SATENGINE: TSatEventMediator::Unregister calling" )
+
+    // Check if observer is registered.
+    TSatEventsObserver* eventsObserver = HasObserverInstance( aObserver );
+    if ( NULL != eventsObserver )
+        {
+        LOG( SIMPLE, "SATENGINE: TSatEventMediator::RegisterL eventsObserver \
+             not NULL" )
+        eventsObserver->RemoveEvent( aEvent );
+
+        // Remove the eventsObserver from the list if the observer has
+        // no longer any events to observe.
+        if ( 0 == eventsObserver->EventCount() )
+            {
+            // Prevent delete if we are notifying observers
+            if ( !iIsNotifying )
+                {
+                LOG( SIMPLE, "SATENGINE: TSatEventMediator::Unregister \
+                     iIsNotifying false" )
+                const TInt index = iEventsObservers.Find( eventsObserver );
+                // Does not destroy the object.
+                iEventsObservers.Remove( index ); 
+                iEventsObservers.GranularCompress();
+                delete eventsObserver;
+                }
+            else
+                {
+                LOG( SIMPLE, "SATENGINE: TSatEventMediator::Unregister \
+                     iIsNotifying true" )
+                // If we are notifying, mark this observer as deleted
+                eventsObserver->MarkForDelete();
+                iDeletionsMarked = ETrue;
+                }
+            }
+        }
+
+    LOG( SIMPLE, "SATENGINE: TSatEventMediator::Unregister exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TSatEventMediator::Unregister
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TSatEventMediator::Unregister(
+    const MSatEventObserver* aObserver ) // Observer of aEvent.
+    {
+    LOG( SIMPLE, "SATENGINE: TSatEventMediator::Unregister calling" )
+
+    // Check if observer is registered.
+    TSatEventsObserver* eventsObserver = HasObserverInstance( aObserver );
+    if ( NULL != eventsObserver )
+        {
+        // Prevent delete if we are notifying observers
+        if ( !iIsNotifying )
+            {
+            LOG( SIMPLE, "SATENGINE: TSatEventMediator::Unregister \
+                 iIsNotifying false" )
+            const TInt index = iEventsObservers.Find( eventsObserver );
+            iEventsObservers.Remove( index ); // Does not destroy the object.
+            iEventsObservers.GranularCompress();
+            delete eventsObserver;
+            }
+        else
+            {
+            LOG( SIMPLE, "SATENGINE: TSatEventMediator::Unregister \
+                 iIsNotifying true" )
+            // If we are notifying, mark this observer as deleted
+            eventsObserver->MarkForDelete();
+            iDeletionsMarked = ETrue;
+            }
+        }
+
+    LOG( SIMPLE, "SATENGINE: TSatEventMediator::Unregister exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TSatEventMediator::HasObserverInstance
+// Checks if aObserver is already registered to this mediator and returns the
+// result.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TSatEventsObserver* TSatEventMediator::HasObserverInstance(
+    const MSatEventObserver* aObserver ) const // Observer looked from the list.
+    {
+    LOG( SIMPLE, "SATENGINE: TSatEventMediator::HasObserverInstance calling" )
+
+    // Go through the list until same observer instance is found or
+    // all entries have been checked.
+    TSatEventsObserver* foundEventsObserver = NULL;
+    const TInt count( iEventsObservers.Count() );
+    LOG2( NORMAL, "SATENGINE: TSatEventMediator::HasObserverInstance \
+          observer count: %d", count )
+    for ( TInt i = 0; ( i < count ) && ( !foundEventsObserver ); i++ )
+        {
+        TSatEventsObserver* eventsObserver = iEventsObservers[i];
+        __ASSERT_ALWAYS( eventsObserver,
+            PanicSatEngine( ESatEngineNullPointer ) );
+
+        if ( aObserver == eventsObserver->Observer() )
+            {
+            LOG( SIMPLE, "SATENGINE: TSatEventMediator::HasObserverInstance \
+            aObserver == eventsObserver->Observer()" )
+            foundEventsObserver = eventsObserver;
+            }
+        }
+
+    LOG( SIMPLE, "SATENGINE: TSatEventMediator::HasObserverInstance exiting" )
+    return foundEventsObserver;
+    }
+
+// -----------------------------------------------------------------------------
+// TSatEventMediator::DeleteMarkedObservers
+// Deletes all observers marked as deleted during Notify loop
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TSatEventMediator::DeleteMarkedObservers()
+    {
+    LOG( SIMPLE, "SATENGINE: TSatEventMediator::DeleteMarkedObservers calling" )
+
+    // Go through the list and delete all observers wich are
+    // marked as deleted
+    TInt count( iEventsObservers.Count() );
+    LOG2( NORMAL, "SATENGINE: TSatEventMediator::DeleteMarkedObservers \
+          observer count: %d", count )
+    for ( TInt i = 0; i < count; i++ )
+        {
+        TSatEventsObserver* eventsObserver =
+            iEventsObservers[i];
+        if ( eventsObserver )
+            {
+            LOG( SIMPLE, "SATENGINE: TSatEventMediator::DeleteMarkedObservers\
+            eventsObserver true" )
+            // Check is obserer marked and it has no events
+            if ( eventsObserver->IsMarkedForDelete() &&
+                 ( 0 == eventsObserver->EventCount() ) )
+                {
+                LOG( SIMPLE, "SATENGINE: TSatEventMediator::\
+                DeleteMarkedObservers delete Observer" )
+                iEventsObservers.Remove( i ); // Does not destroy the object.
+                iEventsObservers.GranularCompress();
+                delete eventsObserver;
+
+                // Update count value. We just removed an object from list
+                count = iEventsObservers.Count();
+                i--;
+                }
+            }
+        }
+
+    LOG( SIMPLE, "SATENGINE: TSatEventMediator::DeleteMarkedObservers exiting" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/TSatEventsObserver.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,185 @@
+/*
+* 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:  Capsulates the observer and events.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "TSatEventsObserver.h"
+//lint -e766 Used inside TRAP macro, lint misfunction.
+#include    "EnginePanic.h"
+#include    "SatLog.h"
+
+// FORWARD DECLARE
+class MSatEventObserver;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TSatEventsObserver::TSatEventsObserver
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+TSatEventsObserver::TSatEventsObserver(
+    MSatEventObserver* aObserver ) // Observer of events.
+    :
+    iEvents(),
+    iObserver( aObserver ),
+    iMarkedForDelete( EFalse ) // This observer is not marked for delete, yet.
+    {
+    LOG( SIMPLE, "SATENGINE: TSatEventsObserver::TSatEventsObserver calling" )
+
+    __ASSERT_ALWAYS( aObserver, PanicSatEngine( ESatEngineNullPointer ) );
+
+    LOG( SIMPLE, "SATENGINE: TSatEventsObserver::TSatEventsObserver exiting" )
+    }
+
+// Destructor
+TSatEventsObserver::~TSatEventsObserver()
+    {
+    LOG( SIMPLE, "SATENGINE: TSatEventsObserver::~TSatEventsObserver calling" )
+
+    iEvents.Reset();
+    iEvents.Close();
+    iObserver = NULL;
+
+    LOG( SIMPLE, "SATENGINE: TSatEventsObserver::~TSatEventsObserver exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TSatEventsObserver::AddEventL
+// Adds event to the list of events. If aEvent is already in the list, it will
+// not be added to the list.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TSatEventsObserver::AddEventL(
+    TInt aEvent ) // Event to be added to list.
+    {
+    LOG( SIMPLE, "SATENGINE: TSatEventsObserver::AddEventL calling" )
+
+    // Check if the event is already added to the list.
+    if ( !ObservingEvent( aEvent ) )
+        {
+        LOG( SIMPLE, "SATENGINE: TSatEventsObserver::AddEventL add event" )
+        User::LeaveIfError( iEvents.Append( aEvent ) );
+        }
+
+    LOG( SIMPLE, "SATENGINE: TSatEventsObserver::AddEventL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TSatEventsObserver::RemoveEvent
+// Removes aEvent from the iEvents list, if aEvent is in the list.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TSatEventsObserver::RemoveEvent( TInt aEvent )
+    {
+    LOG( SIMPLE, "SATENGINE: TSatEventsObserver::RemoveEvent calling" )
+
+    const TInt index( iEvents.Find( aEvent ) );
+    LOG2( SIMPLE, "SATENGINE: TSatEventsObserver::RemoveEvent index: %d", 
+          index )
+
+    // KErrNotFound in index means that aEvent is not in the list.
+    if ( KErrNotFound != index )
+        {
+        iEvents.Remove( index );
+        iEvents.GranularCompress();
+        }
+
+    LOG( SIMPLE, "SATENGINE: TSatEventsObserver::RemoveEvent exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TSatEventsObserver::ObservingEvents
+// Checks wether aEvent is in the iEvents list.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool TSatEventsObserver::ObservingEvent(
+    TInt aEvent ) const // Event to be checked
+    {
+    LOG( DETAILED, "SATENGINE: TSatEventsObserver::ObservingEvent calling" )
+
+    TBool result( ETrue );
+    if ( KErrNotFound == iEvents.Find( aEvent ) )
+        {
+        LOG( DETAILED, "SATENGINE: TSatEventsObserver::ObservingEvent \
+        find event" )
+        result = EFalse;
+        }
+
+    LOG2( DETAILED, "SATENGINE: TSatEventsObserver::ObservingEvent exiting, \
+          result: %d", result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// TSatEventsObserver::Observer
+// Getter for the observer.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+MSatEventObserver* TSatEventsObserver::Observer()
+    {
+    LOG( DETAILED, "SATENGINE: TSatEventsObserver::Observer calling-exiting" )
+    return iObserver;
+    }
+
+// -----------------------------------------------------------------------------
+// TSatEventsObserver::EventCount
+// Getter for the event cound
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt TSatEventsObserver::EventCount() const
+    {
+    LOG( SIMPLE, "SATENGINE: TSatEventsObserver::EventCount calling-exiting" )
+    return iEvents.Count();
+    }
+
+// -----------------------------------------------------------------------------
+// TSatEventsObserver::IsMarkedForDelete
+// Getter for deletion mark
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool TSatEventsObserver::IsMarkedForDelete() const
+    {
+    LOG( SIMPLE,
+        "SATENGINE: TSatEventsObserver::IsMarkedForDelete calling-exiting" )
+    return iMarkedForDelete;
+    }
+
+// -----------------------------------------------------------------------------
+// TSatEventsObserver::MarkForDelete
+// Marks this observer to be deleted
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TSatEventsObserver::MarkForDelete()
+    {
+    LOG( SIMPLE, "SATENGINE: TSatEventsObserver::MarkForDelete calling" )
+
+    iMarkedForDelete = ETrue;
+
+    LOG( SIMPLE, "SATENGINE: TSatEventsObserver::MarkForDelete exiting" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/TSatExtErrorUtils.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,197 @@
+/*
+* 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:  Maps extended error values to correct values.
+*
+*/
+
+
+#include    "TSatExtErrorUtils.h"
+#include    <exterror.h>
+#include    "SatLog.h"
+
+// In some cases return value needs to be zeroed
+const TUint8 KSatZeroError( 0x00 );
+const TUint8 KHighBitInByte( 0x80 );
+
+// -----------------------------------------------------------------------------
+// TSatExtErrorUtils::MapError
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint8 TSatExtErrorUtils::MapError(
+    TInt aExtError,
+    TBool aModifyMappedValue )
+    {
+    LOG2( SIMPLE, "SATENGINE: TSatExtErrorUtils::MapError calling value: %i",
+       aExtError )
+
+    TUint8 retValue( 0 );
+    TUint8 nwValue( 0 );
+    TInt baseError( 0 );
+
+    if ( IsExtendedError( aExtError ) )
+        {
+        // Define the base error value
+        if ( KErrGsmMobilityManagementBase < aExtError )
+            {
+            LOG( NORMAL, "SATENGINE: TSatExtErrorUtils::MapError Base error" )
+            baseError = KErrEtelGsmBase; // Base error
+            }
+        else if ( KErrGsmCallControlBase < aExtError )
+            {
+            LOG( NORMAL, "SATENGINE: TSatExtErrorUtils::MapError MM error" )
+            baseError = KErrGsmMobilityManagementBase; // MM error
+            }
+        else if ( KErrGsmSuppServiceBase < aExtError )
+            {
+            LOG( NORMAL, "SATENGINE: TSatExtErrorUtils::MapError CallControl \
+                 error" )
+            baseError = KErrGsmCallControlBase; // CallControl error
+            }
+        else if ( KErrGsmSmsBase < aExtError )
+            {
+            LOG( NORMAL, "SATENGINE: TSatExtErrorUtils::MapError SS error" )
+            baseError = KErrGsmSuppServiceBase; // Ss error
+            }
+        else if ( KErrGsm0707Base < aExtError )
+            {
+            LOG( NORMAL, "SATENGINE: TSatExtErrorUtils::MapError Sms error" )
+            baseError = KErrGsmSmsBase; // Sms error
+            }
+        else
+            {
+            LOG( NORMAL, "SATENGINE: TSatExtErrorUtils::MapError TE-TA error" )
+            baseError = KErrGsm0707Base; // TE-TA error
+            }
+        // Base error resolved, calculate error value
+        nwValue = static_cast<TUint8>( baseError - aExtError );
+        }
+    else
+        {
+        LOG( NORMAL, "  Value not extended error, not mapped" )
+        }
+
+    // Next, check specific cases
+    CheckSpecificCases( aExtError, nwValue );
+
+    // Check do we have to modify the value
+    if ( aModifyMappedValue && nwValue > KSatZeroError )
+        {
+        LOG( NORMAL, "SATENGINE: TSatExtErrorUtils::MapError Modifying value" )
+        retValue = static_cast<TUint8>( KHighBitInByte | nwValue );
+        }
+    else
+        {
+        retValue = nwValue;
+        }
+
+    LOG2( SIMPLE, "SATENGINE: TSatExtErrorUtils::MapError exiting value:%x",
+        retValue )
+
+    return retValue;
+    }
+
+// -----------------------------------------------------------------------------
+// TSatExtErrorUtils::IsExtendedError
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool TSatExtErrorUtils::IsExtendedError( TInt aExtError )
+    {
+    LOG( SIMPLE, 
+    "SATENGINE: TSatExtErrorUtils::IsExtendedError calling-exiting" )
+    const TBool isExtError(
+        ( KErrEtelGsmBase >= aExtError ) &&
+        ( KErrGsm0707UnknownError <= aExtError ) );
+
+    return isExtError;   
+    }
+
+// -----------------------------------------------------------------------------
+// TSatExtErrorUtils::IsNetworkError
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool TSatExtErrorUtils::IsNetworkError( TInt aExtError )
+    {
+    LOG2( SIMPLE, "SATENGINE: TSatExtErrorUtils::IsNetworkError calling, \
+         aExtError: %d", aExtError )
+    TBool isNwError( ETrue );
+
+    switch ( aExtError )
+        {
+        // Add errors here that are not supposed to handle as NW errors
+        case KErrGsmSMSTemporaryFailure:
+        case KErrGsmSSUnknownAlphabet:
+        case KErrGsmSSSystemFailure:
+        case KErrGsmSSUnexpectedDataValue:
+        case KErrGsmSSIllegalOperation:
+        case KErrGsm0707UnknownError:
+            {
+            isNwError = EFalse;
+            break;
+            }
+
+        default:
+            {
+            LOG( NORMAL, "SATENGINE: TSatExtErrorUtils::IsNetworkError\
+                Is Network error" )
+            isNwError = ETrue;
+            }
+        }
+    LOG2( SIMPLE, "SATENGINE: TSatExtErrorUtils::IsNetworkError exiting, \
+         isNwError: %d", isNwError )
+    return isNwError;    
+    }
+
+// -----------------------------------------------------------------------------
+// TSatExtErrorUtils::CheckSpecificCases
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TSatExtErrorUtils::CheckSpecificCases(
+    TInt aExtError, TUint8& aNwError )
+    {
+    LOG( SIMPLE, "SATENGINE: TSatExtErrorUtils::CheckSpecificCases calling" )
+    // Specific cases, where Extended error received by SAT differs from the
+    // one that SIM expects
+    if ( KErrGsmSMSCongestion == aExtError )
+        {
+        LOG( NORMAL, "SATENGINE: TSatExtErrorUtils::CheckSpecificCases\
+                Changing Sms Congestion" )
+        // Change this into KErrGsmMmCongestion
+        aNwError = static_cast<TUint8>(
+            KErrGsmMobilityManagementBase - KErrGsmMMCongestion );
+        }
+    else if ( KErrGsmSMSUnspecifiedProtocolError == aExtError ||
+              KErrGsmCCResourceNotAvailable == aExtError ||
+              KErrGsmSSIllegalOperation == aExtError ||
+              KErrGsmSMSNoNetworkService == aExtError ||
+              KErrGsmSSNotAvailable == aExtError ||
+              KErrGsm0707UnknownError == aExtError )
+        {
+        LOG( NORMAL, "SATENGINE: TSatExtErrorUtils::CheckSpecificCases\
+                Changing unspecified protocol error to 0x00" )
+        // Change this into zero value
+        aNwError = KSatZeroError;
+        }
+    else
+        {
+        LOG( NORMAL, "SATENGINE: TSatExtErrorUtils::CheckSpecificCases\
+                Not a special case" )
+        }
+    LOG( SIMPLE, "SATENGINE: TSatExtErrorUtils::CheckSpecificCases exiting" )
+    }
+
+// End Of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/TSatQoSParser.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,714 @@
+/*
+* 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:  Maps QoS parameters
+*
+*/
+
+
+#include    "TSatQoSParser.h"
+#include    "SatLog.h"
+
+// Lenght of array of QoS from / to (U)SIM
+const TUint8 KSimQoSSize = 6;
+
+// Precedence class values
+const TUint8 KPrecMaxSize = 4;
+const TUint8 KPrecPos = 0;
+
+const RPacketQoS::TQoSPrecedence TPrecedenceClass[KPrecMaxSize] =
+    {
+    RPacketQoS::EUnspecifiedPrecedence,
+    RPacketQoS::EPriorityHighPrecedence,
+    RPacketQoS::EPriorityMediumPrecedence,
+    RPacketQoS::EPriorityLowPrecedence
+    };
+
+// Delay class values
+const TUint8 KDelayMaxSize = 8;
+const TUint8 KDelayPos = 1;
+const RPacketQoS::TQoSDelay TDelayClass[KDelayMaxSize] =
+    {
+    RPacketQoS::EUnspecifiedDelayClass,
+    RPacketQoS::EDelayClass1,
+    RPacketQoS::EDelayClass2,
+    RPacketQoS::EDelayClass3,
+    RPacketQoS::EDelayClass4,
+    // CDMA2000 specific values
+    RPacketQoS::EDelay40ms,
+    RPacketQoS::EDelay120ms,
+    RPacketQoS::EDelay360ms
+    };
+
+// Reliability class values
+const TUint8 KRelMaxSize = 6;
+const TUint8 KRelPos = 2;
+const RPacketQoS::TQoSReliability TReliablitityClass[KRelMaxSize] =
+    {
+    RPacketQoS::EUnspecifiedReliabilityClass,
+    RPacketQoS::EReliabilityClass1,
+    RPacketQoS::EReliabilityClass2,
+    RPacketQoS::EReliabilityClass3,
+    RPacketQoS::EReliabilityClass4,
+    RPacketQoS::EReliabilityClass5
+    };
+
+// Peak throughput values
+const TUint8 KPeakMaxSize = 10;
+const TUint8 KPeakPos = 3;
+const RPacketQoS::TQoSPeakThroughput TPeak[KPeakMaxSize] =
+    {
+    RPacketQoS::EUnspecifiedPeakThroughput,
+    RPacketQoS::EPeakThroughput1000,
+    RPacketQoS::EPeakThroughput2000,
+    RPacketQoS::EPeakThroughput4000,
+    RPacketQoS::EPeakThroughput8000,
+    RPacketQoS::EPeakThroughput16000,
+    RPacketQoS::EPeakThroughput32000,
+    RPacketQoS::EPeakThroughput64000,
+    RPacketQoS::EPeakThroughput128000,
+    RPacketQoS::EPeakThroughput256000
+    };
+
+// Mean throughput values
+const TUint8 KMeanMaxSize = 20;
+const TUint8 KMeanPos = 4;
+const TUint8 KMeanBestEffort = 0x1F;
+const RPacketQoS::TQoSMeanThroughput TMean[KMeanMaxSize] =
+    {
+    RPacketQoS::EUnspecifiedMeanThroughput,
+    RPacketQoS::EMeanThroughput100,
+    RPacketQoS::EMeanThroughput200,
+    RPacketQoS::EMeanThroughput500,
+    RPacketQoS::EMeanThroughput1000,
+    RPacketQoS::EMeanThroughput2000,
+    RPacketQoS::EMeanThroughput5000,
+    RPacketQoS::EMeanThroughput10000,
+    RPacketQoS::EMeanThroughput20000,
+    RPacketQoS::EMeanThroughput50000,
+    RPacketQoS::EMeanThroughput100000,
+    RPacketQoS::EMeanThroughput200000,
+    RPacketQoS::EMeanThroughput500000,
+    RPacketQoS::EMeanThroughput1000000,
+    RPacketQoS::EMeanThroughput2000000,
+    RPacketQoS::EMeanThroughput5000000,
+    RPacketQoS::EMeanThroughput10000000,
+    RPacketQoS::EMeanThroughput20000000,
+    RPacketQoS::EMeanThroughput50000000,
+    RPacketQoS::EMeanThroughputBestEffort
+    };
+
+// Maximum SDU size value
+const TInt KMaximumSDUSize = 1500;
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// GetRequestedQoSValues
+// ---------------------------------------------------------------------------
+//
+void TSatQoSParser::GetRequestedQoSValues(
+    RSat::TBearerParams& aParams, 
+    RPacketQoS::TQoSGPRSRequested& aResult)
+    {
+    LOG( SIMPLE, "SATENGINE: TSatQoSParser::GetRequestedQoSValues calling" )
+
+    // Get Precedence class value
+    aResult.iReqPrecedence = TPrecedenceClass[
+        CheckIndex( aParams[KPrecPos], KPrecMaxSize ) ];
+    LOG2( SIMPLE, "  Precedence class:   %i", aParams[KPrecPos] )
+    LOG2( SIMPLE, "  Precedence value:   0x%x", aResult.iReqPrecedence )
+
+    // Get Delay class value
+    aResult.iReqDelay = TDelayClass[
+        CheckIndex( aParams[KDelayPos], KDelayMaxSize ) ];
+    LOG2( SIMPLE, "  Delay class:        %i", aParams[KDelayPos] )
+    LOG2( SIMPLE, "  Delay value:        0x%x", aResult.iReqDelay )
+
+    // Get Reliablility value
+    aResult.iReqReliability = TReliablitityClass[
+        CheckIndex( aParams[KRelPos], KRelMaxSize ) ];
+    LOG2( SIMPLE, "  Reliablility class: %i", aParams[KRelPos] )
+    LOG2( SIMPLE, "  Reliablility value: 0x%x", aResult.iReqReliability )
+
+    // Get Peak value
+    aResult.iReqPeakThroughput = TPeak[
+        CheckIndex( aParams[KPeakPos], KPeakMaxSize ) ];
+    LOG2( SIMPLE, "  Peak througput:     %i", aParams[KPeakPos] )
+    LOG2( SIMPLE, "  Peak througput:     0x%x", aResult.iReqPeakThroughput )
+
+    // Get Mean value
+    if ( KMeanBestEffort != aParams[KMeanPos] )
+        {
+        LOG( SIMPLE, "SATENGINE: TSatQoSParser::GetRequestedQoSValues \
+        KMeanBestEffort != aParams[KMeanPos]" )
+        aResult.iReqMeanThroughput = TMean[
+            CheckIndex( aParams[KMeanPos], KMeanMaxSize ) ];
+        }
+    else
+        {
+        aResult.iReqMeanThroughput = RPacketQoS::EMeanThroughputBestEffort;
+        }
+    LOG2( SIMPLE, "  Mean througput:     %i", aParams[KMeanPos] )
+    LOG2( SIMPLE, "  Mean througput(int):%i", aResult.iReqMeanThroughput )
+
+    LOG( SIMPLE, "SATENGINE: TSatQoSParser::GetRequestedQoSValues exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// GetRequestedQoSValues
+// ---------------------------------------------------------------------------
+//
+void TSatQoSParser::GetNegotiatedQoSValues(
+    const RPacketQoS::TQoSGPRSNegotiated& aNegParams, 
+    RSat::TBearerParams& aResult )
+    {
+    LOG( SIMPLE, "SATENGINE: TSatQoSParser::GetNegotiatedQoSValues calling" )
+
+    aResult.SetLength( KSimQoSSize );
+    TInt index( 0 );
+
+    // Get Precedence class by value
+    for ( index = 0; index < KPrecMaxSize; index++ )
+        {
+        if ( TPrecedenceClass[index] == aNegParams.iPrecedence )
+            {
+             // Found, store index
+            aResult[KPrecPos] = static_cast<TUint8>( index );
+            index = KPrecMaxSize; // Stop loop
+            LOG2( SIMPLE, "  Prececence class:  %i", aResult[KPrecPos] )
+            LOG2( SIMPLE, "  Prececence value:  0x%x", aNegParams.iPrecedence )
+            }
+        }
+    LOG2( SIMPLE, "SATENGINE: TSatQoSParser::GetNegotiatedQoSValues index:%i",
+          index )
+    // Get Delay class by value
+    for ( index = 0; index < KDelayMaxSize; index++ )
+        {
+        if ( TDelayClass[index] == aNegParams.iDelay )
+            {
+             // Found, store index
+            aResult[KDelayPos] = static_cast<TUint8>( index );
+            index = KDelayMaxSize; // Stop loop
+            LOG2( SIMPLE, "  Delay class:       %i", aResult[KDelayPos] )
+            LOG2( SIMPLE, "  Delay value:       0x%x", aNegParams.iDelay )
+            }
+        }
+    LOG2( SIMPLE, "SATENGINE: TSatQoSParser::GetNegotiatedQoSValues index:%i",
+          index )
+    // Get Reliability class by value
+    for ( index = 0; index < KRelMaxSize; index++ )
+        {
+        if ( TReliablitityClass[index] == aNegParams.iReliability )
+            {
+             // Found, store index
+            aResult[KRelPos] = static_cast<TUint8>( index );
+            index = KRelMaxSize; // Stop loop
+            LOG2( SIMPLE, "  Reliability class: %i", aResult[KRelPos] )
+            LOG2( SIMPLE, "  Reliability value: 0x%x", aNegParams.iReliability )
+            }
+        }
+    LOG2( SIMPLE, "SATENGINE: TSatQoSParser::GetNegotiatedQoSValues index:%i",
+          index )
+    // Get Peak by value
+    for ( index = 0; index < KPeakMaxSize; index++ )
+        {
+        if ( TPeak[index] == aNegParams.iPeakThroughput )
+            {
+             // Found, store index
+            aResult[KPeakPos] = static_cast<TUint8>( index );
+            index = KPeakMaxSize; // Stop loop
+            LOG2( SIMPLE, "  Peak class:        %i", aResult[KPeakPos] )
+            LOG2( SIMPLE, "  Peak value:        0x%x", 
+                aNegParams.iPeakThroughput )
+            }
+        }
+    LOG2( SIMPLE, "SATENGINE: TSatQoSParser::GetNegotiatedQoSValues index:%i",
+          index )
+    // Get Mean by value
+    for ( index = 0; index < KMeanMaxSize; index++ )
+        {
+        if ( TMean[index] == aNegParams.iMeanThroughput )
+            {
+            if ( RPacketQoS::EMeanThroughputBestEffort ==
+                aNegParams.iMeanThroughput )
+                {
+                LOG( SIMPLE, "SATENGINE: TSatQoSParser::GetNegotiatedQoSValues \
+                EMeanThroughputBestEffort" )
+                // Best effort is not value '19', handle this case differently
+                aResult[4] = KMeanBestEffort;
+                }
+            else
+                {
+                // All other values are linear from '0' to '18'
+                // store index
+                aResult[KMeanPos] = static_cast<TUint8>( index ); 
+                }
+
+            index = KMeanMaxSize; // Stop loop
+            LOG2( SIMPLE, "  Mean class:        %i", aResult[KMeanPos] )
+            LOG2( SIMPLE, "  Mean value:        0x%x", 
+                aNegParams.iMeanThroughput )
+            }
+        }
+    LOG2( SIMPLE, "SATENGINE: TSatQoSParser::GetNegotiatedQoSValues index:%i",
+          index )
+    LOG( SIMPLE, "SATENGINE: TSatQoSParser::GetNegotiatedQoSValues exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// CheckIndex
+// ---------------------------------------------------------------------------
+//
+TInt TSatQoSParser::CheckIndex( TInt aReqIndex, TInt aMaxIndex )
+    {
+    LOG( SIMPLE, "SATENGINE: TSatQoSParser::CheckIndex calling" )
+    TInt retVal( aReqIndex );
+
+    if ( aMaxIndex < aReqIndex )
+        {
+        LOG( SIMPLE, "SATENGINE: TSatQoSParser::CheckIndex \
+        aMaxIndex < aReqIndex" )
+        retVal = 0;
+        }
+    LOG( SIMPLE, "SATENGINE: TSatQoSParser::CheckIndex exiting" )
+    return retVal;    
+    }
+
+// ---------------------------------------------------------------------------
+// Convert QoS parameters from Rel97/98 format to Rel5 format
+// ---------------------------------------------------------------------------
+//
+TSatQoSParser::TQoSRel5 TSatQoSParser::ConvertQoS( 
+    const RPacketQoS::TQoSGPRSRequested& aReqParams )
+    {
+    LOG( SIMPLE, "SATENGINE: TSatQoSParser::ConvertQoS calling" )
+    
+    TQoSRel5 qos;
+    LOG2( SIMPLE, "SATENGINE: TSatQoSParser::ConvertQoS \
+          aReqParams.iReqDelay: %i", aReqParams.iReqDelay )
+    // Map Delay class value to Traffic class/Traffic handling priority
+    // Delay Class ----------- Traffic Class
+    // 1,2,3                    Interactive
+    // 4                        Background
+    // Delay Class ----------- Traffic Handling priority
+    // 1                            1
+    // 2                            2
+    // 3                            3
+    // 4                            unspecified
+    switch ( aReqParams.iReqDelay )
+        {
+        case RPacketQoS::EDelayClass1:
+            {
+            qos.iTrafficClass = RPacketQoS::ETrafficClassInteractive;
+            qos.iTrafficHandlingPriority = RPacketQoS::ETrafficPriority1;
+            break;
+            }
+        case RPacketQoS::EDelayClass2:
+            {
+            qos.iTrafficClass = RPacketQoS::ETrafficClassInteractive;
+            qos.iTrafficHandlingPriority = RPacketQoS::ETrafficPriority2;
+            break;
+            }
+        case RPacketQoS::EDelayClass3:
+            {
+            qos.iTrafficClass = RPacketQoS::ETrafficClassInteractive;
+            qos.iTrafficHandlingPriority = RPacketQoS::ETrafficPriority3;
+            break;
+            }
+        case RPacketQoS::EDelayClass4:
+            {
+            qos.iTrafficClass = RPacketQoS::ETrafficClassBackground;
+            qos.iTrafficHandlingPriority = RPacketQoS::ETrafficPriorityUnspecified;
+            break;    
+            }
+        default:
+            {
+            qos.iTrafficClass = RPacketQoS::ETrafficClassUnspecified;
+            qos.iTrafficHandlingPriority = RPacketQoS::ETrafficPriorityUnspecified;
+            break;    
+            }
+        }
+    LOG2( SIMPLE, "SATENGINE: TSatQoSParser::ConvertQoS \
+          aReqParams.iReqReliability: %i", aReqParams.iReqReliability )
+    // Map Reliability class value to SDU error ratio/
+    // Residual bit error ratio/Delivery of erroneous SDUs
+    // Reliability Class ----------- SDU error ratio
+    //  1,2                             0.000001
+    //  3                               0.0001
+    //  4,5                             0.001
+    // Reliability Class ----------- Residual bit error ratio
+    //  1,2,3,4                         0.00001
+    //  5                               0.004  
+    // Reliability Class ----------- Delivery of erroneous SDUs
+    //  1,2,3,4                         No        
+    //  5                               Yes
+    switch ( aReqParams.iReqReliability )
+        {
+        case RPacketQoS::EReliabilityClass1:
+            {
+            qos.iSduErrorRatio = 
+                RPacketQoS::ESDUErrorRatioOnePerMillion;
+            qos.iResidualBer = RPacketQoS::EBEROnePerHundredThousand;
+            qos.iDeliveryErroneousSdu = 
+                RPacketQoS::EErroneousSDUDeliveryNotRequired;
+            break;
+            }
+        case RPacketQoS::EReliabilityClass2:
+            {
+            qos.iSduErrorRatio = RPacketQoS::ESDUErrorRatioOnePerMillion;
+            qos.iResidualBer = RPacketQoS::EBEROnePerHundredThousand;
+            qos.iDeliveryErroneousSdu = 
+                RPacketQoS::EErroneousSDUDeliveryNotRequired;
+            break;
+            }
+        case RPacketQoS::EReliabilityClass3:
+            {
+            qos.iSduErrorRatio = 
+                RPacketQoS::ESDUErrorRatioOnePerTenThousand;
+            qos.iResidualBer = RPacketQoS::EBEROnePerHundredThousand;
+            qos.iDeliveryErroneousSdu = 
+                RPacketQoS::EErroneousSDUDeliveryNotRequired;
+            break;
+            }
+        case RPacketQoS::EReliabilityClass4:
+            {
+            qos.iSduErrorRatio = RPacketQoS::ESDUErrorRatioOnePerThousand;
+            qos.iResidualBer = RPacketQoS::EBEROnePerHundredThousand;
+            qos.iDeliveryErroneousSdu = 
+                RPacketQoS::EErroneousSDUDeliveryNotRequired;
+            break;
+            }
+        case RPacketQoS::EReliabilityClass5:
+            {
+            qos.iSduErrorRatio = RPacketQoS::ESDUErrorRatioOnePerThousand;
+            qos.iResidualBer = RPacketQoS::EBERFourPerThousand;
+            qos.iDeliveryErroneousSdu = 
+                RPacketQoS::EErroneousSDUDeliveryRequired;
+            break;
+            }    
+        default:
+            {
+            qos.iSduErrorRatio = RPacketQoS::ESDUErrorRatioUnspecified;
+            qos.iResidualBer = RPacketQoS::EBERUnspecified;
+            qos.iDeliveryErroneousSdu = 
+                RPacketQoS::EErroneousSDUDeliveryNotRequired;
+            break;
+            }
+        }
+    LOG2( SIMPLE, "SATENGINE: TSatQoSParser::ConvertQoS \
+          aReqParams.iReqPeakThroughput: %i", aReqParams.iReqPeakThroughput )
+    // Map Peak throughout class value to Maximum bitrate[kbps]
+    // Peak throughout Class ---- Maximum bitrate[kbps]
+    //      1                               8                               
+    //      2                               16
+    //      3                               32
+    //      4                               64
+    //      5                               128
+    //      6                               256
+    //      7                               512
+    //      8                               1024    
+    //      9                               2048
+    switch ( aReqParams.iReqPeakThroughput )
+        {
+        case RPacketQoS::EPeakThroughput1000:
+            {
+            qos.iMaxBitRate = ESatMaxBitRate1;
+            break;
+            }
+            
+        case RPacketQoS::EPeakThroughput2000:
+            {
+            qos.iMaxBitRate = ESatMaxBitRate2;
+            break;
+            }
+        case RPacketQoS::EPeakThroughput4000:
+            {
+            qos.iMaxBitRate = ESatMaxBitRate3;
+            break;
+            }
+        case RPacketQoS::EPeakThroughput8000:
+            {
+            qos.iMaxBitRate = ESatMaxBitRate4;
+            break;
+            }
+        case RPacketQoS::EPeakThroughput16000:
+            {
+            qos.iMaxBitRate = ESatMaxBitRate5;
+            break;
+            }
+        case RPacketQoS::EPeakThroughput32000:
+            {
+            qos.iMaxBitRate = ESatMaxBitRate6;
+            break;
+            }
+        case RPacketQoS::EPeakThroughput64000:
+            {
+            qos.iMaxBitRate = ESatMaxBitRate7;
+            break;    
+            }
+        case RPacketQoS::EPeakThroughput128000:
+            {
+            qos.iMaxBitRate = ESatMaxBitRate8;
+            break;    
+            }
+        case RPacketQoS::EPeakThroughput256000:
+            {
+            qos.iMaxBitRate = ESatMaxBitRate9;
+            break;    
+            }    
+        default:
+            {
+            qos.iMaxBitRate = ESatMaxBitRateUnspecified;
+            break;    
+            }
+        }
+    
+    // Fixed value
+    qos.iMaximumSDUSize = KMaximumSDUSize;
+    qos.iDeliveryOrder = RPacketQoS::EDeliveryOrderNotRequired;
+    	
+    LOG( SIMPLE, "SATENGINE: TSatQoSParser::ConvertQoS exiting" )
+    
+    return qos;
+    }
+
+// ---------------------------------------------------------------------------
+// Convert QoS parameters from Rel5 format to Rel97/98 format
+// ---------------------------------------------------------------------------
+//
+RPacketQoS::TQoSGPRSNegotiated TSatQoSParser::ConvertNegotiatedQoS(
+    const TQoSRel5& aNegQoSRel5 )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::ConvertNegotiatedQoS \
+        calling" )
+    
+    RPacketQoS::TQoSGPRSNegotiated negQos;
+    LOG2( SIMPLE, "SATENGINE: TSatQoSParser::ConvertNegotiatedQoS \
+          aNegQoSRel5.iTrafficClass: %i", aNegQoSRel5.iTrafficClass )
+    // Map Traffic class/Traffic handling priority to Delay class value
+    // Traffic Class/Traffic Handling priority----------- Delay Class
+    // conversational                                       1
+    // streaming                                            1
+    // Interactive/1                                        1
+    // Interactive/2                                        2
+    // Interactive/3                                        3
+    // Background                                           4
+    
+    switch ( aNegQoSRel5.iTrafficClass )
+        {
+        case RPacketQoS::ETrafficClassConversational:
+            {
+            negQos.iDelay = RPacketQoS::EDelayClass1;
+            break;
+            }
+        case RPacketQoS::ETrafficClassStreaming:
+            {
+            negQos.iDelay = RPacketQoS::EDelayClass1;
+            break;
+            }
+        case RPacketQoS::ETrafficClassInteractive:
+            {
+            LOG2( SIMPLE, "SATENGINE: TSatQoSParser::ConvertNegotiatedQoS \
+            priority: %i", aNegQoSRel5.iTrafficHandlingPriority )
+            switch ( aNegQoSRel5.iTrafficHandlingPriority )
+                {
+                case RPacketQoS::ETrafficPriority1:
+                    {
+                    negQos.iDelay = RPacketQoS::EDelayClass1;
+                    break;
+                    }
+                case RPacketQoS::ETrafficPriority2:
+                    {
+                    negQos.iDelay = RPacketQoS::EDelayClass2;
+                    break;
+                    }
+                case RPacketQoS::ETrafficPriority3:
+                    {
+                    negQos.iDelay = RPacketQoS::EDelayClass3;
+                    break;
+                    }
+                default:
+                    {
+                    negQos.iDelay = RPacketQoS::EUnspecifiedDelayClass;
+                    break;
+                    }
+                }
+            break;
+            }
+        case RPacketQoS::ETrafficClassBackground:
+            {
+            negQos.iDelay = RPacketQoS::EDelayClass4;
+            break;    
+            }
+        default:
+            {
+            negQos.iDelay = RPacketQoS::EUnspecifiedDelayClass;
+            break;    
+            }
+        }
+    LOG2( SIMPLE, "SATENGINE: TSatQoSParser::ConvertNegotiatedQoS \
+          aNegQoSRel5.iSduErrorRatio: %i", aNegQoSRel5.iSduErrorRatio )
+    // Map SDU error ratio/Residual bit error ratio to Reliability value
+    // SDU error ratio/Residual bit error ratio -------- Reliability Class
+    // 0.000001                                                     2
+    // 0.00001                                                      2
+    // 0.0001                                                       3
+    // 0.001,0.007,0.01,0.1/0.0001,0.00001, 0.000001,0.00000006     4                         
+    // 0.001,0.007,0.01,0.1/0.001,0.004,0.005,0.01,0.05             5
+    switch ( aNegQoSRel5.iSduErrorRatio )
+        {
+        case RPacketQoS::ESDUErrorRatioOnePerHundredThousand:
+        case RPacketQoS::ESDUErrorRatioOnePerMillion:
+            {
+            negQos.iReliability = RPacketQoS::EReliabilityClass2;
+            break;
+            }
+        case RPacketQoS::ESDUErrorRatioOnePerTenThousand:
+            {
+            negQos.iReliability = RPacketQoS::EReliabilityClass3;
+            break;
+            }
+        case RPacketQoS::ESDUErrorRatioOnePerThousand:
+        case RPacketQoS::ESDUErrorRatioSevenPerThousand:
+        case RPacketQoS::ESDUErrorRatioOnePerHundred:
+        case RPacketQoS::ESDUErrorRatioOnePerTen:
+            {
+            LOG2( SIMPLE, "SATENGINE: TSatQoSParser::ConvertNegotiatedQoS \
+            aNegQoSRel5.iResidualBer: %i", aNegQoSRel5.iResidualBer )
+            switch( aNegQoSRel5.iResidualBer )
+                {
+                case RPacketQoS::EBEROnePerTenThousand:
+                case RPacketQoS::EBEROnePerHundredThousand:
+                case RPacketQoS::EBEROnePerMillion:
+                case RPacketQoS::EBERSixPerHundredMillion:
+                    {
+                    negQos.iReliability = RPacketQoS::EReliabilityClass4;
+                    break;
+                    }
+                case RPacketQoS::EBERFivePerHundred:
+                case RPacketQoS::EBEROnePerHundred:
+                case RPacketQoS::EBERFivePerThousand:
+                case RPacketQoS::EBERFourPerThousand:
+                case RPacketQoS::EBEROnePerThousand: 
+                    {
+                    negQos.iReliability = RPacketQoS::EReliabilityClass5;
+                    break;
+                    }
+                default:
+                    {
+                    negQos.iReliability = RPacketQoS::EUnspecifiedReliabilityClass;
+                    break;
+                    }
+                }
+            break;
+            }
+        default:
+            {
+            negQos.iReliability = RPacketQoS::EUnspecifiedReliabilityClass;
+            break;
+            }
+        }
+        
+    // Map Maximum bitrate [kbps] to Peak throughout class
+    // Maximum bitrate[kbps] ---- Peak throughout Class
+    // 
+    //      < 16                               1                               
+    //      16 <= x < 32                       2
+    //      32 <= x < 64                       3
+    //      64 <= x < 128                      4
+    //      128 <= x < 256                     5
+    //      256 <= x < 512                     6
+    //      512 <= x < 1024                    7
+    //      1024 <= x < 2048                   8    
+    //      >= 2048                            9
+    if ( aNegQoSRel5.iMaxBitRate < ESatMaxBitRate2 )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::\
+             ConvertNegotiatedQoS rate: rate< 16" )
+        negQos.iPeakThroughput = RPacketQoS::EPeakThroughput1000;
+        }
+    else if ( ( aNegQoSRel5.iMaxBitRate < ESatMaxBitRate3 ) && 
+                ( aNegQoSRel5.iMaxBitRate >= ESatMaxBitRate2 ) )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::\
+             ConvertNegotiatedQoS rate: 16 <= rate < 32" )
+        negQos.iPeakThroughput = RPacketQoS::EPeakThroughput2000;
+        }
+    else if ( ( aNegQoSRel5.iMaxBitRate < ESatMaxBitRate4 ) && 
+                ( aNegQoSRel5.iMaxBitRate >= ESatMaxBitRate3 ) )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::\
+             ConvertNegotiatedQoS rate: 32 <= rate < 64" )
+        negQos.iPeakThroughput = RPacketQoS::EPeakThroughput4000;
+        }
+    else if ( ( aNegQoSRel5.iMaxBitRate < ESatMaxBitRate5 ) && 
+                ( aNegQoSRel5.iMaxBitRate >= ESatMaxBitRate4 ) )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::\
+             ConvertNegotiatedQoS rate: 64 <= rate < 128" )
+        negQos.iPeakThroughput = RPacketQoS::EPeakThroughput8000;
+        }
+    else if ( ( aNegQoSRel5.iMaxBitRate < ESatMaxBitRate6 ) && 
+                ( aNegQoSRel5.iMaxBitRate >= ESatMaxBitRate5 ) )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::\
+             ConvertNegotiatedQoS rate: 128 <= rate < 256" )
+        negQos.iPeakThroughput = RPacketQoS::EPeakThroughput16000;
+        }
+    else if ( ( aNegQoSRel5.iMaxBitRate < ESatMaxBitRate7 ) && 
+                ( aNegQoSRel5.iMaxBitRate >= ESatMaxBitRate6 ) )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::\
+             ConvertNegotiatedQoS rate: 256 <= rate < 512" )
+        negQos.iPeakThroughput = RPacketQoS::EPeakThroughput32000;
+        }
+    else if ( ( aNegQoSRel5.iMaxBitRate < ESatMaxBitRate8 ) && 
+                ( aNegQoSRel5.iMaxBitRate >= ESatMaxBitRate7 ) )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::\
+             ConvertNegotiatedQoS rate: 512 <= rate < 1024" )
+        negQos.iPeakThroughput = RPacketQoS::EPeakThroughput64000;
+        }
+    else if ( ( aNegQoSRel5.iMaxBitRate < ESatMaxBitRate9 ) && 
+                ( aNegQoSRel5.iMaxBitRate >= ESatMaxBitRate8 ) )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::\
+             ConvertNegotiatedQoS rate: 1024 <= rate < 2048" )
+        negQos.iPeakThroughput = RPacketQoS::EPeakThroughput128000;
+        }
+    else if ( aNegQoSRel5.iMaxBitRate >= ESatMaxBitRate9 )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::\
+             ConvertNegotiatedQoS rate: rate >= 2048" )
+        negQos.iPeakThroughput = RPacketQoS::EPeakThroughput256000;
+        }
+    else
+        {
+        LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::\
+             ConvertNegotiatedQoS others" )
+        negQos.iPeakThroughput = RPacketQoS::EUnspecifiedPeakThroughput;
+        }
+    
+    // Fixed value
+    // UE shall set the R97/98 precedence class to value "subscribed"  
+    negQos.iPrecedence = RPacketQoS::EUnspecifiedPrecedence;
+    // Always set to 31, best effort
+    negQos.iMeanThroughput = RPacketQoS::EMeanThroughputBestEffort;  
+    
+    LOG( SIMPLE, "SATENGINE: CSatBIPGPRSDataChannel::ConvertNegotiatedQoS \
+        exiting" )
+    
+    return negQos;
+    }
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/TUSatAPI.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,1075 @@
+/*
+* 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:  Wrapper for usat api.
+*
+*/
+
+
+#include    <satcs.h>
+#include    "TUSatAPI.h"
+#include    "SatLog.h"
+#include    "msatmultimodeapi.h"
+#include    "csatsactivewrapper.h"
+
+const TInt KSatSLoopTimeout = 3000000;
+const TInt KLoopMaxTryouts = 5; // Max tryouts for loops
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::TUSatAPI
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+TUSatAPI::TUSatAPI() :
+    iSat(),
+    iRSatConnected( EFalse ),
+    iWrapper( NULL )
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::TUSatAPI calling - exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::Connect
+// Connects to USAT API.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt TUSatAPI::Connect( MSatMultiModeApi& aPhone )
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::Connect calling" )
+
+    TInt numberOfTries( 1 );        // Indicates loop tryouts
+    TBool loopSuccess( EFalse );    // Loop stopper, if this is ETrue
+    TInt error( KErrNotSupported ); // Error code from iSat.Open()
+    iRSatConnected = EFalse;
+
+    // Create active wrapper
+    iWrapper = new CSatSActiveWrapper();
+
+    if ( iWrapper )
+        {        
+        while ( !loopSuccess && numberOfTries <= KLoopMaxTryouts )
+            {
+#ifndef SAT_USE_DUMMY_TSY
+            LOG( NORMAL, "SATENGINE: TUSatAPI::Connect connect Phone" )
+            error = iSat.Open( *( aPhone.Phone() ) );
+#else
+            LOG( NORMAL, "SATENGINE: TUSatAPI::Connect connect DummyPhone" )
+            error = iSat.Open( *( aPhone.DummyPhone() ) );
+#endif
+            if ( KErrNone == error )
+                {
+                LOG( SIMPLE, "SATENGINE: TUSatAPI::Connect KErrNone == error" )
+                loopSuccess = ETrue;
+                iRSatConnected = ETrue;
+                }
+            else
+                {
+                numberOfTries++;
+                iWrapper->After( KSatSLoopTimeout );
+                }
+            }
+        LOG2( SIMPLE, "SATENGINE: TUSatAPI::Connect numberOfTries: %d", 
+              numberOfTries )
+        }
+
+    LOG2( SIMPLE, "SATENGINE: TUSatAPI::Connect exiting with code: %i", error )
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::Close
+// Closes the connection.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::Close()
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::Close calling" )
+
+    iSat.Close();
+    iRSatConnected = EFalse;
+
+    if ( iWrapper )
+        {
+        LOG( SIMPLE, "SATENGINE: TUSatAPI::Close iWrapper true" )
+        iWrapper->CancelWrapper();
+        delete iWrapper;
+        iWrapper = NULL;
+        }
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::Close exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifySetUpMenu
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifySetUpMenu(
+    TRequestStatus& aStatus,
+    TDes8& aPCmd )
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySetUpMenu calling" )
+
+    iSat.NotifySetUpMenuPCmd( aStatus, aPCmd );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySetUpMenu exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifySetUpMenuCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifySetUpMenuCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySetUpMenuCancel calling" )
+
+    iSat.CancelAsyncRequest( ESatNotifySetUpMenuPCmd );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySetUpMenuCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifyLanguageNotification
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifyLanguageNotification(
+    TRequestStatus& aStatus,
+    TDes8& aPCmd )
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyLanguageNotification calling" )
+
+    iSat.NotifyLanguageNotificationPCmd( aStatus, aPCmd );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyLanguageNotification exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifyLanguageNotification
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifyLanguageNotificationCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySetUpMenuCancel calling" )
+
+    iSat.CancelAsyncRequest( ESatNotifyLanguageNotificationPCmd );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySetUpMenuCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifySetUpCall
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifySetUpCall(
+    TRequestStatus& aStatus,
+    TDes8& aPCmd )
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySetUpCall calling" )
+
+    iSat.NotifySetUpCallPCmd( aStatus, aPCmd );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySetUpCall exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifySetUpCallCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifySetUpCallCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySetUpCallCancel calling" )
+
+    iSat.CancelAsyncRequest( ESatNotifySetUpCallPCmd );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySetUpCallCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifySelectItem
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifySelectItem(
+    TRequestStatus& aStatus,
+    TDes8& aPCmd )
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySelectItem calling" )
+
+    iSat.NotifySelectItemPCmd( aStatus, aPCmd );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySelectItem exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifySelectItemCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifySelectItemCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySelectItemCancel calling" )
+
+    iSat.CancelAsyncRequest( ESatNotifySelectItemPCmd );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySelectItemCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifySendSm
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifySendSm(
+    TRequestStatus& aStatus,
+    TDes8& aPCmd )
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySendSm calling" )
+
+    iSat.NotifySendSmPCmd( aStatus, aPCmd );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySendSm exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifySendSmCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifySendSmCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySendSmCancel calling" )
+
+    iSat.CancelAsyncRequest( ESatNotifySendSmPCmd );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySendSmCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::SendMessageNoLogging
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::SendMessageNoLogging(
+    TRequestStatus& aStatus,
+    TDes8& aData,
+    TUint16& aRefMsg )
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::SendMessageNoLogging calling" )
+
+    iSat.SendMessageNoLogging( aStatus, aData, aRefMsg );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::SendMessageNoLogging exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::SendMessageNoLoggingCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::SendMessageNoLoggingCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::SendMessageNoLoggingCancel calling" )
+
+    iSat.CancelAsyncRequest( ESatSendMessageNoLogging );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::SendMessageNoLoggingCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifyLaunchBrowser
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifyLaunchBrowser(
+    TRequestStatus& aStatus,
+    TDes8& aData )
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyLaunchBrowser calling" )
+
+    iSat.NotifyLaunchBrowserPCmd( aStatus, aData );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyLaunchBrowser exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifyLaunchBrowserCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifyLaunchBrowserCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyLaunchBrowserCancel calling" )
+
+    iSat.CancelAsyncRequest( ESatNotifyLaunchBrowserPCmd );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyLaunchBrowserCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifyDisplayText
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifyDisplayText(
+    TRequestStatus& aStatus,
+    TDes8& aData )
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyDisplayText calling" )
+
+    iSat.NotifyDisplayTextPCmd( aStatus, aData );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyDisplayText exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifyDisplayTextCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifyDisplayTextCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyDisplayTextCancel calling" )
+
+    iSat.CancelAsyncRequest( ESatNotifyDisplayTextPCmd );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyDisplayTextCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifyGetInput
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifyGetInput(
+    TRequestStatus& aStatus,
+    TDes8& aData )
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyGetInput calling" )
+
+    iSat.NotifyGetInputPCmd( aStatus, aData );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyGetInput exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifyGetInputCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifyGetInputCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyGetInputCancel calling" )
+
+    iSat.CancelAsyncRequest( ESatNotifyGetInputPCmd );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyGetInputCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifyGetInkey
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifyGetInkey(
+    TRequestStatus& aStatus,
+    TDes8& aData )
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyGetInkey calling" )
+
+    iSat.NotifyGetInkeyPCmd( aStatus, aData );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyGetInkey exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifyGetInkeyCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifyGetInkeyCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyGetInkeyCancel calling" )
+
+    iSat.CancelAsyncRequest( ESatNotifyGetInkeyPCmd );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyGetInkeyCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifyCallControl
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifyCallControl(
+    TRequestStatus& aStatus,
+    TDes8& aData )
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyCallControl calling" )
+
+    iSat.NotifyCallControlRequest( aStatus, aData );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyCallControl exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifyCallControlCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifyCallControlCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyCallControlCancel calling" )
+
+    iSat.CancelAsyncRequest( ESatNotifyCallControlRequest );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyCallControlCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifyMoSmControl
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifyMoSmControl(
+    TRequestStatus& aStatus,
+    TDes8& aData )
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyMoSmControl calling" )
+
+    iSat.NotifyMoSmControlRequest( aStatus, aData );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyMoSmControl exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifyMoSmControlCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifyMoSmControlCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyMoSmControlCancel calling" )
+
+    iSat.CancelAsyncRequest( ESatNotifyMoSmControlRequest );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyMoSmControlCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifySetUpEventList
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifySetUpEventList(
+    TRequestStatus& aStatus,
+    TDes8& aData )
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySetUpEventList calling" )
+
+    iSat.NotifySetUpEventListPCmd( aStatus, aData );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySetUpEventList exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifySetUpEventListCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifySetUpEventListCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySetUpEventListCancel calling" )
+
+    iSat.CancelAsyncRequest( ESatNotifySetUpEventListPCmd );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySetUpEventListCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifySetUpIdleModeText
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifySetUpIdleModeText(
+    TRequestStatus& aStatus,
+    TDes8& aData )
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySetUpIdleModeText calling" )
+
+    iSat.NotifySetUpIdleModeTextPCmd( aStatus, aData );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySetUpIdleModeText exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifySetUpIdleModeTextCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifySetUpIdleModeTextCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySetUpIdleModeTextCancel calling" )
+
+    iSat.CancelAsyncRequest( ESatNotifySetUpIdleModeTextPCmd );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySetUpIdleModeTextCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifySendDtmf
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifySendDtmf(
+    TRequestStatus& aStatus,
+    TDes8& aData )
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySendDtmf calling" )
+
+    iSat.NotifySendDtmfPCmd( aStatus, aData );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySendDtmf exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifySendDtmfCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifySendDtmfCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySendDtmfCancel calling" )
+
+    iSat.CancelAsyncRequest( ESatNotifySendDtmfPCmd );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySendDtmfCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifySendSs
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifySendSs(
+    TRequestStatus& aStatus,
+    TDes8& aData )
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySendSs calling" )
+
+    iSat.NotifySendSsPCmd( aStatus, aData );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySendSs exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifySendSsCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifySendSsCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySendSsCancel calling" )
+
+    iSat.CancelAsyncRequest( ESatNotifySendSsPCmd );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySendSsCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifySendUssd
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifySendUssd(
+    TRequestStatus& aStatus,
+    TDes8& aData )
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySendUssd calling" )
+
+    iSat.NotifySendUssdPCmd( aStatus, aData );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySendUssd exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifySendUssdCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifySendUssdCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySendUssdCancel calling" )
+
+    iSat.CancelAsyncRequest( ESatNotifySendUssdPCmd );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySendUssdCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifyPlayTone
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifyPlayTone(
+    TRequestStatus& aStatus,
+    TDes8& aData )
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyPlayTone calling" )
+
+    iSat.NotifyPlayTonePCmd( aStatus, aData );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyPlayTone exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifyPlayToneCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifyPlayToneCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyPlayToneCancel calling" )
+
+    iSat.CancelAsyncRequest( ESatNotifyPlayTonePCmd );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyPlayToneCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifyRefreshRequired
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifyRefreshRequired(
+    TRequestStatus& aStatus,
+    TDes8& aData )
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyRefreshRequired calling" )
+
+    iSat.NotifyRefreshRequired( aStatus, aData );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyRefreshRequired exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifyRefreshRequiredCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifyRefreshRequiredCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyRefreshRequiredCancel calling" )
+
+    iSat.CancelAsyncRequest( ESatNotifyRefreshRequiredParam );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyRefreshRequiredCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::RefreshAllowed
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::RefreshAllowed(
+    const TDesC8& aPCkg )
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::RefreshAllowed calling" )
+
+    if ( iWrapper )
+        {
+        LOG( SIMPLE, "SATENGINE: TUSatAPI::RefreshAllowed iWrapper true" )
+        iSat.RefreshAllowed( iWrapper->RequestStatus(), aPCkg );
+        iWrapper->SetActiveAndWait();
+        }
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::RefreshAllowed exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifyRefresh
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifyRefresh(
+    TRequestStatus& aStatus,
+    TDes8& aData )
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyRefresh calling" )
+
+    iSat.NotifyRefreshPCmd( aStatus, aData );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyRefresh exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifyRefreshCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifyRefreshCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyRefreshCancel calling" )
+
+    iSat.CancelAsyncRequest( ESatNotifyRefreshPCmd );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyRefreshCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifySimSessionEnd
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifySimSessionEnd( TRequestStatus& aStatus )
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySimSessionEnd calling" )
+
+    iSat.NotifyProactiveSimSessionEnd( aStatus );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySimSessionEnd exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifySimSessionEndCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifySimSessionEndCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySimSessionEndCancel calling" )
+
+    iSat.CancelAsyncRequest( ESatNotifyProactiveSimSessionEnd );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySimSessionEndCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifyLocalInfo
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifyLocalInfo(
+    TRequestStatus& aStatus,
+    TDes8& aData )
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyLocalInfo calling" )
+
+    iSat.NotifyLocalInfoPCmd( aStatus, aData );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyLocalInfo exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifyLocalInfoCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifyLocalInfoCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyLocalInfoCancel calling" )
+
+    iSat.CancelAsyncRequest( ESatNotifyLocalInfoPCmd );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyLocalInfoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifyOpenChannel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifyOpenChannel(
+    TRequestStatus& aStatus,
+    TDes8& aData )
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyOpenChannel calling" )
+
+    iSat.NotifyOpenChannelPCmd( aStatus, aData );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyOpenChannel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifyOpenChannelCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifyOpenChannelCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyOpenChannelCancel calling" )
+
+    iSat.CancelAsyncRequest( ESatNotifyOpenChannelPCmd );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyOpenChannelCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifyCloseChannel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifyCloseChannel(
+    TRequestStatus& aStatus,
+    TDes8& aData )
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyCloseChannel calling" )
+
+    iSat.NotifyCloseChannelPCmd( aStatus, aData );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyCloseChannel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifyCloseChannelCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifyCloseChannelCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyCloseChannelCancel calling" )
+
+    iSat.CancelAsyncRequest( ESatNotifyCloseChannelPCmd );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyCloseChannelCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifyGetChannelStatus
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifyGetChannelStatus(
+    TRequestStatus& aStatus,
+    TDes8& aData )
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyGetChannelStatus calling" )
+
+    iSat.NotifyGetChannelStatusPCmd( aStatus, aData );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyGetChannelStatus exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifyGetChannelStatusCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifyGetChannelStatusCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyGetChannelStatusCancel calling" )
+
+    iSat.CancelAsyncRequest( ESatNotifyGetChannelStatusPCmd );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyGetChannelStatusCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifySendData
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifySendData(
+    TRequestStatus& aStatus,
+    TDes8& aData )
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySendData calling" )
+
+    iSat.NotifySendDataPCmd( aStatus, aData );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySendData exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifySendDataCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifySendDataCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySendDataCancel calling" )
+
+    iSat.CancelAsyncRequest( ESatNotifySendDataPCmd );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifySendDataCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifyReceiveData
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifyReceiveData(
+    TRequestStatus& aStatus,
+    TDes8& aData )
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyReceiveData calling" )
+
+    iSat.NotifyReceiveDataPCmd( aStatus, aData );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyReceiveData exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::NotifyReceiveDataCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::NotifyReceiveDataCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyReceiveDataCancel calling" )
+
+    iSat.CancelAsyncRequest( ESatNotifyReceiveDataPCmd );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::NotifyReceiveDataCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::SendMenuSelection
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::SendMenuSelection( const TDes8& aMenuSelection )
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::SendMenuSelection calling" )
+
+    if ( iWrapper )
+        {
+        LOG( SIMPLE, "SATENGINE: TUSatAPI::SendMenuSelection iWrapper true" )
+        iSat.MenuSelection( iWrapper->RequestStatus(), aMenuSelection );
+        iWrapper->SetActiveAndWait();
+        }
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::SendMenuSelection exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatApi::TerminalRsp
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::TerminalRsp(
+    RSat::TPCmd aPCmd, // Identifies the command, which is sending the response
+    const TDesC8& aRsp ) // Resposen data package
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::TerminalRsp calling" )
+
+    if ( iWrapper )
+        {
+        LOG( SIMPLE, "SATENGINE: TUSatAPI::TerminalRsp iWrapper true" )
+        iSat.TerminalRsp( iWrapper->RequestStatus(), aPCmd, aRsp );
+        iWrapper->SetActiveAndWait();
+        }
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::TerminalRsp exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::GetIcon
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::GetIcon(
+    TRequestStatus& aReqStatus,
+    TUint8 aRecordNumber,
+    RSat::TIcon& aIconEf )
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::GetIcon calling" )
+
+    iSat.GetIcon( aReqStatus, aRecordNumber, aIconEf );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::GetIcon exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::GetImageInstance
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::GetImageInstance(
+    TRequestStatus& aReqStatus,
+    const TDesC8& aInstanceInfo,
+    TDes8& aInstance )
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::GetImageInstance calling" )
+
+    iSat.GetImageInstance( aReqStatus, aInstanceInfo, aInstance );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::GetImageInstance exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::GetClut
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::GetClut(
+    TRequestStatus& aReqStatus,
+    TUint aInstanceNumber,
+    TUint aOffset,
+    TDes8& aClut )
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::GetClut calling" )
+
+    iSat.GetClut( aReqStatus, aInstanceNumber, aOffset, aClut );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::GetClut exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::EventDownload
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TUSatAPI::EventDownload(
+    TRequestStatus& aReqStatus,
+    RSat::TEventList aSingleEvent,
+    const TDesC8& aEventInfo )
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::EventDownload calling" )
+
+    iSat.EventDownload( aReqStatus, aSingleEvent, aEventInfo );
+
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::EventDownload exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// TUSatAPI::IsRSatConnected
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool TUSatAPI::IsRSatConnected() const
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::IsRSatConnected calling-exiting" )
+    return iRSatConnected;
+    }
+// -----------------------------------------------------------------------------
+// TUSatAPI::UsatClientReadyIndication
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt TUSatAPI::UsatClientReadyIndication()
+    {
+    LOG( SIMPLE, "SATENGINE: TUSatAPI::UsatClientReadyIndication calling-exit")
+
+    return iSat.UsatClientReadyIndication();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/csatbipconnectionobserver.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -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:  Observer of the GPRS connection status change
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <etelpckt.h>
+#include <pcktcs.h> // for EPacketNotifyStatusChange in DoCancel
+#include "csatbipconnectionobserver.h"
+#include "CSatBIPUtils.h"
+#include "SatLog.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSatBIPConnectionObserver::CSatBIPConnectionObserver
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatBIPConnectionObserver::CSatBIPConnectionObserver(
+    CSatBIPUtils& aBipUtils ) :
+    CActive( EPriorityNormal ),
+    iBipUtils( aBipUtils )
+    {
+    LOG( NORMAL, "SATENGINE: CSatBIPConnectionObserver::\
+        CSatBIPConnectionObserver calling" )
+    CActiveScheduler::Add( this );
+    // Get current status
+    iBipUtils.PacketService().GetStatus( iConnectionStatus );
+    // Set last status
+    iPrevConnectionStatus = iConnectionStatus;
+    LOG2( NORMAL, "SATENGINE: CSatBIPConnectionObserver::\
+        CSatBIPConnectionObserver exiting: %i", iConnectionStatus )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBIPConnectionObserver::~CSatBIPConnectionObserver
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CSatBIPConnectionObserver::~CSatBIPConnectionObserver()
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatBIPConnectionObserver::~CSatBIPConnectionObserver \
+        calling" )
+    Cancel();
+    LOG( SIMPLE,
+        "SATENGINE: CSatBIPConnectionObserver::~CSatBIPConnectionObserver \
+        exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBIPConnectionObserver::RunL
+// -----------------------------------------------------------------------------
+//
+void CSatBIPConnectionObserver::RunL()
+    {
+    LOG( NORMAL, "SATENGINE: CSatBIPConnectionObserver::RunL calling" )
+
+    const TInt errStatus( iStatus.Int() );
+    LOG2( SIMPLE, " RunL (%i)", errStatus )
+    LOG2( SIMPLE, " ConnStatus (%i)", iConnectionStatus )
+    if ( KErrNone == errStatus )
+        {
+        //if previous status is active packet data connection and
+        //current status is inactive packet data connection, drop links.
+        if( RPacketService::EStatusActive == iPrevConnectionStatus && 
+            ( RPacketService::EStatusAttached == iConnectionStatus || 
+            RPacketService::EStatusUnattached == iConnectionStatus ))
+            {
+            LOG( NORMAL, "CSatBIPConnectionObserver::RunL stop UDP link" )
+            iBipUtils.StopUdpLink();
+            }
+        
+        // Restart request
+        iPrevConnectionStatus = iConnectionStatus;
+        iBipUtils.PacketService().NotifyStatusChange( iStatus, iConnectionStatus );
+        SetActive();
+        }
+
+    LOG( NORMAL, "SATENGINE: CSatBIPConnectionObserver::RunL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBIPConnectionObserver::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CSatBIPConnectionObserver::DoCancel()
+    {
+    LOG( NORMAL, "SATENGINE: CSatBIPConnectionObserver::DoCancel calling" )
+
+    iBipUtils.PacketService().CancelAsyncRequest( EPacketNotifyStatusChange );
+
+    LOG( NORMAL, "SATENGINE: CSatBIPConnectionObserver::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBIPConnectionObserver::StartObserver
+// Starts to observe connection status
+// -----------------------------------------------------------------------------
+//
+void CSatBIPConnectionObserver::StartObserver()
+    {
+    LOG( NORMAL, "SATENGINE: CSatBIPConnectionObserver::StartObserver calling" )
+
+    if ( !IsActive() )
+        {
+        LOG( SIMPLE, "  Activating observer" )
+        iBipUtils.PacketService().NotifyStatusChange( iStatus, iConnectionStatus );
+        SetActive();
+        }
+
+    LOG( NORMAL, "SATENGINE: CSatBIPConnectionObserver::StartObserver exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBIPConnectionObserver::Status
+// Returns current connection status
+// -----------------------------------------------------------------------------
+//
+RPacketService::TStatus CSatBIPConnectionObserver::Status() const
+    {
+    LOG( NORMAL, "SATENGINE: CSatBIPConnectionObserver::Status \
+    calling-exiting" )
+    LOG2( NORMAL, " ConnectionStatus: %i", iConnectionStatus )
+    return iConnectionStatus;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/csatbipsubconneventobserver.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -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:  Observer of Subconnection parameters granted event
+*
+*/
+
+
+#include <cs_subconevents.h>
+#include "csatbipsubconneventobserver.h"
+#include "CSatBIPGPRSDataChannel.h"
+#include "SatLog.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CSatBIPSubConnEventObserver::CSatBIPSubConnEventObserver(
+    CSatBIPGPRSDataChannel& aDataChannel ) :
+    CActive( EPriorityNormal ),
+    iDataChannel( aDataChannel )
+    {
+    LOG( NORMAL, "SATENGINE: CSatBIPSubConnEventObserver::\
+        CSatBIPSubConnEventObserver calling" )
+    CActiveScheduler::Add( this );
+    
+    iEventFilter.iEventGroupUid = KSubConnGenericEventsImplUid;
+    iEventFilter.iEventMask =
+        KSubConGenericEventParamsRejected | KSubConGenericEventParamsGranted;
+        
+    LOG( NORMAL, "SATENGINE: CSatBIPSubConnObserver::\
+        CSatBIPSubConnEventObserver exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CSatBIPSubConnEventObserver::~CSatBIPSubConnEventObserver()
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatBIPSubConnEventObserver::~CSatBIPSubConnEventObserver \
+        calling" )
+    Cancel();
+    LOG( SIMPLE,
+        "SATENGINE: CSatBIPSubConnEventObserver::~CSatBIPSubConnEventObserver \
+        exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// Starts to observe connection status
+// ---------------------------------------------------------------------------
+//
+void CSatBIPSubConnEventObserver::StartObservSubConnEvent()
+    {
+    LOG( NORMAL, 
+        "SATENGINE: CSatBIPSubConnEventObserver::StartObservSubConnEvent\
+         calling" )
+
+    if ( !IsActive() )
+        {
+        LOG( SIMPLE, "  Activating observer" )
+        iDataChannel.SubConnection().EventNotification(
+            iEventBuffer, &iEventFilter, 1, iStatus );
+        SetActive();
+        }
+
+    LOG( NORMAL, 
+        "SATENGINE: CSatBIPSubConnEventObserver::StartObservSubConnEvent\
+        exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// From base class
+// RunL
+// ---------------------------------------------------------------------------
+//
+void CSatBIPSubConnEventObserver::RunL()
+    {
+    LOG( NORMAL, "SATENGINE: CSatBIPSubConnEventObserver::RunL calling" )
+
+    const TInt errStatus( iStatus.Int() );
+    LOG2( SIMPLE, " RunL (%i)", errStatus )
+    if ( KErrNone == errStatus )
+        {
+        iDataChannel.GrantedEventReceivedL( iEventBuffer );
+        }
+    else
+        {
+        LOG( NORMAL, 
+            "SATENGINE: CSatBIPSubConnEventObserver::RunL Leave with err" )
+        User::LeaveIfError( errStatus );
+        }
+
+    LOG( NORMAL, "SATENGINE: CSatBIPSubConnEventObserver::RunL exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// From base class
+// DoCancel
+// ---------------------------------------------------------------------------
+//
+void CSatBIPSubConnEventObserver::DoCancel()
+    {
+    LOG( NORMAL, "SATENGINE: CSatBIPSubConnEventObserver::DoCancel calling" )
+
+    iDataChannel.SubConnection().CancelEventNotification();
+
+    LOG( NORMAL, "SATENGINE: CSatBIPSubConnEventObserver::DoCancel exiting" )
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/csatmediatoreventprovider.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,216 @@
+/*
+* 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:  Provides events to mediator event consumer.
+*
+*/
+
+#include    <featmgr.h>
+#include    <centralrepository.h>
+#include    <MediatorDomainUIDs.h>
+#include    <MediatorEventProvider.h>
+#include    <SecondaryDisplay/secondarydisplaysatapi.h>
+
+#include    "SATPrivateCRKeys.h"
+#include    "csatmediatoreventprovider.h"
+#include    "SatLog.h"
+
+using namespace MediatorService;
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// CSatMediatorEventProvider::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatMediatorEventProvider* CSatMediatorEventProvider::NewL()
+    {
+    LOG( NORMAL, "SATENGINE: CSatMediatorEventProvider::NewL calling" )
+
+    CSatMediatorEventProvider* self =
+        new ( ELeave ) CSatMediatorEventProvider();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    LOG( NORMAL, "SATENGINE: CSatMediatorEventProvider::NewL exiting" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatMediatorEventProvider::~CSatMediatorEventProvider
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CSatMediatorEventProvider::~CSatMediatorEventProvider()
+    {
+    LOG( NORMAL, "SATENGINE: CSatMediatorEventProvider::\
+        ~CSatMediatorEventProvider calling" )
+
+    if ( iEventProvider )
+        {
+        iEventProvider->UnregisterEvent( KMediatorSecondaryDisplayDomain,
+                                         KCatSAT,
+                                         EMsgAnySatCommand );
+        delete iEventProvider;
+        iEventProvider = NULL;
+        }
+
+    LOG( NORMAL,
+        "SATENGINE: CSatMediatorEventProvider::\
+            ~CSatMediatorEventProvider exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatMediatorEventProvider::RaiseSatEvent
+//
+// -----------------------------------------------------------------------------
+//
+TInt CSatMediatorEventProvider::RaiseSatEvent( const TDesC8& aData )
+    {
+
+    LOG( NORMAL, "SATENGINE: CSatMediatorEventProvider \
+        ::RaiseSatEvent calling" )
+    TInt retVal( KErrNone );
+    // If SAT Event is registered, raise SAT event
+    if ( iRegistered )
+        {
+        LOG( NORMAL, "SATENGINE: CSatMediatorEventProvider \
+        ::RaiseSatEvent iRegistered true" )
+#ifdef ENABLE_SAT_LOGGING
+        const TSatCommandPckg* eventPckg =
+            reinterpret_cast<const TSatCommandPckg*> ( aData.Ptr() );
+        const TSatCommandData& eventData =
+            reinterpret_cast<const TSatCommandData&> ( *eventPckg );
+
+        LOG2( DETAILED,
+        "SATENGINE: CSatMediatorEventProvider::RaiseSatEvent: \
+        cmdNumber: 0x%2X", eventData.iPCmdNumber )
+        LOG2( DETAILED,
+        "SATENGINE: CSatMediatorEventProvider::RaiseSatEvent: AlphaId: %S",
+        &eventData.iAlphaId )
+        LOG2( DETAILED,
+        "SATENGINE: CSatMediatorEventProvider::RaiseSatEvent: \
+        duration[s]: 0x%2X", eventData.iDuration.iNumOfUnits )
+        LOG2( DETAILED,
+        "SATENGINE: CSatMediatorEventProvider::RaiseSatEvent: IconID: 0x%2X",
+        eventData.iIconID.iIdentifier )
+#endif
+        retVal = iEventProvider->RaiseEvent(
+                                            KMediatorSecondaryDisplayDomain,
+                                            KCatSAT,
+                                            EMsgAnySatCommand,
+                                            TVersion( KVersionMajor,
+                                                      KVersionMinor,
+                                                      KVersionBuild ),
+                                            aData );
+        }
+
+    LOG2( NORMAL, "SATENGINE: CSatMediatorEventProvider\
+          ::RaiseSatEvent exiting, retVal: %d", retVal )
+    return retVal;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatMediatorEventProvider::CoverUiSupported
+//
+// -----------------------------------------------------------------------------
+//
+TBool CSatMediatorEventProvider::CoverUiSupported()
+    {
+    LOG( NORMAL, "SATENGINE: CSatMediatorEventProvider \
+        ::CoverUiSupported calling-exiting" )
+    return iCoverUiSupported;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatMediatorEventProvider::CSatMediatorEventProvider
+// C++ default constructor can NOT contain any code, that might leave.
+// -----------------------------------------------------------------------------
+//
+CSatMediatorEventProvider::CSatMediatorEventProvider() :
+    iRegistered( EFalse ),
+    iCoverUiSupported( EFalse ),
+    iEventProvider( NULL )
+    {
+    LOG( NORMAL,
+        "SATENGINE: CSatMediatorEventProvider::CSatMediatorEventProvider \
+        calling-exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatMediatorEventProvider::ConstructL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+void CSatMediatorEventProvider::ConstructL()
+    {
+    LOG( NORMAL, "SATENGINE: CSatMediatorEventProvider::ConstructL calling" )
+
+    // Store Cover UI supported information
+    CUiSupportedL();
+
+    // If Cover UI is supported, register SAT Event
+    if ( iCoverUiSupported )
+        {
+        LOG( NORMAL, "SATENGINE: CSatMediatorEventProvider::ConstructL \
+             iCoverUiSupported true" )
+        iEventProvider = CMediatorEventProvider::NewL();
+
+        User::LeaveIfError( iEventProvider->RegisterEvent(
+                    KMediatorSecondaryDisplayDomain,
+                    KCatSAT,
+                    EMsgAnySatCommand,
+                    TVersion( KVersionMajor, KVersionMinor, KVersionBuild ),
+                    TCapabilitySet( ECapabilitySwEvent ) ) );
+
+        iRegistered = ETrue;
+        }
+
+    LOG( NORMAL, "SATENGINE: CSatMediatorEventProvider::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatMediatorEventProvider::CUiSupportedL
+//
+// -----------------------------------------------------------------------------
+//
+void CSatMediatorEventProvider::CUiSupportedL()
+    {
+    LOG( NORMAL,
+        "SATENGINE: CSatMediatorEventProvider::CoverUiSupported calling" )
+
+    TBool coverui( EFalse );
+
+    // Check if Cover UI presents from Feature Manager
+    FeatureManager::InitializeLibL();
+    coverui = FeatureManager::FeatureSupported( KFeatureIdCoverDisplay );
+    FeatureManager::UnInitializeLib();
+
+    // Check SAT internal flag for Cover UI
+    TInt satCoverUi( 0 );
+    CRepository* repository = CRepository::NewL( KCRUidSatServer );
+    repository->StartTransaction( CRepository::EReadTransaction );
+    repository->Get( KSatSecondaryDisplaySupport, satCoverUi );
+    delete repository;
+    repository = NULL;
+
+    // Store Supported information
+    iCoverUiSupported = TBool( coverui & satCoverUi );
+    LOG2( SIMPLE,"CSatMediatorEventProvider::CUiSupportedL \
+          KSatSecondaryDisplaySupport:%d", satCoverUi )
+    LOG( NORMAL,
+        "SATENGINE: CSatMediatorEventProvider::CoverUiSupported exiting" )
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/csatmultimodeapi.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,730 @@
+/*
+* 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:  Encapsule the access to etelmm API in sat
+*
+*/
+
+
+#include    <mmtsy_names.h>
+#include    "csatmultimodeapi.h"
+#include    "csatsactivewrapper.h"
+#include    "SatLog.h"
+
+#ifdef SAT_USE_DUMMY_TSY
+    _LIT( KSatSDummyTsyModuleName, "DSAT" );
+    _LIT( KSatSDummyTsyPhoneName, "DMobile" );
+#endif
+
+const TInt KLoopMaxTryouts = 5;
+const TInt KLoopTimeout = 3000000;
+
+// ================= MEMBER FUNCTIONS ==========================================
+
+// -----------------------------------------------------------------------------
+// Class constructor.
+// -----------------------------------------------------------------------------
+//
+CSatMultiModeApi::CSatMultiModeApi()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::CSatMultiModeApi calling-exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CSatMultiModeApi::~CSatMultiModeApi()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::~CSatMultiModeApi calling" )
+
+    if ( iCallOpened )
+        {
+        iCall.Close();
+        }
+    
+    if ( iLineOpened )
+        {
+        iLine.Close();
+        }
+    
+    if ( iUssdOpened )
+        {
+        iUssd.Close();
+        }
+        
+    iCustomPhone.Close();
+    
+    iPhone.Close();
+
+#ifdef SAT_USE_DUMMY_TSY
+    iDummyPhone.Close();
+#endif
+    iTelServer.Close();
+            
+    delete iWrapper;
+    iWrapper = NULL;
+
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::~CSatMultiModeApi calling" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatMultiModeApi::NewL
+// -----------------------------------------------------------------------------
+//
+CSatMultiModeApi* CSatMultiModeApi::NewL()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::NewL calling" )
+
+    CSatMultiModeApi* self = new( ELeave )CSatMultiModeApi();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::NewL calling" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatMultiModeApi::Phone
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+RMobilePhone* CSatMultiModeApi::Phone()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::Phone calling-exiting" )
+    return &iPhone;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatMultiModeApi::Phone
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+RMobilePhone* CSatMultiModeApi::DummyPhone()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::Phone calling-exiting" )
+#ifdef SAT_USE_DUMMY_TSY
+    return &iDummyPhone;
+#else
+    return NULL;
+#endif
+    }
+
+// -----------------------------------------------------------------------------
+// CSatMultiModeApi::CustomApi
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+RMmCustomAPI* CSatMultiModeApi::CustomApi()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::CustomApi calling-exiting" )
+    return &iCustomPhone;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatMultiModeApi::LowerErrorGranularity
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatMultiModeApi::LowerErrorGranularity()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::LowerErrorGranularity \
+        calling-exiting" )
+    iTelServer.SetExtendedErrorGranularity( RTelServer::EErrorBasic );
+    }
+
+// -----------------------------------------------------------------------------
+// CSatMultiModeApi::RaiseErrorGranularity
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatMultiModeApi::RaiseErrorGranularity()
+    {
+    LOG( NORMAL, "SATENGINE: CSatMultiModeApi::RaiseErrorGranularity \
+        calling-exiting" )
+    iTelServer.SetExtendedErrorGranularity( RTelServer::EErrorExtended );
+    }
+
+// -----------------------------------------------------------------------------
+// CSatMultiModeApi::GetNetworkRegistrationStatus
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatMultiModeApi::GetNetworkRegistrationStatus( 
+        TRequestStatus& aReqStatus, 
+        RMobilePhone::TMobilePhoneRegistrationStatus& aStatus)
+    {
+    LOG( SIMPLE, 
+    "SATENGINE: CSatMultiModeApi::GetNetworkRegistrationStatus calling" )
+
+    iPhone.GetNetworkRegistrationStatus( aReqStatus, aStatus );
+
+    LOG( SIMPLE,
+     "SATENGINE: CSatMultiModeApi::GetNetworkRegistrationStatus exiting" )
+    }
+// -----------------------------------------------------------------------------
+// CSatMultiModeApi::NotifyNetworkRegistrationStatusChange
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatMultiModeApi::NotifyNetworkRegistrationStatusChange(
+        TRequestStatus& aReqStatus, 
+        RMobilePhone::TMobilePhoneRegistrationStatus& aStatus)
+    {    
+    LOG( SIMPLE, "SATENGINE: \
+    CSatMultiModeApi::NotifyNetworkRegistrationStatusChange calling" )
+    
+    iPhone.NotifyNetworkRegistrationStatusChange( aReqStatus, aStatus );
+    
+    LOG( SIMPLE, "SATENGINE: \
+    CSatMultiModeApi::NotifyNetworkRegistrationStatusChange exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatMultiModeApi::GetSubscriberId
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatMultiModeApi::GetSubscriberId(TRequestStatus& aReqStatus, 
+        RMobilePhone::TMobilePhoneSubscriberId& aId)
+    {
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::GetSubscriberId calling" )
+    iPhone.GetSubscriberId( aReqStatus, aId );
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::GetSubscriberId exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatMultiModeApi::SendDTMFTones
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatMultiModeApi::SendDTMFTones( TRequestStatus& aReqStatus, 
+        const TDesC& aTones)
+    {
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::SendDTMFTones calling" )
+    iPhone.SendDTMFTones( aReqStatus, aTones );
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::SendDTMFTones exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatMultiModeApi::ContinueDTMFStringSending
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CSatMultiModeApi::ContinueDTMFStringSending( TBool aContinue )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::ContinueDTMFStringSending" )
+    return iPhone.ContinueDTMFStringSending( aContinue );
+    }
+
+// -----------------------------------------------------------------------------
+// CSatMultiModeApi::DialNoFdnCheck
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatMultiModeApi::DialNoFdnCheck( TRequestStatus& aStatus,
+        const TDesC8& aCallParams, const TDesC& aTelNumber)
+    {
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::DialNoFdnCheck calling" )
+    TInt err = LoadMobileCall();
+    LOG2( SIMPLE, "SATENGINE: CSatMultiModeApi::DialNoFdnCheck err %d", err )
+    
+    iCall.DialNoFdnCheck( aStatus, aCallParams, aTelNumber );
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::DialNoFdnCheck exiting" )
+    }
+                        
+// -----------------------------------------------------------------------------
+// CSatMultiModeApi::SendNetworkServiceRequestNoFdnCheck
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatMultiModeApi::SendNetworkServiceRequestNoFdnCheck( 
+        TRequestStatus& aReqStatus, const TDesC& aServiceString)
+                       
+    {
+    LOG( SIMPLE, "SATENGINE: \
+            CSatMultiModeApi::SendNetworkServiceRequestNoFdnCheck calling" )
+    
+    iPhone.SendNetworkServiceRequestNoFdnCheck( aReqStatus, aServiceString );
+    
+    LOG( SIMPLE, "SATENGINE: \
+            CSatMultiModeApi::SendNetworkServiceRequestNoFdnCheck exiting" )
+    }
+                                
+// -----------------------------------------------------------------------------
+// CSatMultiModeApi::SendMessageNoFdnCheck
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatMultiModeApi::SendMessageNoFdnCheck( TRequestStatus& aReqStatus,
+            const TDesC8& aMsgData, const TDesC8& aMsgAttributes )
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatMultiModeApi::SendMessageNoFdnCheck calling" )
+    
+    iUssd.SendMessageNoFdnCheck( aReqStatus, aMsgData, aMsgAttributes );
+    
+    LOG( SIMPLE, 
+        "SATENGINE: CSatMultiModeApi::SendMessageNoFdnCheck exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatMultiModeApi::CancelAsyncRequest
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatMultiModeApi::CancelAsyncRequest(TInt aReqToCancel)
+    {
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::CancelAsyncRequest calling" )
+    iPhone.CancelAsyncRequest( aReqToCancel );
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::CancelAsyncRequest exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatMultiModeApi::DialCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatMultiModeApi::DialCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::DialCancel calling" )
+    iCall.DialCancel();
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::DialCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatMultiModeApi::IsCallIncoming
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CSatMultiModeApi::IsCallIncoming()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::IsCallIncoming entering" )
+    TInt lines( 0 );
+    TBool callIncoming( EFalse );
+
+    // Enumerate all lines in the phone
+    TInt err( iPhone.EnumerateLines( lines ) );
+
+    if ( KErrNone == err )
+        {
+        RPhone::TLineInfo lineInfo;
+        // Check the lines' status one by one
+        for( TInt i = 0; ( i < lines ) && !callIncoming; ++i )
+            {
+            err = iPhone.GetLineInfo( i, lineInfo ); 
+            if ( KErrNone == err )
+                {
+                LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::IsCallIncoming \
+                    line status is %d", lineInfo.iStatus )
+                if ( ( RCall::EStatusDialling == lineInfo.iStatus ) ||
+                     ( RCall::EStatusRinging == lineInfo.iStatus ) )
+                    {
+                    // There is an incoming call
+                    callIncoming = ETrue;
+                    }
+                }
+            else
+                {
+                // Error happened when getting line info
+                // We currently do nothing but skip the error line and log it
+                LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::IsCallIncoming \
+                    getting line status error %d", err )
+                }
+            }
+        }
+    else
+        {
+        // Enumerate lines error
+        LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::IsCallIncoming \
+            enumerate lines error %d", err )
+        }
+
+    LOG2( SIMPLE, "SATENGINE: CSatMultiModeApi::IsCallIncoming exiting %d", 
+          callIncoming )
+    return callIncoming;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatMultiModeApi::NotifyMobileCallStatusChange
+// -----------------------------------------------------------------------------
+//
+void CSatMultiModeApi::NotifyMobileCallStatusChange ( 
+        TRequestStatus& aReqStatus, RMobileCall::TMobileCallStatus& aStatus )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::NotifyMobileCallStatusChange \
+             calling" )
+    iCall.NotifyMobileCallStatusChange( aReqStatus, aStatus );
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::NotifyMobileCallStatusChange \
+             exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatMultiModeApi::NotifyCallStatusChangeCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatMultiModeApi::NotifyCallStatusChangeCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::DialCancel calling" )
+    iCall.NotifyStatusChangeCancel();
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::DialCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatMultiModeApi::NotifyMobileCallStatusChange
+// -----------------------------------------------------------------------------
+//
+void CSatMultiModeApi::TerminateActiveCalls(TRequestStatus& aReqStatus)
+    {
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::TerminateAllCalls calling" )
+
+    iPhone.TerminateActiveCalls( aReqStatus );
+    
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::TerminateAllCalls exiting" )
+    } 
+
+// -----------------------------------------------------------------------------
+// CSatMultiModeApi::GetMobileCallInfo
+// -----------------------------------------------------------------------------
+//
+TInt CSatMultiModeApi::GetMobileCallInfo(TDes8& aCallInfo)
+    {
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::GetMobileCallInfo calling" )
+    TInt ret = iCall.GetMobileCallInfo( aCallInfo );
+    LOG2( SIMPLE, "SATENGINE: CSatMultiModeApi::GetMobileCallInfo exiting %d",
+            ret )
+    return ret;
+    }
+       
+// -----------------------------------------------------------------------------
+// CSatMultiModeApi::GetMobileCallInfo
+// -----------------------------------------------------------------------------
+//
+void CSatMultiModeApi::DialEmergencyCall(TRequestStatus& aReqStatus, 
+        const TDesC& aNumber)
+    {
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::DialEmergencyCall calling" )
+    TInt err = LoadMobileCall();
+    LOG2( SIMPLE, "SATENGINE: CSatMultiModeApi::DialEmergencyCall err %d", err )
+    iCall.DialEmergencyCall( aReqStatus, aNumber );
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::DialEmergencyCall exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatMultiModeApi::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CSatMultiModeApi::ConstructL()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::ConstructL calling" )
+
+    // Connect to ETel Server    
+    ConnectETelServerL();
+#if !defined ( __WINSCW__ )
+    //On the emulator the load will leave. We can not use the functionaly
+    //on enmulator
+    LoadUssdMessagingL();
+#endif
+
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatMultiModeApi::ConnectETelServerL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatMultiModeApi::ConnectETelServerL()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::ConnectETelServerL calling" )
+
+    TInt numberOfTries( 1 );        // Indicates loop tryouts
+    TBool loopSuccess( EFalse );    // Loop stopper, if this is ETrue
+    TInt error = KErrNone;          // Error that is Leave'd
+
+    if ( !iWrapper )
+        {
+        LOG( NORMAL, "SATENGINE: CSatMultiModeApi::ConnectETelServerL \
+        iWrapper false" )
+        iWrapper = new ( ELeave ) CSatSActiveWrapper();
+        }
+
+    // First loop is for connecting to RTelServer. Loop is done until
+    // connection returns KErrNone or when max loop try outs has been 
+    // reached
+    while ( !loopSuccess && numberOfTries <= KLoopMaxTryouts )
+        {
+        error = iTelServer.Connect();
+        if ( KErrNone == error )
+            {
+            LOG( NORMAL, "SATENGINE: \
+            CSatMultiModeApi::ConnectETelServerL KErrNone == error" )
+            loopSuccess = ETrue;
+            }
+        else
+            {
+            numberOfTries++;
+            iWrapper->After( KLoopTimeout );
+            }
+        }
+
+    LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::ConnectETelServerL \
+          numberOfTries: %i", numberOfTries )
+
+    LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::ConnectETelServerL \
+          error: %i", error )
+
+    // Check the error status
+    User::LeaveIfError( error );
+
+    // Now load phone module
+    LoadPhoneModuleL( iPhone, KMmTsyModuleName, KMmTsyPhoneName );
+
+#ifdef SAT_USE_DUMMY_TSY
+    // Also load dummy tsy
+    LoadPhoneModuleL( iDummyPhone, KSatSDummyTsyModuleName, KSatSDummyTsyPhoneName );
+#endif // SAT_USE_DUMMY_TSY
+
+    User::LeaveIfError( iCustomPhone.Open( iPhone ) );
+
+    // No need for wrapper anymore
+    delete iWrapper;
+    iWrapper = NULL;
+
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::ConnectETelServerL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatMultiModeApi::LoadPhoneModuleL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatMultiModeApi::LoadPhoneModuleL( RMobilePhone& aPhone,
+        const TDesC& aModuleName, const TDesC& aPhoneName )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::LoadPhoneModuleL calling" )
+
+    TInt numberOfTries( 1 );        // Indicates loop tryouts
+    TBool loopSuccess( EFalse );    // Loop stopper, if this is ETrue
+    TInt error = KErrNone;          // Error that is Leave'd
+
+    LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::LoadPhoneModuleL \
+          ModuleName: %S", &aModuleName )
+
+    LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::LoadPhoneModuleL \
+          PhoneName: %S", &aPhoneName )
+
+    // We wait here until the phone module gets loaded.
+    // Load the correct phone module depending on the TSY being used.
+    while ( !loopSuccess && numberOfTries <= KLoopMaxTryouts )
+        {
+        error = iTelServer.LoadPhoneModule( aModuleName );
+        if ( KErrNone == error )
+            {
+            loopSuccess = ETrue;
+            }
+        else
+            {
+            numberOfTries++;
+            iWrapper->After( KLoopTimeout );
+            }
+        }
+
+    LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::LoadPhoneModuleL \
+          numberOfTries: %i", numberOfTries )
+
+    LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::LoadPhoneModuleL \
+          error: %i", error )
+
+    // Check the error status
+    User::LeaveIfError( error );
+
+    // This function retrieves the total number of phones supported by all
+    // the currently loaded ETel (TSY) modules.
+    TInt phoneCount( 0 );
+    User::LeaveIfError( iTelServer.EnumeratePhones( phoneCount ) );
+
+    LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::LoadPhoneModuleL \
+          phoneCount: %i", phoneCount )
+
+    // This function retrieves information associated with the specified phone
+    RTelServer::TPhoneInfo phoneInfo;
+    while ( phoneCount-- )
+        {
+        User::LeaveIfError( iTelServer.GetPhoneInfo( phoneCount,
+            phoneInfo ) );
+
+        // Check that do we have the right phone
+        if ( phoneInfo.iName == aPhoneName )
+            {
+            LOG( NORMAL, "SATENGINE: CSatMultiModeApi::LoadPhoneModuleL \
+            phoneInfo.iName == aPhoneName" )
+            phoneCount = 0;
+            }
+        }
+
+    if ( phoneInfo.iName != aPhoneName )
+        {
+        // Did not found correct phone info -> Leave
+        LOG( SIMPLE, 
+            "SATENGINE: CSatMultiModeApi::LoadPhoneModuleL Not found" )
+        User::Leave( KErrNotFound );
+        }
+
+    // Reset the counter and loop status for the next loop.
+    numberOfTries = 1;
+    loopSuccess = EFalse;
+
+    // We wait here until the phone gets opened.
+    // Open the correct phone depending on the TSY being used.
+    while ( !loopSuccess && ( numberOfTries <= KLoopMaxTryouts ) )
+        {
+        error = aPhone.Open( iTelServer, aPhoneName );
+
+        if ( KErrNone == error )
+            {
+            LOG( NORMAL, "SATENGINE: \
+            CSatMultiModeApi::LoadPhoneModuleL KErrNone == error" )
+            loopSuccess = ETrue;
+            }
+        else
+            {
+            numberOfTries++;
+            iWrapper->After( KLoopTimeout );
+            }
+        }
+    if ( !loopSuccess )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::LoadPhoneModuleL\
+                      phone open failed" );
+        }
+    
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::LoadPhoneModuleL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatMultiModeApi::LoadMobileCall
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CSatMultiModeApi::LoadMobileCall()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::LoadMobileCallL calling" )
+
+    if ( iCallOpened )
+        {
+        iCall.Close();
+        }
+    
+    if ( iLineOpened )
+        {
+        iLine.Close();
+        }
+    
+    TInt numberOfTries( 1 );        // Indicates loop tryouts
+    TBool loopSuccess( EFalse );    // Loop stopper, if this is ETrue
+    TInt error = KErrNone;          // Error that is Leave'd
+
+    while ( !loopSuccess && numberOfTries <= KLoopMaxTryouts )
+        {
+        error = iLine.Open( iPhone, KMmTsyVoice1LineName );
+        if ( KErrNone == error )
+            {
+            loopSuccess = ETrue;
+            iLineOpened = ETrue;
+            }
+        else
+            {
+            numberOfTries++;
+            iWrapper->After( KLoopTimeout );
+            }
+        }
+
+    LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::LoadMobileCallL \
+          iLine numberOfTries: %i", numberOfTries )
+
+    LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::LoadMobileCallL \
+          iLine error: %i", error )
+    
+    numberOfTries = 1;
+    loopSuccess =  EFalse;
+
+    while ( iLineOpened &&!loopSuccess && numberOfTries <= KLoopMaxTryouts )
+        {
+        error = iCall.OpenNewCall( iLine );
+        if ( KErrNone == error )
+            {
+            loopSuccess = ETrue;
+            iCallOpened = ETrue;
+            }
+        else
+            {
+            numberOfTries++;
+            iWrapper->After( KLoopTimeout );
+            }
+        }
+
+    LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::LoadMobileCallL \
+          iCall numberOfTries: %i", numberOfTries )
+
+    LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::LoadMobileCallL \
+          iCall error: %i", error )
+
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::LoadMobileCallL exiting" )
+    return error;
+    }
+    
+// -----------------------------------------------------------------------------
+// CSatMultiModeApi::LoadMobileCallL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//    
+void CSatMultiModeApi::LoadUssdMessagingL()
+    
+    {
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::LoadUssdMessagingL calling" )
+
+    TInt numberOfTries( 1 );        // Indicates loop tryouts
+    TBool loopSuccess( EFalse );    // Loop stopper, if this is ETrue
+    TInt error = KErrNone;          // Error that is Leave'd
+
+    while ( !loopSuccess && numberOfTries <= KLoopMaxTryouts )
+        {
+        error = iUssd.Open( iPhone );
+        if ( KErrNone == error )
+            {
+            loopSuccess = ETrue;
+            iUssdOpened = ETrue;
+            }
+        else
+            {
+            numberOfTries++;
+            iWrapper->After( KLoopTimeout );
+            }
+        }
+
+    LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::LoadUssdMessagingL \
+          iUssd numberOfTries: %i", numberOfTries )
+
+    LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::LoadUssdMessagingL \
+          iUssd error: %i", error )
+          
+    User::LeaveIfError( error );
+
+    LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::LoadUssdMessagingL exiting" )
+    }
+
+
+//End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/csatprofilechangeobserver.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,147 @@
+/*
+* 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 Profile state changes.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "TSatSystemStateFactory.h"
+#include    "MSatSystemStateChangeNotifier.h"
+#include    "MSatUtils.h"
+#include    "csatprofilechangeobserver.h"
+#include    "SatLog.h"
+#include    "CSatSUiClientHandler.h"
+
+
+// CONSTANTS
+const TInt KSatActiveProfileOffline = 5; // value from ProfileEngine
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSatProfileChangeObserver::CSatProfileChangeObserver
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatProfileChangeObserver::CSatProfileChangeObserver(
+    MSatUtils& aUtils ) :
+    iUtils( aUtils )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CSatProfileChangeObserver::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatProfileChangeObserver* CSatProfileChangeObserver::NewL(
+    MSatUtils& aUtils )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatProfileChangeObserver::NewL calling" )
+
+    CSatProfileChangeObserver* self =
+        new ( ELeave ) CSatProfileChangeObserver( aUtils );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "SATENGINE: CSatProfileChangeObserver::NewL exiting" )
+    return self;
+    }
+
+// Destructor
+CSatProfileChangeObserver::~CSatProfileChangeObserver()
+    {
+    LOG( SIMPLE,
+        "SATENGINE: CSatProfileChangeObserver::~CSatProfileChangeObserver \
+        calling" )
+
+    if ( iStateNotifier )
+        {
+        iStateNotifier->CancelNotify();
+        delete iStateNotifier;
+        iStateNotifier = NULL;
+        }
+
+    LOG( SIMPLE,
+        "SATENGINE: CSatProfileChangeObserver::~CSatProfileChangeObserver \
+        exiting" )
+    }
+    
+// -----------------------------------------------------------------------------
+// CSatProfileChangeObserver::ConstructL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+void CSatProfileChangeObserver::ConstructL()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatProfileChangeObserver::ConstructL calling" )
+
+    iStateNotifier = TSatSystemStateFactory::CreateProfileChangeNotifierL( *this );
+    // Start observer immediately
+    iStateNotifier->NotifyChangeL();
+    
+    // iPreviousProfile must set to -1 because values 0-49 
+    // are reserved for different profiles.
+    iPreviousProfile = -1;
+    
+    LOG( SIMPLE, "SATENGINE: CSatSAPChangeObserver::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatProfileChangeObserver::StateChanged
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+void CSatProfileChangeObserver::StateChanged( const TInt aValue )
+    {
+    LOG2( SIMPLE, "SATENGINE: CSatProfileChangeObserver::StateChanged calling \
+        with value %d", aValue )
+
+    // If profile is off-line send removing event
+    if ( KSatActiveProfileOffline == aValue )
+        {
+        LOG( SIMPLE, "SATENGINE: Off-line" )
+        // Off-line state activated.
+        // Notify listeners about SAT UI icon removing
+        iUtils.NotifyEvent( MSatUtils::ERemoveSatUiCalled );       
+        }
+
+    // Send event if previous state was offline.
+    // The event will not be sent in following case: Phone is started
+    // in offline mode and profile is changed to online. Proactive 
+    // SetupMenu command is received from SIM card not before phone is
+    // in online mode. iPreviousProfile is -1 when StateChanged is called
+    // first time.
+    else if ( ( KSatActiveProfileOffline != aValue ) &&  
+        ( KSatActiveProfileOffline  == iPreviousProfile ) )
+        {
+        LOG( SIMPLE, "SATENGINE: !Off-line" )
+        // Notify listeners about SAT UI icon adding
+        iUtils.NotifyEvent( MSatUtils::EAddSatUiCalled );
+        }
+    
+    else
+        {
+        // meaningless else. Only for Lint
+        }
+
+    iPreviousProfile = aValue;
+
+    LOG( SIMPLE, "SATENGINE: CSatProfileChangeObserver::StateChanged exiting" )
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/csatsactivewrapper.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,205 @@
+/*
+* 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:  Active object wrapper for SAT Server
+*
+*/
+
+
+#include    "csatsactivewrapper.h"
+#include    "SatLog.h"
+
+const TInt KShortWait = 200; // 200 microseconds
+const TInt KWaitTimes = 5;   // Number of retries
+
+// ================= MEMBER FUNCTIONS ==========================================
+
+// Class constructor.
+CSatSActiveWrapper::CSatSActiveWrapper() :
+    CActive( EPriorityStandard )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSActiveWrapper::CSatSActiveWrapper \
+    calling-exiting" )
+    CActiveScheduler::Add( this );
+    }
+
+// Destructor
+CSatSActiveWrapper::~CSatSActiveWrapper()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSActiveWrapper::~CSatSActiveWrapper calling" )
+
+    if ( iTimer )
+        {
+        iTimer->Cancel();
+        delete iTimer;
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatSActiveWrapper::~CSatSActiveWrapper exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSActiveWrapper::RequestStatus
+// -----------------------------------------------------------------------------
+//
+TRequestStatus& CSatSActiveWrapper::RequestStatus()
+    {
+    LOG( DETAILED, "SATENGINE: CSatSActiveWrapper::RequestStatus calling" )
+
+    TInt retries( 0 );
+    while ( IsActive() && ( retries++ < KWaitTimes ) )
+        {
+        // If this wrapper is already active, wait little bit
+        After( KShortWait );
+        }
+    LOG2( DETAILED, "SATENGINE: CSatSActiveWrapper::RequestStatus retries: %d",
+          retries )
+    // Double check. If still active, cancel
+    if ( IsActive() )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatSActiveWrapper::RequestStatus active" )
+        CancelWrapper();
+        }
+
+    LOG( DETAILED, "SATENGINE: CSatSActiveWrapper::RequestStatus exiting" )
+    return iStatus;
+    }
+// -----------------------------------------------------------------------------
+// CSatSActiveWrapper::SetActiveAndWait
+// -----------------------------------------------------------------------------
+//
+TInt CSatSActiveWrapper::SetActiveAndWait()
+    {
+    LOG( DETAILED, "SATENGINE: CSatSActiveWrapper::SetActiveAndWait calling" )
+
+    TInt returnValue( KErrInUse );
+    if ( !IsActive() && !iWait.IsStarted() )
+        {
+        LOG( DETAILED,
+        "SATENGINE: CSatSActiveWrapper::SetActiveAndWait setActiveAndWait" )
+        SetActive();
+        iWait.Start(); // Blocks until request is complete or cancelled
+        returnValue = iStatus.Int();
+        }
+
+    LOG( DETAILED, "SATENGINE: CSatSActiveWrapper::SetActiveAndWait exiting" )
+    return returnValue;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSActiveWrapper::After
+// -----------------------------------------------------------------------------
+void CSatSActiveWrapper::After(
+    const TTimeIntervalMicroSeconds32& aDelay,
+    const TTimeIntervalMicroSeconds32& aInterval )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSActiveWrapper::After calling" )
+
+    if ( !iAfterWait.IsStarted() )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatSActiveWrapper::After start iAfterWait" )
+        TRAP_IGNORE( ( iTimer = CPeriodic::NewL( EPriorityStandard ) ) )
+        iTimer->Start( aDelay, aInterval, TCallBack( DelayCallBack, this ) );
+        iAfterWait.Start();
+
+        delete iTimer;
+        iTimer = NULL;
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatSActiveWrapper::After exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSActiveWrapper::DelayCallBack
+// Timer call back function
+// -----------------------------------------------------------------------------
+TInt CSatSActiveWrapper::DelayCallBack( TAny* aPtr )
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSActiveWrapper::DelayCallBack calling" )
+    CSatSActiveWrapper* ptrThis = static_cast<CSatSActiveWrapper*>( aPtr );
+    if ( ptrThis && ( ptrThis->iAfterWait.IsStarted() ) )
+        {
+        LOG( SIMPLE, "SATENGINE: CSatSActiveWrapper::DelayCallBack stop \
+             iAfterWait" )
+        ptrThis->iAfterWait.AsyncStop();
+        }
+    LOG( SIMPLE, "SATENGINE: CSatSActiveWrapper::DelayCallBack exiting" )
+    return ( EFalse );
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSActiveWrapper::AddSubSessionL
+// -----------------------------------------------------------------------------
+void CSatSActiveWrapper::CancelWrapper()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSActiveWrapper::CancelWrapper calling" )
+
+    // If pending for request, cancel active
+    if ( IsActive() )
+        {
+        LOG( SIMPLE, 
+        "SATENGINE: CSatSActiveWrapper::CancelWrapper cancel iWait" )
+        // Calls DoCancel which cancels iWait
+        Cancel();
+        }
+    else if ( iAfterWait.IsStarted() )
+        {
+        LOG( SIMPLE, 
+        "SATENGINE: CSatSActiveWrapper::CancelWrapper cancel timer" )
+        // Cancels timer
+        iAfterWait.AsyncStop();
+        }
+    else
+        {
+        LOG( SIMPLE, 
+        "SATENGINE: CSatSActiveWrapper::CancelWrapper Wrapper not active" )
+        }
+
+    LOG( SIMPLE, "SATENGINE: CSatSActiveWrapper::CancelWrapper exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSActiveWrapper::Release
+// -----------------------------------------------------------------------------
+void CSatSActiveWrapper::Release()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatSActiveWrapper::Release calling-exiting" )
+    delete this;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSActiveWrapper::RunL
+// Synchronous request complete
+// -----------------------------------------------------------------------------
+//
+void CSatSActiveWrapper::RunL()
+    {
+    LOG( DETAILED, "SATENGINE: CSatSActiveWrapper::RunL calling" )
+
+    iWait.AsyncStop();
+
+    LOG( DETAILED, "SATENGINE: CSatSActiveWrapper::RunL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSActiveWrapper::DoCancel
+// Synchronous request complete
+// -----------------------------------------------------------------------------
+//
+void CSatSActiveWrapper::DoCancel()
+    {
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::DoCancel calling" )
+
+    iWait.AsyncStop();
+
+    LOG( SIMPLE, "SATENGINE: CSatBIPUtils::DoCancel exiting" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/Engine/src/std.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* 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:  General functions
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32std.h>
+#include    "SatServerFactory.h"
+#include    "CSatSServer.h"
+#include    "SatLog.h"
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// Factory method for CSatSServer
+// -----------------------------------------------------------------------------
+EXPORT_C CSatSServer* CreateSatServerL()
+    {
+    LOG( SIMPLE, "SATENGINE: CreateSatServerL calling-exiting" )
+    return CSatSServer::NewL();
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/EventMonitors/BWINS/SatEventMonitorsU.DEF	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,6 @@
+EXPORTS
+	?CancelMonitor@CSatEventMonitorHandler@@UAEXXZ @ 1 NONAME ; void CSatEventMonitorHandler::CancelMonitor(void)
+	?CreateEventMonitorsL@TSatEventMonitorFactory@@SAPAV?$CArrayPtrFlat@VMSatEventMonitor@@@@AAVMSatEventMonitorUtils@@@Z @ 2 NONAME ; class CArrayPtrFlat<class MSatEventMonitor> * TSatEventMonitorFactory::CreateEventMonitorsL(class MSatEventMonitorUtils &)
+	?UpdateMonitor@CSatEventMonitorHandler@@UAEHI@Z @ 3 NONAME ; int CSatEventMonitorHandler::UpdateMonitor(unsigned int)
+	?IsMonitoringEvent@CSatEventMonitorHandler@@UAEHH@Z @ 4 NONAME ; int CSatEventMonitorHandler::IsMonitoringEvent(int)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/EventMonitors/EABI/SatEventMonitorsU.DEF	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,29 @@
+EXPORTS
+	_ZN23CSatEventMonitorHandler13CancelMonitorEv @ 1 NONAME
+	_ZN23CSatEventMonitorHandler13UpdateMonitorEj @ 2 NONAME
+	_ZN23TSatEventMonitorFactory20CreateEventMonitorsLER21MSatEventMonitorUtils @ 3 NONAME
+	_ZTI21CSatIdleScreenMonitor @ 4 NONAME ; #<TI>#
+	_ZTI21CSatSimRemovalMonitor @ 5 NONAME ; #<TI>#
+	_ZTI23CSatEventMonitorHandler @ 6 NONAME ; #<TI>#
+	_ZTI23CSatUserActivityMonitor @ 7 NONAME ; #<TI>#
+	_ZTI24CSatBrowserThreadMonitor @ 8 NONAME ; #<TI>#
+	_ZTI27CSatBIPChannelStatusMonitor @ 9 NONAME ; #<TI>#
+	_ZTI27CSatBIPDataAvailableMonitor @ 10 NONAME ; #<TI>#
+	_ZTI28CSatLanguageSelectionMonitor @ 11 NONAME ; #<TI>#
+	_ZTI29CSatBrowserTerminationMonitor @ 12 NONAME ; #<TI>#
+	_ZTV21CSatIdleScreenMonitor @ 13 NONAME ; #<VT>#
+	_ZTV21CSatSimRemovalMonitor @ 14 NONAME ; #<VT>#
+	_ZTV23CSatEventMonitorHandler @ 15 NONAME ; #<VT>#
+	_ZTV23CSatUserActivityMonitor @ 16 NONAME ; #<VT>#
+	_ZTV24CSatBrowserThreadMonitor @ 17 NONAME ; #<VT>#
+	_ZTV27CSatBIPChannelStatusMonitor @ 18 NONAME ; #<VT>#
+	_ZTV27CSatBIPDataAvailableMonitor @ 19 NONAME ; #<VT>#
+	_ZTV28CSatLanguageSelectionMonitor @ 20 NONAME ; #<VT>#
+	_ZTV29CSatBrowserTerminationMonitor @ 21 NONAME ; #<VT>#
+	_ZTI20CSatBrowserWSMonitor @ 22 NONAME ; #<TI>#
+	_ZTV20CSatBrowserWSMonitor @ 23 NONAME ; #<VT>#
+	_ZThn4_N23CSatEventMonitorHandler13CancelMonitorEv @ 24 NONAME ; #<thunk>#
+	_ZThn4_N23CSatEventMonitorHandler13UpdateMonitorEj @ 25 NONAME ; #<thunk>#
+	_ZN23CSatEventMonitorHandler17IsMonitoringEventEi @ 26 NONAME
+	_ZThn4_N23CSatEventMonitorHandler17IsMonitoringEventEi @ 27 NONAME ; #<thunk>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/EventMonitors/group/EventMonitors.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,59 @@
+/*
+* 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:  Project definition file for project EventMonitors
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../inc/SatMacroes.h"
+
+TARGET                  SatEventMonitors.dll
+TARGETTYPE              dll
+UID                     0x1000008d 0x101F79FD
+
+CAPABILITY              CAP_GENERAL_DLL
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  TSatEventMonitorFactory.cpp
+SOURCE                  CSatEventMonitorHandler.cpp
+SOURCE                  CSatSimRemovalMonitor.cpp
+SOURCE                  CSatUserActivityMonitor.cpp
+SOURCE                  CSatIdleScreenMonitor.cpp
+SOURCE                  CSatBrowserTerminationMonitor.cpp
+SOURCE                  csatbrowserwsmonitor.cpp
+SOURCE                  CSatLanguageSelectionMonitor.cpp
+SOURCE                  CSatBrowserThreadMonitor.cpp
+SOURCE                  CSatBIPDataAvailableMonitor.cpp
+SOURCE                  CSatBIPChannelStatusMonitor.cpp
+
+USERINCLUDE             ../inc
+USERINCLUDE             ../../inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           ../../../../inc         // Domain telephony
+SYSTEMINCLUDE           ../../../inc            // Subsystem satengine
+
+LIBRARY                 euser.lib
+LIBRARY                 etelsat.lib
+LIBRARY                 SatSystemState.lib
+LIBRARY                 ws32.lib                // For RWsSession
+LIBRARY                 apgrfx.lib              // For TApaTask
+LIBRARY                 activitymanager.lib     // For CActivityManager
+
+#ifdef ENABLE_SAT_LOGGING
+LIBRARY                 flogger.lib
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/EventMonitors/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 EventMonitors
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+EventMonitors.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/EventMonitors/inc/CSatBIPChannelStatusMonitor.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,98 @@
+/*
+* 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:  Monitor of channel status events.
+*
+*/
+
+
+#ifndef CSATBIPCHANNELSTATUSMONITOR_H
+#define CSATBIPCHANNELSTATUSMONITOR_H
+
+// INCLUDES
+#include "CSatEventMonitorHandler.h"
+#include "MSatBIPChannelStatusObserver.h"
+
+// FORWARD DECLARATION
+class MSatBIPEventNotifier;
+
+// CLASS DECLARATION
+
+/**
+*  Monitors ChannelStatus event from BIP Data channels
+*
+*  @lib EventMonitors.lib
+*  @since Series 60 3.0
+*/
+class CSatBIPChannelStatusMonitor : public CSatEventMonitorHandler,
+                                    public MSatBIPChannelStatusObserver
+    {
+    public:  // Constructor and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aUtils Interface for Event monitor utils
+        */
+        static CSatBIPChannelStatusMonitor* NewL(
+            MSatEventMonitorUtils& aUtils );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSatBIPChannelStatusMonitor();
+
+    public: // From base class
+
+        /**
+        * From CSatEventMonitorHandler Cancels event monitoring
+        */
+        void DoCancelMonitor();
+
+        /**
+        * From MSatBIPChannelStatusObserver Notification of an event.
+        * @param aChannelId ID of the channel that started this event.
+        * @param aStatus Status that caused this event.
+        */
+        void ChannelStatus( const TInt aChannelId, const TInt aStatus );
+
+    protected: // New functions
+
+        /**
+        * From CSatEventMonitorHandler Starts event monitoring
+        * @return Error code indicating the status of starting the monitor
+        */
+        TInt StartMonitor();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        * @param aUtils Interface for Event monitor utils
+        */
+        CSatBIPChannelStatusMonitor( MSatEventMonitorUtils& aUtils );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private: // Data
+
+        // Indicates is this monitor active or not
+        TBool iIsActive;
+
+    };
+
+#endif      // CSATBIPCHANNELSTATUSMONITOR_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/EventMonitors/inc/CSatBIPDataAvailableMonitor.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,98 @@
+/*
+* 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:  Monitor of data receiving event.
+*
+*/
+
+
+#ifndef CSATBIPDATAAVAILABLEMONITOR_H
+#define CSATBIPDATAAVAILABLEMONITOR_H
+
+// INCLUDES
+#include "CSatEventMonitorHandler.h"
+#include "MSatBIPDataAvailableObserver.h"
+
+// FORWARD DECLARATION
+class MSatBIPEventNotifier;
+
+// CLASS DECLARATION
+
+/**
+*  Monitors DataAvailable event from BIP Data channels
+*
+*  @lib EventMonitors.lib
+*  @since Series 60 3.0
+*/
+class CSatBIPDataAvailableMonitor : public CSatEventMonitorHandler,
+                                    public MSatBIPDataAvailableObserver
+    {
+    public:  // Constructor and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aUtils Interface for Event monitor utils
+        */
+        static CSatBIPDataAvailableMonitor* NewL(
+            MSatEventMonitorUtils& aUtils );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSatBIPDataAvailableMonitor();
+
+    public: // From base class
+
+        /**
+        * From CSatEventMonitorHandler Cancels event monitoring
+        */
+        void DoCancelMonitor();
+
+        /**
+        * From MSatBIPDataAvailableObserver Notification of an event.
+        * @param aChannelId ID of the channel where the data is available.
+        * @param aLength Number of bytes available.
+        */
+        void DataAvailable( const TInt aChannelId, const TInt aLength );
+
+    protected: // New functions
+
+        /**
+        * From CSatEventMonitorHandler Starts event monitoring
+        * @return Error code indicating the status of starting the monitor
+        */
+        TInt StartMonitor();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        * @param aUtils Interface for Event monitor utils
+        */
+        CSatBIPDataAvailableMonitor( MSatEventMonitorUtils& aUtils );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private: // Data
+
+        // Indicates is this monitor active or not
+        TBool iIsActive;
+
+    };
+
+#endif      // CSATBIPDATAAVAILABLEMONITOR_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/EventMonitors/inc/CSatBrowserTerminationMonitor.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,110 @@
+/*
+* 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:  Monitors browser termination.
+*
+*/
+
+
+#ifndef CSATBROWSERTERMINATIONMONITOR_H
+#define CSATBROWSERTERMINATIONMONITOR_H
+
+// INCLUDES
+#include <w32std.h>
+#include "msatbrowserwsobserver.h"
+#include "CSatEventMonitorHandler.h"
+
+// FORWARD DECLARATION
+class CSatBrowserWSMonitor;
+
+// CLASS DECLARATION
+
+/**
+*  Monitors browser termination.
+*
+*  @lib EventMonitors.lib
+*  @since Series 60 3.0
+*/
+class CSatBrowserTerminationMonitor : public MSatBrowserWSObserver,
+                                      public CSatEventMonitorHandler
+    {
+    public:  // Constructor and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aUtils Event monitor utils interface
+        */
+        static CSatBrowserTerminationMonitor* NewL(
+            MSatEventMonitorUtils& aUtils );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSatBrowserTerminationMonitor();
+
+    public: // From base class
+
+        /**
+        * From CSatEventMonitorHandler Cancels event monitoring
+        */
+        void DoCancelMonitor();
+
+        /**
+        * This function is called when browser's thread has actually died.
+        * @param aCause The cause for the browser termination.
+        */
+        void NotifyBrowserTerminated(
+            const RSat::TBrowserTerminationCause aCause );
+
+    protected: // From CTimer
+
+        /**
+        * From CActive.
+        */
+        void RunL();
+
+        /**
+        * From CActive, implements the cancel protocol.
+        */
+        void DoCancel();
+
+    protected: // From CSatEventMonitorHandler
+
+        /**
+        * From CSatEventMonitorHandler Starts event monitoring
+        * @return Error code indicating the status of starting the monitor
+        */
+        TInt StartMonitor();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        * @param aUtils Event monitor utils interface
+        */
+        CSatBrowserTerminationMonitor( MSatEventMonitorUtils& aUtils );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private: // Data
+
+        // Window session termination monitor.
+        CSatBrowserWSMonitor* iWSMonitor;
+    };
+
+#endif      // CSATBROWSERTERMINATIONMONITOR_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/EventMonitors/inc/CSatBrowserThreadMonitor.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,114 @@
+/*
+* 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:  Monitors browser's thread death.
+*
+*/
+
+
+#ifndef CSATBROWSERTHREADMONITOR_H
+#define CSATBROWSERTHREADMONITOR_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class MSatBrowserThreadObserver;
+
+// CLASS DECLARATION
+
+/**
+*  Monitors the terminating of the browser and informs the observer when
+*  the browser is terminated.
+*
+*  @lib EventMonitors.lib
+*  @since Series 60 3.0
+*/
+
+class CSatBrowserThreadMonitor : public CActive
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aThread The thread of the browser.
+        */
+        static CSatBrowserThreadMonitor* NewL(
+            const RThread& aThread );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSatBrowserThreadMonitor();
+
+    public: // New functions
+
+        /**
+        * Starts Browser termination monitor.
+        * @param aObserver Observer for browser termination.
+        */
+        void StartMonitor(
+            MSatBrowserThreadObserver* aObserver );
+
+        /**
+        * Cancels event monitoring
+        */
+        void DoCancelMonitor();
+
+    protected: // Functions from base classes
+
+        /**
+        * From CActive, handles the request completion.
+        */
+        void RunL();
+
+        /**
+        * From CActive, implements the cancel protocol.
+        */
+        void DoCancel();
+
+    private: // Constructors
+
+        /**
+        * C++ default constructor.
+        * @param aMonitor Active object for the start of the browser.
+        * @param aThread The thread of the browser.
+        */
+        CSatBrowserThreadMonitor(
+            const RThread& aThread );
+
+        /**
+        * Fetch application exit cause.
+        * @return Exit cause.
+        */
+        RSat::TBrowserTerminationCause ExitCause() const;
+
+    private:
+
+        /**
+        * Starts browser termination monitor.
+        */
+        void Start();
+
+    private: // Data
+
+        // Active object for starting browser.
+        MSatBrowserThreadObserver* iObserver;
+
+        //  The thread of the browser.
+        RThread iThread;
+    };
+
+#endif      // CSATBROWSERTHREADMONITOR_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/EventMonitors/inc/CSatEventMonitorHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 event monitors
+*
+*/
+
+
+
+#ifndef CSATEVENTMONITORHANDLER_H
+#define CSATEVENTMONITORHANDLER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <etelsat.h>
+#include "MSatEventMonitor.h"
+
+// FORWARD DECLARATIONS
+class MSatEventMonitorUtils;
+
+
+// CLASS DECLARATION
+
+/**
+*  Base class for Event monitors. Responsible for
+*  starting and cancelling event monitoring and to inform
+*  Event observers of an event occurrence.
+*
+*  @lib EventMonitors.lib
+*  @since Series 60 3.0
+*/
+class CSatEventMonitorHandler : public CBase,
+                                public MSatEventMonitor
+    {
+    public:  // Constructor and destructor
+
+        /**
+        * C++ default constructor.
+        * @param aUtils Interface for Event monitor utils.
+        */
+        CSatEventMonitorHandler( MSatEventMonitorUtils& aUtils );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSatEventMonitorHandler();
+
+    public: // From base class
+
+        /**
+        * From MSatEventMonitor Cancels event monitoring
+        */
+        IMPORT_C void CancelMonitor();
+
+        /**
+        * From MSatEventMonitor Updates monitors state.
+        * This function call starts or cancels monitor
+        * @param aEvents A list of events to be monitored. If this monitors event
+        * is not on the list, this monitor is cancelled.
+        * @return TInt An error code indicating update status
+        */
+        IMPORT_C TInt UpdateMonitor( TUint aEvents );
+
+        /**
+        * From MSatEventMonitor Checks is this event monitor monitoring
+        * particular event.
+        * @param aEvent Event to check against
+        * @return ETrue if aEvent is the same event this is monitoring
+        */
+        IMPORT_C TBool IsMonitoringEvent( const TInt aEvent );
+
+    protected: // New functions
+
+        /**
+        * Starts event monitoring
+        * @return An error code indicating monitor start status
+        */
+        virtual TInt StartMonitor() = 0;
+
+        /**
+        * Cancels event monitoring
+        */
+        virtual void DoCancelMonitor() = 0;
+
+        /**
+        * Base class constructor
+        * @param aEvent Monitor ID from the derived event monitor.
+        */
+        void BaseConstructL( MSatEventMonitor::TEvent aEvent );
+
+        /**
+        * Passes event information to SatEngine when monitored event occurs.
+        * @param aIntArg An extra argument. Not all monitors use this.
+        * @param aSecArg An extra argument. Used if needed.
+        */
+        void EventOccured(
+            TInt aIntArg = -1,
+            TInt aSecArg = -1
+            );
+
+    protected: // Data
+
+        // Event container. Link to SatEngine
+        MSatEventMonitorUtils& iEventUtils;
+
+    private:
+
+        // Derived monitor's event
+        RSat::TEventList iEvent;
+
+        // Indicates is derived monitor SimRemovalMonitor
+        TBool iIsSimRemovalMonitor;
+
+        // Indicaties is SimRemovalMonitor active
+        TBool iSimRemovalMonitorActive;
+
+    };
+
+#endif      // CSATEVENTMONITORHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/EventMonitors/inc/CSatIdleScreenMonitor.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,93 @@
+/*
+* 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:  Monitor of idle screen availability.
+*
+*/
+
+
+
+#ifndef CSATIDLESCREENMONITOR_H
+#define CSATIDLESCREENMONITOR_H
+
+//  INCLUDES
+#include "MSatSystemStateObserver.h"
+#include "CSatEventMonitorHandler.h"
+
+// CLASS DECLARATION
+class MSatSystemStateChangeNotifier;
+
+/**
+*  Monitors idle screen state and informs SAT Engine if idle screen is available
+*
+*  @lib EventMonitors.lib
+*  @since Series 60 3.0
+*/
+class CSatIdleScreenMonitor : public CSatEventMonitorHandler,
+                              public MSatSystemStateObserver
+    {
+    public:  // Constructor and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aUtils Interface for Event monitor utils
+        */
+        static CSatIdleScreenMonitor* NewL(
+            MSatEventMonitorUtils& aUtils );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSatIdleScreenMonitor();
+
+    public: // From base class
+
+        /**
+        * From CSatEventMonitorHandler Cancels event monitoring
+        */
+        void DoCancelMonitor();
+
+        /**
+        * From MSatSystemStateObserver Notifies that system state changed.
+        */
+        void StateChanged();
+
+    protected: // New functions
+
+        /**
+        * From CSatEventMonitorHandler Starts event monitoring
+        * @return Error code indicating the status of starting the monitor
+        */
+        TInt StartMonitor();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        * @param aUtils Interface for Event monitor utils
+        */
+        CSatIdleScreenMonitor( MSatEventMonitorUtils& aUtils );
+
+        // ConstructL
+        void ConstructL();
+
+    private: // Data
+
+        // P&S change notifier
+        MSatSystemStateChangeNotifier* iPSNotifier;
+
+    };
+
+#endif      // CSATIDLESCREENMONITOR_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/EventMonitors/inc/CSatLanguageSelectionMonitor.h	Wed Jul 21 18:26:52 2010 +0300
@@ -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:  Monitor of language selection
+*
+*/
+
+
+#ifndef CSATLANGUAGESELECTIONMONITOR_H
+#define CSATLANGUAGESELECTIONMONITOR_H
+
+// INCLUDES
+#include "MSatSystemStateObserver.h"
+#include "CSatEventMonitorHandler.h"
+
+// FORWARD DECLARATIONS
+class MSatSystemStateChangeNotifier;
+
+// CLASS DECLARATION
+
+/**
+*  Monitors language selection events.
+*
+*  @lib EventMonitors.lib
+*  @since Series 60 3.0
+*/
+class CSatLanguageSelectionMonitor : public CSatEventMonitorHandler,
+                                     public MSatSystemStateObserver
+    {
+    public:  // Constructor and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aUtils Interface for Event monitor utils
+        */
+        static CSatLanguageSelectionMonitor* NewL(
+            MSatEventMonitorUtils& aUtils );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSatLanguageSelectionMonitor();
+
+    public: // From base class
+
+        /**
+        * From CSatEventMonitorHandler Cancels event monitoring
+        */
+        void DoCancelMonitor();
+
+        /**
+        * From MSatSystemStateObserver Notifies that system state changed.
+        * @param aValue ID of the selected language.
+        */
+        void StateChanged( const TInt aValue );
+
+    protected: // New functions
+
+        /**
+        * From CSatEventMonitorHandler Starts event monitoring
+        * @return Error code indicating the status of starting the monitor
+        */
+        TInt StartMonitor();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        * @param aUtils Interface for Event monitor utils
+        */
+        CSatLanguageSelectionMonitor( MSatEventMonitorUtils& aUtils );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private: // Data
+
+        // CentRep change notifier
+        MSatSystemStateChangeNotifier* iPSNotifier;
+
+    };
+
+#endif      // CSATLANGUAGESELECTIONMONITOR_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/EventMonitors/inc/CSatSimRemovalMonitor.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,96 @@
+/*
+* 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:  Monitor of SIM card removal
+*
+*/
+
+
+#ifndef CSATSIMREMOVALMONITOR_H
+#define CSATSIMREMOVALMONITOR_H
+
+//  INCLUDES
+#include "MSatSystemStateObserver.h"
+#include "CSatEventMonitorHandler.h"
+
+// FORWARD DECLARATION
+class MSatSystemStateChangeNotifier;
+
+// CLASS DECLARATION
+
+/**
+*  Monitors SIM removal state and informs SAT Engine if SIM gets removed.
+*
+*  @lib EventMonitors.lib
+*  @since Series 60 3.0
+*/
+class CSatSimRemovalMonitor : public CSatEventMonitorHandler,
+                              public MSatSystemStateObserver
+    {
+    public:  // Constructor and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aUtils Interface for Event monitor utils
+        */
+        static CSatSimRemovalMonitor* NewL(
+            MSatEventMonitorUtils& aUtils );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSatSimRemovalMonitor();
+
+    public: // From base class
+
+        /**
+        * From CSatEventMonitorHandler Cancels event monitoring
+        */
+        void DoCancelMonitor();
+
+        /**
+        * From MSatSystemStateObserver Notifies that system state changed.
+        */
+        void StateChanged();
+
+    protected: // New functions
+
+        /**
+        * From CSatEventMonitorHandler Starts event monitoring
+        * @return Error code indicating the status of starting the monitor
+        */
+        TInt StartMonitor();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        * @param aUtils Interface for Event monitor utils
+        */
+        CSatSimRemovalMonitor( MSatEventMonitorUtils& aUtils );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private: // Data
+
+        // P&S change notifier
+        MSatSystemStateChangeNotifier* iPSNotifier;
+
+    };
+
+#endif      // CSATSIMREMOVALMONITOR_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/EventMonitors/inc/CSatUserActivityMonitor.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,109 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Monitor of user activity
+*
+*/
+
+
+#ifndef CSATUSERACTIVITYMONITOR_H
+#define CSATUSERACTIVITYMONITOR_H
+
+#include <activitymanager.h>
+#include "CSatEventMonitorHandler.h"
+
+/**
+*  Monitors user activity and informs SAT Engine if there
+*  is no user activity in certain time.
+*
+*  @lib EventMonitors.lib
+*  @since Series 60 3.0
+*/
+class CSatUserActivityMonitor : public CSatEventMonitorHandler
+    {
+    public:  // Constructor and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aUtils Interface for Event monitor utils
+        */
+        static CSatUserActivityMonitor* NewL(
+            MSatEventMonitorUtils& aUtils );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSatUserActivityMonitor();
+
+    public: // From base class
+
+        /**
+        * From CSatEventMonitorHandler Cancels event monitoring
+        */
+        void DoCancelMonitor();
+
+    protected: // New functions
+
+        /**
+        * From CSatEventMonitorHandler Starts event monitoring
+        * @return Error code indicating the status of starting the monitor
+        */
+        TInt StartMonitor();
+
+    private:
+
+        /**
+        * Cancels monitoring of user activity.
+        */
+        void Cancel();
+
+        /**
+        * C++ default constructor.
+        * @param aUtils Interface for Event monitor utils
+        */
+        CSatUserActivityMonitor( MSatEventMonitorUtils& aUtils );
+
+        // ConstructL
+        void ConstructL();
+
+        /**
+        * Starts activity manager for user actions.
+        */
+        void StartActivityManagerL();
+
+        /**
+        * Called when user has been
+        * passive for a pre-defined period
+        * @param aPtr Pointer to creator, not currently used
+        * @return Completing result value
+        */
+        static TInt DispatchUserInactive( TAny* /* aPtr */ );
+
+        /**
+        * Called when user does something
+        * @param aPtr Pointer to creator
+        * @return Completing result value
+        */
+        static TInt DispatchUserActive( TAny* aPtr );
+
+    private: // Data
+
+        // Activity manager to follow user activity.
+        CUserActivityManager* iActivityManager;
+        // Indicates is this monitor active
+        TBool iMonitoring;
+    };
+
+#endif      // CSATUSERACTIVITYMONITOR_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/EventMonitors/inc/csatbrowserwsmonitor.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,142 @@
+/*
+* 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 browser window session termination.
+*
+*/
+
+
+#ifndef CSATBROWSERWSMONITOR_H
+#define CSATBROWSERWSMONITOR_H
+
+// INCLUDES
+#include <w32std.h>
+#include "CSatEventMonitorHandler.h"
+#include "msatbrowserthreadobserver.h"
+#include "msatbrowserwsobserver.h"
+
+// FORWARD DECLARATION
+class CSatBrowserThreadMonitor;
+class MSatBrowserWSObserver;
+
+// CLASS DECLARATION
+
+/**
+ * Monitors browser termination.
+ *
+ * @lib EventMonitors.lib
+ * @since Series 60 3.1
+ */
+class CSatBrowserWSMonitor : public MSatBrowserThreadObserver,
+                             public CActive
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     */
+    static CSatBrowserWSMonitor* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CSatBrowserWSMonitor();
+
+    /**
+     * From CSatEventMonitorHandler Starts event monitoring
+     * @param Browser termination observer.
+     * @return Error code indicating the status of starting the monitor
+     */
+    TInt StartMonitor(
+        MSatBrowserWSObserver* aObserver );
+
+    /**
+     * This function is called when browser's thread has actually died.
+     * @param aCause The cause for the browser termination.
+     */
+    void NotifyBrowserTerminated(
+        const RSat::TBrowserTerminationCause aCause );
+
+// From base class CActive
+
+    /**
+     * From CSatEventMonitorHandler Cancels event monitoring
+     */
+    void DoCancelMonitor();
+
+protected:
+
+// From base class CActive
+
+    /**
+     * From CActive.
+     */
+    void RunL();
+
+    /**
+     * From CActive, implements the cancel protocol.
+     */
+    void DoCancel();
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CSatBrowserWSMonitor();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+    /**
+     * Start to monitor Browser termination.
+     */
+    void Start();
+
+    /**
+     * Creates a window group and hides it from the UI.
+     */
+    void CreateWGL();
+
+private: // Data
+
+    /**
+     * Thread death monitor
+     */
+    CSatBrowserThreadMonitor* iThreadMonitor;
+
+    /**
+     * Indicates is window group created or not
+     */
+    TBool iWGCreated;
+
+    /**
+     * Browser termination observer.
+     */
+    MSatBrowserWSObserver* iObserver;
+
+    /**
+     * Window group
+     */
+    RWindowGroup iWg;
+
+    /**
+     * Window session
+     */
+    RWsSession iWsSession;
+
+    };
+
+#endif // CSATBROWSERWSMONITOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/EventMonitors/inc/msatbrowserthreadobserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,67 @@
+/*
+* 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:  Observer for browser termination.
+*
+*/
+
+
+#ifndef MSATBROWSERTHREADOBSERVER_H
+#define MSATBROWSERTHREADOBSERVER_H
+
+#include <w32std.h>
+
+/**
+ * Observer for browser termination.
+ *
+ * @lib EventMonitors.lib
+ * @since Series 60 3.1
+ */
+class MSatBrowserThreadObserver
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     * @param aUtils Event monitor utils interface
+     */
+    MSatBrowserThreadObserver() {};
+
+    /**
+     * Destructor.
+     */
+    virtual ~MSatBrowserThreadObserver() {};
+
+    /**
+     * Notification of browser termination.
+     * @param aCause The cause for the browser termination.
+     */
+    virtual void NotifyBrowserTerminated(
+        const RSat::TBrowserTerminationCause aCause ) = 0;
+
+private:
+
+    /**
+     * Prohibit copy constructor if not deriving from CBase.
+     */
+    MSatBrowserThreadObserver( const MSatBrowserThreadObserver& );
+
+    /**
+     * Prohibit assigment operator if not deriving from CBase.
+     */
+    MSatBrowserThreadObserver& operator=( const MSatBrowserThreadObserver& );
+
+    };
+
+#endif // MSATBROWSERTHREADOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/EventMonitors/inc/msatbrowserwsobserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,67 @@
+/*
+* 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:  Observer for browser termination.
+*
+*/
+
+
+#ifndef MSATBROWSERWSOBSERVER_H
+#define MSATBROWSERWSOBSERVER_H
+
+#include <w32std.h>
+
+/**
+ * Observer for browser termination.
+ *
+ * @lib EventMonitors.lib
+ * @since Series 60 3.1
+ */
+class MSatBrowserWSObserver
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     * @param aUtils Event monitor utils interface
+     */
+    MSatBrowserWSObserver() {};
+
+    /**
+     * Destructor.
+     */
+    virtual ~MSatBrowserWSObserver() {};
+
+    /**
+     * This function is called when browser's thread has actually died.
+     * @param aCause The cause for the browser termination.
+     */
+    virtual void NotifyBrowserTerminated(
+        const RSat::TBrowserTerminationCause aCause ) = 0;
+
+private:
+
+    /**
+     * Prohibit copy constructor if not deriving from CBase.
+     */
+    MSatBrowserWSObserver( const MSatBrowserWSObserver& );
+
+    /**
+     * Prohibit assigment operator if not deriving from CBase.
+     */
+    MSatBrowserWSObserver& operator=( const MSatBrowserWSObserver& );
+
+    };
+
+#endif // MSATBROWSERWSOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/EventMonitors/src/CSatBIPChannelStatusMonitor.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,150 @@
+/*
+* 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:  Monitor for Channel status events
+*
+*/
+
+
+// INCLUDE FILES
+#include    "CSatBIPChannelStatusMonitor.h"
+#include    "MSatEventMonitorUtils.h"
+#include    "MSatBIPEventNotifier.h"
+#include    "SatLog.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+// -----------------------------------------------------------------------------
+// CSatBIPChannelStatusMonitor::CSatBIPChannelStatusMonitor
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatBIPChannelStatusMonitor::CSatBIPChannelStatusMonitor(
+    MSatEventMonitorUtils& aUtils ) :
+    CSatEventMonitorHandler( aUtils )
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatBIPChannelStatusMonitor::\
+        CSatBIPChannelStatusMonitor calling-exiting" )
+    }
+
+// Destructor
+CSatBIPChannelStatusMonitor::~CSatBIPChannelStatusMonitor()
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatBIPChannelStatusMonitor::\
+        ~CSatBIPChannelStatusMonitor calling-exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBIPChannelStatusMonitor::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatBIPChannelStatusMonitor* CSatBIPChannelStatusMonitor::NewL(
+    MSatEventMonitorUtils& aUtils )
+    {
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBIPChannelStatusMonitor::NewL calling" )
+
+    CSatBIPChannelStatusMonitor* self =
+        new ( ELeave ) CSatBIPChannelStatusMonitor( aUtils );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBIPChannelStatusMonitor::NewL exiting" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBIPChannelStatusMonitor::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSatBIPChannelStatusMonitor::ConstructL()
+    {
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBIPChannelStatusMonitor::ConstructL calling" )
+
+    // Create base class and give this monitors event as a parameter
+    BaseConstructL( MSatEventMonitor::EChannelStatus );
+    iIsActive = EFalse;
+
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBIPChannelStatusMonitor::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBIPChannelStatusMonitor::DoCancelMonitor
+// Cancels monitor.
+// -----------------------------------------------------------------------------
+//
+void CSatBIPChannelStatusMonitor::DoCancelMonitor()
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatBIPChannelStatusMonitor::\
+        DoCancelMonitor calling" )
+
+    if ( iIsActive )
+        {
+        LOG( SIMPLE, "SATEVENTMONITORS: CSatBIPChannelStatusMonitor::\
+            DoCancelMonitor Canceling monitor" )
+        // Call MSatBIPEventNotifier.CancelChannelStatus
+        iEventUtils.BipNotifier().CancelChannelStatus();
+        }
+
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatBIPChannelStatusMonitor::\
+        DoCancelMonitor exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBIPChannelStatusMonitor::StartMonitor
+// Starts monitor.
+// -----------------------------------------------------------------------------
+//
+TInt CSatBIPChannelStatusMonitor::StartMonitor()
+    {
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBIPChannelStatusMonitor::StartMonitor calling" )
+
+    if ( !iIsActive )
+        {
+        LOG( NORMAL, "SATEVENTMONITORS: CSatBIPChannelStatusMonitor::\
+            StartMonitor Activating monitor" )
+        // Call MSatBIPEventNotifier.NotifyChannelStatus
+        iEventUtils.BipNotifier().NotifyChannelStatus( this );
+        }
+
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBIPChannelStatusMonitor::StartMonitor exiting" )
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBIPChannelStatusMonitor::ChannelStatus
+// Called when data is received
+// -----------------------------------------------------------------------------
+//
+void CSatBIPChannelStatusMonitor::ChannelStatus(
+    const TInt aChannelId, const TInt aStatus )
+    {
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBIPChannelStatusMonitor::ChannelStatus calling" )
+
+    // Send BIP Event.
+    EventOccured( aChannelId, aStatus );
+
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBIPChannelStatusMonitor::ChannelStatus exiting" )
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/EventMonitors/src/CSatBIPDataAvailableMonitor.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,150 @@
+/*
+* 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:  Monitor for Data available
+*
+*/
+
+
+// INCLUDE FILES
+#include    "CSatBIPDataAvailableMonitor.h"
+#include    "MSatEventMonitorUtils.h"
+#include    "MSatBIPEventNotifier.h"
+#include    "SatLog.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+// -----------------------------------------------------------------------------
+// CSatBIPDataAvailableMonitor::CSatBIPDataAvailableMonitor
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatBIPDataAvailableMonitor::CSatBIPDataAvailableMonitor(
+    MSatEventMonitorUtils& aUtils ) :
+    CSatEventMonitorHandler( aUtils )
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatBIPDataAvailableMonitor::\
+        CSatBIPDataAvailableMonitor calling-exiting" )
+    }
+
+// Destructor
+CSatBIPDataAvailableMonitor::~CSatBIPDataAvailableMonitor()
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatBIPDataAvailableMonitor::\
+        ~CSatBIPDataAvailableMonitor calling-exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBIPDataAvailableMonitor::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatBIPDataAvailableMonitor* CSatBIPDataAvailableMonitor::NewL(
+    MSatEventMonitorUtils& aUtils )
+    {
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBIPDataAvailableMonitor::NewL calling" )
+
+    CSatBIPDataAvailableMonitor* self =
+        new( ELeave ) CSatBIPDataAvailableMonitor( aUtils );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBIPDataAvailableMonitor::NewL exiting" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBIPDataAvailableMonitor::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSatBIPDataAvailableMonitor::ConstructL()
+    {
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBIPDataAvailableMonitor::ConstructL calling" )
+
+    // Create base class and give this monitors event as a parameter
+    BaseConstructL( MSatEventMonitor::EDataAvailable );
+    iIsActive = EFalse;
+
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBIPDataAvailableMonitor::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBIPDataAvailableMonitor::DoCancelMonitor
+// Cancels monitor.
+// -----------------------------------------------------------------------------
+//
+void CSatBIPDataAvailableMonitor::DoCancelMonitor()
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatBIPDataAvailableMonitor::\
+        DoCancelMonitor calling" )
+
+    if ( iIsActive )
+        {
+        LOG( NORMAL, "SATEVENTMONITORS: CSatBIPDataAvailableMonitor::\
+            DoCancelMonitor Canceling monitor" )
+        // Call MSatBIPEventNotifier.CancelDataAvailable
+        iEventUtils.BipNotifier().CancelDataAvailable();
+        }
+
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatBIPDataAvailableMonitor::\
+        DoCancelMonitor exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBIPDataAvailableMonitor::StartMonitor
+// Starts monitor.
+// -----------------------------------------------------------------------------
+//
+TInt CSatBIPDataAvailableMonitor::StartMonitor()
+    {
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBIPDataAvailableMonitor::StartMonitor calling" )
+
+    if ( !iIsActive )
+        {
+        LOG( NORMAL, "SATEVENTMONITORS: CSatBIPDataAvailableMonitor::\
+            StartMonitor Activating monitor" )
+        // Call MSatBIPEventNotifier.NotifyDataAvailable
+        iEventUtils.BipNotifier().NotifyDataAvailable( this );
+        }
+
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBIPDataAvailableMonitor::StartMonitor exiting" )
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBIPDataAvailableMonitor::DataAvailable
+// Called when data is received
+// -----------------------------------------------------------------------------
+//
+void CSatBIPDataAvailableMonitor::DataAvailable( const TInt aChannelId,
+    const TInt aLength )
+    {
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBIPDataAvailableMonitor::DataAvailable calling" )
+
+    // Inform SAT Engine that data is available.
+    EventOccured( aChannelId, aLength );
+
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBIPDataAvailableMonitor::DataAvailable exiting" )
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/EventMonitors/src/CSatBrowserTerminationMonitor.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,158 @@
+/*
+* 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:  Monitor for browser termination
+*
+*/
+
+
+// INCLUDE FILES
+#include    "csatbrowserwsmonitor.h"
+#include    "CSatBrowserTerminationMonitor.h"
+#include    "SatLog.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+// -----------------------------------------------------------------------------
+// CSatBrowserTerminationMonitor::CSatBrowserTerminationMonitor
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatBrowserTerminationMonitor::CSatBrowserTerminationMonitor(
+    MSatEventMonitorUtils& aUtils ) :
+    CSatEventMonitorHandler( aUtils )
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatBrowserTerminationMonitor::\
+        CSatBrowserTerminationMonitor calling-exiting" )
+    }
+
+// Destructor
+CSatBrowserTerminationMonitor::~CSatBrowserTerminationMonitor()
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatBrowserTerminationMonitor::\
+        ~CSatBrowserTerminationMonitor calling" )
+
+    if ( iWSMonitor )
+        {
+        iWSMonitor->DoCancelMonitor();
+        delete iWSMonitor;
+        iWSMonitor = NULL;
+        }
+
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatBrowserTerminationMonitor::\
+        ~CSatBrowserTerminationMonitor exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBrowserTerminationMonitor::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatBrowserTerminationMonitor* CSatBrowserTerminationMonitor::NewL(
+    MSatEventMonitorUtils& aUtils )
+    {
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBrowserTerminationMonitor::NewL calling" )
+
+    CSatBrowserTerminationMonitor* self =
+        new ( ELeave ) CSatBrowserTerminationMonitor( aUtils );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( /*self*/ );
+
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBrowserTerminationMonitor::NewL exiting" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBrowserTerminationMonitor::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSatBrowserTerminationMonitor::ConstructL()
+    {
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBrowserTerminationMonitor::ConstructL calling" )
+
+    // Create base class and give this monitors event as a parameter.
+    BaseConstructL( MSatEventMonitor::EBrowserTerminated );
+
+    // Create Windows session monitor.
+    iWSMonitor = CSatBrowserWSMonitor::NewL();
+
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBrowserTerminationMonitor::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBrowserTerminationMonitor::DoCancelMonitor
+// -----------------------------------------------------------------------------
+//
+void CSatBrowserTerminationMonitor::DoCancelMonitor()
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatBrowserTerminationMonitor::\
+        DoCancelMonitor calling" )
+
+    iWSMonitor->DoCancelMonitor();
+
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatBrowserTerminationMonitor::\
+        DoCancelMonitor exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBrowserTerminationMonitor::StartMonitor
+// -----------------------------------------------------------------------------
+//
+TInt CSatBrowserTerminationMonitor::StartMonitor()
+    {
+    LOG( SIMPLE,
+    "SATEVENTMONITORS: CSatBrowserTerminationMonitor::StartMonitor calling" )
+
+    if ( !iWSMonitor->IsActive() )
+        {
+        LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBrowserTerminationMonitor::StartMonitor \
+        StartMonitor" )
+        iWSMonitor->StartMonitor( this );
+        }
+
+    LOG( SIMPLE,
+    "SATEVENTMONITORS: CSatBrowserTerminationMonitor::StartMonitor exiting" )
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBrowserTerminationMonitor::NotifyBrowserTerminated
+// Sends event download notification to SAT Engine.
+// -----------------------------------------------------------------------------
+//
+void CSatBrowserTerminationMonitor::NotifyBrowserTerminated(
+    const RSat::TBrowserTerminationCause aCause )
+    {
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBrowserTerminationMonitor::BrowserTerminated \
+        calling" )
+
+    // Send cause to SAT Engine
+    EventOccured( aCause );
+
+    // Restart the monitor
+    StartMonitor();
+
+    LOG( SIMPLE,
+    "SATEVENTMONITORS: CSatBrowserTerminationMonitor::NotifyBrowserTerminated\
+    exiting" )
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/EventMonitors/src/CSatBrowserThreadMonitor.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,236 @@
+/*
+* 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:  Monitors browser's thread death.
+*
+*/
+
+
+// INCLUDE FILES
+#include    <etelsat.h>
+#include    <e32std.h>
+#include    "msatbrowserthreadobserver.h"
+#include    "CSatBrowserThreadMonitor.h"
+#include    "SatLog.h"
+
+
+// ================= MEMBER FUNCTIONS ==========================================
+
+// -----------------------------------------------------------------------------
+// CSatBrowserThreadMonitor::CSatBrowserThreadMonitor
+// The class constructor
+// -----------------------------------------------------------------------------
+//
+CSatBrowserThreadMonitor::CSatBrowserThreadMonitor(
+    const RThread& aThread ) :
+    CActive( EPriorityStandard ),
+    iThread( aThread )
+    {
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBrowserThreadMonitor::CSatBrowserThreadMonitor \
+        calling" )
+
+    CActiveScheduler::Add( this );
+
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBrowserThreadMonitor::CSatBrowserThreadMonitor \
+        exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSBrowserTerminationMonitor::NewL
+// Two-phased constructor
+// -----------------------------------------------------------------------------
+//
+CSatBrowserThreadMonitor* CSatBrowserThreadMonitor::NewL(
+    const RThread& aThread )
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatBrowserThreadMonitor::NewL calling" )
+
+    CSatBrowserThreadMonitor* self =
+        new( ELeave )CSatBrowserThreadMonitor( aThread );
+
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatBrowserThreadMonitor::NewL exiting" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBrowserThreadMonitor::~CSatBrowserThreadMonitor
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CSatBrowserThreadMonitor::~CSatBrowserThreadMonitor()
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatBrowserThreadMonitor::\
+        ~CSatBrowserThreadMonitor calling" )
+
+    // Cancel any outstanding requests.
+    Cancel();
+    iThread.Close();
+
+    iObserver = NULL;
+
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatBrowserThreadMonitor::\
+        ~CSatBrowserThreadMonitor exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBrowserThreadMonitor::StartMonitor
+// Starts the handler.
+// -----------------------------------------------------------------------------
+//
+void CSatBrowserThreadMonitor::StartMonitor(
+    MSatBrowserThreadObserver* aObserver )
+    {
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBrowserThreadMonitor::StartMonitor calling" )
+
+    iObserver = aObserver;
+
+    Start();
+
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBrowserThreadMonitor::StartMonitor exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBrowserThreadMonitor::Start
+// Starts the handler.
+// -----------------------------------------------------------------------------
+//
+void CSatBrowserThreadMonitor::Start()
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatBrowserThreadMonitor::Start calling" )
+
+    // Just in case.
+    Cancel();
+
+    // Monitor changes only in Browser Thread.
+    iThread.Logon( iStatus );
+    SetActive();
+
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatBrowserThreadMonitor::Start exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBrowserThreadMonitor::DoCancelMonitor
+// -----------------------------------------------------------------------------
+//
+void CSatBrowserThreadMonitor::DoCancelMonitor()
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatBrowserThreadMonitor::\
+        DoCancelMonitor calling" )
+
+    Cancel();
+
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatBrowserThreadMonitor::\
+        DoCancelMonitor exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBrowserThreadMonitor::RunL
+// Handles the command.
+// -----------------------------------------------------------------------------
+//
+void CSatBrowserThreadMonitor::RunL()
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatBrowserThreadMonitor::RunL calling" )
+
+    const TExitType exitType( iThread.ExitType() );
+
+    // Check whether the thread is alive.
+    if ( EExitPending == exitType )
+        {
+        LOG( SIMPLE, "SATEVENTMONITORS: CSatBrowserThreadMonitor::RunL() | \
+           iThread.ExitType = EExitPending , renew the request" )
+        // Renew the request.
+        Start();
+        }
+    // Thread has exited
+    else
+        {
+        LOG2( SIMPLE, "SATEVENTMONITORS: CSatBrowserThreadMonitor::RunL() | \
+            Thread has exited with exit code %i", exitType )
+
+        // Why did the browser exit.
+        RSat::TBrowserTerminationCause cause( ExitCause() );
+
+        // Call the event monitor with the cause of the thread termination.
+        iObserver->NotifyBrowserTerminated( cause );
+        }
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatBrowserThreadMonitor::RunL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBrowserThreadMonitor::DoCancel
+// Cancels the pending request.
+// -----------------------------------------------------------------------------
+//
+void CSatBrowserThreadMonitor::DoCancel()
+    {
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBrowserThreadMonitor::DoCancel calling" )
+
+    // No longer monitor this thread.
+    iThread.LogonCancel( iStatus );
+
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBrowserThreadMonitor::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBrowserThreadMonitor::ExitCause
+// Why did the application close.
+// -----------------------------------------------------------------------------
+//
+RSat::TBrowserTerminationCause CSatBrowserThreadMonitor::ExitCause() const
+    {
+    LOG( SIMPLE,
+    "SATEVENTMONITORS: CSatBrowserThreadMonitor::ExitCause calling" )
+
+    TExitType exitType = iThread.ExitType();
+    RSat::TBrowserTerminationCause terminationCause;
+    LOG2( SIMPLE,
+    "SATEVENTMONITORS: CSatBrowserThreadMonitor::ExitCause exitType: %d",
+    exitType )
+    switch ( exitType )
+        {
+        // The thread has ended as a result of a kill.
+        // i.e. Kill() has been called on the RThread.
+        case EExitKill:
+            {
+            terminationCause = RSat::EUserTermination;
+            break;
+            }
+
+        // The thread has been panicked.
+        case EExitPanic:
+            {
+            terminationCause = RSat::EErrorTermination;
+            break;
+            }
+
+        // The thread ended for unknown reasons.
+        default:
+            {
+            terminationCause = RSat::EUnknownCause;
+            break;
+            }
+        }
+
+    LOG2( SIMPLE, "SATEVENTMONITORS: CSatBrowserThreadMonitor::\
+        ExitCause exiting with value: %d", terminationCause )
+    return terminationCause;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/EventMonitors/src/CSatEventMonitorHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,258 @@
+/*
+* 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:  Base class for event monitors
+*
+*/
+
+
+// INCLUDE FILES
+#include    "CSatEventMonitorHandler.h"
+#include    "MSatEventMonitorUtils.h"
+#include    "SatLog.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+// -----------------------------------------------------------------------------
+// CSatEventMonitorHandler::CSatEventMonitorHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatEventMonitorHandler::CSatEventMonitorHandler(
+    MSatEventMonitorUtils& aUtils ) :
+    iEventUtils( aUtils )
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatEventMonitorHandler::\
+        CSatEventMonitorHandler calling-exiting" )
+    }
+
+// Destructor
+CSatEventMonitorHandler::~CSatEventMonitorHandler()
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatEventMonitorHandler::\
+        ~CSatEventMonitorHandler calling-exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatEventMonitorHandler::BaseConstructL
+// Constructor of this class.
+// -----------------------------------------------------------------------------
+//
+void CSatEventMonitorHandler::BaseConstructL( MSatEventMonitor::TEvent aEvent )
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatEventMonitorHandler::\
+        BaseConstructL calling" )
+
+    iIsSimRemovalMonitor = EFalse;
+    iSimRemovalMonitorActive = EFalse;
+
+    // Resolve correct event
+    switch ( aEvent )
+        {
+        case MSatEventMonitor::EUserActivity:
+            {
+            LOG( NORMAL, "SATEVENTMONITORS: CSatEventMonitorHandler::\
+                BaseConstructL User activity" )
+            iEvent = RSat::KUserActivity;
+            break;
+            }
+
+        case MSatEventMonitor::EIdleScreenAvailable:
+            {
+            LOG( NORMAL, "SATEVENTMONITORS: CSatEventMonitorHandler::\
+                BaseConstructL Idle Screen available" )
+            iEvent = RSat::KIdleScreenAvailable;
+            break;
+            }
+
+        case MSatEventMonitor::ELanguageSelection:
+            {
+            LOG( NORMAL, "SATEVENTMONITORS: CSatEventMonitorHandler::\
+                BaseConstructL Language selection" )
+            iEvent = RSat::KLanguageSelection;
+            break;
+            }
+
+        case MSatEventMonitor::ESimRemoved:
+            {
+            LOG( NORMAL, "SATEVENTMONITORS: CSatEventMonitorHandler::\
+                BaseConstructL SIM removal" )
+            // There is no event for sim removal event.
+            // The observer of events should cancel all monitors
+            // if sim is removed.
+            iIsSimRemovalMonitor = ETrue;
+            break;
+            }
+
+        case MSatEventMonitor::EBrowserTerminated:
+            {
+            LOG( NORMAL, "SATEVENTMONITORS: CSatEventMonitorHandler::\
+                BaseConstructL Browser termination" )
+            iEvent = RSat::KBrowserTermination;
+            break;
+            }
+
+        case MSatEventMonitor::EDataAvailable:
+            {
+            LOG( NORMAL, "SATEVENTMONITORS: CSatEventMonitorHandler::\
+                BaseConstructL Data available" )
+            iEvent = RSat::KDataAvailable;
+            break;
+            }
+
+        case MSatEventMonitor::EChannelStatus:
+            {
+            LOG( NORMAL, "SATEVENTMONITORS: CSatEventMonitorHandler::\
+                BaseConstructL Channel status" )
+            iEvent = RSat::KChannelStatus;
+            break;
+            }
+
+        default:
+            {
+            LOG( SIMPLE, "SATEVENTMONITORS: CSatEventMonitorHandler::\
+                BaseConstructL No implementation" )
+            }
+        }
+
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatEventMonitorHandler::\
+        BaseConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatEventMonitorHandler::CancelMonitor
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CSatEventMonitorHandler::CancelMonitor()
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatEventMonitorHandler::\
+        CancelMonitor calling" )
+
+    DoCancelMonitor();
+
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatEventMonitorHandler::\
+        CancelMonitor exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatEventMonitorHandler::UpdateMonitor
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CSatEventMonitorHandler::UpdateMonitor(
+    TUint aEvents )
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatEventMonitorHandler::\
+        UpdateMonitor calling" )
+
+    TInt errCode = KErrNone;
+
+    LOG2( DETAILED, "SATEVENTMONITORS: CSatEventMonitorHandler::aEvents = %d",
+        aEvents )
+    LOG2( DETAILED, "SATEVENTMONITORS: CSatEventMonitorHandler::iEvent = %d",
+        iEvent )
+
+    // There is no specific event ID for SIM removal monitor,
+    // so we have to check this different than others
+    if ( iIsSimRemovalMonitor )
+        {
+        LOG( NORMAL, "SATEVENTMONITORS: CSatEventMonitorHandler::\
+            IsSimRemovalMonitor" )
+
+        // If events list is not empty, start
+        // SIM removal monitor. Otherwise cancel it.
+        if ( aEvents != 0 )
+            {
+            LOG( NORMAL, "SATEVENTMONITORS: CSatEventMonitorHandler::\
+                IsSimRemovalMonitor - Events list is not empty" )
+            // Start SIM removal monitor only if it is not already active
+            if ( !iSimRemovalMonitorActive )
+                {
+                LOG( NORMAL, "SATEVENTMONITORS: CSatEventMonitorHandler::\
+                    IsSimRemovalMonitor - Start SIM removal monitor" )
+                errCode = StartMonitor();
+                iSimRemovalMonitorActive = ETrue;
+                }
+            }
+        else
+            {
+            LOG( NORMAL, "SATEVENTMONITORS: CSatEventMonitorHandler::\
+                IsSimRemovalMonitor - Cancel monitor" )
+            CancelMonitor();
+            iSimRemovalMonitorActive = EFalse;
+            }
+        }
+
+    // Check is derived monitor in list
+    else if ( aEvents & iEvent )
+        {
+        LOG( NORMAL, "SATEVENTMONITORS: CSatEventMonitorHandler::\
+            UpdateMonitor Starting monitor" )
+        // Monitor found, start monitor
+        errCode = StartMonitor();
+        }
+    else
+        {
+        LOG( NORMAL, "SATEVENTMONITORS: CSatEventMonitorHandler::\
+            UpdateMonitor Cancelling monitor" )
+        // Monitor not in list, cancel monitor
+        CancelMonitor();
+        }
+
+    LOG2( SIMPLE, "SATEVENTMONITORS: CSatEventMonitorHandler::\
+        UpdateMonitor exiting with value: %d", errCode )
+    return errCode;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatEventMonitorHandler::IsMonitoringEvent
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool CSatEventMonitorHandler::IsMonitoringEvent( const TInt aEvent )
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatEventMonitorHandler::\
+        IsMonitoringEvent calling-exiting" )
+    return ( aEvent == iEvent );
+    }
+
+// -----------------------------------------------------------------------------
+// CSatEventMonitorHandler::EventOccured
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatEventMonitorHandler::EventOccured( TInt aIntArg, TInt aSecArg )
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatEventMonitorHandler::\
+        EventOccured calling" )
+
+    // Check is this SimRemoval monitor.
+    if ( iIsSimRemovalMonitor )
+        {
+        LOG( SIMPLE, "SATEVENTMONITORS: CSatEventMonitorHandler::\
+        EventOccured iIsSimRemovalMonitor true" )
+        // Yes, Inform observer that SIM is removed
+        iEventUtils.SimRemoved();
+        }
+    else
+        {
+        // No, Inform normal event occurrence
+        iEventUtils.EventDownload( iEvent, aIntArg, aSecArg );
+        }
+
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatEventMonitorHandler::\
+        EventOccured exiting" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/EventMonitors/src/CSatIdleScreenMonitor.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,145 @@
+/*
+* 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:  Monitor for idle screen availability.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "TSatSystemStateFactory.h"
+#include    "MSatSystemStateChangeNotifier.h"
+#include    "CSatIdleScreenMonitor.h"
+#include    "SatLog.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+// -----------------------------------------------------------------------------
+// CSatIdleScreenMonitor::CSatIdleScreenMonitor
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatIdleScreenMonitor::CSatIdleScreenMonitor(
+    MSatEventMonitorUtils& aUtils ) :
+    CSatEventMonitorHandler( aUtils )
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatIdleScreenMonitor::\
+        CSatIdleScreenMonitor calling-exiting" )
+    }
+
+// Destructor
+CSatIdleScreenMonitor::~CSatIdleScreenMonitor()
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS:CSatIdleScreenMonitor::\
+        ~CSatIdleScreenMonitor calling" )
+
+    delete iPSNotifier;
+
+    LOG( SIMPLE, "SATEVENTMONITORS:CSatIdleScreenMonitor::\
+        ~CSatIdleScreenMonitor exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatIdleScreenMonitor::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatIdleScreenMonitor* CSatIdleScreenMonitor::NewL(
+    MSatEventMonitorUtils& aUtils )
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS:CSatIdleScreenMonitor::NewL calling" )
+
+    CSatIdleScreenMonitor* self = new( ELeave ) CSatIdleScreenMonitor( aUtils );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "SATEVENTMONITORS:CSatIdleScreenMonitor::NewL exiting" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatIdleScreenMonitor::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSatIdleScreenMonitor::ConstructL()
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS:CSatIdleScreenMonitor::\
+        ConstructL calling" )
+
+    // Create base class and give this monitors event as a parameter
+    BaseConstructL( MSatEventMonitor::EIdleScreenAvailable );
+    iPSNotifier =
+        TSatSystemStateFactory::CreateIdleModeChangeNotifierL( *this );
+
+    LOG( SIMPLE, "SATEVENTMONITORS:CSatIdleScreenMonitor::\
+        ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatIdleScreenMonitor::DoCancelMonitor
+// Cancels monitor.
+// -----------------------------------------------------------------------------
+//
+void CSatIdleScreenMonitor::DoCancelMonitor()
+    {
+    LOG( SIMPLE,
+        "SATEVENTMONITORS:CSatIdleScreenMonitor::DoCancelMonitor calling" )
+
+    iPSNotifier->CancelNotify();
+
+    LOG( SIMPLE,
+        "SATEVENTMONITORS:CSatIdleScreenMonitor::DoCancelMonitor exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatIdleScreenMonitor::StartMonitor
+// Starts monitor.
+// -----------------------------------------------------------------------------
+//
+TInt CSatIdleScreenMonitor::StartMonitor()
+    {
+    LOG( SIMPLE,
+        "SATEVENTMONITORS:CSatIdleScreenMonitor::StartMonitor calling" )
+
+    // Cancel first, it might be activated already
+    DoCancelMonitor();
+
+    // Now start it again
+    TRAPD( err, iPSNotifier->NotifyChangeL() );
+
+    LOG2( SIMPLE, "SATEVENTMONITORS:CSatIdleScreenMonitor::\
+        StartMonitor exiting with code: %d", err )
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatIdleScreenMonitor::StateChanged
+// Called when idle screen is available.
+// -----------------------------------------------------------------------------
+//
+void CSatIdleScreenMonitor::StateChanged()
+    {
+    LOG( SIMPLE,
+        "SATEVENTMONITORS:CSatIdleScreenMonitor::StateChanged calling" )
+
+    // Inform SAT Engine that idle screen is available.
+    EventOccured();
+
+    LOG( SIMPLE,
+        "SATEVENTMONITORS:CSatIdleScreenMonitor::StateChanged exiting" )
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/EventMonitors/src/CSatLanguageSelectionMonitor.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -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:  Monitor for SIM removal
+*
+*/
+
+
+// INCLUDE FILES
+#include    "TSatSystemStateFactory.h"
+#include    "MSatSystemStateChangeNotifier.h"
+#include    "MSatEventMonitorUtils.h"
+#include    "CSatLanguageSelectionMonitor.h"
+#include    "SatLog.h"
+
+// CONSTANTS
+const TInt KSecond( 1000 );
+
+// ============================ MEMBER FUNCTIONS ===============================
+// -----------------------------------------------------------------------------
+// CSatLanguageSelectionMonitor::CSatLanguageSelectionMonitor
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatLanguageSelectionMonitor::CSatLanguageSelectionMonitor(
+    MSatEventMonitorUtils& aUtils ) :
+    CSatEventMonitorHandler( aUtils )
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatLanguageSelectionMonitor::\
+        CSatLanguageSelectionMonitor calling-exiting" )
+    }
+
+// Destructor
+CSatLanguageSelectionMonitor::~CSatLanguageSelectionMonitor()
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatLanguageSelectionMonitor::\
+        ~CSatLanguageSelectionMonitor calling" )
+
+    delete iPSNotifier;
+
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatLanguageSelectionMonitor::\
+        ~CSatLanguageSelectionMonitor exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatLanguageSelectionMonitor::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatLanguageSelectionMonitor* CSatLanguageSelectionMonitor::NewL(
+    MSatEventMonitorUtils& aUtils )
+    {
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatLanguageSelectionMonitor::NewL calling" )
+
+    CSatLanguageSelectionMonitor* self =
+        new( ELeave ) CSatLanguageSelectionMonitor( aUtils );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatLanguageSelectionMonitor::NewL exiting" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatLanguageSelectionMonitor::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSatLanguageSelectionMonitor::ConstructL()
+    {
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatLanguageSelectionMonitor::ConstructL calling" )
+
+    // Create base class and give this monitors event as a parameter
+    BaseConstructL( MSatEventMonitor::ELanguageSelection );
+    iPSNotifier =
+        TSatSystemStateFactory::CreateLanguageSelectionChangeNotifierL( *this );
+
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatLanguageSelectionMonitor::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatLanguageSelectionMonitor::DoCancelMonitor
+// Cancels monitor.
+// -----------------------------------------------------------------------------
+//
+void CSatLanguageSelectionMonitor::DoCancelMonitor()
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatLanguageSelectionMonitor::\
+        DoCancelMonitor calling" )
+
+    iPSNotifier->CancelNotify();
+    iEventUtils.WriteLanguageSelectionTime( KErrNone );
+
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatLanguageSelectionMonitor::\
+        DoCancelMonitor exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatLanguageSelectionMonitor::StartMonitor
+// Starts monitor.
+// -----------------------------------------------------------------------------
+//
+TInt CSatLanguageSelectionMonitor::StartMonitor()
+    {
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatLanguageSelectionMonitor::StartMonitor calling" )
+
+    // Cancel first, it might be activated already
+    DoCancelMonitor();
+
+    // Now start
+    TRAPD( err, iPSNotifier->NotifyChangeL() );
+    iEventUtils.WriteLanguageSelectionTime( KSecond );
+
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatLanguageSelectionMonitor::StartMonitor exiting" )
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatLanguageSelectionMonitor::StateChanged
+// Called when SIM is removed.
+// -----------------------------------------------------------------------------
+//
+void CSatLanguageSelectionMonitor::StateChanged( const TInt aValue )
+    {
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatLanguageSelectionMonitor::StateChanged calling" )
+
+    // Inform SAT Engine that language is been changed.
+    EventOccured( aValue );
+
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatLanguageSelectionMonitor::StateChanged exiting" )
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/EventMonitors/src/CSatSimRemovalMonitor.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,144 @@
+/*
+* 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:  Monitor for SIM removal
+*
+*/
+
+
+// INCLUDE FILES
+#include    "TSatSystemStateFactory.h"
+#include    "MSatSystemStateChangeNotifier.h"
+#include    "CSatSimRemovalMonitor.h"
+#include    "SatLog.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+// -----------------------------------------------------------------------------
+// CSatSimRemovalMonitor::CSatSimRemovalMonitor
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatSimRemovalMonitor::CSatSimRemovalMonitor(
+    MSatEventMonitorUtils& aUtils ) :
+    CSatEventMonitorHandler( aUtils )
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatSimRemovalMonitor::\
+        CSatSimRemovalMonitor calling-exiting" )
+    }
+
+// Destructor
+CSatSimRemovalMonitor::~CSatSimRemovalMonitor()
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatSimRemovalMonitor::\
+        ~CSatSimRemovalMonitor calling" )
+
+    delete iPSNotifier;
+
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatSimRemovalMonitor::\
+        ~CSatSimRemovalMonitor exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSimRemovalMonitor::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatSimRemovalMonitor* CSatSimRemovalMonitor::NewL(
+    MSatEventMonitorUtils& aUtils )
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatSimRemovalMonitor::NewL calling" )
+
+    CSatSimRemovalMonitor* self = new( ELeave ) CSatSimRemovalMonitor( aUtils );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatSimRemovalMonitor::NewL exiting" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSimRemovalMonitor::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSatSimRemovalMonitor::ConstructL()
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatSimRemovalMonitor::ConstructL calling" )
+
+    // Create base class and give this monitors event as a parameter
+    BaseConstructL( MSatEventMonitor::ESimRemoved );
+
+    iPSNotifier =
+        TSatSystemStateFactory::CreateSimStatusChangeNotifierL( *this );
+
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatSimRemovalMonitor::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSimRemovalMonitor::DoCancelMonitor
+// Cancels monitor.
+// -----------------------------------------------------------------------------
+//
+void CSatSimRemovalMonitor::DoCancelMonitor()
+    {
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatSimRemovalMonitor::DoCancelMonitor calling" )
+
+    iPSNotifier->CancelNotify();
+
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatSimRemovalMonitor::DoCancelMonitor exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSimRemovalMonitor::StartMonitor
+// Starts monitor.
+// -----------------------------------------------------------------------------
+//
+TInt CSatSimRemovalMonitor::StartMonitor()
+    {
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatSimRemovalMonitor::StartMonitor calling" )
+
+    // Cancel first. It might be activated already
+    DoCancelMonitor();
+
+    // Now start it again.
+    TRAPD( err, iPSNotifier->NotifyChangeL() );
+
+    LOG2( SIMPLE, "SATEVENTMONITORS: CSatSimRemovalMonitor::StartMonitor \
+        exiting with value: %d", err )
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSimRemovalMonitor::StateChanged
+// Called when SIM is removed.
+// -----------------------------------------------------------------------------
+//
+void CSatSimRemovalMonitor::StateChanged()
+    {
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatSimRemovalMonitor::StateChanged calling" )
+
+    // Inform SAT Engine that SIM status state has changed.
+    EventOccured();
+
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatSimRemovalMonitor::StateChanged exiting" )
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/EventMonitors/src/CSatUserActivityMonitor.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,249 @@
+/*
+* 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:  Monitor for user activity
+*
+*/
+
+
+// INCLUDE FILES
+#include    "CSatUserActivityMonitor.h"
+#include    "SatLog.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSatUserActivityMonitor::CSatUserActivityMonitor
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatUserActivityMonitor::CSatUserActivityMonitor(
+    MSatEventMonitorUtils& aUtils ) :
+    CSatEventMonitorHandler( aUtils )
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatUserActivityMonitor::\
+        CSatUserActivityMonitor calling" )
+
+    iActivityManager = NULL;
+
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatUserActivityMonitor::\
+        CSatUserActivityMonitor exiting" )
+    }
+
+// Destructor
+CSatUserActivityMonitor::~CSatUserActivityMonitor()
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatUserActivityMonitor::\
+        ~CSatUserActivityMonitor calling" )
+
+    Cancel();
+
+    if ( iActivityManager )
+        {
+        delete iActivityManager;
+        iActivityManager = NULL;
+        }
+
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatUserActivityMonitor::\
+        ~CSatUserActivityMonitor exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatUserActivityMonitor::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatUserActivityMonitor* CSatUserActivityMonitor::NewL(
+    MSatEventMonitorUtils& aUtils )
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatUserActivityMonitor::NewL calling" )
+
+    CSatUserActivityMonitor* self =
+        new( ELeave ) CSatUserActivityMonitor( aUtils );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatUserActivityMonitor::NewL exiting" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatUserActivityMonitor::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSatUserActivityMonitor::ConstructL()
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatUserActivityMonitor::\
+        ConstructL calling" )
+
+    // Create base class and give this monitors event as a parameter
+    BaseConstructL( MSatEventMonitor::EUserActivity );
+    iMonitoring = EFalse;
+
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatUserActivityMonitor::\
+        ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatUserActivityMonitor::StartActivityManagerL
+// Called when user has been inactive for a pre-defined time period
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatUserActivityMonitor::StartActivityManagerL()
+    {
+    LOG( SIMPLE,"SATEVENTMONITORS: \
+        CSatUserActivityMonitor::StartActivityManag calling" )
+
+    // Delete activity manager if it exists
+    if ( iActivityManager )
+        {
+        LOG( SIMPLE,"SATEVENTMONITORS: \
+        CSatUserActivityMonitor::StartActivityManag iActivityManager true" )
+        iActivityManager->Cancel();
+        delete iActivityManager;
+        iActivityManager = NULL;
+        }
+
+    iMonitoring = ETrue;
+
+    iActivityManager = CUserActivityManager::NewL( EPriorityNormal );
+    iActivityManager->Start(
+        TTimeIntervalSeconds( 1 ),
+        TCallBack( DispatchUserInactive, this ),
+        TCallBack( DispatchUserActive, this ) );
+
+    // Changes checking immediatelly activity,
+    // activity before exceeding one second.
+    iActivityManager->SetInactivityTimeout( TTimeIntervalSeconds( 0 ) );
+
+    LOG( SIMPLE, "SATEVENTMONITORS: \
+        CSatUserActivityMonitor::StartActivityManagerL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatUserActivityMonitor::DispatchUserInactive
+// Called when user has been inactive for a pre-defined time period
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CSatUserActivityMonitor::DispatchUserInactive( TAny* /* aPtr */ )
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: \
+        CSatUserActivityMonitor::DispatchUserInactive calling/exiting" )
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatUserActivityMonitor::DispatchUserActive
+// Called when user does something
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CSatUserActivityMonitor::DispatchUserActive( TAny* aPtr )
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: \
+        CSatUserActivityMonitor::DispatchUserActive calling" )
+
+    TInt retVal( KErrNone );
+
+    if ( aPtr )
+        {
+        LOG( SIMPLE, "SATEVENTMONITORS: \
+        CSatUserActivityMonitor::DispatchUserActive aPtr true" )
+        CSatUserActivityMonitor* ptrThis = 
+            static_cast<CSatUserActivityMonitor*>( aPtr );
+        if ( ptrThis->iMonitoring )
+            {
+            LOG( SIMPLE, "SATEVENTMONITORS: \
+            CSatUserActivityMonitor::DispatchUserActive ptrThis->iMonitoring" )
+            // Notify observer and set flag off, no more monitoring.
+            ptrThis->EventOccured();
+            ptrThis->iMonitoring = EFalse;
+            }
+        else
+            {
+            retVal = KErrCancel;
+            }
+        }
+    LOG2( SIMPLE, "SATEVENTMONITORS: CSatUserActivityMonitor::\
+    DispatchUserActive exiting, retVal: %d", retVal )
+    return retVal;    
+    }
+
+// -----------------------------------------------------------------------------
+// CSatUserActivityMonitor::DoCancelMonitor
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSatUserActivityMonitor::DoCancelMonitor()
+    {
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatUserActivityMonitor::DoCancelMonitor calling" )
+
+    Cancel();
+
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatUserActivityMonitor::DoCancelMonitor exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatUserActivityMonitor::StartMonitor
+// Starts monitoring the user activity. The real start of user actitivity
+// monitoring starts in RunL, after call of Inactivity( 0 ), which causes run of
+// RunL immediatly. The inacativity call is needed to reset the user activity
+// timers in User class.
+// -----------------------------------------------------------------------------
+//
+TInt CSatUserActivityMonitor::StartMonitor()
+    {
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatUserActivityMonitor::StartMonitor calling" )
+
+    // Starts activity manager.
+    TRAPD( err, StartActivityManagerL() );
+
+    LOG2( SIMPLE,
+        "SATEVENTMONITORS: CSatUserActivityMonitor::StartMonitor exiting,\
+        err: %d", err )
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatUserActivityMonitor::Cancel
+// Cancels user activity monitor.
+// If activity manager is active, cancels request
+// and deletes activity manager.
+// -----------------------------------------------------------------------------
+//
+void CSatUserActivityMonitor::Cancel()
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatUserActivityMonitor::Cancel calling" )
+
+    if ( iActivityManager )
+        {
+        LOG( DETAILED,
+            "SATEVENTMONITORS: CSatUAMon::Cancel AM Cancel call" )
+        iActivityManager->Cancel();
+
+        delete iActivityManager;
+        iActivityManager = NULL;
+        }
+
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatUserActivityMonitor::Cancel exiting" )
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/EventMonitors/src/TSatEventMonitorFactory.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,118 @@
+/*
+* 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:  Factory for event monitors
+*
+*/
+
+
+// INCLUDE FILES
+#include    "TSatEventMonitorFactory.h"
+#include    "MSatEventMonitor.h"
+#include    "CSatSimRemovalMonitor.h"
+#include    "CSatUserActivityMonitor.h"
+#include    "CSatIdleScreenMonitor.h"
+#include    "CSatLanguageSelectionMonitor.h"
+#include    "CSatBrowserTerminationMonitor.h"
+#include    "CSatBIPDataAvailableMonitor.h"
+#include    "CSatBIPChannelStatusMonitor.h"
+#include    "SatLog.h"
+
+// ============================ LOCAL FUNCTIONS ================================
+
+// -----------------------------------------------------------------------------
+// CleanupEventMonitors
+// Remove and destroy items from the specified array.
+// @param aArray An array whose items need to be removed and destroyed.
+// -----------------------------------------------------------------------------
+//
+LOCAL_C void CleanupEventMonitors( TAny* aArray )
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CleanupEventMonitors calling" )
+    
+    CArrayPtrFlat<MSatEventMonitor>* array = 
+        static_cast< CArrayPtrFlat< MSatEventMonitor >* >(aArray);
+    array->ResetAndDestroy();
+    
+    LOG( SIMPLE, "SATEVENTMONITORS: CleanupEventMonitors exiting" )
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TSatEventMonitorFactory::CreateEventMonitorsL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CArrayPtrFlat<MSatEventMonitor>* TSatEventMonitorFactory::
+    CreateEventMonitorsL( MSatEventMonitorUtils& aUtils )
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: TSatEventMonitorFactory::\
+        CreateEventMonitorsL calling" )
+
+    CArrayPtrFlat<MSatEventMonitor>* array =
+        new( ELeave ) CArrayPtrFlat<MSatEventMonitor>( 1 );
+    CleanupStack::PushL( TCleanupItem(CleanupEventMonitors, array) );
+    
+    MSatEventMonitor* eventMonitor = NULL;
+    // Add event monitors
+    eventMonitor = 
+        CSatSimRemovalMonitor::NewL( aUtils );
+    CleanupStack::PushL( eventMonitor );
+    array->AppendL( eventMonitor );
+    CleanupStack::Pop( eventMonitor );
+    
+    eventMonitor = 
+        CSatUserActivityMonitor::NewL( aUtils );
+    CleanupStack::PushL( eventMonitor );
+    array->AppendL( eventMonitor );
+    CleanupStack::Pop( eventMonitor );
+    
+    eventMonitor = 
+        CSatIdleScreenMonitor::NewL( aUtils );
+    CleanupStack::PushL( eventMonitor );
+    array->AppendL( eventMonitor );
+    CleanupStack::Pop( eventMonitor );    
+        
+    eventMonitor = 
+        CSatLanguageSelectionMonitor::NewL( aUtils );
+    CleanupStack::PushL( eventMonitor );
+    array->AppendL( eventMonitor );
+    CleanupStack::Pop( eventMonitor ); 
+    
+    eventMonitor = 
+        CSatBrowserTerminationMonitor::NewL( aUtils );
+    CleanupStack::PushL( eventMonitor );
+    array->AppendL( eventMonitor );
+    CleanupStack::Pop( eventMonitor ); 
+    
+    eventMonitor = 
+        CSatBIPDataAvailableMonitor::NewL( aUtils );
+    CleanupStack::PushL( eventMonitor );
+    array->AppendL( eventMonitor );
+    CleanupStack::Pop( eventMonitor );
+    
+    eventMonitor = 
+        CSatBIPChannelStatusMonitor::NewL( aUtils );
+    CleanupStack::PushL( eventMonitor );
+    array->AppendL( eventMonitor );
+    CleanupStack::Pop( eventMonitor );     
+
+    CleanupStack::Pop( array );
+
+    LOG( SIMPLE, "SATEVENTMONITORS: TSatEventMonitorFactory::\
+        CreateEventMonitorsL exiting" )
+    return array;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/EventMonitors/src/csatbrowserwsmonitor.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,324 @@
+/*
+* 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:  Monitor for browser termination
+*
+*/
+
+
+// INCLUDE FILES
+#include    <etelsat.h>
+#include    <apgtask.h>
+#include    <DocumentHandler.h>  //KWmlcHandler
+#include    "CSatBrowserThreadMonitor.h"
+#include    "csatbrowserwsmonitor.h"
+#include    "SatLog.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// CSatBrowserWSMonitor::CSatBrowserWSMonitor
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatBrowserWSMonitor::CSatBrowserWSMonitor() :
+    CActive( CActive::EPriorityStandard )
+    {
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBrowserWSMonitor::CSatBrowserWSMonitor calling" )
+
+    CActiveScheduler::Add( this );
+
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBrowserWSMonitor::CSatBrowserWSMonitor exiting" )
+    }
+
+// Destructor
+CSatBrowserWSMonitor::~CSatBrowserWSMonitor()
+    {
+    LOG( SIMPLE,
+    "SATEVENTMONITORS: CSatBrowserWSMonitor::~CSatBrowserWSMonitor calling" )
+
+    // Cancel any outstanding requests.
+    Cancel();
+
+    if ( iThreadMonitor )
+        {
+        iThreadMonitor->DoCancelMonitor();
+        delete iThreadMonitor;
+        iThreadMonitor = NULL;
+        }
+
+    iObserver = NULL;
+
+    iWg.Close();
+    iWsSession.Close();
+
+    LOG( SIMPLE,
+    "SATEVENTMONITORS: CSatBrowserWSMonitor::~CSatBrowserWSMonitor exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBrowserWSMonitor::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatBrowserWSMonitor* CSatBrowserWSMonitor::NewL()
+    {
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBrowserWSMonitor::NewL calling" )
+
+    CSatBrowserWSMonitor* self =
+        new ( ELeave ) CSatBrowserWSMonitor();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( /*self*/ );
+
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBrowserWSMonitor::NewL exiting" )
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBrowserWSMonitor::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSatBrowserWSMonitor::ConstructL()
+    {
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBrowserWSMonitor::ConstructL calling" )
+    // Window session is created when event is requested
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBrowserWSMonitor::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBrowserWSMonitor::DoCancelMonitor
+// -----------------------------------------------------------------------------
+//
+void CSatBrowserWSMonitor::DoCancelMonitor()
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatBrowserWSMonitor::\
+        DoCancelMonitor calling" )
+
+    Cancel();
+
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatBrowserWSMonitor::\
+        DoCancelMonitor exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBrowserWSMonitor::StartMonitor
+// -----------------------------------------------------------------------------
+//
+TInt CSatBrowserWSMonitor::StartMonitor(
+    MSatBrowserWSObserver* aObserver )
+    {
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBrowserWSMonitor::StartMonitor calling" )
+    TInt err( KErrNone );
+    
+    if ( !iWGCreated )
+        {
+        // First time called, create needed services
+        LOG( SIMPLE,"SATEVENTMONITORS: CSatBrowserWSMonitor::StartMonitor \
+            connect to WsSession " )
+        err = iWsSession.Connect();
+        if ( KErrNone == err )
+            {
+            // Creates a window group
+            TRAP( err, CreateWGL() );
+            }
+        }
+
+    iObserver = aObserver;
+
+    if ( !err )
+        {
+        // All fine, start monitoring
+        Start();
+        }
+        
+    LOG2( SIMPLE,
+        "SATEVENTMONITORS: CSatBrowserWSMonitor::StartMonitor exiting err=%d",\
+            err )
+    
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBrowserWSMonitor::Start
+// -----------------------------------------------------------------------------
+//
+void CSatBrowserWSMonitor::Start()
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatBrowserWSMonitor::Start calling" )
+
+    Cancel();
+
+    // It migth be null already
+    if ( iThreadMonitor )
+        {
+        LOG( SIMPLE, 
+        "SATEVENTMONITORS: CSatBrowserWSMonitor::Start iThreadMonitor true" )
+        delete iThreadMonitor;
+        iThreadMonitor = NULL;
+        }
+
+    iWsSession.EventReady( &iStatus );
+    SetActive();
+
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatBrowserWSMonitor::Start exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBrowserWSMonitor::RunL
+// Checks is the WML Browser launched and creates browser thread monitor to
+// monitor browsers thread death.
+// -----------------------------------------------------------------------------
+//
+void CSatBrowserWSMonitor::RunL()
+    {
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBrowserWSMonitor::RunL calling" )
+
+    // Get the status of this object.
+    const TInt errCode( iStatus.Int() );
+    LOG2( SIMPLE,
+    "SATEVENTMONITORS: CSatBrowserWSMonitor::RunL errCode: %d",
+    errCode )
+    if ( KErrNone == errCode )
+        {
+        // UID Code for WML Browser in S60.
+        const TUid uidWmlBrowser( TUid::Uid( KWmlcHandler ) );
+        TWsEvent event;
+        iWsSession.GetEvent( event );
+        TApaTaskList taskList( iWsSession );
+
+        if ( taskList.FindApp( uidWmlBrowser ).Exists() )
+            {
+            LOG( SIMPLE,
+            "SATEVENTMONITORS: CSatBrowserWSMonitor::RunL task exists" )
+            const TApaTask task = taskList.FindApp( uidWmlBrowser );
+            const TThreadId threadID = task.ThreadId();
+            RThread thread;
+            User::LeaveIfError ( thread.Open( threadID, EOwnerProcess ) );
+
+            // Create Browser thread monitor.
+            iThreadMonitor = CSatBrowserThreadMonitor::NewL( thread );
+
+            // Call the active object to monitor for this threads death.
+            iThreadMonitor->StartMonitor( this );
+            }
+        else
+            {
+            LOG( SIMPLE,
+            "SATEVENTMONITORS: CSatBrowserWSMonitor::RunL start" )
+            // Renew the request.
+            Start();
+            }
+        }
+    else if ( KErrCancel != errCode )
+        {
+        // Renew the request.
+        Start();
+        }
+    else
+        {
+        LOG( SIMPLE,
+            "SATEVENTMONITORS: CSatBrowserWSMonitor::RunL cancelled" )
+        }
+
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBrowserWSMonitor::RunL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBrowserWSMonitor::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CSatBrowserWSMonitor::DoCancel()
+    {
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBrowserWSMonitor::DoCancel calling" )
+
+    if ( iThreadMonitor )
+        {
+        LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBrowserWSMonitor::DoCancel iThreadMonitor true" )
+        iThreadMonitor->DoCancelMonitor();
+        }
+
+    // Cancel the outstanding request.
+    iWsSession.EventReadyCancel();
+
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBrowserWSMonitor::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBrowserWSMonitor::NotifyBrowserTerminated
+// Sends event download notification to SAT Engine.
+// -----------------------------------------------------------------------------
+//
+void CSatBrowserWSMonitor::NotifyBrowserTerminated(
+    const RSat::TBrowserTerminationCause aCause )
+    {
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatBrowserWSMonitor::\
+        NotifyBrowserTerminated calling" )
+
+    // Notify termination to observer.
+    iObserver->NotifyBrowserTerminated( aCause );
+
+    LOG( SIMPLE, "SATEVENTMONITORS: CSatBrowserWSMonitor::\
+        NotifyBrowserTerminated exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatBrowserWSMonitor::CreateWGL
+// Creates a window group and hides it form the UI.
+// -----------------------------------------------------------------------------
+//
+void CSatBrowserWSMonitor::CreateWGL()
+    {
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBrowserWSMonitor::CreateWGL calling" )
+
+    // -1 means the window will never be visible.
+    const TInt KWindowGroupPriority( -1 );
+
+    RWindowGroup wg( iWsSession );
+    // Make a handle from the address of window group obj.
+    User::LeaveIfError( wg.Construct( reinterpret_cast<TUint32>( &wg ) ) );
+    // Enable group changed events.
+    User::LeaveIfError( wg.EnableGroupChangeEvents() );
+
+    // Get the ordinal pos of this window group.
+    const TInt ordPos( wg.OrdinalPosition() );
+    // Set SAT so its never shown in the UI.
+    wg.SetOrdinalPosition( ordPos , KWindowGroupPriority );
+
+    // Needs to be a member variable. Must be closed in destructor.
+    // Otherwise can't monitor what has been opened.
+    iWg = wg;
+
+    // Set SAT Server hidden now.
+    iWsSession.Flush();
+    iWGCreated = ETrue;
+    LOG( SIMPLE,
+        "SATEVENTMONITORS: CSatBrowserWSMonitor::CreateWGL exiting" )
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatClient/BMARM/SATCLIENTU.DEF	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,25 @@
+EXPORTS
+	__13RSatUiSession @ 1 NONAME R3UNUSED ; RSatUiSession::RSatUiSession(void)
+	Cancel__C11RSatRefresh @ 2 NONAME R3UNUSED ; RSatRefresh::Cancel(void) const
+	Close__11RSatRefresh @ 3 NONAME R3UNUSED ; RSatRefresh::Close(void)
+	Close__13RSatUiSession @ 4 NONAME R3UNUSED ; RSatUiSession::Close(void)
+	ConnectL__11RSatSession @ 5 NONAME R3UNUSED ; RSatSession::ConnectL(void)
+	KillServer__C13RSatUiSession @ 6 NONAME R3UNUSED ; RSatUiSession::KillServer(void) const
+	NotifyFileChangeL__11RSatRefresh @ 7 NONAME R3UNUSED ; RSatRefresh::NotifyFileChangeL(void)
+	OpenL__11RSatRefreshR11RSatSession @ 8 NONAME R3UNUSED ; RSatRefresh::OpenL(RSatSession &)
+	Panic__C13RSatUiSession15TSatClientPanic @ 9 NONAME R3UNUSED ; RSatUiSession::Panic(TSatClientPanic) const
+	RegisterL__13RSatUiSessionR11RSatSessionP14MSatUiObserver @ 10 NONAME R3UNUSED ; RSatUiSession::RegisterL(RSatSession &, MSatUiObserver *)
+	Unregister__13RSatUiSession @ 11 NONAME R3UNUSED ; RSatUiSession::Unregister(void)
+	Version__C11RSatSession @ 12 NONAME R3UNUSED ; RSatSession::Version(void) const
+	Version__C13RSatUiSession @ 13 NONAME R3UNUSED ; RSatUiSession::Version(void) const
+	__11RSatRefreshR19MSatRefreshObserver @ 14 NONAME R3UNUSED ; RSatRefresh::RSatRefresh(MSatRefreshObserver &)
+	__11RSatSession @ 15 NONAME R3UNUSED ; RSatSession::RSatSession(void)
+	Adapter__C13RSatUiSession @ 16 NONAME R3UNUSED ; RSatUiSession::Adapter(void) const
+	__8RSatIcon @ 17 NONAME R3UNUSED ; RSatIcon::RSatIcon(void)
+	Close__8RSatIcon @ 18 NONAME R3UNUSED ; RSatIcon::Close(void)
+	CodingScheme__C12TSatIconInfo @ 19 NONAME R3UNUSED ; TSatIconInfo::CodingScheme(void) const
+	GetIconInfoL__C8RSatIconUcRt6RArray1Z12TSatIconInfo @ 20 NONAME R3UNUSED ; RSatIcon::GetIconInfoL(unsigned char, RArray<TSatIconInfo> &) const
+	GetIconL__C8RSatIconRC12TSatIconInfo @ 21 NONAME R3UNUSED ; RSatIcon::GetIconL(TSatIconInfo const &) const
+	IconSize__C12TSatIconInfo @ 22 NONAME R3UNUSED ; TSatIconInfo::IconSize(void) const
+	OpenL__8RSatIconR11RSatSession @ 23 NONAME R3UNUSED ; RSatIcon::OpenL(RSatSession &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatClient/BMARM/SATSERVERU.DEF	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,2 @@
+EXPORTS
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatClient/BMARM/SATSHELLCNTRLU.DEF	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,7 @@
+EXPORTS
+	AddSatUiL__19CSatShellControllerR7TDesC16 @ 1 NONAME R3UNUSED ; CSatShellController::AddSatUiL(TDesC16 &)
+	BringSatUiToForeground__19CSatShellController @ 2 NONAME R3UNUSED ; CSatShellController::BringSatUiToForeground(void)
+	LaunchSatUiL__19CSatShellController @ 3 NONAME R3UNUSED ; CSatShellController::LaunchSatUiL(void)
+	NewL__19CSatShellController @ 4 NONAME R3UNUSED ; CSatShellController::NewL(void)
+	RemoveSatUiL__19CSatShellController @ 5 NONAME R3UNUSED ; CSatShellController::RemoveSatUiL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatClient/BWINS/SATCLIENTU.DEF	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,26 @@
+EXPORTS
+	??0RSatRefresh@@QAE@AAVMSatRefreshObserver@@@Z @ 1 NONAME ; RSatRefresh::RSatRefresh(class MSatRefreshObserver &)
+	??0RSatService@@QAE@XZ @ 2 NONAME ; RSatService::RSatService(void)
+	??0RSatSession@@QAE@XZ @ 3 NONAME ; RSatSession::RSatSession(void)
+	?Cancel@RSatRefresh@@QBEXXZ @ 4 NONAME ; void RSatRefresh::Cancel(void) const
+	?Close@RSatRefresh@@QAEXXZ @ 5 NONAME ; void RSatRefresh::Close(void)
+	?Close@RSatService@@QAEXXZ @ 6 NONAME ; void RSatService::Close(void)
+	?CodingScheme@TSatIconInfo@@QBE?AW4TCodingScheme@1@XZ @ 7 NONAME ; enum TSatIconInfo::TCodingScheme TSatIconInfo::CodingScheme(void) const
+	?ConnectL@RSatSession@@QAEXXZ @ 8 NONAME ; void RSatSession::ConnectL(void)
+	?DataLength@TSatIconInfo@@QBEGXZ @ 9 NONAME ; unsigned short TSatIconInfo::DataLength(void) const
+	?FileIdentifier@TSatIconInfo@@QBEGXZ @ 10 NONAME ; unsigned short TSatIconInfo::FileIdentifier(void) const
+	?GetIconInfoL@RSatService@@QBEXEAAV?$RArray@VTSatIconInfo@@@@@Z @ 11 NONAME ; void RSatService::GetIconInfoL(unsigned char, class RArray<class TSatIconInfo> &) const
+	?GetIconL@RSatService@@QBEPAVCFbsBitmap@@ABVTSatIconInfo@@@Z @ 12 NONAME ; class CFbsBitmap * RSatService::GetIconL(class TSatIconInfo const &) const
+	?GetSetupIdleModeTextL@RSatService@@QAEHAAPAVHBufC16@@AAW4TSatIconQualifier@1@AAE@Z @ 13 NONAME ; int RSatService::GetSetupIdleModeTextL(class HBufC16 * &, enum RSatService::TSatIconQualifier &, unsigned char &)
+	?IconSize@TSatIconInfo@@QBE?AVTSize@@XZ @ 14 NONAME ; class TSize TSatIconInfo::IconSize(void) const
+	?NotifyFileChangeL@RSatRefresh@@QAEXABV?$TBuf16@$0PC@@@@Z @ 15 NONAME ; void RSatRefresh::NotifyFileChangeL(class TBuf16<242> const &)
+	?NotifyFileChangeL@RSatRefresh@@QAEXXZ @ 16 NONAME ; void RSatRefresh::NotifyFileChangeL(void)
+	?NotifySetupIdleModeTextChange@RSatService@@QAEHAAVTRequestStatus@@@Z @ 17 NONAME ; int RSatService::NotifySetupIdleModeTextChange(class TRequestStatus &)
+	?NotifySetupIdleModeTextChangeCancel@RSatService@@QAEXXZ @ 18 NONAME ; void RSatService::NotifySetupIdleModeTextChangeCancel(void)
+	?Offset@TSatIconInfo@@QBEGXZ @ 19 NONAME ; unsigned short TSatIconInfo::Offset(void) const
+	?OpenL@RSatRefresh@@QAEXABVRSatSession@@@Z @ 20 NONAME ; void RSatRefresh::OpenL(class RSatSession const &)
+	?OpenL@RSatService@@QAEXABVRSatSession@@@Z @ 21 NONAME ; void RSatService::OpenL(class RSatSession const &)
+	?RefreshEFRead@RSatRefresh@@QBEXH@Z @ 22 NONAME ; void RSatRefresh::RefreshEFRead(int) const
+	?SetIdleModeTextResponse@RSatService@@QBEXABW4TSATIdleResult@1@@Z @ 23 NONAME ; void RSatService::SetIdleModeTextResponse(enum RSatService::TSATIdleResult const &) const
+	?Version@RSatSession@@QBE?AVTVersion@@XZ @ 24 NONAME ; class TVersion RSatSession::Version(void) const
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatClient/EABI/SatClientU.DEF	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,33 @@
+EXPORTS
+	_ZN11RSatRefresh17NotifyFileChangeLERK6TBuf16ILi242EE @ 1 NONAME
+	_ZN11RSatRefresh17NotifyFileChangeLEv @ 2 NONAME
+	_ZN11RSatRefresh5CloseEv @ 3 NONAME
+	_ZN11RSatRefresh5OpenLERK11RSatSession @ 4 NONAME
+	_ZN11RSatRefreshC1ER19MSatRefreshObserver @ 5 NONAME
+	_ZN11RSatRefreshC2ER19MSatRefreshObserver @ 6 NONAME
+	_ZN11RSatService21GetSetupIdleModeTextLERP7HBufC16RNS_17TSatIconQualifierERh @ 7 NONAME
+	_ZN11RSatService29NotifySetupIdleModeTextChangeER14TRequestStatus @ 8 NONAME
+	_ZN11RSatService35NotifySetupIdleModeTextChangeCancelEv @ 9 NONAME
+	_ZN11RSatService5CloseEv @ 10 NONAME
+	_ZN11RSatService5OpenLERK11RSatSession @ 11 NONAME
+	_ZN11RSatServiceC1Ev @ 12 NONAME
+	_ZN11RSatServiceC2Ev @ 13 NONAME
+	_ZN11RSatSession8ConnectLEv @ 14 NONAME
+	_ZN11RSatSessionC1Ev @ 15 NONAME
+	_ZN11RSatSessionC2Ev @ 16 NONAME
+	_ZNK11RSatRefresh13RefreshEFReadEi @ 17 NONAME
+	_ZNK11RSatRefresh6CancelEv @ 18 NONAME
+	_ZNK11RSatService12GetIconInfoLEhR6RArrayI12TSatIconInfoE @ 19 NONAME
+	_ZNK11RSatService23SetIdleModeTextResponseERKNS_14TSATIdleResultE @ 20 NONAME
+	_ZNK11RSatService8GetIconLERK12TSatIconInfo @ 21 NONAME
+	_ZNK11RSatSession7VersionEv @ 22 NONAME
+	_ZNK12TSatIconInfo10DataLengthEv @ 23 NONAME
+	_ZNK12TSatIconInfo12CodingSchemeEv @ 24 NONAME
+	_ZNK12TSatIconInfo14FileIdentifierEv @ 25 NONAME
+	_ZNK12TSatIconInfo6OffsetEv @ 26 NONAME
+	_ZNK12TSatIconInfo8IconSizeEv @ 27 NONAME
+	_ZTI18CSatRefreshMonitor @ 28 NONAME ; #<TI>#
+	_ZTI23CSatAllowRefreshMonitor @ 29 NONAME ; #<TI>#
+	_ZTV18CSatRefreshMonitor @ 30 NONAME ; #<VT>#
+	_ZTV23CSatAllowRefreshMonitor @ 31 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatClient/group/SatClient.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,58 @@
+/*
+* 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:  Project definition file for project SatClient
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../inc/SatMacroes.h"
+
+TARGET                  SatClient.dll
+TARGETTYPE              dll
+UID                     0x1000008d 0x1000A834
+
+CAPABILITY              CAP_CLIENT_DLL
+VENDORID                VID_DEFAULT
+
+#ifdef ENABLE_SAT_LOGGING
+EPOCSTACKSIZE           0x4000 // Logging needs more stack than default 8 kilos.
+#endif
+
+SOURCEPATH              ../src
+SOURCE                  RSatSession.cpp
+SOURCE                  CSatRefreshMonitor.cpp
+SOURCE                  RSatRefresh.cpp
+SOURCE                  CSatAllowRefreshMonitor.cpp
+SOURCE                  rsatservice.cpp
+SOURCE                  TSatIconInfo.cpp
+SOURCE                  csatpluginmonitor.cpp
+
+USERINCLUDE             ../inc
+USERINCLUDE             ../../inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           ../../../../inc         // Domain telephony
+SYSTEMINCLUDE           ../../../inc            // Subsystem satengine
+
+LIBRARY                 euser.lib
+LIBRARY                 etelsat.lib
+LIBRARY                 bafl.lib
+LIBRARY                 fbscli.lib
+LIBRARY                 CentralRepository.lib   // For Central Repository
+
+#ifdef ENABLE_SAT_LOGGING
+LIBRARY                 flogger.lib
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatClient/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,24 @@
+/*
+* 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 information file for project SatClient
+*
+*/
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+SatClient.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatClient/inc/CSatAllowRefreshMonitor.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,124 @@
+/*
+* 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:  Waits for the refresj query notification
+*
+*/
+
+
+
+#ifndef CSATALLOWREFRESHMONITOR_H
+#define CSATALLOWREFRESHMONITOR_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <msatrefreshobserver.h>
+
+// FORWARD DECLARATIONS
+class RSatRefresh;
+
+// CLASS DECLARATION
+
+/**
+*  Active object to wait the refresh query notification.
+*
+*  @lib SatClient.lib
+*  @since 2.6
+*/
+class CSatAllowRefreshMonitor : public CActive
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aObserver Observer for refresh query.
+        * @param aRefresh Refresh sub-session.
+        */
+        static CSatAllowRefreshMonitor* NewL(
+            MSatRefreshObserver& aObserver,
+            RSatRefresh& aRefresh );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSatAllowRefreshMonitor();
+
+    public: // New functions
+
+        /**
+        * Set files to be observed.
+        * @since 3.0
+        * @param aObservedFiles List of files to be observed for refresh.
+        */
+        void ObserveFiles( const TSatRefreshFiles& aObservedFiles );
+
+        /**
+        * Starts waiting for the refresh query.
+        */
+        void Start();
+
+    protected:  // Functions from base classes
+
+        /**
+        * From CActive
+        */
+        void RunL();
+
+        /**
+        * From CActive
+        * @param aStatus Request status.
+        */
+        TInt RunError( TInt aError );
+
+        /**
+        * From CActive
+        */
+        void DoCancel();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CSatAllowRefreshMonitor(
+            MSatRefreshObserver& aObserver,
+            RSatRefresh& aRefresh );
+
+    private:
+
+        // Notified when query comes.
+        MSatRefreshObserver& iObserver;
+
+        // Refresh sub-sesion.
+        RSatRefresh& iRefresh;
+
+        // Changing files
+        TSatRefreshFiles iChangingFiles;
+
+        // Package of chaning files.
+        TPckg<TSatRefreshFiles> iChangingFilesPckg;
+
+        // Observed files
+        TSatRefreshFiles iObservedFiles;
+
+        // Refresh type.
+        TSatRefreshType iType;
+
+        // Refresh type package.
+        TPckg<TSatRefreshType> iTypePckg;
+
+    };
+
+#endif      // CSATALLOWREFRESHMONITOR_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatClient/inc/CSatRefreshMonitor.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,109 @@
+/*
+* 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:  Active object to monitor the refresh event.
+*
+*/
+
+
+
+#ifndef CSATREFRESHMONITOR_H
+#define CSATREFRESHMONITOR_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <msatrefreshobserver.h>
+
+// FORWARD DECLARATIONS
+class RSatRefresh;
+
+// CLASS DECLARATION
+
+/**
+*  Active object for monitoring the refresh event.
+*
+*  @lib SatClient
+*  @since 2.6
+*/
+class CSatRefreshMonitor : public CActive
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aRefresh Refresh sub-session.
+        * @param aObserver Observer for refresh event.
+        */
+        static CSatRefreshMonitor* NewL(
+            RSatRefresh& aRefresh,
+            MSatRefreshObserver& aObserver );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSatRefreshMonitor();
+
+    public: // New functions
+
+        /**
+        * Starts to monitor the refresh event.
+        * @since 2.6
+        */
+        void Start();
+
+    protected: // Functions from Base classes.
+
+        /**
+        * From CActive.
+        */
+        void RunL();
+
+        /**
+        * From CActive.
+        */
+        void DoCancel();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        * @param aRefresh Refresh sub-session.
+        * @param aObserver Observer for refresh event.
+        */
+        CSatRefreshMonitor(
+            RSatRefresh& aRefresh,
+            MSatRefreshObserver& aObserver );
+
+    private:    // Data
+        // Observer
+        MSatRefreshObserver& iObserver;
+
+        // Refresh sub session.
+        RSatRefresh& iRefresh;
+
+        // Changed files
+        TSatRefreshFiles iChangedFiles;
+
+        // Changed files package.
+        TPckg<TSatRefreshFiles> iChangedFilesPckg;
+
+        // Refresh type.
+        TSatRefreshType iType;
+
+        // Refresh type package.
+        TPckg<TSatRefreshType> iTypePckg;
+    };
+
+#endif      // CSATREFRESHMONITOR_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatClient/inc/csatpluginmonitor.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Monitor the set up idle mote text P&S key.
+*
+*/
+
+
+
+#ifndef CSATPLUGINMONITOR_H
+#define CSATPLUGINMONITOR_H
+
+//  INCLUDES
+#include    <e32property.h>             // For monitor the P&S key   
+
+// CLASS DECLARATION
+NONSHARABLE_CLASS( CSatPluginMonitor ) : public CActive
+    {
+    public: // Constructors and destructor
+        
+        /**
+         * Part of the two phased constuction
+         *
+         * @return Pointer to the created CSatPluginMonitor object
+         */
+        static CSatPluginMonitor* NewL();
+    
+        /**
+         * Destructor
+         */
+        virtual ~CSatPluginMonitor();
+        
+    public: // New function
+    
+        /**
+         * Start monitor the P&S key.
+         * 
+         * @since 5.1
+         * @param aStatus Request to be completed on update.
+         * @return Error code indicating the status of starting the monitor.
+         */
+        TInt Start( TRequestStatus& aStatus );
+        
+        /**
+         * Get idle mode text via P&S key.
+         * 
+         * @since 5.1
+         * @param aText the idle mode text.
+         * @return Error code indicating the status of GetIdleModeText. 
+         */      
+        TInt GetIdleModeText( HBufC*& aText );
+    
+        /**
+         * Get idle mode icon qualifier via P&S key.
+         * 
+         * @since 5.1
+         * @param aIconQualifier the idle mode icon qualifier.
+         * @return Error code indicating the status of GetIdleModeIconQualifier.
+         */     
+        TInt GetIdleModeIconQualifier( TInt& aIconQualifier );
+    
+        /**
+         * Get idle mode icon id via P&S key.
+         * 
+         * @since 5.1
+         * @param aRecordNumber the icon mode icon id.
+         * @return Error code indicating the status of GetIdleModeIconId.
+         */     
+        TInt GetIdleModeIconId( TInt& aRecordNumber );        
+        
+    protected: // Functions from CActive
+    
+        /**
+         * From CActive.
+         *  
+         * Handles the request completion.
+         */
+        void RunL();
+    
+        /**
+         * From CActive.
+         * 
+         * Implements the cancel protocol.
+         */
+        void DoCancel();
+       
+        /**
+         * From CActive
+         * 
+         * Handles a leave occurring in the request completion event 
+         * handler RunL()
+         * @param aError Leave from RunL().
+         * @return Error code
+         */    
+        TInt RunError( TInt aError );
+        
+    private: // Constructors
+            
+        /**
+         * Part of the two phased construction
+         */
+        void ConstructL();
+        
+        /**
+         * Constructor to use in the object creation. 
+         * Initializes the necessary data.
+         */
+        CSatPluginMonitor();        
+        
+    private: // data
+    
+        /**
+         * Reference of idle application TRequestStatus.
+         * Notify the idle application when P&S key changed.
+         *
+         * Not own
+         */
+        TRequestStatus* iIdleAppStatus;  
+          
+        /**
+         * For monitor the P&S key.
+         */    
+        RProperty iIdleMode;
+    };
+
+#endif // CSATPLUGINMONITOR_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatClient/src/CSatAllowRefreshMonitor.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,207 @@
+/*
+* 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:  Active object for waiting the refresh query,
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CSatAllowRefreshMonitor.h"
+#include    "msatrefreshobserver.h"
+#include    "rsatrefresh.h"
+#include    "SatLog.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSatAllowRefreshMonitor::CSatAllowRefreshMonitor
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatAllowRefreshMonitor::CSatAllowRefreshMonitor(
+    MSatRefreshObserver& aObserver,
+    RSatRefresh& aRefresh ) :
+    CActive( CActive::EPriorityStandard ),
+    iObserver( aObserver ),
+    iRefresh( aRefresh ),
+    iChangingFiles(),
+    iChangingFilesPckg( iChangingFiles ),
+    iObservedFiles(),
+    iType( ERefreshTypeNotSet ),
+    iTypePckg( iType )
+    {
+    LOG( SIMPLE,
+        "SATCLIENT: CSatAllowRefreshMonitor::CSatAllowRefreshMonitor calling" )
+
+    CActiveScheduler::Add( this );
+    iObservedFiles.Zero();
+
+    LOG( SIMPLE,
+        "SATCLIENT: CSatAllowRefreshMonitor::CSatAllowRefreshMonitor exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatAllowRefreshMonitor::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatAllowRefreshMonitor* CSatAllowRefreshMonitor::NewL(
+    MSatRefreshObserver& aObserver,
+    RSatRefresh& aRefresh )
+    {
+    LOG( SIMPLE, "SATCLIENT: CSatAllowRefreshMonitor::NewL calling" )
+
+    CSatAllowRefreshMonitor* self =
+        new ( ELeave ) CSatAllowRefreshMonitor( aObserver, aRefresh );
+
+    LOG( SIMPLE, "SATCLIENT: CSatAllowRefreshMonitor::NewL exiting" )
+    return self;
+    }
+
+// Destructor
+CSatAllowRefreshMonitor::~CSatAllowRefreshMonitor()
+    {
+    LOG( SIMPLE,
+        "SATCLIENT: CSatAllowRefreshMonitor::~CSatAllowRefreshMonitor calling" )
+
+    Cancel();
+    iObservedFiles.Zero();
+
+    LOG( SIMPLE,
+        "SATCLIENT: CSatAllowRefreshMonitor::~CSatAllowRefreshMonitor exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatAllowRefreshMonitor::ObserveFiles
+// Set files to be observed.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatAllowRefreshMonitor::ObserveFiles(
+    const TSatRefreshFiles& aObservedFiles )
+    {
+    LOG( SIMPLE, "SATCLIENT: CSatAllowRefreshMonitor::ObserveFiles calling" )
+
+    iObservedFiles.Zero();
+
+    // Add list of observed files if given.
+    TInt observeFileCount( aObservedFiles.Length() );
+    LOG2( SIMPLE, 
+    "SATCLIENT: CSatAllowRefreshMonitor::ObserveFiles observeFileCount: %d",
+    observeFileCount )
+    for ( TInt fileIndex = 0; fileIndex < observeFileCount; fileIndex++ )
+        {
+        iObservedFiles.Append( aObservedFiles[ fileIndex ] );
+        }
+
+    LOG( SIMPLE, "SATCLIENT: CSatAllowRefreshMonitor::ObserveFiles exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatAllowRefreshMonitor::Start
+// Starts the waiting of notification.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatAllowRefreshMonitor::Start()
+    {
+    LOG( SIMPLE, "SATCLIENT: CSatAllowRefreshMonitor::Start calling" )
+
+    if ( !IsActive() )
+        {
+        LOG( SIMPLE, "SATCLIENT: CSatAllowRefreshMonitor::Start not Active" )
+        iChangingFiles.Zero();
+
+        // Add list of observed files if given.
+        TInt observeFileCount( iObservedFiles.Length() );
+        LOG2( SIMPLE, 
+        "SATCLIENT: CSatAllowRefreshMonitor::Start observeFileCount: %d",
+        observeFileCount )
+        for ( TInt fileIndex = 0; fileIndex < observeFileCount; fileIndex++ )
+            {
+            iChangingFiles.Append( iObservedFiles[ fileIndex ] );
+            }
+
+        iRefresh.NotifyAllowRefresh( iTypePckg, iChangingFilesPckg, iStatus );
+        SetActive();
+        }
+
+    LOG( SIMPLE, "SATCLIENT: CSatAllowRefreshMonitor::Start exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatAllowRefreshMonitor::RunL
+// Notifies the observer for the refresh query.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatAllowRefreshMonitor::RunL()
+    {
+    LOG( SIMPLE, "SATCLIENT: CSatAllowRefreshMonitor::RunL calling" )
+    const TInt err( iStatus.Int() );
+    
+    LOG2( SIMPLE, "SATCLIENT: CSatAllowRefreshMonitor::RunL, error: %i", err )
+
+    if ( KErrNone == err )
+        {
+        const TBool response = iObserver.AllowRefresh( iType, iChangingFiles );
+        iRefresh.AllowRefreshL( response );
+        Start();
+        }
+    else if ( KErrInUse != err && 
+              KErrServerTerminated != err && 
+              KErrCancel != err )
+        {
+        Start();
+        }
+
+    LOG( SIMPLE, "SATCLIENT: CSatAllowRefreshMonitor::RunL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatAllowRefreshMonitor::RunError
+// Handles refresh monitor error.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CSatAllowRefreshMonitor::RunError( TInt aError )
+    {
+    LOG2( SIMPLE,
+          "SATCLIENT: CSatAllowRefreshMonitor::RunError calling, error: %i",
+          aError )
+
+    iRefresh.CancelNotifyAllowRefresh( aError );
+
+    LOG( SIMPLE, "SATCLIENT: CSatAllowRefreshMonitor::RunError exiting" )
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatAllowRefreshMonitor::DoCancels
+// Cancels the notfication.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatAllowRefreshMonitor::DoCancel()
+    {
+    LOG( SIMPLE, "SATCLIENT: CSatAllowRefreshMonitor::DoCancel calling" )
+
+    iRefresh.CancelNotifyAllowRefresh();
+
+    LOG( SIMPLE, "SATCLIENT: CSatAllowRefreshMonitor::DoCancel exiting" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatClient/src/CSatRefreshMonitor.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -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:  Active object for monitoring the refresh event.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <rsatsession.h>
+#include    <rsatrefresh.h>
+
+#include    "CSatRefreshMonitor.h"
+#include    "SatLog.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSatRefreshMonitor::CSatRefreshMonitor
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatRefreshMonitor::CSatRefreshMonitor(
+    RSatRefresh& aRefresh,
+    MSatRefreshObserver& aObserver ) :
+    CActive( CActive::EPriorityStandard ),
+    iObserver( aObserver ),
+    iRefresh( aRefresh ),
+    iChangedFiles(),
+    iChangedFilesPckg( iChangedFiles ),
+    iType( ERefreshTypeNotSet ),
+    iTypePckg( iType )
+    {
+    LOG( SIMPLE, "SATCLIENT: CSatRefreshMonitor::CSatRefreshMonitor calling" )
+
+    CActiveScheduler::Add( this );
+
+    LOG( SIMPLE, "SATCLIENT: CSatRefreshMonitor::CSatRefreshMonitor exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatRefreshMonitor::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatRefreshMonitor* CSatRefreshMonitor::NewL(
+    RSatRefresh& aRefresh,
+    MSatRefreshObserver& aObserver )
+    {
+    LOG( SIMPLE, "SATCLIENT: CSatRefreshMonitor::NewL calling" )
+
+    CSatRefreshMonitor* self =
+        new ( ELeave ) CSatRefreshMonitor( aRefresh, aObserver );
+
+    LOG( SIMPLE, "SATCLIENT: CSatRefreshMonitor::NewL exiting" )
+    return self;
+    }
+
+// Destructor
+CSatRefreshMonitor::~CSatRefreshMonitor()
+    {
+    LOG( SIMPLE, "SATCLIENT: CSatRefreshMonitor::~CSatRefreshMonitor calling" )
+
+    Cancel();
+
+    LOG( SIMPLE, "SATCLIENT: CSatRefreshMonitor::~CSatRefreshMonitor exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatRefreshMonitor::Start
+// Starts monitoring the refresh event.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatRefreshMonitor::Start()
+    {
+    LOG( SIMPLE, "SATCLIENT: CSatRefreshMonitor::Start calling" )
+
+    if ( !IsActive() )
+        {
+        LOG( SIMPLE, "SATCLIENT: CSatRefreshMonitor::Start set active" )
+        iRefresh.NotifyRefresh( iTypePckg, iChangedFilesPckg, iStatus );
+        SetActive();
+        }
+
+    LOG( SIMPLE, "SATCLIENT: CSatRefreshMonitor::Start exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatRefreshMonitor::RunL
+// Notifies the observer about refresh event.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatRefreshMonitor::RunL()
+    {
+    LOG( SIMPLE, "SATCLIENT: CSatRefreshMonitor::RunL calling" )
+    const TInt err( iStatus.Int() );
+
+    if ( KErrNone == err )
+        {
+        iObserver.Refresh( iType, iChangedFiles );
+        Start();
+        }
+    else if ( KErrInUse == err )
+        {
+        LOG( SIMPLE, "SATCLIENT:   Attempt to restart, cancelled" )
+        }
+    else if ( KErrServerTerminated == err )
+        {
+        LOG( SIMPLE, "SATCLIENT:   Server terminated" )
+        }
+    else if ( KErrCancel != err )
+        {
+        LOG2( SIMPLE, "SATCLIENT:   RunL error: %i", err )
+        Start();
+        }
+    else
+        {
+        LOG( SIMPLE, "SATCLIENT:   Cancelled" )
+        }
+
+    LOG( SIMPLE, "SATCLIENT: CSatRefreshMonitor::RunL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatRefreshMonitor::DoCancel
+// Cancels the request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatRefreshMonitor::DoCancel()
+    {
+    LOG( SIMPLE, "SATCLIENT: CSatRefreshMonitor::DoCancel calling" )
+
+    iRefresh.CancelNotifyRefresh();
+
+    LOG( SIMPLE, "SATCLIENT: CSatRefreshMonitor::DoCancel exiting" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatClient/src/RSatRefresh.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,349 @@
+/*
+* 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:  Refresh notification sub-session.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <rsatrefresh.h>
+#include    <rsatsession.h>
+#include    "SatSOpcodes.h"
+#include    "CSatAllowRefreshMonitor.h"
+#include    "CSatRefreshMonitor.h"
+#include    "SatLog.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// RSatRefresh::RSatRefresh
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RSatRefresh::RSatRefresh( MSatRefreshObserver& aObserver ) :
+    RSubSessionBase(),
+    iObserver( aObserver ),
+    iAllowMonitor( NULL ),
+    iRefreshMonitor( NULL )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// RSatRefresh::OpenL
+// Connects a sub-session to SatServer.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RSatRefresh::OpenL( const RSatSession& aSession )
+    {
+    LOG( SIMPLE, "SATCLIENT: RSatRefresh::OpenL calling" )
+    
+    #ifdef ENABLE_SAT_LOGGING
+    RProcess test;
+    LOG2( SIMPLE, 
+    "SATCLIENT: RSatRefresh::OpenL UID of calling process: 0x%x",
+    test.SecureId().iId )
+    test.Close();
+    #endif
+
+    TIpcArgs arguments( 0, 0, 0, 0 );
+    User::LeaveIfError(
+        CreateSubSession( aSession, ESatSOpenRefreshSubSession, arguments ) );
+
+    LOG( SIMPLE, "SATCLIENT: RSatRefresh::OpenL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// RSatRefresh::Close
+// Closes the sub-session
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RSatRefresh::Close()
+    {
+    LOG( SIMPLE, "SATCLIENT: RSatRefresh::Close calling" )
+    
+    #ifdef ENABLE_SAT_LOGGING
+    RProcess test;
+    LOG2( SIMPLE, 
+    "SATCLIENT: RSatRefresh::Close UID of calling process: 0x%x",
+    test.SecureId().iId )
+    test.Close();
+    #endif
+
+    delete iRefreshMonitor;
+    delete iAllowMonitor;
+
+    iRefreshMonitor = NULL;
+    iAllowMonitor = NULL;
+
+    CloseSubSession( ESatSCloseRefreshSubSession );
+
+    LOG( SIMPLE, "SATCLIENT: RSatRefresh::Close exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// RSatRefresh::NotifyFileChangeL
+// Starts monitoring refresh events.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RSatRefresh::NotifyFileChangeL()
+    {
+    LOG( SIMPLE, "SATCLIENT: RSatRefresh::NotifyFileChangeL calling" )
+    
+    #ifdef ENABLE_SAT_LOGGING
+    RProcess test;
+    LOG2( SIMPLE, 
+    "SATCLIENT: RSatRefresh::NotifyFileChangeL UID of calling process: 0x%x",
+    test.SecureId().iId )
+    test.Close();
+    #endif
+    
+    if ( !iAllowMonitor )
+        {
+        LOG( SIMPLE, 
+        "SATCLIENT: RSatRefresh::NotifyFileChangeL iAllowMonitor false" )
+        iAllowMonitor = CSatAllowRefreshMonitor::NewL( iObserver, *this );
+        iAllowMonitor->Start();
+        }
+    else
+        {
+        LOG( SIMPLE, "SATCLIENT: RSatRefresh::NotifyFileChangeL, \
+            re-start allowMonitor" )
+        TSatRefreshFiles empty;
+        iAllowMonitor->ObserveFiles( empty );
+        iAllowMonitor->Start();
+        }
+
+    if ( !iRefreshMonitor )
+        {
+        LOG( SIMPLE, 
+        "SATCLIENT: RSatRefresh::NotifyFileChangeL iRefreshMonitor false" )
+        iRefreshMonitor = CSatRefreshMonitor::NewL( *this, iObserver );
+        iRefreshMonitor->Start();
+        }
+    else
+        {
+        LOG( SIMPLE, "SATCLIENT: RSatRefresh::NotifyFileChangeL, \
+            re-start RefreshMonitor" )
+        iRefreshMonitor->Start();
+        }
+
+    LOG( SIMPLE, "SATCLIENT: RSatRefresh::NotifyFileChangeL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// RSatRefresh::NotifyFileChangeL
+// Starts monitoring refresh events.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RSatRefresh::NotifyFileChangeL(
+    const TSatRefreshFiles& aObservedFiles )
+    {
+    LOG( SIMPLE, "SATCLIENT: RSatRefresh::NotifyFileChangeL(1) calling" )
+    
+    #ifdef ENABLE_SAT_LOGGING
+    RProcess test;
+    LOG2( SIMPLE, 
+    "SATCLIENT: RSatRefresh::NotifyFileChangeL(1) UID of calling process: 0x%x",
+    test.SecureId().iId )
+    test.Close();
+    #endif
+    
+    if ( !iAllowMonitor )
+        {
+        LOG( SIMPLE, 
+        "SATCLIENT: RSatRefresh::NotifyFileChangeL(1) iAllowMonitor false" )
+        iAllowMonitor = CSatAllowRefreshMonitor::NewL( iObserver, *this );
+        iAllowMonitor->ObserveFiles( aObservedFiles );
+        iAllowMonitor->Start();
+        }
+    else
+        {
+        LOG( SIMPLE, "SATCLIENT: RSatRefresh::NotifyFileChangeL(1), \
+            re-start allowMonitor" )
+        iAllowMonitor->ObserveFiles( aObservedFiles );
+        iAllowMonitor->Start();
+        }
+
+    if ( !iRefreshMonitor )
+        {
+        LOG( SIMPLE, 
+        "SATCLIENT: RSatRefresh::NotifyFileChangeL(1) iRefreshMonitor false" )
+        iRefreshMonitor = CSatRefreshMonitor::NewL( *this, iObserver );
+        iRefreshMonitor->Start();
+        }
+    else
+        {
+        LOG( SIMPLE, "SATCLIENT: RSatRefresh::NotifyFileChangeL(1), \
+            re-start RefreshMonitor" )
+        iRefreshMonitor->Start();
+        }
+
+    LOG( SIMPLE, "SATCLIENT: RSatRefresh::NotifyFileChangeL(1) exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// RSatRefresh::RefreshEFRead
+// Indicates client's refresh actions complete.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RSatRefresh::RefreshEFRead( TBool aAdditionEFRead ) const
+    {
+    LOG( SIMPLE, "SATCLIENT: RSatRefresh::RefreshEFRead calling" )
+    
+    #ifdef ENABLE_SAT_LOGGING
+    RProcess test;
+    LOG2( SIMPLE, 
+    "SATCLIENT: RSatRefresh::RefreshEFRead UID of calling process: 0x%x",
+    test.SecureId().iId )
+    test.Close();
+    #endif
+    
+    TPckg<TBool> additionEFReadPckg( aAdditionEFRead );
+    TIpcArgs arguments( &additionEFReadPckg );
+
+    SendReceive( ESatSRefreshEFRead, arguments );
+
+    LOG( SIMPLE, "SATCLIENT: RSatRefresh::RefreshEFRead exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// RSatRefresh::Cancel
+// Cancels both requests.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RSatRefresh::Cancel() const
+    {
+    LOG( SIMPLE, "SATCLIENT: RSatRefresh::Cancel calling" )
+    
+    #ifdef ENABLE_SAT_LOGGING
+    RProcess test;
+    LOG2( SIMPLE, 
+    "SATCLIENT: RSatRefresh::Cancel UID of calling process: 0x%x",
+    test.SecureId().iId )
+    test.Close();
+    #endif
+    
+    CancelNotifyAllowRefresh();
+    CancelNotifyRefresh();
+
+    LOG( SIMPLE, "SATCLIENT: RSatRefresh::Cancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// RSatRefresh::NotifyAllowRefresh
+// Issues the request to be notified when refresh query is made.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void RSatRefresh::NotifyAllowRefresh(
+    TPckg<TSatRefreshType>& aType,
+    TPckg<TSatRefreshFiles>& aChangingFiles,
+    TRequestStatus& aStatus ) const
+    {
+    LOG( SIMPLE, "SATCLIENT: RSatRefresh::NotifyAllowRefresh calling" )
+
+    TIpcArgs arguments( &aChangingFiles, &aType );
+    SendReceive( ESatSNotifyAllowRefresh, arguments, aStatus );
+
+    LOG( SIMPLE, "SATCLIENT: RSatRefresh::NotifyAllowRefresh exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// RSatRefresh::AllowRefreshL
+// Sends client's response.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void RSatRefresh::AllowRefreshL( TBool aAllow ) const
+    {
+    LOG( SIMPLE, "SATCLIENT: RSatRefresh::AllowRefreshL calling" )
+
+    TPckg<TBool> allowPckg( aAllow );
+    TIpcArgs arguments( &allowPckg );
+    User::LeaveIfError( SendReceive( ESatSRefreshAllowed, arguments ) );
+
+    LOG( SIMPLE, "SATCLIENT: RSatRefresh::AllowRefreshL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// RSatRefresh::CancelNotifyAllowRefresh
+// Cancels the request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void RSatRefresh::CancelNotifyAllowRefresh( TInt aError ) const
+    {
+    LOG( SIMPLE, "SATCLIENT: RSatRefresh::CancelNotifyAllowRefresh calling" )
+
+    if ( iAllowMonitor )
+        {
+        LOG( SIMPLE, 
+        "SATCLIENT: RSatRefresh::CancelNotifyAllowRefresh iAllowMonitor true" )
+        TIpcArgs arguments( aError );
+        SendReceive( ESatSNotityAllowRefreshCancel, arguments );
+        }
+
+    LOG( SIMPLE, "SATCLIENT: RSatRefresh::CancelNotifyAllowRefresh exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// RSatRefresh::NotifyRefresh
+// Issues the request to be notified when refresh is made.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void RSatRefresh::NotifyRefresh(
+    TPckg<TSatRefreshType>& aType,
+    TPckg<TSatRefreshFiles>& aChangedFiles,
+    TRequestStatus& aStatus ) const
+    {
+    LOG( SIMPLE, "SATCLIENT: RSatRefresh::NotifyRefresh calling" )
+
+    TIpcArgs arguments( &aChangedFiles, &aType );
+    SendReceive( ESatSNotifyRefresh, arguments, aStatus );
+
+    LOG( SIMPLE, "SATCLIENT: RSatRefresh::NotifyRefresh exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// RSatRefresh::CancelNotifyRefresh
+// Cancels the request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void RSatRefresh::CancelNotifyRefresh() const
+    {
+    LOG( SIMPLE, "SATCLIENT: RSatRefresh::CancelNotifyRefresh calling" )
+
+    if ( iRefreshMonitor )
+        {
+        LOG( SIMPLE, 
+        "SATCLIENT: RSatRefresh::CancelNotifyAllowRefresh iRefreshMonitor \
+        true" )
+        TIpcArgs arguments( 0 );
+        SendReceive( ESatSCancelNotifyRefresh, arguments );
+        }
+
+    LOG( SIMPLE, "SATCLIENT: RSatRefresh::CancelNotifyRefresh exiting" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatClient/src/RSatSession.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,133 @@
+/*
+* 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:  Session class to connect SatServer.
+*
+*/
+
+
+#include    <rsatsession.h>
+#include    "SatSOpcodes.h"
+#include    "SatServerFactory.h"
+#include    "SatLog.h"
+
+_LIT( KSatSessionMtx, "SATSESSIONMTX" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// RSatSession::RSatSession
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RSatSession::RSatSession() :
+    RSessionBase()
+    {
+    LOG( SIMPLE, "SATCLIENT: RSatSession::RSatSession calling-exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// RSatSession::ConnectL
+// Connects to SatServer.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RSatSession::ConnectL()
+    {
+    LOG( SIMPLE, "SATCLIENT: RSatSession::ConnectL calling" )
+    
+    #ifdef ENABLE_SAT_LOGGING
+    RProcess test;
+    LOG2( SIMPLE, 
+    "SATCLIENT: RSatSession::ConnectL UID of calling process: 0x%x",
+    test.SecureId().iId )
+    test.Close();
+    #endif
+
+    RMutex sessionStartMutex;
+    TInt createErr( sessionStartMutex.CreateGlobal( KSatSessionMtx ) );
+    if ( createErr )
+        {
+        TInt openErr( sessionStartMutex.OpenGlobal( KSatSessionMtx ) );
+        User::LeaveIfError( openErr );
+        LOG( SIMPLE, "SATCLIENT:   Opened SATSESSIONMTX" )
+        }
+
+    LOG( SIMPLE, "SATCLIENT:   Asking ownership of SATSESSIONMTX" )
+    sessionStartMutex.Wait();
+    LOG( SIMPLE, "SATCLIENT:   Got ownership of SATSESSIONMTX" )
+
+    // Create new session for SatServer.
+    TInt error( CreateSession( KSatServerName, Version(), KSatMessageSlots ) );
+
+    // Server may not be fully started, so let's retry after synchronization.
+    if ( KErrNone != error )
+        {
+        LOG2( SIMPLE,
+              "SATCLIENT: RSatSession::ConnectL CreateSession %d", error )
+
+        // Starts a new process, loading SAT Server.
+        TBuf<1> arguments;
+        RProcess satProcess;
+
+        if ( KErrNone == satProcess.Create( KSatServerNameAndPath, arguments ) )
+            {
+            TRequestStatus rendezvousStatus;
+
+            satProcess.Rendezvous( rendezvousStatus );
+            satProcess.Resume();
+            User::WaitForRequest( rendezvousStatus );
+            LOG2( SIMPLE,
+                  "SATCLIENT: RSatSession::ConnectL Rendezvous %d",
+                   rendezvousStatus.Int() )
+            satProcess.Close();
+            }
+
+        // Retry session creation.
+        error = CreateSession( KSatServerName,
+                               Version(), KSatMessageSlots );
+        LOG2( DETAILED,
+              "SATCLIENT: RSatSession::ConnectL CreateSession %d",
+              error )
+        }
+
+    LOG( SIMPLE, "SATCLIENT:   Releasing ownership of SATSESSIONMTX" )
+    sessionStartMutex.Signal();
+    sessionStartMutex.Close();
+    User::LeaveIfError( error );
+
+    LOG( SIMPLE, "SATCLIENT: RSatSession::ConnectL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// RSatSession::Version
+// Returns the version of this API.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TVersion RSatSession::Version() const
+    {
+    LOG( SIMPLE, "SATCLIENT: RSatSession::Version calling-exiting" )
+    
+    #ifdef ENABLE_SAT_LOGGING
+    RProcess test;
+    LOG2( SIMPLE, 
+    "SATCLIENT: RSatSession::Version UID of calling process: 0x%x",
+    test.SecureId().iId )
+    test.Close();
+    #endif
+    
+    return TVersion(
+        KSatServerMajorVersionNumber,
+        KSatServerMinorVersionNumber,
+        KSatServerBuildVersionNumber );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatClient/src/TSatIconInfo.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,180 @@
+/*
+* 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:  Capsulates the icon info from the SIM.
+*
+*/
+
+
+// INCLUDE FILES
+#include    <etelsat.h>
+#include    <tsaticoninfo.h>
+
+#include    "SatLog.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TSatIconInfo::TSatIconInfo
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// The aIconDescription has to be in following format: (ETSI TS 131 102 V4.10.0)
+//      1 byte: Icon width
+//      2 byte: Icon height
+//      3 byte: Image coding scheme
+//      4 byte: High byte of file identifier
+//      5 byte: Low byte of file identifier.
+//      6 byte: High byte of offset of the icon in EF.
+//      7 byte: Low byte of offset of the icon in EF.
+//      8 byte: High byte of icon length.
+//      9 byte: Low byte of icon lenght.
+// -----------------------------------------------------------------------------
+//
+
+TSatIconInfo::TSatIconInfo() :
+    iSize(),
+    iCodingScheme( static_cast<TCodingScheme>( 0 ) ),
+    iFileIdentifier( 0 ),
+    iOffset( 0 ),
+    iLength( 0 )
+    {
+    LOG( SIMPLE, "SATCLIENT: TSatIconInfo::TSatIconInfo calling-exits" )
+    }
+
+// -----------------------------------------------------------------------------
+// TSatIconInfo::IconSize
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TSize TSatIconInfo::IconSize() const
+    {
+    LOG( SIMPLE, "SATCLIENT: TSatIconInfo::IconSize calling-exits" )    
+    return iSize;
+    }
+
+// -----------------------------------------------------------------------------
+// TSatIconInfo::CodingScheme
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TSatIconInfo::TCodingScheme TSatIconInfo::CodingScheme() const
+    {
+    LOG( SIMPLE, "SATCLIENT: TSatIconInfo::CodingScheme calling-exits" )
+    return iCodingScheme;
+    }
+
+// -----------------------------------------------------------------------------
+// TSatIconInfo::FileIdentifier
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint16 TSatIconInfo::FileIdentifier() const
+    {
+    LOG2( SIMPLE, 
+    "SATCLIENT: TSatIconInfo::FileIdentifier calling-exits, iFileIdentifier: %i", 
+    iFileIdentifier )
+    return iFileIdentifier;
+    }
+
+// -----------------------------------------------------------------------------
+// TSatIconInfo::Offset
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint16 TSatIconInfo::Offset() const
+    {
+    LOG2( SIMPLE, 
+    "SATCLIENT: TSatIconInfo::Offset calling-exits, iOffset: %i", 
+    iOffset )
+    return iOffset;
+    }
+
+// -----------------------------------------------------------------------------
+// TSatIconInfo::DataLength
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint16 TSatIconInfo::DataLength() const
+    {
+    LOG2( SIMPLE, 
+    "SATCLIENT: TSatIconInfo::DataLength calling-exits, iLength: %i", 
+    iLength )
+    return iLength;
+    }
+
+// -----------------------------------------------------------------------------
+// TSatIconInfo::SetIconSize
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TSatIconInfo::SetIconSize( const TSize aIconSize )
+    {
+    LOG3( SIMPLE, 
+    "SATCLIENT: TSatIconInfo::SetIconSize calling-exits aIconSize: x=%i, y=%i", 
+    aIconSize.iWidth, aIconSize.iHeight )
+    iSize = aIconSize;
+    }
+
+// -----------------------------------------------------------------------------
+// TSatIconInfo::SetCodingScheme
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TSatIconInfo::SetCodingScheme( const TCodingScheme aCodingScheme )
+    {
+    LOG2( SIMPLE, 
+    "SATCLIENT: TSatIconInfo::SetCodingScheme calling-exits, aCodingScheme: %i",
+    aCodingScheme )
+    iCodingScheme = aCodingScheme;
+    }
+
+// -----------------------------------------------------------------------------
+// TSatIconInfo::SetFileIdentifier
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TSatIconInfo::SetFileIdentifier( const TUint16 aFileIdentifier )
+    {
+    LOG2( SIMPLE, 
+    "SATCLIENT: TSatIconInfo::SetFileIdentifier calling-exits, aFileIdentifier: %i", 
+    aFileIdentifier )
+    iFileIdentifier = aFileIdentifier;
+    }
+
+// -----------------------------------------------------------------------------
+// TSatIconInfo::SetOffset
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TSatIconInfo::SetOffset( const TUint16 aOffset)
+    {
+    LOG2( SIMPLE, 
+    "SATCLIENT: TSatIconInfo::SetOffset calling-exiting, aOffset: %i", 
+    aOffset )
+    iOffset = aOffset;
+    }
+
+// -----------------------------------------------------------------------------
+// TSatIconInfo::SetDataLength
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TSatIconInfo::SetDataLength( const TUint16 aDataLength )
+    {
+    LOG2( SIMPLE, 
+    "SATCLIENT: TSatIconInfo::SetDataLength calling-exiting aDataLength: %i", 
+    aDataLength )
+    iLength = aDataLength;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatClient/src/csatpluginmonitor.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,236 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Monitor the set up idle mote text P&S key.
+*
+*/
+
+
+#include    <e32base.h>
+#include    <etelsat.h>
+#include    <SATInternalPSKeys.h>       // For monitor the P&S key
+
+#include    "csatpluginmonitor.h"
+#include    "SatLog.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave
+// -----------------------------------------------------------------------------
+//
+CSatPluginMonitor* CSatPluginMonitor::NewL()
+    {
+    LOG( SIMPLE, "CSatPluginMonitor::NewL calling" )
+    
+    CSatPluginMonitor* self = new ( ELeave ) CSatPluginMonitor();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "CSatPluginMonitor::NewL exits" )
+    return self;    
+    }
+// -----------------------------------------------------------------------------
+// Destructor
+// Cancels  and deletes
+// all the dynamic content
+// -----------------------------------------------------------------------------
+//
+CSatPluginMonitor::~CSatPluginMonitor()
+    {
+    LOG( SIMPLE, "CSatPluginMonitor::~CSatPluginMonitor calling" )
+    iIdleAppStatus = NULL;
+    Cancel();
+    iIdleMode.Close();
+    LOG( SIMPLE, "CSatPluginMonitor::~CSatPluginMonitor exits" )
+    }
+    
+// -----------------------------------------------------------------------------
+// Start monitor the P&S key.
+// -----------------------------------------------------------------------------
+//
+TInt CSatPluginMonitor::Start( TRequestStatus& aStatus )
+    {
+    LOG( SIMPLE, "CSatPluginMonitor::StartMonitor calling" )
+    TInt err ( KErrNotReady );    
+        
+    if ( !iIdleAppStatus && !IsActive() )
+        {
+        aStatus = KRequestPending;
+        iIdleAppStatus = &aStatus;
+        iIdleMode.Subscribe( iStatus );
+        SetActive();
+        err = KErrNone;
+        LOG( DETAILED, "CSatPluginMonitor::StartMonitor subscribe the P&S key" )       
+        }     
+        
+    LOG2( SIMPLE, "CSatPluginMonitor::StartMonitor exits, err: %d", err )   
+    return err;     
+    }
+
+// -----------------------------------------------------------------------------
+// Get idle mode text
+// -----------------------------------------------------------------------------
+//
+TInt CSatPluginMonitor::GetIdleModeText( HBufC*& aText )
+    {
+    LOG( SIMPLE, "CSatPluginMonitor::GetIdleModeText calling" )    
+    TInt err ( KErrNoMemory );
+    
+    // Make the function no-leave.
+    aText = HBufC::New( RSat::KIdleModeTextMaxSize );  
+    if( aText )
+        {
+        TPtr txtPtr( aText->Des() );
+        err = RProperty::Get( KPSUidSatServerInternal, 
+                              KSatIdleModeText, 
+                              txtPtr ); 
+        if ( KErrNone != err )                           
+            {  
+            delete aText;
+            aText = NULL;            
+            }         
+        }
+    LOG2( SIMPLE,
+          "SATCLIENT::GetSetupIdleModeTextL text exits, error: %i", 
+          err )            
+    return err;                                      
+    }
+
+// -----------------------------------------------------------------------------
+// Get idle mode icon qualifier
+// -----------------------------------------------------------------------------
+//
+TInt CSatPluginMonitor::GetIdleModeIconQualifier( TInt& aIconQualifier )
+    {
+    LOG( SIMPLE, "CSatPluginMonitor::GetIdleModeIconQualifier calling" )       
+    TInt err( KErrNone );
+    err = RProperty::Get( KPSUidSatServerInternal, 
+                          KSatIdleModeTextIconQualifier, 
+                          aIconQualifier );  
+    LOG2( DETAILED,
+          "SATCLIENT::GetSetupIdleModeTextL iconQualifier error: %i", 
+          err )                           
+    LOG2( SIMPLE,
+          "SATCLIENT::GetSetupIdleModeTextL exits, iconQualifier: %i", 
+          aIconQualifier )   
+    return err;                                      
+    }
+
+// -----------------------------------------------------------------------------
+// Get idle mode icon id
+// -----------------------------------------------------------------------------
+//
+TInt CSatPluginMonitor::GetIdleModeIconId( TInt& aRecordNumber )
+    {
+    LOG( SIMPLE, "CSatPluginMonitor::GetIdleModeIconId calling" ) 
+    TInt err( KErrNone );
+    err = RProperty::Get( KPSUidSatServerInternal, 
+                          KSatIdleModeTextIconId, 
+                          aRecordNumber );  
+    LOG2( DETAILED,
+          "SATCLIENT::GetIdleModeIconId icon id error: %i", 
+          err )   
+    LOG2( SIMPLE,
+          "SATCLIENT: RSatService:GetIdleModeIconId exits, id: %i",
+          aRecordNumber ) 
+           
+    return err;                                
+    }
+
+
+// -----------------------------------------------------------------------------
+// Handles the request completion.
+// -----------------------------------------------------------------------------
+//
+void CSatPluginMonitor::RunL()
+    {
+    LOG2( SIMPLE, "SATCLIENT::CSatPluginMonitor::RunL calling, \
+          iIdleAppStatus: %i", iIdleAppStatus )
+    
+    if ( iIdleAppStatus )
+        {
+        // Complete the request.
+        User::RequestComplete( iIdleAppStatus, iStatus.Int() );
+        LOG2( DETAILED, "CSatPluginMonitor::RunL error: %i", iStatus.Int() );
+        
+        iIdleAppStatus = NULL;       
+        }
+
+    LOG( SIMPLE, "SATCLIENT::CSatPluginMonitor::RunL exits" )    
+    }
+    
+// -----------------------------------------------------------------------------
+// Cancels the pending request
+// -----------------------------------------------------------------------------
+//
+void CSatPluginMonitor::DoCancel()
+    {
+    LOG( SIMPLE, "CSatPluginMonitor::DoCancel calling" )
+    if ( iIdleAppStatus )
+        {
+        User::RequestComplete( iIdleAppStatus, KErrCancel );
+        iIdleMode.Cancel(); 
+        
+        iIdleAppStatus = NULL;
+        }
+    LOG( SIMPLE, "CSatPluginMonitor::DoCancel exits" )
+    }
+   
+// -----------------------------------------------------------------------------
+// Handles a leave occurring in the request completion event handler RunL()
+// -----------------------------------------------------------------------------
+//   
+TInt CSatPluginMonitor::RunError( TInt aError )
+    {
+    LOG2( SIMPLE, "CSatPluginMonitor::RunError calling, error: %i", aError )
+    if ( iIdleAppStatus )
+        {
+        // Complete the request.
+        User::RequestComplete( iIdleAppStatus, aError );
+        iIdleMode.Cancel(); 
+        
+        iIdleAppStatus = NULL;       
+        } 
+    LOG( SIMPLE, "CSatPluginMonitor::RunError exits" )   
+    return aError;
+    }
+// -----------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave
+// -----------------------------------------------------------------------------
+//
+void CSatPluginMonitor::ConstructL()
+    {
+    LOG( SIMPLE, "CSatPluginMonitor::ConstructL calling" )  
+     
+    TInt err = iIdleMode.Attach( KPSUidSatServerInternal, 
+                                 KSatIdleModeTextIconQualifier );
+    LOG2( DETAILED, "CSatPluginMonitor::ConstructL err: %i, exits", err )   
+                              
+    User::LeaveIfError( err );                                        
+    }
+    
+// -----------------------------------------------------------------------------
+// Default constructor
+// -----------------------------------------------------------------------------
+//
+CSatPluginMonitor::CSatPluginMonitor() : 
+    CActive( EPriorityStandard )
+    {
+    LOG( SIMPLE, "CSatPluginMonitor::ConstructL calling" ) 
+    CActiveScheduler::Add( this );
+    LOG( SIMPLE, "CSatPluginMonitor::ConstructL exits" ) 
+    }
+    
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatClient/src/rsatservice.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,582 @@
+/*
+* 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:  Sub-session for accessing icon data in SIM.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <fbs.h>
+#include    <centralrepository.h>
+#include    <etelsat.h>
+#include    <rsatservice.h>
+#include    <rsatsession.h>
+#include    <tsaticoninfo.h>
+
+#include    "tsatinternaliconinfo.h"
+#include    "SatSOpcodes.h"
+#include    "SatLog.h"
+#include    "SATPrivateCRKeys.h"
+#include    "csatpluginmonitor.h"
+
+// CONSTANTS
+// Length of the one icon info,
+// defined in chapter 4.6.1.1 ETSI TS 131 102 V4.10.0 (2003-09)
+const TInt KInfoLength = 9;
+const TInt KMaxIconSizeNotRead = -1;
+
+// Icon description must follow ETSI TS 131 102 V4.10.0 specification
+const TUint8 KBitsInByte( 8 );
+const TUint8 KIconWidth( 0 );
+const TUint8 KIconHeigth( 1 );
+const TUint8 KImageCodingScheme( 2 );
+const TUint8 KHighFileId( 3 );
+const TUint8 KLowFileId( 4 );
+const TUint8 KHighIconOffset( 5 );
+const TUint8 KLowIconOffset( 6 );
+const TUint8 KHighIconLength( 7 );
+const TUint8 KLowIconLength( 8 );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// RSatService::RSatService
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RSatService::RSatService() :
+    RSubSessionBase(),
+    iMaxIconDataSize( KMaxIconSizeNotRead )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// RSatService::OpenL
+// Connects a sub-session to SatServer.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RSatService::OpenL( const RSatSession& aSession )
+    {
+    LOG( SIMPLE, "SATCLIENT: RSatService::OpenL calling" )
+    #ifdef ENABLE_SAT_LOGGING
+    RProcess test;
+    LOG2( SIMPLE, 
+    "SATCLIENT: RSatService::OpenL UID of calling process: 0x%x",
+    test.SecureId().iId )
+    test.Close();
+    #endif
+
+    const TIpcArgs args( TIpcArgs::ENothing );
+    User::LeaveIfError(
+        CreateSubSession( aSession, ESatSOpenIconSubSession, args ) );
+
+    TInt err( KErrNone );
+    CRepository* repository = NULL;
+
+    // Which UID to monitor.
+    TRAP( err, repository = CRepository::NewL( KCRUidSatServer ); );
+    LOG2( SIMPLE, 
+          "SATCLIENT: RSatService::OpenL: new CRepository err: %d", 
+          err )
+    
+    if ( repository )
+        {
+        err = repository->StartTransaction(
+            CRepository::EReadWriteTransaction );
+        LOG2( SIMPLE, 
+              "SATCLIENT: RSatService::OpenL StartTransaction err: %d", 
+              err )
+        if ( KErrNone == err )
+            {
+            err = repository->Get( KSatMaxIconDataSize, iMaxIconDataSize );
+            LOG2( SIMPLE, 
+                  "SATCLIENT: RSatService::OpenL: GetMaxIconDataSize err: %d",
+                  err )
+            }
+        
+        LOG2( SIMPLE, 
+              "SATCLIENT: RSatService::OpenL Iconsize limit:%d",
+              iMaxIconDataSize )
+
+        delete repository;
+        repository = NULL;
+        }  
+        
+    // Monitor the idle mode text    
+    iSatPluginMonitor = CSatPluginMonitor::NewL();       
+    
+    LOG( SIMPLE, "SATCLIENT: RSatService::OpenL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// RSatService::Close
+// Closes the sub-session
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RSatService::Close()
+    {
+    LOG( SIMPLE, "SATCLIENT: RSatService::Close calling" )
+    #ifdef ENABLE_SAT_LOGGING
+    RProcess test;
+    LOG2( SIMPLE, 
+    "SATCLIENT: RSatService::Close UID of calling process: 0x%x",
+    test.SecureId().iId )
+    test.Close();
+    #endif
+
+    delete iSatPluginMonitor;
+    iSatPluginMonitor = NULL;
+    CloseSubSession( ESatSCloseIconSubSession );
+
+    LOG( SIMPLE, "SATCLIENT: RSatService::Close exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// RSatService::NotifySetupIdleModeTextChange
+// Get notified of idle mode text change.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RSatService::NotifySetupIdleModeTextChange( 
+    TRequestStatus& aStatus )
+    {
+    TInt err( KErrNotReady );
+    LOG( SIMPLE, 
+         "SATCLIENT: RSatService::NotifySetupIdleModeTextChange calling" )
+         
+    // New the SATMonitor to monitor the P&S key. 
+    // IsActive checked also here to avoid a Codescanner warning.
+    if ( iSatPluginMonitor && !iSatPluginMonitor->IsActive() )
+        {
+        err = iSatPluginMonitor->Start( aStatus );          
+        }
+    LOG( SIMPLE, 
+         "SATCLIENT: RSatService::NotifySetupIdleModeTextChange exiting" )    
+         
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// RSatService::NotifySetupIdleModeTextChangeCancel
+// Cancel notified of idle mode text change.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RSatService::NotifySetupIdleModeTextChangeCancel()
+    {
+    LOG( SIMPLE, 
+         "SATCLIENT: RSatService::NotifySetupIdleModeTextChangeCancel calling" )  
+           
+    if ( iSatPluginMonitor )
+        {
+        iSatPluginMonitor->Cancel();
+        }
+
+    LOG( SIMPLE, 
+     "SATCLIENT: RSatService::NotifySetupIdleModeTextChangeCancel exiting" )  
+    }
+    
+// -----------------------------------------------------------------------------
+// RSatService::GetSetupIdleModeTextL
+// Get text after bootup
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool RSatService::GetSetupIdleModeTextL( HBufC*& aText, 
+                                          TSatIconQualifier& aIconQualifier,
+                                          TUint8& aRecordNumber )  
+    {
+    LOG( SIMPLE, "SATCLIENT: RSatService::GetSetupIdleModeTextL calling" )
+    #ifdef ENABLE_SAT_LOGGING
+    RProcess test;
+    LOG2( SIMPLE,  "SATCLIENT: RSatService::GetSetupIdleModeTextL \
+          UID of calling process:  0x%x",
+          test.SecureId().iId )
+    test.Close();
+    #endif
+  
+    TBool ret ( ETrue ); 
+    TSatIconQualifier satIconQualifier( ESatIconNoIcon );
+    TUint8 satRecordNumber( NULL );    
+    TInt iconQualifier( KSatIdleIconQInit );
+    TInt recordNumber( KErrNotFound );
+    
+    // 1. Read icon qualifier, icon id and text
+    if ( iSatPluginMonitor )
+        {
+        LOG( SIMPLE, "SATCLIENT: RSatService::GetSetupIdleModeTextL read key" )
+        TInt result = 
+             iSatPluginMonitor->GetIdleModeIconQualifier( iconQualifier );
+             
+        // Read icon id.
+        if ( KSatIdleIconQNoIcon != iconQualifier )
+            {
+            result = iSatPluginMonitor->GetIdleModeIconId( recordNumber );
+            }
+        // Read the text on default.
+        result = iSatPluginMonitor->GetIdleModeText( aText );
+
+        }
+    
+    // 2. Convert icon qualifier.
+    // Form enum TSatIdleModeTextIconQualifierValue defined in 
+    // satinternalpskeys.h to enum TSatIconQualifier defined in rsatservice.h
+    // NOTE: the value are different.
+    switch ( iconQualifier )
+        {
+        case KSatIdleIconQInit: // go through
+        case KSatIdleIconQNoIcon: 
+            {
+            satIconQualifier = RSatService::ESatIconNoIcon;
+            break;
+            }
+        case KSatIdleIconQSelfExplanatory:
+            {
+            satIconQualifier = RSatService::ESatIconSelfExplanatory;
+            break;
+            }        
+        case KSatIdleIconQNotSelfExplanatory:
+            {
+            satIconQualifier = RSatService::ESatIconNotSelfExplanatory;
+            break;
+            }
+        default:
+            {
+            satIconQualifier = RSatService::ESatIconNoIcon;
+            break;            
+            }  
+        }
+    
+    // 3. Convert icon id
+    if ( 0 <= recordNumber )
+        {
+        // The PS key is published in TInt, and the value in etelsat.h is TUint8
+        // the revode number have to be cast to TUint8
+        satRecordNumber = static_cast<TUint8>( recordNumber );
+        LOG2( SIMPLE, "SATCLIENT: RSatService::GetSetupIdleModeTextL\
+             convert icon id: %i", satRecordNumber )           
+        }
+    else
+        {
+        satIconQualifier = RSatService::ESatIconNoIcon;
+        satRecordNumber = NULL;        
+        }
+
+    // 4. Inspect icon qualifier, icon id and text.
+    if ( RSatService::ESatIconNoIcon ==  satIconQualifier)
+        {
+        LOG( SIMPLE, 
+             "SATCLIENT: RSatService::GetSetupIdleModeTextL ESatIconNoIcon" )         
+        aIconQualifier = ESatIconNoIcon;
+        aRecordNumber = NULL;
+        }
+    else if ( RSatService::ESatIconNotSelfExplanatory == satIconQualifier && 
+              !aText )
+        {
+        LOG( SIMPLE, 
+             "SATCLIENT: RSatService::GetSetupIdleModeTextL \
+             ESatIconNotSelfExplanatory but no text" )  
+        User::LeaveIfError( KErrNotFound );
+        }
+    else
+        {
+        aIconQualifier = satIconQualifier;
+        aRecordNumber = satRecordNumber;        
+        }        
+        
+    LOG( SIMPLE, "SATCLIENT: RSatService::GetSetupIdleModeTextL exiting" )     
+    return ret;   
+    }
+
+
+// -----------------------------------------------------------------------------
+// RSatService::GetIconInfoL
+// Sends aRecordNumber to SatServer and waits for the icon informations.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RSatService::GetIconInfoL(
+    TUint8 aRecordNumber,
+    RIconEf& aIconEf ) const
+    {
+    LOG( SIMPLE, "SATCLIENT: RSatService::GetIconInfoL calling" )
+    #ifdef ENABLE_SAT_LOGGING
+    RProcess test;
+    LOG2( SIMPLE, 
+    "SATCLIENT: RSatService::GetIconInfoL UID of calling process: 0x%x",
+    test.SecureId().iId )
+    test.Close();
+    #endif
+
+    // Inform client that icons are not supported at all
+    if ( 0 >= iMaxIconDataSize )
+        {
+        LOG( SIMPLE, "SATCLIENT:M RSatService::GetIconInfoL KErrNotSupported" )
+        User::Leave( KErrNotSupported );
+        }
+
+    TPckgC<TUint8> recordNumberPckg( aRecordNumber );
+    RSat::TIcon iconEf;
+    TPckg<RSat::TIcon> iconEfPckg( iconEf );
+
+    const TIpcArgs args( &recordNumberPckg, &iconEfPckg );
+
+    // Get the icon info
+    const TInt error( SendReceive( ESatSGetIconInfo, args ) );
+    
+    LOG2( SIMPLE, "SATCLIENT: RSatService::GetIconInfo with error %i", error )
+    User::LeaveIfError( error );
+
+    // Check that data is valid.
+    CheckInfoValidityL( iconEf );
+
+    if ( 0 < iconEf.Length() )
+        {
+        LOG( SIMPLE, 
+             "SATCLIENT: RSatService::GetIconInfoL iconEf.Length() > 0" )
+        const TInt infoCount( iconEf[0] );
+        LOG2( SIMPLE, 
+        "SATCLIENT: RSatService::GetIconInfo infoCount: %i", infoCount )
+        for ( TInt i = 0; i < infoCount; i++ )
+            {
+            // Icon info is 9 bytes long and first byte is number of
+            // icon info descriptors.
+            const TInt KStart( i * KInfoLength + 1 );
+
+            // Extract the info and append to aIconEf.
+            const TPtrC8 info( iconEf.Mid( KStart, KInfoLength ) );
+            
+            TSatIconInfo satIconInfo;
+            SetIconInfoL( satIconInfo, info );
+            aIconEf.AppendL( satIconInfo );
+            }
+
+        }
+
+    LOG( SIMPLE, "SATCLIENT: RSatService::GetIconInfoL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// RSatService::GetIconL
+// Sends icon information to SatServer and waits the icon bitmap handle.
+// SatServer is notified when the bitmap is duplicated, so that server knows
+// that it can free the bitmap. If the server does not get the notification
+// of bitmap duplication then server will free the bitmap when next
+// icon is fetched.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CFbsBitmap* RSatService::GetIconL(
+    const TSatIconInfo& aIconInfo ) const
+    {
+    LOG( SIMPLE, "SATCLIENT: RSatService::GetIconL calling" )
+    #ifdef ENABLE_SAT_LOGGING
+    RProcess test;
+    LOG2( SIMPLE, 
+    "SATCLIENT: RSatService::GetIconL UID of calling process: 0x%x",
+    test.SecureId().iId )
+    test.Close();
+    #endif
+
+    CFbsBitmap* bitmap = NULL;
+
+    // Icon data size is checked
+    // If under or same as the maximum size, icon is fetched
+    // Otherwise null is returned.
+    if ( ( aIconInfo.DataLength() <= iMaxIconDataSize ) )
+        {
+        LOG( SIMPLE, "SATCLIENT: RSatService::GetIconL icon fetch started" )
+        TInt bitmapHandle( 0 );
+        TPckg<TInt> bitmapHandlePckg( bitmapHandle );
+
+        TSatInternalIconInfo interIconInfo;
+        TSatInternalIconInfoPckg interIconPckg( interIconInfo );
+        FillInternalIconInfo( aIconInfo, interIconInfo );
+
+
+        TIpcArgs args( &interIconPckg, &bitmapHandlePckg );
+
+        // Fetch the handle of the icon.
+        User::LeaveIfError( SendReceive( ESatSGetIconInstance, args ) );
+
+        // Duplicate the bitmap and notify server that bitmap is duplicated.
+        // After the duplication the bitmap is owned by the client.
+        args.Set( 0, TIpcArgs::ENothing );
+        args.Set( 1, TIpcArgs::ENothing );
+        bitmap = new( ELeave )CFbsBitmap();
+        CleanupStack::PushL( bitmap );
+        User::LeaveIfError( bitmap->Duplicate( bitmapHandle ) );
+        User::LeaveIfError( Send( ESatSIconInstanceGot, args ) );
+        CleanupStack::Pop( bitmap );
+        LOG( SIMPLE, "SATCLIENT: RSatService::GetIconL icon fetch exit" )
+        }
+
+    LOG( SIMPLE, "SATCLIENT: RSatService::GetIconL exiting" )
+    return bitmap;
+    }
+
+// -----------------------------------------------------------------------------
+// RSatService::SetIdleModeTextResponse
+// Sends SetUpIdleModeText response to Server.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RSatService::SetIdleModeTextResponse(
+    const TSATIdleResult& aResult ) const
+    {
+    LOG( SIMPLE, "SATCLIENT: RSatService::SetIdleModeTextResponse calling" )
+    
+    #ifdef ENABLE_SAT_LOGGING
+    RProcess test;
+    LOG2( SIMPLE, "SATCLIENT: RSatService::SetIdleModeTextResponse \
+    UID of calling process: 0x%x",
+    test.SecureId().iId )
+    test.Close();
+    #endif
+    
+    TInt responseValue( aResult );
+
+    // Build IPC package
+    const TIpcArgs args( responseValue );
+
+    // Send the SetUpIdleMode response
+    TInt err = SendReceive( ESatSIdleModeResponse, args );
+    LOG2( SIMPLE,
+        "SATCLIENT: RSatService::SetIdleModeTextResponse error while sending \
+        response to SAT Engine: %d", err )    
+    LOG( SIMPLE, "SATCLIENT: RSatService::SetIdleModeTextResponse exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// RSatService::CheckDataValidityL
+// Checks that data is valid.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void RSatService::CheckInfoValidityL( const TDesC8& aIconEf ) const
+    {
+    LOG( SIMPLE, "SATCLIENT: RSatService::CheckInfoValidityL calling" )
+
+    TInt err( KErrCorrupt );
+    TInt realLength( aIconEf.Length() );
+    TInt requiredLength( aIconEf[0] * KInfoLength + 1 );
+    
+    LOG2( SIMPLE, 
+          "SATCLIENT: RSatService::CheckInfoValidityL realLength=%d",
+          realLength )
+    LOG2( SIMPLE, 
+          "SATCLIENT: RSatService::CheckInfoValidityL requiredLength=%d",
+          requiredLength )   
+
+    // The length can be more than required, but the lenght has to be
+    // at least required length.            
+    if ( 0 < realLength && realLength >= requiredLength )
+        {
+        err = KErrNone;
+        }
+    User::LeaveIfError( err );
+
+    LOG( SIMPLE, "SATCLIENT: RSatService::CheckInfoValidityL exiting" )
+    }
+  
+// -----------------------------------------------------------------------------
+// RSatService::SetIconInfo
+// Set aIconSatData to TSatIconInfo.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void RSatService::SetIconInfoL( TSatIconInfo& aContainer, 
+                               const TDesC8& aIconSatData ) const
+    {
+    LOG( SIMPLE, "SATCLIENT: RSatService::SetIconInfo calling" )
+    TInt err( KErrCorrupt );
+    
+    if ( KLowIconLength <= aIconSatData.Size() )
+        {
+        LOG( SIMPLE, "SATCLIENT: RSatService::SetIconInfo valid descriptor" )  
+        
+        TUint16 integer( 0 );
+        TSize size( 0, 0 );
+
+        // 1. icon size
+        size.SetSize( aIconSatData[KIconWidth], aIconSatData[KIconHeigth] );
+        aContainer.SetIconSize( size );  
+         
+        // 2. code scheme     
+        aContainer.SetCodingScheme( static_cast<TSatIconInfo::TCodingScheme>( 
+                                    aIconSatData[KImageCodingScheme] ) );
+
+        // 3. file identifier
+        // High byte
+        integer = static_cast<TUint16>( 
+                  aIconSatData[KHighFileId] << KBitsInByte );
+        // Low byte
+        integer |= aIconSatData[KLowFileId];
+        aContainer.SetFileIdentifier( integer );
+
+        // 4. offset
+        // High byte
+        integer = static_cast<TUint16>( 
+                  aIconSatData[KHighIconOffset] << KBitsInByte );
+        // Low byte
+        integer |= aIconSatData[KLowIconOffset];
+        aContainer.SetOffset( integer );
+
+        // 5. length 
+        // High byte
+        integer = static_cast<TUint16>( 
+                  aIconSatData[KHighIconLength] << KBitsInByte );
+        // Low byte
+        integer |= aIconSatData[KLowIconLength];
+        aContainer.SetDataLength( integer );  
+        err = KErrNone;
+        }
+    User::LeaveIfError( err );   
+    LOG( SIMPLE, "SATCLIENT: RSatService::SetIconInfo exiting" )
+    }
+  
+// -----------------------------------------------------------------------------
+// RSatService::llInternalIconInfo
+// Convert TSatIconinfo to TSatInternalIconInfo.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+void RSatService::FillInternalIconInfo( const TSatIconInfo& aIconInfo, 
+                  TSatInternalIconInfo& aInternalIconInfo ) const
+    {
+    LOG( SIMPLE, "SATCLIENT: RSatService::FillInternalIconInfo calling" )
+
+    // Fill the fields    
+    aInternalIconInfo.iWidth = aIconInfo.IconSize().iWidth;
+    aInternalIconInfo.iHeight = aIconInfo.IconSize().iHeight;
+    if ( TSatIconInfo::EBasic == aIconInfo.CodingScheme() )
+        {
+        aInternalIconInfo.iCodingScheme = TSatInternalIconInfo::EBasic;
+        }
+    else
+        {
+        aInternalIconInfo.iCodingScheme = TSatInternalIconInfo::EColor;
+        }       
+    aInternalIconInfo.iFileIdentifier = aIconInfo.FileIdentifier();
+    aInternalIconInfo.iOffset = aIconInfo.Offset();
+    aInternalIconInfo.iLength = aIconInfo.DataLength();
+    
+    LOG( SIMPLE, "SATCLIENT: RSatService::FillInternalIconInfo exit" )    
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatInternalClient/bwins/SatInternalClientu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,12 @@
+EXPORTS
+	??0RSatUiSession@@QAE@XZ @ 1 NONAME ; RSatUiSession::RSatUiSession(void)
+	?Adapter@RSatUiSession@@QBEPAVMSatUiAdapter@@XZ @ 2 NONAME ; class MSatUiAdapter * RSatUiSession::Adapter(void) const
+	?Close@RSatUiSession@@QAEXXZ @ 3 NONAME ; void RSatUiSession::Close(void)
+	?CreateRequest@RSatUiSession@@QBEXHABVTIpcArgs@@@Z @ 4 NONAME ; void RSatUiSession::CreateRequest(int, class TIpcArgs const &) const
+	?CreateRequest@RSatUiSession@@QBEXHABVTIpcArgs@@AAVTRequestStatus@@@Z @ 5 NONAME ; void RSatUiSession::CreateRequest(int, class TIpcArgs const &, class TRequestStatus &) const
+	?KillServer@RSatUiSession@@QBEXXZ @ 6 NONAME ; void RSatUiSession::KillServer(void) const
+	?Panic@RSatUiSession@@QBEXW4TSatClientPanic@@@Z @ 7 NONAME ; void RSatUiSession::Panic(enum TSatClientPanic) const
+	?RegisterL@RSatUiSession@@QAEXABVRSatSession@@PAVMSatUiObserver@@@Z @ 8 NONAME ; void RSatUiSession::RegisterL(class RSatSession const &, class MSatUiObserver *)
+	?SatUiObserver@RSatUiSession@@QAEPAVMSatUiObserver@@XZ @ 9 NONAME ; class MSatUiObserver * RSatUiSession::SatUiObserver(void)
+	?Version@RSatUiSession@@QBE?AVTVersion@@XZ @ 10 NONAME ; class TVersion RSatUiSession::Version(void) const
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatInternalClient/eabi/SatInternalClientu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,35 @@
+EXPORTS
+	_ZN13RSatUiSession13SatUiObserverEv @ 1 NONAME
+	_ZN13RSatUiSession5CloseEv @ 2 NONAME
+	_ZN13RSatUiSession9RegisterLERK11RSatSessionP14MSatUiObserver @ 3 NONAME
+	_ZN13RSatUiSessionC1Ev @ 4 NONAME
+	_ZN13RSatUiSessionC2Ev @ 5 NONAME
+	_ZNK13RSatUiSession10KillServerEv @ 6 NONAME
+	_ZNK13RSatUiSession13CreateRequestEiRK8TIpcArgs @ 7 NONAME
+	_ZNK13RSatUiSession13CreateRequestEiRK8TIpcArgsR14TRequestStatus @ 8 NONAME
+	_ZNK13RSatUiSession5PanicE15TSatClientPanic @ 9 NONAME
+	_ZNK13RSatUiSession7AdapterEv @ 10 NONAME
+	_ZNK13RSatUiSession7VersionEv @ 11 NONAME
+	_ZTI17CSatCEventHandler @ 12 NONAME ; #<TI>#
+	_ZTI17CSatCQueryHandler @ 13 NONAME ; #<TI>#
+	_ZTI18CSatCNotifyHandler @ 14 NONAME ; #<TI>#
+	_ZTI20CSatCGetInkeyHandler @ 15 NONAME ; #<TI>#
+	_ZTI20CSatCGetInputHandler @ 16 NONAME ; #<TI>#
+	_ZTI20CSatCPlayToneHandler @ 17 NONAME ; #<TI>#
+	_ZTI21CSatCCommandProcessor @ 18 NONAME ; #<TI>#
+	_ZTI21CSatCSetUpMenuHandler @ 19 NONAME ; #<TI>#
+	_ZTI22CSatCSelectItemHandler @ 20 NONAME ; #<TI>#
+	_ZTI23CSatCDisplayTextHandler @ 21 NONAME ; #<TI>#
+	_ZTI25CSatCActiveCommandHandler @ 22 NONAME ; #<TI>#
+	_ZTV17CSatCEventHandler @ 23 NONAME ; #<VT>#
+	_ZTV17CSatCQueryHandler @ 24 NONAME ; #<VT>#
+	_ZTV18CSatCNotifyHandler @ 25 NONAME ; #<VT>#
+	_ZTV20CSatCGetInkeyHandler @ 26 NONAME ; #<VT>#
+	_ZTV20CSatCGetInputHandler @ 27 NONAME ; #<VT>#
+	_ZTV20CSatCPlayToneHandler @ 28 NONAME ; #<VT>#
+	_ZTV21CSatCCommandProcessor @ 29 NONAME ; #<VT>#
+	_ZTV21CSatCSetUpMenuHandler @ 30 NONAME ; #<VT>#
+	_ZTV22CSatCSelectItemHandler @ 31 NONAME ; #<VT>#
+	_ZTV23CSatCDisplayTextHandler @ 32 NONAME ; #<VT>#
+	_ZTV25CSatCActiveCommandHandler @ 33 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatInternalClient/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project SatInternalClient
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+satinternalclient.mmp
+
+PRJ_EXPORTS
+../inc/RSatUiSession.h          |../../../../inc/rsatuisession.h
+../inc/MSatUiObserver.h         |../../../../inc/msatuiobserver.h
+../inc/MSatUiAdapter.h          |../../../../inc/msatuiadapter.h
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatInternalClient/group/satinternalclient.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 SatClient
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../inc/SatMacroes.h"
+
+TARGET                  SatInternalClient.dll
+TARGETTYPE              dll
+UID                     0x1000008d 0x200194F8
+
+CAPABILITY              CAP_CLIENT_DLL
+VENDORID                VID_DEFAULT
+
+#ifdef ENABLE_SAT_LOGGING
+EPOCSTACKSIZE           0x4000 // Logging needs more stack than default 8 kilos.
+#endif
+
+SOURCEPATH              ../src
+
+SOURCE                  RSatUiSession.cpp
+SOURCE                  CSatCCommandProcessor.cpp
+SOURCE                  CSatCDisplayTextHandler.cpp
+SOURCE                  CSatCGetInkeyHandler.cpp
+SOURCE                  CSatCGetInputHandler.cpp
+SOURCE                  CSatCSetUpMenuHandler.cpp
+SOURCE                  CSatCPlayToneHandler.cpp
+SOURCE                  CSatCSelectItemHandler.cpp
+SOURCE                  CSatCActiveCommandHandler.cpp
+SOURCE                  CSatCQueryHandler.cpp
+SOURCE                  CSatCEventHandler.cpp
+SOURCE                  CSatCNotifyHandler.cpp
+
+USERINCLUDE             ../inc
+USERINCLUDE             ../../inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           ../../../../inc         // Domain telephony
+SYSTEMINCLUDE           ../../../inc            // Subsystem satengine
+
+LIBRARY                 euser.lib
+LIBRARY                 satengine.lib
+LIBRARY                 etelsat.lib
+LIBRARY                 bafl.lib
+LIBRARY                 fbscli.lib
+LIBRARY                 CentralRepository.lib   // For Central Repository
+LIBRARY                 SatClient.lib
+
+#ifdef ENABLE_SAT_LOGGING
+LIBRARY                 flogger.lib
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatInternalClient/inc/CSatCActiveCommandHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,107 @@
+/*
+* 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:  This is the handler for the SIM Application Toolkit
+*                active commands.
+*
+*/
+
+
+#ifndef CSATCACTIVECOMMANDHANDLER_H
+#define CSATCACTIVECOMMANDHANDLER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <etelsat.h>
+#include "MSatUiAdapter.h"
+
+// FORWARD DECLARATIONS
+
+class RSatUiSession;
+
+// CLASS DECLARATION
+
+/**
+ *  This class handles end user -initiated commands.
+ *  It is derived from an abstract interface (MSatUiAdapter) so that
+ *  the implementation is not exposed to the user of this class.
+ *
+ *  @lib SatClient.lib
+ *  @since Series 60 2.6
+ */
+class CSatCActiveCommandHandler : public CBase, public MSatUiAdapter
+    {
+    public: // Constructors and destructor
+
+        /**
+         * Two-phased constructor.
+         * @param aSat A pointer to a session (does not take ownership).
+         */
+        static CSatCActiveCommandHandler* NewL( RSatUiSession* aSat );
+
+        /**
+         * Destructor.
+         */
+        virtual ~CSatCActiveCommandHandler();
+
+    public: // New functions
+
+        /**
+         * From MSatUiAdapter
+         *
+         * Menu Selection active command handling.
+         * @param aMenuItem The index of the selected menu item (starts from 0).
+         * @param aHelpRequested A flag indicating whether help was req'd.
+         */
+        void MenuSelection(
+            TInt aMenuItem,
+            TBool aHelpRequested );
+
+        /**
+         * From MSatUiAdapter
+         *
+         * Session terminanation active command handling.
+         * @param aType The type of termination
+         */
+        void SessionTerminated( TInt8 aType );
+
+    private: // Constructors
+
+        /**
+         * C++ default constructor.
+         * @param aSat A pointer to a session (does not take ownership).
+         */
+        CSatCActiveCommandHandler( RSatUiSession* aSat );
+
+    private: // Data
+
+        /**
+         * Reference to the Sat API
+         */
+        RSatUiSession* iSession;
+
+        /**
+         * The data structure for the command data
+         */        
+        RSat::TMenuSelectionV1 iMenuSelectionData;
+
+        /**
+         * The data package for IPC
+         */          
+        RSat::TMenuSelectionV1Pckg iMenuSelectionPckg;
+
+    };
+
+#endif // CSATCACTIVECOMMANDHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatInternalClient/inc/CSatCCommandProcessor.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,161 @@
+/*
+* 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:  This file contains the client command processor class that is
+*                responsible for the active objects needed to maintain that
+*                connection.
+*
+*/
+
+
+
+#ifndef CSATCCOMMANDPROCESSOR_H
+#define CSATCCOMMANDPROCESSOR_H
+
+//  INCLUDES
+#include <e32base.h>
+
+#include "CSatCDisplayTextHandler.h"
+#include "CSatCGetInkeyHandler.h"
+#include "CSatCGetInputHandler.h"
+#include "CSatCSetUpMenuHandler.h"
+#include "CSatCSelectItemHandler.h"
+#include "CSatCPlayToneHandler.h"
+#include "CSatCActiveCommandHandler.h"
+#include "CSatCEventHandler.h"
+#include "CSatCQueryHandler.h"
+#include "CSatCNotifyHandler.h"
+
+// FORWARD DECLARATIONS
+class RSatUiSession;
+
+// CLASS DECLARATION
+
+/**
+ *  This class is the container for all command handlers.
+ *  The class, owned by the session objects, initializes and starts all
+ *  of the active objects which are part of the Sat Client API.
+ *
+ *  @lib SatClient.lib
+ *  @since Series 60 2.6
+ */
+class CSatCCommandProcessor : public CBase
+    {
+    public: // Constructors and destructor
+
+        /**
+         * Two-phased constructor.
+         * @param aSession A pointer to a session (does not take ownership).
+         */
+        static CSatCCommandProcessor* NewL( RSatUiSession* aSession );
+
+        /**
+         * Destructor.
+         */
+        virtual ~CSatCCommandProcessor();
+
+    public:  // New functions
+
+        /**
+         * Starts the active objects.
+         */
+        void Start();
+
+        /**
+         * Returns a pointer to the object that implements set up menu command
+         * handler object.
+         * @return The set up menu command handler object pointer.
+         */
+        CSatCSetUpMenuHandler* SetUpMenuHandler();
+
+        /**
+         * Returns a pointer to a active command handler object.
+         * @return The active command handler object pointer.
+         */
+        CSatCActiveCommandHandler* ActiveCommandHandler();
+
+    private: // Constructors
+
+        /**
+         * C++ default constructor.
+         * @param aSession A pointer to a session (does not take ownership).
+         */
+        CSatCCommandProcessor( RSatUiSession* aSession );
+
+        /**
+         * By default Symbian OS constructor is private.
+         */
+        void ConstructL();
+
+    private: // Data
+
+        /**
+         * The Sat Client Session.
+         */        
+        RSatUiSession* iSession;
+
+        /**
+         * The Display Text command handler.
+         */          
+        CSatCDisplayTextHandler* iDisplayTextHandler;
+
+        /**
+         * The Get Inkey command handler.
+         */          
+        CSatCGetInkeyHandler* iGetInkeyHandler;
+
+        /**
+         * The Get Input command handler.
+         */          
+        CSatCGetInputHandler* iGetInputHandler;
+ 
+        /**
+         * The Set Up Menu command handler.
+         */          
+        CSatCSetUpMenuHandler* iSetUpMenuHandler;
+
+        /**
+         * The Select Item command handler.
+         */          
+        CSatCSelectItemHandler* iSelectItemHandler;
+
+        /**
+         * The Play Tone command handler.
+         */          
+        CSatCPlayToneHandler* iPlayToneHandler;
+
+        /**
+         * Handler for various server-side events.
+         */          
+        CSatCEventHandler* iEventHandler;
+
+        /**
+         * Handler for various end-user queries.
+         */          
+        CSatCQueryHandler* iQueryHandler;
+
+        /**
+         * Notification handler
+         */          
+        CSatCNotifyHandler* iNotifyHandler;
+
+        /**
+         * The handler for all user-initiated commands.
+         */          
+        CSatCActiveCommandHandler* iActiveCommandHandler;
+
+    };
+
+#endif // CSATCCOMMANDPROCESSOR_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatInternalClient/inc/CSatCDisplayTextHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,131 @@
+/*
+* 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:  This is the handler for the SIM Application Toolkit
+*                Display Text proactive command.
+*
+*/
+
+
+
+#ifndef CSATCDISPLAYTEXTHANDLER_H
+#define CSATCDISPLAYTEXTHANDLER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <etelsat.h>
+
+#include "SatSTypes.h"
+
+// FORWARD DECLARATIONS
+class RSatUiSession;
+
+// CLASS DECLARATION
+
+/**
+ *  The active object handler for the Display Text command.
+ *  Processes the received data and passes it on to the session client.
+ *
+ *  @lib SatClient.lib
+ *  @since Series 60 2.6
+ */
+class CSatCDisplayTextHandler : public CActive
+    {
+    public: // Constructors and destructor
+
+        /**
+         * Two-phased constructor.
+         * @param aSat A pointer to a session (does not take ownership).
+         */
+        static CSatCDisplayTextHandler* NewL( RSatUiSession* aSat );
+
+        /**
+         * Destructor.
+         */
+        virtual ~CSatCDisplayTextHandler();
+
+    public: // New functions
+
+        /**
+        * Starts listening for the Sat command.
+        */
+        void Start();
+
+    protected:  // Functions from base classes
+
+        /**
+         * From CActive
+         * Handles the request completion.
+         */
+        void RunL();
+
+        /**
+         * From CActive
+         * Implements the cancel protocol.
+         */
+        void DoCancel();
+
+    private: // Constructors
+
+        /**
+         * C++ default constructor.
+         * @param aPriority The priority of this active object.
+         * @param aSat A pointer to a session (does not take ownership).
+         */
+        CSatCDisplayTextHandler(
+            TInt aPriority,
+            RSatUiSession* aSat );
+
+    private: // New functions
+
+        /**
+         * Examine the client response.
+         * @param sResponse response data
+         * @param aRequestedIconDisplayed Informs if icon is not used
+         */
+        void ExamineClientResponse(
+            TSatUiResponse sResponse,
+            TBool aRequestedIconDisplayed );
+
+    private: // Data
+
+        /**
+         * Reference to the Sat API
+         */
+        RSatUiSession* iSession;
+
+        /**
+         * The data structure for the command data
+         */        
+        TSatDisplayTextV1 iDisplayTextData;
+
+        /**
+         * The data package for IPC
+         */          
+        TSatDisplayTextV1Pckg iDisplayTextPckg;
+
+        /**
+         * The response data structure
+         */          
+        RSat::TDisplayTextRspV1 iDisplayTextRsp;
+
+        /**
+         * The response package for IPC
+         */          
+        RSat::TDisplayTextRspV1Pckg iDisplayTextRspPckg;
+
+    };
+
+#endif // CSATCDISPLAYTEXTHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatInternalClient/inc/CSatCEventHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,113 @@
+/*
+* 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:  This is the handler for various events related to those SIM
+*                Application Toolkit proactive commands that simply indicate
+*                that an action occured at the server.
+*
+*/
+
+
+
+#ifndef CSATCEVENTHANDLER_H
+#define CSATCEVENTHANDLER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <etelsat.h>
+#include "SatSTypes.h"
+
+// FORWARD DECLARATIONS
+
+class RSatUiSession;
+
+// CLASS DECLARATION
+
+/**
+ *  This class notifies the client about various server-side events.
+ *  The events in question are start/end of call, start/end of SIM refresh,
+ *  SS send and SIM session end.
+ *
+ *  @lib SatClient.lib
+ *  @since Series 60 2.6
+ */
+class CSatCEventHandler : public CActive
+    {
+    public: // Constructors and destructor
+
+        /**
+         * Two-phased constructor.
+         * @param aSat A pointer to a session (does not take ownership).
+         */
+        static CSatCEventHandler* NewL( RSatUiSession* aSat );
+
+        /**
+         * Destructor.
+         */
+        virtual ~CSatCEventHandler();
+
+    public: // New functions
+
+        /**
+         * Starts listening for the Sat command.
+         */
+        void Start();
+
+    protected:  // Functions from base classes
+
+        /**
+         * From CActive
+         *
+         * Handles the request completion.
+         */
+        void RunL();
+
+        /**
+         * From CActive
+         * 
+         * Implements the cancel protocol.
+         */
+        void DoCancel();
+
+    private: // Constructors
+
+        /**
+         * C++ default constructor.
+         * @param aPriority The priority of this active object.
+         * @param aSat A pointer to a session (does not take ownership).
+         */
+        CSatCEventHandler(
+            TInt aPriority,
+            RSatUiSession* aSat );
+
+    private: // Data
+
+        /**
+         * Reference to the Sat API
+         */
+        RSatUiSession* iSession;
+
+        /**
+         * The data structure for the command data
+         */        
+        TSatEventV1 iEventData;
+
+        /**
+         * The data package for IPC
+         */                
+        TSatEventV1Pckg iEventPckg;
+    };
+
+#endif // CSATCEVENTHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatInternalClient/inc/CSatCGetInkeyHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,147 @@
+/*
+* 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:  This is the handler for the SIM Application Toolkit Get Inkey
+*                proactive command.
+*
+*/
+
+
+
+#ifndef CSATCGETINKEYHANDLER_H
+#define CSATCGETINKEYHANDLER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "etelsat.h"
+
+// FORWARD DECLARATIONS
+class RSatUiSession;
+
+// CLASS DECLARATION
+
+/**
+ *  This is the Get Inkey command active object handler.
+ *  The class receives command data from ETel, processes it and
+ *  passes it on to the user. Following that, the response is encoded and
+ *  sent back to ETel.
+ *
+ *  @lib SatClient.lib
+ *  @since Series 60 2.6
+ */
+class CSatCGetInkeyHandler : public CActive
+    {
+    public: // Constructors and destructor
+
+        /**
+         * Two-phased constructor.
+         * @param aSat A pointer to a session (does not take ownership).
+         */
+        static CSatCGetInkeyHandler* NewL( RSatUiSession* aSat );
+
+        /**
+         * Destructor.
+         */
+        virtual ~CSatCGetInkeyHandler();
+
+    public: // New functions
+
+        /**
+         * Starts listening for the Sat command.
+         */
+        void Start();
+
+    protected: // Functions from base classes
+
+        /**
+         * From CActive
+         *
+         * Handles the request completion.
+         */
+        void RunL();
+
+        /**
+         * From CActive
+         *
+         * Implements the cancel protocol.
+         */
+        void DoCancel();
+
+    private: // Constructors
+
+        /**
+         * C++ default constructor.
+         * @param aPriority The priority of this active object.
+         * @param aSat A pointer to a session (does not take ownership).
+         */
+        CSatCGetInkeyHandler(
+            TInt aPriority,
+            RSatUiSession* aSat );
+
+    private: // New functions
+
+        /**
+         * Examine the client response.
+         * @param aResponse Client response data
+         * @param aCharacter User input
+         * @param aRequestedIconDisplayed Informs if icon is not used
+         */
+        void ExamineClientResponse(
+            TSatUiResponse aResponse,
+            const TChar& aCharacter,
+            TBool aRequestedIconDisplayed );
+
+        /**
+         * Return given duration in seconds.
+         * @return Return given duration in seconds.
+         */
+        TUint DurationInTenthOfSeconds() const;
+
+        /**
+         * Convert seconds to duration.
+         * @param aDurationInSeconds Duration in seconds
+         */
+        void TenthOfSecondsToDuration( TUint aDurationInSeconds );
+
+    private: // Data
+
+        /**
+         * Reference to the Sat API
+         */
+        RSatUiSession* iSession;
+
+        /**
+         * The data structure for the command data
+         */        
+        RSat::TGetInkeyV2 iGetInkeyData;
+
+        /**
+         * The data package for IPC
+         */        
+        RSat::TGetInkeyV2Pckg iGetInkeyPckg;
+
+        /**
+         * The response data structure
+         */        
+        RSat::TGetInkeyRspV2 iGetInkeyRsp;
+
+        /**
+         * The response package for IPC
+         */        
+        RSat::TGetInkeyRspV2Pckg iGetInkeyRspPckg;
+
+    };
+
+#endif // CSATCGETINKEYHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatInternalClient/inc/CSatCGetInputHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,146 @@
+/*
+* 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:  This is the handler for the SIM Application Toolkit Get Input
+*                proactive command.
+*
+*/
+
+
+
+#ifndef CSATCGETINPUTHANDLER_H
+#define CSATCGETINPUTHANDLER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <etelsat.h>
+
+// FORWARD DECLARATIONS
+
+class RSatUiSession;
+
+// CLASS DECLARATION
+
+/**
+ *  This is the Get Input command active object handler.
+ *  The class receives command data from ETel, processes it and
+ *  passes it on to the user. Following that, the response is encoded and
+ *  sent back to ETel.
+ *
+ *  @lib SatClient.lib
+ *  @since Series 60 2.6
+ */
+class CSatCGetInputHandler : public CActive
+    {
+    public: // Constructors and destructor
+
+        /**
+         * Two-phased constructor.
+         * @param aSat A pointer to a session (does not take ownership).
+         */
+        static CSatCGetInputHandler* NewL( RSatUiSession* aSat );
+
+        /**
+         * Destructor.
+         */
+        virtual ~CSatCGetInputHandler();
+
+    public: // New functions
+
+        /**
+         * Starts listening for the Sat command.
+         */
+        void Start();
+
+    private:
+
+        /**
+         * Converts USAT character set to SAT character set type.
+         * @param aCharacterSet USAT character set
+         * @return SAT character set.
+         */
+        TSatCharacterSet ConvertCharacterSet(
+            const RSat::TGetInputRspFormat& aCharacterSet ) const;
+
+    protected:  // Functions from base classes
+
+        /**
+         * From CActive
+         * 
+         * Handles the request completion.
+         */
+        void RunL();
+
+        /**
+         * From CActive
+         *
+         * Implements the cancel protocol.
+         */
+        void DoCancel();
+
+    private: // Constructors
+
+        /**
+         * C++ default constructor.
+         * @param aPriority The priority of this active object.
+         * @param aSat A pointer to a session (does not take ownership).
+         */
+        CSatCGetInputHandler(
+            TInt aPriority,
+            RSatUiSession* aSat );
+
+    private: // New functions
+
+        /**
+         * Examine the client response.
+         * @param aResponse Client response data
+         * @param aInputText User input
+         * @param aRequestedIconDisplayed Informs if icon is not used
+         */
+        void ExamineClientResponse(
+            TSatUiResponse aResponse,
+            const TDes& aInputText,
+            TBool aRequestedIconDisplayed );
+
+    private: // Data
+
+        /**
+         * Reference to the Sat API
+         */
+        RSatUiSession* iSession;
+
+        /**
+         * The data structure for the command data
+         */
+        RSat::TGetInputV1 iGetInputData;
+
+        /**
+         * The data package for IPC
+         */
+        RSat::TGetInputV1Pckg iGetInputPckg;
+
+        /**
+         * The data structure for the response data
+         */
+        RSat::TGetInputRspV1 iGetInputRsp;
+
+        /**
+         * The response package for IPC
+         */
+        RSat::TGetInputRspV1Pckg iGetInputRspPckg;
+
+    };
+
+#endif // CSATCGETINPUTHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatInternalClient/inc/CSatCNotifyHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,121 @@
+/*
+* 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:  This is the handler for various notifications related to
+*                those SIM Application Toolkit proactive commands that
+*                uses notifications to inform user about their actions.
+*
+*/
+
+
+
+#ifndef CSATCNOTIFYHANDLER_H
+#define CSATCNOTIFYHANDLER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <etelsat.h>
+#include "SatSTypes.h"
+
+// FORWARD DECLARATIONS
+class RSatUiSession;
+
+// CLASS DECLARATION
+
+/**
+ *  This is the active object handler for various end-user notifications.
+ *
+ *  @lib SatClient.lib
+ *  @since Series 60 3.1
+ */
+class CSatCNotifyHandler : public CActive
+    {
+    public: // Constructors and destructor
+
+        /**
+         * Two-phased constructor.
+         * @param aSat A pointer to a session (does not take ownership).
+         */
+        static CSatCNotifyHandler* NewL( RSatUiSession* aSat );
+
+        /**
+         * Destructor.
+         */
+        virtual ~CSatCNotifyHandler();
+
+    public: // New functions
+
+        /**
+         * Starts listening for the Sat command.
+         */
+        void Start();
+
+    protected:  // Functions from base classes
+
+        /**
+         * From CActive
+         *
+         * Handles the request completion.
+         */
+        void RunL();
+
+        /**
+         * From CActive
+         *
+         * Implements the cancel protocol.
+         */
+        void DoCancel();
+
+    private: // Constructors
+
+        /**
+         * C++ default constructor.
+         * @param aPriority The priority of this active object.
+         * @param aSat A pointer to a session (does not take ownership).
+         */
+        CSatCNotifyHandler(
+            TInt aPriority,
+            RSatUiSession* aSat );
+
+    private:    // Data
+
+        /**
+         * Reference to the Sat API
+         */        
+        RSatUiSession* iSession;
+
+        /**
+         * The data structure for the command data
+         */        
+        TSatNotificationV1 iNotifyData;
+
+        /**
+         * The data package for IPC
+         */        
+        TSatNotificationV1Pckg iNotifyPckg;
+
+        /**
+         * The response data structure
+         */        
+        TSatNotificationRspV1 iNotifyRsp;
+
+        /**
+         * The response package for IPC
+         */        
+        TSatNotificationRspV1Pckg iNotifyRspPckg;
+
+    };
+
+#endif // CSATCNOTIFYHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatInternalClient/inc/CSatCPlayToneHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,142 @@
+/*
+* 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:  This is the handler for the SIM Application Toolkit
+*                Play Tone proactive command.
+*
+*/
+
+
+#ifndef CSATCPLAYTONEHANDLER_H
+#define CSATCPLAYTONEHANDLER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <etelsat.h>
+
+// CONSTANTS
+
+// Number of microseconds in a minute.
+const TInt64 KSatCMicroSecondsInMinute = 60*1000000;
+
+// Number of microseconds in a seconds.
+const TInt64 KSatCMicroSecondsInSecond = 1000000;
+
+// Number of microseconds in one tenth of a seconds.
+const TInt64 KSatCMicroSecondsInOneTenthSecond = 100000;
+
+// FORWARD DECLARATIONS
+
+class RSatUiSession;
+
+// CLASS DECLARATION
+
+/**
+ *  This is the Play Tone command active object handler.
+ *
+ *  @lib SatClient.lib
+ *  @since Series 60 2.6
+ */
+class CSatCPlayToneHandler : public CActive
+    {
+    public: // Constructors and destructor
+
+        /**
+         * Two-phased constructor.
+         * @param aSat A pointer to a session (does not take ownership).
+         */
+        static CSatCPlayToneHandler* NewL( RSatUiSession* aSat );
+
+        /**
+         * Destructor.
+         */
+        virtual ~CSatCPlayToneHandler();
+
+    public: // New functions
+
+        /**
+         * Starts listening for the Sat command.
+         */
+        void Start();
+
+    protected: // Functions from base classes
+
+        /**
+         * From CActive
+         *
+         * Handles the request completion.
+         */
+        void RunL();
+
+        /**
+         * From CActive
+         *
+         * Implements the cancel protocol.
+         */
+        void DoCancel();
+
+    private: // Constructors
+
+        /**
+         * C++ default constructor.
+         * @param aPriority The priority of this active object.
+         * @param aSat A pointer to a session (does not take ownership).
+         */
+
+        CSatCPlayToneHandler(
+            TInt aPriority,
+            RSatUiSession* aSat );
+
+    private: // New functions
+
+        /**
+         * Examine the client response.
+         * @param aResponse Client response data
+         * @param aRequestedIconDisplayed Informs if icon is not used
+         */
+        void ExamineClientResponse(
+            TSatUiResponse aResponse,
+            TBool aRequestedIconDisplayed );
+
+    private: // Data
+
+        /**
+         * Reference to the Sat API
+         */
+        RSatUiSession* iSession;
+
+        /**
+         * The data structure for the command data
+         */        
+        RSat::TPlayToneV2 iPlayToneData;
+
+        /**
+         * The data package for IPC
+         */        
+        RSat::TPlayToneV2Pckg iPlayTonePckg;
+
+        /**
+         * The data structure for the response data
+         */        
+        RSat::TPlayToneRspV1 iPlayToneRsp;
+
+        /**
+         * The response package for IPC
+         */        
+        RSat::TPlayToneRspV1Pckg iPlayToneRspPckg;
+
+    };
+
+#endif // CSATCPLAYTONEHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatInternalClient/inc/CSatCQueryHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,121 @@
+/*
+* 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:  This is the handler for various query requests related to
+*                those SIM Application Toolkit proactive commands that
+*                require user permissions to complete their actions.
+*
+*/
+
+
+
+#ifndef CSATCQUERYHANDLER_H
+#define CSATCQUERYHANDLER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <etelsat.h>
+#include "SatSTypes.h"
+
+// FORWARD DECLARATIONS
+class RSatUiSession;
+
+// CLASS DECLARATION
+
+/**
+ *  This is the active object handler for various end-user queries.
+ *
+ *  @lib SatClient.lib
+ *  @since Series 60 2.6
+ */
+class CSatCQueryHandler : public CActive
+    {
+    public: // Constructors and destructor
+
+        /**
+         * Two-phased constructor.
+         * @param aSat A pointer to a session (does not take ownership).
+         */
+        static CSatCQueryHandler* NewL( RSatUiSession* aSat );
+
+        /**
+         * Destructor.
+         */
+        virtual ~CSatCQueryHandler();
+
+    public: // New functions
+
+        /**
+         * Starts listening for the Sat command.
+         */
+        void Start();
+
+    protected:  // Functions from base classes
+
+        /**
+         * From CActive
+         *
+         * Handles the request completion.
+         */
+        void RunL();
+
+        /**
+         * From CActive
+         *
+         * Implements the cancel protocol.
+         */
+        void DoCancel();
+
+    private: // Constructors
+
+        /**
+         * C++ default constructor.
+         * @param aPriority The priority of this active object.
+         * @param aSat A pointer to a session (does not take ownership).
+         */
+        CSatCQueryHandler(
+            TInt aPriority,
+            RSatUiSession* aSat );
+
+    private: // Data
+
+        /**
+         * Reference to the Sat API
+         */
+        RSatUiSession* iSession;
+
+        /**
+         * The data structure for the command data
+         */        
+        TSatQueryV1 iQueryData;
+
+        /**
+         * The data package for IPC
+         */        
+        TSatQueryV1Pckg iQueryPckg;
+
+        /**
+         * The response data structure
+         */        
+        TSatQueryRspV1 iQueryRsp;
+
+        /**
+         * The response package for IPC
+         */        
+        TSatQueryRspV1Pckg iQueryRspPckg;
+
+    };
+
+#endif // CSATCQUERYHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatInternalClient/inc/CSatCSelectItemHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,136 @@
+/*
+* 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:  This is the handler for the SIM Application Toolkit
+*                Select Item proactive command.
+*
+*/
+
+
+
+#ifndef CSATCSELECTITEMHANDLER_H
+#define CSATCSELECTITEMHANDLER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <etelsat.h>
+
+// FORWARD DECLARATIONS
+class RSatUiSession;
+
+// CLASS DECLARATION
+
+/**
+ *  This is the Select Item command active object handler.
+ *  The class processes data from ETel SAT API and passes it on to
+ *  the client. The selection made by the end-user is passed back to ETel.
+ *
+ *  @lib SatClient.lib
+ *  @since Series 60 2.6
+ */
+class CSatCSelectItemHandler : public CActive
+    {
+    public: // Constructors and destructor
+
+        /**
+         * Two-phased constructor.
+         * @param aSat A pointer to a session (does not take ownership).
+         */
+        static CSatCSelectItemHandler* NewL( RSatUiSession* aSat );
+
+        /**
+         * Destructor.
+         */
+        virtual ~CSatCSelectItemHandler();
+
+    public: // New functions
+
+        /**
+         * Starts listening for the Sat command.
+         */
+        void Start();
+
+    protected:  // Functions from base classes
+
+        /**
+         * From CActive
+         *
+         * Handles the request completion.
+         */
+        void RunL();
+
+        /**
+         * From CActive
+         *
+         * Implements the cancel protocol.
+         */
+        void DoCancel();
+
+    private: // Constructors
+
+        /**
+         * C++ default constructor.
+         * @param aPriority The priority of this active object.
+         * @param aSat A pointer to a session (does not take ownership).
+         */
+        CSatCSelectItemHandler(
+            TInt aPriority,
+            RSatUiSession* aSat );
+
+    private: // New functions
+
+        /**
+         * Examine the client response.
+         * @param aResponse Client response data
+         * @param aSelection User selection
+         * @param aRequestedIconDisplayed Informs if icon is not used
+         * @param aDefaultItemIdFound informs if default item is found
+         * from item list
+         */
+        void ExamineClientResponse(
+            TSatUiResponse aResponse,
+            TUint8 aSelection,
+            TBool aRequestedIconDisplayed,
+            TBool aDefaultItemIdFound );
+
+    private: // Data
+
+        /**
+         * Reference to the Sat API
+         */        
+        RSatUiSession* iSession;
+
+        /**
+         * The data structure for the command data
+         */        
+        RSat::TSelectItemV2 iSelectItemData;
+
+        /**
+         * The data package for IPC
+         */        
+        RSat::TSelectItemV2Pckg iSelectItemPckg;
+
+        /**
+         * The data structure for the response data
+         */        
+        RSat::TSelectItemRspV1 iSelectItemRsp;
+ 
+        /**
+         * The response package for IPC
+         */        
+        RSat::TSelectItemRspV1Pckg iSelectItemRspPckg;
+    };
+
+#endif // CSATCSELECTITEMHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatInternalClient/inc/CSatCSetUpMenuHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,132 @@
+/*
+* 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:  This is the handler for the SIM Application Toolkit
+*                Set Up Menu proactive command.
+*
+*/
+
+
+
+#ifndef CSATCSETUPMENUHANDLER_H
+#define CSATCSETUPMENUHANDLER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <etelsat.h>
+
+// FORWARD DECLARATIONS
+class RSatUiSession;
+
+// CLASS DECLARATION
+
+/**
+ *  This is the Set Up Menu command active object handler.
+ *  The class processes data from ETel SAT API and passes it on to
+ *  the client. The selection made by the end-user is passed back to ETel.
+ *
+ *  @lib SatClient.lib
+ *  @since Series 60 2.6
+ */
+class CSatCSetUpMenuHandler : public CActive
+    {
+    public: // Constructors and destructor
+
+        /**
+         * Two-phased constructor.
+         * @param aSat A pointer to a session (does not take ownership).
+         */
+        static CSatCSetUpMenuHandler* NewL( RSatUiSession* aSat );
+
+        /**
+         * Destructor.
+         */
+        virtual ~CSatCSetUpMenuHandler();
+
+    public: // New functions
+
+        /**
+         * Starts listening for the Sat command.
+         */
+        void Start();
+
+        /**
+         * Returns a pointer to the object that implements old the command data
+         * object.
+         * @return The set up menu command handler object pointer.
+         */
+        RSat::TSetUpMenuV2 OldSetUpMenuData() const;
+
+    protected:  // Functions from base classes
+
+        /**
+         * From CActive
+         *
+         * Handles the request completion.
+         */
+        void RunL();
+
+        /**
+         * From CActive
+         *
+         * Implements the cancel protocol.
+         */
+        void DoCancel();
+
+    private: // Constructors
+
+        /**
+         * C++ default constructor.
+         * @param aPriority The priority of this active object.
+         * @param aSat A pointer to a session (does not take ownership).
+         */
+        CSatCSetUpMenuHandler( TInt aPriority, RSatUiSession* aSat );
+
+    private: // Data
+
+        /**
+         * Reference to the Sat API
+         */        
+        RSatUiSession* iSession;
+
+        /**
+         * The data structure for the command data
+         */
+        RSat::TSetUpMenuV2 iSetUpMenuData;
+
+        /**
+         * The data structure for old the command data
+         * Used for envelope menu selection
+         */        
+        RSat::TSetUpMenuV2 iOldSetUpMenuData;
+
+        /**
+         * The data package for IPC
+         */         
+        RSat::TSetUpMenuV2Pckg iSetUpMenuPckg;
+
+        /**
+         * The data structure for the response data
+         */         
+        RSat::TSetUpMenuRspV1 iSetUpMenuRsp;
+
+        /**
+         * The response package for IPC
+         */         
+        RSat::TSetUpMenuRspV1Pckg iSetUpMenuRspPckg;
+
+    };
+
+#endif // CSATCSETUPMENUHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatInternalClient/inc/MSatUiAdapter.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* 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:  The adapter interface for the Sat Client. Used by clients to
+*                send envelope commands to SIM applications.
+*
+*/
+
+
+
+#ifndef MSATUIADAPTER_H
+#define MSATUIADAPTER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <e32svr.h>
+
+// CLASS DECLARATION
+
+/**
+ *  An abstract adapter interface.
+ *  Use to send SAT envelope commands to the SIM.
+ *
+ *  @lib SatClient.lib
+ *  @since Series 60 2.0
+ */
+class MSatUiAdapter
+    {
+
+    public: // New functions
+
+        /**
+         * Response to the Set Up Menu command.
+         * @param aMenuItem The selected menu item.
+         * @param aHelpRequested Indicates whether help was requested.
+         */
+        virtual void MenuSelection(
+            TInt aMenuItem,
+            TBool aHelpRequested ) = 0;
+
+        virtual void SessionTerminated( TInt8 aType ) = 0;
+
+    };
+
+#endif // MSATUIADAPTER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatInternalClient/inc/MSatUiObserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,437 @@
+/*
+* 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:  The observer interface for the Sat Client. Register a
+*                concrete impl of this to receive SAT events from the session
+*                object.
+*
+*/
+
+
+#ifndef MSATUIOBSERVER_H
+#define MSATUIOBSERVER_H
+
+#include <e32base.h>
+#include <e32svr.h>
+#include <badesca.h>    // for descriptor arrays
+#include <etelsat.h>
+
+/**
+ * The UI response codes, enumerations values are from ETSI 11.14 specification.
+ */
+enum TSatUiResponse
+    {
+    ESatFailure = -1,                       // OOM or other error
+    ESatSuccess = 0x00,                     // success
+    ESatSuccessToneNotPlayed = 0x09,        // Warning and game tones are
+                                            // disabled from current profile
+    ESatSessionTerminatedByUser = 0x10,     // user exited the app
+    ESatBackwardModeRequestedByUser = 0x11, // user pressed back
+    ESatNoResponseFromUser = 0x12,          // no response from user
+    EHelpRequestedByUser = 0x13,            // help request from the UI
+    EPCmdNotAcceptedByUser = 0x22,
+    ESatCmdDataNotUnderstood = 0x32
+    };
+
+/**
+ * Tone values are dictated by ETSI 11.14.
+ * Use by the SAT Play Tone command.
+ */
+
+enum TSatTone
+    {
+    ESatToneNotSet                          = -1,
+    ESatDialTone                            = 0x01,
+    ESatCalledSubscriberBusy                = 0x02,
+    ESatCongestion                          = 0x03,
+    ESatRadioPathAcknowledge                = 0x04,
+    ESatRadioPathNotAvailableCallDropped    = 0x05,
+    ESatErrorSpecialInfo                    = 0x06,
+    ESatCallWaitingTone                     = 0x07,
+    ESatRingingTone                         = 0x08,
+    ESatGeneralBeep                         = 0x10,
+    ESatPositiveTone                        = 0x11,
+    ESatNegativeTone                        = 0x12,
+    ESatUserSelectedToneIncomingSpeech      = 0x13,
+    ESatUserSelectedToneIncomingSms         = 0x14
+    };
+
+enum TSatAlphaIdStatus
+    {
+    ESatAlphaIdNotNull,
+    ESatAlphaIdNull,
+    ESatAlphaIdNotProvided
+    };
+
+/**
+ * ControlResult can be used e.g. to supply
+ * Call Control / MO Short Message Control result
+ * from SIM to UI Client
+ */
+
+enum TSatControlResult
+    {
+    ESatAllowedNoModification,
+    ESatNotAllowed,
+    ESatAllowedWithModifications
+    };
+
+/**
+ * The SAT next action indicators, localized by the UI.
+ * Values commented out will not be used, with accordance to ETSI 11.14.
+ */
+
+enum TSatAction
+    {
+    //ESatNoAction = 0x00,
+    //ESatRefreshAction = 0x01,
+    //ESatMoreTimeAction = 0x02,
+    //ESatPollIntervalAction = 0x03,
+    //ESatPollingOffAction = 0x04,
+    //ESatSetUpEventListAction = 0x05,
+    ESatSetUpCallAction = 0x10,
+    ESatSendSsAction = 0x11,
+    ESatSendUssdAction = 0x12,
+    ESatSendSmAction = 0x13,
+    //ESatSendDtmfAction = 0x14,
+    ESatLaunchBrowserAction = 0x15,
+    ESatPlayToneAction = 0x20,
+    ESatDisplayTextAction = 0x21,
+    ESatGetInkeyAction = 0x22,
+    ESatGetInputAction = 0x23,
+    ESatSelectItemAction = 0x24,
+    ESatSetUpMenuAction = 0x25,
+    //ESatProvideLocalInformationAction = 0x26,
+    //ESatTimerManagementAction = 0x27,
+    ESatSetUpIdleModeTextAction = 0x28,
+    ESatPerformCardApduAction = 0x30,
+    ESatPowerOnCardAction = 0x31,
+    ESatPowerOffCardAction = 0x32,
+    ESatGetReaderStatusAction = 0x33,
+    //ESatRunAtCommandAction = 0x34,
+    ESatEndOfSimSession = 0x81
+    };
+
+/**
+ * The SAT input commands' data formats.
+ */
+enum TSatCharacterSet
+    {
+    ESatDigitOnly,
+    ESatCharSmsDefaultAlphabet,
+    ESatCharUcs2Alphabet,
+    ESatYesNo
+    };
+
+/**
+ * Dictates how the icons should be used.
+ */
+enum TSatIconQualifier
+    {
+    ESatIconQualifierNotSet,// Icon qualifier is not set
+    ESatENoIconId,          // Icon qualifier not present
+    ESatSelfExplanatory,    // Icon qualifier is self explanatory
+                            // (to display instead of the alpha id or text
+                            // string)
+    ESatNotSelfExplanatory  // Icon qualifier is not self explanatory
+                            // (to display along the alpha id or text string)
+    };
+
+/**
+ * Identifies the quering command
+ */
+enum TSatSQueryCommand
+    {
+    ESatSSendSmQuery,
+    ESatSSendSsQuery,
+    ESatSSendUssdQuery,
+    ESatSRefreshQuery,
+    ESatSLaunchBrowserQuery,
+    ESatOpenChannelQuery,
+    ESatSSetUpCallQuery
+    };
+
+/**
+ * Identifies the notification command
+ */
+enum TSatSNotifyCommand
+    {
+    ESatSSendDataNotify,
+    ESatSReceiveDataNotify,
+    ESatSCloseChannelNotify,
+    ESatSMoSmControlNotify,
+    ESatSCallControlNotify,
+    ESatSSendSsNotify,
+    ESatSSendUssdNotify,
+    ESatSSendDtmfNotify,
+    ESatSSendSmsNotify
+    };
+
+/**
+ * The icon id struct.
+ */
+struct TSatIconId
+    {
+    TUint8 iIdentifier;     // Identifies the EF_IMG in SIM.
+    TSatIconQualifier iIconQualifier;
+    };
+
+/**
+ * Specifies whether soft keys is the preferred selection mode or not.
+ */
+enum TSatSelectionPreference
+    {
+    ESatSelectionPreferenceNotSet,
+    ESatNoSelectionPreference,
+    ESatSoftKeyPreferred
+    };
+
+enum TSatBIPCommandIdentifier
+    {
+    ESendDataIdentier,
+    EReceiveDataIdentifier,
+    ECloseChannelIdentifier
+    };
+
+enum TSatSessionTerminationType
+    {
+    ESessionCancel,
+    EEndKeyUsed
+    };
+
+// Codes for event notifications.
+enum TSatSEvent
+    {
+    ESatSRefreshStartEvent,
+    ESatSRefreshEndEvent,
+    ESatSSmEndEvent,
+    ESatSClearScreenEvent,
+    ESatSCloseSatUiAppEvent,
+    ESatSsEndEvent,
+    ESatSsErrorEvent,
+    ESatSDtmfEndEvent
+    };
+
+enum TSatSEventStatus
+    {
+    ESatEventNone,
+    ESatEventCompleteOk,
+    ESatEventFailure,
+    ESatEventCancel
+    };
+
+/**
+ *  An abstract observer interface.
+ *  Register to receive SAT events from the session object.
+ *
+ *  @lib SatClient.lib
+ *  @since Series 60 2.0
+ */
+class MSatUiObserver
+    {
+    public: // New functions
+
+        /**
+         * Notification of the SAT Display Text command.
+         * @param aText The text string to be displayed.
+         * @param aSimApplicationName  Sim Application name
+         * @param aIconId The id of icon.
+         * @param aRequestedIconDisplayed Informs if icon is not used.
+         * @param aSustainedText Indicates is this text sustained ie. no timers
+         *        used if ETrue.
+         * @param aDuration Duration for showing the text
+         * @param aWaitUserToClear Indication if user is needed to clear
+         *        message
+         * @return The response of the UI to this command.
+         */
+        virtual TSatUiResponse DisplayTextL(
+            const TDesC& aText,
+            const TDesC& aSimApplicationName,
+            const TSatIconId& aIconId,
+            TBool& aRequestedIconDisplayed,
+            const TBool aSustainedText,
+            const TTimeIntervalSeconds aDuration,
+            const TBool aWaitUserToClear ) = 0;
+
+        /**
+         * Notification of the SAT Get Inkey command.
+         * @param aText The query text.
+         * @param aCharacterSet The character range allowed.
+         * @param aInput The input character.
+         * @param aHelpIsAvailable indicates if help can be requested.
+         * @param aIconId The id of icon.
+         * @param aRequestedIconDisplayed Informs if icon is not used.
+         * @param aDuration Duration for showing the dialog.
+         * @param aImmediateDigitResponse Indication if Immediate digit response
+         *        is needed.
+         * @return The response of the UI to this command.
+         */
+        virtual TSatUiResponse GetInkeyL(
+            const TDesC& aText,
+            const TSatCharacterSet aCharacterSet,
+            TChar& aInput,
+            const TBool aHelpIsAvailable,
+            const TSatIconId& aIconId,
+            TBool& aRequestedIconDisplayed,
+            TUint& aDuration,
+            const TBool aImmediateDigitResponse ) = 0;
+
+        /**
+         * Notification of the SAT Get Input command.
+         * @param aText The query text.
+         * @param aCharacterSet The character range allowed.
+         * @param aInput The input string.
+         * @param aMaxLength The maximum length of the input allowed.
+         * @param aMinLength The minimum length of the input allowed.
+         * @param aHideInput A flag indicating if the input should be hidden.
+         * @param aHelpIsAvailable indicates if help can be requested.
+         * @param aIconId The id of icon.
+         * @param aRequestedIconDisplayed Informs if icon is not used.
+         * @return The response of the UI to this command.
+         */
+        virtual TSatUiResponse GetInputL(
+            const TDesC& aText,
+            const TSatCharacterSet aCharacterSet,
+            TDes& aInput,
+            const TInt aMinLength,
+            const TInt aMaxLength,
+            const TBool aHideInput,
+            const TBool aHelpIsAvailable,
+            const TSatIconId& aIconId,
+            TBool& aRequestedIconDisplayed ) = 0;
+
+        /**
+         * Notification of the SAT Set Up Menu command.
+         * @param aText The query text.
+         * @param aMenuItems The array of menu item captions.
+         * @param aMenuItemNextActions The array of menu item next action
+         * indicator captions.
+         * @param aHelpIsAvailable indicates if help can be requested.
+         * @param aIconId The id of icon.
+         * @param aMenuIcons List of icon identifiers for menu items.
+         * @param aIconListQualifier Indicates how to use icons in the icon
+         * list.
+         * @param aSelectionPreference Specifies is the soft keys preferred.
+         * @return The response of the UI to this command.
+         */
+        virtual TSatUiResponse SetUpMenuL(
+            const TDesC& aText,
+            const MDesCArray& aMenuItems,
+            const CArrayFixFlat<TSatAction>* aMenuItemNextActions,
+            const TBool aHelpIsAvailable,
+            const TSatIconId& aIconId,
+            const CArrayFixFlat<TInt>* aMenuIcons,
+            const enum TSatIconQualifier aIconListQualifier,
+            const enum TSatSelectionPreference aSelectionPreference ) = 0;
+
+        /**
+         * Notification of the SAT Select Item command.
+         * @param aText The query text.
+         * @param aMenuItems The array of menu item captions.
+         * @param aMenuItemNextActions The array of menu item next action
+         * indicator codes.
+         * @param aDefaultItem The item selected by default.
+         * @param aSelection The item index selected by the user.
+         * @param aHelpIsAvailable indicates if help can be requested.
+         * @param aIconId The id of title icon.
+         * @param aMenuIcons List of icon identifiers for menu items.
+         * @param aIconListQualifier Indicates how to use icons in the icon
+         * list.
+         * @param aRequestedIconDisplayed Informs if icon is not used.
+         * @param aSelectionPreference Specifies is the soft keys preferred.
+         * @return The response of the UI to this command.
+         */
+        virtual TSatUiResponse SelectItemL(
+            const TDesC& aText,
+            const MDesCArray& aMenuItems,
+            const CArrayFixFlat<TSatAction>* aMenuItemNextActions,
+            const TInt aDefaultItem, TUint8& aSelection,
+            const TBool aHelpIsAvailable,
+            const TSatIconId& aIconId,
+            const CArrayFixFlat<TInt>* aMenuIcons,
+            const enum TSatIconQualifier aIconListQualifier,
+            TBool& aRequestedIconDisplayed,
+            const enum TSatSelectionPreference aSelectionPreference ) = 0;
+
+        /**
+         * Notification of the SAT Play Tone command.
+         * @param aText The text to be displayed.
+         * @param aTone The tone to be played.
+         * @param aDuration The duration of the tone to be played.
+         * @param aIconId The id of icon.
+         * @param aRequestedIconDisplayed Informs if icon is not used.
+         * @return The response of the UI to this command.
+         */
+        virtual TSatUiResponse PlayTone(
+            const TDesC& aText,
+            const TSatTone aTone,
+            const TTimeIntervalMicroSeconds aDuration,
+            const TSatIconId& aIconId,
+            TBool& aRequestedIconDisplayed ) = 0;
+
+
+        /**
+         * General confirmation request
+         * @param aCommandId ID of the quering command
+         * @param aAlphaIdStatus Alpha Identifier status
+         * @param aText The text to be displayed.
+         * @param aAdditionalText Additional text to be used in queries.
+         * @param aActionAccepted Indicates whether the command was accepted.
+         * @param aIconId The id of icon.
+         * @param aRequestedIconDisplayed Informs if icon is not used.
+         * @param aTerminatedByUser Informs if end key is used.
+         */
+        virtual void ConfirmCommand(
+            const TSatSQueryCommand aCommandId,
+            const TSatAlphaIdStatus aAlphaIdStatus,
+            const TDesC& aText,
+            const TDesC& aAdditionalText,
+            TBool& aActionAccepted,
+            const TSatIconId& aIconId,
+            TBool& aRequestedIconDisplayed,
+            TBool& aTerminatedByUser ) = 0;
+
+        /**
+         * General notification
+         * @param aCommandId ID of the notifying command
+         * @param aAlphaIdStatus Alpha Identifier status
+         * @param aText Alpha Identifier
+         * @param aIconId The id of icon.
+         * @param aRequestedIconDisplayed Informs if icon is not used.
+         * @param aControlResult Control result of the MoSm and CallControl
+         * @return The response of the UI to this command.
+         */
+        virtual TSatUiResponse Notification(
+            const TSatSNotifyCommand aCommandId,
+            const TSatAlphaIdStatus aAlphaIdStatus,
+            const TDesC& aText,
+            const TSatIconId& aIconId,
+            TBool& aRequestedIconDisplayed,
+            const TSatControlResult aControlResult ) = 0;
+
+        /**
+         * General event notification. Used for example to tell UI that command
+         * has completed its execution.
+         * @param aEventId, identifies the event
+         * @param aEventStatus, status of the event, used as additional info for
+         *        the event
+         * @param aError, possible error code that may affect on event handling.
+         *        This is also used as additional info
+         */
+        virtual void EventNotification(
+            const TSatSEvent aEventId,
+            const TSatSEventStatus aEventStatus,
+            const TInt aError ) = 0;
+    };
+
+#endif // MSATUIOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatInternalClient/inc/RSatUiSession.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,182 @@
+/*
+* 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:  The UI Client API of the SAT Server.
+*
+*/
+
+
+
+#ifndef RSATUISESSION_H
+#define RSATUISESSION_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+
+// The name of the SatClient module for panic purposes
+_LIT( KSatCliName, "SatClient" );
+
+// DATA TYPES
+
+// The Sat Client Panic codes
+enum TSatClientPanic
+    {
+    ESatInvalidResponse,
+    ESatSetUpMenuFailure,
+    ESelectedItemOutOfRange
+    };
+
+// FORWARD DECLARATIONS
+
+class MSatUiObserver;
+class MSatUiAdapter;
+class CSatCCommandProcessor;
+class CSatCDisplayTextHandler;
+class RSatSession;
+
+// CLASS DECLARATION
+
+/**
+ *  UI sub-session to SatServer.
+ *  Use this to register your event observer object.
+ *
+ *  @lib SatClient.lib
+ *  @since Series 60 2.0
+ */
+
+class RSatUiSession : public RSubSessionBase
+    {
+    public: // Constructors and destructor
+
+        /**
+         * C++ default constructor.
+         */
+        IMPORT_C RSatUiSession();
+
+    public: // New functions
+
+        /**
+         * Registers the listener object for SAT events and connects to
+         * the Sat Server.
+         * @param aSat
+         * @param aObserver The observer.
+         */
+        IMPORT_C void RegisterL(
+            const RSatSession& aSatSession,
+            MSatUiObserver* aObserver );
+
+        /**
+         * Returns a pointer to the object that implements the UI
+         * adapter interface.
+         * @return The adapter object pointer.
+         */
+        IMPORT_C MSatUiAdapter* Adapter() const;
+
+        /**
+         * Unregisters the listener object and disconnects from the server.
+         */
+        void Unregister();
+
+        /**
+         * The client API version
+         * @return The version of the current API.
+         */
+        IMPORT_C TVersion Version() const;
+
+        /**
+         * Panics the client application
+         * @param aReason The reason code.
+         */
+        IMPORT_C void Panic( TSatClientPanic aReason ) const;
+
+        /**
+         * Shuts down the server. Active in development use only.
+         */
+        IMPORT_C void KillServer() const;
+
+        /**
+        * Create and send service request message to SAT server.
+        * @param aFunction Service request id.
+        * @param aArgs Service request arguments.
+        * @param aStatus Service request status.
+        */
+        IMPORT_C void CreateRequest(
+            TInt aFunction,
+            const TIpcArgs& aArgs,
+            TRequestStatus& aStatus ) const;
+
+        /**
+         * Create and send service request message to SAT server.
+         * @param aFunction Service request id.
+         * @param aArgs Service request arguments.
+         */
+        IMPORT_C void CreateRequest(
+            TInt aFunction,
+            const TIpcArgs& aArgs ) const;
+
+        /**
+        * Returns a pointer to the object that implements client observer
+        * object that receives SAT commands
+        * @return The client observer object pointer.
+        */
+        IMPORT_C MSatUiObserver* SatUiObserver();
+
+        /**
+         * Returns a pointer to the object that implements Processor agent for
+         * SAT commands.
+         * @return The command processor object pointer.
+         */
+        CSatCCommandProcessor* CommandProcessor();
+
+    public: // Functions from base classes
+
+        /**
+         * From RHandleBase
+         *
+         * Close the handle.
+         */
+        IMPORT_C void Close();
+
+    private:
+
+        // Prohibited copy constructor.
+        RSatUiSession( const RSatUiSession& );
+
+        // Prohibited assigment operator.
+        RSatUiSession& operator= ( const RSatUiSession& );
+
+        /**
+        * Checks if the server is started.
+        * @return Interger value, is server started or not.
+        */
+        TBool IsServerStarted() const;
+
+    private: // Data
+
+        /**
+         * Processor agent for SAT commands
+         */
+        CSatCCommandProcessor* iCommandProcessor;
+
+        /**
+         * The client observer object that receives SAT commands.
+         */        
+        MSatUiObserver* iSatUiObserver;
+
+    };
+
+#endif // RSATUISESSION_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatInternalClient/src/CSatCActiveCommandHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,162 @@
+/*
+* 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:  This is the handler for the SIM Application Toolkit
+*                active commands.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    <e32svr.h>
+#include    "RSatUiSession.h"
+#include    "MSatUiAdapter.h"
+#include    "CSatCActiveCommandHandler.h"
+#include    "CSatCCommandProcessor.h"
+#include    "SatSOpcodes.h"
+#include    "SatLog.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSatCActiveCommandHandler::CSatCActiveCommandHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatCActiveCommandHandler::CSatCActiveCommandHandler(
+    RSatUiSession* aSession ) :
+    iSession( aSession ),
+    iMenuSelectionData(),
+    iMenuSelectionPckg( iMenuSelectionData )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCActiveCommandHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatCActiveCommandHandler* CSatCActiveCommandHandler::NewL(
+    RSatUiSession* aSat )
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCActiveCommandHandler::NewL calling" )
+
+    // Perform construction
+    CSatCActiveCommandHandler* self =
+        new ( ELeave ) CSatCActiveCommandHandler( aSat );
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCActiveCommandHandler::NewL exiting" )
+    return self;
+    }
+
+// Destructor
+CSatCActiveCommandHandler::~CSatCActiveCommandHandler()
+    {
+    LOG( SIMPLE, 
+    "SATINTERNALCLIENT: CSatCActiveCommandHandler::~CSatCActiveCommandHandler calling" )
+    iSession = NULL;
+    LOG( SIMPLE, 
+    "SATINTERNALCLIENT: CSatCActiveCommandHandler::~CSatCActiveCommandHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCActiveCommandHandler::MenuSelection
+// Sends the Menu Selection Active command
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatCActiveCommandHandler::MenuSelection(
+    TInt aMenuItem,
+    TBool aHelpRequested )
+    {
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCActiveCommandHandler::MenuSelection calling" )
+
+    // Empty the IPC data
+    RSat::TMenuSelectionV1 menuSelection;
+    iMenuSelectionData = menuSelection;
+
+    // Map the index into correct item ID.
+    RSat::TItem item;
+    iSession->CommandProcessor()->SetUpMenuHandler()->
+        OldSetUpMenuData().GetItem( static_cast<TUint>( aMenuItem + 1 ), item );
+
+    // Set the item ID of the selected item.
+    iMenuSelectionData.iItemId = item.iItemId;
+
+    // Set the help request identifier.
+    iMenuSelectionData.iHelp = RSat::EHelpNotRequested;
+    if ( aHelpRequested )
+        {
+        LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCActiveCommandHandler::MenuSelection aHelpRequested" )
+        iMenuSelectionData.iHelp = RSat::EHelpRequested;
+        }
+
+    // Perform a synchronous service request.
+    TIpcArgs arguments( &iMenuSelectionPckg );
+    iSession->CreateRequest( ESatSActiveMenuSelection, arguments );
+
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCActiveCommandHandler::MenuSelection exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCActiveCommandHandler::SessionTerminated
+// Sends the Session Terminated Active command
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatCActiveCommandHandler::SessionTerminated( TInt8 aType )
+    {
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCActiveCommandHandler::SessionTerminated calling" )
+    TSatTermination termination;
+    //lint -e{603} termination used through terminationPckg.
+    TSatTerminationPckg terminationPckg ( termination );
+
+    switch ( aType )
+        {
+        case ESessionCancel:
+            {
+            termination.type = ETerminatedByCancel;
+            TIpcArgs arguments( &terminationPckg );
+            iSession->CreateRequest( ESatSSessionTerminated, arguments );
+            LOG( SIMPLE, "SATINTERNALCLIENT:   Terminated by cancel" )
+            break;
+            }
+
+        case EEndKeyUsed:
+            {
+            termination.type = ETerminatedByEndKey;
+            TIpcArgs arguments( &terminationPckg );
+            iSession->CreateRequest( ESatSSessionTerminated, arguments );
+            LOG( SIMPLE, "SATINTERNALCLIENT:   Terminated by end key" )
+            break;
+            }
+
+        default:
+            {
+            LOG( SIMPLE, "SATINTERNALCLIENT:   Not terminated" )
+            break;
+            }
+        }
+
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCActiveCommandHandler::SessionTerminated exiting" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatInternalClient/src/CSatCCommandProcessor.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,161 @@
+/*
+* 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:  This file contains the client command processor class
+*                that is  responsible for the active objects needed to
+*                maintain that connection.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32svr.h>
+#include    "CSatCCommandProcessor.h"
+#include    "SatLog.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSatCCommandProcessor::CSatCCommandProcessor
+// C++ default constructor cannot contain any code that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatCCommandProcessor::CSatCCommandProcessor(
+    RSatUiSession* aSession ) :
+    iSession( aSession )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCCommandProcessor::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSatCCommandProcessor::ConstructL()
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCCommandProcessor::ConstructL calling" )
+
+    // All the command handlers are constructed here.
+    iDisplayTextHandler = CSatCDisplayTextHandler::NewL( iSession );
+    iGetInkeyHandler = CSatCGetInkeyHandler::NewL( iSession );
+    iGetInputHandler = CSatCGetInputHandler::NewL( iSession );
+    iSetUpMenuHandler = CSatCSetUpMenuHandler::NewL( iSession );
+    iSelectItemHandler = CSatCSelectItemHandler::NewL( iSession );
+    iPlayToneHandler = CSatCPlayToneHandler::NewL( iSession );
+    iActiveCommandHandler = CSatCActiveCommandHandler::NewL( iSession );
+    iEventHandler = CSatCEventHandler::NewL( iSession );
+    iQueryHandler = CSatCQueryHandler::NewL( iSession );
+    iNotifyHandler = CSatCNotifyHandler::NewL( iSession );
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCCommandProcessor::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCCommandProcessor::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatCCommandProcessor* CSatCCommandProcessor::NewL(
+    RSatUiSession* aSession )
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCCommandProcessor::NewL calling" )
+
+    // Perform two-phase construction.
+    CSatCCommandProcessor* self =
+        new ( ELeave ) CSatCCommandProcessor( aSession );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCCommandProcessor::NewL exiting" )
+    return self;
+    }
+
+// Destructor
+CSatCCommandProcessor::~CSatCCommandProcessor()
+    {
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCCommandProcessor::~CSatCCommandProcessor calling" )
+
+    // All the event handlers are deleted here.
+    delete iDisplayTextHandler;
+    delete iGetInkeyHandler;
+    delete iGetInputHandler;
+    delete iSetUpMenuHandler;
+    delete iSelectItemHandler;
+    delete iPlayToneHandler;
+    delete iActiveCommandHandler;
+    delete iEventHandler;
+    delete iQueryHandler;
+    delete iNotifyHandler;
+
+    iSession = NULL;
+
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCCommandProcessor::~CSatCCommandProcessor exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCCommandProcessor::Start
+// Starts the active objects
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatCCommandProcessor::Start()
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCCommandProcessor::Start calling" )
+
+    // Start all the event handlers
+    iDisplayTextHandler->Start();
+    iGetInkeyHandler->Start();
+    iGetInputHandler->Start();
+    iSetUpMenuHandler->Start();
+    iSelectItemHandler->Start();
+    iPlayToneHandler->Start();
+    iQueryHandler->Start();
+    iNotifyHandler->Start();
+    iEventHandler->Start();
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCCommandProcessor::Start exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCCommandProcessor::SetUpMenuHandler
+// Returns a pointer to a Set Up menu command handler object.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CSatCSetUpMenuHandler* CSatCCommandProcessor::SetUpMenuHandler()
+    {
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCCommandProcessor::SetUpMenuHandler calling-exiting" )
+    return iSetUpMenuHandler;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCCommandProcessor::ActiveCommandHandler
+// Returns a pointer to a active command handler object.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CSatCActiveCommandHandler* CSatCCommandProcessor::ActiveCommandHandler()
+    {
+    LOG( SIMPLE,
+    "SATINTERNALCLIENT: CSatCCommandProcessor::ActiveCommandHandler calling-exiting" )
+    return iActiveCommandHandler;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatInternalClient/src/CSatCDisplayTextHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,284 @@
+/*
+* 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:  This is the handler for the SIM Application Toolkit
+*                Display Text proactive command.
+*
+*/
+
+
+#include    <e32svr.h>
+#include    "RSatUiSession.h"
+#include    "MSatUiObserver.h"
+#include    "CSatCDisplayTextHandler.h"
+#include    "SatSOpcodes.h"
+#include    "SatLog.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// CSatCDisplayTextHandler::CSatCDisplayTextHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatCDisplayTextHandler::CSatCDisplayTextHandler(
+    TInt aPriority,
+    RSatUiSession* aSession ) :
+    CActive( aPriority ), iSession( aSession ),
+    iDisplayTextData(),
+    iDisplayTextPckg( iDisplayTextData ),
+    iDisplayTextRsp(),
+    iDisplayTextRspPckg( iDisplayTextRsp )
+    {
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCDisplayTextHandler::CSatCDisplayTextHandler calling" )
+
+    CActiveScheduler::Add( this ); // add to active scheduler
+
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCDisplayTextHandler::CSatCDisplayTextHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCDisplayTextHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatCDisplayTextHandler* CSatCDisplayTextHandler::NewL(
+    RSatUiSession* aSat )
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCDisplayTextHandler::NewL calling" )
+
+    // Perform construction.
+    CSatCDisplayTextHandler* self =
+        new ( ELeave ) CSatCDisplayTextHandler( EPriorityLow, aSat );
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCDisplayTextHandler::NewL exiting" )
+    return self;
+    }
+
+// Destructor
+CSatCDisplayTextHandler::~CSatCDisplayTextHandler()
+    {
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCDisplayTextHandler::~CSatCDisplayTextHandler calling" )
+
+    // Cancel any outstanding requests.
+    Cancel();
+    iSession = NULL;
+
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCDisplayTextHandler::~CSatCDisplayTextHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCDisplayTextHandler::Start
+// Starts the handler.
+// -----------------------------------------------------------------------------
+//
+void CSatCDisplayTextHandler::Start()
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCDisplayTextHandler::Start calling" )
+
+    // Empty the IPC data
+    TSatDisplayTextV1 temp;
+    iDisplayTextData = temp;
+    RSat::TDisplayTextRspV1 temp2;
+    iDisplayTextRsp = temp2;
+
+    // Request Display Text notifications.
+    TIpcArgs arguments( &iDisplayTextPckg );
+
+    // Pass the Display Text IPC package
+    iSession->CreateRequest( ESatSProactiveDisplayText, arguments, iStatus );
+
+    // Set this handler to active so that it can receive requests.
+    SetActive();
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCDisplayTextHandler::Start exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCDisplayTextHandler::RunL
+// Handles the command.
+// -----------------------------------------------------------------------------
+//
+void CSatCDisplayTextHandler::RunL()
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCDisplayTextHandler::RunL calling" )
+
+    // Check the status of the asnychronous operation
+    if ( KErrNone != iStatus.Int() )
+        {
+        LOG2(
+            SIMPLE,
+            "SATINTERNALCLIENT: CSatCDisplayTextHandler::RunL exiting, error: %d",
+            iStatus.Int() )
+
+        // Renew the request
+        Start();
+        }
+    else
+        {
+        // Has to be casted to TInt before casting to TSatIconQualifier, because
+        // gcc warns about the direct cast.
+        const struct TSatIconId iconId = { iDisplayTextData.iIconId.iIdentifier,
+            static_cast<TSatIconQualifier>(
+                static_cast<TInt>( iDisplayTextData.iIconId.iQualifier ) ) };
+
+        // This will contain EFalse if requested icon is not displayed.
+        TBool requestedIconDisplayed( ETrue );
+
+        // Indicator if user is expected to clear the message
+        TBool waitUserToClear( ETrue );
+
+        if ( RSat::EClearAfterDelay == iDisplayTextData.iClearScreen )
+            {
+            LOG( SIMPLE, 
+            "SATINTERNALCLIENT: CSatCDisplayTextHandler::RunL EClearAfterDelay" )
+            waitUserToClear = EFalse;
+            }
+
+        // Notify the registered client and save the response.
+        TSatUiResponse response;
+        response = iSession->SatUiObserver()->DisplayTextL(
+            iDisplayTextData.iText,
+            iDisplayTextData.iSimApplicationName,
+            iconId,
+            requestedIconDisplayed,
+            iDisplayTextData.iSustainedText,
+            iDisplayTextData.iDuration,
+            waitUserToClear );
+
+        // This command never has any additional information.
+        iDisplayTextRsp.iInfoType = RSat::KNoAdditionalInfo;
+        iDisplayTextRsp.iAdditionalInfo.Zero();
+
+        iDisplayTextRsp.SetPCmdNumber( iDisplayTextData.iPCmdNumber );
+
+        // Examine the client response.
+        ExamineClientResponse(
+            response, requestedIconDisplayed );
+
+        // Pass the Display Text response IPC package.
+        TIpcArgs arguments( &iDisplayTextRspPckg );
+
+        // Perform the IPC data transfer.
+        iSession->CreateRequest( ESatSProactiveDisplayTextResponse, arguments );
+
+        // Renew the service request.
+        Start();        
+        }
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCDisplayTextHandler::RunL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCDisplayTextHandler::ExamineClientResponse
+// Examine the client response.
+// -----------------------------------------------------------------------------
+//
+void CSatCDisplayTextHandler::ExamineClientResponse(
+    TSatUiResponse aResponse,
+    TBool aRequestedIconDisplayed )
+    {
+    LOG2( SIMPLE,
+    "SATINTERNALCLIENT: CSatCDisplayTextHandler::ExamineClientResponse calling,\
+    aResponse: %x", aResponse )
+
+    switch ( aResponse )
+        {
+        case ESatSuccess:
+            {
+            // Convert terminal rsp if icon used
+            RSat::TPCmdResult result( RSat::KSuccess );
+            RSat::TIconQualifier iconQualifier(
+                    iDisplayTextData.iIconId.iQualifier );
+
+            if ( !aRequestedIconDisplayed )
+                {
+                LOG( SIMPLE,
+                "SATINTERNALCLIENT: CSatCDisplayTextHandler::ExamineClientResponse \
+                aRequestedIconDisplayed false" )
+                if ( iconQualifier == RSat::ESelfExplanatory ||
+                     iconQualifier == RSat::ENotSelfExplanatory )
+                    {
+                    LOG( SIMPLE,
+                    "SATINTERNALCLIENT: CSatCDisplayTextHandler::ExamineClientResponse \
+                    IconNotDisplayed" )
+                    result = RSat::KSuccessRequestedIconNotDisplayed;
+                    }
+                }
+
+            iDisplayTextRsp.iGeneralResult = result;
+            break;
+            }
+
+        case ESatFailure:
+            {
+            iDisplayTextRsp.iInfoType = RSat::KMeProblem;
+            iDisplayTextRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+            iDisplayTextRsp.iAdditionalInfo.SetLength( 1 );
+            iDisplayTextRsp.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
+            break;
+            }
+
+        case ESatSessionTerminatedByUser:
+            {
+            iDisplayTextRsp.iGeneralResult = RSat::KPSessionTerminatedByUser;
+            break;
+            }
+
+        case ESatBackwardModeRequestedByUser:
+            {
+            iDisplayTextRsp.iGeneralResult =
+                RSat::KBackwardModeRequestedByUser;
+            break;
+            }
+
+        case ESatNoResponseFromUser:
+            {
+            iDisplayTextRsp.iGeneralResult = RSat::KNoResponseFromUser;
+            break;
+            }
+
+        // No help is ever supplied with this command
+        case EHelpRequestedByUser:
+        case EPCmdNotAcceptedByUser:
+        case ESatCmdDataNotUnderstood:
+        default:
+            {
+            iSession->Panic( ESatInvalidResponse );
+            break;
+            }
+        }
+
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCDisplayTextHandler::ExamineClientResponse exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCDisplayTextHandler::DoCancel
+// Cancels the pending request.
+// -----------------------------------------------------------------------------
+//
+void CSatCDisplayTextHandler::DoCancel()
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCDisplayTextHandler::DoCancel calling" )
+
+    // Complete the request with cancel code.
+    TRequestStatus* requestStatus = &iStatus;
+    User::RequestComplete( requestStatus, KErrCancel );
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCDisplayTextHandler::DoCancel exiting" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatInternalClient/src/CSatCEventHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,174 @@
+/*
+* 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:  This is the handler for various events related to
+*                those SIM Application Toolkit proactive commands that
+*                simply indicate that an action occured at the server.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32svr.h>
+#include    <basched.h>
+#include    "RSatUiSession.h"
+#include    "MSatUiObserver.h"
+#include    "CSatCEventHandler.h"
+#include    "SatSOpcodes.h"
+#include    "SatSTypes.h"
+#include    "SatLog.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSatCEventHandler::CSatCEventHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+//lint -e{1769, 1403} Can not be initialized.
+CSatCEventHandler::CSatCEventHandler(
+    TInt aPriority,
+    RSatUiSession* aSession ) :
+    CActive( aPriority ),
+    iSession( aSession ),
+    iEventData(),
+    iEventPckg( iEventData )
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCEventHandler::CSatCEventHandler calling" )
+
+    // Add to active scheduler.
+    CActiveScheduler::Add( this );
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCEventHandler::CSatCEventHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCEventHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatCEventHandler* CSatCEventHandler::NewL(
+    RSatUiSession* aSat )
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCEventHandler::NewL calling" )
+
+    // Perform construction.
+    CSatCEventHandler* self =
+        new ( ELeave ) CSatCEventHandler( EPriorityLow, aSat );
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCEventHandler::NewL exiting" )
+    return self;
+    }
+
+// Destructor
+CSatCEventHandler::~CSatCEventHandler()
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCEventHandler::~CSatCEventHandler calling" )
+
+    // Cancel any outstanding requests.
+    Cancel();
+    iSession = NULL;
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCEventHandler::~CSatCEventHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCEventHandler::Start
+// Starts the handler.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatCEventHandler::Start()
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCEventHandler::Start calling" )
+
+    // Request notifications about various server-side events.
+    TIpcArgs arguments( &iEventPckg );
+    iSession->CreateRequest( ESatSProactiveEvent, arguments, iStatus );
+
+    // Set this handler to active so that it can receive requests.
+    SetActive();
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCEventHandler::Start exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCEventHandler::RunL
+// Handles the command.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatCEventHandler::RunL()
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCEventHandler::RunL calling" )
+
+    // Check the status of the asnychronous operation
+    if ( KErrNone != iStatus.Int() )
+        {
+        LOG2(
+            SIMPLE,
+            "SATINTERNALCLIENT: CSatCEventHandler::RunL exiting, error: %d",
+            iStatus.Int() )
+
+        // Renew the request
+        Start();
+
+        return;
+        }
+
+    // Send event to UI
+    iSession->SatUiObserver()->EventNotification( 
+        iEventData.iEvent,
+        iEventData.iStatus,
+        iEventData.iError );
+        
+    if ( ESatSCloseSatUiAppEvent == iEventData.iEvent )
+        {
+        LOG( SIMPLE, "SATINTERNALCLIENT: CSatCEventHandler::RunL close ui" )
+        // Close UI
+        CBaActiveScheduler::Exit();
+        }
+
+
+    // Pass the Event response IPC package.
+    TIpcArgs arguments( &iEventPckg );
+
+    // Perform the IPC data transfer.
+    iSession->CreateRequest( ESatSProactiveEventResponse, arguments );
+
+    // Renew the service request.
+    Start();
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCEventHandler::RunL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCEventHandler::DoCancel
+// Cancels the pending request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatCEventHandler::DoCancel()
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCEventHandler::DoCancel calling" )
+
+    // Complete the request with cancel code.
+    TRequestStatus* requestStatus = &iStatus;
+    User::RequestComplete( requestStatus, KErrCancel );
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCEventHandler::DoCancel exiting" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatInternalClient/src/CSatCGetInkeyHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,503 @@
+/*
+* 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:  This is the handler for the SIM Application Toolkit
+*                Get Inkey proactive command.
+*
+*/
+
+
+#include    <e32svr.h>
+#include    "RSatUiSession.h"
+#include    "MSatUiObserver.h"
+#include    "CSatCGetInkeyHandler.h"
+#include    "SatSOpcodes.h"
+#include    "SatLog.h"
+
+const TInt KTenthOfSecondsInMinute( 600 );
+const TInt8 KSecond( 10 );
+const TUint8 KHalfSecond( 5 );
+const TInt KHalfMinute( 300 );
+const TUint8 KByteMax( 255 );
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// CSatCGetInkeyHandler::CSatCGetInkeyHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatCGetInkeyHandler::CSatCGetInkeyHandler(
+    TInt aPriority,
+    RSatUiSession* aSession ) :
+    CActive( aPriority ),
+    iSession( aSession ),
+    iGetInkeyData(),
+    iGetInkeyPckg( iGetInkeyData ),
+    iGetInkeyRsp(),
+    iGetInkeyRspPckg( iGetInkeyRsp )
+    {
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCGetInkeyHandler::CSatCGetInkeyHandler calling" )
+
+    // Add to active scheduler.
+    CActiveScheduler::Add( this );
+
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCGetInkeyHandler::CSatCGetInkeyHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCGetInkeyHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatCGetInkeyHandler* CSatCGetInkeyHandler::NewL(
+    RSatUiSession* aSat )
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCGetInkeyHandler::NewL calling" )
+
+    // Perform construction.
+    CSatCGetInkeyHandler* self =
+        new ( ELeave ) CSatCGetInkeyHandler( EPriorityLow, aSat );
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCGetInkeyHandler::NewL exiting" )
+    return self;
+    }
+
+// Destructor
+CSatCGetInkeyHandler::~CSatCGetInkeyHandler()
+    {
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCGetInkeyHandler::~CSatCGetInkeyHandler calling" )
+
+    // Cancel any outstanding requests.
+    Cancel();
+    iSession = NULL;
+
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCGetInkeyHandler::~CSatCGetInkeyHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCGetInkeyHandler::Start
+// Starts the handler.
+// -----------------------------------------------------------------------------
+//
+void CSatCGetInkeyHandler::Start()
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCGetInkeyHandler::Start calling" )
+
+    // Empty the IPC data
+    RSat::TGetInkeyV2 temp;
+    iGetInkeyData = temp;
+    RSat::TGetInkeyRspV2 temp2;
+    iGetInkeyRsp = temp2;
+
+    // Request Get Inkey notifications.
+    TIpcArgs arguments( &iGetInkeyPckg );
+
+    // Pass the Get Inkey IPC package.
+    iSession->CreateRequest( ESatSProactiveGetInkey, arguments, iStatus );
+
+    // Set this handler to active so that it can receive requests.
+    SetActive();
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCGetInkeyHandler::Start exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCGetInkeyHandler::RunL
+// Handles the command.
+// -----------------------------------------------------------------------------
+//
+void CSatCGetInkeyHandler::RunL()
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCGetInkeyHandler::RunL calling" )
+
+    // Check the status of the asnychronous operation
+    if ( KErrNone != iStatus.Int() )
+        {
+        LOG2(
+            SIMPLE,
+            "SATINTERNALCLIENT: CSatCGetInkeyHandler::RunL exiting, error: %d",
+            iStatus.Int() )
+
+        // Renew the request
+        Start();
+
+        return;
+        }
+    
+    LOG2( SIMPLE,
+    "SATINTERNALCLIENT: CSatCGetInkeyHandler::RunL iGetInkeyData.iRspFormat: %d",
+    iGetInkeyData.iRspFormat )
+    // Set the character set parameter.
+    TSatCharacterSet characterSet = ESatCharSmsDefaultAlphabet;
+    if ( RSat::EDigitOnly == iGetInkeyData.iRspFormat )
+        {        
+        characterSet = ESatDigitOnly;
+        }
+    else if ( RSat::ECharSmsDefaultAlphabet == iGetInkeyData.iRspFormat )
+        {        
+        characterSet = ESatCharSmsDefaultAlphabet;
+        }
+    else if ( RSat::ECharUcs2Alphabet == iGetInkeyData.iRspFormat )
+        {        
+        characterSet = ESatCharUcs2Alphabet;
+        }
+    else if ( RSat::EYesNo == iGetInkeyData.iRspFormat )
+        {        
+        characterSet = ESatYesNo;
+        }
+    else
+        {        
+        characterSet = ESatCharSmsDefaultAlphabet;
+        }
+
+    // This will contain user input.
+    TChar character;
+
+    // Indicates whether help is available
+    TBool helpIsAvailable( EFalse );
+    if ( RSat::EHelpAvailable == iGetInkeyData.iHelp )
+        {
+        LOG( SIMPLE, 
+        "SATINTERNALCLIENT: CSatCGetInkeyHandler::RunL HelpAvailable" )
+        helpIsAvailable = ETrue;
+        }
+
+    // Has to be casted to TInt before casting to TSatIconQualifier, because
+    // GCC warns about the direct cast.
+    const struct TSatIconId iconId = { iGetInkeyData.iIconId.iIdentifier,
+        static_cast<TSatIconQualifier>(
+            static_cast<TInt>( iGetInkeyData.iIconId.iQualifier ) ) };
+
+    // This will contain EFalse if requested icon is not displayed.
+    // And if icon is displayed, it contains ETrue.
+    TBool requestedIconDisplayed( EFalse );
+
+    TUint duration( 0 );
+    TUint8 timeUnit( iGetInkeyData.iDuration.iTimeUnit );
+
+    // check if duration data is available.
+    if ( ( RSat::ENoDurationAvailable != timeUnit ) &&
+        ( RSat::ETimeUnitNotSet != timeUnit ) &&
+        iGetInkeyData.iDuration.iNumOfUnits )
+        {
+        // The resolution of a timer is tenth of second.
+        duration = DurationInTenthOfSeconds();
+        LOG2( SIMPLE, "SATINTERNALCLIENT: CSatCGetInkeyHandler duration %i",
+            duration )
+        }
+
+    TBool immediateDigitResponse( EFalse );
+    if ( RSat::EImmediateDigitRsp == iGetInkeyData.iMode )
+        {
+        LOG( SIMPLE, 
+        "SATINTERNALCLIENT: CSatCGetInkeyHandler::RunL EImmediateDigitRsp" )
+        immediateDigitResponse = ETrue;
+        }
+
+    // Notify the registered client and save the response.
+    TSatUiResponse response = iSession->SatUiObserver()->GetInkeyL(
+        iGetInkeyData.iText,
+        characterSet, character, helpIsAvailable,
+        iconId, requestedIconDisplayed,
+        duration, immediateDigitResponse
+        );
+
+    // If duration exists set duration value in response
+    if ( duration &&
+        ( ESatSuccess == response || ESatNoResponseFromUser == response ) )
+        {
+        TenthOfSecondsToDuration( duration );
+        LOG2( SIMPLE,
+            "SATINTERNALCLIENT: CSatCGetInkeyHandler duration in response %i",
+            iGetInkeyRsp.iDuration.iNumOfUnits )
+        }
+
+    // Use the same format in the response as it is in the input.
+    iGetInkeyRsp.iRspFormat = iGetInkeyData.iRspFormat;
+
+    // By default, this command does not have additional information.
+    iGetInkeyRsp.iInfoType = RSat::KNoAdditionalInfo;
+    iGetInkeyRsp.iAdditionalInfo.Zero();
+
+    iGetInkeyRsp.SetPCmdNumber( iGetInkeyData.PCmdNumber() );
+
+    // Examine the client response.
+    ExamineClientResponse(
+        response, character, requestedIconDisplayed );
+
+    // Pass the Get Inkey response package.
+    TIpcArgs arguments( &iGetInkeyRspPckg );
+
+    // Perform the IPC data transfer.
+    iSession->CreateRequest( ESatSProactiveGetInkeyResponse, arguments );
+
+    // Renew the service request.
+    Start();
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCGetInkeyHandler::RunL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCGetInkeyHandler::ExamineClientResponse
+// Examine the client response.
+// -----------------------------------------------------------------------------
+//
+void CSatCGetInkeyHandler::ExamineClientResponse(
+    TSatUiResponse aResponse,
+    const TChar& aCharacter,
+    TBool aRequestedIconDisplayed )
+    {
+    LOG2( SIMPLE,
+    "SATINTERNALCLIENT: CSatCGetInkeyHandler::ExamineClientResponse calling,\
+    aResponse: %x", aResponse )
+
+    // Examine the client response.
+    switch ( aResponse )
+        {
+        case ESatSuccess:
+            {
+             // Convert terminal rsp if icon used
+            RSat::TPCmdResult result( RSat::KSuccess );
+            RSat::TIconQualifier iconQualifier(
+                iGetInkeyData.iIconId.iQualifier );
+
+            if ( !aRequestedIconDisplayed )
+                {
+                LOG( SIMPLE,
+                "SATINTERNALCLIENT: CSatCGetInkeyHandler::ExamineClientResponse \
+                aRequestedIconDisplayed false" )
+                if ( iconQualifier == RSat::ESelfExplanatory ||
+                    iconQualifier == RSat::ENotSelfExplanatory )
+                    {
+                    LOG( SIMPLE,
+                    "SATINTERNALCLIENT: CSatCGetInkeyHandler::ExamineClientResponse \
+                    IconNotDisplayed" )
+                    result = RSat::KSuccessRequestedIconNotDisplayed;
+                    }
+                }
+
+            iGetInkeyRsp.iGeneralResult = result;
+
+            // If GetInkey is type of YesNo, aCharacter is 0 if user selects NO
+            if ( aCharacter || ( RSat::EYesNo == iGetInkeyData.iRspFormat ) )
+                {
+                LOG( SIMPLE,
+                "SATINTERNALCLIENT: CSatCGetInkeyHandler::ExamineClientResponse \
+                set AdditionalInfo" )
+                // Change the additional information type
+                iGetInkeyRsp.iInfoType = RSat::KTextString;
+
+                // Save the character input by the user
+                iGetInkeyRsp.iAdditionalInfo.Append( aCharacter );
+                }
+            else
+                {
+                LOG( SIMPLE,
+                "SATINTERNALCLIENT: CSatCGetInkeyHandler::ExamineClientResponse \
+                no AdditionalInfo" )
+                // Otherwise, just return the response.
+                iGetInkeyRsp.iInfoType = RSat::KNoAdditionalInfo;
+                }
+            break;
+            }
+        case ESatFailure:
+            {
+            iGetInkeyRsp.iInfoType = RSat::KMeProblem;
+            iGetInkeyRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+            iGetInkeyRsp.iAdditionalInfo.SetLength( 1 );
+            iGetInkeyRsp.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
+            break;
+            }
+        case ESatSessionTerminatedByUser:
+            {
+            iGetInkeyRsp.iGeneralResult = RSat::KPSessionTerminatedByUser;
+            break;
+            }
+        case ESatBackwardModeRequestedByUser:
+            {
+            iGetInkeyRsp.iGeneralResult =
+                RSat::KBackwardModeRequestedByUser;
+            break;
+            }
+        case ESatNoResponseFromUser:
+            {
+            iGetInkeyRsp.iGeneralResult = RSat::KNoResponseFromUser;
+            break;
+            }
+        case EHelpRequestedByUser:
+            {
+            iGetInkeyRsp.iGeneralResult = RSat::KHelpRequestedByUser;
+            break;
+            }
+        case EPCmdNotAcceptedByUser:
+        case ESatCmdDataNotUnderstood:
+        default:
+            {
+            iSession->Panic( ESatInvalidResponse );
+            break;
+            }
+        }
+
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCGetInkeyHandler::ExamineClientResponse exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCGetInkeyHandler::DoCancel
+// Cancels the pending request.
+// -----------------------------------------------------------------------------
+//
+void CSatCGetInkeyHandler::DoCancel()
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCGetInkeyHandler::DoCancel calling" )
+
+    // Complete the request with cancel code.
+    TRequestStatus* requestStatus = &iStatus;
+    User::RequestComplete( requestStatus, KErrCancel );
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCGetInkeyHandler::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCGetInkeyHandler::DurationInTenthOfSeconds
+// Return duration in seconds.
+// -----------------------------------------------------------------------------
+//
+TUint CSatCGetInkeyHandler::DurationInTenthOfSeconds() const
+    {
+    LOG2( SIMPLE, 
+    "SATINTERNALCLIENT: CSatCGetInkeyHandler::DurationInTenthOfSeconds calling,\
+    iGetInkeyData.iDuration.iTimeUnit: %d",iGetInkeyData.iDuration.iTimeUnit )
+    TUint duration( 0 );
+
+    switch ( iGetInkeyData.iDuration.iTimeUnit )
+        {
+        case RSat::EMinutes:
+            {
+            duration =
+                iGetInkeyData.iDuration.iNumOfUnits * KTenthOfSecondsInMinute;
+            break;
+            }
+        case RSat::ESeconds:
+            {
+            duration = iGetInkeyData.iDuration.iNumOfUnits * KSecond;
+            break;
+            }
+        case RSat::ETenthsOfSeconds:
+            {
+            duration = iGetInkeyData.iDuration.iNumOfUnits;
+            break;
+            }
+        default:
+            {
+            //duration is 0
+            break;
+            }
+        }
+    LOG2( SIMPLE, 
+    "SATINTERNALCLIENT: CSatCGetInkeyHandler::DurationInTenthOfSeconds exiting,\
+    duration: %d", duration )
+    return duration;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCGetInkeyHandler::TenthOfSecondsToDuration
+// Convert second to duration.
+// -----------------------------------------------------------------------------
+//
+void CSatCGetInkeyHandler::TenthOfSecondsToDuration(
+    TUint aDuration )
+    {
+    LOG2( SIMPLE, 
+    "SATINTERNALCLIENT: CSatCGetInkeyHandler::TenthOfSecondsToDuration calling,\
+    iGetInkeyData.iDuration.iTimeUnit: %d",iGetInkeyData.iDuration.iTimeUnit )
+    switch ( iGetInkeyData.iDuration.iTimeUnit )
+        {
+        case RSat::EMinutes:
+            {
+            iGetInkeyRsp.iDuration.iTimeUnit = RSat::EMinutes;
+
+            // Make Roundup
+            TUint numOfUnits(
+                ( aDuration + KHalfMinute ) / KTenthOfSecondsInMinute );
+
+            if ( KByteMax >= numOfUnits )
+                {
+                LOG( SIMPLE, 
+                "SATINTERNALCLIENT: CSatCGetInkeyHandler::TenthOfSecondsToDuration \
+                EMinutes KByteMax >= numOfUnits" )
+                iGetInkeyRsp.iDuration.iNumOfUnits =
+                    static_cast<TUint8>( numOfUnits );
+                }
+            else
+                {
+                iGetInkeyRsp.iDuration.iNumOfUnits = KByteMax;
+                }
+
+            break;
+            }
+        case RSat::ESeconds:
+            {
+            iGetInkeyRsp.iDuration.iTimeUnit = RSat::ESeconds;
+
+            // Make Roundup
+            TUint numOfUnits(
+                ( aDuration + KHalfSecond ) / KSecond );
+
+            if ( KByteMax >= numOfUnits )
+                {
+                LOG( SIMPLE, 
+                "SATINTERNALCLIENT: CSatCGetInkeyHandler::TenthOfSecondsToDuration \
+                ESeconds KByteMax >= numOfUnits" )
+                iGetInkeyRsp.iDuration.iNumOfUnits =
+                    static_cast<TUint8>( numOfUnits );
+                }
+            else
+                {
+                iGetInkeyRsp.iDuration.iNumOfUnits = KByteMax;
+                }
+
+            break;
+            }
+        case RSat::ETenthsOfSeconds:
+            {
+            iGetInkeyRsp.iDuration.iTimeUnit = RSat::ETenthsOfSeconds;
+            if ( KByteMax >= aDuration )
+                {
+                LOG( SIMPLE, 
+                "SATINTERNALCLIENT: CSatCGetInkeyHandler::TenthOfSecondsToDuration \
+                ETenthsOfSeconds KByteMax >= aDuration" )
+                iGetInkeyRsp.iDuration.iNumOfUnits =
+                    static_cast<TUint8>( aDuration );
+                }
+            else
+                {
+                iGetInkeyRsp.iDuration.iNumOfUnits = KByteMax;
+                }
+
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
+    LOG( SIMPLE, 
+    "SATINTERNALCLIENT: CSatCGetInkeyHandler::TenthOfSecondsToDuration exiting" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatInternalClient/src/CSatCGetInputHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,357 @@
+/*
+* 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:  This is the handler for the SIM Application Toolkit
+*                Get Input proactive command.
+*
+*/
+
+
+#include    <e32svr.h>
+#include    "RSatUiSession.h"
+#include    "MSatUiObserver.h"
+#include    "CSatCGetInputHandler.h"
+#include    "SatSOpcodes.h"
+#include    "SatSTypes.h"
+#include    "SatLog.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// CSatCGetInputHandler::CSatCGetInputHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatCGetInputHandler::CSatCGetInputHandler(
+    TInt aPriority,
+    RSatUiSession* aSession ) :
+    CActive( aPriority ),
+    iSession( aSession ),
+    iGetInputData(),
+    iGetInputPckg( iGetInputData ),
+    iGetInputRsp(),
+    iGetInputRspPckg( iGetInputRsp )
+    {
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCGetInputHandler::CSatCGetInputHandler calling" )
+
+    // Add to active scheduler.
+    CActiveScheduler::Add( this );
+
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCGetInputHandler::CSatCGetInputHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCGetInputHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatCGetInputHandler* CSatCGetInputHandler::NewL(
+    RSatUiSession* aSat )
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCGetInputHandler::NewL calling" )
+
+    // Perform construction.
+    CSatCGetInputHandler* self =
+        new ( ELeave ) CSatCGetInputHandler( EPriorityLow, aSat );
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCGetInputHandler::NewL exiting" )
+    return self;
+    }
+
+// Class destructor.
+CSatCGetInputHandler::~CSatCGetInputHandler()
+    {
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCGetInputHandler::~CSatCGetInputHandler calling" )
+
+    // Cancel any outstanding requests.
+    Cancel();
+
+    iSession = NULL;
+
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCGetInputHandler::~CSatCGetInputHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCGetInputHandler::Start
+// Starts the handler.
+// -----------------------------------------------------------------------------
+//
+void CSatCGetInputHandler::Start()
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCGetInputHandler::Start calling" )
+
+    // Empty the IPC data
+    RSat::TGetInputV1 temp;
+    iGetInputData = temp;
+    RSat::TGetInputRspV1 temp2;
+    iGetInputRsp = temp2;
+
+    // Request Get Input notification.
+    TIpcArgs arguments( &iGetInputPckg );
+
+    // Pass the Get Input IPC package.
+    iSession->CreateRequest( ESatSProactiveGetInput, arguments, iStatus );
+
+    // Set this handler to active so that it can receive requests.
+    SetActive();
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCGetInputHandler::Start exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCGetInputHandler::ConvertCharacterSet
+// Converts USAT character set to SAT character set type.
+// -----------------------------------------------------------------------------
+//
+TSatCharacterSet CSatCGetInputHandler::ConvertCharacterSet(
+    const RSat::TGetInputRspFormat& aCharacterSet ) const
+    {
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCGetInputHandler::ConvertCharacterSet calling" )
+
+    TSatCharacterSet charSet( ESatCharSmsDefaultAlphabet );
+    
+    LOG2( SIMPLE,
+    "SATINTERNALCLIENT: CSatCGetInputHandler::ConvertCharacterSet aCharacterSet: %d",
+    aCharacterSet )
+    
+    if ( ( RSat::EDigitOnlyUnpacked == aCharacterSet ) ||
+         ( RSat::EDigitOnlyPacked == aCharacterSet ) )
+        {        
+        charSet = ESatDigitOnly;
+        }
+    else if ( aCharacterSet == RSat::EUcs2Alphabet )
+        {       
+        charSet = ESatCharUcs2Alphabet;
+        }
+    else
+        {        
+        charSet = ESatCharSmsDefaultAlphabet;
+        }
+
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCGetInputHandler::ConvertCharacterSet exiting" )
+    return charSet;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCGetInputHandler::RunL
+// Handles the command.
+// -----------------------------------------------------------------------------
+//
+void CSatCGetInputHandler::RunL()
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCGetInputHandler::RunL calling" )
+
+    // Check the status of the asnychronous operation
+    if ( KErrNone != iStatus.Int() )
+        {
+        LOG2(
+            SIMPLE,
+            "SATINTERNALCLIENT: CSatCGetInputHandler::RunL exiting, error: %d",
+            iStatus.Int() )
+
+        // Renew the request
+        Start();
+
+        return;
+        }
+
+    // Determine the character set.
+    const TSatCharacterSet characterSet(
+        ConvertCharacterSet( iGetInputData.iRspFormat ) );
+
+    // Determine whether user input should be hidden or not.
+    TBool hideInput( EFalse );
+    if ( RSat::EHideUserInput == iGetInputData.iInputDisplayOption )
+        {
+        LOG( SIMPLE, "SATINTERNALCLIENT: CSatCGetInputHandler::RunL EHideUserInput" )
+        hideInput = ETrue;
+        }
+
+    // This will contain user input.
+    TBuf<KSatGetInputEntrySize> inputText( iGetInputData.iDefaultText );
+
+    // Indicates whether help is available
+    TBool helpIsAvailable( EFalse );
+    if ( RSat::EHelpAvailable == iGetInputData.iHelp )
+        {
+        LOG( SIMPLE, "SATINTERNALCLIENT: CSatCGetInputHandler::RunL EHelpAvailable" )
+        helpIsAvailable = ETrue;
+        }
+
+    // Has to be casted to TInt before casting to TSatIconQualifier, because
+    // GCC warns about the direct cast.
+    const struct TSatIconId iconId = { iGetInputData.iIconId.iIdentifier,
+        static_cast<TSatIconQualifier>(
+            static_cast<TInt>( iGetInputData.iIconId.iQualifier ) ) };
+
+    // This will contain EFalse if requested icon is not displayed.
+    // And if icon is displayed, it contains ETrue.
+    TBool requestedIconDisplayed( EFalse );
+
+    // Notify the registered client and save the response.
+    TSatUiResponse response = iSession->SatUiObserver()->GetInputL(
+        iGetInputData.iText,
+        characterSet, inputText, iGetInputData.iRspLength.iMinRspLength,
+        iGetInputData.iRspLength.iMaxRspLength, hideInput,
+        helpIsAvailable, iconId, requestedIconDisplayed );
+
+    // Use the same format in the response as it is in the input.
+    iGetInputRsp.iRspFormat = iGetInputData.iRspFormat;
+
+    // By default, this command does not have additional information.
+    iGetInputRsp.iInfoType = RSat::KNoAdditionalInfo;
+    iGetInputRsp.iAdditionalInfo.Zero();
+
+    iGetInputRsp.SetPCmdNumber( iGetInputData.PCmdNumber() );
+
+    // Examine the client response.
+    ExamineClientResponse(
+        response, inputText, requestedIconDisplayed );
+
+    // Pass the Get Input response package.
+    TIpcArgs arguments( &iGetInputRspPckg );
+
+    // Perform the IPC data transfer.
+    iSession->CreateRequest( ESatSProactiveGetInputResponse, arguments );
+
+    // Renew the service request.
+    Start();
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCGetInputHandler::RunL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCGetInputHandler::ExamineClientResponse
+// Examine the client response.
+// -----------------------------------------------------------------------------
+//
+void CSatCGetInputHandler::ExamineClientResponse(
+    TSatUiResponse aResponse,
+    const TDes& aInputText,
+    TBool aRequestedIconDisplayed )
+    {
+    LOG2( SIMPLE,
+    "SATINTERNALCLIENT: CSatCGetInputHandler::ExamineClientResponse calling,\
+    aResponse: %d", aResponse )
+
+    // Examine the client response.
+    switch ( aResponse )
+        {
+        case ESatSuccess:
+            {
+
+            // Convert terminal rsp if icon used
+            RSat::TPCmdResult result( RSat::KSuccess );
+            RSat::TIconQualifier iconQualifier(
+                iGetInputData.iIconId.iQualifier );
+
+                if ( !aRequestedIconDisplayed )
+                {
+                LOG( SIMPLE,
+                "SATINTERNALCLIENT: CSatCGetInputHandler::ExamineClientResponse \
+                aRequestedIconDisplayed false" )
+                if ( iconQualifier == RSat::ESelfExplanatory ||
+                     iconQualifier == RSat::ENotSelfExplanatory )
+                    {
+                    LOG( SIMPLE,
+                    "SATINTERNALCLIENT: CSatCGetInputHandler::ExamineClientResponse \
+                    IconNotDisplayed" )
+                    result = RSat::KSuccessRequestedIconNotDisplayed;
+                    }
+                }
+
+            iGetInputRsp.iGeneralResult = result;
+            LOG2( SIMPLE,
+            "SATINTERNALCLIENT: CSatCGetInputHandler::ExamineClientResponse length \
+            of aInputText: %d", aInputText.Length() )
+            // Change the additional information type
+            if ( aInputText.Length() > 0 )
+                {
+                iGetInputRsp.iInfoType = RSat::KTextString;
+
+                // Save the character input by the user
+                iGetInputRsp.iAdditionalInfo.Append( aInputText );
+                }
+            break;
+            }
+
+        // Otherwise, just return the response.
+        case ESatFailure:
+            {
+            iGetInputRsp.iInfoType = RSat::KMeProblem;
+            iGetInputRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+            iGetInputRsp.iAdditionalInfo.SetLength( 1 );
+            iGetInputRsp.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
+            break;
+            }
+
+        case ESatSessionTerminatedByUser:
+            {
+            iGetInputRsp.iGeneralResult = RSat::KPSessionTerminatedByUser;
+            break;
+            }
+
+        case ESatBackwardModeRequestedByUser:
+            {
+            iGetInputRsp.iGeneralResult =
+                RSat::KBackwardModeRequestedByUser;
+            break;
+            }
+
+        case ESatNoResponseFromUser:
+            {
+            iGetInputRsp.iGeneralResult = RSat::KNoResponseFromUser;
+            break;
+            }
+
+        case EHelpRequestedByUser:
+            {
+            iGetInputRsp.iGeneralResult = RSat::KHelpRequestedByUser;
+            break;
+            }
+
+        case EPCmdNotAcceptedByUser:
+        case ESatCmdDataNotUnderstood:
+        default:
+            {
+            iSession->Panic( ESatInvalidResponse );
+            break;
+            }
+        }
+
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCGetInputHandler::ExamineClientResponse exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCGetInputHandler::DoCancel
+// Cancels the pending request.
+// -----------------------------------------------------------------------------
+//
+void CSatCGetInputHandler::DoCancel()
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCGetInputHandler::DoCancel calling" )
+
+    // Complete the request with cancel code.
+    TRequestStatus* requestStatus = &iStatus;
+    User::RequestComplete( requestStatus, KErrCancel );
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCGetInputHandler::DoCancel exiting" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatInternalClient/src/CSatCNotifyHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,218 @@
+/*
+* 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:  This is the handler for various notifications related to
+*                those SIM Application Toolkit proactive commands that
+*                uses notifications to inform user about their actions.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    <e32svr.h>
+#include    "RSatUiSession.h"
+#include    "MSatUiObserver.h"
+#include    "SatSOpcodes.h"
+#include    "CSatCNotifyHandler.h"
+#include    "SatLog.h"
+
+// CONSTANTS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSatCNotifyHandler::CSatCNotifyHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+//lint -e{1403, 1769} Can not be initialized, harmless.
+CSatCNotifyHandler::CSatCNotifyHandler(
+    TInt aPriority,
+    RSatUiSession* aSession ) :
+    CActive( aPriority ),
+    iSession( aSession ),
+    iNotifyData(),
+    iNotifyPckg( iNotifyData ),
+    iNotifyRsp(),
+    iNotifyRspPckg( iNotifyRsp )
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCNotifyHandler::CSatCNotifyHandler calling" )
+
+    // Add to active scheduler.
+    CActiveScheduler::Add( this );
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCNotifyHandler::CSatCNotifyHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCNotifyHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatCNotifyHandler* CSatCNotifyHandler::NewL(
+    RSatUiSession* aSat )
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCNotifyHandler::NewL calling" )
+
+    // Perform construction.
+    CSatCNotifyHandler* self =
+        new ( ELeave ) CSatCNotifyHandler( EPriorityLow, aSat );
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCNotifyHandler::NewL exiting" )
+    return self;
+    }
+
+// Destructor
+CSatCNotifyHandler::~CSatCNotifyHandler()
+    {
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCNotifyHandler::~CSatCNotifyHandler calling" )
+
+    // Cancel any outstanding requests.
+    Cancel();
+    iSession = NULL;
+
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCNotifyHandler::~CSatCNotifyHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCNotifyHandler::Start
+// Starts the handler.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatCNotifyHandler::Start()
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCNotifyHandler::Start calling" )
+
+    // Empty the IPC data
+    TSatNotificationV1 temp;
+    iNotifyData = temp;
+    TSatNotificationRspV1 temp2;
+    temp2.iAccepted = EFalse;
+    temp2.iCommand = ESatSSendDataNotify;
+    iNotifyRsp = temp2;
+
+    // Request notification.
+    TIpcArgs arguments( &iNotifyPckg );
+
+    // Pass the notification IPC package.
+    iSession->CreateRequest( ESatSProactiveNotification, arguments, iStatus );
+
+    // Set this handler to active so that it can receive requests.
+    SetActive();
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCNotifyHandler::Start exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCNotifyHandler::RunL
+// Handles the command.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatCNotifyHandler::RunL()
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCNotifyHandler::RunL calling" )
+
+    // Check the status of the asnychronous operation
+    if ( KErrNone != iStatus.Int() )
+        {
+        LOG2(
+            SIMPLE,
+            "SATINTERNALCLIENT: CSatCNotifyHandler::RunL error: %d",
+            iStatus.Int() )
+
+        // Renew the request
+        Start();
+        }
+
+    else
+        {
+        // This will contain the result of the user query.
+        TBool userQuery( ETrue );
+
+        // This will contain EFalse if requested icon is not displayed.
+        // And if icon is displayed, it contains ETrue.
+        TBool requestedIconDisplayed( EFalse );
+
+        // This will contain the result that has the user pressed end key.
+        TBool terminatedByUser( EFalse );
+        
+        // Has to be casted to TInt before casting to TSatIconQualifier, because
+        // GCC warns about the direct cast.
+        const struct TSatIconId iconId =
+            {
+            iNotifyData.iIconId.iIdentifier,
+                static_cast<TSatIconQualifier>(
+                    static_cast<TInt>(
+                        iNotifyData.iIconId.iIconQualifier ) )
+            };
+
+        // Send notification to UI
+        TSatUiResponse response = iSession->SatUiObserver()->Notification(
+            iNotifyData.iCommand,
+            iNotifyData.iAlphaIdStatus,
+            iNotifyData.iText,
+            iconId,
+            requestedIconDisplayed,
+            iNotifyData.iControlResult );
+        
+        // Check response
+        if ( ESatSuccess != response )
+            {
+            LOG( SIMPLE, 
+            "SATINTERNALCLIENT: CSatCNotifyHandler::RunL ESatSuccess != response" )
+            terminatedByUser = ETrue;
+            }
+        
+        // Indicate SAT Server that notification is complete
+        iNotifyRsp.iCommand = iNotifyData.iCommand;
+        iNotifyRsp.iRequestedIconDisplayed = requestedIconDisplayed;
+        iNotifyRsp.iSessionTerminatedByUser = terminatedByUser;
+        iNotifyRsp.iAccepted = userQuery;
+
+        // Pass the notification response IPC package.
+        TIpcArgs arguments( &iNotifyRspPckg );
+
+        // Perform the IPC data transfer.
+        iSession->CreateRequest( ESatSProactiveNotificationResponse, arguments );
+
+        Start();
+        }
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCNotifyHandler::RunL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCNotifyHandler::DoCancel
+// Cancels the pending request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatCNotifyHandler::DoCancel()
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCNotifyHandler::DoCancel calling" )
+
+    // Complete the request with cancel code.
+    TRequestStatus* requestStatus = &iStatus;
+    User::RequestComplete( requestStatus, KErrCancel );
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCNotifyHandler::DoCancel exiting" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatInternalClient/src/CSatCPlayToneHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,324 @@
+/*
+* 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:  This is the handler for the SIM Application Toolkit
+*                Play Tone proactive command.
+*
+*/
+
+
+#include    <e32svr.h>
+#include    "RSatUiSession.h"
+#include    "MSatUiObserver.h"
+#include    "SatSOpcodes.h"
+#include    "CSatCPlayToneHandler.h"
+#include    "SatLog.h"
+
+// Used when Play tone doesn't contain duration.
+const TInt KSatPtDefaultDuration = 5;
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// CSatCPlayToneHandler::CSatCPlayToneHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatCPlayToneHandler::CSatCPlayToneHandler(
+    TInt aPriority,
+    RSatUiSession* aSession ) :
+    CActive( aPriority ),
+    iSession( aSession ),
+    iPlayToneData(),
+    iPlayTonePckg( iPlayToneData ),
+    iPlayToneRsp(),
+    iPlayToneRspPckg( iPlayToneRsp )
+    {
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCPlayToneHandler::CSatCPlayToneHandler calling" )
+
+    // Add to active scheduler.
+    CActiveScheduler::Add( this );
+
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCPlayToneHandler::CSatCPlayToneHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCPlayToneHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatCPlayToneHandler* CSatCPlayToneHandler::NewL(
+    RSatUiSession* aSat )
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCPlayToneHandler::NewL calling" )
+
+    // Perform the construction.
+    CSatCPlayToneHandler* self =
+        new ( ELeave ) CSatCPlayToneHandler( EPriorityLow, aSat );
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCPlayToneHandler::NewL exiting" )
+    return self;
+    }
+
+// Destructor
+CSatCPlayToneHandler::~CSatCPlayToneHandler()
+    {
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCPlayToneHandler::~CSatCPlayToneHandler calling" )
+    // Cancel any outstanding requests.
+
+    Cancel();
+    iSession = NULL;
+
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCPlayToneHandler::~CSatCPlayToneHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCPlayToneHandler::Start
+// Starts the handler.
+// -----------------------------------------------------------------------------
+//
+void CSatCPlayToneHandler::Start()
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCPlayToneHandler::Start calling" )
+
+    // Empty the IPC data
+    RSat::TPlayToneV2 temp;
+    iPlayToneData = temp;
+    RSat::TPlayToneRspV1 temp2;
+    iPlayToneRsp = temp2;
+
+    // Request Play Tone notification.
+    TIpcArgs arguments( &iPlayTonePckg );
+
+    // Pass the Play Tone IPC package.
+    iSession->CreateRequest( ESatSProactivePlayTone, arguments, iStatus );
+
+    // Set this handler to active so that it can receive requests.
+    SetActive();
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCPlayToneHandler::Start exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCPlayToneHandler::RunL
+// Handles the command.
+// -----------------------------------------------------------------------------
+//
+void CSatCPlayToneHandler::RunL()
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCPlayToneHandler::RunL calling" )
+
+    // Check the status of the asnychronous operation
+    if ( KErrNone != iStatus.Int() )
+        {
+        LOG2(
+            SIMPLE,
+            "SATINTERNALCLIENT: CSatCPlayToneHandler::RunL exiting, error: %d",
+            iStatus.Int() )
+
+        // Renew the request
+        Start();
+
+        return;
+        }
+
+    // Determine the play duration.
+    TTimeIntervalMicroSeconds interval( static_cast<TInt64>( 0 ) );
+    LOG2( SIMPLE,
+    "SATINTERNALCLIENT: CSatCPlayToneHandler::RunL \
+    iPlayToneData.iDuration.iTimeUnit: %d",iPlayToneData.iDuration.iTimeUnit )
+    switch ( iPlayToneData.iDuration.iTimeUnit )
+        {
+        case RSat::EMinutes:
+            {
+            TInt64 temp1(
+            static_cast<TInt>( iPlayToneData.iDuration.iNumOfUnits ) );
+            TInt64 temp2( KSatCMicroSecondsInMinute );
+            interval = temp1 * temp2;
+            break;
+            }
+        case RSat::ESeconds:
+            {
+            interval = iPlayToneData.iDuration.iNumOfUnits *
+                KSatCMicroSecondsInSecond;
+            break;
+            }
+        case RSat::ETenthsOfSeconds:
+            {
+            interval = iPlayToneData.iDuration.iNumOfUnits *
+                KSatCMicroSecondsInOneTenthSecond;
+            break;
+            }
+        case RSat::ETimeUnitNotSet:
+        case RSat::ENoDurationAvailable:
+            {
+            // We are defaulting to 5 seconds in S60
+            interval = KSatPtDefaultDuration *
+                KSatCMicroSecondsInSecond;
+            break;
+            }
+        default:
+            {
+            LOG( SIMPLE, "SATINTERNALCLIENT: Unexpected time unit" )
+            }
+        }
+    // Set the type of tone to be played.
+    // Cannot use static_cast directly because of GCC
+    TSatTone dialTone( static_cast<TSatTone>(
+        static_cast<TInt>( iPlayToneData.iTone ) ) );
+
+    // Has to be casted to TInt before casting to TSatIconQualifier, because
+    // GCC warns about the direct cast.
+    const struct TSatIconId iconId = { iPlayToneData.iIconId.iIdentifier,
+        static_cast<TSatIconQualifier>(
+            static_cast<TInt>( iPlayToneData.iIconId.iQualifier ) ) };
+
+    // This will contain EFalse if requested icon is not displayed.
+    // And if icon is displayed, it contains ETrue.
+    TBool requestedIconDisplayed( EFalse );
+
+    // Notify the registered client and save the response.
+    TSatUiResponse response = iSession->SatUiObserver()->PlayTone(
+        iPlayToneData.iAlphaId.iAlphaId, dialTone, interval,
+        iconId, requestedIconDisplayed );
+
+    // This command never has any additional information.
+    iPlayToneRsp.iInfoType = RSat::KNoAdditionalInfo;
+    iPlayToneRsp.iAdditionalInfo.Zero();
+
+    iPlayToneRsp.SetPCmdNumber( iPlayToneData.PCmdNumber() );
+
+    // Examine the client response.
+    ExamineClientResponse(
+        response, requestedIconDisplayed );
+
+    // Pass the Play Tone response IPC package.
+    TIpcArgs arguments( &iPlayToneRspPckg );
+
+    // Perform the IPC data transfer.
+    iSession->CreateRequest( ESatSProactivePlayToneResponse, arguments );
+
+    // Renew the request
+    Start();
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCPlayToneHandler::RunL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCPlayToneHandler::ExamineClientResponse
+// Examine the client response.
+// -----------------------------------------------------------------------------
+//
+void CSatCPlayToneHandler::ExamineClientResponse(
+    TSatUiResponse aResponse,
+    TBool aRequestedIconDisplayed )
+    {
+    LOG2( SIMPLE,
+    "SATINTERNALCLIENT: CSatCPlayToneHandler::ExamineClientResponse calling,\
+    aResponse: %x", aResponse )
+
+    // Examine the client response.
+    switch ( aResponse )
+        {
+        case ESatSuccess:
+        case ESatSuccessToneNotPlayed: // for future use,
+        // specified in ETSI spec but not currently implemented in etelsat.
+            {
+            // Convert terminal rsp if icon used
+            RSat::TPCmdResult result( RSat::KSuccess );
+            RSat::TIconQualifier iconQualifier(
+                iPlayToneData.iIconId.iQualifier );
+
+            if ( !aRequestedIconDisplayed )
+                {
+                LOG( SIMPLE,
+                "SATINTERNALCLIENT: CSatCPlayToneHandler::ExamineClientResponse \
+                aRequestedIconDisplayed false" )
+                if ( iconQualifier == RSat::ESelfExplanatory ||
+                     iconQualifier == RSat::ENotSelfExplanatory )
+                    {
+                    LOG( SIMPLE,
+                    "SATINTERNALCLIENT: CSatCPlayToneHandler::ExamineClientResponse \
+                    IconNotDisplayed" )
+                    result = RSat::KSuccessRequestedIconNotDisplayed;
+                    }
+                }
+
+            iPlayToneRsp.iGeneralResult = result;
+            break;
+            }
+        case ESatFailure:
+            {
+            iPlayToneRsp.iInfoType = RSat::KMeProblem;
+            iPlayToneRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+            iPlayToneRsp.iAdditionalInfo.SetLength( 1 );
+            iPlayToneRsp.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
+            break;
+            }
+        case ESatSessionTerminatedByUser:
+            {
+            iPlayToneRsp.iGeneralResult = RSat::KPSessionTerminatedByUser;
+            break;
+            }
+        case ESatBackwardModeRequestedByUser:
+            {
+            iPlayToneRsp.iGeneralResult =
+                RSat::KBackwardModeRequestedByUser;
+            break;
+            }
+        case ESatNoResponseFromUser:
+            {
+            iPlayToneRsp.iGeneralResult = RSat::KNoResponseFromUser;
+            break;
+            }
+        case ESatCmdDataNotUnderstood:
+            {
+            iPlayToneRsp.iGeneralResult = RSat::KCmdDataNotUnderstood;
+            iPlayToneRsp.iInfoType = RSat::KNoAdditionalInfo;
+            iPlayToneRsp.iAdditionalInfo.Zero();
+            break;
+            }
+        // No help is ever available with this command.
+        case EHelpRequestedByUser:
+        case EPCmdNotAcceptedByUser:
+        default:
+            {
+            iSession->Panic( ESatInvalidResponse );
+            break;
+            }
+        }
+
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCPlayToneHandler::ExamineClientResponse exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCPlayToneHandler::DoCancel
+// Cancels the pending request.
+// -----------------------------------------------------------------------------
+//
+void CSatCPlayToneHandler::DoCancel()
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCPlayToneHandler::DoCancel calling" )
+
+    // Complete the request with cancel code.
+    TRequestStatus* requestStatus = &iStatus;
+    User::RequestComplete( requestStatus, KErrCancel );
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCPlayToneHandler::DoCancel exiting" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatInternalClient/src/CSatCQueryHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,206 @@
+/*
+* 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:  This is the handler for various query requests related to
+*                those SIM Application Toolkit proactive commands that require
+*                user permissions to complete their actions.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    <e32svr.h>
+#include    "RSatUiSession.h"
+#include    "MSatUiObserver.h"
+#include    "SatSOpcodes.h"
+#include    "CSatCQueryHandler.h"
+#include    "SatLog.h"
+
+// CONSTANTS
+
+// This will contain the Window Group Id of SAT UI
+const TInt KSatUiWgId = -1;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSatCQueryHandler::CSatCQueryHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+//lint -e{1403, 1769} Can not be initialized, harmless.
+CSatCQueryHandler::CSatCQueryHandler(
+    TInt aPriority,
+    RSatUiSession* aSession ) :
+    CActive( aPriority ),
+    iSession( aSession ),
+    iQueryData(),
+    iQueryPckg( iQueryData ),
+    iQueryRsp(),
+    iQueryRspPckg( iQueryRsp )
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCQueryHandler::CSatCQueryHandler calling" )
+
+    // Add to active scheduler.
+    CActiveScheduler::Add( this );
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCQueryHandler::CSatCQueryHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCQueryHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatCQueryHandler* CSatCQueryHandler::NewL(
+    RSatUiSession* aSat )
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCQueryHandler::NewL calling" )
+
+    // Perform construction.
+    CSatCQueryHandler* self =
+        new ( ELeave ) CSatCQueryHandler( EPriorityLow, aSat );
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCQueryHandler::NewL exiting" )
+    return self;
+    }
+
+// Destructor
+CSatCQueryHandler::~CSatCQueryHandler()
+    {
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCQueryHandler::~CSatCQueryHandler calling" )
+
+    // Cancel any outstanding requests.
+    Cancel();
+    iSession = NULL;
+
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCQueryHandler::~CSatCQueryHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCQueryHandler::Start
+// Starts the handler.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatCQueryHandler::Start()
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCQueryHandler::Start calling" )
+
+    // Empty the IPC data
+    TSatQueryV1 temp;
+    iQueryData = temp;
+    TSatQueryRspV1 temp2;
+    temp2.iAccepted = EFalse;
+    temp2.iCommand = ESatSSendSmQuery;
+    iQueryRsp = temp2;
+
+    // Request queries notification.
+    TIpcArgs arguments( &iQueryPckg );
+
+    // Pass the Query IPC package.
+    iSession->CreateRequest( ESatSProactiveQuery, arguments, iStatus );
+
+    // Set this handler to active so that it can receive requests.
+    SetActive();
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCQueryHandler::Start exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCQueryHandler::RunL
+// Handles the command.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatCQueryHandler::RunL()
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCQueryHandler::RunL calling" )
+
+    // Check the status of the asnychronous operation
+    if ( KErrNone != iStatus.Int() )
+        {
+        LOG2(
+            SIMPLE,
+            "SATINTERNALCLIENT: CSatCQueryHandler::RunL error: %d",
+            iStatus.Int() )
+
+        // Renew the request
+        Start();
+        }
+
+    else
+        {
+        // This will contain the result of the user query.
+        TBool userQuery( EFalse );
+
+        // This will contain EFalse if requested icon is not displayed.
+        // And if icon is displayed, it contains ETrue.
+        TBool requestedIconDisplayed( EFalse );
+
+        // This will contain the result that has the user pressed end key.
+        TBool terminatedByUser( EFalse );
+
+        // Use general configm function
+        iSession->SatUiObserver()->ConfirmCommand(
+            iQueryData.iCommand,
+            iQueryData.iAlphaIdStatus,
+            iQueryData.iQueryText,
+            iQueryData.iSimApplicationName,
+            userQuery,
+            iQueryData.iIconId,
+            requestedIconDisplayed,
+            terminatedByUser );
+
+        // Return the result of the query to the server.
+        iQueryRsp.iAccepted = userQuery;
+        iQueryRsp.iCommand = iQueryData.iCommand;
+        iQueryRsp.iWgId = KSatUiWgId;
+        iQueryRsp.iRequestedIconDisplayed = requestedIconDisplayed;
+        iQueryRsp.iSessionTerminatedByUser = terminatedByUser;
+
+        // Pass the Query response IPC package.
+        TIpcArgs arguments( &iQueryRspPckg );
+
+        // Perform the IPC data transfer.
+        iSession->CreateRequest( ESatSProactiveQueryResponse, arguments );
+
+        Start();
+        }
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCQueryHandler::RunL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCQueryHandler::DoCancel
+// Cancels the pending request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatCQueryHandler::DoCancel()
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCQueryHandler::DoCancel calling" )
+
+    // Complete the request with cancel code.
+    TRequestStatus* requestStatus = &iStatus;
+    User::RequestComplete( requestStatus, KErrCancel );
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCQueryHandler::DoCancel exiting" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatInternalClient/src/CSatCSelectItemHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,435 @@
+/*
+* 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:  This is the handler for the SIM Application Toolkit
+*                Select Item proactive command.
+*
+*/
+
+
+#include    <e32svr.h>
+#include    <basched.h>
+#include    "RSatUiSession.h"
+#include    "MSatUiObserver.h"
+#include    "SatSOpcodes.h"
+#include    "CSatCSelectItemHandler.h"
+#include    "SatLog.h"
+
+const TInt8 KMenuItemPop( 3 );
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// CSatCSelectItemHandler::CSatCSelectItemHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatCSelectItemHandler::CSatCSelectItemHandler(
+    TInt aPriority,
+    RSatUiSession* aSession ) :
+    CActive( aPriority ),
+    iSession( aSession ),
+    iSelectItemData(),
+    iSelectItemPckg( iSelectItemData ),
+    iSelectItemRsp(),
+    iSelectItemRspPckg( iSelectItemRsp )
+    {
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCSelectItemHandler::CSatCSelectItemHandler calling" )
+
+    // Add to active scheduler.
+    CActiveScheduler::Add( this );
+
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCSelectItemHandler::CSatCSelectItemHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCSelectItemHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatCSelectItemHandler* CSatCSelectItemHandler::NewL(
+    RSatUiSession* aSat )
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCSelectItemHandler::NewL calling" )
+
+    // Perform the construction.
+    CSatCSelectItemHandler* self =
+        new ( ELeave ) CSatCSelectItemHandler( EPriorityLow, aSat );
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCSelectItemHandler::NewL exiting" )
+    return self;
+    }
+
+// Destructor
+CSatCSelectItemHandler::~CSatCSelectItemHandler()
+    {
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCSelectItemHandler::~CSatCSelectItemHandler calling" )
+
+    // Cancel any outstanding requests.
+    Cancel();
+    iSession = NULL;
+
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCSelectItemHandler::~CSatCSelectItemHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCSelectItemHandler::Start
+// Starts the handler.
+// -----------------------------------------------------------------------------
+//
+void CSatCSelectItemHandler::Start()
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCSelectItemHandler::Start calling" )
+
+    // Empty the IPC data
+    RSat::TSelectItemV2 temp;
+    iSelectItemData = temp;
+    RSat::TSelectItemRspV1 temp2;
+    iSelectItemRsp = temp2;
+
+    // Request Select Item notification.
+    TIpcArgs arguments( &iSelectItemPckg );
+
+    // Pass the Select Item IPC package.
+    iSession->CreateRequest( ESatSProactiveSelectItem, arguments, iStatus );
+
+    // Set this handler to active so that it can receive requests.
+    SetActive();
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCSelectItemHandler::Start exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCSelectItemHandler::RunL
+// Handles the command.
+// -----------------------------------------------------------------------------
+//
+void CSatCSelectItemHandler::RunL()
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCSelectItemHandler::RunL calling" )
+
+    // Check the status of the asnychronous operation
+    if ( KErrNone != iStatus.Int() )
+        {
+        LOG2(
+            SIMPLE,
+            "SATINTERNALCLIENT: CSatCSelectItemHandler::RunL error: %d",
+            iStatus.Int() )
+
+        // Renew the request
+        Start();
+        }
+    else
+        {
+        // Create the menu item array.
+        CDesC16ArrayFlat* menuItems = new( ELeave ) CDesC16ArrayFlat( 1 );
+        CleanupStack::PushL( menuItems );
+
+        // Create the next action indicator array.
+        CArrayFixFlat<TSatAction>* menuActions =
+            new( ELeave ) CArrayFixFlat<TSatAction>( 1 );
+        CleanupStack::PushL( menuActions );
+
+        // Create the menu item icon array.
+        CArrayFixFlat<TInt>* menuIcons =
+            new( ELeave ) CArrayFixFlat<TInt>( 1 );
+        CleanupStack::PushL( menuIcons );
+
+        // Fetch all the menu items.
+        // Note that the indexing starts from 1 in SIM item lists.
+        // This is the default menu item.
+        TInt defaultItem( 0 );
+        TBool defaultItemIdFound( EFalse );
+
+        const TInt numberOfItems( static_cast<TInt>(
+            iSelectItemData.NumberOfItems() ) );
+            
+        LOG2( SIMPLE,
+        "SATINTERNALCLIENT: CSatCSelectItemHandler::RunL numberOfItems: %d",
+        numberOfItems )
+        for ( TInt currentItem = 1; currentItem <= numberOfItems; currentItem++ )
+            {
+            RSat::TItem item;
+            TInt action;
+            TInt icon( KErrNotFound );
+
+            // Fetch all data for this index.
+            iSelectItemData.GetItem( static_cast<TUint>( currentItem ),
+                                     item, action, icon );
+
+            if ( item.iItemId == iSelectItemData.iDefaultItemId )
+                {
+                LOG( SIMPLE, 
+                "SATINTERNALCLIENT: CSatCSelectItemHandler::RunL has defaultItemId" )
+                defaultItem = currentItem - 1;
+                defaultItemIdFound = ETrue;
+                }
+
+            // Save the item name
+            menuItems->AppendL( item.iItemString );
+
+            // Save icon identifier.
+            // icon will be KErrNotFound (-1) if it is not present in the
+            // SAT menu.
+            menuIcons->AppendL( icon );
+            LOG2( SIMPLE,
+            "SATINTERNALCLIENT: CSatCSelectItemHandler::RunL action: %d", action )
+            if ( KErrNotFound != action )
+                {
+                // Save the next action indicator, if found.
+                menuActions->AppendL( STATIC_CAST( TSatAction, action ) );
+                }
+            }
+
+        // Do not return partial comprehension response when
+        // default item is not set.
+        if ( !iSelectItemData.iDefaultItemId )
+            {
+            LOG( SIMPLE, 
+            "SATINTERNALCLIENT: CSatCSelectItemHandler::RunL \
+            iSelectItemData.iDefaultItemId false" )
+            defaultItemIdFound = ETrue;
+            }
+
+        // This will contain the user selection.
+        TUint8 selection;
+
+        // Indicates whether help is available
+        TBool helpIsAvailable( EFalse );
+        if ( iSelectItemData.iHelp == RSat::EHelpAvailable )
+            {
+            LOG( SIMPLE, 
+            "SATINTERNALCLIENT: CSatCSelectItemHandler::RunL EHelpAvailable" )
+            helpIsAvailable = ETrue;
+            }
+
+        // Has to be casted to TInt before casting to TSatIconQualifier,
+        // because gcc warns about the direct cast.
+        const struct TSatIconId iconId = { iSelectItemData.iIconId.iIdentifier,
+            static_cast<TSatIconQualifier>(
+                static_cast<TInt>( iSelectItemData.iIconId.iQualifier ) ) };
+
+        const enum TSatIconQualifier iconListQualifier(
+            static_cast<TSatIconQualifier>(
+                static_cast<TInt>( iSelectItemData.iIconListQualifier ) ) );
+
+        const enum TSatSelectionPreference selectionPreference(
+            static_cast<TSatSelectionPreference>(
+                static_cast<TInt>( iSelectItemData.iPreference ) ) );
+
+        // This will contain EFalse if requested icon is not displayed.
+        TBool requestedIconDisplayed( ETrue );
+
+        // About lint e64:
+        // Error in lint was MDesC8Array = CDesC16ArrayFlat, which
+        // is not the case.
+        // Notify the registered client and save the response.
+        //lint -e{64}
+        TSatUiResponse response = iSession->SatUiObserver()->SelectItemL(
+            iSelectItemData.iAlphaId.iAlphaId,
+            *menuItems,
+            menuActions,
+            defaultItem,
+            selection,
+            helpIsAvailable,
+            iconId,
+            menuIcons,
+            iconListQualifier,
+            requestedIconDisplayed,
+            selectionPreference );
+
+        // By default, this command does not have additional information.
+        iSelectItemRsp.iInfoType = RSat::KNoAdditionalInfo;
+        iSelectItemRsp.iAdditionalInfo.Zero();
+
+        // must use the same pcmd
+        iSelectItemRsp.SetPCmdNumber( iSelectItemData.PCmdNumber() );
+
+        // Examine the client response.
+        ExamineClientResponse(
+            response, selection, requestedIconDisplayed, defaultItemIdFound );
+
+        // Pass the Select Item response package.
+        TIpcArgs arguments( &iSelectItemRspPckg );
+
+        // Perform the IPC data transfer.
+        iSession->CreateRequest( ESatSProactiveSelectItemResponse, arguments );
+
+        // Destroy the array objects: menuIcons, menuActions, menuItems.
+        CleanupStack::PopAndDestroy( KMenuItemPop, menuItems );
+
+        // Renew the service request.
+        Start();
+        }
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCSelectItemHandler::RunL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCSelectItemHandler::ExamineClientResponse
+// Examine the client response.
+// -----------------------------------------------------------------------------
+//
+void CSatCSelectItemHandler::ExamineClientResponse(
+    TSatUiResponse aResponse,
+    TUint8 aSelection,
+    TBool aRequestedIconDisplayed,
+    TBool aDefaultItemIdFound )
+    {
+    LOG2( SIMPLE,
+    "SATINTERNALCLIENT: CSatCSelectItemHandler::ExamineClientResponse calling,\
+    aResponse: %x", aResponse )
+
+    // Examine the client response.
+    switch ( aResponse )
+        {
+        case ESatSuccess:
+            {
+            // Convert terminal rsp if icon used
+            RSat::TPCmdResult result( RSat::KSuccess );
+            RSat::TIconQualifier iconQualifier(
+                    iSelectItemData.iIconId.iQualifier );
+
+            //lint -e{961} Else block meaningless
+            if ( iSelectItemData.iDefaultItemId && !aDefaultItemIdFound )
+                {
+                LOG( SIMPLE,
+                "SATINTERNALCLIENT: CSatCSelectItemHandler::ExamineClientResponse \
+                KPartialComprehension" )
+                result = RSat::KPartialComprehension;
+                }
+            else if ( !aRequestedIconDisplayed )
+                {
+                LOG( SIMPLE,
+                "SATINTERNALCLIENT: CSatCSelectItemHandler::ExamineClientResponse \
+                aRequestedIconDisplayed false" )
+                if ( iconQualifier == RSat::ESelfExplanatory ||
+                     iconQualifier == RSat::ENotSelfExplanatory )
+                    {
+                    LOG( SIMPLE,
+                    "SATINTERNALCLIENT: CSatCSelectItemHandler::ExamineClientResponse \
+                    IconNotDisplayed" )
+                    result = RSat::KSuccessRequestedIconNotDisplayed;
+                    }
+                }
+
+            iSelectItemRsp.iGeneralResult = result;
+
+            // Change the additional information type.
+            iSelectItemRsp.iInfoType = RSat::KItemIdentifier;
+
+            // Search for the correct item ID.
+            // Underflow not possible due to selection
+            // being of type TUint8
+            if ( aSelection > iSelectItemData.NumberOfItems() - 1 )
+                {
+                LOG( SIMPLE,
+                "SATINTERNALCLIENT: CSatCSelectItemHandler::ExamineClientResponse \
+                ESatSuccess ESelectedItemOutOfRange" )
+                iSession->Panic( ESelectedItemOutOfRange );
+                }
+
+            // Get the item with the desired index.
+            RSat::TItem item;
+            iSelectItemData.GetItem( aSelection + 1, item );
+
+            // Save the index of the item selected by the user.
+            iSelectItemRsp.iAdditionalInfo.SetLength( 1 );
+            iSelectItemRsp.iAdditionalInfo[0] = item.iItemId;
+            break;
+            }
+        // Otherwise, just return the response.
+        case ESatFailure:
+            {
+            iSelectItemRsp.iInfoType = RSat::KMeProblem;
+            iSelectItemRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
+            iSelectItemRsp.iAdditionalInfo.SetLength( 1 );
+            iSelectItemRsp.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
+            break;
+            }
+        case ESatSessionTerminatedByUser:
+            {
+            iSelectItemRsp.iGeneralResult = RSat::KPSessionTerminatedByUser;
+            break;
+            }
+        case ESatBackwardModeRequestedByUser:
+            {
+            iSelectItemRsp.iGeneralResult =
+                RSat::KBackwardModeRequestedByUser;
+            break;
+            }
+        case ESatNoResponseFromUser:
+            {
+            iSelectItemRsp.iGeneralResult = RSat::KNoResponseFromUser;
+            break;
+            }
+        case EHelpRequestedByUser:
+            {
+            iSelectItemRsp.iGeneralResult = RSat::KHelpRequestedByUser;
+
+            // Change the additional information type.
+            iSelectItemRsp.iInfoType = RSat::KItemIdentifier;
+
+            // Search for the correct item ID.
+            // Underflow not possible due to selection
+            // being of type TUint8
+            if ( aSelection > iSelectItemData.NumberOfItems() - 1 )
+                {
+                LOG( SIMPLE,
+                "SATINTERNALCLIENT: CSatCSelectItemHandler::ExamineClientResponse \
+                EHelpRequestedByUser ESelectedItemOutOfRange" )
+                iSession->Panic( ESelectedItemOutOfRange );
+                }
+
+            // Get the item with the desired index.
+            RSat::TItem item;
+            iSelectItemData.GetItem( aSelection + 1, item );
+
+            // Save the index of the item selected by the user.
+            iSelectItemRsp.iAdditionalInfo.SetLength( 1 );
+            iSelectItemRsp.iAdditionalInfo[0] = item.iItemId;
+            break;
+            }
+        case EPCmdNotAcceptedByUser:
+        case ESatCmdDataNotUnderstood:
+        default:
+            {
+            iSession->Panic( ESatInvalidResponse );
+            break;
+            }
+        }
+
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCSelectItemHandler::ExamineClientResponse exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCSelectItemHandler::DoCancel
+// Cancels the pending request.
+// -----------------------------------------------------------------------------
+//
+void CSatCSelectItemHandler::DoCancel()
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCSelectItemHandler::DoCancel calling" )
+
+    // Complete the request with cancel code.
+    TRequestStatus* requestStatus = &iStatus;
+    User::RequestComplete( requestStatus, KErrCancel );
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCSelectItemHandler::DoCancel exiting" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatInternalClient/src/CSatCSetUpMenuHandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,299 @@
+/*
+* 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:  This is the handler for the SIM Application Toolkit
+*                Set Up Menu proactive command.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    <e32svr.h>
+#include    "RSatUiSession.h"
+#include    "MSatUiObserver.h"
+#include    "SatSOpcodes.h"
+#include    "CSatCSetUpMenuHandler.h"
+#include    "SatLog.h"
+
+// CONSTANTS
+const TInt8 KMenuItemPop( 3 );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSatCSetUpMenuHandler::CSatCSetUpMenuHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatCSetUpMenuHandler::CSatCSetUpMenuHandler(
+    TInt aPriority,
+    RSatUiSession* aSession ) :
+    CActive( aPriority ),
+    iSession( aSession ),
+    iSetUpMenuData(),
+    iSetUpMenuPckg( iSetUpMenuData ),
+    iSetUpMenuRsp(),
+    iSetUpMenuRspPckg( iSetUpMenuRsp )
+    {
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCSetUpMenuHandler::CSatCSetUpMenuHandler calling" )
+
+    // Add to active scheduler.
+    CActiveScheduler::Add( this );
+
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCSetUpMenuHandler::CSatCSetUpMenuHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCSetUpMenuHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatCSetUpMenuHandler* CSatCSetUpMenuHandler::NewL(
+    RSatUiSession* aSat )
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCSetUpMenuHandler::NewL calling" )
+
+    // Perform the construction.
+    CSatCSetUpMenuHandler* self =
+        new ( ELeave ) CSatCSetUpMenuHandler( EPriorityLow, aSat );
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCSetUpMenuHandler::NewL exiting" )
+    return self;
+    }
+
+// Destructor
+CSatCSetUpMenuHandler::~CSatCSetUpMenuHandler()
+    {
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCSetUpMenuHandler::~CSatCSetUpMenuHandler calling" )
+
+    // Cancel any outstanding requests.
+    Cancel();
+    iSession = NULL;
+
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCSetUpMenuHandler::~CSatCSetUpMenuHandler exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCSetUpMenuHandler::Start
+// Starts the handler.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+
+void CSatCSetUpMenuHandler::Start()
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCSetUpMenuHandler::Start calling" )
+
+    // Empty the IPC data
+    RSat::TSetUpMenuV2 temp;
+    iSetUpMenuData = temp;
+    RSat::TSetUpMenuRspV1 temp2;
+    iSetUpMenuRsp = temp2;
+
+    // Request Set Up Menu notification.
+    TIpcArgs arguments( &iSetUpMenuPckg );
+
+    // Pass the Set Up Menu IPC package.
+    iSession->CreateRequest( ESatSProactiveSetUpMenu, arguments, iStatus );
+
+    // Set this handler to active so that it can receive requests.
+    SetActive();
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCSetUpMenuHandler::Start exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCSetUpMenuHandler::RunL
+// Handles the command.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatCSetUpMenuHandler::RunL()
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCSetUpMenuHandler::RunL calling" )
+
+    // Check the status of the asnychronous operation
+    if ( KErrNone != iStatus.Int() )
+        {
+        LOG2(
+            SIMPLE,
+            "SATINTERNALCLIENT: CSatCSetUpMenuHandler::RunL exiting, error: %d",
+            iStatus.Int() )
+        }
+    else 
+        {
+        // Save the contents of the data for envelope Menu Selection.
+        iOldSetUpMenuData = iSetUpMenuData;
+
+        // Create the menu item array.
+        CDesCArrayFlat* menuItems = new( ELeave ) CDesCArrayFlat( 1 );
+        CleanupStack::PushL( menuItems );
+
+        // Create the next action indicator array.
+        CArrayFixFlat<TSatAction>* menuActions =
+            new( ELeave ) CArrayFixFlat<TSatAction>( 1 );
+        CleanupStack::PushL( menuActions );
+
+        // Create the menu item icon array.
+        CArrayFixFlat<TInt>* menuIcons =
+            new( ELeave ) CArrayFixFlat<TInt>( 1 );
+        CleanupStack::PushL( menuIcons );
+
+        // Fetch all the menu items.
+        // Note that the indexing starts from 1 in SIM item lists.
+        const TInt menuItemCount(
+            static_cast<TInt>( iSetUpMenuData.NumberOfItems() ) );
+        LOG2( SIMPLE,
+        "SATINTERNALCLIENT: CSatCSetUpMenuHandler::RunL menuItemCount: %d",
+        menuItemCount )
+        for ( TInt currentItem = 1;
+              currentItem <= menuItemCount;
+              currentItem++ )
+            {
+            RSat::TItem item;
+            TInt action;
+            TInt icon( KErrNotFound );
+
+            // Fetch all data for this index.
+            iSetUpMenuData.GetItem( static_cast<TUint>( currentItem ),
+                                    item,
+                                    action,
+                                    icon );
+
+            // Save the item name
+            menuItems->AppendL( item.iItemString );
+
+            // Save icon identifier.
+            // icon will be KErrNotFound (-1) if it is not present in the
+            // SAT menu.
+            menuIcons->AppendL( icon );
+            
+            if ( KErrNotFound != action )
+                {
+                LOG2( SIMPLE,
+                "SATINTERNALCLIENT: CSatCSetUpMenuHandler::RunL action: %d", action )
+                // Save the next action indicator, if found.
+                menuActions->AppendL( STATIC_CAST( TSatAction, action ) );
+                }
+            }
+
+        // Indicates whether help is available
+        TBool helpIsAvailable( EFalse );
+        if ( RSat::EHelpAvailable == iSetUpMenuData.iHelp )
+            {
+            LOG( SIMPLE, 
+            "SATINTERNALCLIENT: CSatCSetUpMenuHandler::RunL EHelpAvailable" )
+            helpIsAvailable = ETrue;
+            }
+
+        // Has to be casted to TInt before casting to TSatIconQualifier,
+        // because gcc warns about the direct cast.
+        const struct TSatIconId iconId = { iSetUpMenuData.iIconId.iIdentifier,
+            static_cast<TSatIconQualifier>(
+                static_cast<TInt>( iSetUpMenuData.iIconId.iQualifier ) ) };
+
+        const enum TSatIconQualifier iconListQualifier(
+            static_cast<TSatIconQualifier>(
+                static_cast<TInt>( iSetUpMenuData.iIconListQualifier ) ) );
+
+        const enum TSatSelectionPreference selectionPreference(
+            static_cast<TSatSelectionPreference>(
+                static_cast<TInt>( iSetUpMenuData.iPreference ) ) );
+
+        // Notify the registered client and save the response.
+        TSatUiResponse response(
+            iSession->SatUiObserver()->SetUpMenuL(
+            iSetUpMenuData.iAlphaId.iAlphaId,
+            *menuItems,
+            menuActions,
+            helpIsAvailable,
+            iconId,
+            menuIcons,
+            iconListQualifier,
+            selectionPreference ) );
+            
+        LOG2( SIMPLE,
+        "SATINTERNALCLIENT: CSatCSetUpMenuHandler::RunL response: %x", response )
+        // Examine the client response.
+        switch ( response )
+            {
+            case ESatSuccess:
+                {
+                break;
+                }
+            case ESatFailure:
+                {
+                iSession->Panic( ESatSetUpMenuFailure );
+                break;
+                }
+            case ESatSessionTerminatedByUser:
+            case ESatBackwardModeRequestedByUser:
+            case ESatNoResponseFromUser:
+            case EHelpRequestedByUser:
+            case EPCmdNotAcceptedByUser:
+            case ESatCmdDataNotUnderstood:
+            default:
+                {
+                iSession->Panic( ESatInvalidResponse );
+                break;
+                }
+            }
+
+        // Destroy the array objects: menuIcons, menuActions, menuItems.
+        CleanupStack::PopAndDestroy( KMenuItemPop, menuItems );
+        }
+
+    // Renew the service request.
+    Start();
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCSetUpMenuHandler::RunL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCSetUpMenuHandler::DoCancel
+// Cancels the pending request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatCSetUpMenuHandler::DoCancel()
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCSetUpMenuHandler::DoCancel calling" )
+
+    // Complete the request with cancel code.
+    TRequestStatus* requestStatus = &iStatus;
+    User::RequestComplete( requestStatus, KErrCancel );
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: CSatCSetUpMenuHandler::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCSetUpMenuHandler::OldSetUpMenuData
+// Returns a pointer to a old the command data object.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+RSat::TSetUpMenuV2 CSatCSetUpMenuHandler::OldSetUpMenuData() const
+    {
+    LOG( SIMPLE,
+        "SATINTERNALCLIENT: CSatCSetUpMenuHandler::OldSetUpMenuData calling-exiting" )
+    return iOldSetUpMenuData;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatInternalClient/src/RSatUiSession.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,283 @@
+/*
+* 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:  The UI Client API of the SAT Server.
+*
+*/
+
+
+
+//  INCLUDE FILES
+#include <e32def.h>
+#include <rsatsession.h>
+#include <data_caging_path_literals.hrh>
+
+#include "RSatUiSession.h"
+#include "MSatUiObserver.h"
+#include "MSatUiAdapter.h"
+#include "SatSOpcodes.h"
+#include "CSatCCommandProcessor.h"
+#include "SatServerFactory.h"
+#include "SatLog.h"
+
+// CONSTANTS
+
+#if defined( __WINS__ )
+const TInt KHeapMinSize = 0x10000;
+const TInt KHeapMaxSize = 0x10000;
+#endif
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// RSatUiSession::RSatUiSession
+// Class constructor.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RSatUiSession::RSatUiSession() :
+    RSubSessionBase(),
+    iCommandProcessor( NULL ),
+    iSatUiObserver( NULL )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// RSatUiSession::RegisterL
+// Registers a new client.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RSatUiSession::RegisterL(
+    const RSatSession& aSession,
+    MSatUiObserver* aSatUiObserver )
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: RSatUiSession::RegisterL calling" )
+
+    // If the server isn't already started, we can't do anything.
+    if ( !IsServerStarted() )
+        {
+        LOG( SIMPLE, 
+        "SATINTERNALCLIENT: RSatUiSession::RegisterL server not started" )
+        User::Leave( KErrCouldNotConnect );
+        }
+
+    iSatUiObserver = aSatUiObserver;
+    iCommandProcessor = CSatCCommandProcessor::NewL( this );
+
+    // Connect to the server side session.
+    TIpcArgs arguments( 0 );
+    User::LeaveIfError(
+        CreateSubSession(
+            aSession,
+            ESatSOpenUiSubSession, arguments ) );
+
+    // Start the handlers.
+    iCommandProcessor->Start();
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: RSatUiSession::RegisterL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// RSatUiSession::Adapter
+// Returns a pointer to an adapter object.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MSatUiAdapter* RSatUiSession::Adapter() const
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: RSatUiSession::Adapter calling" )
+
+    if ( iCommandProcessor )
+        {
+        MSatUiAdapter* satUiAdapter = iCommandProcessor->ActiveCommandHandler();
+
+        LOG( SIMPLE,
+            "SATINTERNALCLIENT: RSatUiSession::Adapter (iCommandProcessor) exiting" )
+        return satUiAdapter;
+        }
+
+    else
+        {
+        LOG( SIMPLE, "SATINTERNALCLIENT: RSatUiSession::Adapter exiting" )
+        return NULL;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// RSatUiSession::Unregister
+// Unregisters a client.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void RSatUiSession::Unregister()
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: RSatUiSession::Unregister calling" )
+
+     if ( iCommandProcessor )
+        {
+        LOG( SIMPLE, 
+        "SATINTERNALCLIENT: RSatUiSession::Unregister iCommandProcessor true" )
+        delete iCommandProcessor;
+        iCommandProcessor = NULL;
+        }
+
+    iSatUiObserver = NULL;
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: RSatUiSession::Unregister exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// RSatUiSession::Version
+// Returns the current version of the client.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TVersion RSatUiSession::Version() const
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: RSatUiSession::Version calling-exiting" )
+    return TVersion(
+        KSatServerMajorVersionNumber,
+        KSatServerMinorVersionNumber,
+        KSatServerBuildVersionNumber );
+    }
+
+// -----------------------------------------------------------------------------
+// RSatUiSession::Close
+// Closes the server session.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RSatUiSession::Close()
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: RSatUiSession::Close calling" )
+
+    Unregister();
+    CloseSubSession( ESatSCloseUiSubSession );
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: RSatUiSession::Close exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// RSatUiSession::Panic
+// Panics the client.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RSatUiSession::Panic(
+    TSatClientPanic aReason ) const
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: RSatUiSession::Panic" )
+
+    User::Panic( KSatCliName, aReason );
+    }
+
+// -----------------------------------------------------------------------------
+// RSatUiSession::KillServer
+// Kills the server.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RSatUiSession::KillServer() const
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: RSatUiSession::KillServer calling" )
+
+    // Use a dummy arguments table.
+    TIpcArgs arguments( 0 );
+
+    // Request the server shutdown.
+    SendReceive( ESatSShutdown, arguments );
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: RSatUiSession::KillServer exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// RSatUiSession::IsServerStarted
+// Checks if the server is already started.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool RSatUiSession::IsServerStarted() const
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: RSatUiSession::IsServerStarted calling" )
+
+    TFindServer findServer( KSatServerName );
+    TFullName name;
+    TBool started = ( KErrNone == findServer.Next( name ) );
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: RSatUiSession::IsServerStarted exiting" )
+    return started;
+    }
+
+// -----------------------------------------------------------------------------
+// RSatUiSession::CreateRequest
+// Creates Send Receive request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RSatUiSession::CreateRequest(
+    TInt aFunction,
+    const TIpcArgs& aArgs,
+    TRequestStatus& aStatus ) const
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: RSatUiSession::CreateRequest calling" )
+
+    SendReceive( aFunction, aArgs, aStatus );
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: RSatUiSession::CreateRequest exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// RSatUiSession::CreateRequest
+// Creates Send Receive request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RSatUiSession::CreateRequest(
+    TInt aFunction,
+    const TIpcArgs& aArgs ) const
+    {
+    LOG( SIMPLE, "SATINTERNALCLIENT: RSatUiSession::CreateRequest calling" )
+
+    SendReceive( aFunction, aArgs );
+
+    LOG( SIMPLE, "SATINTERNALCLIENT: RSatUiSession::CreateRequest exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// RSatUiSession::SatUiObserver
+// Returns a pointer to a client observer object.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MSatUiObserver* RSatUiSession::SatUiObserver()
+    {
+    LOG( SIMPLE, 
+    "SATINTERNALCLIENT: RSatUiSession::SatUiObserver calling-exiting" )
+    return iSatUiObserver;
+    }
+
+// -----------------------------------------------------------------------------
+// RSatUiSession::CommandProcessor
+// Returns a pointer to a command processor object.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CSatCCommandProcessor* RSatUiSession::CommandProcessor()
+    {
+    LOG( SIMPLE, 
+    "SATINTERNALCLIENT: RSatUiSession::CommandProcessor calling-exiting" )
+    return iCommandProcessor;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatServer/BWINS/SATSERVERU.DEF	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	?WinsMain@@YAHPAX@Z @ 1 NONAME ; int __cdecl WinsMain(void *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatServer/EABI/SatServerU.DEF	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,2 @@
+EXPORTS
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatServer/group/SatServer.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2003-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 SatServer
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../inc/SatMacroes.h"
+
+TARGET                  SatServer.exe
+TARGETTYPE              exe
+UID                     0x1000008d 0x1000A833
+SECUREID                0x1000A833
+
+CAPABILITY              CAP_SERVER NetworkControl AllFiles
+VENDORID                VID_DEFAULT
+
+#ifdef ENABLE_SAT_LOGGING
+EPOCSTACKSIZE           0x4000 // Logging needs more stack than default 8 kilos.
+#endif
+
+TARGETPATH              PROGRAMS_DIR
+
+#if defined( EABI )
+deffile                 ../EABI/ 
+#endif
+
+SOURCEPATH              ../src
+SOURCE                  std.cpp
+
+USERINCLUDE             ../inc
+USERINCLUDE             ../../inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+SYSTEMINCLUDE           ../../../../inc         // Domain telephony
+SYSTEMINCLUDE           ../../../inc            // Subsystem satengine
+
+LIBRARY                 euser.lib
+LIBRARY                 SatEngine.lib
+
+#ifdef ENABLE_SAT_LOGGING
+LIBRARY                 flogger.lib
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatServer/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,23 @@
+/*
+* 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:  Build information file for project SatServer
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+SatServer.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatServer/inc/SatSPanic.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* 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:  Declares panic function and panic codes for SatServer.
+*
+*/
+
+
+
+#ifndef SATSPANIC_H
+#define SATSPANIC_H
+
+// DATA TYPES
+enum TSatSPanicCode
+    {
+    ESatSBadRequest,
+    ESatSBadDescriptor,
+    ESatSMainSchedulerError,
+    ESatSCreateServer,
+    ESatSStartServer,
+    ESatSCreateTrapCleanup,
+    ESatSNotImplementedYet,
+    ESatSNonNumericString,
+    ESatSCommandError,
+    ESatSUnsupportedEvent
+    };
+
+// FUNCTION PROTOTYPES
+void PanicSatServer( TSatSPanicCode aPanicCode );
+
+#endif      // SATSPANIC_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SatServer/src/std.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,141 @@
+/*
+* 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:  General functions
+*
+*/
+
+
+#include    <e32base.h>
+#include    <data_caging_path_literals.hrh>
+#include    "SatServerFactory.h"
+#include    "CSatSScheduler.h"
+#include    "SatSPanic.h"
+#include    "SatLog.h"
+
+const TInt8 KInitServerPop( 2 );
+_LIT( KSatServerMtx, "SATSERVERMTX" );
+
+// ======== LOCAL FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// PanicServer
+// Panics the SatServer.
+// -----------------------------------------------------------------------------
+//
+void PanicServer(
+    TSatSPanicCode aPanicCode ) // Panic code
+    {
+    LOG( SIMPLE, "SATSERVER: PanicServer" )
+    User::Panic( KSatServerPanic, aPanicCode );
+    }
+
+// -----------------------------------------------------------------------------
+// InitServerL
+// Initialises the SatServer.
+// -----------------------------------------------------------------------------
+//
+LOCAL_C void InitServerL()
+    {
+    LOG( SIMPLE, "SATSERVER: InitServerL calling" )
+
+    RMutex serverStartMutex;
+    TInt createErr( serverStartMutex.CreateGlobal( KSatServerMtx ) );
+    if ( createErr )
+        {
+        TInt openErr( serverStartMutex.OpenGlobal( KSatServerMtx ) );
+        User::LeaveIfError( openErr );
+        LOG( SIMPLE, "SATSERVER:   Opened SATSERVERMTX" )
+        }
+
+    LOG( SIMPLE, "SATSERVER:   Asking ownership of SATSERVERMTX" )
+    serverStartMutex.Wait();
+    LOG( SIMPLE, "SATSERVER:   Got ownership of SATSERVERMTX" )
+
+    // create server - if one of this name does not already exist
+    TFindServer findSatServer( KSatServerName );
+    TFullName pathName;
+
+    // Search for the server.
+    if ( KErrNone != findSatServer.Next( pathName ) )
+        {
+        // We don't already exist.
+        // Start scheduler and server.
+        CSatSScheduler* scheduler = new ( ELeave ) CSatSScheduler;
+        __ASSERT_ALWAYS( scheduler !=
+            NULL, PanicServer( ESatSMainSchedulerError ) );
+
+        CleanupStack::PushL( scheduler );
+        CActiveScheduler::Install( scheduler );
+
+        // Rename the thread.
+        User::RenameThread( KSatServerName );
+
+        // Create the server and connect to external interfaces.
+        CSatSServer* server = CreateSatServerL();
+        CleanupStack::PushL( server );
+
+        // The scheduler needs access to the server instance.
+        //lint -e{613} scheduler cannot be null, due assertion in creation.
+        scheduler->SetServer( server );
+
+        // Call Rendezvous to improve startup time
+        RProcess::Rendezvous( KErrNone );
+
+        LOG( SIMPLE,
+            "SATSERVER:   Releasing ownership of SATSERVERMTX, Starting.." )
+        serverStartMutex.Signal();
+
+        // start fielding requests from clients
+        CActiveScheduler::Start();
+
+        // finished when the scheduler stops
+        CleanupStack::PopAndDestroy( KInitServerPop ); // scheduler, server
+        }
+    else
+        {
+        LOG( SIMPLE,
+            "SATSERVER:   Releasing ownership of SATSERVERMTX, Already started" )
+        serverStartMutex.Signal();
+        }
+    serverStartMutex.Close();
+    LOG( SIMPLE, "SATSERVER: InitServerL exiting" )
+    }
+
+// ======== GLOBAL FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// E32Main implements the executable entry function.
+// Target type of the SATServer module is EXE.
+// Creates a cleanup stack and runs the server.
+// -----------------------------------------------------------------------------
+//
+GLDEF_C TInt E32Main()
+    {
+    __UHEAP_MARK;
+
+    // Get a new clean-up stack.
+    CTrapCleanup* cleanup = CTrapCleanup::New();
+
+    // Initialize and run the server.
+    TRAPD( error, InitServerL() );
+    __ASSERT_ALWAYS( !error, User::Panic( KSatSInitError, error ) );
+
+    // Destroy clean-up stack.
+    delete cleanup;
+
+    __UHEAP_MARKEND;
+    // Not called unless server is already running. This server is always on
+    LOG( SIMPLE, "SATSERVER: E32Main exiting" )
+    return KErrAlreadyExists;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SystemState/BMARM/SATSYSTEMSTATEU.DEF	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,4 @@
+EXPORTS
+	CreateIdleModeChangeNotifierL__22TSatSystemStateFactoryR23MSatSystemStateObserver @ 1 NONAME R3UNUSED ; TSatSystemStateFactory::CreateIdleModeChangeNotifierL(MSatSystemStateObserver &)
+	CreateSystemStateL__22TSatSystemStateFactoryR12RMobilePhone @ 2 NONAME R3UNUSED ; TSatSystemStateFactory::CreateSystemStateL(RMobilePhone &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SystemState/BWINS/SATSYSTEMSTATEU.DEF	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,9 @@
+EXPORTS
+	?CreateIdleModeChangeNotifierL@TSatSystemStateFactory@@SAPAVMSatSystemStateChangeNotifier@@AAVMSatSystemStateObserver@@@Z @ 1 NONAME ; class MSatSystemStateChangeNotifier * TSatSystemStateFactory::CreateIdleModeChangeNotifierL(class MSatSystemStateObserver &)
+	?CreateLanguageSelectionChangeNotifierL@TSatSystemStateFactory@@SAPAVMSatSystemStateChangeNotifier@@AAVMSatSystemStateObserver@@@Z @ 2 NONAME ; class MSatSystemStateChangeNotifier * TSatSystemStateFactory::CreateLanguageSelectionChangeNotifierL(class MSatSystemStateObserver &)
+	?CreateSIMAccessProfileChangeNotifierL@TSatSystemStateFactory@@SAPAVMSatSystemStateChangeNotifier@@AAVMSatSystemStateObserver@@@Z @ 3 NONAME ; class MSatSystemStateChangeNotifier * TSatSystemStateFactory::CreateSIMAccessProfileChangeNotifierL(class MSatSystemStateObserver &)
+	?CreateSimStatusChangeNotifierL@TSatSystemStateFactory@@SAPAVMSatSystemStateChangeNotifier@@AAVMSatSystemStateObserver@@@Z @ 4 NONAME ; class MSatSystemStateChangeNotifier * TSatSystemStateFactory::CreateSimStatusChangeNotifierL(class MSatSystemStateObserver &)
+	?CreateSystemStateL@TSatSystemStateFactory@@SAPAVMSatSystemState@@AAVMSatMultiModeApi@@@Z @ 5 NONAME ; class MSatSystemState * TSatSystemStateFactory::CreateSystemStateL(class MSatMultiModeApi &)
+	?CreateProfileChangeNotifierL@TSatSystemStateFactory@@SAPAVMSatSystemStateChangeNotifier@@AAVMSatSystemStateObserver@@@Z @ 6 NONAME ; class MSatSystemStateChangeNotifier * TSatSystemStateFactory::CreateProfileChangeNotifierL(class MSatSystemStateObserver &)
+	?CreateStartupChangeNotifierL@TSatSystemStateFactory@@SAPAVMSatSystemStateChangeNotifier@@AAVMSatSystemStateObserver@@@Z @ 7 NONAME ; class MSatSystemStateChangeNotifier * TSatSystemStateFactory::CreateStartupChangeNotifierL(class MSatSystemStateObserver &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SystemState/EABI/SatSystemStateU.DEF	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,17 @@
+EXPORTS
+	_ZN22TSatSystemStateFactory18CreateSystemStateLER16MSatMultiModeApi @ 1 NONAME
+	_ZN22TSatSystemStateFactory28CreateProfileChangeNotifierLER23MSatSystemStateObserver @ 2 NONAME
+	_ZN22TSatSystemStateFactory28CreateStartupChangeNotifierLER23MSatSystemStateObserver @ 3 NONAME
+	_ZN22TSatSystemStateFactory29CreateIdleModeChangeNotifierLER23MSatSystemStateObserver @ 4 NONAME
+	_ZN22TSatSystemStateFactory30CreateSimStatusChangeNotifierLER23MSatSystemStateObserver @ 5 NONAME
+	_ZN22TSatSystemStateFactory37CreateSIMAccessProfileChangeNotifierLER23MSatSystemStateObserver @ 6 NONAME
+	_ZN22TSatSystemStateFactory38CreateLanguageSelectionChangeNotifierLER23MSatSystemStateObserver @ 7 NONAME
+	_ZTI15CSatSystemState @ 8 NONAME ; #<TI>#
+	_ZTI20CSatPSChangeNotifier @ 9 NONAME ; #<TI>#
+	_ZTI24CSatCenRepChangeNotifier @ 10 NONAME ; #<TI>#
+	_ZTI27CSatNetworkRegStatusMonitor @ 11 NONAME ; #<TI>#
+	_ZTV15CSatSystemState @ 12 NONAME ; #<VT>#
+	_ZTV20CSatPSChangeNotifier @ 13 NONAME ; #<VT>#
+	_ZTV24CSatCenRepChangeNotifier @ 14 NONAME ; #<VT>#
+	_ZTV27CSatNetworkRegStatusMonitor @ 15 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SystemState/group/SatSystemState.mmp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,56 @@
+/*
+* 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:  Project definition file for project SatSystemState
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../inc/SatMacroes.h"
+
+TARGET                  SatSystemState.dll
+TARGETTYPE              dll
+UID                     0x1000008d 0x1000f200
+
+CAPABILITY              CAP_GENERAL_DLL
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  std.cpp
+SOURCE                  CSatSystemState.cpp
+SOURCE                  TSatSystemStateFactory.cpp
+SOURCE                  CSatPSChangeNotifier.cpp
+SOURCE                  CSatCenRepChangeNotifier.cpp
+SOURCE                  csatnetworkregstatusmonitor.cpp
+
+USERINCLUDE             ../inc
+USERINCLUDE             ../../inc
+
+// Application layer systeminclude is needed due P&S and CR keys provided by ProfileEngine
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/connect
+SYSTEMINCLUDE           ../../../../inc         // Domain telephony
+SYSTEMINCLUDE           ../../../inc            // Subsystem satengine
+
+LIBRARY                 euser.lib
+LIBRARY                 etel.lib
+LIBRARY                 etelmm.lib
+LIBRARY                 msgs.lib                // For CMsvSession
+LIBRARY                 smcm.lib                // For CSmsNumber
+LIBRARY                 centralrepository.lib   // For Central Repository
+
+#ifdef ENABLE_SAT_LOGGING
+LIBRARY                 flogger.lib
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SystemState/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 Systemstate
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+SatSystemState.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SystemState/inc/CSatCenRepChangeNotifier.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,155 @@
+/*
+* 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:  Notifies the changes in central repository values.
+*
+*/
+
+
+
+#ifndef CSATCENREPCHANGENOTIFIER_H
+#define CSATCENREPCHANGENOTIFIER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "MSatSystemStateChangeNotifier.h"
+
+// FORWARD DECLARATION
+class MSatSystemStateObserver;
+class CRepository;
+
+// CLASS DECLARATION
+
+/**
+*  Notifies the changes in central repository values.
+*
+*  @lib SatSystemState
+*  @since Series 60 3.0
+*/
+class CSatCenRepChangeNotifier : public CActive,
+                                 public MSatSystemStateChangeNotifier
+    {
+    public: // Enums
+
+        /**
+        * Identifier for the value type that is being observered.
+        */
+        enum TCenRepTypes
+            {
+            // Type is TInt
+            ECRTypeInteger,
+             // Type is TReal
+            ECRTypeReal,
+             // Type is TDesC8
+            ECRTypeDesC8,
+            // Type is TDesC16
+            ECRTypeDesC16,
+            // Type not defined
+            ECRTypeUnknown
+            };
+
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aCenRepCategory This is the CR Category.
+        * @param aCenRepId CR value id to be listened.
+        * @param aObserver A class that is notified when value changes.
+        * @param aCenRepType Identifies the base type of the observered value,
+        *        which can be TInt, TDesC or TReal. Default is Unknown.
+        */
+        static CSatCenRepChangeNotifier* NewL(
+            const TUid& aCenRepCategory,
+            TUint32 aCenRepId,
+            MSatSystemStateObserver& aObserver,
+            TInt aCenRepType );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSatCenRepChangeNotifier();
+
+    public: // Functions from base classes
+
+        /**
+        * From MSatSystemStateChangeNotifier Request a notification of a
+        * change in system state.
+        */
+        void NotifyChangeL();
+
+        /**
+        * From MSatSystemStateChangeNotifier Cancels the notification request.
+        */
+        void CancelNotify();
+
+    protected:  // Functions from base classes
+
+        /**
+        * From CActive
+        */
+        void DoCancel();
+
+        /**
+        * From CActive.
+        */
+        void RunL();
+
+    private: // New methods
+
+        /**
+        * Makes the request and activates the active object.
+        */
+        void ActivateL();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        * @param aCenRepCategory This is the CR Category.
+        * @param aCenRepId CR value id to be listened.
+        * @param aObserver A class that is notified when value changes.
+        * @param aCenRepType Identifies the base type of the observered value
+        */
+        CSatCenRepChangeNotifier(
+            const TUid& aCenRepCategory,
+            TUint32 aCenRepId,
+            MSatSystemStateObserver& aObserver,
+            TInt aCenRepType );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private:    // Data
+
+        // Change observer.
+        MSatSystemStateObserver& iObserver;
+
+        // Central repository class.
+        CRepository* iCenRepClient;
+
+        // CenRep category
+        TUid iCenRepCategory;
+
+        // CenRep value to listen
+        TUint32 iCenRepId;
+
+        // CR value type
+        TInt iCenRepType;
+
+    };
+
+#endif      // CSATCENREPCHANGENOTIFIER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SystemState/inc/CSatPSChangeNotifier.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,137 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 the changes in publish and suscripe properties.
+*
+*/
+
+
+
+#ifndef CSATPSCHANGENOTIFIER_H
+#define CSATPSCHANGENOTIFIER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <e32property.h>
+#include "MSatSystemStateChangeNotifier.h"
+
+// FORWARD DECLARATION
+class MSatSystemStateObserver;
+
+// CLASS DECLARATION
+
+/**
+*  Notifies the changes in publish and suscripe properties.
+*
+*  @lib SatSystemState
+*  @since Series 60 3.0
+*/
+class CSatPSChangeNotifier : public CActive,
+                             public MSatSystemStateChangeNotifier
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aPropertyKey This is the P&S key.
+        * @param aPropertyValue Value of the P&S key.
+        * @param aObserver A class that is notified when value changes.
+        * @param aNotifyValue Defines the value that causes the notification.
+        */
+        static CSatPSChangeNotifier* NewL(
+            const TUid& aPropertyKey,
+            TUint aPropertyValue,
+            MSatSystemStateObserver& aObserver,
+            TInt aNotifyValue = -1 );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSatPSChangeNotifier();
+
+    public: // Functions from base classes
+
+        /**
+        * From MSatSystemStateChangeNotifier Request a notification of a
+        * change in system state.
+        */
+        void NotifyChangeL();
+
+        /**
+        * From MSatSystemStateChangeNotifier Cancels the notification request.
+        */
+        void CancelNotify();
+               
+        /**
+        * From MSatSystemStateChangeNotifier Gets the current value.
+        * @return Current value for earlier request.
+        */
+        TInt GetValueInt();
+
+    protected:  // Functions from base classes
+
+        /**
+        * From CActive
+        */
+        void DoCancel();
+
+        /**
+        * From CActive.
+        */
+        void RunL();
+
+    private: // New methods
+
+        /**
+        * Makes the request and activates the active object.
+        */
+        void Activate();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        * @param aPropertyKey This is the P&S key.
+        * @param aPropertyValue Value of the P&S key.
+        * @param aObserver A class that is notified when value changes.
+        * @param aNotifyValue Defines the value that causes the notification.
+        */
+        CSatPSChangeNotifier(
+            const TUid& aPropertyKey,
+            TUint aPropertyValue,
+            MSatSystemStateObserver& aObserver,
+            TInt aNotifyValue );
+
+    private:    // Data
+
+        // Change observer.
+        MSatSystemStateObserver& iObserver;
+
+        // Publish & suscripe handle.
+        RProperty iPSClient;
+
+        // Publish&Suscripe property key
+        TUid iPSKey;
+
+        // Publish&Suscripe property value
+        TUint iPSValue;
+
+        // Value of the property when observer should be notified
+        // If this is not set, the changed value is sent to observer
+        TInt iNotifyValue;
+
+    };
+
+#endif      // CSATPSCHANGENOTIFIER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SystemState/inc/CSatSystemState.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,215 @@
+/*
+* 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:  Provides system state information to SAT Server
+*
+*/
+
+
+
+#ifndef CSATSYSTEMSTATE_H
+#define CSATSYSTEMSTATE_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <e32property.h>
+#include <msvapi.h>
+#include "MSatSystemState.h"
+#include "csatnetworkregstatusmonitor.h"
+
+// PREDEFINED CLASS
+class MSatMultiModeApi;
+
+// CONSTANTS
+const TInt KMaxSCANumberSize = 251;
+
+/**
+*  Accessors for system state information.
+*
+*  @lib SatSystemState
+*  @since Series 60 3.0
+*/
+class CSatSystemState : public CBase,
+                        public MSatSystemState,
+                        public MMsvSessionObserver
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aPhone Reference to mobile phone
+        */
+        static MSatSystemState* NewL( MSatMultiModeApi& aPhone );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSatSystemState();
+
+    public: // Functions from base classes
+
+        /**
+        * From MSatSystemState Gets the network registrtaion status
+        * @return Mobile phone's registration status
+        */
+        RMobilePhone::TMobilePhoneRegistrationStatus
+            GetNetworkRegistrationStatus();
+
+        /**
+        * From MSatSystemState Checks is call active.
+        * @return TBool indicating wether call is active or not
+        */
+        TBool IsCallActive();
+
+        /**
+        * From MSatSystemState Checks is call active.
+        * @return TBool indicating wether call is coming or not
+        */
+        TBool IsCallIncoming();
+
+        /**
+        * From MSatSystemState Gets SCA number from CommsDB and
+        * returns it.
+        * @return SCANumber from CommsDB.
+        */
+        const TDesC& SCANumber();
+
+        /**
+        * From MSatSystemState Checks is phone in silent mode.
+        * @return TBool indicating wether phone is in silent mode
+        */
+        TBool IsSilentMode();
+
+        /**
+        * From MSatSystemState Checks is phone in idle state.
+        * @return TBool indicating wether phone is in idle mode
+        */
+        TBool IsPhoneInIdleStateL();
+
+        /**
+        * From MSatSystemState Checks is screen saver actived from idle.
+        * @return TBool indicating whether screen saver is actived from idle.
+        */
+        TBool IsScreenSaverActivedFromIdle();
+        
+        /**
+        * From MSatSystemState Sets time between language selection and reboot.
+        * @param aTime Time before reboot.
+        * @return KErrNone if time is set successfully.
+        */
+        TInt WriteLanguageSelectionTime(
+            TInt aTime );
+
+        /**
+        * From MSatSystemState Puts proactive Idle Mode Text command data to
+        * shared data.
+        * @param aString Idle mode text string
+        * @param aIconId Idle mode text icon ID
+        * @param aIconQualifier Idle mode text icon qualifier
+        * @return KErrNone if setting data is OK
+        */
+        TInt WriteSetIdleModeText(
+            const TDesC& aString,
+            TInt aIconId,
+            RSat::TIconQualifier aIconQualifier );
+
+        /**
+        * From MSatSystemState Checks is backup / restore process ongoing.
+        * @return TBool indicating is process ongoing or not.
+        */
+        TBool IsBackupProcessOngoing();
+
+        /**
+        * From MSatSystemState Checks is ConfirmSatOperations on.
+        * @return TBool indicating is confirmation on or off.
+        */
+        TBool IsConfirmSatOperationsOn();
+
+        /**
+        * From MSatSystemState Gets the display language from
+        * CentRep and returns it.
+        * @return ID indicating the selected language.
+        */
+        TInt DisplayTextLanguage();
+
+        /**
+        * Checks is Bluetooth SIM Access Profile active
+        * @return ETrue if BT SAP is active
+        */
+        TBool IsBtSapActive();
+
+        /**
+        * From MMsvSessionObserver Indicates an event has occurred from a
+        * Message Server session.
+        * @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*/) {};
+            
+        /**
+        * From MSatSystemState Checks are phone warnings and game tones on.
+        * @return TBool indicating wether phone are warnings and game tone on.
+        */
+        TBool IsWarningAndGameTonesOn();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        * @param aPhone Reference to mobile phone
+        */
+        CSatSystemState( MSatMultiModeApi& aPhone );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL( MSatMultiModeApi& aPhone );
+
+        /**
+        * Reads current Short Message Service Center Address.
+        * @param aAddress The reference for SCA number.
+        */
+        void ReadCurrentSMSCL( TDes& aAddress );
+
+        /**
+        * Specifies an entry in the Message Server index.
+        * @param aSession The current message server session.
+        * @param aMtm The SMS messaging type module UID.
+        * @return The entry in the Message Server index.
+        */
+        TMsvId ServiceForMTML(
+            CMsvSession& aSession,
+            const TUid& aMtm ) const;
+
+    private:    // Data
+
+        // Network registration status monitor
+        CSatNetworkRegStatusMonitor* iNetworkRegStatusMonitor;
+
+        // Descriptor for SCA number
+        TBuf<KMaxSCANumberSize> iScaAddress;
+
+        // Reference for MSatMultiModeApi
+        MSatMultiModeApi& iPhone;
+
+    };
+
+#endif      // CSATSYSTEMSTATE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SystemState/inc/Panic.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,36 @@
+/*
+* 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:  Panic function
+*
+*/
+
+
+
+#ifndef PANIC_H
+#define PANIC_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// ENUM
+enum TSatSystemStatePanic
+    {
+    ESatSystemStateAllReadyActive
+    };
+
+void Panic( TSatSystemStatePanic aPanic );
+
+#endif      // PANIC_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SystemState/inc/csatnetworkregstatusmonitor.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,103 @@
+/*
+* 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:  Network registration status monitor.
+*
+*/
+
+
+
+#ifndef CSATNETWORKREGSTATUSMONITOR_H
+#define CSATNETWORKREGSTATUSMONITOR_H
+
+#include <e32base.h>
+#include <e32svr.h>
+#include <satcs.h>
+#include "msatmultimodeapi.h"
+
+/**
+ *  Network registration status monitor
+ *
+ *  Initiates asynchronous operation to get current network registration
+ *  status. After it has been got, initiates monitor change of its value.
+ *
+ *  @lib SystemState
+ *  @since S60 v3.1
+ */
+class CSatNetworkRegStatusMonitor : public CActive
+    {
+
+public:
+
+    static CSatNetworkRegStatusMonitor* NewL( MSatMultiModeApi& aPhone );
+
+    virtual ~CSatNetworkRegStatusMonitor();
+
+    /**
+     * Activate network registration status monitor.
+     */
+    void Start();
+
+    /**
+     * Fetch current network registration status.
+     * On error returns ERegistrationUnknown.
+     *
+     * @return Current network registration status.
+     */
+    RMobilePhone::TMobilePhoneRegistrationStatus CurrentValue();
+
+protected:
+
+    /**
+     * From CActive
+     * Implements cancellation of an outstanding request.
+     */
+    void DoCancel();
+
+    /**
+     * From CActive
+     * Handles an active object's request completion event.
+     */
+    void RunL();
+
+private:
+
+    CSatNetworkRegStatusMonitor( MSatMultiModeApi& aPhone );
+
+private: // data
+
+    /**
+     * Current value of network registration status.
+     */
+    RMobilePhone::TMobilePhoneRegistrationStatus iRegistrationStatus;
+
+    /**
+     * iRegistrationStatus first value has not yet been got
+     * after starting this monitor.
+     */
+    TBool iWaitingRegistrationStatus;
+
+    /**
+     * Blocker for synchronous requests.
+     */
+    CActiveSchedulerWait iWait;
+
+    /**
+     * Phone instance.
+     * Not own.
+     */
+    MSatMultiModeApi& iPhone;
+
+    };
+
+#endif // CSATNETWORKREGSTATUSMONITOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SystemState/src/CSatCenRepChangeNotifier.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,269 @@
+/*
+* 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:  Notifies the changes in central repository values.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <centralrepository.h>
+#include    "CSatCenRepChangeNotifier.h"
+#include    "MSatSystemStateObserver.h"
+#include    "Panic.h"
+#include    "SatLog.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSatCenRepChangeNotifier::CSatCenRepChangeNotifier
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatCenRepChangeNotifier::CSatCenRepChangeNotifier(
+    const TUid& aCenRepCategory,
+    TUint32 aCenRepId,
+    MSatSystemStateObserver& aObserver,
+    TInt aCenRepType ) :
+    CActive( EPriorityStandard ),
+    iObserver( aObserver ),
+    iCenRepCategory( aCenRepCategory ),
+    iCenRepId( aCenRepId ),
+    iCenRepType( aCenRepType )
+    {
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatCenRepChangeNotifier::\
+        CSatCenRepChangeNotifier calling" )
+    // Log parameters
+    LOG2( NORMAL, "SATSYSTEMSTATE: CSatCenRepChangeNotifier::\
+        CSatCenRepChangeNotifier Category: %d", aCenRepCategory )
+    LOG2( NORMAL, "SATSYSTEMSTATE: CSatCenRepChangeNotifier::\
+        CSatCenRepChangeNotifier ID: %d", aCenRepId )
+    LOG2( NORMAL, "SATSYSTEMSTATE: CSatCenRepChangeNotifier::\
+        CSatCenRepChangeNotifier Type: %d ", aCenRepType )
+
+    CActiveScheduler::Add( this );
+
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatCenRepChangeNotifier::\
+        CSatCenRepChangeNotifier exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCenRepChangeNotifier::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatCenRepChangeNotifier* CSatCenRepChangeNotifier::NewL(
+    const TUid& aCenRepCategory,
+    TUint32 aCenRepId,
+    MSatSystemStateObserver& aObserver,
+    TInt aCenRepType )
+    {
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatCenRepChangeNotifier::NewL calling" )
+
+    CSatCenRepChangeNotifier* self =
+        new( ELeave ) CSatCenRepChangeNotifier(
+            aCenRepCategory, aCenRepId, aObserver, aCenRepType );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatCenRepChangeNotifier::NewL exiting" )
+    return self;
+    }
+
+
+// Destructor
+CSatCenRepChangeNotifier::~CSatCenRepChangeNotifier()
+    {
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatCenRepChangeNotifier::\
+        ~CSatCenRepChangeNotifier calling" )
+
+    Cancel();
+    if ( iCenRepClient )
+        {
+        delete iCenRepClient;
+        iCenRepClient = NULL;
+        }
+
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatCenRepChangeNotifier::\
+        ~CSatCenRepChangeNotifier exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCenRepChangeNotifier::ConstructL
+// Creates central repository object.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatCenRepChangeNotifier::ConstructL()
+    {
+    LOG( SIMPLE,
+        "SATSYSTEMSTATE: CSatCenRepChangeNotifier::ConstructL calling" )
+
+    iCenRepClient = CRepository::NewL( iCenRepCategory );
+
+    LOG( SIMPLE,
+        "SATSYSTEMSTATE: CSatCenRepChangeNotifier::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCenRepChangeNotifier::NotifyChangeL
+// Issues notification request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatCenRepChangeNotifier::NotifyChangeL()
+    {
+    LOG( SIMPLE,
+        "SATSYSTEMSTATE: CSatCenRepChangeNotifier::NotifyChangeL calling" )
+
+    __ASSERT_ALWAYS( !IsActive(), Panic( ESatSystemStateAllReadyActive ) );
+    ActivateL();
+
+    LOG( SIMPLE,
+        "SATSYSTEMSTATE: CSatCenRepChangeNotifier::NotifyChangeL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCenRepChangeNotifier::CancelNotify
+// Cancels outstanding request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatCenRepChangeNotifier::CancelNotify()
+    {
+    LOG( SIMPLE,
+        "SATSYSTEMSTATE: CSatCenRepChangeNotifier::CancelNotify calling" )
+
+    Cancel();
+
+    LOG( SIMPLE,
+        "SATSYSTEMSTATE: CSatCenRepChangeNotifier::CancelNotify exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCenRepChangeNotifier::DoCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatCenRepChangeNotifier::DoCancel()
+    {
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatCenRepChangeNotifier::DoCancel calling" )
+
+    // Cancel all notifications. This causes notification mechanism to return
+    // KInvalidNotificationId in the RunL function, so it must be handled there.
+    iCenRepClient->NotifyCancelAll();
+
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatCenRepChangeNotifier::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCenRepChangeNotifier::RunL
+// Activates the request again and calls the observer.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatCenRepChangeNotifier::RunL()
+    {
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatCenRepChangeNotifier::RunL calling" )
+
+    // In CenRep CRepository returns the key for the changed value in iStatus.
+    const TUint32 cenRepId( iStatus.Int() );
+    LOG2( NORMAL, "SATSYSTEMSTATE: CSatCenRepChangeNotifier::RunL \
+    iStatus: %d", iStatus.Int() )
+    // Makes sure that all the changes are notified.
+    if ( KErrCancel != iStatus.Int() )
+        {
+        ActivateL();
+        }
+        
+    // Check that notification came from that ID we are observing.
+    if ( cenRepId == iCenRepId )
+        {
+        LOG( SIMPLE, 
+        "SATSYSTEMSTATE: CSatCenRepChangeNotifier::RunL cenRepId == iCenRepId" )
+        switch ( iCenRepType )
+            {
+            case ECRTypeInteger:
+                {
+                TInt value;
+                iCenRepClient->Get( iCenRepId, value );
+                LOG2( NORMAL, "SATSYSTEMSTATE: CSatCenRepChangeNotifier::RunL \
+                    Notifying TInt value: %d", value )
+                iObserver.StateChanged( value );
+                break;
+                }
+            case ECRTypeReal:
+                {
+                TReal value;
+                iCenRepClient->Get( iCenRepId, value );
+                LOG2( NORMAL, "SATSYSTEMSTATE: CSatCenRepChangeNotifier::RunL \
+                    Notifying TReal value: %d", value )
+                iObserver.StateChanged( value );
+                break;
+                }
+            case ECRTypeDesC8:
+                {
+                TBuf8<NCentralRepositoryConstants::KMaxBinaryLength> value;
+                iCenRepClient->Get( iCenRepId, value );
+                LOG( NORMAL, "SATSYSTEMSTATE: CSatCenRepChangeNotifier::RunL \
+                    Notifying string value" )
+                iObserver.StateChanged( value );
+                break;
+                }
+            case ECRTypeDesC16:
+                {
+                TBuf16<NCentralRepositoryConstants::KMaxUnicodeStringLength> value;
+                iCenRepClient->Get( iCenRepId, value );
+                LOG( NORMAL, "SATSYSTEMSTATE: CSatCenRepChangeNotifier::RunL \
+                    Notifying Unicode value" )
+                iObserver.StateChanged( value );
+                break;
+                }
+            case ECRTypeUnknown:
+            default:
+                {
+                LOG( NORMAL, "SATSYSTEMSTATE: CSatCenRepChangeNotifier::RunL \
+                    Notifying without value" )
+                // If type is not defined, call StateChanged without parameters
+                iObserver.StateChanged();
+                break;
+                }
+            }
+        }
+
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatCenRepChangeNotifier::RunL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatCenRepChangeNotifier::ActivateL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatCenRepChangeNotifier::ActivateL()
+    {
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatCenRepChangeNotifier::ActivateL calling" )
+
+    // This request notifies all changes in this category, not just the one we
+    // are observing. Thus we have to read the value from CenRep before
+    // notification.
+    User::LeaveIfError( iCenRepClient->NotifyRequest( iCenRepId, iStatus ) );
+    SetActive();
+
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatCenRepChangeNotifier::ActivateL exiting" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SystemState/src/CSatPSChangeNotifier.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,228 @@
+/*
+* 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:  Notifies the changes in publish and suscripe properties.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "CSatPSChangeNotifier.h"
+#include    "MSatSystemStateObserver.h"
+#include    "Panic.h"
+#include    "SatLog.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSatPSChangeNotifier::CSatPSChangeNotifier
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatPSChangeNotifier::CSatPSChangeNotifier(
+    const TUid& aPropertyKey,
+    TUint aPropertyValue,
+    MSatSystemStateObserver& aObserver,
+    TInt aNotifyValue ) :
+    CActive( EPriorityStandard ),
+    iObserver( aObserver ),
+    iPSKey( aPropertyKey ),
+    iPSValue( aPropertyValue ),
+    iNotifyValue( aNotifyValue )
+    {
+    LOG( SIMPLE,
+        "SATSYSTEMSTATE: CSatPSChangeNotifier::CSatPSChangeNotifier calling" )
+    // Log parameters
+    LOG2( NORMAL,
+        "SATSYSTEMSTATE: CSatPSChangeNotifier::CSatPSChangeNotifier PS Uid: %d",
+        aPropertyKey )
+    LOG2( NORMAL,
+        "SATSYSTEMSTATE: CSatPSChangeNotifier::CSatPSChangeNotifier PS Key: %d",
+        aPropertyValue )
+    LOG2( NORMAL,
+        "SATSYSTEMSTATE: CSatPSChangeNotifier::CSatPSChangeNotifier Needed \
+        value: %d ", aNotifyValue )
+
+    CActiveScheduler::Add( this );
+
+    LOG( SIMPLE,
+        "SATSYSTEMSTATE: CSatPSChangeNotifier::CSatPSChangeNotifier exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatPSChangeNotifier::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSatPSChangeNotifier* CSatPSChangeNotifier::NewL(
+    const TUid& aPropertyKey,
+    TUint aPropertyValue,
+    MSatSystemStateObserver& aObserver,
+    TInt aNotifyValue )
+    {
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatPSChangeNotifier::NewL calling" )
+
+    CSatPSChangeNotifier* self =
+        new( ELeave ) CSatPSChangeNotifier(
+            aPropertyKey, aPropertyValue, aObserver, aNotifyValue );
+
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatPSChangeNotifier::NewL exiting" )
+    return self;
+    }
+
+
+// Destructor
+CSatPSChangeNotifier::~CSatPSChangeNotifier()
+    {
+    LOG( SIMPLE,
+        "SATSYSTEMSTATE: CSatPSChangeNotifier::~CSatPSChangeNotifier calling" )
+
+    Cancel();
+    iPSClient.Close();
+
+    LOG( SIMPLE,
+        "SATSYSTEMSTATE: CSatPSChangeNotifier::~CSatPSChangeNotifier exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatPSChangeNotifier::NotifyChangeL
+// Issues notification request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatPSChangeNotifier::NotifyChangeL()
+    {
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatPSChangeNotifier::NotifyChangeL calling" )
+
+    __ASSERT_ALWAYS( !IsActive(), Panic( ESatSystemStateAllReadyActive ) );
+    User::LeaveIfError( iPSClient.Attach( iPSKey, iPSValue ) );
+    Activate();
+
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatPSChangeNotifier::NotifyChangeL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatPSChangeNotifier::CancelNotify
+// Cancels outstanding request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatPSChangeNotifier::CancelNotify()
+    {
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatPSChangeNotifier::CancelNotify calling" )
+
+    Cancel();
+
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatPSChangeNotifier::CancelNotify exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatPSChangeNotifier::DoCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatPSChangeNotifier::DoCancel()
+    {
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatPSChangeNotifier::DoCancel calling" )
+
+    iPSClient.Cancel();
+
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatPSChangeNotifier::DoCancel exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatPSChangeNotifier::RunL
+// Activates the request again and calls the observer.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatPSChangeNotifier::RunL()
+    {
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatPSChangeNotifier::RunL calling" )
+    // Makes sure that all the changes are notified.
+    LOG2( SIMPLE, "SATSYSTEMSTATE:   Failed: %i", iStatus.Int() )
+    if ( KErrNone == iStatus.Int() )
+        {
+        NotifyChangeL();
+
+        // Check the value
+        TInt value = KNotifyValueNotSet;
+
+        // Get the value from P&S
+        RProperty::Get( iPSKey, iPSValue, value );
+
+        // If notify value is set, check the value before notifying observer
+        if ( KNotifyValueNotSet != iNotifyValue )
+            {
+            LOG( SIMPLE, "SATSYSTEMSTATE: CSatPSChangeNotifier::RunL \
+            KNotifyValueNotSet != iNotifyValue" )
+            // If changed P&S value is same as notify value, notify observer
+            if ( value == iNotifyValue )
+                {
+                LOG( SIMPLE, "SATSYSTEMSTATE: CSatPSChangeNotifier::RunL \
+                value == iNotifyValue" )
+                iObserver.StateChanged();
+                }
+            }
+        else
+            {
+            LOG( SIMPLE, "SATSYSTEMSTATE: CSatPSChangeNotifier::RunL \
+            KNotifyValueNotSet == iNotifyValue" )
+            // Notify value not specified -> Send the changed value
+            iObserver.StateChanged( value );
+            }
+        }
+    else if ( KErrCancel == iStatus.Int() )
+        {
+        Activate();
+        }
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatPSChangeNotifier::RunL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatPSChangeNotifier::Activate
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSatPSChangeNotifier::Activate()
+    {
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatPSChangeNotifier::Activate calling" )
+
+    iPSClient.Subscribe( iStatus );
+    SetActive();
+
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatPSChangeNotifier::Activate exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSatPSChangeNotifier::GetValueInt
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CSatPSChangeNotifier::GetValueInt()
+    {
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatPSChangeNotifier::GetValueInt calling" )
+
+    // Gets the value from P&S.
+    TInt value( KNotifyValueNotSet );
+    RProperty::Get( iPSKey, iPSValue, value );
+
+    LOG2( SIMPLE, 
+        "SATSYSTEMSTATE: CSatPSChangeNotifier::GetValueInt exiting %i",
+        value )
+    return value;
+    }
+    
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SystemState/src/CSatSystemState.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,762 @@
+/*
+* 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:  Provides system state information to SAT Server
+*
+*/
+
+
+
+#include    <mtclreg.h>
+#include    <smsclnt.h>
+#include    <smutset.h>
+#include    <PSVariables.h>             // Publish & Suscribe keys
+#include    <centralrepository.h>       // CRepository
+#include    <CommonEngineDomainCRKeys.h>
+#include    <ProfileEngineSDKCRKeys.h>
+#include    <settingsinternalcrkeys.h>
+#include    <satdomainpskeys.h>
+#define Q_OS_SYMBIAN // needed to activate homescreendomainpskeys.h
+#include    <homescreendomainpskeys.h>
+
+// ******************************************************************
+// TODO: ScreensaverInternalPSKeys.h does no longer exist.
+// Must find an alternative way to check screen locked state.
+// #include    <ScreensaverInternalPSKeys.h>
+// ******************************************************************
+#include    <ctsydomainpskeys.h>
+#include    <sbdefs.h>
+#include    <BTSapDomainPSKeys.h>
+
+#include    "SATInternalPSKeys.h"
+#include    "CSatSystemState.h"
+#include    "msatmultimodeapi.h"
+#include    "SatLog.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSatSystemState::CSatSystemState( MSatMultiModeApi& aPhone ) : iPhone( aPhone )
+    {
+    LOG( SIMPLE,
+        "SATSYSTEMSTATE: CSatSystemState::CSatSystemState calling-exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSatSystemState::ConstructL( MSatMultiModeApi& aPhone )
+    {
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::ConstructL calling" )
+
+    // Define policies
+    TSecurityPolicy readPolicy( ECapabilityReadUserData );
+    TSecurityPolicy writePolicy( ECapabilityWriteUserData );
+
+    TInt err( KErrNone );
+    // Define properties in P&S for SetUpIdleModeTex command
+    err = RProperty::Define( KPSUidSatServerInternal, 
+                             KSatIdleModeText,
+                             RProperty::ELargeText, 
+                             readPolicy, 
+                             writePolicy );
+    LOG2( SIMPLE, 
+          "SATSYSTEMSTATE: CSatSystemState::ConstructL \
+          Define KSatIdleModeText err: %i", err )
+
+    err = RProperty::Define( KPSUidSatServerInternal, 
+                             KSatIdleModeTextIconId,
+                             RProperty::EInt, 
+                             readPolicy, 
+                             writePolicy );
+    LOG2( SIMPLE, 
+         "SATSYSTEMSTATE: CSatSystemState::ConstructL \
+         Define KSatIdleModeTextIconId err: %i", err )                       
+
+    err = RProperty::Define( KPSUidSatServerInternal, 
+                             KSatIdleModeTextIconQualifier,
+                             RProperty::EInt, 
+                             readPolicy, 
+                             writePolicy );
+    LOG2( SIMPLE, 
+          "SATSYSTEMSTATE: CSatSystemState::ConstructL \
+          Define KSatIdleModeTextIconQualifier err: %i", err )                         
+
+    // Set default (empty) values
+    WriteSetIdleModeText( KNullDesC, KErrNotFound, RSat::ENoIconId );
+
+    err = RProperty::Define( KPSUidSatServer, 
+                             KSatLanguageSelectionTimeBeforeReboot,
+                             RProperty::EInt, 
+                             readPolicy, 
+                             writePolicy );
+    LOG2( SIMPLE, 
+          "SATSYSTEMSTATE: CSatSystemState::ConstructL \
+          Define KSatLanguageSelectionTimeBeforeReboot err: %i", err )                        
+
+    // Create Network Registration Status Monitor.
+    iNetworkRegStatusMonitor = CSatNetworkRegStatusMonitor::NewL( aPhone );
+
+    // Start Network Registration Status Monitor.
+    iNetworkRegStatusMonitor->Start();
+
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::ConstructL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+MSatSystemState* CSatSystemState::NewL( MSatMultiModeApi& aPhone )
+    {
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::NewL calling" )
+
+    CSatSystemState* self = new( ELeave ) CSatSystemState( aPhone );
+    CleanupStack::PushL( self );
+    self->ConstructL( aPhone );
+    CleanupStack::Pop( self );
+
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::NewL exiting" )
+    return self;
+    }
+
+
+// Destructor
+CSatSystemState::~CSatSystemState()
+    {
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::~CSatSystemState calling" )
+
+    delete iNetworkRegStatusMonitor;
+    iNetworkRegStatusMonitor = NULL;
+
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::~CSatSystemState exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Returns network registration status.
+// -----------------------------------------------------------------------------
+//
+RMobilePhone::TMobilePhoneRegistrationStatus
+    CSatSystemState::GetNetworkRegistrationStatus()
+    {
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::\
+        GetNetworkRegistrationStatus calling-exiting" )
+    return iNetworkRegStatusMonitor->CurrentValue();
+    }
+
+// -----------------------------------------------------------------------------
+// Checks current call status and returns true only if cuurent call status is
+// voice call active.
+// -----------------------------------------------------------------------------
+//
+TBool CSatSystemState::IsCallActive()
+    {
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::IsCallActive calling" )
+    TInt callActiveState = EPSCTsyCallTypeNone;
+
+    // Get current call status from P&S
+    const TInt errCode( RProperty::Get(
+        KPSUidCtsyCallInformation,
+        KCTsyCallType,
+        callActiveState ) );
+
+    // Check current call type
+    TBool result(
+        ( EPSCTsyCallTypeCSVoice == callActiveState ) &&
+        ( KErrNone == errCode ) );
+
+    LOG2(
+        SIMPLE,
+        "SATSYSTEMSTATE: CSatSystemState::IsCallActive exiting with value: %d",
+        result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// Checks current call state and returns true if phone is alerting or ringing.
+// -----------------------------------------------------------------------------
+//
+TBool CSatSystemState::IsCallIncoming()
+    {
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::IsCallIncoming calling" )
+
+    // Using MSatMultiModeApi::IsCallIncoming to check call status instead of
+    // checking P&S key so that we can get the status on time
+    TBool result( iPhone.IsCallIncoming() );
+
+    LOG2( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::IsCallIncoming exiting \
+        with value: %d", result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// Gets the SMS Service center number and returns it.
+// -----------------------------------------------------------------------------
+//
+const TDesC& CSatSystemState::SCANumber()
+    {
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::SCANumber calling" )
+
+    // Null possible previous SCA number
+    iScaAddress = KNullDesC;
+    TBuf<KMaxSCANumberSize> address;
+
+    TRAPD( err, ReadCurrentSMSCL( address ) );
+    LOG2( SIMPLE,
+    "SATSYSTEMSTATE: CSatSystemState::SCANumber err: %d", err )
+    // If any error occurs, return null string.
+    if ( KErrNone != err )
+        {
+        address = KNullDesC;
+        }
+
+    iScaAddress = address;
+
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::SCANumber exiting" )
+    return iScaAddress;
+    }
+
+// -----------------------------------------------------------------------------
+// Method is used when the information of phones silent mode is needed.
+// Returns true if silent mode is on and false otherwise.
+// -----------------------------------------------------------------------------
+//
+TBool CSatSystemState::IsSilentMode()
+    {
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::IsSilentMode calling" )
+    TBool result( EFalse );
+    TInt silenceMode( -1 );
+    CRepository* centRep( NULL );
+
+    TRAPD( err, centRep = CRepository::NewL( KCRUidProfileEngine ) );
+    LOG2( SIMPLE, "SATSYSTEMSTATE:CSatSystemState::IsSilentMode\
+                   CRepository::NewL result: %i", err )
+    if ( ( KErrNone == err ) && centRep )
+        {
+        // Get the needed information from CentRep
+        centRep->Get( KProEngActiveMessageAlert, silenceMode );
+
+        // Delete CentRep
+        delete centRep;
+
+        if ( 0 == silenceMode )
+            {
+            LOG( SIMPLE, "SATSYSTEMSTATE:CSatSystemState::IsSilentMode\
+                          Silent mode" )
+            result = ETrue;
+            }
+        }
+    
+    LOG2(
+        SIMPLE,
+        "SATSYSTEMSTATE: CSatSystemState::IsSilentMode exiting with value: %d",
+        result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// Checks is phone in idle state.
+// -----------------------------------------------------------------------------
+//
+TBool CSatSystemState::IsPhoneInIdleStateL()
+    {
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::IsPhoneInIdleState calling" )
+    TInt idleStatus(EHomeScreenIdleState) ;
+
+    // Get the idle status from P&S
+    User::LeaveIfError( RProperty::Get(
+        KHsCategoryUid, 
+        KHsCategoryStateKey, 
+        idleStatus));
+    // Returns true if phone in idle state. 
+    const TBool result( EHomeScreenIdleState == idleStatus ); 
+
+    LOG2( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::IsPhoneInIdleState exiting \
+        with value: %d", result )
+    return result;
+    }
+    
+// -----------------------------------------------------------------------------
+// Checks is screen saver actived from idle.
+// -----------------------------------------------------------------------------
+//
+TBool CSatSystemState::IsScreenSaverActivedFromIdle()
+    {
+    LOG( SIMPLE, 
+    "SATSYSTEMSTATE: CSatSystemState::IsScreenSaverActivedFromIdle calling" )
+    TBool result( EFalse );
+
+    /*
+    // TODO: This method can no longer be used for checking screen saver status.
+    // Must find an alternative method.
+
+    TInt screenSaverActive( -1 );
+
+    // Get the idle status from P&S
+    TInt err = RProperty::Get( KPSUidScreenSaver, 
+        KScreenSaverActivatedFromIdle, screenSaverActive );
+        
+    if ( KErrNone == err )
+        {
+        // Returns true if screen saver is actived from idle.    
+        if ( screenSaverActive )
+            {
+            result = ETrue;
+            }
+        }
+
+    LOG2( SIMPLE, 
+        "SATSYSTEMSTATE: CSatSystemState:: IsScreenSaverActivedFromIdle \
+         err: %d", err )
+    */
+
+    LOG2( SIMPLE, 
+        "SATSYSTEMSTATE: CSatSystemState:: \
+        IsScreenSaverActivedFromIdle exiting with value: %d", result )
+    return result;    
+    }
+
+// -----------------------------------------------------------------------------
+// Sets time between language selection and reboot.
+// -----------------------------------------------------------------------------
+//
+TInt CSatSystemState::WriteLanguageSelectionTime(
+    TInt aTime )
+    {
+    LOG2( NORMAL,
+    "SATSYSTEMSTATE: CSatSystemState::WriteLanguageSelectionTime calling, \
+    aTime: %d", aTime )
+    TInt errorCode( KErrNone );
+
+    // Set SetUpIdleModeText string
+    errorCode = RProperty::Set(
+        KPSUidSatServer,
+        KSatLanguageSelectionTimeBeforeReboot,
+        aTime );
+    LOG2( NORMAL,
+    "SATSYSTEMSTATE: CSatSystemState::WriteLanguageSelectionTime exiting, \
+    errorCode: %d", errorCode )
+    return errorCode;
+    }
+
+// -----------------------------------------------------------------------------
+// Writes idle mode text and icon ID to P&S.
+// -----------------------------------------------------------------------------
+//
+TInt CSatSystemState::WriteSetIdleModeText(
+    const TDesC& aString,
+    TInt aIconId,
+    RSat::TIconQualifier aIconQualifier )
+    {
+    LOG( SIMPLE,
+        "SATSYSTEMSTATE: CSatSystemState::WriteSetIdleModeText calling" )
+    LOG2(
+        NORMAL,
+        "SATSYSTEMSTATE: CSatSystemState::WriteSetIdleModeText ID: %d",
+        aIconId )
+    TInt errorCode( KErrNone );
+
+    // Set SetUpIdleModeText string
+    errorCode = RProperty::Set(
+        KPSUidSatServerInternal,
+        KSatIdleModeText,
+        aString );
+    LOG2( NORMAL,
+    "SATSYSTEMSTATE: CSatSystemState::WriteSetIdleModeText errorCode: %d",
+     errorCode )
+    if ( KErrNone == errorCode )
+        {
+        // Set SetUpIdleModeText icon
+        errorCode = RProperty::Set(
+            KPSUidSatServerInternal,
+            KSatIdleModeTextIconId,
+            aIconId );
+        if ( KErrNone == errorCode )
+            {
+            // Select qualifier value for icon.
+            TSatIdleModeTextIconQualifierValue qualifier( KSatIdleIconQInit );
+            LOG2( NORMAL,
+            "SATSYSTEMSTATE: CSatSystemState::WriteSetIdleModeText \
+            aIconQualifier: %d", aIconQualifier )
+            switch ( aIconQualifier )
+                {
+                // Icon not present.
+                case RSat::ENoIconId:
+                    {
+                    qualifier = KSatIdleIconQNoIcon;
+                    break;
+                    }
+                // Icon is self explanatory. Displayed instead text string.
+                case RSat::ESelfExplanatory:
+                    {
+                    qualifier = KSatIdleIconQSelfExplanatory;
+                    break;
+                    }
+                // Icon is not self explanatory. Displayed with text string.
+                case RSat::ENotSelfExplanatory:
+                    {
+                    qualifier = KSatIdleIconQNotSelfExplanatory;
+                    break;
+                    }
+                // Icon qualifier is not set.
+                case RSat::EIconQualifierNotSet:
+                default:
+                    {
+                    qualifier = KSatIdleIconQInit;
+                    break;
+                    }
+                }
+
+                LOG2( NORMAL,
+                "SATSYSTEMSTATE: CSatSystemState::WriteSetIdleModeText \
+                IconQualifier: %d", qualifier )
+
+            // Set qualifier for icon.
+            errorCode = RProperty::Set(
+                KPSUidSatServerInternal,
+                KSatIdleModeTextIconQualifier,
+                qualifier );
+            }
+        }
+
+    LOG2( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::WriteSetIdleModeText \
+        exiting with value: %d", errorCode )
+    return errorCode;
+    }
+
+// -----------------------------------------------------------------------------
+// Checks is backup process ongoing.
+// -----------------------------------------------------------------------------
+//
+TBool CSatSystemState::IsBackupProcessOngoing()
+    {
+    LOG( SIMPLE,
+        "SATSYSTEMSTATE: CSatSystemState::IsBackupProcessOngoing calling" )
+    TInt backupState( conn::ENoBackup );
+
+    // Get the backup state from P&S
+    const TInt errCode( RProperty::Get(
+        KUidSystemCategory,
+        conn::KUidBackupRestoreKey,
+        backupState ) );
+
+    TBool result(
+        ( conn::ENoBackup != ( backupState & conn::KBackupIncTypeMask ) )
+        && ( KErrNone == errCode ) );
+
+    LOG2( SIMPLE,
+        "SATSYSTEMSTATE: CSatSystemState::IsBackupProcessOngoing exiting \
+        with value: %d", result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSystemState::IsConfirmSatOperationsOn
+// -----------------------------------------------------------------------------
+//
+TBool CSatSystemState::IsConfirmSatOperationsOn()
+    {
+    LOG( SIMPLE,
+        "SATSYSTEMSTATE: CSatSystemState::IsConfirmSatOperationsOn calling" )
+    TBool result( EFalse );
+    TInt confirmSatOperations( 0 );
+    CRepository* centRep( NULL );
+
+    TRAPD( err, centRep = CRepository::NewL( KCRUidPersonalizationSettings ) );
+    LOG2( SIMPLE, "SATSYSTEMSTATE:   CentRep failed: %i", err )
+    if ( ( KErrNone == err ) && centRep )
+        {
+        // Get the needed information from CentRep
+        centRep->Get( KSettingsConfirmSatOperations, confirmSatOperations );
+
+        // Delete CentRep
+        delete centRep;
+
+        if ( 1 == confirmSatOperations )
+            {
+            LOG( SIMPLE,
+            "SATSYSTEMSTATE: CSatSystemState::IsConfirmSatOperationsOn \
+            1 == confirmSatOperations" )
+            result = ETrue;
+            }
+        }
+    
+    LOG2( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::IsConfirmSatOperationsOn \
+        exiting with value: %d", result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatSystemState::DisplayTextLanguage
+// -----------------------------------------------------------------------------
+//
+TBool CSatSystemState::DisplayTextLanguage()
+    {
+    LOG( SIMPLE,
+        "SATSYSTEMSTATE: CSatSystemState::DisplayTextLanguage calling" )
+    TInt selLanguage( 0 );
+    CRepository* centRep( NULL );
+
+    // Create instance to CentRep
+    TRAPD( err, centRep = CRepository::NewL( KCRUidCommonEngineKeys ) );
+    LOG2( SIMPLE, "SATSYSTEMSTATE:   CentRep failed: %i", err )
+    if ( ( KErrNone == err ) && centRep )
+        {
+        // Get the needed information from CentRep
+        centRep->Get( KGSDisplayTxtLang, selLanguage );
+
+        // Delete CentRep
+        delete centRep;
+        }
+    
+    LOG2( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::DisplayTextLanguage \
+        exiting with value: %d", selLanguage )
+    return selLanguage;
+    }
+
+// -----------------------------------------------------------------------------
+// Checks is BT SAP active
+// -----------------------------------------------------------------------------
+//
+TBool CSatSystemState::IsBtSapActive()
+    {
+    LOG( SIMPLE,
+        "SATSYSTEMSTATE: CSatSystemState::IsBtSapActive calling" )
+    TInt sapActive( EBTSapNotConnected );
+
+    // Get the backup state from P&S
+    const TInt errCode( RProperty::Get(
+        KPSUidBluetoothSapConnectionState,
+        KBTSapConnectionState,
+        sapActive ) );
+
+    LOG2(
+        SIMPLE,
+        "SATSYSTEMSTATE:   RProperty::Get returned value: %i", errCode )
+
+    TBool result( ( ( EBTSapConnecting == sapActive ) ||
+                    ( EBTSapConnected == sapActive ) ) &&
+                    ( KErrNone == errCode ) );
+
+    LOG2(
+        SIMPLE,
+        "SATSYSTEMSTATE: CSatSystemState::IsBtSapActive exiting with value: %i",
+        result )
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// Reads current SMS Center number.
+// -----------------------------------------------------------------------------
+//
+void CSatSystemState::ReadCurrentSMSCL( TDes& aAddress )
+    {
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::ReadCurrentSMSCL calling" )
+
+    aAddress = KNullDesC;
+    TInt status( KErrNone );
+
+    // Open message server connection.
+    CMsvSession* msvSession = CMsvSession::OpenSyncL( *this );
+    CleanupStack::PushL( msvSession );
+
+    CClientMtmRegistry* clientRegistry =
+        CClientMtmRegistry::NewL( *msvSession );
+
+    CleanupStack::PushL( clientRegistry );
+
+    // Get the account.
+    TInt serviceId( ServiceForMTML( *msvSession, KUidMsgTypeSMS ) );
+    if ( KMsvUnknownServiceIndexEntryId != serviceId )
+        {
+        LOG( SIMPLE, 
+        "SATSYSTEMSTATE: CSatSystemState::ReadCurrentSMSCL \
+        KMsvUnknownServiceIndexEntryId != serviceId" )
+        // Read the setting.
+        CSmsClientMtm* mtm =
+            static_cast<CSmsClientMtm*>( clientRegistry->NewMtmL( KUidMsgTypeSMS ) );
+        CleanupStack::PushL( mtm );
+        mtm->SwitchCurrentEntryL( serviceId );
+        mtm->LoadMessageL();
+        // Findout the number.
+        const CSmsSettings& settings = mtm->ServiceSettings();
+
+#ifndef __HIDE_MESSAGING_API_V1__
+        if ( settings.NumSCAddresses() != 0 )
+            {
+            if ( settings.DefaultSC() < settings.NumSCAddresses() )
+                {
+                LOG( SIMPLE, 
+                "SATSYSTEMSTATE: CSatSystemState::ReadCurrentSMSCL \
+                settings.DefaultSC() < settings.NumSCAddresses()" )
+                TPtrC addr = settings.SCAddress( settings.DefaultSC() ).Address();
+                aAddress = addr;
+                }
+            else
+                {
+                LOG( SIMPLE, 
+                "SATSYSTEMSTATE: CSatSystemState::ReadCurrentSMSCL \
+                others" )
+                status = KErrOverflow;
+                }
+            }
+#else
+
+        if ( settings.ServiceCenterCount() != 0 )
+            {
+            LOG( SIMPLE, 
+            "SATSYSTEMSTATE: CSatSystemState::ReadCurrentSMSCL \
+            settings.ServiceCenterCount() != 0" )
+            if ( settings.DefaultServiceCenter() < settings.ServiceCenterCount() )
+                {
+                LOG( SIMPLE, 
+                "SATSYSTEMSTATE: CSatSystemState::ReadCurrentSMSCL \
+                settings.DefaultServiceCenter() < \
+                settings.ServiceCenterCount()" )
+                TPtrC addr = settings.GetServiceCenter(
+                    settings.DefaultServiceCenter() ).Address();
+                aAddress = addr;
+                }
+            else
+                {
+                status = KErrOverflow;
+                }
+            }
+
+#endif
+        else
+            {
+            LOG( SIMPLE, 
+            "SATSYSTEMSTATE: CSatSystemState::ReadCurrentSMSCL \
+            settings.ServiceCenterCount() == 0" )
+            status = KErrNotFound;
+            }
+
+        // Cleanup.
+        CleanupStack::PopAndDestroy( mtm );
+        }
+    else
+        {
+        LOG( SIMPLE, 
+        "SATSYSTEMSTATE: CSatSystemState::ReadCurrentSMSCL \
+        KMsvUnknownServiceIndexEntryId == serviceId" )
+        status = KErrNotFound;
+        }
+
+    CleanupStack::PopAndDestroy( clientRegistry );
+    CleanupStack::PopAndDestroy( msvSession );
+
+    if ( KErrNone != status )
+        {
+        LOG2( NORMAL,
+            "SATSYSTEMSTATE: CSatSystemState::ReadCurrentSMSCL leave: %d",
+            status )
+        User::Leave( status );
+        }
+
+    LOG( NORMAL, "SATSYSTEMSTATE: CSatSystemState::ReadCurrentSMSCL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
+// Specifies an entry in the Message Server index.
+// -----------------------------------------------------------------------------
+//
+TMsvId CSatSystemState::ServiceForMTML(
+    CMsvSession& aSession,
+    const TUid& aMtm ) const
+    {
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::ServiceForMTML calling" )
+
+    CMsvEntry* entry = aSession.GetEntryL( KMsvRootIndexEntryIdValue );
+    CleanupStack::PushL( entry );
+    TMsvId serviceId = KMsvUnknownServiceIndexEntryId;
+    LOG2( SIMPLE, 
+    "SATSYSTEMSTATE: CSatSystemState::ServiceForMTML count: %d",
+     entry->Count() )
+    // Check are there any entries
+    if ( entry->Count() != 0 )
+        {        
+        entry->SetSortTypeL(
+            TMsvSelectionOrdering( KMsvGroupByType | KMsvGroupByStandardFolders,
+            EMsvSortByDetailsReverse,
+            ETrue ) );
+
+        const TMsvEntry* tentry;
+        for ( TInt cc( entry->Count() ); --cc >= 0; )
+            {
+            tentry = &( *entry )[cc];
+            if ( tentry->iMtm == aMtm )
+                {
+                LOG( SIMPLE, 
+                "SATSYSTEMSTATE: CSatSystemState::ServiceForMTML \
+                tentry->iMtm == aMtm" )
+                if ( ( tentry->iType.iUid == KUidMsvServiceEntryValue ) &&
+                     ( tentry->Id() != KMsvLocalServiceIndexEntryIdValue ) )
+                    {
+                    LOG( SIMPLE, 
+                    "SATSYSTEMSTATE: CSatSystemState::ServiceForMTML \
+                    exit loop" )
+                    serviceId = tentry->Id();
+                    cc = 0; // To exit for-loop. Replaces break.
+                    }
+                }
+            }
+        }
+
+    CleanupStack::PopAndDestroy( entry );
+
+    LOG2( SIMPLE,
+    "SATSYSTEMSTATE: CSatSystemState::ServiceForMTML exiting with value: %d",
+    serviceId )
+    return serviceId;
+    }
+
+// -----------------------------------------------------------------------------
+// Method is used when the information of phones warnings and game tone
+// mode is needed.
+// Returns true if silent mode is on and false otherwise.
+// -----------------------------------------------------------------------------
+//
+TBool CSatSystemState::IsWarningAndGameTonesOn()
+    {
+    LOG( SIMPLE, "SATSYSTEMSTATE: \
+        CSatSystemState::IsWarningAndGameTonesOn calling" )
+
+    TBool modeOn( ETrue );
+    CRepository* centRep( NULL );
+
+    TRAPD( err, centRep = CRepository::NewL( KCRUidProfileEngine ) );
+    LOG2( SIMPLE, "SATSYSTEMSTATE:   CentRep failed: %i", err )
+    if ( ( KErrNone == err ) && centRep )
+        {
+        // Get the needed information from CentRep
+        centRep->Get( KProEngActiveWarningTones, modeOn );
+
+        // Delete CentRep
+        delete centRep;
+
+        }
+   
+    LOG2(
+        SIMPLE,
+        "SATSYSTEMSTATE: \
+        CSatSystemState::IsWarningAndGameTonesOn exiting with value: %d",
+        modeOn )
+
+    return modeOn;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SystemState/src/TSatSystemStateFactory.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,183 @@
+/*
+* 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 SAT SystemState objects outside of this DLL
+*
+*/
+
+
+#include    <startupdomainpskeys.h>
+#include    <PSVariables.h>
+#define Q_OS_SYMBIAN // needed to activate homescreendomainpskeys.h
+#include    <homescreendomainpskeys.h>
+#include    <CommonEngineDomainCRKeys.h>
+#include    <BTSapDomainPSKeys.h>
+#include    <ProfileEngineSDKCRKeys.h>
+#include    "TSatSystemStateFactory.h"
+#include    "CSatSystemState.h"
+#include    "msatmultimodeapi.h"
+#include    "CSatPSChangeNotifier.h"
+#include    "CSatCenRepChangeNotifier.h"
+#include    "SatLog.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MSatSystemState* TSatSystemStateFactory::CreateSystemStateL(
+    MSatMultiModeApi& aPhone )
+    {
+    LOG( SIMPLE, "SATSYSTEMSTATE: TSatSystemStateFactory::CreateSystemStateL \
+        calling" )
+
+    MSatSystemState* systemState = CSatSystemState::NewL( aPhone );
+
+    LOG( SIMPLE, "SATSYSTEMSTATE: TSatSystemStateFactory::CreateSystemStateL \
+        exiting" )
+    return systemState;
+    }
+
+// -----------------------------------------------------------------------------
+// TSatSystemStateFactory::CreateIdleModeChangeNotifierL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MSatSystemStateChangeNotifier*
+    TSatSystemStateFactory::CreateIdleModeChangeNotifierL(
+    MSatSystemStateObserver& aObserver )
+    {
+    LOG( SIMPLE, "SATSYSTEMSTATE: TSatSystemStateFactory::\
+        CreateIdleModeChangeNotifierL calling" )
+
+    MSatSystemStateChangeNotifier* ret = CSatPSChangeNotifier::NewL(
+        KHsCategoryUid,
+        KHsCategoryStateKey,
+        aObserver,
+        EHomeScreenIdleState );
+
+    LOG( SIMPLE, "SATSYSTEMSTATE: TSatSystemStateFactory::\
+        CreateIdleModeChangeNotifierL exiting" )
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// TSatSystemStateFactory::CreateSimStatusChangeNotifierL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MSatSystemStateChangeNotifier*
+    TSatSystemStateFactory::CreateSimStatusChangeNotifierL(
+    MSatSystemStateObserver& aObserver )
+    {
+    LOG( SIMPLE, "SATSYSTEMSTATE: TSatSystemStateFactory::\
+        CreateSimStatusChangeNotifierL calling" )
+
+    MSatSystemStateChangeNotifier* ret = CSatPSChangeNotifier::NewL(
+        KPSUidStartup,
+        KPSSimStatus,
+        aObserver,
+        ESimNotPresent );
+
+    LOG( SIMPLE, "SATSYSTEMSTATE: TSatSystemStateFactory::\
+        CreateSimStatusChangeNotifierL exiting" )
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// TSatSystemStateFactory::CreateSIMAccessProfileChangeNotifierL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MSatSystemStateChangeNotifier*
+    TSatSystemStateFactory::CreateSIMAccessProfileChangeNotifierL(
+    MSatSystemStateObserver& aObserver )
+    {
+    LOG( SIMPLE, "SATSYSTEMSTATE: TSatSystemStateFactory::\
+        CreateSIMAccessProfileChangeNotifier calling" )
+
+    MSatSystemStateChangeNotifier* ret = CSatPSChangeNotifier::NewL(
+        KPSUidBluetoothSapConnectionState,
+        KBTSapConnectionState,
+        aObserver,
+        KNotifyValueNotSet ); // No notify value specified
+
+    LOG( SIMPLE, "SATSYSTEMSTATE: TSatSystemStateFactory::\
+        CreateSIMAccessProfileChangeNotifier exiting" )
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// TSatSystemStateFactory::CreateStartupChangeChangeNotifierL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MSatSystemStateChangeNotifier*
+    TSatSystemStateFactory::CreateStartupChangeNotifierL(
+    MSatSystemStateObserver& aObserver )
+    {
+    LOG( SIMPLE, "SATSYSTEMSTATE: TSatSystemStateFactory::\
+        CreateStartupChangeNotifierL calling" )
+
+    MSatSystemStateChangeNotifier* ret = CSatPSChangeNotifier::NewL(
+        KPSUidStartup,
+        KPSGlobalSystemState,
+        aObserver,
+        KNotifyValueNotSet );
+
+    LOG( SIMPLE, "SATSYSTEMSTATE: TSatSystemStateFactory::\
+        CreateStartupChangeNotifierL exiting" )
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// TSatSystemStateFactory::CreateLanguageSelectionChangeNotifierL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MSatSystemStateChangeNotifier*
+    TSatSystemStateFactory::CreateLanguageSelectionChangeNotifierL(
+    MSatSystemStateObserver& aObserver )
+    {
+    LOG( SIMPLE, "SATSYSTEMSTATE: TSatSystemStateFactory::\
+        CreateLanguageSelectionChangeNotifier calling" )
+
+    MSatSystemStateChangeNotifier* ret = CSatCenRepChangeNotifier::NewL(
+        KCRUidCommonEngineKeys,
+        KGSDisplayTxtLang,
+        aObserver,
+        CSatCenRepChangeNotifier::ECRTypeInteger );
+
+    LOG( SIMPLE, "SATSYSTEMSTATE: TSatSystemStateFactory::\
+        CreateLanguageSelectionChangeNotifier exiting" )
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// TSatSystemStateFactory::CreateProfileChangeNotifierL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MSatSystemStateChangeNotifier*
+    TSatSystemStateFactory::CreateProfileChangeNotifierL(
+    MSatSystemStateObserver& aObserver )
+    {
+    LOG( SIMPLE, "SATSYSTEMSTATE: TSatSystemStateFactory::\
+        CreateProfileChangeNotifierL calling" )
+
+    MSatSystemStateChangeNotifier* ret = CSatCenRepChangeNotifier::NewL(
+        KCRUidProfileEngine,
+        KProEngActiveProfile,
+        aObserver,
+        CSatCenRepChangeNotifier::ECRTypeInteger );
+
+    LOG( SIMPLE, "SATSYSTEMSTATE: TSatSystemStateFactory::\
+        CreateProfileChangeNotifierL exiting" )
+    return ret;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SystemState/src/csatnetworkregstatusmonitor.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,226 @@
+/*
+* 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:  Network registration status monitor.
+*
+*/
+
+
+#include "csatnetworkregstatusmonitor.h"
+#include "SatLog.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that might leave.
+// ---------------------------------------------------------------------------
+//
+CSatNetworkRegStatusMonitor::CSatNetworkRegStatusMonitor(
+    MSatMultiModeApi& aPhone ) :
+    CActive( CActive::EPriorityStandard ),
+    iRegistrationStatus( RMobilePhone::ERegistrationUnknown ),
+    iWaitingRegistrationStatus( EFalse ),
+    iPhone( aPhone )
+    {
+    LOG( SIMPLE, "SATSYSTEMSTATE: \
+        CSatNetworkRegStatusMonitor::CSatNetworkRegStatusMonitor calling" )
+
+    // Add to active scheduler.
+    CActiveScheduler::Add( this );
+
+    LOG( SIMPLE, "SATSYSTEMSTATE: \
+        CSatNetworkRegStatusMonitor::CSatNetworkRegStatusMonitor exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CSatNetworkRegStatusMonitor* CSatNetworkRegStatusMonitor::NewL(
+    MSatMultiModeApi& aPhone )
+    {
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatNetworkRegStatusMonitor::NewL calling" )
+
+    CSatNetworkRegStatusMonitor* self =
+        new( ELeave ) CSatNetworkRegStatusMonitor( aPhone );
+
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatNetworkRegStatusMonitor::NewL exiting" )
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CSatNetworkRegStatusMonitor::~CSatNetworkRegStatusMonitor()
+    {
+    LOG( SIMPLE, "SATSYSTEMSTATE: \
+        CSatNetworkRegStatusMonitor::~CSatNetworkRegStatusMonitor calling" )
+
+    Cancel();
+
+    LOG( SIMPLE, "SATSYSTEMSTATE: \
+        CSatNetworkRegStatusMonitor::~CSatNetworkRegStatusMonitor exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// Activate monitor.
+// ---------------------------------------------------------------------------
+//
+void CSatNetworkRegStatusMonitor::Start()
+    {
+    LOG( SIMPLE,
+        "SATSYSTEMSTATE: CSatNetworkRegStatusMonitor::Start calling" )
+
+#ifndef SAT_USE_DUMMY_TSY
+    if ( !IsActive() )
+        {
+        iRegistrationStatus = RMobilePhone::ERegistrationUnknown;
+
+        iPhone.GetNetworkRegistrationStatus( iStatus, iRegistrationStatus );
+        SetActive();
+        iWaitingRegistrationStatus = ETrue;
+        LOG( SIMPLE, "SATSYSTEMSTATE:   Started" )
+        }
+#else
+    iRegistrationStatus = RMobilePhone::ERegisteredOnHomeNetwork;
+    iWaitingRegistrationStatus = EFalse;
+    LOG( SIMPLE, "SATSYSTEMSTATE:   Set for WINS Emulator" )
+#endif
+
+    LOG( SIMPLE,
+        "SATSYSTEMSTATE: CSatNetworkRegStatusMonitor::Start exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// Get current value of network registration status.
+// ---------------------------------------------------------------------------
+//
+RMobilePhone::TMobilePhoneRegistrationStatus
+    CSatNetworkRegStatusMonitor::CurrentValue()
+    {
+    LOG( SIMPLE,
+        "SATSYSTEMSTATE: CSatNetworkRegStatusMonitor::CurrentValue calling" )
+
+    // In case network registration notification failed on startup, we need to 
+    // check it again, if not registered on home network and we are observing
+    // changes in registration status ( iWaitingRegistrationStatus == EFalse )
+    if ( !iWaitingRegistrationStatus &&
+         ( RMobilePhone::ERegisteredOnHomeNetwork != iRegistrationStatus &&
+           RMobilePhone::ERegisteredRoaming != iRegistrationStatus ) )
+        {
+        LOG( NORMAL, "Not registered -> Going to check value again" )
+        Cancel(); // Cancel pending request...
+        Start();  // ... and start again
+        }
+
+    // Wait, initial value has not yet been got.
+    if ( iWaitingRegistrationStatus )
+        {
+        LOG( SIMPLE,
+        "SATSYSTEMSTATE: CSatNetworkRegStatusMonitor::CurrentValue \
+        iWaitingRegistrationStatus true" )
+        if ( !iWait.IsStarted() )
+            {
+            LOG( SIMPLE,
+            "SATSYSTEMSTATE: CSatNetworkRegStatusMonitor::CurrentValue \
+            start iWait" )
+            iWait.Start();
+            }
+        }
+
+    LOG2( SIMPLE,
+        "SATSYSTEMSTATE: CSatNetworkRegStatusMonitor::CurrentValue exiting \
+        (%d)", iRegistrationStatus )
+    return iRegistrationStatus;
+    }
+
+// -----------------------------------------------------------------------------
+// CRegistrationMonitor::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CSatNetworkRegStatusMonitor::DoCancel()
+    {
+    LOG( SIMPLE,
+        "SATSYSTEMSTATE: CSatNetworkRegStatusMonitor::DoCancel calling" )
+
+    iPhone.CancelAsyncRequest(
+        EMobilePhoneNotifyNetworkRegistrationStatusChange );
+    if ( iWait.IsStarted() )
+        {
+        LOG( SIMPLE,
+        "SATSYSTEMSTATE: CSatNetworkRegStatusMonitor::DoCancel stop iWait" )
+        iWait.AsyncStop();
+        }
+
+    LOG( SIMPLE,
+        "SATSYSTEMSTATE: CSatNetworkRegStatusMonitor::DoCancel exiting" )
+    }
+
+// ---------------------------------------------------------------------------
+// From class CActive.
+// Marks status value valid and activates change notifier.
+// ---------------------------------------------------------------------------
+//
+void CSatNetworkRegStatusMonitor::RunL()
+    {
+    const TInt status( iStatus.Int() ); // Asynchronous status
+    LOG2( SIMPLE,
+        "SATSYSTEMSTATE: CSatNetworkRegStatusMonitor::RunL calling (%d)",
+        status )
+
+    // Restart request
+    if ( KErrServerBusy == status )
+        {
+        iPhone.GetNetworkRegistrationStatus(
+            iStatus,
+            iRegistrationStatus );
+        SetActive();
+        }
+    else if ( KErrCancel != status )
+        {
+        // (Re)start observing
+        iPhone.NotifyNetworkRegistrationStatusChange(
+            iStatus,
+            iRegistrationStatus );
+        SetActive();
+        }
+    else
+        {
+        LOG( SIMPLE, " Request cancelled" )
+        }
+
+    // Still waiting first value after start.
+    if ( iWaitingRegistrationStatus )
+        {
+        LOG( SIMPLE, 
+        "SATSYSTEMSTATE: CSatNetworkRegStatusMonitor::RunL \
+        iWaitingRegistrationStatus true" )
+        iWaitingRegistrationStatus = EFalse;
+        if ( iWait.IsStarted() )
+            {
+            LOG( SIMPLE, 
+            "SATSYSTEMSTATE: CSatNetworkRegStatusMonitor::RunL \
+            stop iWait" )
+            iWait.AsyncStop();
+            }
+        }
+
+    LOG2( SIMPLE,
+        "SATSYSTEMSTATE:   NetworkRegistrationStatus updated: %d",
+        iRegistrationStatus )
+
+    LOG( SIMPLE, "SATSYSTEMSTATE: CSatNetworkRegStatusMonitor::RunL exiting" )
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/SystemState/src/std.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,35 @@
+/*
+* 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:  General functions
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32std.h>
+#include    "Panic.h"
+#include    "SatLog.h"
+
+// CONSTANTS
+_LIT( KSatSystemStatePanic, "SatSystemState" );
+
+void Panic( TSatSystemStatePanic aPanic )
+    {
+    LOG2( SIMPLE, "SATSYSTEMSTATE: Panic calling: %d", aPanic )
+    User::Panic( KSatSystemStatePanic, aPanic );
+    LOG( SIMPLE, "SATSYSTEMSTATE: Panic exiting" )
+    }
+
+//  End of File
Binary file satengine/satserver/conf/sat.confml has changed
Binary file satengine/satserver/conf/sat_102078E1.crml has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/group/bld.inf	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2003-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 SatServer
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+satserver_stub.sis               /epoc32/data/z/system/install/SatServer_stub.sis
+../rom/satserver.iby             CORE_MW_LAYER_IBY_EXPORT_PATH( satserver.iby )
+../rom/SatServerResources.iby    LANGUAGE_MW_LAYER_IBY_EXPORT_PATH( SatServerResources.iby )
+
+// Generic configuration interface for component cenrep settings  
+../conf/sat.confml                      MW_LAYER_CONFML(sat.confml)
+../conf/sat_102078E1.crml 	        MW_LAYER_CRML(sat_102078E1.crml)
+
+#include "../SystemState/group/bld.inf"
+#include "../EventMonitors/group/bld.inf"
+#include "../Engine/group/bld.inf"
+#include "../SatServer/group/bld.inf"
+#include "../SatClient/group/bld.inf"
+#include "../SatInternalClient/group/bld.inf"
+#include "../Commands/ProvideLocalInfoCmd/group/bld.inf"
+#include "../Commands/SelectItemCmd/group/bld.inf"
+#include "../Commands/SetUpCallCmd/group/bld.inf"
+#include "../Commands/SetUpMenuCmd/group/bld.inf"
+#include "../Commands/SimSessionEndCmd/group/bld.inf"
+#include "../Commands/SendSmCmd/group/bld.inf"
+#include "../Commands/LaunchBrowserCmd/group/bld.inf"
+#include "../Commands/PlayToneCmd/group/bld.inf"
+#include "../Commands/MoSmControlCmd/group/bld.inf"
+#include "../Commands/SendDtmfCmd/group/bld.inf"
+#include "../Commands/GetInkeyCmd/group/bld.inf"
+#include "../Commands/GetInputCmd/group/bld.inf"
+#include "../Commands/SendSSCmd/group/bld.inf"
+#include "../Commands/SendUSSDCmd/group/bld.inf"
+#include "../Commands/SetUpIdleModeTextCmd/group/bld.inf"
+#include "../Commands/CallControlCmd/group/bld.inf"
+#include "../Commands/DisplayTextCmd/group/bld.inf"
+#include "../Commands/RefreshCmd/group/bld.inf"
+#include "../Commands/RefreshRequiredCmd/group/bld.inf"
+#include "../Commands/SetUpEventListCmd/group/bld.inf"
+#include "../Commands/LanguageNotificationCmd/group/bld.inf"
+#include "../Commands/GetChannelStatusCmd/group/bld.inf"
+#include "../Commands/CloseChannelCmd/group/bld.inf"
+#include "../Commands/OpenChannelCmd/group/bld.inf"
+#include "../Commands/SendDataCmd/group/bld.inf"
+#include "../Commands/ReceiveDataCmd/group/bld.inf"
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/group/satserver_stub.pkg	Wed Jul 21 18:26:52 2010 +0300
@@ -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: For packing satserver stub.
+;
+; Languages
+&EN
+
+; Header
+#{"satserver"}, (0x1000A833), 1, 0, 0, TYPE=SA
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Files
+""-"z:\sys\bin\SatServer.exe"
+""-"z:\sys\bin\satengine.dll"
+""-"z:\sys\bin\SatEventMonitors.dll"
+""-"z:\sys\bin\SatClient.dll"
+""-"z:\sys\bin\SatInternalClient.dll"
+""-"z:\sys\bin\SatSystemState.dll"
+""-"z:\sys\bin\CallControlCmd.dll"
+""-"z:\sys\bin\CloseChannelCmd.dll"
+""-"z:\sys\bin\DisplayTextCmd.dll"
+""-"z:\sys\bin\GetChannelStatusCmd.dll"
+""-"z:\sys\bin\GetInkeyCmd.dll"
+""-"z:\sys\bin\GetInputCmd.dll"
+""-"z:\sys\bin\LanguageNotificationCmd.dll"
+""-"z:\sys\bin\LaunchBrowserCmd.dll"
+""-"z:\sys\bin\MoSmControlCmd.dll"
+""-"z:\sys\bin\OpenChannelCmd.dll"
+""-"z:\sys\bin\PlayToneCmd.dll"
+""-"z:\sys\bin\ProvideLocalInfoCmd.dll"
+""-"z:\sys\bin\ReceiveDataCmd.dll"
+""-"z:\sys\bin\RefreshCmd.dll"
+""-"z:\sys\bin\RefreshRequiredCmd.dll"
+""-"z:\sys\bin\SelectItemCmd.dll"
+""-"z:\sys\bin\SendDataCmd.dll"
+""-"z:\sys\bin\SendDtmfCmd.dll"
+""-"z:\sys\bin\SendSmCmd.dll"
+""-"z:\sys\bin\SendSsCmd.dll"
+""-"z:\sys\bin\SendUssdCmd.dll"
+""-"z:\sys\bin\SetUpCallCmd.dll"
+""-"z:\sys\bin\SetUpEventListCmd.dll"
+""-"z:\sys\bin\SetUpIdleModeTextCmd.dll"
+""-"z:\sys\bin\SetUpMenuCmd.dll"
+""-"z:\sys\bin\SimSessionEndCmd.dll"
\ No newline at end of file
Binary file satengine/satserver/group/satserver_stub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/CSatCommandHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,205 @@
+/*
+* 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 for SAT commands
+*
+*/
+
+#ifndef CSATCOMMANDHANDLER_H
+#define CSATCOMMANDHANDLER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <etelsat.h>
+#include <SecondaryDisplay/secondarydisplaysatapi.h>
+#include "MSatUtils.h"
+#include "MSatEventObserver.h"
+#include "MSatCommand.h"
+
+// CLASS DECLARATION
+
+/**
+*  Base class for SAT commands.
+*
+*  @lib SatServer
+*  @since Series 60 3.0
+*/
+class CSatCommandHandler : public CActive, public MSatEventObserver,
+                           public MSatCommand
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aImplUid Uid for derived class's plugin
+        * @param aUtils Utils interface
+        */
+        static CSatCommandHandler* NewL(
+            const TUid& aImplUid,
+            MSatUtils* aUtils );
+
+        /**
+        * Destructor.
+        */
+        IMPORT_C virtual ~CSatCommandHandler();
+
+    public: // New fucntions
+
+        /**
+        * Start the waiting of SAT command from USAT API.
+        */
+        IMPORT_C void Start();
+
+        /**
+        * Gives a panic.
+        * @param aCategory A category for this panic
+        * @param aReason Reason for this panic
+        */
+        IMPORT_C void Panic( const TDesC& aCategory, TInt aReason ) const;
+
+        /**
+        * Indicates is this command handler currently executing a command.
+        * @return ETrue if executing.
+        */
+        IMPORT_C TBool IsCommandExecuting() const ;
+
+    public: // Functions from base classes
+
+        /**
+        * From MSatEventObserver Notification of event.
+        * @param aEvent An event that has been notified
+        */
+        IMPORT_C void Event( TInt aEvent );
+
+        /**
+        * From MSatCommand Response from client.
+        * Default implementation will cause panic.
+        */
+        IMPORT_C virtual void ClientResponse();
+
+    protected: // New functions
+
+        /**
+        * Start of the command handling. Asks from derived class whether the
+        * command is allowed to execute by calling AllowCommand.
+        * If command is allowed to execute then the need of ui session
+        * is queried by calling NeedUiSession. If ui session is needed and
+        * its not available, ui is launcehd and this class registers itself
+        * to listen the event of ui launch. After the ui is launched,
+        * HandleCommand is called. If the derived class does not need the ui
+        * session or ui session is available, HandleCommand is called
+        * immediatly.
+        */
+        IMPORT_C virtual void DoHandleCommand();
+
+        /**
+        * Derived class needs to make the request from USatApi.
+        * @param aStatus Status of request.
+        */
+        virtual void IssueUSATRequest( TRequestStatus& aStatus ) = 0;
+
+        /**
+        * Command has to check the state of the system and make the
+        * desision of allowing the command to perform. If desision
+        * is not to allow the command, then the terminal response has to
+        * sent from this method.
+        * @return TBool indicating is this command allowed or not
+        */
+        virtual TBool CommandAllowed() = 0;
+
+        /**
+        * Queries need of ui session in order to
+        * execute the command. If ui session is needed, the ui client
+        * launched and this class will register it self for the notification
+        * of ui request.
+        * @return ETrue if ui session is needed.
+        */
+        virtual TBool NeedUiSession() = 0;
+
+        /**
+        * Called when USAT API notifies that command
+        * data is available.
+        */
+        virtual void HandleCommand() = 0;
+
+        /**
+        * Called if launch of a Sat Ui application failed.
+        * Every derived class, which needs a ui session in order to
+        * execute command, needs to send a terminal
+        * response from this method.
+        */
+        virtual void UiLaunchFailed() = 0;
+
+    protected:
+
+        /**
+        * Sends terminal response and renews the usat request of the command.
+        * @param aPCmd Identifies the command, which is sending
+        * terminal response.
+        * @param aRsp Terminal response data package.
+        */
+        IMPORT_C void TerminalRsp( RSat::TPCmd aPCmd, const TDesC8& aRsp );
+
+        /**
+        * Calls SatSystemState's IsPhoneInIdleState if not using Dummy TSY,
+        * otherwise returns ETrue
+        * @return ETrue if using Dymmy TSY, otherwise asks status
+        * from SatSystemState and returns it.
+        */
+        IMPORT_C TBool IsPhoneInIdleState();
+
+    protected:  // From CActive
+
+        /**
+        * From CActive base class
+        */
+        IMPORT_C void RunL();
+
+    protected:
+
+        /**
+        * C++ default constructor.
+        */
+        IMPORT_C CSatCommandHandler();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        * @param aPtr Pointer to Utils interface
+        */
+        IMPORT_C void BaseConstructL( MSatUtils* aPtr );
+
+    protected:  // Data
+
+        // Utils interface
+        MSatUtils* iUtils;
+
+        // Indicates that command is pending for UI to launch
+        TBool iWaitingUiLaunch;
+
+    private:    // Data
+
+        // Requiered attribute for the ECOM framework.
+        TUid iDtorIDKey;
+
+        // Indicates is this command handler executing
+        TBool iIsExecuting;
+
+        // Timer to get UI Launch notification released before
+        // starting to handle pending proactive command.
+        RTimer iDelayTimer;
+
+    };
+
+#endif      // CSATCOMMANDHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/CSatSScheduler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,86 @@
+/*
+* 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 is the active scheduler of the SAT Server.
+*
+*/
+
+
+#ifndef CSATSSCHEDULER_H
+#define CSATSSCHEDULER_H
+
+// INCLUDE FILES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CSatSServer;
+
+//  CLASS DECLARATION
+
+/**
+*  SAT Server includes a scheduler of it's own to simplify
+*  client request handling code. All active object leaves are
+*  handled in function Error(). The behaviour of Error()
+*  depends on whether there is an outstanding client request
+*  or not: it will tell the client the reason for inability
+*  to handle the client request. It will also panic the
+*  client if the descriptor passed to the server was malformed.
+*  Finally, a panic is raised if the error does not originate
+*  from the server itself.
+*
+*  @lib SatEngine
+*  @since Series 60 3.0
+*/
+
+class CSatSScheduler : public CActiveScheduler
+    {
+    public: // Constructors
+
+        /**
+        *   Default constructor
+        */
+        IMPORT_C CSatSScheduler();
+
+        /**
+        *   Gives a pointer of the current CSatSServer instance
+        *   to the scheduler.
+        *   @param aServer The current server pointer
+        */
+        IMPORT_C void SetServer( CSatSServer* aServer );
+
+    public:     // from CActiveScheduler
+
+        /**
+        *   Overridden to handle leaves in request functions and
+        *   unexpected situations.
+        *   @param aError Error code, see EPOC system documentation.
+        */
+        void Error( TInt aError ) const;
+
+    private:    // prohibited operators and functions
+
+        // Copy constructor
+        CSatSScheduler( const CSatSScheduler& );
+
+        // Assignment operator
+        CSatSScheduler& operator=( const CSatSScheduler& );
+
+    private:    // data
+
+        // Ref: server instance
+        CSatSServer* iServer;
+    };
+
+#endif          // CSATSSCHEDULER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/MSatApi.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,523 @@
+/*
+* 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:  Interface for USat API.
+*
+*/
+
+
+
+#ifndef MSATAPI_H
+#define MSATAPI_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <etelsat.h>
+
+// CLASS DECLARATION
+
+/**
+*  Interface for USat api.
+*
+*  @lib SatEngine.lib
+*  @since Series 60 3.0
+*/
+class MSatApi
+    {
+    protected:  // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        MSatApi() {};
+
+        /**
+        * Destructor.
+        */
+        virtual ~MSatApi() {};
+
+    public: // New functions
+
+        /**
+        * Issues SetUpMenu request.
+        * @param aStatus Request status.
+        * @param aPCmd Command identifier and other relevant information
+        */
+        virtual void NotifySetUpMenu(
+            TRequestStatus& aStatus,
+            TDes8& aPCmd ) = 0;
+
+        /**
+        * Cancels the setupmenu request.
+        */
+        virtual void NotifySetUpMenuCancel() = 0;
+
+        /**
+        * Issues SetUpCall request
+        * @param aStatus Request status.
+        * @param aPCmd Command identifier and other relevant information
+        */
+        virtual void NotifySetUpCall(
+            TRequestStatus& aStatus,
+            TDes8& aPCmd ) = 0;
+
+        /**
+        * Cancels the SetUpCall request
+        */
+        virtual void NotifySetUpCallCancel() = 0;
+
+        /**
+        * Issues LangNotify request
+        * @param aStatus Request status.
+        * @param aPCmd Command identifier and other relevant information
+        */
+        virtual void NotifyLanguageNotification(
+            TRequestStatus& aStatus,
+            TDes8& aPCmd ) = 0;
+
+        /**
+        * Cancels the LangNotify request
+        */
+        virtual void NotifyLanguageNotificationCancel() = 0;
+
+        /**
+        * Issues the SelectItem request.
+        * @param aStatus Request status.
+        * @param aPCmd Command identifier and other relevant information
+        */
+        virtual void NotifySelectItem(
+            TRequestStatus& aStatus,
+            TDes8& aPCmd ) = 0;
+
+        /**
+        * Cancels the SelectItem request
+        */
+        virtual void NotifySelectItemCancel() = 0;
+
+        /**
+        * Issues the SendSm request.
+        * @param aStatus Request status.
+        * @param aPCmd Command identifier and other relevant information
+        */
+        virtual void NotifySendSm(
+            TRequestStatus& aStatus,
+            TDes8& aPCmd ) = 0;
+
+        /**
+        * Cancels the SendSm request.
+        */
+        virtual void NotifySendSmCancel() = 0;
+
+        /**
+        * Sends sm message.
+        * @param aStatus Request status
+        * @aData Data to be sent
+        * @aMsgReference Message reference.
+        */
+        virtual void SendMessageNoLogging(
+            TRequestStatus& aStatus,
+            TDes8& aData,
+            TUint16& aMsgReference ) = 0;
+
+        /**
+        * Cancels the send sm request.
+        */
+        virtual void SendMessageNoLoggingCancel() = 0;
+
+        /**
+        * Issues the request
+        * @param aStatus Request status.
+        * @param aPCmd Command identifier and other relevant information
+        */
+        virtual void NotifyLaunchBrowser(
+            TRequestStatus& aStatus,
+            TDes8& aPCmd ) = 0;
+
+        /**
+        * Cancels the request
+        */
+        virtual void NotifyLaunchBrowserCancel() = 0;
+
+        /**
+        * Issues the request
+        * @param aStatus Request status.
+        * @param aPCmd Command identifier and other relevant information
+        */
+        virtual void NotifyDisplayText(
+            TRequestStatus& aStatus,
+            TDes8& aPCmd ) = 0;
+
+        /**
+        * Cancels the request
+        */
+        virtual void NotifyDisplayTextCancel() = 0;
+
+        /**
+        * Issues the request
+        * @param aStatus Request status.
+        * @param aPCmd Command identifier and other relevant information
+        */
+        virtual void NotifyGetInput(
+            TRequestStatus& aStatus,
+            TDes8& aPCmd ) = 0;
+
+        /**
+        * Cancels the request
+        */
+        virtual void NotifyGetInputCancel() = 0;
+
+        /**
+        * Issues the request
+        * @param aStatus Request status.
+        * @param aPCmd Command identifier and other relevant information
+        */
+        virtual void NotifyGetInkey(
+            TRequestStatus& aStatus,
+            TDes8& aPCmd ) = 0;
+
+        /**
+        * Cancels the request
+        */
+        virtual void NotifyGetInkeyCancel() = 0;
+
+        /**
+        * Issues the request
+        * @param aStatus Request status.
+        * @param aPCmd Command identifier and other relevant information
+        */
+        virtual void NotifyCallControl(
+            TRequestStatus& aStatus,
+            TDes8& aPCmd ) = 0;
+
+        /**
+        * Cancels the request
+        */
+        virtual void NotifyCallControlCancel() = 0;
+
+        /**
+        * Issues the request
+        * @param aStatus Request status.
+        * @param aPCmd Command identifier and other relevant information
+        */
+        virtual void NotifyMoSmControl(
+            TRequestStatus& aStatus,
+            TDes8& aPCmd ) = 0;
+
+        /**
+        * Cancels the request
+        */
+        virtual void NotifyMoSmControlCancel() = 0;
+
+        /**
+        * Issues the request
+        * @param aStatus Request status.
+        * @param aPCmd Command identifier and other relevant information
+        */
+        virtual void NotifySetUpEventList(
+            TRequestStatus& aStatus,
+            TDes8& aPCmd ) = 0;
+
+        /**
+        * Cancels the request
+        */
+        virtual void NotifySetUpEventListCancel() = 0;
+
+        /**
+        * Issues the request
+        * @param aStatus Request status.
+        * @param aPCmd Command identifier and other relevant information
+        */
+        virtual void NotifySetUpIdleModeText(
+            TRequestStatus& aStatus,
+            TDes8& aPCmd ) = 0;
+
+        /**
+        * Cancels the request
+        */
+        virtual void NotifySetUpIdleModeTextCancel() = 0;
+
+        /**
+        * Issues the request
+        * @param aStatus Request status.
+        * @param aPCmd Command identifier and other relevant information
+        */
+        virtual void NotifySendDtmf(
+            TRequestStatus& aStatus,
+            TDes8& aPCmd ) = 0;
+
+        /**
+        * Cancels the request
+        */
+        virtual void NotifySendDtmfCancel() = 0;
+
+        /**
+        * Issues the request
+        * @param aStatus Request status.
+        * @param aPCmd Command identifier and other relevant information
+        */
+        virtual void NotifySendSs(
+            TRequestStatus& aStatus,
+            TDes8& aPCmd ) = 0;
+
+        /**
+        * Cancels the request
+        */
+        virtual void NotifySendSsCancel() = 0;
+
+        /**
+        * Issues the request
+        * @param aStatus Request status.
+        * @param aPCmd Command identifier and other relevant information
+        */
+        virtual void NotifySendUssd(
+            TRequestStatus& aStatus,
+            TDes8& aPCmd ) = 0;
+
+        /**
+        * Cancels the request
+        */
+        virtual void NotifySendUssdCancel() = 0;
+
+        /**
+        * Issues the request
+        * @param aStatus Request status.
+        * @param aPCmd Command identifier and other relevant information
+        */
+        virtual void NotifyPlayTone(
+            TRequestStatus& aStatus,
+            TDes8& aPCmd ) = 0;
+
+        /**
+        * Cancels the request
+        */
+        virtual void NotifyPlayToneCancel() = 0;
+
+        /**
+        * Issues the request
+        * @param aStatus Request status.
+        * @param aPCmd Command identifier and other relevant information
+        */
+        virtual void NotifyRefreshRequired(
+            TRequestStatus& aStatus ,
+            TDes8& aPCmd ) = 0;
+
+        /**
+        * Cancels the request
+        */
+        virtual void NotifyRefreshRequiredCancel() = 0;
+
+        /**
+        * Respond to NotifyRefreshRequired. Replaces Terminal Rsp here.
+        * @param aPCkg Refresh required response package
+        */
+        virtual void RefreshAllowed( const TDesC8& aPCkg ) = 0;
+
+        /**
+        * Issues the request
+        * @param aStatus Request status.
+        * @param aPCmd Command identifier and other relevant information
+        */
+        virtual void NotifyRefresh(
+            TRequestStatus& aStatus,
+            TDes8& aPCmd ) = 0;
+
+        /**
+        * Cancels the request
+        */
+        virtual void NotifyRefreshCancel() = 0;
+
+        /**
+        * Issues the request
+        * @param aStatus Request status.
+        */
+        virtual void NotifySimSessionEnd( TRequestStatus& aStatus ) = 0;
+
+        /**
+        * Cancels the SimSessionEnd request
+        */
+        virtual void NotifySimSessionEndCancel() = 0;
+
+        /**
+        * Issues the request
+        * @param aStatus Request status.
+        * @param aPCmd Command identifier and other relevant information
+        */
+        virtual void NotifyLocalInfo(
+            TRequestStatus& aStatus,
+            TDes8& aPCmd ) = 0;
+
+        /**
+        * Cancels the request
+        */
+        virtual void NotifyLocalInfoCancel() = 0;
+
+        /**
+        * Issues the request
+        * @param aStatus Request status.
+        * @param aPCmd Command identifier and other relevant information
+        */
+        virtual void NotifyOpenChannel(
+            TRequestStatus& aStatus,
+            TDes8& aPCmd ) = 0;
+
+        /**
+        * Cancels the request
+        */
+        virtual void NotifyOpenChannelCancel() = 0;
+
+        /**
+        * Issues the request
+        * @param aStatus Request status.
+        * @param aPCmd Command identifier and other relevant information
+        */
+        virtual void NotifyCloseChannel(
+            TRequestStatus& aStatus,
+            TDes8& aPCmd ) = 0;
+
+        /**
+        * Cancels the request
+        */
+        virtual void NotifyCloseChannelCancel() = 0;
+
+        /**
+        * Issues the request
+        * @param aStatus Request status.
+        * @param aPCmd Command identifier and other relevant information
+        */
+        virtual void NotifyGetChannelStatus(
+            TRequestStatus& aStatus,
+            TDes8& aPCmd ) = 0;
+
+        /**
+        * Cancels the request
+        */
+        virtual void NotifyGetChannelStatusCancel() = 0;
+
+        /**
+        * Issues the request
+        * @param aStatus Request status.
+        * @param aPCmd Command identifier and other relevant information
+        */
+        virtual void NotifySendData(
+            TRequestStatus& aStatus,
+            TDes8& aPCmd ) = 0;
+
+        /**
+        * Cancels the request
+        */
+        virtual void NotifySendDataCancel() = 0;
+
+        /**
+        * Issues the request
+        * @param aStatus Request status.
+        * @param aPCmd Command identifier and other relevant information
+        */
+        virtual void NotifyReceiveData(
+            TRequestStatus& aStatus,
+            TDes8& aPCmd ) = 0;
+
+        /**
+        * Cancels the request
+        */
+        virtual void NotifyReceiveDataCancel() = 0;
+
+        /**
+        * Sends menu selection to SIM.
+        * @param aMenuSelection Selected menu item
+        */
+        virtual void SendMenuSelection( const TDes8& aMenuSelection ) = 0;
+
+        /**
+        * Sends terminal response to SIM.
+        * @param aPCmd Proactive command, which is sending the Terminal Rsp.
+        * @param aPckg Packed data of terminal rsp.
+        */
+        virtual void TerminalRsp(
+            RSat::TPCmd aPCmd,
+            const TDesC8& aPckg ) = 0;
+
+        /**
+        * Gets the icon info from SIM.
+        * @param aReqStatus Request status.
+        * @param aRecordNumber Specifies the EF_IMG in SIM.
+        * @param aIconEf Contains the icon informations from SIM in returning
+        *        of the method.
+        */
+        virtual void GetIcon(
+            TRequestStatus& aReqStatus,
+            TUint8 aRecordNumber,
+            RSat::TIcon& aIconEf ) = 0;
+
+        /**
+        * Gets the icon image.
+        * @param aReqStatus Request status.
+        * @param aInstanceInfo Informatio of the icon, which data is
+        *        fetched from SIM.
+        * @param aInstance Contains the icon data from SIM in returning of the
+        *        method.
+        */
+        virtual void GetImageInstance(
+            TRequestStatus& aReqStatus,
+            const TDesC8& aInstanceInfo,
+            TDes8& aInstance ) = 0;
+
+        /**
+        * Gets color lookup table of the icon.
+        * @param aReqStatus Request status.
+        * @param aInstanceNumber Image instance number.
+        * @param aOffset Offset of the clut.
+        * @param aClut Contains the Clut of the icon in returning of the
+        *        method.
+        */
+        virtual void GetClut(
+            TRequestStatus& aReqStatus,
+            TUint aInstanceNumber,
+            TUint aOffset,
+            TDes8& aClut ) = 0;
+
+        /**
+        * Sends notify to SIM about some event using EventDownload.
+        * @param aReqStatus Request status.
+        * @param aSingleEvent Single event reported to SIM.
+        * @param aEventInfo Contains information of an event.
+        */
+        virtual void EventDownload(
+            TRequestStatus& aReqStatus,
+            RSat::TEventList aSingleEvent,
+            const TDesC8& aEventInfo ) = 0;
+
+        /**
+        * Indicates is RSat connected
+        * @return ETrue if RSat is connected
+        */
+        virtual TBool IsRSatConnected() const = 0;
+        
+        /**
+        * Called when all the supported notifies are sent to TSY
+        * @return TInt from RSat
+        */
+        virtual TInt UsatClientReadyIndication() = 0;
+
+    private:
+
+        // Prohibit copy constructor if not deriving from CBase.
+        MSatApi( const MSatApi& );
+
+        // Prohibit assigment operator if not deriving from CBase.
+        MSatApi& operator=( const MSatApi& );
+
+    };
+
+#endif      // MSATAPI_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/MSatApnHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,98 @@
+/*
+* 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:  Interface for APN handler
+*
+*/
+
+
+#ifndef MSATAPNHANDLER_H
+#define MSATAPNHANDLER_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <etelsat.h>
+#include <etelpckt.h>
+// CLASS DECLARATION
+
+/**
+*  Interface for APN operations with CMManager.
+*
+*  @lib SatEngine
+*  @since S60 3.0
+*/
+class MSatApnHandler
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        MSatApnHandler() {};
+
+        /**
+        * Destructor.
+        */
+        virtual ~MSatApnHandler() {};
+
+    public: // New functions
+
+        /**
+        * Locates APN from CMManager Session, creates new APN if not  
+        * found, and returns IAP id and Network ID in referenced parameters
+        * @param aName Accesspoint to locate / create
+        * @param aUserLogin, User name in case new APN is needed
+        * @param aUserPwd, Password in case, new APN is needed
+        * @param aIapId, after completion, holds the IAP id of the APN
+        * @param aNwId, after completion, holds the Network id of the APN
+        * @param aApnCreated indicates is new APN created
+        * @param aPdpType, indicates whether the address type is IPv4  or IPv6
+        * @param aLocalAddress, represents the Local Address provided by NAA
+        */
+        virtual void GetApnInfoL( 
+            const RSat::TAccessName& aName,
+            const RSat::TTextString& aUserLogin,
+            const RSat::TTextString& aUserPwd,
+            TUint32& aIapId,
+            TUint32& aNwId,
+            TBool& aApnCreated, 
+            const RPacketContext::TProtocolType& aPdpType,
+            const TDesC8& aLocalAddress ) = 0;
+
+        /**
+        * Deletes APN from connection method list with given APN ID. Note  
+        * that aApnId is the same id that GetApnInfoL returns in aNwId.
+        * @param aApnId APN to delete
+        */
+        virtual void DeleteApnL( TUint32 aApnId ) = 0;
+
+        /**
+         * Find the default APN Id
+         * @param aPdpType, indicates the address type is IPv4  or IPv6
+         * @return a default iap id
+         */
+        virtual TUint32 FindDefaultApL(
+                const RPacketContext::TProtocolType& aPdpType ) = 0;
+    private:
+
+        // Prohibit copy constructor if not deriving from CBase.
+        MSatApnHandler( const MSatApnHandler& );
+
+        // Prohibit assigment operator if not deriving from CBase.
+        MSatApnHandler& operator=( const MSatApnHandler& );
+
+    };
+
+#endif      // MSATAPNHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/MSatBIPChannelStatusObserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,75 @@
+/*
+* 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:  Interface for ChannelStatus event observer.
+*
+*/
+
+
+
+#ifndef MSATBIPCHANNELSTATUSOBSERVER_H
+#define MSATBIPCHANNELSTATUSOBSERVER_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// CLASS DECLARATION
+
+/**
+*  Interface for ChannelStatus event observer. When ChannelStatus event occurs, the
+*  implementors of this class will be notified. However, this class must be send to
+*  MSatBIPEventNotifier to get the notification.
+*
+*  @lib SatEngine
+*  @since Series 60 3.0
+*/
+class MSatBIPChannelStatusObserver
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        MSatBIPChannelStatusObserver() {};
+
+        /**
+        * Destructor.
+        */
+        virtual ~MSatBIPChannelStatusObserver() {};
+
+    public: // New functions
+
+        /**
+        * Notification of an event.
+        * @param aChannelId ID of the channel that started this event.
+        * @param aStatus Status that caused this event.
+        */
+        virtual void ChannelStatus(
+            const TInt aChannelId,
+            const TInt aStatus ) = 0;
+
+    private:
+
+        // Prohibit copy constructor if not deriving from CBase.
+        MSatBIPChannelStatusObserver(
+            const MSatBIPChannelStatusObserver& );
+
+        // Prohibit assigment operator if not deriving from CBase.
+        MSatBIPChannelStatusObserver&
+            operator=( const MSatBIPChannelStatusObserver& );
+
+    };
+
+#endif      // MSATBIPCHANNELSTATUSOBSERVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/MSatBIPDataAvailableObserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Interface for DataAvailable event observer.
+*
+*/
+
+
+
+#ifndef MSATBIPDATAAVAILABLEOBSERVER_H
+#define MSATBIPDATAAVAILABLEOBSERVER_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// CLASS DECLARATION
+
+/**
+*  Interface for DataAvailable event observer. When DataAvailable event occurs, the
+*  implementors of this class will be notified. However, this class must be send to
+*  MSatBIPEventNotifier to get the notification.
+*
+*  @lib SatEngine
+*  @since Series 60 3.0
+*/
+class MSatBIPDataAvailableObserver
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        MSatBIPDataAvailableObserver() {};
+
+        /**
+        * Destructor.
+        */
+        virtual ~MSatBIPDataAvailableObserver() {};
+
+    public: // New functions
+
+        /**
+        * Notification of an event.
+        * @param aChannelId ID of the channel where the data is available.
+        * @param aLength Number of bytes available
+        */
+        virtual void DataAvailable(
+            const TInt aChannelId,
+            const TInt aLength ) = 0;
+
+    private:
+
+        // Prohibit copy constructor if not deriving from CBase.
+        MSatBIPDataAvailableObserver(
+            const MSatBIPDataAvailableObserver& );
+
+        // Prohibit assigment operator if not deriving from CBase.
+        MSatBIPDataAvailableObserver& operator=(
+            const MSatBIPDataAvailableObserver& );
+
+    };
+
+#endif      // MSATBIPDATAAVAILABLEOBSERVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/MSatBIPDataChannel.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,173 @@
+/*
+* 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:  Interface for BIP Data channel.
+*
+*/
+
+
+
+#ifndef MSATBIPDATACHANNEL_H
+#define MSATBIPDATACHANNEL_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <etelsat.h>
+#include <extendedconnpref.h> // TExtendedConnPref
+
+// CLASS DECLARATION
+class MSatSendDataObserver;
+class MSatConnectionObserver;
+/**
+*  Interface for BIP Data channel.
+*
+*  @lib SatEngine
+*  @since Series 60 3.0
+*/
+class MSatBIPDataChannel
+    {
+
+    public: // Structs
+
+        // Contains all the information needed to establish connection.
+        // Parameters are common to all bearers
+        struct TSatBipConnectionInfo
+            {
+            RSat::TSimMeInterface iProtocol;     // TCP or UDP, port number
+            RSat::TOtherAddress   iDestination;  // Dest. address, IPv4 or IPv6
+            TUint16               iBufferSize;   // Size of the receive buffer
+            TExtendedConnPref*    iOverrideSet;  // extended connection
+            RSat::TBearerParams   iBearerParams; // QoS parameters
+            RSat::TOtherAddress   iSource;       // Local addr, IPv4 or IPv6
+            TUint32               iCreatedApnId; // ID of the created APN
+            };
+
+    public: // New functions
+
+        /**
+        * Sets up connection. Does not activate it yet.
+        * @param aConnParams includes all needed information to
+        *        open the connection.
+        */
+        virtual void SetupConnectionL(
+            const TSatBipConnectionInfo& aConnParams ) = 0;
+
+        /**
+        * Activates connection. Connection information must be set before
+        * activating connection
+        * @param aObserver Observer of the connection
+        */
+        virtual void ActivateConnectionL( 
+            MSatConnectionObserver* aObserver ) = 0;
+        
+        /**
+        * From MSatBIPDataChannel Returns Negotiated bearer parameters
+        * @param aResult Output Negotiated bearer parameters
+        */
+        virtual void GetNegotiatedQoSParams( 
+            RSat::TBearerParams& aResult ) const = 0;
+        
+        /**
+        * Sends the data or stores it into a buffer for later send.
+        * @param aData Data to be send.
+        * @param aSendImmedeately Indicates whether to send immediately or
+        *        store data to buffer for later send.
+        * @param aFreeBufferSize The number of bytes of empty size in the buffer
+        * @param aObserver Observer of the completion of data send.
+        * @return Error code indicating the status of the command execution.
+        */
+        virtual TInt SendDataL( const TDes8& aData,
+                                const TBool aSendImmediately,
+                                TInt& aFreeBufferSize,
+                                MSatSendDataObserver* aObserver ) = 0;
+
+        /**
+        * Receives the data from the buffer.
+        * @param aData Data to receive.
+        * @param aBytesToRead The number of requested bytes to return
+        * @param aAvailableBytes Number of unread bytes left in the buffer.
+        * @return Error code indicating the status of the command execution.
+        */
+        virtual TInt ReceiveDataL( TDes8& aData,
+                                   const TInt aBytesToRead,
+                                   TInt& aAvailableBytes ) = 0;
+
+        /**
+        * Returns the ID of this data channel.
+        * @return ID of this channel.
+        */
+        virtual TInt ChannelId() const = 0;
+
+        /**
+        * Returns the ID of this data channel to ChannelStatus
+        * @return ID that can be placed to ChannelStatus
+        */
+        virtual TUint8 ChannelStatusChannelId() const = 0;
+
+        /**
+        * Returns the status of this channel.
+        * @return Status of this data channel
+        */
+        virtual TInt Status() const = 0;
+
+        /**
+        * Closes the connection and empties the buffers.
+        */
+        virtual void CloseChannel() = 0;
+
+        /**
+        * Cancels all actions.
+        */
+        virtual void CancelAll() = 0;
+
+        /**
+        * Indicates whether PDP contex is active or not.
+        * @return TBool indicating context activation.
+        */
+        virtual TBool IsContextActive() const = 0;
+        
+        /**
+        * Returns connection information
+        * @return Connection information
+        */
+        virtual const TSatBipConnectionInfo& ConnInfo() const = 0;
+       
+        /**
+        * Close udp socket.
+        */
+        virtual void StopUdpSocket() = 0;
+
+        /**
+        * Destructor.
+        */
+        virtual ~MSatBIPDataChannel() {};
+
+    protected:  // Constructors and destructor
+
+        /**
+        * Constructor.
+        */
+        MSatBIPDataChannel() {};
+
+    private:
+
+        // Assign operator
+        MSatBIPDataChannel& operator=( const MSatBIPDataChannel& );
+
+        // Prohibit copy constructor if not deriving from CBase.
+        MSatBIPDataChannel( const MSatBIPDataChannel& );
+    };
+
+#endif      // MSATBIPDATACHANNEL_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/MSatBIPEventNotifier.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,90 @@
+/*
+* 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:  Notifier of the BIP Events.
+*
+*/
+
+
+
+#ifndef MSATBIPEVENTNOTIFIER_H
+#define MSATBIPEVENTNOTIFIER_H
+
+//  INCLUDES
+#include <e32std.h>
+
+class MSatBIPChannelStatusObserver;
+class MSatBIPDataAvailableObserver;
+
+// CLASS DECLARATION
+
+/**
+*  BIP Event notifier interface. Responsible to notify BIP Event observers
+*  about BIP Events.
+*
+*  @lib SatEngine
+*  @since Series 60 3.0
+*/
+class MSatBIPEventNotifier
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        MSatBIPEventNotifier() {};
+
+        /**
+        * Destructor.
+        */
+        virtual ~MSatBIPEventNotifier() {};
+
+    public: // New functions
+
+        /**
+        * Notification request for DataAvailable event.
+        * @param aObserver An observer of the event.
+        */
+        virtual void NotifyDataAvailable(
+            MSatBIPDataAvailableObserver* aObserver ) = 0;
+
+        /**
+        * Notification request for ChannelStatus event.
+        * @param aObserver An observer of the event.
+        */
+        virtual void NotifyChannelStatus(
+            MSatBIPChannelStatusObserver* aObserver ) = 0;
+
+        /**
+        * Cancels DataAvailable event notification request.
+        */
+        virtual void CancelDataAvailable() = 0;
+
+        /**
+        * Cancels ChannelStatus event notification request.
+        */
+        virtual void CancelChannelStatus() = 0;
+
+    private:
+
+        // Prohibit copy constructor if not deriving from CBase.
+        MSatBIPEventNotifier( const MSatBIPEventNotifier& );
+
+        // Prohibit assigment operator if not deriving from CBase.
+        MSatBIPEventNotifier& operator=( const MSatBIPEventNotifier& );
+
+    };
+
+#endif      // MSATBIPEVENTNOTIFIER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/MSatBIPUtils.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,181 @@
+/*
+* 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:  BIP Utils interface for BIP proactive commands.
+*
+*/
+
+
+
+#ifndef MSATBIPUTILS_H
+#define MSATBIPUTILS_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <etelsat.h>
+
+// CLASS DECLARATION
+class MSatBIPDataChannel;
+class MSatApnHandler;
+
+// CONSTANTS
+// These constants are used by BIP related objects
+// Used in terminal responses and DataAvailable envelope
+const TInt KSatBIPMoreThanMaxSize = 0xFF;
+
+// The minimum size of receive buffer is 1500 bytes.
+const TInt KSatBIPMinReceiveBufferSize = 0x5DC;
+
+// Maximum buffer size from SIM in OpenChannel command is 1500.
+const TInt KSatBIPMaxBufferSize = 0x5DC;
+
+// Maximum size of one ReceiveCommand TerminalResponse
+const TInt KSatBIPMaxResponseSize = 0xED;
+
+/**
+*  BIP Utils interface. Provides functionality to
+*  BIP proactive command handlers.
+*
+*  @lib SatEngine
+*  @since Series 60 3.0
+*/
+class MSatBIPUtils
+    {
+    public: // Enums
+
+        // These values can be used straigth in TerminalResponses
+        // additional info with KBearerIndepProtocolError
+        enum TSatBIPErrors
+            {
+            ESatBIPSuccess                     = 0x00,
+            ESatBIPNoChannelAvail              = 0x01,
+            ESatBIPChannelClosed               = 0x02,
+            ESatBIPChannelIdNotValid           = 0x03,
+            ESatBIPReqBufSizeNotAvail          = 0x04,
+            ESatBIPSecurityError               = 0x05,
+            ESatBIPTransportLevelNotAvailable  = 0x06,
+            ESatBIPRemoteDeviceNotReachable    = 0x07,
+            ESatBIPServiceError                = 0x08,
+            ESatBIPServiceIdUnknown            = 0x09
+            };
+
+        // This comes with OpenChannel command to identify the type
+        // of bearer in the data channel.
+        enum TSatBearerType
+            {
+            ESatDefault,    /* Default bearer type */
+            ESatGPRS,       /* GPRS */
+            ESatCSD         /* CSD, Not supported */
+            };
+
+        // Defines the possible channel IDs. The values should be the same as are in
+        // etelsat.h and these values can be used in functions.
+        enum TSatChannelId
+            {
+            ESatNoChannel               = 0x00,
+            ESatChannel1                = 0x01,
+            ESatChannel2                = 0x02,
+            ESatChannel3                = 0x03,
+            ESatChannel4                = 0x04,
+            ESatChannel5                = 0x05,
+            ESatChannel6                = 0x06,
+            ESatChannel7                = 0x07
+            };
+
+        // Supported status informations
+        enum TSatChannelStatus
+            {
+            ESatNoFurtherInformation = 0x00,
+            ESatLinkDropped          = 0x05
+            };
+
+    protected:  // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        MSatBIPUtils() {};
+
+        /**
+        * Destructor.
+        */
+        virtual ~MSatBIPUtils() {};
+
+    public: // New functions
+
+        /**
+        * Creates new data channel and returns reference to it.
+        * @param aBearerType identifies the type of data channel to create.
+        * @param TSatBIPError code indicating the execution status.
+        * @return Pointer to created data channel
+        */
+        virtual MSatBIPDataChannel* CreateChannelL(
+            const TSatBearerType aBearerType,
+            TInt& aErrCode ) = 0;
+
+        /**
+        * Request to close specified data channel.
+        * @param aChannelId Identifies the channel to be closed.
+        * @return TSatBIPError code indicating the execution status.
+        */
+        virtual TInt CloseChannel( const TInt aChannelId ) = 0;
+
+        /**
+        * Request to open new data channel
+        * @param aChannelId Identifies the channel.
+        * @param aErrCode TSatBIPError code indicating the execution status.
+        * @return Pointer to requested data channel
+        */
+        virtual MSatBIPDataChannel* DataChannel( const TInt aChannelId,
+            TInt& aErrCode ) = 0;
+
+        /**
+        * Request to close specified data channel.
+        * @return Array containing all available data channels.
+        */
+        virtual CArrayPtrFlat<MSatBIPDataChannel>* DataChannels() = 0;
+
+        /**
+        * Generates channel status object from given parameters to
+        * used in terminal responses.
+        * @param aChannelId Data channel identifier.
+        * @param aStatus Data channel's status.
+        * @return channel status object that can be put into terminal responses.
+        */
+        virtual RSat::TChannelStatus GenerateChannelStatusL(
+            const TInt aChannelId, TInt aStatus ) = 0;
+
+        /**
+        * Reference to APN handler
+        * @return Interface reference to CSatApnHandler
+        */
+        virtual MSatApnHandler& ApnHandler() = 0;
+        
+        /**
+        * Status of the PDP Context
+        * @return ETrue, if there is active PDP Context
+        */
+        virtual TBool IsContextActive() = 0;
+
+    private:
+
+        // Prohibit copy constructor if not deriving from CBase.
+        MSatBIPUtils( const MSatBIPUtils& );
+
+        // Prohibit assigment operator if not deriving from CBase.
+        MSatBIPUtils& operator=( const MSatBIPUtils& );
+    };
+
+#endif      // MSATBIPUTILS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/MSatCommand.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,91 @@
+/*
+* 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:  Command interface for use of ui session.
+*
+*/
+
+
+
+#ifndef MSATCOMMAND_H
+#define MSATCOMMAND_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// CLASS DECLARATION
+
+/**
+*  Command interface. Offers accessors for command id and command data.
+*
+*  @lib SatEngine
+*  @since Series 60 3.0
+*/
+class MSatCommand
+    {
+    public: // Enums
+
+        enum TSatCmdId
+            {
+            ESetUpMenuCmdId,
+            ESetUpCallCmdId,
+            ESelectItemCmdId,
+            ESimSessionEndCmdId,
+            ESendSmCmdId,
+            ELaunchBrowserCmdId,
+            EDisplayTextCmdId,
+            EGetInputCmdId,
+            EGetInkeyCmdId,
+            ECallControlCmdId,
+            EMoSmControlCmdId,
+            ESetUpEventListCmdId,
+            ESetUpIdleModeTextCmdId,
+            ESendDtmfCmdId,
+            ESendSsCmdId,
+            ESendUssdCmdId,
+            EPlayToneCmdId,
+            ERefreshCmdId
+            };
+
+    protected:  // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        MSatCommand() {};
+
+        /**
+        * Destructor.
+        */
+        virtual ~MSatCommand() {};
+
+    public: // New functions
+
+        /**
+        * Response from client.
+        */
+        virtual void ClientResponse() = 0;
+
+    private:
+
+        // Prohibit copy constructor if not deriving from CBase.
+        MSatCommand( const MSatCommand& );
+
+        // Prohibit assigment operator if not deriving from CBase.
+        MSatCommand& operator=( const MSatCommand& );
+
+    };
+
+#endif      // MSATCOMMAND_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/MSatConnectionObserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,69 @@
+/*
+* 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:  Interface for Connection observers.
+*
+*/
+
+
+
+#ifndef MSATCONNECTIONOBSERVER_H
+#define MSATCONNECTIONOBSERVER_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// CLASS DECLARATION
+
+/**
+*  Interface for Connection observers. These observers are notified, when
+*  connection is fully up, or an error occurs during connection stage.
+*
+*  @lib SatEngine
+*  @since Series 60 3.0
+*/
+class MSatConnectionObserver
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        MSatConnectionObserver() {};
+
+        /**
+        * Destructor.
+        */
+        virtual ~MSatConnectionObserver() {};
+
+    public: // New functions
+
+        /**
+        * Notification of connection stage
+        * @param aError Indicates the status of connection.
+        */
+        virtual void ConnectionNotification( const TInt aError ) = 0;
+
+    private:
+
+        // Prohibit copy constructor if not deriving from CBase.
+        MSatConnectionObserver( const MSatConnectionObserver& );
+
+        // Prohibit assigment operator if not deriving from CBase.
+        MSatConnectionObserver& operator=( const MSatConnectionObserver& );
+
+    };
+
+#endif      // MSATSENDDATAOBSERVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/MSatEventMonitor.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,94 @@
+/*
+* 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:  Event monitor interface
+*
+*/
+
+
+#ifndef MSATEVENTMONITOR_H
+#define MSATEVENTMONITOR_H
+
+//  INCLUDES
+#include <e32base.h>
+// CLASS DECLARATION
+
+/**
+*  Interface for event monitors.
+*
+*  @lib EventMonitors.lib
+*  @since Series 60 3.0
+*/
+class MSatEventMonitor
+    {
+    public: // Enums
+
+        // Monitored events
+        enum TEvent
+            {
+            EUserActivity,
+            EIdleScreenAvailable,
+            ELanguageSelection,
+            ESimRemoved,
+            EBrowserTerminated,
+            EDataAvailable,
+            EChannelStatus
+            };
+
+    public: // New functions
+
+        /**
+        * Cancels event monitoring
+        */
+        virtual void CancelMonitor() = 0;
+
+        /**
+        * Updates monitors state. This function call starts or cancels monitor
+        * @param aEvents A list of events to be monitored. If this monitors event
+        * is not on the list, this monitor is cancelled.
+        * @return TInt An error code indicating update status
+        */
+        virtual TInt UpdateMonitor( TUint aEvents ) = 0;
+
+        /**
+        * Checks is this event monitor monitoring particular event
+        * @param aEvent Event to check against
+        * @return ETrue if aEvent is the same event this is monitoring
+        */
+        virtual TBool IsMonitoringEvent( const TInt aEvent ) = 0;
+
+        /**
+        * Destructor.
+        */
+        virtual ~MSatEventMonitor() {};
+
+    protected:
+
+        /**
+        * C++ default constructor.
+        */
+        MSatEventMonitor() {};
+
+    private:
+
+        // Prohibit copy constructor if not deriving from CBase.
+        MSatEventMonitor( const MSatEventMonitor& );
+ 
+        // Prohibit assigment operator if not deriving from CBase.
+        MSatEventMonitor& operator=( const MSatEventMonitor& );
+
+    };
+
+#endif      // MSATEVENTMONITOR_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/MSatEventMonitorContainer.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,88 @@
+/*
+* 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:  API for container of event monitors
+*
+*/
+
+
+
+#ifndef MSATEVENTMONITORCONTAINER_H
+#define MSATEVENTMONITORCONTAINER_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <etelsat.h>
+// CLASS DECLARATION
+
+/**
+*  Interface for observing events.
+*
+*  @lib SatEngine
+*  @since Series 60 3.0
+*/
+class MSatEventMonitorContainer
+    {
+    protected: // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        MSatEventMonitorContainer() {};
+
+        /**
+        * Destructor.
+        */
+        virtual ~MSatEventMonitorContainer() {};
+
+    public: // New functions
+
+        /**
+        * Updates monitors state.
+        * @param aEvents Events that should be monitored.
+        * @return KErrNone if all goes OK
+        */
+        virtual TInt SetUpEventMonitors( TUint aEvents ) = 0;
+
+        /**
+        * Cancels all monitors.
+        * @return KErrNone if all goes OK
+        */
+        virtual TInt CancelAllMonitors() = 0;
+
+        /**
+        * Solves language code.
+        * @param aLanguageId Resolved language ID
+        */
+        virtual void LanguageSettingL( TInt& aLanguageId ) = 0;
+
+        /**
+        * Gets the ISO639 language code.
+        * @param aId Language ID
+        * @param aText Language code can be read from this after function call.
+        */
+        virtual void GetLanguageString( const TInt aId, TDes& aText ) = 0;
+
+    private:
+
+        // Prohibit copy constructor if not deriving from CBase.
+        MSatEventMonitorContainer( const MSatEventMonitorContainer& );
+
+        // Prohibit assigment operator if not deriving from CBase.
+        MSatEventMonitorContainer& operator=( const MSatEventMonitorContainer& );
+
+    };
+
+#endif      // MSATEVENTMONITORCONTAINER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/MSatEventMonitorUtils.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Interface for event monitor utils
+*
+*/
+
+
+
+#ifndef MSATEVENTMONITORUTILS_H
+#define MSATEVENTMONITORUTILS_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <etelsat.h>
+
+// FORWARD DECLARATION
+class MSatBIPEventNotifier;
+
+// CLASS DECLARATION
+
+/**
+*  Interface for event monitors.
+*
+*  @lib EventMonitors.lib
+*  @since Series 60 3.0
+*/
+class MSatEventMonitorUtils
+    {
+    public: // New functions
+
+        /**
+        * Sends notify to SIM about some event using EventDownload command.
+        * @param aSingleEvent Single event reported to SIM.
+        * @param aFirstArg First argument interpreted according to type of event
+        * @param aSecArg Second argument interpreted according to type of event
+        */
+        virtual void EventDownload(
+            RSat::TEventList aSingleEvent,
+            TInt aFirstArg,
+            TInt aSecArg ) = 0;
+
+        /**
+        * Gives a reference to BIP Event notifier interface.
+        * @return A reference to BIP Event notifier interface.
+        */
+        virtual MSatBIPEventNotifier& BipNotifier() = 0;
+
+        /**
+        * Tells to observer that SIM is removed. Observer should cancel all
+        * monitors.
+        */
+        virtual void SimRemoved() = 0;
+
+        /**
+        * From MSatEventMonitorUtils
+        * Writes time between language selection and reboot.
+        * @param aTime Time before reboot.
+        * @return KErrNone if Language Selection Time is set.
+        */
+        virtual TInt WriteLanguageSelectionTime( TInt aTime ) = 0;
+
+    protected:  // New functions
+
+        /**
+        * Destructor.
+        */
+        virtual ~MSatEventMonitorUtils() {};
+
+        /**
+        * C++ default constructor.
+        */
+        MSatEventMonitorUtils() {};
+
+    private:
+
+        // Prohibit copy constructor if not deriving from CBase.
+        MSatEventMonitorUtils( const MSatEventMonitorUtils& );
+
+        // Prohibit assigment operator if not deriving from CBase.
+        MSatEventMonitorUtils& operator=( const MSatEventMonitorUtils& );
+
+    };
+
+#endif      // MSATEVENTMONITORUTILS_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/MSatEventObserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,68 @@
+/*
+* 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:  Observer of events.
+*
+*/
+
+
+
+#ifndef MSATEVENTOBSERVER_H
+#define MSATEVENTOBSERVER_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// CLASS DECLARATION
+
+/**
+*  Interface for observing events.
+*
+*  @lib SatEngine
+*  @since Series 60 3.0
+*/
+class MSatEventObserver
+    {
+    protected: // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        MSatEventObserver() {};
+
+        /**
+        * Destructor.
+        */
+        virtual ~MSatEventObserver() {};
+
+    public: // New functions
+
+        /**
+        * Notification of event.
+        * @param aEvent Identifies the event.
+        */
+        virtual void Event( TInt aEvent ) = 0;
+
+    private:
+
+        // Prohibit copy constructor if not deriving from CBase.
+        MSatEventObserver( const MSatEventObserver& );
+
+        // Prohibit assigment operator if not deriving from CBase.
+        MSatEventObserver& operator=( const MSatEventObserver& );
+
+    };
+
+#endif      // MSATEVENTOBSERVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/MSatRefreshSubSession.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,84 @@
+/*
+* 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:  Interface for refresh subsession.
+*
+*/
+
+
+
+#ifndef MSATREFRESHSUBSESSION_H
+#define MSATREFRESHSUBSESSION_H
+
+//  INCLUDES
+#include <etelsat.h>
+#include <e32std.h>
+
+// FORWARD DECLARATIONS
+class MSatCommand;
+class MSatReplyObserver;
+
+// CLASS DECLARATION
+
+/**
+*  Interface for refresh subsession.
+*
+*  @lib SatEngine.lib
+*  @since Series S60 3.0
+*/
+class MSatRefreshSubSession
+    {
+    protected:
+
+        /**
+        * C++ default constructor.
+        */
+        MSatRefreshSubSession() {};
+
+        /**
+        * Destructor.
+        */
+        virtual ~MSatRefreshSubSession() {};
+
+    public: // New functions
+
+        /**
+        * Query for allowing the refresh
+        * @param aRefresh Refresh data.
+        */
+        virtual void QueryClient( const RSat::TRefreshV2& aRefresh ) = 0;
+
+        /**
+        * Refresh event.
+        * @param aRefresh Refresh data.
+        */
+        virtual void NotifyClient( const RSat::TRefreshV2& aRefresh ) = 0;
+
+        /**
+        * Refresh cancel event.
+        */
+        virtual void NotifyClientCancel() = 0;
+
+    private:
+
+        // Prohibit copy constructor if not deriving from CBase.
+        MSatRefreshSubSession( const MSatRefreshSubSession& );
+
+        // Prohibit assigment operator if not deriving from CBase.
+        MSatRefreshSubSession& operator=( const MSatRefreshSubSession& );
+
+    };
+
+#endif      // MSATREFRESHSUBSESSION_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/MSatSSimSubscriberId.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,69 @@
+/*
+* 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 is the handler for the SIM Application Toolkit
+*                to dedect the SIM card subscriber id.
+*
+*/
+
+
+
+#ifndef MSATSSIMSUBSCRIBERID_H
+#define MSATSSIMSUBSCRIBERID_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <etelmm.h>
+
+// CLASS DECLARATION
+
+/**
+*  SIM Subscriber id handler interface.
+*
+*  @lib SATEngine.lib
+*  @since Series 60 3.0
+*/
+class MSatSSimSubscriberId
+    {
+    public:  // Constructors and destructor
+
+        /*
+        * Destructor.
+        */
+        virtual ~MSatSSimSubscriberId() {};
+
+    public: // New functions
+
+        /**
+        * Starts listening for the SIM card subscriber id.
+        */
+        virtual void Start() = 0;
+
+    protected:
+
+        /**
+        * Constructor.
+        */
+        MSatSSimSubscriberId() {};
+
+        // Prohibit copy constructor if not deriving from CBase.
+        MSatSSimSubscriberId( const MSatSSimSubscriberId& );
+
+        // Prohibit assigment operator if not deriving from CBase.
+        MSatSSimSubscriberId& operator=( const MSatSSimSubscriberId& );
+
+    };
+
+#endif      // MSATSSIMSUBSCRIBERID_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/MSatSUiClientHandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MSatSUiClientHandler provides functions for some UI activity
+*                like LaunchUi
+*
+*/
+
+
+
+#ifndef MSATSUICLIENTHANDLER_H
+#define MSATSUICLIENTHANDLER_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// FORWARD DECLARATION
+class MSatUiSession;
+class MSatShellController;
+
+// CLASS DECLARATION
+
+/**
+*  Interface provides some activity conserning UI client
+*
+*  @lib SatEngine.lib
+*  @since Series 60 3.0
+*/
+class MSatSUiClientHandler
+    {
+
+     protected:  // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        MSatSUiClientHandler() {};
+
+        /**
+        * Destructor.
+        */
+        virtual ~MSatSUiClientHandler() {};
+
+    public: // New functions
+
+        /**
+        * Gives pointer to ui session interface. If pointer is NULL, then
+        * ui session is not available.
+        * @return Pointer to ui session interface.
+        */
+        virtual MSatUiSession* UiSession() = 0;
+
+        /**
+        * Launches the SAT UI Client.
+        */
+        virtual void LaunchSatUiL() = 0;
+
+        /**
+        * Tells if user has started the ui client.
+        * @return ETrue if user has launched the ui client.
+        */
+        virtual TBool UiLaunchedByUser() = 0;
+
+        /**
+        * Gives pointer to MSatShellController.
+        * @return Pointer to sat shell controller.
+        */
+        virtual MSatShellController& ShellController() = 0;
+
+        /**
+        * Tells is UI closing
+        * @return Boolean value indicating is UI closing
+        */
+        virtual TBool IsUiClosing() const = 0;
+
+    private:
+
+        // Prohibit copy constructor if not deriving from CBase.
+        MSatSUiClientHandler( const MSatSUiClientHandler& );
+
+        // Prohibit assigment operator if not deriving from CBase.
+        MSatSUiClientHandler& operator=( const MSatSUiClientHandler& );
+    };
+
+#endif      // MSATSUICLIENTHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/MSatSendDataObserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,73 @@
+/*
+* 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:  Interface for DataAvailable event observer.
+*
+*/
+
+
+
+#ifndef MSATSENDDATAOBSERVER_H
+#define MSATSENDDATAOBSERVER_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// CLASS DECLARATION
+
+/**
+*  Interface for DataAvailable event observer. When DataAvailable event occurs, the
+*  implementors of this class will be notified. However, this class must be send to 
+*  MSatBIPEventNotifier to get the notification. 
+*
+*  @lib SatEngine
+*  @since Series 60 3.0
+*/
+class MSatSendDataObserver 
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * C++ default constructor.
+        */
+        MSatSendDataObserver() {};
+
+        /**
+        * Destructor.
+        */
+        virtual ~MSatSendDataObserver() {};
+
+    public: // New functions
+
+        /**
+        * Notification of data has been sent
+        * @param aError Indicates the status of data sent. 
+        * @param aLength Number of bytes sent
+        */
+        virtual void DataSentNotification(
+            const TInt aError, 
+            const TInt aLength ) = 0;
+
+    private:
+
+        // Prohibit copy constructor if not deriving from CBase.
+        MSatSendDataObserver( const MSatSendDataObserver& );
+
+        // Prohibit assigment operator if not deriving from CBase.
+        MSatSendDataObserver& operator=( const MSatSendDataObserver& );
+
+    };
+
+#endif      // MSATSENDDATAOBSERVER_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/MSatSystemState.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,158 @@
+/*
+* 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:  Accessor for system states.
+*
+*/
+
+
+
+#ifndef MSATSYSTEMSTATE_H
+#define MSATSYSTEMSTATE_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <etelmm.h>
+#include <etelsat.h>
+#include <PSVariables.h>
+
+// CLASS DECLARATION
+
+/**
+*  Accessors for system state.
+*
+*  @lib SatSystemState.lib
+*  @since Series 60 3.0
+*/
+class MSatSystemState
+    {
+    public:  // Constructors and destructor
+
+        /*
+        * Destructor.
+        */
+        virtual ~MSatSystemState() {};
+
+    public: // New functions
+
+        /**
+        * Getter for NetworkRegistrationStatus
+        * @return Network registration status.
+        */
+        virtual RMobilePhone::TMobilePhoneRegistrationStatus
+            GetNetworkRegistrationStatus() = 0;
+
+        /**
+        * Checks is call active.
+        * @return ETrue if call is currently active.
+        */
+        virtual TBool IsCallActive() = 0;
+
+        /**
+        * Checks is call incoming.
+        * @return ETrue if call is incoming.
+        */
+        virtual TBool IsCallIncoming() = 0;
+
+        /**
+        * Gets the Service Center Address number.
+        * @return SCA number.
+        */
+        virtual const TDesC& SCANumber() = 0;
+
+        /**
+        * Checks whether the phone is in silent mode.
+        * @return Silent mode activated state.
+        */
+        virtual TBool IsSilentMode() = 0;
+
+        /**
+        * Checks whether the phone is in idle state.
+        * @return ETrue if phone is in idle mode.
+        */
+        virtual TBool IsPhoneInIdleStateL() = 0;
+        
+        /**
+        * Checks whether the screen saver is actived from idle.
+        * @return ETrue if screen saver is actived from idle.
+        */        
+        virtual TBool IsScreenSaverActivedFromIdle() = 0;
+
+        /**
+        * Sets time between language selection and reboot.
+        * @param aTime Time before reboot.
+        * @return KErrNone if time is set successfully.
+        */
+        virtual TInt WriteLanguageSelectionTime(
+            TInt aTime ) = 0;
+
+        /**
+        * Puts proactive Idle Mode Text command data to shared data
+        * @param aString Idle mode text string
+        * @param aIconId Idle mode text icon ID
+        * @param aIconQualifier Idle mode text icon qualifier
+        * @return KErrNone if setting data is OK
+        */
+        virtual TInt WriteSetIdleModeText(
+            const TDesC& aString,
+            TInt aIconId,
+            RSat::TIconQualifier aIconQualifier ) = 0;
+
+        /**
+        * Checks is backup / restore process ongoing.
+        * @return TBool indicating is process ongoing or not.
+        */
+        virtual TBool IsBackupProcessOngoing() = 0;
+
+        /**
+        * Checks is ConfirmSatOperations on.
+        * @return TBool indicating is confirmation on or off.
+        */
+        virtual TBool IsConfirmSatOperationsOn() = 0;
+
+        /**
+        * Gets the display language from CentRep and returns it.
+        * @return ID indicating the selected language.
+        */
+        virtual TInt DisplayTextLanguage() = 0;
+
+        /**
+        * Checks is Bluetooth SIM Access Profile active
+        * @return ETrue if BT SAP is active
+        */
+        virtual TBool IsBtSapActive() = 0;
+        
+        /**
+        * Checks are phone warnings and game tones on.
+        * @return TBool indicating wether phone are warnings and game tone on.
+        */
+        virtual TBool IsWarningAndGameTonesOn() = 0;
+
+    protected:
+
+        /**
+        * Constructor.
+        */
+        MSatSystemState() {};
+
+        // Prohibit copy constructor if not deriving from CBase.
+        MSatSystemState( const MSatSystemState& );
+
+        // Prohibit assigment operator if not deriving from CBase.
+        MSatSystemState& operator=( const MSatSystemState& );
+
+    };
+
+#endif      // MSATSYSTEMSTATE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/MSatSystemStateChangeNotifier.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Interface for Publish and suscripe change notifier.
+*
+*/
+
+
+
+#ifndef MSATSYSTEMSTATECHANGENOTIFIER_H
+#define MSATSYSTEMSTATECHANGENOTIFIER_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// CONSTANTS
+// Indicates that the observer doesn't want to specify any value, when it should
+// be notified. In this case, the changed value is sent to observer
+const TInt KNotifyValueNotSet = -1;
+
+// CLASS DECLARATION
+
+/**
+*  Change notifier for Publish & Subscribe.
+*
+*  @lib SatSystemState
+*  @since Series 60 3.0
+*/
+class MSatSystemStateChangeNotifier
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Destructor.
+        */
+        virtual ~MSatSystemStateChangeNotifier() {};
+
+    public: // New functions
+
+        /**
+        * Request a notification of a change in system state.
+        * The request is standing as long as it is canceled.
+        */
+        virtual void NotifyChangeL() = 0;
+
+        /**
+        * Cancels the notification request.
+        */
+        virtual void CancelNotify() = 0;
+        
+        /**
+        * Gets the current value.
+        * @return Current value for earlier request.
+        */
+        virtual TInt GetValueInt() { return KNotifyValueNotSet; };
+
+    protected:  // New functions
+
+        /**
+        * C++ default constructor.
+        */
+        MSatSystemStateChangeNotifier() {};
+
+    private:
+
+        // Prohibit copy constructor if not deriving from CBase.
+        MSatSystemStateChangeNotifier( const MSatSystemStateChangeNotifier& );
+
+        // Prohibit assigment operator if not deriving from CBase.
+        MSatSystemStateChangeNotifier& operator=( const MSatSystemStateChangeNotifier& );
+
+    };
+
+#endif      // MSATSYSTEMSTATECHANGENOTIFIER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/MSatSystemStateObserver.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,91 @@
+/*
+* 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:  Observer for system state changes.
+*
+*/
+
+
+
+#ifndef MSATSYSTEMSTATEOBSERVER_H
+#define MSATSYSTEMSTATEOBSERVER_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// CLASS DECLARATION
+
+/**
+*  Observer for system state changes.
+*
+*  @lib SatSystemState.lib
+*  @since Series 60 3.0
+*/
+class MSatSystemStateObserver
+    {
+    public: // New functions
+
+        /**
+        * Notifies that system state changed.
+        */
+        virtual void StateChanged() {};
+
+        /**
+        * Notifies that system state changed.
+        * @param aValue The new value that has changed.
+        */
+        virtual void StateChanged( const TInt /*aValue*/ ) {};
+
+        /**
+        * Notifies that system state changed.
+        * @param aValue The new value that has changed.
+        */
+        virtual void StateChanged( const TReal& /*aValue*/ ) {};
+
+        /**
+        * Notifies that system state changed.
+        * @param aValue The new value that has changed.
+        */
+        virtual void StateChanged( const TDesC8& /*aValue*/ ) {};
+
+        /**
+        * Notifies that system state changed.
+        * @param aValue The new value that has changed.
+        */
+        virtual void StateChanged( const TDesC16& /*aValue*/ ) {};
+
+    protected:  // New functions
+
+        /**
+        * Destructor.
+        */
+        virtual ~MSatSystemStateObserver() {};
+
+        /**
+        * C++ default constructor.
+        */
+        MSatSystemStateObserver() {};
+
+    private:
+
+        // Prohibit copy constructor if not deriving from CBase.
+        MSatSystemStateObserver( const MSatSystemStateObserver& );
+
+        // Prohibit assigment operator if not deriving from CBase.
+        MSatSystemStateObserver& operator=( const MSatSystemStateObserver& );
+
+    };
+
+#endif      // MSATSYSTEMSTATEOBSERVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/MSatUiSession.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,96 @@
+/*
+* 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:  Interface for Ui sessions
+*
+*/
+
+
+
+#ifndef MSATUISESSION_H
+#define MSATUISESSION_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <etelsat.h>
+#include "SatSOpcodes.h"
+
+// FORWARD DECLARATION
+class MSatCommand;
+
+// CLASS DECLARATION
+
+/**
+*  Ui sub session interface for commands.
+*
+*  @lib SatEngine.lib
+*  @since Series 60 3.0
+*/
+class MSatUiSession
+    {
+    protected:  // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        MSatUiSession() {};
+
+        /**
+        * Destructor.
+        */
+        virtual ~MSatUiSession() {};
+
+    public: // New functions
+
+        /**
+        * Closes the ui session.
+        */
+        virtual void CloseUiSession() = 0;
+
+        /**
+        * Clears the screen.
+        */
+        virtual void ClearScreen() = 0;
+        
+        /**
+        * Ui Event
+        */
+        virtual void UiEventNotification( 
+            TInt aEventId,
+            TInt aEventStatus,
+            TInt aEventError ) = 0;
+
+        /**
+        * Notification that command data is available.
+        * @param aCmdData Data to be sent to client.
+        * @param aCmdRsp Response from Client is written to this.
+        * @param aRequest Request, where the data is sent.
+        */
+        virtual void SendCommand(
+            TDesC8* aCmdData,
+            TDes8* aCmdRsp,
+            TSatServerRequest aRequest ) = 0;
+
+    private:
+
+        // Prohibit copy constructor if not deriving from CBase.
+        MSatUiSession( const MSatUiSession& );
+
+        // Prohibit assigment operator if not deriving from CBase.
+        MSatUiSession& operator=( const MSatUiSession& );
+
+    };
+
+#endif      // MSATUISESSION_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/MSatUtils.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,554 @@
+/*
+* 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:  Utility methods for SAT command handling.
+*
+*/
+
+
+
+#ifndef M_MSATUTILS_H
+#define M_MSATUTILS_H
+
+
+#include <e32std.h>
+#include <etelsat.h>
+#include "MSatRefreshSubSession.h"
+#include "SatSOpcodes.h"
+#include "msatasynctosync.h"
+
+class MUiSessionLaunchObserver;
+class MSatApi;
+class MSatUiSession;
+class MSatEventObserver;
+class MSatSystemState;
+class MSatShellController;
+class MSatSUiClientHandler;
+class MSatCommand;
+class CSatClientServiceReq;
+class MSatEventMonitorContainer;
+class MSatEventMonitorUtils;
+class MSatSSimSubscriberId;
+class MSatBIPUtils;
+class MSatBIPEventNotifier;
+class RMobilePhone;
+class RMmCustomAPI;
+class MSatMediatorEventProvider;
+class MSatMultiModeApi;
+
+/**
+ *  Utility methods for SAT command handling.
+ *
+ *  @lib SatServer
+ *  @since S60 v3.0
+ */
+class MSatUtils
+    {
+
+public:
+
+    /**  For notifying SAT commands/events */
+    enum TSatEvent
+        {
+        /**  Originator:  CSetUpMenuHandler */
+        /**  Listeners:   None */
+        ESetUpMenuExecuting,
+
+        /**  Originator:  CSimSessionEndHandler */
+        /**  Listeners:   CSetUpMenuHandler */
+        ESimSessionEndExecuting,
+
+        /**  Originator:  CSelectItemHandler */
+        /**  Listeners:   None */
+        ESelectItemExecuting,
+
+        /**  Originator:  CSetUpCallHandler */
+        /**  Listeners:   None */
+        ESetUpCallExecuting,
+
+        /**  Originator:  CDisplayTextHandler */
+        /**  Listeners:   None */
+        EDisplayTextExecuting,
+
+        /**  Originator:  CLaunchBrowserHandler */
+        /**  Listeners:   None */
+        ELaunchBrowserExecuting,
+
+        /**  Originator:  CGetInputHandler */
+        /**  Listeners:   None */
+        EGetInputExecuting,
+
+        /**  Originator:  CGetInkeyHandler */
+        /**  Listeners:   None */
+        EGetInkeyExecuting,
+
+        /**  Originator:  CSetUpEventListHandler */
+        /**  Listeners:   None */
+        ESetUpEventListExecuting,
+
+        /**  Originator:  CSetUpIdleModeTextHandler */
+        /**  Listeners:   None */
+        ESetUpIdleModeTextExecuting,
+
+        /**  Originator:  CSendDtmfHandler */
+        /**  Listeners:   None */
+        ESendDtmfExecuting,
+
+        /**  Originator:  CSendSsHandler */
+        /**  Listeners:   None */
+        ESendSsExecuting,
+
+        /**  Originator:  CSendUssdHandler */
+        /**  Listeners:   None */
+        ESendUssdExecuting,
+
+        /**  Originator:  CPlayToneHandler */
+        /**  Listeners:   None */
+        EPlayToneExecuting,
+
+        /**  Originator:  CProvideLocalInfoHandler */
+        /**  Listeners:   None */
+        ELocalInfoExecuting,
+
+        /**  Originator:  CRefreshHandler */
+        /**  Listeners:   CClearScreenHandler */
+        ERefreshExecuting,
+
+        /**  Originator:  CCallControlHandler */
+        /**  Listeners:   CSetUpCallHandler */
+        /**               CSendSsHandler */
+        /**               CSendUssdHandler */
+        ECallControlExecuting,
+
+        /**  Originator:  CSendSmHandler */
+        /**  Listeners:   None */
+        ESendSmExecuting,
+
+        /**  Originator:  CMoSmControlHandler */
+        /**  Listener:    CSendSmHandler */
+        EMoSmControlExecuting,
+
+        /**  Originator:  CMoSmControlHandler */
+        /**  Listener:    CSendSmHandler */
+        EMoSmControlDone,
+
+        /**  Originator:  CCallControlHandler */
+        /**  Listeners:   CSetUpCallHandler */
+        /**               CSendSsHandler */
+        /**               CSendUssdHandler */
+        ECallControlDone,
+
+        /**  Originator:  CSatSSession */
+        /**  Listeners:   CSatCommandContainer */
+        ESatUiClosed,
+
+        /**  Originator:  CSatSSession */
+        /**  Listeners:   CSetUpMenuHandler */
+        ESatUiLaunched,
+
+        /**  originators: CSendSmHandler */
+        /**  Listeners:   CSatSUiSubSession */
+        ESmsSent,
+
+        /**  Originators: CSetUpCallHandler */
+        /**               CSelectItemHandler */
+        /**  Listeners    CSimSessionEndHandler */
+        ESessionTerminatedByUser,
+
+        /**  Originators: CSatCommandHandler */
+        /**  Listeners:   CSimSessionEndHandler */
+        EDestroySimSessionEndTimer,
+
+        /**  Originators: CSatCommandHandler */
+        /**  Listeners:   CSimSessionEndHandler */
+        EDelaySimSessionEnd,
+
+        /**  Originators: CDisplayTextHandler */
+        /**  Listeners:   CSetUpMenuHandler */
+        ESetUpMenuNeeded,
+
+        /**  Originators: CCallControlHandler */
+        /**               CMoSmControlHandler*/
+        /**  Listeners:   CSimSessionEndHandler */
+        ESimSessionEndCallBack,
+
+        /**  Originators: CSatIconSubSession */
+        /**  Listeners:   CSetUpIdleModeTextHandler */
+        EIdleModeResponseSuccess,
+
+        /**  Originators: CSatIconSubSession */
+        /**  Listeners:   CSetUpIdleModeTextHandler */
+        EIdleModeResponseSuccessNoIcon,
+
+        /**  Originators: CSatIconSubSession */
+        /**  Listeners:   CSetUpIdleModeTextHandler */
+        EIdleModeResponseBeyondCapabilities,
+
+        /**  Originators: CSatIconSubSession */
+        /**  Listeners:   CSetUpIdleModeTextHandler */
+        EIdleModeResponseUnableToProcess,
+
+        /**  Originator:  CSatSRefreshSubSession. */
+        /**  Listeners:   CRefreshHandler */
+        ERefreshAllowed,
+
+        /**  Originator:  CSatSRefreshSubSession. */
+        /**  Listeners:   CRefreshHandler */
+        ERefreshNotAllowed,
+
+        /**  Originator:  CSatSRefreshSubSession. */
+        /**  Listeners:   CRefreshHandler */
+        ERefreshEFRead,
+
+        /**  Originator:  CSatSRefreshSubSession. */
+        /**  Listeners:   CRefreshHandler */
+        ERefreshAdditionalEFRead,
+
+        /**  Originators: CSatSSimSubscriberId */
+        /**  Listeners:   CSatCommandContainer */
+        ECmccSimDetected,
+
+        /**  Originators: CSatCommandContainer */
+        /**  Listeners:   CSetUpMenuHandler */
+        EApplNameUpdated,
+
+        /**  Originators: COpenChannelHandler */
+        /**  Listeners:   CReceiveDataHandler */
+        /**               CSendDataHandler */
+        EOpenChannelExecuting,
+
+        /**  Originators: CCloseChannelHandler */
+        /**  Listeners:   None */
+        ECloseChannelExecuting,
+
+        /**  Originators: CGetChannelStatusHandler */
+        /**  Listeners:   None */
+        EGetChannelStatusExecuting,
+
+        /**  Originators: CSendDataHandler */
+        /**  Listeners:   None */
+        ESendDataExecuting,
+
+        /**  Originators: CReceiveDataHandler */
+        /**  Listeners:   None */
+        EReceiveDataExecuting,
+
+        /**  Originators: CDisplayTextHandler */
+        /**  Listeners:   CSimSessionEndHandler */
+        ESustainedTextInDisplay,
+
+        /**  Originators: CDisplayTextHandler */
+        /**  Listeners:   CSimSessionEndHandler */
+        ESustainedTextRemoved,
+
+        /**  Originators: COpenChannelHandler */
+        /**  Listeners:   CSimSessionEndHandler */
+        EDataChannelsActive,
+
+        /**  Originators: CCloseChannelHandler */
+        /**  Listeners:   CSimSessionEndHandler */
+        EDataChannelsInactive,
+
+        /**  Originators: CSendDataHandler */
+        /**               CReceiveDataHandler */
+        /**  Listeners:   CSatSEventMoniotorContainer */
+        EBipCommandExecuting,
+        EBipCommandDoneExecuting,
+
+        /**  Originators: CSatSUiSubSession */
+        /**  Listeners:   Command handlers */
+        ECommandCancelled,
+        ECancelledUsingEndKey,
+
+        /**  Originators: CRefreshHandler */
+        /**  Listeners:   CSetUpIdleModeTextHandler */
+        ESimInitDone,
+
+        /**  Originators: CRefreshRequiredHandler */
+        /**  Listeners:   CSetUpMenuHandler */
+        /**               CSetUpIdleModeTextHandler */
+        /**               CSetUpEventListHandler */
+        ESimResetCalled,
+
+        /**  Originators: CRefreshHandler */
+        /**  Listeners:   CSetUpIdleModeTextHandler */
+        /**               CSetUpEventListHandler */
+        ESimResetCancelled,
+
+        /**  Originator:  CSatUiSubSession */
+        /**  Listeners:   CLaunchBrowserHandler */
+        ESetUpMenuRequested,
+
+        /** Originator:  CSatClientServiceReq */
+        /** Listeners:   CSatSUiClientHandler */
+        EBringSatUiToForeGround,
+
+        /** Originator:  CSatSAPChangeObserver */
+        /** Listeners:   CSetUpMenuHandler */
+        EAddSatUiCalled,
+        ERemoveSatUiCalled
+
+        };
+
+
+    /**
+     * Gives USAT API.
+     *
+     * @since S60 v3.0
+     * @return Reference to USAT API wrapper.
+     */
+    virtual MSatApi& USatAPI() = 0;
+
+    /**
+     * Gives reference to system state interface
+     *
+     * @since S60 v3.0
+     * @return Reference to system state interface.
+     */
+    virtual MSatSystemState& SystemState() = 0;
+
+    /**
+     * Gives reference to MSatSUiClientHandler
+     *
+     * @since S60 v3.0
+     * @return Pointer to sat ui handler.
+     */
+    virtual MSatSUiClientHandler& SatUiHandler() = 0;
+
+    /**
+     * Registers observer for event. Same observer will not be added
+     * more than once for one event.
+     *
+     * @since S60 v3.0
+     * @param aObserver Pointer of observer instance. Panic will occur if
+     * aObserver is NULL.
+     * @param aEvent Event, which will cause the notification of observer.
+     */
+    virtual void RegisterL(
+            MSatEventObserver* aObserver,
+            TSatEvent aEvent ) = 0;
+
+    /**
+     * Notifies event to all registered observers.
+     *
+     * @since S60 v3.0
+     * @param aEvent Event to be notified.
+     */
+    virtual void NotifyEvent( TSatEvent aEvent ) = 0;
+
+    /**
+     * From MSatEventObserver.Sends UI Event Notification,
+     * if UI session is found
+     *
+     * @since S60 v3.1
+     * @param aEvenId, identifies the event
+     * @param aEventStatus, status of the event
+     * @param aEventError, possible error value
+     */
+    virtual void NotifyUiEvent(
+            TInt aEventId,
+            TInt aEventStatus,
+            TInt aEventError ) = 0;
+
+    /**
+     * Unregisters the event notification.
+     *
+     * @since S60 v3.0
+     * @param aObserver Observer of the event
+     * @param aEvent Event to be unregistered.
+     */
+    virtual void UnregisterEvent(
+            MSatEventObserver* aObserver,
+            TSatEvent aEvent ) = 0;
+
+    /**
+     * Removes observer from event observers
+     *
+     * @since S60 v3.0
+     * @param aObserver Observer to removed
+     */
+    virtual void UnregisterEventObserver(
+            MSatEventObserver* aObserver ) = 0;
+
+    /**
+     * Gives number of executing commands currently.
+     * In practise there can be only one executing proactive
+     * command, but envelopes can be executing same time.
+     *
+     * @since S60 v3.0
+     * @return Number of executing command handlers.
+     */
+    virtual TInt NumberOfExecutingCommandHandlers() = 0;
+
+    /**
+     * Gets the sim application name.
+     *
+     * @since S60 v3.0
+     * @return Sat application name.
+     */
+    virtual const TDesC& SatAppName() const = 0;
+
+    /**
+     * Gets the name for the APN
+     *
+     * @since S60 v3.0
+     * @return Sat application name.
+     */
+    virtual const TDesC& BipApnName() const = 0;
+    
+    /**
+     * Restores default SIM Application name.
+     *
+     * @since S60 v3.1
+     */
+    virtual void RestoreSatAppNameL() = 0;
+
+    /**
+     * Sets the sim application name.
+     *
+     * @since S60 v3.0
+     * @param aName New name of Sat application
+     */
+    virtual void SetSatAppNameL( const TDesC& aName ) = 0;
+
+    /**
+     * Gets all refresh subsession.
+     * @return Pointer array of Refresh Sub sessions.
+     */
+    virtual const RPointerArray<MSatRefreshSubSession>&
+            RefreshSubSessions() = 0;
+
+    /**
+     * Registers new service request handler
+     *
+     * @since S60 v3.0
+     * @param aRequest A Request this service request listens
+     * @param aResponse A Response for this service request
+     * @param aCommand A Command handler for request
+     */
+    virtual void RegisterServiceRequestL(
+            TSatServerRequest aRequest,
+            TSatServerRequest aResponse,
+            MSatCommand* aCommand ) = 0;
+
+    /**
+     * Gets all registered service requests
+     *
+     * @since S60 v3.0
+     * @return Pointer array of registered Client Service requests
+     */
+    virtual CArrayPtrFlat<CSatClientServiceReq>*
+            ServiceRequests() = 0;
+
+    /**
+     * Gives pointer to event monitor container
+     *
+     * @since S60 v3.0
+     * @return Pointer to MSatEventMonitorContainer API
+     */
+    virtual MSatEventMonitorContainer* EventMonitors() = 0;
+
+    /**
+     * Gives reference to subscriber id.
+     *
+     * @since S60 v3.0
+     * @return SIM subscriber id API reference
+     */
+    virtual MSatSSimSubscriberId& SimSubscriberId() = 0;
+
+    /**
+     * Gives reference to BIP Utils interface.
+     *
+     * @since S60 v3.0
+     * @return Reference to BIP Utils interface.
+     */
+    virtual MSatBIPUtils& BipUtils() = 0;
+
+    /**
+     * Gives reference to BIP Event notifier interface.
+     *
+     * @since S60 v3.0
+     * @return Reference to BIP Event notifier interface.
+     */
+    virtual MSatBIPEventNotifier& BipEventNotifier() = 0;
+
+    /**
+     * Gives reference to active RMmCustomApi session
+     *
+     * @since S60 v3.1
+     * @return Reference to active RMmCustomApi server session
+     */
+    virtual RMmCustomAPI* CustomApi() = 0;
+    
+
+    /**
+     * Gives reference to MSatMultiModeApi
+     *
+     * @since S60 v5.0
+     * @return Reference to MSatMultiModeApi
+     */
+    virtual MSatMultiModeApi& MultiModeApi() = 0;
+
+    /**
+     * Sends SAT Mediator event to Mediator Event Provider interface.
+     *
+     * @since S60 v3.1
+     * @param aData packaged data to mediator event consumer
+     * @return KErrNone or error code.
+     */
+    virtual TInt RaiseSatEvent( const TDesC8& aData ) = 0;
+
+    /**
+     * Checks Cover UI support for SAT Mediator Event.
+     *
+     * @since S60 v3.1
+     * @return ETrue if supported.
+     */
+    virtual TBool CoverUiSupported() = 0;
+
+    /**
+     * Gives pointer to MSatAsyncToSync interface.
+     *
+     * @since S60 v5.0.1
+     * @return a MSatAsyncToSync Pointer to CreateAsyncToSyncHelper object.
+     */
+    virtual MSatAsyncToSync* CreateAsyncToSyncHelper() = 0;
+
+protected:
+
+    MSatUtils() {};
+
+    virtual ~MSatUtils() {};
+
+private:
+
+    /**
+     * Prohibit copy constructor if not deriving from CBase.
+     *
+     * @since S60 v3.0
+     * @param const reference to MSatUtils.
+     */
+    MSatUtils( const MSatUtils& );
+
+    /**
+     * Prohibit assigment operator if not deriving from CBase.
+     *
+     * @since S60 v3.0
+     * @param const reference to MSatUtils.
+     */
+    MSatUtils& operator=( const MSatUtils& );
+
+    };
+
+#endif // M_MSATUTILS_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/SATPrivateCRKeys.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  SATEngine Subsystem CenRep uid and keys declaration.
+*
+*/
+
+
+#ifndef SATPRIVATECRKEYS_H
+#define SATPRIVATECRKEYS_H
+
+#include <SATInternalPSKeys.h>
+
+// CONSTANTS
+
+// SAT Icon Data Support API
+// Uid :
+const TUid KCRUidSatServer = { 0x102078E1 };
+
+// Defines the limit for KSatMaxIconDataSize
+// Shared Data Value was KMaxIconDataSize
+/**
+* Limit for icon size. Icon support is disabled if value is 0.
+* Possible values are 0 to 9999999999999999.
+*
+* Default value: N/A
+*/
+const TUint32 KSatMaxIconDataSize( 0x00000004 );
+
+// Defines if Cover UI is supported
+/**
+*  Support is disabled if value is 0
+*
+* Default value: N/A
+*/
+const TUint32 KSatSecondaryDisplaySupport( 0x00000008 );
+
+// Defines if Launch Browser GCF Support is available
+/**
+* Support is disabled if value is 0
+*
+* Default value: N/A
+*/
+const TUint32 KSatLaunchBrowserGCF( 0x00000016 );
+
+// Defines whether Home Zone Icon is visible or not
+/**
+* Support is disabled if value is 0
+*
+* Default value: N/A
+*/
+const TUint32 KSatHomeZoneIconVisible( 0x00000032 );
+#endif      // SATPRIVATECRKEYS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/SatLog.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,111 @@
+/*
+* 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:  Offers logging facility through flogger
+*
+*/
+
+
+#ifndef SATLOG_H
+#define SATLOG_H
+
+// LOGGING LEVELS
+const TInt SIMPLE( 1 );
+const TInt NORMAL( 2 );
+const TInt DETAILED( 3 );
+
+#include <flogger.h>
+#include <e32svr.h> // For RDebug
+
+#ifdef ENABLE_SAT_LOGGING
+
+    //
+    // DEFINE THE LOGGING LEVEL HERE: SIMPLE, NORMAL, DETAILED
+    //
+    #define LOGGING_LEVEL NORMAL
+
+    // CONSTANTS
+    _LIT( KLogDir, "sat" );
+    _LIT( KLogFile, "sat.txt" );
+
+    // This warning is disabled: conditinal expression is constant.
+
+    //
+    // USE THIS MACRO FOR LOGGING. THE LEVEL OF LOGGING CAN BE
+    // SIMPLE, NORMAL, DETAILED
+    //
+    #ifdef LOG
+        #undef LOG
+    #endif
+
+    #define LOG( LEVEL, TEXT ) \
+        { \
+        if ( LEVEL <= LOGGING_LEVEL ) \
+            { \
+            _LIT( KText, TEXT ); \
+            RFileLogger::Write( \
+                KLogDir, \
+                KLogFile, \
+                EFileLoggingModeAppend, \
+                KText ); \
+            RDebug::Print( KText ); \
+            } \
+        }
+
+    #ifdef LOG2
+        #undef LOG2
+    #endif
+
+    #define LOG2( LEVEL, TEXT, VARIABLE ) \
+        { \
+        if ( LEVEL <= LOGGING_LEVEL ) \
+            { \
+            _LIT( KText, TEXT ); \
+            RFileLogger::WriteFormat( \
+                KLogDir, \
+                KLogFile, \
+                EFileLoggingModeAppend, \
+                TRefByValue<const TDesC>( KText() ), VARIABLE ); \
+            RDebug::Print( KText, VARIABLE ); \
+            } \
+        }
+
+    #ifdef LOG3
+        #undef LOG3
+    #endif
+
+    #define LOG3( LEVEL, TEXT, VARIABLE1, VARIABLE2 ) \
+        { \
+        if ( LEVEL <= LOGGING_LEVEL ) \
+            { \
+            _LIT( KText, TEXT ); \
+            RFileLogger::WriteFormat( \
+                KLogDir, \
+                KLogFile, \
+                EFileLoggingModeAppend, \
+                TRefByValue<const TDesC>( KText() ), VARIABLE1, VARIABLE2 ); \
+            RDebug::Print( KText, VARIABLE1, VARIABLE2 ); \
+            } \
+        }
+
+#else // ENABLE_SAT_LOGGING
+
+    #define LOG( LEVEL, TEXT )
+
+    #define LOG2( LEVEL, TEXT, VARIABLE1 )
+
+    #define LOG3( LEVEL, TEXT, VARIABLE1, VARIABLE2 )
+
+#endif // ENABLE_SAT_LOGGING
+
+#endif // SATLOG_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/SatMacroes.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* 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:  Definition of test and logging macroes.
+*
+*/
+
+
+#ifndef SATMACROES_H
+#define SATMACROES_H
+
+// Use this macro to enable dummy TSY.
+// Must be disabled on released version.
+// MACRO SAT_USE_DUMMY_TSY
+// #define SAT_USE_DUMMY_TSY
+
+// This used only when testing Launch Browser without real BrowserApp.
+// Must be disabled on released version.
+// MACRO MODULE_TESTING_LB
+// #define MODULE_TESTING_LB
+
+// Use this macro to enable logging.
+// Must be disabled on released version.
+// MACRO ENABLE_SAT_LOGGING
+// #define ENABLE_SAT_LOGGING
+
+#endif      // SATMACROES_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/SatSOpcodes.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,284 @@
+/*
+* 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 data structure and message code
+*                definitions needed by both the server and the client
+*                interfaces at compile time.
+*
+*/
+
+
+#ifndef SATSOPCODES_H
+#define SATSOPCODES_H
+
+//  INCLUDES
+
+#include <e32base.h>
+#include <languages.hrh>    // Contains new language definitions for Series 60.
+
+// CONSTANTS
+// Contains the full path name of the executable to be loaded.
+_LIT( KSatServerNameAndPath, "z:\\sys\\bin\\SatServer.exe" );
+
+// A version must be specified when creating a session with the server.
+const TUint KSatServerMajorVersionNumber = 0;
+const TUint KSatServerMinorVersionNumber = 1;
+const TUint KSatServerBuildVersionNumber = 1;
+
+// Number of message slots
+const TInt KSatMessageSlots = 42;
+
+// Max number of message arguments
+const TInt KSatMaxMessageArguments = 4;
+
+// DATA TYPES
+
+// Operation codes used in message passing between client and server
+enum TSatServerRequest
+    {
+    ESatSNone, // Illegal service request.
+    // Server test commands
+    ESatSDisplayText,
+    ESatSNotifyTest,
+    ESatSNotifyTestCancel,
+    ESatSShutdown,
+    // Proactive commands (asynchronous)
+    ESatSProactiveDisplayText,
+    ESatSProactiveGetInkey,
+    ESatSProactiveGetInput,
+    ESatSProactiveSetUpMenu,
+    ESatSProactiveSelectItem,
+    ESatSProactivePlayTone,
+    ESatSProactiveRefresh,
+    ESatSProactiveQuery, // for Send SM and Set Up Call
+    ESatSProactiveEvent, // for server event notification
+    ESatSProactiveNotification,
+
+    // Envelope commands (synchronous)
+    ESatSActiveMenuSelection,
+
+    // Command responses (synchronous)
+    ESatSProactiveDisplayTextResponse,
+    ESatSProactiveGetInkeyResponse,
+    ESatSProactiveGetInputResponse,
+    ESatSProactiveSetUpMenuResponse,
+    ESatSProactiveSelectItemResponse,
+    ESatSProactivePlayToneResponse,
+    ESatSProactiveQueryResponse,
+    ESatSProactiveEventResponse,
+    ESatSProactiveNotificationResponse,
+
+    ESatSProactiveRefreshResponse,
+
+    // Session indicators (for internal use)
+    ESatSOpenUiSubSession,
+    ESatSGetSIMAppStatus,
+    ESatSCloseUiSubSession,
+
+    // Refresh handling
+    ESatSOpenRefreshSubSession,
+    ESatSCloseRefreshSubSession,
+    ESatSRefreshAllowed,
+    ESatSNotifyAllowRefresh,
+    ESatSNotityAllowRefreshCancel,
+    ESatSNotifyRefresh,
+    ESatSCancelNotifyRefresh,
+    ESatSRefreshEFRead,
+
+    // Icon handling
+    ESatSOpenIconSubSession,
+    ESatSCloseIconSubSession,
+    ESatSGetIconInfo,
+    ESatSGetIconInstance,
+    ESatSIconInstanceGot,
+
+    // SetUpIdleMode response
+    ESatSIdleModeResponse,
+
+    ESatSSessionTerminated
+    };
+
+// String array to convert Symbian TLanguage enums to
+// ISO 639-1 language codes.
+//
+// See "http://lcweb.loc.gov/standards/iso639-2/englangn.html"
+typedef const TText*  TLangString;
+struct SLangString
+    {
+    TInt iId;
+    TLangString iString;
+    };
+
+const SLangString KLangStrings[] =
+    {
+    { ELangEnglish,                 _S( "en" ) },
+    { ELangFrench,                  _S( "fr" ) },
+    { ELangGerman,                  _S( "de" ) },
+    { ELangSpanish,                 _S( "es" ) },
+    { ELangItalian,                 _S( "it" ) },
+    { ELangSwedish,                 _S( "sv" ) },
+    { ELangDanish,                  _S( "da" ) },
+    { ELangNorwegian,               _S( "no" ) },
+    { ELangFinnish,                 _S( "fi" ) },
+
+    // Following three languages are not listed in ISO 639-1 specification.
+    // Decisions based on parent language.
+    { ELangAmerican,                _S( "en" ) },
+    { ELangSwissFrench,             _S( "fr" ) },
+    { ELangSwissGerman,             _S( "de" ) },
+
+    { ELangPortuguese,              _S( "pt" ) },
+    { ELangTurkish,                 _S( "tr" ) },
+    { ELangIcelandic,               _S( "is" ) },
+    { ELangRussian,                 _S( "ru" ) },
+    { ELangHungarian,               _S( "hu" ) },
+    { ELangDutch,                   _S( "nl" ) },
+
+    // Following five languages are not listed in ISO 639-1 specification.
+    // Decisions based on parent language.
+    { ELangBelgianFlemish,          _S( "nl" ) },
+    { ELangAustralian,              _S( "en" ) },  // ISO 639-2 "aus"
+    { ELangBelgianFrench,           _S( "fr" ) },
+    { ELangAustrian,                _S( "de" ) },
+    { ELangNewZealand,              _S( "en" ) },
+
+    { ELangInternationalFrench,     _S( "fr" ) },
+    { ELangCzech,                   _S( "cs" ) },
+    { ELangSlovak,                  _S( "sk" ) },
+    { ELangPolish,                  _S( "pl" ) },
+    { ELangSlovenian,               _S( "sl" ) },
+
+    // Following three languages are not listed in ISO 639-1 specification.
+    // Decisions based on parent language.
+    { ELangTaiwanChinese,           _S( "zh" ) },
+    { ELangHongKongChinese,         _S( "zh" ) },
+    { ELangPrcChinese,              _S( "zh" ) },
+
+    { ELangJapanese,                _S( "ja" ) },
+    { ELangThai,                    _S( "th" ) },
+    { ELangAfrikaans,               _S( "af" ) },
+    { ELangAlbanian,                _S( "sq" ) },
+    { ELangAmharic,                 _S( "am" ) },
+
+    { ELangArabic,                  _S( "ar" ) },
+    { ELangArmenian,                _S( "hy" ) },
+    { ELangTagalog,                 _S( "tl" ) },
+    { ELangBelarussian,             _S( "be" ) },
+    { ELangBengali,                 _S( "bn" ) },
+    { ELangBulgarian,               _S( "bg" ) },
+    { ELangBurmese,                 _S( "my" ) },
+    { ELangCatalan,                 _S( "ca" ) },
+    { ELangCroatian,                _S( "hr" ) },
+
+    // Following language is not listed in ISO 639-1 specification.
+    // Decisions based on parent language.
+    { ELangCanadianEnglish,         _S( "en" ) },
+
+    { ELangInternationalEnglish,    _S( "en" ) },
+
+    // Following language is not listed in ISO 639-1 specification.
+    // Decisions based on parent language.
+    { ELangSouthAfricanEnglish,     _S( "en" ) },
+
+    { ELangEstonian,                _S( "et" ) },
+    { ELangFarsi,                   _S( "fa" ) },
+
+    // Following language is not listed in ISO 639-1 specification.
+    // Decisions based on parent language.
+    { ELangCanadianFrench,          _S( "fr" ) },
+
+    { ELangScotsGaelic,             _S( "gd" ) },
+    { ELangGeorgian,                _S( "ka" ) },
+    { ELangGreek,                   _S( "el" ) },
+
+    // Following language is not listed in ISO 639-1 specification.
+    // Decisions based on parent language.
+    { ELangCyprusGreek,             _S( "el" ) },
+
+    { ELangGujarati,                _S( "gu" ) },
+    { ELangHebrew,                  _S( "he" ) },
+    { ELangHindi,                   _S( "hi" ) },
+    { ELangIndonesian,              _S( "id" ) },
+    { ELangIrish,                   _S( "ga" ) },
+
+    // Following language is not listed in ISO 639-1 specification.
+    // Decisions based on parent language.
+    { ELangSwissItalian,            _S( "it" ) },
+
+    { ELangKannada,                 _S( "kn" ) },
+    { ELangKazakh,                  _S( "kk" ) },
+    { ELangKhmer,                   _S( "km" ) },
+    { ELangKorean,                  _S( "ko" ) },
+    { ELangLao,                     _S( "lo" ) },
+    { ELangLatvian,                 _S( "lv" ) },
+    { ELangLithuanian,              _S( "lt" ) },
+    { ELangMacedonian,              _S( "mk" ) },
+    { ELangMalay,                   _S( "ms" ) },
+    { ELangMalayalam,               _S( "ml" ) },
+    { ELangMarathi,                 _S( "mr" ) },
+    { ELangMoldavian,               _S( "mo" ) },
+    { ELangMongolian,               _S( "mn" ) },
+    { ELangNorwegianNynorsk,        _S( "nn" ) },
+
+    // Following language is not listed in ISO 639-1 specification.
+    // Decisions based on parent language.
+    { ELangBrazilianPortuguese,     _S( "pt" ) },
+
+    { ELangPunjabi,                 _S( "pa" ) },
+    { ELangRomanian,                _S( "ro" ) },
+    { ELangSerbian,                 _S( "sr" ) },
+    { ELangSinhalese,               _S( "si" ) },
+    { ELangSomali,                  _S( "so" ) },
+    { ELangInternationalSpanish,    _S( "es" ) },
+
+    // Following language is not listed in ISO 639-1 specification.
+    // Decisions based on parent language.
+    { ELangLatinAmericanSpanish,    _S( "es" ) },
+
+    { ELangSwahili,                 _S( "sw" ) },
+
+    // Following language is not listed in ISO 639-1 specification.
+    // Decisions based on parent language.
+    { ELangFinlandSwedish,          _S( "sv" ) },
+
+    { ELangReserved1,               _S( "en" ) },
+    { ELangTamil,                   _S( "ta" ) },
+    { ELangTelugu,                  _S( "te" ) },
+    { ELangTibetan,                 _S( "bo" ) },
+    { ELangTigrinya,                _S( "ti" ) },
+
+    // Following language is not listed in ISO 639-1 specification.
+    // Decisions based on parent language.
+    { ELangCyprusTurkish,           _S( "tr" ) },
+
+    { ELangTurkmen,                 _S( "tk" ) },
+    { ELangUkrainian,               _S( "uk" ) },
+    { ELangUrdu,                    _S( "ur" ) },
+    { ELangReserved2,               _S( "en" ) },
+    { ELangVietnamese,              _S( "vi" ) },
+    { ELangWelsh,                   _S( "cy" ) },
+    { ELangZulu,                    _S( "zu" ) },
+
+    // Series 60 added language codes.
+    { KLangTaiwanEnglish,           _S( "en" ) },
+    { KLangHongKongEnglish,         _S( "en" ) },
+    { KLangPrcEnglish,              _S( "en" ) },
+    { KLangJapaneseEnglish,         _S( "en" ) },
+    { KLangThaiEnglish,             _S( "en" ) },
+    };
+
+#define KNUMLANGSTRINGS ( sizeof( KLangStrings ) / sizeof( SLangString ) )
+
+#endif      // SATSOPCODES_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/SatSTypes.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,141 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 data structure definitions
+*     needed by both the server and the client interfaces at compile
+*     time.
+*
+*
+*/
+
+
+#ifndef SATSTYPES_H
+#define SATSTYPES_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <etelsat.h>
+#include <msatuiobserver.h>
+
+// CONSTANTS
+
+// The length of the IPC data buffer.
+const TInt KSatIpcBufferLength = 256;
+
+// The size of the name buffer of SAT application.
+const TInt KSatAppNameSize = 255;
+
+// The size of the name buffer of SAT application.
+const TInt KSatGetInputEntrySize = 256;
+
+// DATA TYPES
+
+// The query IPC data structure.
+struct TSatDisplayTextV1
+    {
+    TUint8 iPCmdNumber;
+    TBuf<KSatIpcBufferLength> iText;
+    TBuf<KSatIpcBufferLength> iSimApplicationName;
+    RSat::TIconId iIconId;
+    TBool iSustainedText;
+    TTimeIntervalSeconds iDuration;
+    RSat::TClearScreenTrigger iClearScreen;
+    };
+
+// The query IPC data package.
+typedef TPckg<TSatDisplayTextV1> TSatDisplayTextV1Pckg;
+
+// The event IPC data structure.
+struct TSatEventV1
+    {
+    TSatSEvent iEvent;
+    TSatSEventStatus iStatus;
+    TInt iError;
+    };
+
+// The event IPC data package.
+typedef TPckg<TSatEventV1> TSatEventV1Pckg;
+
+// The query IPC data structure.
+struct TSatQueryV1
+    {
+    TBuf<KSatIpcBufferLength> iQueryText;
+    TSatSQueryCommand iCommand;
+    TBuf<KSatIpcBufferLength> iSimApplicationName;
+    TBuf<KSatIpcBufferLength> iDestinationName;
+    TSatAlphaIdStatus iAlphaIdStatus;
+    TSatIconId iIconId;
+    };
+
+// The query IPC data package.
+typedef TPckg<TSatQueryV1> TSatQueryV1Pckg;
+
+// The query response IPC data structure.
+struct TSatQueryRspV1
+    {
+    TSatSQueryCommand iCommand;
+    TBool iAccepted;
+    TInt iWgId;
+    TBool iRequestedIconDisplayed;
+    TBool iSessionTerminatedByUser;
+    };
+
+// The query response IPC data package.
+typedef TPckg<TSatQueryRspV1> TSatQueryRspV1Pckg;
+
+// The notification IPC data structure.
+struct TSatNotificationV1
+    {
+    RSat::TAlphaIdBuf iText;
+    TSatSNotifyCommand iCommand;
+    TSatAlphaIdStatus iAlphaIdStatus;
+    TSatControlResult iControlResult; // CC and MoSm
+    TSatIconId iIconId;
+    };
+    
+// The notification response IPC data package.
+typedef TPckg<TSatNotificationV1> TSatNotificationV1Pckg;
+
+// The notification IPC data structure.
+struct TSatNotificationRspV1
+    {
+    TSatSNotifyCommand iCommand;
+    TBool iAccepted;
+    TInt iWgId;
+    TBool iRequestedIconDisplayed;
+    TBool iSessionTerminatedByUser;
+    };
+    
+// The notification response IPC data package.
+typedef TPckg<TSatNotificationRspV1> TSatNotificationRspV1Pckg;
+
+// Types for session termination
+enum TSatTerminationType
+    {
+    ETerminatedByCancel,
+    ETerminatedByEndKey
+    };
+
+// Session termination data structure
+struct TSatTermination
+    {
+    TSatTerminationType type;
+    };
+
+// Session termination IPC data package.
+typedef TPckg<TSatTermination> TSatTerminationPckg;
+
+#endif      // SATSTYPES_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/SatServerFactory.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Factory method for creating SatServer
+*
+*/
+
+
+
+#ifndef SATSERVERFACTORY_H
+#define SATSERVERFACTORY_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// CONSTANTS
+
+_LIT( KSatServerPanic, "SatServer" );
+
+// Full server file path and name.
+// Server name.
+_LIT( KSatServerName, "SatServer" );
+
+// Init error assertion string.
+_LIT( KSatSInitError, "Error initalizing SatServer" );
+
+// FORWARD DECLARATIONS
+class CSatSServer;
+
+/**
+* Creates an instance of CSatSServer
+*/
+//lint -e{1717} void declaration not possible
+IMPORT_C CSatSServer* CreateSatServerL();
+
+#endif      // SATSERVERFACTORY_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/TSatEventMonitorFactory.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* 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:  Factory class for Event monitors
+*
+*/
+
+
+
+#ifndef TSATEVENTMONITORFACTORY_H
+#define TSATEVENTMONITORFACTORY_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class MSatEventMonitor;
+class MSatEventMonitorUtils;
+
+
+// CLASS DECLARATION
+
+/**
+*  Factory class.
+*
+*  @lib EventMonitors.lib
+*  @since Series 60 3.0
+*/
+class TSatEventMonitorFactory
+    {
+    public:  // Factory methods
+
+        /**
+        * Creates pointer array containing event monitor objects.
+        */
+        IMPORT_C static CArrayPtrFlat<MSatEventMonitor>* 
+            CreateEventMonitorsL( MSatEventMonitorUtils& aUtils );
+        
+    };
+
+#endif      // TSATEVENTMONITORFACTORY_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/TSatExtErrorUtils.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* 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:  Maps extended error values to correct values.
+*
+*/
+
+
+
+#ifndef TSATEXTERRORUTILS_H
+#define TSATEXTERRORUTILS_H
+
+#include <e32std.h>
+// CLASS DECLARATION
+
+/**
+*  Extended GSM error utility class. Used to map extended error codes into
+*  correct Network errors. These values are used in SetUpCall, SendSs,
+*  SendUssd and SendSm TerminalResponses, when network returns error.
+*
+*  @lib SatEngine.lib
+*  @since 3.0
+*/
+class TSatExtErrorUtils
+    {
+    
+    public: // New functions
+
+        /**
+        * Maps extended error value to correct value.
+        * @param aExtError Extended GSM error defined in exterror.h
+        * @param aModifyMappedValue, should 8th bit changed into 1 or not. 
+        *        default is ETrue
+        * @return Hex number indicating the correct value
+        */
+        IMPORT_C static TUint8 MapError( 
+            TInt  aExtError, 
+            TBool aModifyMappedValue = ETrue );
+
+        /**
+        * Check is given value GSM extended error
+        * @param aExtError Value to be checked
+        * @return TBool indicating is the value extended GSM error
+        */
+        IMPORT_C static TBool IsExtendedError( TInt aExtError );
+
+        /**
+        * Check should given extended error to be handled as network error
+        * @param aExtError Value to be checked
+        * @return TBool indicating is the value network error
+        */
+        IMPORT_C static TBool IsNetworkError( TInt aExtError );
+        
+    private:
+        
+        /**
+        * Checks specific cases of error codes and changes the code, 
+        * if neccessary.
+        * @param aExtErrorCode code to be checked
+        * @param aNwError, this is where the new nw value is set
+        */
+        static void CheckSpecificCases( TInt aExtError, TUint8& aNwError );
+
+    };
+
+#endif      // TSATEXTERRORUTILS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/TSatSystemStateFactory.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,113 @@
+/*
+* 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:  Factory class that provides SAT SystemState objects
+*                outside of this DLL
+*
+*/
+
+
+
+#ifndef TSATSYSTEMSTATEFACTORY_H
+#define TSATSYSTEMSTATEFACTORY_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// FORWARD DECLARATIONS
+class MSatSystemState;
+class MSatSystemStateChangeNotifier;
+class MSatSystemStateObserver;
+class MSatMultiModeApi;
+
+// CLASS DECLARATION
+
+/**
+*  Factory class.
+*
+*  @lib SatSystemState.lib
+*  @since Series 60 3.0
+*/
+class TSatSystemStateFactory
+    {
+    public:  // Factory methods
+
+        /**
+        * Creates MSatSystemState object.
+        * @param aPhone Reference to MSatMultiModeApi object.
+        * @return Interface to SatSystemnState
+        */
+        IMPORT_C static MSatSystemState* CreateSystemStateL(
+            MSatMultiModeApi& aPhone );
+
+        /**
+        * Creates idle mode change notifier.
+        * @param aObserver Observer, which is notifed when change happens.
+        * @return Interface to PSChangeNotifier listening Idle mode changes.
+        */
+        IMPORT_C static MSatSystemStateChangeNotifier*
+            CreateIdleModeChangeNotifierL(
+                MSatSystemStateObserver& aObserver );
+
+        /**
+        * Creates SIM status change notifier.
+        * @param aObserver Observer, which is notifed when change happens.
+        * @return Interface to PSChangeNotifier listening SIM status changes.
+        */
+        IMPORT_C static MSatSystemStateChangeNotifier*
+            CreateSimStatusChangeNotifierL(
+                MSatSystemStateObserver& aObserver );
+
+        /**
+        * Creates SIM access profile state change observer.
+        * @param aObserver Observer, which is notifed when change happens.
+        * @return Interface CenRepChangeNotifier listening SAP status.
+        */
+        IMPORT_C static MSatSystemStateChangeNotifier*
+            CreateSIMAccessProfileChangeNotifierL(
+                MSatSystemStateObserver& aObserver );
+
+        /**
+        * Creates Startup state change observer.
+        * @param aObserver Observer, which is notifed when change happens.
+        * @return Interface PSChangeNotifier listening startup status.
+        */
+        IMPORT_C static MSatSystemStateChangeNotifier*
+            CreateStartupChangeNotifierL(
+                MSatSystemStateObserver& aObserver );
+
+        /**
+        * Creates language selection observer.
+        * @param aObserver Observer, which is notifed when change happens.
+        * @return Interface to CenRepChangeNotifier listening language
+        * selections.
+        */
+        IMPORT_C static MSatSystemStateChangeNotifier*
+            CreateLanguageSelectionChangeNotifierL(
+                MSatSystemStateObserver& aObserver );
+                
+        /**
+        * Creates Profile state change observer.
+        * @param aObserver Observer, which is notifed when change happens.
+        * @return Interface to CenRepChangeNotifier listening profile
+        * status.
+        */
+        IMPORT_C static MSatSystemStateChangeNotifier*
+            CreateProfileChangeNotifierL(
+                MSatSystemStateObserver& aObserver );
+                
+    };
+
+#endif      // TSATSYSTEMSTATEFACTORY_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/csatsactivewrapper.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,129 @@
+/*
+* 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:  Active object wrapper for SAT Server
+*
+*/
+
+
+#ifndef CSATSACTIVEWRAPPER_H
+#define CSATSACTIVEWRAPPER_H
+
+#include <e32base.h>
+#include "msatasynctosync.h"
+
+/**
+ *  Active object wrapper for SAT Server
+ *
+ *  Provides asynchronous function calls to be synchronized functions. 
+ *  Provides also timer functionality.
+ *
+ *  @lib satengine.lib
+ *  @since S60 v3.1
+ */
+class CSatSActiveWrapper : public CActive, public MSatAsyncToSync
+    {
+
+public:
+
+    /**
+    * Default C++ constructor
+    */
+    CSatSActiveWrapper();
+
+    /**
+    * Destructor
+    */
+    virtual ~CSatSActiveWrapper();
+
+
+    /**
+     * Gives reference to this active object wrapper's request status. Use this 
+     * when calling asynchronous function and you want to use this wrapper.
+     *
+     * @return  Request status to be sent to asynchronous function call
+     */
+    TRequestStatus& RequestStatus();
+
+    /**
+     * Sets this wrapper active and starts waiting for request to complete.
+     * Function returns after request status given to asynchronous funtion with 
+     * RequestStatus is completed or wrapper is cancelled.
+     *
+     * @return System-wide error code indicating the completion of request
+     */
+    TInt SetActiveAndWait();
+
+    /**
+     * Starts timer. Function returns as the given time has elapsed or 
+     * timer is cancelled.
+     *
+     * @param aDelay Delay from the function call to complete function in microseconds
+     * @param aInterval Interval to complete wait after aDelay, zero by default
+     */
+    void After( const TTimeIntervalMicroSeconds32& aDelay,
+                const TTimeIntervalMicroSeconds32& aInterval = 0 );
+
+     /**
+     * Cancels request status or timer depending which is active
+     */
+    void CancelWrapper();
+
+     /**
+     * Release object
+     */
+    void Release();
+
+    /**
+     * From CActive.
+     * Called when request status given SetActiveAndWait completes
+     */
+    void RunL();
+
+    /**
+     * From CActive.
+     * Called when request is cancelled
+     */
+    void DoCancel();
+
+private:
+
+    /**
+     * Called after given delay in After function. 
+     * Causes the After function to complete
+     *
+     * @param aPtr Pointer to itself since this is static function
+     * @return whether to call function again after an interval
+     */
+    static TInt DelayCallBack( TAny* aPtr );
+
+private: // data
+
+    /**
+     * Blocker for After
+     */
+    CActiveSchedulerWait iAfterWait;
+
+    /**
+     * Blocker for SetActiveAndWait
+     */
+    CActiveSchedulerWait iWait;
+
+    /**
+     * Timer used in After
+     */
+    CPeriodic* iTimer;
+    
+    };
+
+#endif // CSATSACTIVEWRAPPER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/msatasynctosync.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Interface for active object wrapper
+*
+*/
+
+
+#ifndef MSATASYNCTOSYNC_H
+#define MSATASYNCTOSYNC_H
+
+
+#include <e32base.h>
+
+/**
+ *  Active object wrapper for SAT Server
+ *  Interface provides asynchronous function calls to be synchronous functions.
+ *
+ *  @lib satengine.lib
+ *  @since S60 v5.0.1
+ */
+class MSatAsyncToSync
+    {
+
+public:
+
+    /**
+     * Gives reference to this active object wrapper's request status. Use this 
+     * when calling asynchronous function and you want to use this wrapper.
+     *
+     * @return  Request status to be sent to asynchronous function call
+     */
+    virtual TRequestStatus& RequestStatus() = 0;
+    
+    /**
+     * Sets this wrapper active and starts waiting for request to complete.
+     * Function returns after request status given to asynchronous funtion with 
+     * RequestStatus is completed or wrapper is cancelled.
+     *
+     * @return System-wide error code indicating the completion of request
+     */
+    virtual TInt SetActiveAndWait() = 0;
+
+    /**
+     * Cancels request status or timer depending which is active
+     */
+    virtual void CancelWrapper() = 0;
+
+    /**
+     * Release object
+     */
+    virtual void Release() = 0;
+   };
+
+#endif // MSATASYNCTOSYNC_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/msatmediatoreventprovider.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2005-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:  Provider of the SAT Mediator Events.
+*
+*/
+
+
+
+#ifndef M_MSATMEDIATOREVENTPROVIDER_H
+#define M_MSATMEDIATOREVENTPROVIDER_H
+
+
+#include <e32std.h>
+
+
+/**
+*  Mediator Event provider interface.
+*
+*  Responsible to notify Mediator Event Consumers about SAT Mediator Events.
+*
+*  @lib SatEngine
+*  @since S60 v3.1
+*/
+class MSatMediatorEventProvider
+    {
+    
+public:  
+
+    MSatMediatorEventProvider() {};
+
+    virtual ~MSatMediatorEventProvider() {};
+
+    /**
+     * Raises SAT Mediator Event.
+     *
+     * @since S60 v3.1
+     * @param aData contains packaged event information for event consumer
+     * @return KErrNone or possible error code
+     */
+    virtual TInt RaiseSatEvent( const TDesC8& aData ) = 0;
+
+    /**
+     * Checks Cover UI support for SAT Mediator Event.
+     *
+     * @since S60 v3.1
+     * @return ETrue if cover Ui is supported
+     */        
+    virtual TBool CoverUiSupported() = 0;
+
+private:
+
+    /**
+     * Prohibit copy constructor if not deriving from CBase.
+     *
+     * @since S60 v3.1
+     * @param const reference to MSatMediatorEventProvider.
+     */
+    MSatMediatorEventProvider( const MSatMediatorEventProvider& );
+
+    /**
+     * Prohibit assigment operator if not deriving from CBase.
+     *
+     * @since S60 v3.1
+     * @param const reference to MSatMediatorEventProvider.
+     */
+    MSatMediatorEventProvider& 
+            operator=( const MSatMediatorEventProvider& );
+
+    };
+
+#endif // M_MSATMEDIATOREVENTPROVIDER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/msatmultimodeapi.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,171 @@
+/*
+* 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 that access to etelmm API in sat
+*
+*/
+
+
+#ifndef MSATMULTIMODEAPI_H
+#define MSATMULTIMODEAPI_H
+
+#include <e32base.h>
+#include <etel.h>
+#include <etelmm.h>
+#include <rmmcustomapi.h>
+
+
+/**
+ *  Encapsule the access to etelmm API in sat
+ *
+ *  @lib satengine.lib
+ *  @since S60 v5.0
+ */
+class MSatMultiModeApi
+    {
+
+public:
+    
+    /**
+     * Gives reference to active RMobilePhone session
+     *
+     * @return Reference to active RMobilePhone server session
+     */
+    virtual RMobilePhone* Phone() = 0;
+
+    /**
+     * Gives reference to active Dummy RMobilePhone session
+     *
+     * @return Reference to active Dummy RMobilePhone server session
+     */
+    virtual RMobilePhone* DummyPhone() = 0;
+
+    /**
+     * Gives reference to active RMmCustomApi session
+     *
+     * @return Reference to active RMmCustomApi server session
+     */
+    virtual RMmCustomAPI* CustomApi() = 0;
+
+    /**
+     * Lowers error granularity to basic errors
+     */
+    virtual void LowerErrorGranularity() = 0;
+
+    /**
+     * Raises error granularity to extended errors
+     */
+    virtual void RaiseErrorGranularity() = 0;
+    
+    /**
+     * Access RMobilePhone::GetNetworkRegistrationStatus
+     * for the paramter information please see the etelmm.h
+     */
+    virtual void GetNetworkRegistrationStatus( TRequestStatus& aReqStatus, 
+                RMobilePhone::TMobilePhoneRegistrationStatus& aStatus ) = 0;
+    
+    /**
+     * Access RMobilePhone::NotifyNetworkRegistrationStatusChange
+     * for the paramter information please see the etelmm.h
+     */ 
+    virtual void NotifyNetworkRegistrationStatusChange(
+                TRequestStatus& aReqStatus,
+                RMobilePhone::TMobilePhoneRegistrationStatus& aStatus) = 0;
+                
+    /**
+     * Access RMobilePhone::GetSubscriberId
+     * for the paramter information please see the etelmm.h
+     */ 
+    virtual void GetSubscriberId( TRequestStatus& aReqStatus, 
+                    RMobilePhone::TMobilePhoneSubscriberId& aId ) = 0;              
+
+    /**
+     * Access RMobilePhone::SendDTMFTones
+     * for the paramter information please see the etelmm.h
+     */ 
+    virtual void SendDTMFTones(TRequestStatus& aReqStatus, 
+                    const TDesC& aTones) = 0;    
+    
+    /**
+     * Access RMobilePhone::ContinueDTMFStringSending
+     * for the paramter information please see the etelmm.h
+     */ 
+    virtual TInt ContinueDTMFStringSending( TBool aContinue ) = 0;
+    /**
+     * Access RMobilePhone::CancelAsyncRequest
+     * for the paramter information please see the etelmm.h
+     */
+    virtual void CancelAsyncRequest(TInt aReqToCancel) = 0;
+    
+    
+    /**
+     * Access RMobilePhone::SendNetworkServiceRequestNoFdnCheck
+     * for the paramter information please see the etelmm.h
+     */
+    virtual void SendNetworkServiceRequestNoFdnCheck( 
+            TRequestStatus& aReqStatus, const TDesC& aServiceString) = 0;
+            
+    /**
+     * Access RMobileCall::DialNoFdnCheck
+     * for the paramter information please see the etelmm.h
+     */
+    virtual void DialNoFdnCheck(TRequestStatus& aStatus,
+                const TDesC8& aCallParams,const TDesC& aTelNumber) = 0;
+                                            
+    /**
+     * Access RMobileUssdMessaging::SendNetworkServiceRequestNoFdnCheck
+     * for the paramter information please see the etelmm.h
+     */
+    virtual void SendMessageNoFdnCheck( TRequestStatus& aReqStatus,
+                const TDesC8& aMsgData, const TDesC8& aMsgAttributes ) = 0 ;
+    /**
+     * Access RMobileCall::DialCancel
+     */
+    virtual void DialCancel() = 0;
+
+    /**
+     * Check if there is an incoming call 
+     * @return ETrue if there is an incoming call
+     */
+    virtual TBool IsCallIncoming() = 0;
+
+    /**
+     * Access RMobileCall::NotifyMobileCallStatusChange
+     */
+    virtual void NotifyMobileCallStatusChange( TRequestStatus& aReqStatus,
+                    RMobileCall::TMobileCallStatus& aStatus) = 0; 
+
+    /**
+     * Access RMobileCall::NotifyStatusChangeCancel
+     */
+    virtual void NotifyCallStatusChangeCancel() = 0;
+
+    /**
+     * Access RMobilePhone::TerminateActiveCalls
+     */
+    virtual void TerminateActiveCalls(TRequestStatus& aReqStatus) = 0;
+    
+    /**
+     * Access RMboileCall::GetMobileCallInfo
+     */
+    virtual TInt GetMobileCallInfo(TDes8& aCallInfo) = 0;
+
+    /**
+     * Access RMboileCall::DialEmergencyCall
+     */
+    virtual void DialEmergencyCall(TRequestStatus& aReqStatus, 
+                const TDesC& aNumber) = 0;
+    
+    };
+
+#endif // MSATMULTIMODEAPI_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/inc/tsatinternaliconinfo.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,98 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Sub-session for SAT services.
+*
+*/
+
+#ifndef TSATINTERNALICONINFO_H
+#define TSATINTERNALICONINFO_H
+
+/**
+ * Class for transporting icon image data to SatEngine
+ * Internal parameter class between SAT client and server.
+ *
+ * @code
+ * TSatInternalIconInfo internalIconInfo;
+ * TSatInternalIconInfoPckg internalIconInfoPckg
+ * @endcode 
+ *
+ * @since 5.1
+ */
+NONSHARABLE_CLASS( TSatInternalIconInfo )
+    {
+    public:
+    
+        /**
+         * Coding scheme of the icon.
+         * The same with TSatIconInfo enum.
+         * 
+         * @since 5.1
+         */
+        enum TCodingScheme
+            {
+            EBasic = 0x11,  ///< Basic (Black and White) icon
+            EColor = 0x21   ///< Color icon
+            };    
+
+        /**
+         * Class constructor.
+         */
+        TSatInternalIconInfo() :
+            iWidth( 0 ),
+            iHeight( 0 ),
+            iCodingScheme( EBasic ),
+            iFileIdentifier( 0 ),
+            iOffset( 0 ),
+            iLength( 0 )
+            {
+            };
+
+    public:
+
+        /**
+         * The icon width in pixels.
+         */
+        TInt iWidth;
+
+        /**
+         * The icon height in pixels
+         */
+        TInt iHeight;
+
+        /**
+         * Coding scheme of the icon.
+         */
+        TCodingScheme iCodingScheme;
+
+        /**
+         * File identifier of the icon
+         */
+        TUint16 iFileIdentifier;
+
+        /**
+         * Offset of the icon in EF.
+         */
+        TUint16 iOffset;
+
+        /**
+         * Length of the icon data.
+         */
+        TUint16 iLength;
+    };
+    
+typedef TPckg<TSatInternalIconInfo> TSatInternalIconInfoPckg;
+
+#endif // TSATINTERNALICONINFO_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/loc/SatServer.loc	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,32 @@
+/*
+* 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:  SatServer localisation file
+*
+*/
+
+
+// LOCALISATION STRINGS:
+
+//d: Sat application name under the Sat icon in app shell.
+//l: cell_app_pane_t1
+//w: S90DeskAppName
+//
+#define qtn_sat_log_title "SIM Services"
+
+//d: Application title and SAT application name when China
+//d: Mobile SIM cards used
+//l: cell_app_pane_t1
+#define qtn_sat_cmcc_title "SIM Card Application"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/rom/SatServerResources.iby	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,32 @@
+/*
+* 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:  Sat Server Resources iby file, contains resource file
+*                iby- information
+*
+*/
+
+
+#ifndef SATSERVERRESOURCES_IBY
+#define SATSERVERRESOURCES_IBY
+
+#ifdef __SIMCARD
+
+// Resource file(s) for SatServer
+data = DATAZ_\RESOURCE_FILES_DIR\satserver.rsc  RESOURCE_FILES_DIR\satserver.rsc
+
+#endif // __SIMCARD
+
+#endif // SATSERVERRESOURCES_IBY
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satengine/satserver/rom/satserver.iby	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 2003-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Sat Sever iby file, contains client and shell controller
+*                iby- information
+*
+*/
+
+
+#ifndef SATSERVER_IBY
+#define SATSERVER_IBY
+
+
+file=ABI_DIR\BUILD_DIR\SatSystemState.dll           SHARED_LIB_DIR\SatSystemState.dll
+file=ABI_DIR\BUILD_DIR\SatEventMonitors.dll         SHARED_LIB_DIR\SatEventMonitors.dll
+file=ABI_DIR\BUILD_DIR\SATENGINE.DLL                SHARED_LIB_DIR\SATENGINE.DLL
+file=ABI_DIR\BUILD_DIR\SATSERVER.EXE                PROGRAMS_DIR\SATSERVER.EXE
+file=ABI_DIR\BUILD_DIR\SATCLIENT.DLL                SHARED_LIB_DIR\SATCLIENT.DLL
+file=ABI_DIR\BUILD_DIR\SATINTERNALCLIENT.DLL        SHARED_LIB_DIR\SATINTERNALCLIENT.DLL
+
+// SAT Stub SIS
+data=ZSYSTEM\install\SatServer_stub.sis     System\Install\SatServer_stub.sis
+
+// COMMANDS
+#ifdef __SAT_DISPLAY_TEXT
+ECOM_PLUGIN( DisplayTextCmd.dll, 10202989.rsc )
+#endif
+
+#ifdef __SAT_CALL_CONTROL
+ECOM_PLUGIN( CallControlCmd.dll, 1020298B.rsc )
+#endif
+
+#ifdef __SAT_GET_INKEY
+ECOM_PLUGIN( GetInkeyCmd.dll, 1000A889.rsc )
+#endif
+
+#ifdef __SAT_GET_INPUT
+ECOM_PLUGIN( GetInputCmd.dll, 10202985.rsc )
+#endif
+
+#ifdef __SAT_LANGUAGE_NOTIFICATION
+ECOM_PLUGIN( LanguageNotificationCmd.dll, 101F79FE.rsc )
+#endif
+
+#ifdef __SAT_LAUNCH_BROWSER
+ECOM_PLUGIN( LaunchBrowserCmd.dll, 1000A88D.rsc )
+#endif
+
+#ifdef __SAT_MO_SM_CONTROL
+ECOM_PLUGIN( MoSmControlCmd.dll, 1020298D.rsc )
+#endif
+
+#ifdef __SAT_PLAY_TONE
+ECOM_PLUGIN( PlayToneCmd.dll, 1000A887.rsc )
+#endif
+
+#ifdef __SAT_PROVIDE_LOCAL_INFO
+ECOM_PLUGIN( ProvideLocalInfoCmd.dll, 10205C45.rsc )
+#endif
+
+#ifdef __SAT_REFRESH
+ECOM_PLUGIN( RefreshCmd.dll, 10202990.rsc )
+
+ECOM_PLUGIN( RefreshRequiredCmd.dll, 102078D9.rsc )
+#endif
+
+#ifdef __SAT_SELECT_ITEM
+ECOM_PLUGIN( SelectItemCmd.dll, 1000f00A.rsc )
+#endif
+
+#ifdef __SAT_SEND_DTMF
+ECOM_PLUGIN( SendDtmfCmd.dll, 1000A88B.rsc )
+#endif
+
+#ifdef __SAT_SEND_SS
+ECOM_PLUGIN( SendSsCmd.dll, 1000A884.rsc )
+#endif
+
+#ifdef __SAT_SEND_SM
+ECOM_PLUGIN( SendSmCmd.dll, 1000f020.rsc )
+#endif
+
+#ifdef __SAT_SEND_USSD
+ECOM_PLUGIN( SendUssdCmd.dll, 10202983.rsc )
+#endif
+
+#ifdef __SAT_SETUP_CALL
+ECOM_PLUGIN( SetUpCallCmd.dll, 1000f005.rsc )
+#endif
+
+#ifdef __SAT_SET_UP_EVENT_LIST
+ECOM_PLUGIN( SetUpEventListCmd.dll, 10202992.rsc )
+#endif
+
+#ifdef __SAT_SET_UP_IDLE_MODE_TEXT
+ECOM_PLUGIN( SetUpIdleModeTextCmd.dll, 1000A88A.rsc )
+#endif
+
+#ifdef __SAT_SET_UP_MENU
+ECOM_PLUGIN( SetUpMenuCmd.dll, 1000f000.rsc )
+#endif
+
+ECOM_PLUGIN( SimSessionEndCmd.dll, 1000f010.rsc )
+
+#ifdef __SAT_BIP
+ECOM_PLUGIN( CloseChannelCmd.dll, 102078DB.rsc )
+
+ECOM_PLUGIN( OpenChannelCmd.dll, 101F79FA.rsc )
+
+ECOM_PLUGIN( SendDataCmd.dll, 10205C50.rsc )
+
+ECOM_PLUGIN( ReceiveDataCmd.dll, 10205C52.rsc )
+
+ECOM_PLUGIN( GetChannelStatusCmd.dll, 102078DD.rsc )
+#endif
+
+// USE THESE ONLY IF YOU ARE USING AUTOMATED SAT TSY
+//file=ABI_DIR\BUILD_DIR\DSAT.TSY         SHARED_LIB_DIR\DSAT.TSY
+//file=ABI_DIR\BUILD_DIR\Commands.dll     SHARED_LIB_DIR\commands.dll
+//file=ABI_DIR\BUILD_DIR\TestCases.dll    SHARED_LIB_DIR\TestCases.dll
+//file=ABI_DIR\BUILD_DIR\Tester.dll       SHARED_LIB_DIR\Tester.dll
+
+
+#endif // SATSERVER_IBY
+
+//  End of File
--- a/satui/satapp/inc/csatuiiconhandler.h	Tue Jul 06 14:53:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-/*
-* 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:  Introduces CSatUiIconHandler class, which handles
-*                icon fetching for SatUi.
-*
-*/
-
-
-#ifndef CSATUIICONHANDLER_H
-#define CSATUIICONHANDLER_H
-
-#include <e32base.h>
-#include <rsatservice.h>
-
-class CFbsBitmap;
-class RSatSession;
-
-/**
- *  Handles asynchronous icon fetching for SatUi.
- *
- *  Opens connection to SatClient by using received session attribute.
- *  Receives icon information and does the selection based on received icon id
- *  attribute. Asks the handle of the icon bitmap from the SatClient's
- *  RSatIcon class by giving the icon information and the package for handle,
- *  which is done asynchronously. For mean time, this class is waiting for
- *  completion of request by starting CActiveSchedulerWait, which is stopped
- *  when request is completed. After that the icon is duplicated via RSatIcon
- *  by giving the handle information. This is also an asynchronous call and
- *  CActiveSchedulerWait is started again. When completed the pointer to the
- *  bitmap is returned.
- *
- *  @lib satui.exedll
- *  @since S60 v3.1
- */
-class CSatUiIconHandler : public CBase
-    {
-
-public: // Constructors and destructor
-
-    /**
-     * Constructor.
-     */
-    static CSatUiIconHandler* NewL();
-
-    /*
-     * Destructor.
-     */
-    virtual ~CSatUiIconHandler();
-
-public: // New functions
-
-    /**
-     * The method, which fetches the icon.
-     *
-     * @since S60 v3.1
-     * @param aSatSession Session information for SatClient interface.
-     * @param aIconId Id for icon to be fetched.
-     * @param aOptWidth Optimal width of the icon to be fetched.
-     * @param aOptHeight Optimal height of the icon to be fetched.
-     * @param aIconSupport Flag to signal if icons are not supported at all
-     * @return A pointer to the icon bitmap.
-     */
-    CFbsBitmap* FetchIconL( const RSatSession& aSatSession,
-                            const TUint8 aIconId,
-                            const TInt aOptWidth,
-                            const TInt aOptHeight,
-                            TBool& aIconSupport );
-
-private:
-
-    /**
-     * C++ default constructor.
-     *
-     * @since S60 v3.1
-     */
-    CSatUiIconHandler();
-
-    /**
-     * Sorts the icons into order of superiority and saves the order into a list
-     *
-     * @since S60 v3.1
-     * @param aIconEf List of icons
-     * @param aSelectedIcons List into which order is saved
-     * @param aOptWidth Optimal width of the icon to be fetched.
-     * @param aOptHeight Optimal height of the icon to be fetched.
-     */
-    void SortIconsL( const RIconEf& aIconEf,
-                     RArray<TInt>& aSelectedIcons,
-                     const TInt aOptWidth,
-                     const TInt aOptHeight ) const;
-
-private: // data
-
-    /**
-     * RSatService of the SatClient.
-     */
-    RSatService iSatService;
-
-    };
-
-#endif // CSATUIICONHANDLER_H
--- a/satui/satapp/inc/csatuiobserver.h	Tue Jul 06 14:53:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,396 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  This class handles the communication between server and user
-*                   interface
-*
-*/
-
-
-#ifndef CSATUIOBSERVER_H
-#define CSATUIOBSERVER_H
-
-//  INCLUDES
-#include <msatuiobserver.h>
-#include <rsatuisession.h>
-#include <rsatsession.h>
-#include <QString>
-#include "satappcommonconstant.h"
-// CONSTANTS
-//256 max length-header information fields
-const TInt KAdditionalInfoMaxSize = 244;
-const TInt KMaxPlayToneLength = 50;
-
-enum TIconCommand
-    {
-    EIconSetUpMenuContext = 1,
-    EIconSetUpMenuItems,
-    EIconDisplayText,
-    EIconGetInput,
-    EIconGetInkey,
-    EIconGetYesNo,
-    EIconPlayTone,
-    EIconNotification,
-    EIconConfirmCommand
-    };
-
-// FORWARD DECLARATIONS
-class MSatUiAdapter;
-class MSatUiActionImplementer;
-class CSatUiIconHandler;
-class CFbsBitmap;
-
-// CLASS DECLARATION
-
-/**
-*  This class implements the methods specified in the MSatUiObserver.
-*/
-
-class CSatUiObserver : public CBase,
-                       public MSatUiObserver
-    {
-    public:  // Constructors and destructor
-
-        /**
-        * Two-phased constructor.
-        */
-        static CSatUiObserver* NewL();
-
-        /**
-        * Destructor.
-        */
-        virtual ~CSatUiObserver();
-
-    public: // New functions
-
-        /**
-        * Sets the UI.
-        * @param aImplementer Pointer to be set.
-        */
-        void SetImplementer( MSatUiActionImplementer* aImplementer );
-
-        /**
-        * Returns the adapter provided by SatCli.
-        */
-        MSatUiAdapter* Adapter();
-
-
-        /**
-        * Return current profile state.
-        * @return current profile state.
-        */
-        TInt ProfileState();
-
-        /**
-        * ConnectRSatSession.
-        * 
-        */
-        void ConnectRSatSessionL();
-
-        /**
-        * DisconnectRSatSession
-        * 
-        */
-        void DisconnectRSatSession();
-
-    public: // Functions from base classes
-
-         /**
-        * From MSatUiObserver Notification of the SAT Display Text command.
-        * @param aText The text string to be displayed.
-        * @param aSimApplicationName  Sim Application name
-        * @param aIconId The id of icon.
-        * @param aRequestedIconDisplayed Informs if icon is not used.
-        * @param aSustainedText Indicates is this text sustained ie. no timers
-        *        used if ETrue.
-        * @param aDuration Duration for showing the text
-        * @param aWaitUserToClear Indication if user is needed to clear
-        *        message
-        * @return The response to this command.
-        */
-        TSatUiResponse DisplayTextL( const TDesC& aText,
-            const TDesC& aSimApplicationName,
-            const TSatIconId& aIconId,
-            TBool& aRequestedIconDisplayed,
-            const TBool aSustainedText,
-            const TTimeIntervalSeconds aDuration,
-            const TBool aWaitUserToClear );
-
-        /**
-        * From MSatUiObserver Notification of the SAT Get Inkey command.
-        * @param aText The query text.
-        * @param aCharacterSet The character range allowed.
-        * @param aInput The input character.
-        * @param aHelpIsAvailable A flag indicating  if SAT help is available
-        * @param aIconId The id of icon.
-        * @param aRequestedIconDisplayed Informs if icon is not used.
-        * @param aDuration Duration for showing the dialog.
-        * @param aImmediateDigitResponse Indication if Immediate digit response
-        *        is needed.
-        * @return The response of to this command.
-        */
-        TSatUiResponse GetInkeyL( const TDesC& aText,
-            const TSatCharacterSet aCharacterSet, TChar& aInput,
-            const TBool aHelpIsAvailable,
-            const TSatIconId& aIconId,
-            TBool& aRequestedIconDisplayed,
-            TUint& aDuration,
-            const TBool aImmediateDigitResponse );
-
-        /**
-        * From MSatUiObserver Notification of the SAT Get Input command.
-        * @param aText The query text.
-        * @param aCharacterSet The character range allowed.
-        * @param aInput The input string.
-        * @param aMinLength The minimum length of the input allowed.
-        * @param aMaxLength The maximum length of the input allowed.
-        * @param aHideInput A flag indicating if the input should be hidden.
-        * @param aHelpIsAvailable A flag indicating if SAT help is available.
-        * @param aIconId The id of icon.
-        * @param aRequestedIconDisplayed Informs if icon is not used.
-        * @return The response to this command.
-        */
-        TSatUiResponse GetInputL( const TDesC& aText,
-            const TSatCharacterSet aCharacterSet, TDes& aInput,
-            const TInt aMinLength, const TInt aMaxLength,
-            const TBool aHideInput,
-            const TBool aHelpIsAvailable,
-            const TSatIconId& aIconId,
-            TBool& aRequestedIconDisplayed );
-
-        /**
-        * From MSatUiObserver Notification of the SAT Set Up Menu command.
-        * @param aText The title text.
-        * @param aMenuItems The array of menu item captions.
-        * @param aMenuItemNextActions The array of menu item next action
-        * indicator codes.
-        * @param aHelpIsAvailable A flag indicating if SAT help is available.
-        * @param aIconId The id of title icon.
-        * @param aMenuIcons List of icon identifiers for menu items.
-        * @param aIconListQualifier Indicates how to use icons in the icon list.
-        * @param aSelectionPreference Specifies is the soft keys preferred.
-        * @return The response to this command.
-        */
-        TSatUiResponse SetUpMenuL( const TDesC& aText,
-            const MDesCArray& aMenuItems,
-            const CArrayFixFlat<TSatAction>* aMenuItemNextActions,
-            const TBool aHelpIsAvailable,
-            const TSatIconId& aIconId,
-            const CArrayFixFlat<TInt>* aMenuIcons,
-            const enum TSatIconQualifier aIconListQualifier,
-            const enum TSatSelectionPreference aSelectionPreference );
-
-        /**
-        * From MSatUiObserver Notification of the SAT Select Item command.
-        * @param aText The title text.
-        * @param aMenuItems The array of menu item captions.
-        * @param aMenuItemNextActions The array of menu item next action
-        * indicator codes.
-        * @param aDefaultItem The item selected by default.
-        * @param aSelection The item index selected by the user.
-        * @param aHelpIsAvailable A flag indicating if help is available.
-        * @param aIconId The id of title icon.
-        * @param aMenuIcons List of icon identifiers for menu items.
-        * @param aIconListQualifier Indicates how to use icons in the icon list.
-        * @param aRequestedIconDisplayed Informs if icon is not used.
-        * @param aSelectionPreference Specifies is the soft keys preferred.
-        * @return The response to this command.
-        */
-        TSatUiResponse SelectItemL( const TDesC& aText,
-            const MDesCArray& aMenuItems,
-            const CArrayFixFlat<TSatAction>* aMenuItemNextActions,
-            const TInt aDefaultItem, TUint8& aSelection,
-            const TBool aHelpIsAvailable,
-            const TSatIconId& aIconId,
-            const CArrayFixFlat<TInt>* aMenuIcons,
-            const enum TSatIconQualifier aIconListQualifier,
-            TBool& aRequestedIconDisplayed,
-            const enum TSatSelectionPreference aSelectionPreference );
-
-        /**
-        * From MSatUiObserver Notification of the SAT Play Tone command.
-        * @param aText The text to be displayed.
-        * @param aTone The tone to be played.
-        * @param aDuration The duration of the tone to be played.
-        * @param aIconId The id of icon.
-        * @param aRequestedIconDisplayed Informs if icon is not used.
-        * @return The response to this command.
-        */
-        TSatUiResponse PlayTone( const TDesC& aText,
-            const TSatTone aTone,
-            const TTimeIntervalMicroSeconds aDuration,
-            const TSatIconId& aIconId,
-            TBool& aRequestedIconDisplayed );
-
-        /**
-        * From MSatUiObserver General confirmation request
-        * @param aCommandId ID of the quering command
-        * @param aAlphaIdStatus Alpha Identifier status
-        * @param aText The text to be displayed.
-        * @param aAdditionalText Additional text to be used in queries.
-        * @param aActionAccepted Indicates whether the command was accepted.
-        * @param aIconId The id of icon.
-        * @param aRequestedIconDisplayed Informs if icon is not used.
-        * @param aTerminatedByUser Informs if end key is used.
-        */
-        void ConfirmCommand(
-            const TSatSQueryCommand aCommandId,
-            const TSatAlphaIdStatus aAlphaIdStatus,
-            const TDesC& aText,
-            const TDesC& aAdditionalText,
-            TBool& aActionAccepted,
-            const TSatIconId& aIconId,
-            TBool& aRequestedIconDisplayed,
-            TBool& aTerminatedByUser );
-
-        /**
-        * From MSatUiObserver General notification
-        * @param aCommandId ID of the notifying command
-        * @param aAlphaIdStatus Alpha Identifier status
-        * @param aText Alpha Identifier
-        * @param aIconId The id of icon.
-        * @param aRequestedIconDisplayed Informs if icon is not used.
-        * @param aControlResult Control result of the MoSm and CallControl
-        * @return The response of the UI to this command.
-        */
-        TSatUiResponse Notification(
-            const TSatSNotifyCommand aCommandId,
-            const TSatAlphaIdStatus aAlphaIdStatus,
-            const TDesC& aText,
-            const TSatIconId& aIconId,
-            TBool& aRequestedIconDisplayed,
-            const TSatControlResult aControlResult );
-
-        /**
-        * From MSatUiObserverGeneral event notification. Used for example to
-        * tell UI that command has completed its execution.
-        * @param aEventId, identifies the event
-        * @param aEventStatus, status of the event, used as additional info for
-        *        the event
-        * @param aError, possible error code that may affect on event handling.
-        *        This is also used as additional info
-        */
-        void EventNotification(
-            const TSatSEvent aEventId,
-            const TSatSEventStatus aEventStatus,
-            const TInt aError );
-
-    private:
-
-        /**
-        * C++ default constructor.
-        */
-        CSatUiObserver();
-
-        /**
-        * Symbian OS constructor.
-        */
-        void ConstructL();
-
-        /**
-        * Fetch icon information.
-        * @param aIconId Id for icons
-        * @param aIconCommand Command type for icon.
-        * @return Pointer to selected FbsBitmap icon
-        */
-        CFbsBitmap* FetchIcon( const TUint8 aIconId,
-            const enum TIconCommand aIconCommand );
-
-        /**
-        * Gets default text's resource id
-        * @param aCommandId Identifies the command
-        * @param aControl Used only for MoSm and Call Control
-        * @return Resource id for the default text
-        */
-        void DefaultAlphaId(
-            const TSatSNotifyCommand aCommandId,
-            const TSatControlResult aControlResult,
-            QString &resource) const;
-
-        /**
-        * Get size for the icon in popup window.
-        * @param aSize Reference to the size of icon place.
-        * @param aIconCommand Dialog information
-        * @return TBool Returns EFalse if popup window is not supported
-        *               in current layout.
-        */
-        TBool GetPopUpWindowIconSize( TSize& aSize,
-             const TIconCommand  aIconCommand );
-
-        /**
-        * Creates scalable bitmap.
-        * @param aBitMapToConvert Reference icon to be scaled.
-        * @param aIconCommand Dialog information
-        */
-        void GetScalableBitmapL( CFbsBitmap*& aBitMapToConvert,
-            const TIconCommand  aIconCommand );
-
-        /**
-        * Handles scalable bitmap.
-        * @param aBitMapToConvert Reference icon to be scaled.
-        * @param aIconCommand Dialog information
-        * @param aRequestedIconDisplayed Informs if icon is not shown.
-        */
-        void GetScalableBitmap(
-            CFbsBitmap*& aBitMapToConvert,
-            const TIconCommand  aIconCommand,
-            TBool& aRequestedIconDisplayed );
-
-        /**
-        * Handles scalable bitmap.
-        * @param aBitMapToConvert Reference icon to be scaled.
-        * @param aIconCommand Dialog information
-        */
-        void GetScalableBitmap(
-            CFbsBitmap*& aBitMapToConvert,
-            const TIconCommand  aIconCommand );
-
-    public: // Data
-
-        //wait scheduler
-        CActiveSchedulerWait iWait;
-
-    private: // Data
-
-        // play tone sequence
-        TBuf8<KMaxPlayToneLength> iSequence;
-
-        //Ref: Interface to the UI-part
-        MSatUiActionImplementer* iActionImplementer;
-
-        // own: used with refresh started and finished
-        TBool iRefresh;
-
-        // own: session to sat client
-        RSatUiSession iSat;
-
-        //Ref: Adapter provided by SAT Client
-        MSatUiAdapter* iAdapter;
-
-        //Own: Session
-        RSatSession iSatSession;
-
-        //Own: Current Iconididentifier
-        TInt iIconIdIdentifier;
-
-        // own: used to signal that icons are supported
-        TBool iIconSupport;
-
-        //Own: used to indicate if ESatSClearScreenEvent occurs
-        TBool iClearScreenEvent;
-
-    };
-
-#endif    // CSATUIOBSERVER_H
-
-//  End of File
--- a/satui/satapp/inc/dialogwaiter.h	Tue Jul 06 14:53:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
-* 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: dialog waiter
-*
-*
-*/
-
-#ifndef DIALOGWAITER_H
-#define DIALOGWAITER_H
-
-// INCLUDES
-#include <QObject>
-#include <QEventLoop>
-
-// FORWARD DECLARATION
-class HbAction;
-
-/**
- * This utility synchronises access to dialogs, popups, menus and
- * other ORBIT resources. How to use:
- * <code>
- * HbDialog* dialog = new HbDialog();
- * DialogWaiter waiter();
- * dialog->open(&waiter, SLOT(done(HbAction*)));
- * HbAction* result = waiter.wait();
- * delete dialog;
- * if (result==...) ...
- * </code>
- */
-class DialogWaiter : public QObject
-{
-    Q_OBJECT
-
-    public:
-    
-        /**
-         * waits until dialog exits
-         * returns dialog exit action
-         */
-        HbAction* wait();
-
-    private slots:
-        void done(HbAction* result);
-
-    private:
-        QEventLoop mLoop;
-        HbAction* mResult;
-
-};
-
-#endif  // DIALOGWAITER_H
--- a/satui/satapp/inc/msatuiactionimplementer.h	Tue Jul 06 14:53:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,366 +0,0 @@
-/*
-* 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 MSATUIACTIONIMPLEMENTER_H
-#define MSATUIACTIONIMPLEMENTER_H
-
-//  INCLUDES
-#include <msatuiobserver.h>
-
-// CLASS DECLARATION
-class CCoeEnv;
-class CFbsBitmap;
-
-/**
-*  This class defines the interface between engine and UI.
-*/
-class MSatUiActionImplementer
-    {
-    public:
-
-        /**
-        * Returns CoeEnv.
-        */
-        virtual CCoeEnv* CoeEnv() = 0;
-
-        /**
-        * Shows the wait note.
-        */
-        virtual void ShowWaitNoteL() = 0;
-
-        /**
-        * Shows the wait note without delay
-        */
-        virtual void ShowWaitNoteWithoutDelayL() = 0;
-
-        /**
-        * Removes the wait note from the screen.
-        */
-        virtual void StopShowWaitNote() = 0;
-
-        /**
-        * Handles the DisplayText operation.
-        * @param aText Text to be shown.
-        * @param aSimApplicationName  Sim Application name
-        * @param aIconBitmapDisplayText Icon for dialog
-        * @param aSustainedText Indicates is this text sustained ie. no timers
-        *        used if ETrue.
-        * @param aDuration Duration for showing the text
-        * @param aWaitUserToClear Indication if user is needed to clear
-        *        message
-        * @return Information of the operation result.
-        */
-        virtual TSatUiResponse DisplayTextL( const TDesC& aText,
-            const TDesC& aSimApplicationName,
-            CFbsBitmap* aIconBitmapDisplayText,
-            const TBool aSelfExplanatoryIcon,
-            const TBool aSustainedText,
-            const TTimeIntervalSeconds aDuration,
-            const TBool aWaitUserToClear ) = 0;
-
-        /**
-        * Removes Display Text Dialog from the screen.
-        */
-        virtual void ClearScreen() = 0;
-
-        /**
-        * Asks a Yes/No answer from the user.
-        * @param aText A question to be shown.
-        * @param aCharacterSet The character range allowed.
-        * @param aInkey Character user feeds.
-        * @param aIconBitmap Icon for query dialog.
-        * @param aSelfExplanatory Flag indicating if icon is self-explanatory.
-        * @param aDuration Duration for showing the dialog.
-        * @param aImmediateDigitResponse Indication if Immediate digit response
-        *        is needed.
-        * @return Information of the operation result.
-        */
-        virtual TSatUiResponse GetYesNoL( const TDesC& aText,
-            const TSatCharacterSet aCharacterSet,
-            TChar& aInkey,
-            const CFbsBitmap* aIconBitmap,
-            const TBool aSelfExplanatory,
-            TUint& aDuration,
-            const TBool aImmediateDigitResponse ) = 0;
-
-        /**
-        * Asks input from the user.
-        * @param aText A question to be shown.
-        * @param aCharacterSet The character range allowed.
-        * @param aInput The input string.
-        * @param aMinLength The minimum length of the input allowed.
-        * @param aMaxLength The maximum length of the input allowed.
-        * @param aHideInput A flag indicating if the input should be hidden.
-        * @param aGetInkey A flag indicating if GetInkey command is used.
-        * @param aIconBitmapGetInput Icon for query dialog.
-        * @param aSelfExplanatory  A flag indicating if icon is self-explanatory.
-        * @param aDuration Duration for showing the dialog.
-        * @return Information of the operation result.
-        */
-        virtual TSatUiResponse GetInputL( const TDesC& aText,
-            const TSatCharacterSet aCharacterSet, TDes& aInput,
-            const TInt aMinLength, const TInt aMaxLength,
-            const TBool aHideInput, const TBool aGetInkey,
-            const CFbsBitmap* aIconBitmapGetInput,
-            const TBool aSelfExplanatory,
-            TUint& aDuration ) = 0;
-
-        /**
-        * Handles the SetUpMenu view.
-        * @param aText The title text.
-        * @param aMenuItems The array of menu item captions.
-        * @param aMenuItemNextActions The array of menu item next action
-        * indicator captions.
-        * @param aIconBitmap The Context pane icon.
-        * @param aItemsIconArray Array of item icons
-        * @param aSelfExplanatoryItems Flag indicating if only icons are shown.
-        * @param aHelpIsAvailable A flag indicating if SAT help is available.
-        * @return Information of the operation result.
-        */
-        virtual TSatUiResponse SetUpMenuL( const TDesC& aText,
-            const MDesCArray& aMenuItems,
-            const CArrayFixFlat<TSatAction>* aMenuItemNextActions,
-            const CFbsBitmap* aIconBitmap,
-            //const CAknIconArray* aItemIconsArray,
-            const TBool aSelfExplanatoryItems,
-            const TBool aHelpIsAvailable ) = 0;
-
-       /**
-        * Handles the SelectItem view.
-        * @param aText The title text.
-        * @param aMenuItems The array of menu items.
-        * @param aMenuItemNextActions The array of next action indicators.
-        * @param aDefaultItem The item in focus.
-        * @param aSelection The item index selected by the user.
-        * @param aIconBitmap The Context Pane icon.
-        * @param aItemsIconArray Array of item icons
-        * @param aSelfExplanatoryItems Flag indicating if only icons are shown.
-        * @param aHelpIsAvailable A flag indicating if SAT help is available.
-        * @return Information of the operation result.
-        */
-        virtual TSatUiResponse SelectItemL( const TDesC& aText,
-            const MDesCArray& aMenuItems,
-            const CArrayFixFlat<TSatAction>* aMenuItemNextActions,
-            const TInt aDefaultItem,
-            TUint8& aSelection,
-            const CFbsBitmap* aIconBitmap,
-            //const CAknIconArray* aItemsIconArray,
-            const TBool aSelfExplanatoryItems,
-            const TBool aHelpIsAvailable ) = 0;
-
-        /**
-        * Handles Standard Tone playing.
-        * @param aText The text to be displayed.
-        * @param aFileName The name of the file corresponding to the tone.
-        * @param aDuration The duration of the tone to be played.
-        * @param aIconBitmap The tone playing note icon
-        * @param aSelfExplanatory Flag indicating if icon is self-explanatory.
-        * @return Information of the operation result.
-        */
-        virtual TSatUiResponse PlayStandardToneL( const TDesC& aText,
-            const TDesC8& aSequence,
-            TTimeIntervalMicroSeconds aDuration,
-            const CFbsBitmap* aIconBitmap,
-            const TBool aSelfExplanatory ) = 0;
-
-        /**
-        * Shows the confirmation note about the SAT Send SMS, Send SS or
-        * Send USSD command.
-        * @param aText The text to be displayed.
-        * @param aActionAccepted Indicates whether the command was accepted.
-        * @param aType Type of the request (SMS, SS, USSD).
-        * @return Information of the operation result.
-        */
-        virtual TSatUiResponse ConfirmSendL( const TDesC& aText,
-            TBool& aActionAccepted, TInt aType ) = 0;
-
-        /**
-        * Shows the wait note about the Send SMS command.
-        * @param aText The text to be displayed.
-        * @param aIconBitmapSendSM Sending dialog icon.
-        * @param aSelfExplanatoryIcon A flag indicating if only icon is shown.
-        */
-        virtual void ShowSmsWaitNoteL( const TDesC& aText,
-            const CFbsBitmap* aIconBitmapSendSM,
-            const TBool aSelfExplanatoryIcon ) = 0;
-
-        /**
-        * Shows the wait note about the Send SS command.
-        * @param aText The text to be displayed.
-        * @param aIconBitmap Sending dialog icon.
-        * @param aSelfExplanatoryIcon A flag indicating if only icon is shown.
-        */
-        virtual void ShowSsWaitNoteL( const TDesC& aText,
-            const CFbsBitmap* aIconBitmap,
-            const TBool aSelfExplanatoryIcon ) = 0;
-
-        /**
-        * Shows the confirmation note about the SAT Refresh command.
-        * @param aActionAccepted Indicates whether the command was accepted.
-        * @return Information of the operation result.
-        */
-        virtual TSatUiResponse ConfirmRefreshL(
-            TBool& aActionAccepted) = 0;
-
-        /**
-        * Notification of the SAT Call Control command.
-        * @param aText The text string to be displayed.
-        * @param aAlphaIdStatus Alpha Identifier status
-        * @param aControlResult Call control general result
-        * @return The response from the UI
-        */
-        virtual TSatUiResponse CallControlL(
-            const TDesC& aText,
-            const TSatAlphaIdStatus aAlphaIdStatus ) = 0;
-
-        /**
-        * Notification of the SAT Launch browser confirmation request
-        * @param aText The text to be displayed.
-        * @param aActionAccepted Indicates whether the command was accepted.
-        * @param aIconBitmap The confirm note icon
-        * @param aSelfExplanatory Flag indicating if icon is self-explanatory.
-        */
-        virtual void ConfirmLaunchBrowserL(
-            const TDesC& aText,
-            TBool& aActionAccepted,
-            const CFbsBitmap* aIconBitmap,
-            const TBool aSelfExplanatory ) = 0;
-
-        /**
-        * Notification of the SAT Mo Sm Control command.
-        * @param aText The text string to be displayed.
-        * @param aAlphaIdStatus Alpha Identifier status
-        * @param aControlResult Mo Sm control general result
-        * @return The response from the UI
-        */
-        virtual TSatUiResponse MoSmControlL(
-            const TDesC& aText,
-            const TSatAlphaIdStatus aAlphaIdStatus ) = 0;
-
-        /**
-        * Shows the wait note while DTMF are being sent.
-        * @param aText The text to be displayed.
-        * @param aIconBitmap The confirm note icon
-        * @param aSelfExplanatory Flag indicating if icon is self-explanatory.
-        * @return Information on the operation result.
-        */
-        virtual TSatUiResponse ShowDtmfWaitNoteL( const TDesC& aText,
-            const CFbsBitmap* aIconBitmap,
-            const TBool aSelfExplanatoryIcon ) = 0;
-
-        /** Dispatch iWait to action implementer.
-        * @param aWait Timer.
-        */
-        virtual void DispatchTimer( CActiveSchedulerWait& aWait ) = 0;
-
-        /**
-        * Get flag which is indicating if end key is pressed.
-        * @return A Boolean flag which is indicating if end key is pressed.
-        */
-        virtual TBool GetEndKey() = 0;
-
-        /**
-        * Set a flag which is indicating if end key is pressed.
-        * @param aValue Status of end key
-        */
-        virtual void SetEndKey( TBool aValue ) = 0;
-
-        /**
-        * Set a flag which is indicating if proactive command is pending.
-        * @param aValue Status of proactive command
-        */
-        virtual void SetCommandPending( TBool aValue ) = 0;
-
-        /**
-        * Plays user selected tone.
-        * @param aText The text to be displayed.
-        * @param aDuration Play duration.
-        * @param aTone Tone to be played.
-        * @param aIconBitmap The tone playing note icon
-        * @param aSelfExplanatory Flag indicating if icon is self-explanatory.
-        * @return Information on the operation result.
-        */
-        virtual TSatUiResponse PlayUserSelectedToneL(
-            const TDesC& aText,
-            TTimeIntervalMicroSeconds aDuration,
-            TSatTone aTone,
-            const CFbsBitmap* aIconBitmap,
-            const TBool aSelfExplanatory ) = 0;
-
-        /**
-        * Confirm user permission for Open Channel.
-        * @param aText The text to be displayed.
-        * @param aActionAccepted Indicates whether the command was accepted.
-        * @param aIconBitmapOpenChannel Icon for query dialog
-        * @param aSelfExplanatory A flag indicating if icon is self-explanatory
-        * @return Operation result
-        */
-        virtual TSatUiResponse ConfirmOpenChannelL(
-            const TDesC& aText,
-            TBool& aActionAccepted,
-            const CFbsBitmap* aIconBitmapOpenChannel,
-            const TBool aSelfExplanatory ) = 0;
-
-        /**
-        * Shows the wait note while BIP packets are sent.
-        * @param aCommand Command type.
-        * @param aText The text to be displayed.
-        * @param aIconBitmap Icon for query dialog
-        * @param aSelfExplanatory A flag indicating if icon is self-explanatory
-        */
-        virtual void ShowBIPNoteL(
-            TInt aCommand,
-            const TDesC& aText,
-            const CFbsBitmap* aIconBitmap,
-            const TBool aSelfExplanatory ) = 0;
-
-        /**
-        * Confirm user permission for SetUpCall
-        * @param aText The text to be displayed.
-        * @param aSimAppName Header for th equery
-        * @param aActionAccepted Indicates whether the command was accepted.
-        * @param aIconBitmap Icon for query dialog
-        * @param aSelfExplanatory A flag indicating if icon is self-explanatory
-        */
-        virtual void ConfirmSetUpCallL(
-            const TDesC& aText,
-            const TDesC& aSimAppName,
-            TBool& aActionAccepted,
-            const CFbsBitmap* aIconBitmap,
-            const TBool aSelfExplanatory ) = 0;
-
-        /**
-        * Show note indicating SAT is not available.
-        */
-        virtual void ShowNotAvailableNoteL() = 0;
-
-        /**
-        * Show the Ss error note.
-        */
-        virtual void ShowSsErrorNoteL() = 0;
-
-        /**
-        * Start SatUi closing process.
-        */
-        virtual void CloseSatUI() = 0;
-
-    };
-
-#endif    // MSATUIACTIONIMPLEMENTER_H
-
-//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satui/satapp/inc/satappaction.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,108 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*
+*/
+
+#ifndef SATAPPACTION_H
+#define SATAPPACTION_H
+
+#include <QObject>
+#include <QString>
+#include <QVariant>
+#include <QMap>
+#include <e32base.h> // for symbian-to-qt conversions
+#include "MSatUiObserver.h" // for the param type definitions
+#include "satappconstant.h"
+
+// class declaration
+class SatAppAction : public QObject
+{
+    Q_OBJECT
+
+public:
+    /** creates an action with given identity (TSatAction) */
+    SatAppAction(int action, QObject *parent = 0);
+    ~SatAppAction();
+
+    /** synchronous wait until the action has been completed */
+    void waitUntilCompleted();
+    /** completes the action with guiven response */
+    void complete(TSatUiResponse resp);
+
+public slots:
+
+    /** completes the action */
+    void complete() {complete(response());}
+
+    // comfy methods for completing with certain response
+    void completeWithSuccess() {complete(ESatSuccess);}
+    void completeWithFailure() {complete(ESatFailure);}
+    void completeWithNoResponse() {complete(ESatNoResponseFromUser);}
+    void completeWithBackRequested() {complete(ESatBackwardModeRequestedByUser);}
+    void completeWithSessionTerminated() {complete(ESatSessionTerminatedByUser);}
+
+signals:
+
+    /** signalled when the action has been completed */
+    void actionCompleted(SatAppAction *action);
+
+public: // param access
+
+    /** returns the identity of the action (TSatAction) */
+    int action() {return mAction;}
+
+    /** sets the action response */
+    void setResponse(TSatUiResponse resp) {mResponse=resp;}
+    /** the action response (TSatUiResponse) */
+    TSatUiResponse response() {return mResponse;}
+
+    /** sets a value (arbitary type) */
+    void set(const QString& key, QVariant value);
+
+    /** sets QString value after doing symbian-to-qt conversion */
+    void set(const QString& key, const TDesC& value);
+    /** sets QStringList value after doing symbian-to-qt conversion */
+    void set(const QString& key, const MDesCArray& value);
+    /** sets QList<int> value after doing symbian-to-qt conversion */
+    void set(const QString& key, CArrayFixFlat<TInt>& value);
+    /** sets int(millisec) value after doing symbian-to-qt conversion */
+    void set(const QString& key, TTimeIntervalSeconds& value);
+    /** sets int(millisec) value after doing symbian-to-qt conversion */
+    void set(const QString& key, TTimeIntervalMicroSeconds& value);
+
+    /** returns a value (arbitary type) */
+    QVariant value(const QString &key);
+    /** whether a value is present */
+    bool hasValue(const QString &key);
+
+private: // data
+
+    // identity of this action
+    int mAction;
+
+    // response
+    TSatUiResponse mResponse;
+    
+    // parameter map
+    QMap<QString, QVariant> mParams;
+
+    // internal action state
+    enum State {Active,Waiting,Completed};
+    State mState;
+};
+
+#endif // SATAPPACTION_H
+
--- a/satui/satapp/inc/satappcommandhandler.h	Tue Jul 06 14:53:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,281 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef SATAPPCOMMANDHANDLER_H
-#define SATAPPCOMMANDHANDLER_H
-
-#include <QObject>
-#include <msatuiobserver.h>
-
-class SatAppUiProvider;
-
-class SatAppCommandHandler : public QObject
-    {
-    Q_OBJECT    
-public:
-    SatAppCommandHandler(SatAppUiProvider &ui, QObject *parent = 0);
-    virtual ~SatAppCommandHandler();
-    
-private slots:
- 
-    /**
-    * Handles the SetUpMenu command.
-    * @param aRes the out parameter. the result of the command.
-    * @param aText The title text.
-    * @param aMenuItems The array of menu item captions.
-    * @param aMenuItemNextActions The array of menu item next action
-    * indicator captions.
-    * @param aIconBitmap The Context pane icon.
-    * @param aItemsIconArray Array of item icons
-    * @param aSelfExplanatoryItems Flag indicating if only icons are shown.
-    * @param aHelpIsAvailable A flag indicating if SAT help is available.
-    */
-    void setUpMenu(
-       TSatUiResponse &aRes,
-       const QString &aText,
-       const QStringList &aMenuItems,
-       //const CArrayFixFlat<TSatAction>* aMenuItemNextActions,
-       //const HbIcon &aIcon,
-       //const CAknIconArray* aItemIconsArray,
-       const bool aSelfExplanatoryItems,
-       const bool aHelpIsAvailable);
-    
-    /**
-    * Handles the SelectItem view.
-    * @param aRes the out parameter. the result of the command.
-    * @param aText The title text.
-    * @param aMenuItems The array of menu items.
-    * @param aMenuItemNextActions The array of next action indicators.
-    * @param aDefaultItem The item in focus.
-    * @param aSelection The item index selected by the user.
-    * @param aIconBitmap The Context Pane icon.
-    * @param aItemsIconArray Array of item icons
-    * @param aSelfExplanatoryItems Flag indicating if only icons are shown.
-    * @param aHelpIsAvailable A flag indicating if SAT help is available.
-    * @return Information of the operation result.
-    */
-    void selectItem(
-        TSatUiResponse &aRes,
-        const QString &aText,
-        const QStringList &aMenuItems,
-        //const CArrayFixFlat<TSatAction>* aMenuItemNextActions,
-        const int aDefaultItem,
-        unsigned char &aSelection,
-        //const HbIcon &aIcon,
-        //const CAknIconArray* aItemsIconArray,
-        const bool aSelfExplanatoryItems,
-        const bool aHelpIsAvailable);
-
-    /**
-    * Notification of the SAT Display Text command.
-    * @param aRes, the User's response.
-    * @param aText The text string to be displayed.
-    * @param aSimApplicationName  Sim Application name
-    * @param aIcon the icon to show.
-    * @param aRequestedIconDisplayed Informs if icon is not used.
-    * @param aSustainedText Indicates is this text sustained ie. no timers
-    *        used if ETrue.
-    * @param aDuration Duration for showing the text
-    * @param aWaitUserToClear Indication if user is needed to clear
-    *        message
-    * @return The response of the UI to this command.
-    */
-    void displayText(
-        TSatUiResponse &aRes,
-        const QString &aText,
-        const QString &aSimApplicationName,
-//      const HbIcon &aIcon,
-        bool &aRequestedIconDisplayed,
-        const bool aSustainedText,
-        const int aDuration,
-        const bool aWaitUserToClear);
-    
-    /**
-    * Notification of the SAT Get Input command.
-    * @param aRes, the User's response.
-    * @param aText The text string to be displayed.
-    * @param aSimApplicationName  Sim Application name
-    * @param aIcon the icon to show.
-    * @param aRequestedIconDisplayed Informs if icon is not used.
-    * @param aSustainedText Indicates is this text sustained ie. no timers
-    *        used if ETrue.
-    * @param aDuration Duration for showing the text
-    * @param aWaitUserToClear Indication if user is needed to clear
-    *        message
-    * @return The response of the UI to this command.
-    */
-    void getInkey(
-        TSatUiResponse &aRes,
-        const QString &aTitleText,
-        const TSatCharacterSet aCharacterSet,
-        QString &aInputText,
-        //const QPixmap* /*aIconBitmapGetInput*/,
-        const bool aSelfExplanatory,
-        unsigned int &aDuration);
-
-    /**
-     * Notification of the SAT Get YesNo command.
-     * @param aText The query text.
-     * @param aCharacterSet The character range allowed.
-     * @param aInput The input character.
-     * @param aHelpIsAvailable indicates if help can be requested.
-     * @param aIconId The id of icon.
-     * @param aRequestedIconDisplayed Informs if icon is not used.
-     * @param aDuration Duration for showing the dialog.
-     * @param aImmediateDigitResponse Indication if Immediate digit response
-     *        is needed.
-     * @return The response of the UI to this command.
-     */
-    void getYesNo(
-        TSatUiResponse &aRes,
-        const QString &aText,
-        const TSatCharacterSet aCharacterSet,
-        unsigned int &aInkey,
-        //const TSatIconId &aIconId,
-        const bool &aSelfExplanatory,
-        unsigned int &aDuration,
-        const bool aImmediateDigitResponse);
-    
-    /**
-    * Notification of the SAT Get Input command.
-    * @param aRes, the User's response.
-    * @param aText The text string to be displayed.
-    * @param aSimApplicationName  Sim Application name
-    * @param aIcon the icon to show.
-    * @param aRequestedIconDisplayed Informs if icon is not used.
-    * @param aSustainedText Indicates is this text sustained ie. no timers
-    *        used if ETrue.
-    * @param aDuration Duration for showing the text
-    * @param aWaitUserToClear Indication if user is needed to clear
-    *        message
-    * @return The response of the UI to this command.
-    */
-    void getInput(
-        TSatUiResponse &aRes,
-        const QString &aTitleText,
-        const TSatCharacterSet aCharacterSet,
-        QString &aInputText,
-        const int aMinLength,
-        const int aMaxLength,
-        const bool aHideInput,
-        //const QPixmap* /*aIconBitmapGetInput*/,
-        const bool aSelfExplanatory,
-        unsigned int &aDuration);
-
-    /**
-    * Notification of the SAT Call Control command.
-    * @param aText The text string to be displayed.
-    * @param aAlphaIdStatus alpha ID's status
-    */
-    void callControl(
-        const QString &aText,
-        const TSatAlphaIdStatus aAlphaIdStatus);        
-
-    /**
-    * Notification of the SAT Mo Sms Control command.
-    * @param aText The text string to be displayed.
-    * @param aAlphaIdStatus alpha ID's status
-    */
-    void moSmControl(
-        const QString &aText,
-        const TSatAlphaIdStatus aAlphaIdStatus);
-        
-    /**
-    * Shows the confirmation note about the SAT Send SMS, Send SS or
-    * Send USSD command.
-    * @param aText The text to be displayed.
-    * @param aActionAccepted Indicates whether the command was accepted.
-    * @param aType Type of the request (SMS, SS, USSD).
-    * @return Information of the operation result.
-    */
-    void confirmSend(
-        TSatUiResponse &aRes,
-        const QString &aText,
-        bool &aActionAccepted,
-        int aType);
-
-    /**
-    * Shows the wait note about the Send SMS command.
-    * @param aText The text to be displayed.
-    * @param aIconBitmapSendSM Sending dialog icon.
-    * @param aSelfExplanatoryIcon A flag indicating if only icon is shown.
-    */
-    void showSmsWaitNote(
-        const QString &aText,
-        //const CFbsBitmap* aIconBitmapSendSM,
-        const bool aSelfExplanatoryIcon
-        );
-
-    /**
-    * Shows the wait note about the Send DTMF command.
-    * @param aText The text to be displayed.
-    * @param aIconBitmapSendDtmf Sending dialog icon.
-    * @param aSelfExplanatoryIcon A flag indicating if only icon is shown.
-    */
-    void showDtmfWaitNote(
-        TSatUiResponse &aRes,
-        const QString &aText
-        );
-
-    /*!
-    Stop wait note
-     */
-    void stopShowWaitNote();
-    
-    /**
-    * Shows the confirmation not about SetUpCall.
-    * @param aText The text to be displayed.
-    * @param aSimAppName The header to be displayed.
-    * @param aActionAccepted Indicates whether the command was accepted.
-    */
-    void confirmSetUpCall(
-        const QString &aText,
-        const QString &aSimAppName,
-        bool &aActionAccepted//,
-        //const CFbsBitmap* aIconBitmap,
-        //const TBool aSelfExplanatory
-       );
-
-    /**
-    * Shows the wait note about the Send Ss or Ussd command.
-    * @param aText The text to be displayed.
-    * @param aIconBitmapSendSM Sending dialog icon.
-    * @param aSelfExplanatoryIcon A flag indicating if only icon is shown.
-    */
-    void showSsWaitNote(
-        const QString &aText,
-        //const CFbsBitmap* aIconBitmapSendSM,
-        const bool aSelfExplanatoryIcon
-        );
-
-    /**
-    * Shows the wait note about BIP
-    * @param aCommand command type.
-    * @param aText The text to be displayed.
-    */
-    void showBIPWaitNote(int aCommand, const QString &aText);
-    
-
-private:
-    /**
-    * Not own.
-    */
-    SatAppUiProvider &mUi;
-
-};
-
-#endif /* SATAPPCOMMANDHANDLER_H */
--- a/satui/satapp/inc/satappcommonconstant.h	Tue Jul 06 14:53:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef SATAPPCOMMONCONSTANT_H
-#define SATAPPCOMMONCONSTANT_H
-
-//  CONSTANTS
-
-const int KDisplayTxtUserClearTimeout( 60000 );
-// As the QT for S60 is slow, we use 6 sec, in symbian sat ui we use 3 sec.
-// Rollback to 3s
-const int KDisplayTxtDefaultduration( 3000 );
-
-const unsigned int KGetInputStringMaxSize = 0xEF;
-
-const int KExtendTimeoutMseconds(3000);
-// 1 minute
-const int KDefaultSelectionTimeoutMseconds(60000);
-const int KSymbianTimeConvertQtTime(100);
-const int KMoSmControlTimeOut(3000);
-const int KPlayToneSymbianConvertQtTime(1000);
-
-//enum for SendSms
-/**Sat send sms user response*/
-enum TSatAppConfirmType
-    {
-    ESatUiConfirmSendSms = 1,
-    ESatUiConfirmSendSs,
-    ESatUiConfirmSendUssd
-    };
-   
-enum TSatAppUserResponse
-{
-    /**
-     *  default, user no response
-     */
-    EUserNoResponse = 0,
-    /**
-     *  OK, user response
-     */
-    EUserPrimaryResponse,
-    /**
-     *  Back, user response
-     */
-    EUserSecondaryResponse,
-    /**
-     *  requested to clear by the server
-     */
-    EUserClearResponse,
-    /**
-     *  requested to close application by the server
-     */
-    EUserCloseResponse
-};
-    
-enum TSatAppDialogActionType
-    {
-    ESatDialogDisplayText = 0, // Ok Back
-    ESatDialogGetInput, // Cancel ->Ok Cancel
-    ESatDialogGetInkey, // Cancel ->Ok Cancel
-    ESatDialogGetYesNo, // Yes No
-    ESatDialogGetDigitalRsp, // Cancel
-    ESatDialogSetUpCall, // Call Cancel
-    ESatDialogConfirmSend, // Yes No
-    ESatDialogConfirmBip // Ok Cancel
-    };
-
-#endif 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satui/satapp/inc/satappconfirmprovider.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,72 @@
+/*
+* 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: Provides SAT user confim notes
+*
+*/
+
+#ifndef SATAPPCONFIRMPROVIDER_H
+#define SATAPPCONFIRMPROVIDER_H
+
+// includes
+#include <QObject>
+
+// forward declarations
+class HbMessageBox;
+class SatAppAction;
+
+class SatAppConfirmProvider : public QObject
+{
+    Q_OBJECT
+
+public:
+    /** Constructor */
+    SatAppConfirmProvider(QObject *parent = 0);
+
+    /** Destructor */
+    virtual ~SatAppConfirmProvider();
+
+public slots:
+
+    /**
+    * General confirmation request
+    * @param userAccepted Indicates whether the command was accepted.
+    */
+    void confirmCommand(SatAppAction &action);
+
+    /** clear the current dialog in screen */
+    void clearScreen();
+
+    /** reset some data members */
+    void resetState();
+
+private:
+
+    /** Shows the confirm note about Open Channel */
+    void showOpenChannelConfirm(SatAppAction &action);
+
+    /** Shows the confirmation not about SetUpCall*/
+    void showSetUpCallConfirm(SatAppAction &action);
+
+private:
+
+    /** Own.*/
+    HbMessageBox *mConfirmQuery;
+    
+    SatAppAction *mAction;
+
+    /** For unit testing.*/ 
+    friend class ConfirmProviderTest;
+};
+
+#endif /* SATAPPCONFIRMPROVIDER_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satui/satapp/inc/satappconstant.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,157 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef SATAPPCONSTANT_H
+#define SATAPPCONSTANT_H
+
+#ifdef _UDEB
+#define SAT_ASSERT Q_ASSERT
+#else
+#define SAT_ASSERT(cond) cond
+#endif
+
+//  CONSTANTS
+
+const int KDisplayTxtUserClearTimeout( 60000 );
+// As the QT for S60 is slow, we use 6 sec, in symbian sat ui we use 3 sec.
+// Rollback to 3s
+const int KDisplayTxtDefaultduration( 3000 );
+
+const unsigned int KGetInputStringMaxSize = 0xEF;
+
+const int KExtendTimeoutMseconds(3000);
+// 1 minute
+const int KDefaultSelectionTimeoutMseconds(60000);
+const int KSymbianTimeConvertQtTime(100);
+const int KMoSmControlTimeOut(3000);
+const int KPlayToneSymbianConvertQtTime(1000);
+
+// extensions to ConfirmAction
+const int ESatConfirmAction = 0x35;
+// extensions to TSatAction
+const int ESatNotifyAction = 0x1001;
+
+// SatAppAction
+// parameter keys
+const QString KeyText="text"; // QString
+const QString KeyMenu="menu"; // QList<QVariant/QString>
+const QString KeyDefault="default"; // int - default selected item index
+const QString KeySelection="selection"; // int - real selected index
+const QString KeyCharacterSet="charset"; // int(TSatCharacterSet)
+const QString KeyInKey="inkey"; // int(char pressed)
+const QString KeyDuration="duration"; // int(milliseconds)
+const QString KeyImmediate="immediate"; // bool - immediate response
+const QString KeyInputString="input"; // QString - user input string
+const QString KeyMinLength="min"; // int 
+const QString KeyMaxLength="max"; // int
+const QString KeyHideInput="hide"; // bool - password mode
+const QString KeyToneId="tone"; // int(TSatTone)
+const QString KeySustainedText="sustained"; // bool - sustained text
+const QString KeyWaitUserToClear="waitusertoclear"; // bool
+const QString KeyHelpRequested="helprequested"; // bool
+const QString KeyApplicationName="applicationname"; // QString - app.name
+const QString KeyCommandId="commandid"; // int(TSatSNotifyCommand)
+const QString KeyControlResult="controlresult"; // int(TSatControlResult)
+const QString KeyAlphaIdStatus="alphaidstatus"; // int(TSatAlphaIdStatus)
+const QString KeyAdditionalText="additionaltext"; //QString - aAdditionalText
+const QString KeyQueryCommandId="querycommandid";//int(TSatSQueryCommand)
+const QString KeyActionAccepted="actionaccepted";//bool
+
+const QString KeyselfExp="sekfexp";//bool
+
+// icon identifiers
+const QString KeyIconId="iconid"; // int - icon id
+const QString KeyIconIdArray="iconidarray"; // QList<QVariant/int> (icon id)
+const QString KeyIconQualifier="iconqualifier"; // int (TSatIconQualifier)
+
+// icons
+const QString KeyIcon="icon"; // HbIcon
+const QString KeyIconArray="icons"; // QList<QVariant/QPixmap>
+
+const TInt KSatActiveProfileOffline = 5; // value from ProfileEngine
+
+/**
+ * Play Tone Constants
+ */
+// Tone Sequence
+const char KNetToneSeqNetBusy[] = "\x00\x11\x05\x4E\x30\x40\x30\x07\x0B";
+const char KNetToneSeqNetCallWaiting[] = "\x00\x11\x05\x4E\x14\x40\x3C\x4E\x14"
+"\x40\x64\x40\x64\x40\x64\x4E\x14\x40\x3C\x4E\x14\x40\x64\x40\x64\x40\x64"
+"\x07\x0B";
+const char KNetToneSeqNetCongestion[] = "\x00\x11\x05\x4E\x14\x40\x14\x07\x0B";
+const char KNetToneSeqNetSpecialInformation[] = "\x00\x11\x05\x4F\x21\x50"
+"\x21\x51\x21\x40\x64\x07\x0B";
+const char KNetToneSeqDial[] = "\x00\x11\x05\x4E\xFE\x4E\xFE\x4E\xFE\x4E\xFE\x4E\xFE"
+"\x4E\xFE\x4E\xFE\x4E\xFE\x07\x0B";
+const char KNetToneSeqRingGoing[] = "\x00\x11\x05\x4E\x64\x05\x04\x40\x64\06\x07\x0B";
+const char KGeneralBeep[] = "\x00\x11\x0A\x76\x00\x0B";
+const char KErrorTone[] = "\x00\x11\x0A\x6C\x19\x0B";
+const char KRadioPathNotAvailable[] = "\x00\x11\x0A\x05\x03\x4E\x14\x40\x14\x06\x0B";
+const char KRadioPathAck[] = "\x00\x11\x0A\x02\xFC\x0A\x80\x4E\x14\x0A\x7f\x0B";
+
+// PlayTone durations
+const int KSatDur170ms  = 170;  // 170ms
+const int KSatDur200ms  = 200;  // 200ms
+const int KSatDur250ms  = 250;  // 250ms
+const int KSatDur1200ms = 1200; // 1200ms
+
+//enum for SendSms
+/**Sat send sms user response*/
+enum TSatAppConfirmType
+    {
+    ESatUiConfirmSendSms = 1,
+    ESatUiConfirmSendSs,
+    ESatUiConfirmSendUssd
+    };
+   
+enum TSatAppUserResponse
+{
+    /**
+     *  default, user no response
+     */
+    EUserNoResponse = 0,
+    /**
+     *  OK, user response
+     */
+    EUserPrimaryResponse,
+    /**
+     *  Back, user response
+     */
+    EUserSecondaryResponse,
+    /**
+     *  requested to clear by the server
+     */
+    EUserClearResponse,
+    /**
+     *  requested to close application by the server
+     */
+    EUserCloseResponse
+};
+    
+enum TSatAppDialogActionType
+    {
+    ESatDialogDisplayText = 0, // Ok Back
+    ESatDialogGetInput, // Cancel ->Ok Cancel
+    ESatDialogGetInkey, // Cancel ->Ok Cancel
+    ESatDialogGetYesNo, // Yes No
+    ESatDialogGetDigitalRsp, // Cancel
+    ESatDialogSetUpCall, // Call Cancel
+    ESatDialogConfirmSend, // Yes No
+    ESatDialogConfirmBip // Ok Cancel
+    };
+
+#endif 
--- a/satui/satapp/inc/satappeventprovider.h	Tue Jul 06 14:53:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,675 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef SATAPPEVENTPROVIDER_H
-#define SATAPPEVENTPROVIDER_H
-
-#include <QObject>
-#include <msatuiobserver.h>
-#include "msatuiactionimplementer.h"
-
-class CSatUiObserver;
-class SatAppPlayToneProvider;
-
-
-class SatAppEventProvider: public QObject,
-                           public MSatUiActionImplementer
-{
-    Q_OBJECT
-
-public:
-
-    /**
-    * Constructor
-    */
-    SatAppEventProvider(QObject *parent = 0);
-
-    /**
-    * Distructor
-    */
-    virtual ~SatAppEventProvider();
-
-signals:
-     /**
-     * Notification of the SAT Display Text command.
-     * @param aRes, the User's response.
-     * @param aText The text string to be displayed.
-     * @param aSimApplicationName  Sim Application name
-     * @param aIcon the icon to show.
-     * @param aRequestedIconDisplayed Informs if icon is not used.
-     * @param aSustainedText Indicates is this text sustained ie. no timers
-     *        used if true.
-     * @param aDuration Duration for showing the text
-     * @param aWaitUserToClear Indication if user is needed to clear
-     *        message
-     */
-    void displayTextEvent(
-        TSatUiResponse &aRes,
-        const QString &aText,
-        const QString &aSimApplicationName,
-        bool &aRequestedIconDisplayed,
-        const bool aSustainedText,
-        const int aDuration,
-        const bool aWaitUserToClear);
-
-    /**
-     * Notification of the SAT Get Input command.
-     * @param aText The query text.
-     * @param aCharacterSet The character range allowed.
-     * @param aInput The input string.
-     * @param aMaxLength The maximum length of the input allowed.
-     * @param aMinLength The minimum length of the input allowed.
-     * @param aHideInput A flag indicating if the input should be hidden.
-     * @param aHelpIsAvailable indicates if help can be requested.
-     * @param aIconId The id of icon.
-     * @param aRequestedIconDisplayed Informs if icon is not used.
-     * @return The response of the UI to this command.
-     */
-    void getInputEvent(
-        TSatUiResponse &aRes,
-        const QString &aTitleText,
-        const TSatCharacterSet aCharacterSet,
-        QString &aInputText,
-        const int aMinLength,
-        const int aMaxLength,
-        const bool aHideInput,
-        const bool aSelfExplanatory,
-        unsigned int &aDuration);
-
-    /**
-     * Notification of the SAT Get Inkey command.
-     * @param aText The query text.
-     * @param aCharacterSet The character range allowed.
-     * @param aInput The input string.
-     * @param aHideInput A flag indicating if the input should be hidden.
-     * @param aHelpIsAvailable indicates if help can be requested.
-     * @param aIconId The id of icon.
-     * @param aRequestedIconDisplayed Informs if icon is not used.
-     */
-    void getInkeyEvent(
-        TSatUiResponse &aRes,
-        const QString &aTitleText,
-        const TSatCharacterSet aCharacterSet,
-        QString &aInputText,
-        const bool aSelfExplanatory,
-        unsigned int &aDuration);
-
-    /**
-     * Notification of the SAT Get YesNo command.
-     * @param aText The query text.
-     * @param aCharacterSet The character range allowed.
-     * @param aInput The input character.
-     * @param aHelpIsAvailable indicates if help can be requested.
-     * @param aIconId The id of icon.
-     * @param aRequestedIconDisplayed Informs if icon is not used.
-     * @param aDuration Duration for showing the dialog.
-     * @param aImmediateDigitResponse Indication if Immediate digit response
-     *        is needed.
-     * @return The response of the UI to this command.
-     */
-    void getYesNoEvent(
-        TSatUiResponse &aRes,
-        const QString &aText,
-        const TSatCharacterSet aCharacterSet,
-        unsigned int &aInkey,
-        //const TSatIconId &aIconId,
-        const bool &aSelfExplanatory,
-        unsigned int &aDuration,
-        const bool aImmediateDigitResponse);
-        
-    /**
-     * Notification of the SAT Call Control command.
-     * @param aRes The response.
-     * @param aText The heading.
-     * @param aAlphaIdStatus The alpha ID status.
-     * 
-     */
-    void callControlEvent(
-        const QString &aText,
-        const TSatAlphaIdStatus aAlphaIdStatus);
-
-    /**
-     * Notification of the SAT Call Control command.
-     * @param aRes The response.
-     * @param aText The heading.
-     * @param aAlphaIdStatus The alpha ID status.
-     *
-     */
-    void moSmControlEvent(
-        const QString &aText,
-        const TSatAlphaIdStatus aAlphaIdStatus);
-
-    /**
-    * Handles the SetUpMenu command.
-    * @param aRes the out parameter. the result of the command.
-    * @param aText The title text.
-    * @param aMenuItems The array of menu item captions.
-    * @param aMenuItemNextActions The array of menu item next action
-    * indicator captions.
-    * @param aIconBitmap The Context pane icon.
-    * @param aItemsIconArray Array of item icons
-    * @param aSelfExplanatoryItems A flag indicating if only icons are shown.
-    * @param aHelpIsAvailable A flag indicating if SAT help is available.
-    */
-    void setUpMenuEvent(
-        TSatUiResponse &aRes,
-        const QString &aText,
-        const QStringList &aMenuItems,
-        const bool aSelfExplanatoryItems,
-        const bool aHelpIsAvailable);
-
-    /**
-    * Handles the SelectItem view.
-    * @param aRes the out parameter. the result of the command.
-    * @param aText The title text.
-    * @param aMenuItems The array of menu items.
-    * @param aMenuItemNextActions The array of next action indicators.
-    * @param aDefaultItem The item in focus.
-    * @param aSelection The item index selected by the user.
-    * @param aIconBitmap The Context Pane icon.
-    * @param aItemsIconArray Array of item icons
-    * @param aSelfExplanatoryItems Flag indicating if only icons are shown.
-    * @param aHelpIsAvailable A flag indicating if SAT help is available.
-    * @return Information of the operation result.
-    */
-    void selectItemEvent(
-        TSatUiResponse &aRes,
-        const QString &aText,
-        const QStringList &aMenuItems,
-        const int aDefaultItem,
-        unsigned char &aSelection,
-        const bool aSelfExplanatoryItems,
-        const bool aHelpIsAvailable);
-
-    /**
-    * Shows the confirmation note about the SAT Send SMS, Send SS or
-    * Send USSD command.
-    * @param aText The text to be displayed.
-    * @param aActionAccepted Indicates whether the command was accepted.
-    * @param aType Type of the request (SMS, SS, USSD).
-    * @return Information of the operation result.
-    */
-    void confirmSendEvent(
-        TSatUiResponse &aRes,
-        const QString &aText,
-        bool &aActionAccepted,
-        int aType);
-
-     /**
-     * Shows the wait note about the Send SMS command.
-     * @param aText The text to be displayed.
-     * @param aIconBitmapSendSM Sending dialog icon.
-     * @param aSelfExplanatoryIcon A flag indicating if only icon is shown.
-     */
-    void showSmsWaitNoteEvent(
-        const QString &aText,
-        const bool aSelfExplanatoryIcon);
-    
-    /**
-    * Shows the confirmation not about SetUpCall.
-    * @param aText The text to be displayed.
-    * @param aSimAppName The header to be displayed.
-    * @param aActionAccepted Indicates whether the command was accepted.
-    */
-   void showSetUpCallConfirmEvent(
-        const QString &aText,
-        const QString &aSimAppName,
-        bool &aActionAccepted);
-
-     /**
-     * Shows the wait note about the Send DTMF command.
-     * @param aText The text to be displayed.
-     * @param aIconBitmapSendSM Sending dialog icon.
-     */
-    void showDtmfWaitNoteEvent(
-        TSatUiResponse &aRes,
-        const QString &aText);
-
-
-     /**
-     * Shows the wait note about the Send Ss or Ussd command.
-     * @param aText The text to be displayed.
-     * @param aIconBitmapSendSM Sending dialog icon.
-     * @param aSelfExplanatoryIcon A flag indicating if only icon is shown.
-     */
-    void showSsWaitNoteEvent(
-        const QString &aText,
-        const bool aSelfExplanatoryIcon);
-
-     /**
-     * Shows the wait note about Open Channel
-     * @param aText The text to be displayed.
-     * @param aActionAccepted Indicates whether the command was accepted.
-     */
-    void showOpenChannelConfirmEvent(
-        const QString &aText,
-        bool &aActionAccepted);
-
-
-    /*!
-     Removes Display Text Dialog from the screen.
-    */
-    void clearScreenEvent();
-
-    /*!
-     Close the sat ui
-     */
-    void closeUiEvent();
-
-    /*!
-    *Close wait note
-    */
-    void stopShowWaitNoteEvent();
-
-    /*!
-    *Show SsWaitNote without Delay
-    */  
-    void showWaitNoteWithoutDelayEvent();
-
-    /*!
-    *ShowSsErrorNoteEvent
-    */  
-    void showSsErrorNoteEvent();
-    
-    /*!
-    * Show BIP related Note 
-    */      
-    void showBIPNoteEvent(int aCommand, const QString &aText);
-
-public slots:
-    /*!
-    *User cancel response, Send DTMF, Send Data, Receive Data
-    */
-    void userCancelResponse();
-
-public: // from MSatUiActionImplementer and impletment by QT
-
-    /**
-    * Shows the wait note.
-    */
-    virtual void ShowWaitNoteL() {};
-
-    /**
-    * Shows the wait note without delay
-    */
-    virtual void ShowWaitNoteWithoutDelayL();
-
-    /**
-    * Removes the wait note from the screen.
-    */
-    void StopShowWaitNote();
-
-    /**
-     * Handles the SetUpMenu view.
-     * @param aText The title text.
-     * @param aMenuItems The array of menu item captions.
-     * @param aMenuItemNextActions The array of menu item next action
-     * indicator captions.
-     * @param aIconBitmap The Context pane icon.
-     * @param aItemsIconArray Array of item icons
-     * @param aSelfExplanatoryItems Flag indicating if only icons are shown.
-     * @param aHelpIsAvailable A flag indicating if SAT help is available.
-     * @return Information of the operation result.
-     */
-     virtual TSatUiResponse SetUpMenuL(
-         const TDesC &aText,
-         const MDesCArray &aMenuItems,
-         const CArrayFixFlat<TSatAction>* aMenuItemNextActions,
-         const CFbsBitmap *aIconBitmap,
-         const TBool aSelfExplanatoryItems,
-         const TBool aHelpIsAvailable);
-
-    /**
-     * Handles the SelectItem view.
-     * @param aText The title text.
-     * @param aMenuItems The array of menu items.
-     * @param aMenuItemNextActions The array of next action indicators.
-     * @param aDefaultItem The item in focus.
-     * @param aSelection The item index selected by the user.
-     * @param aIconBitmap The Context Pane icon.
-     * @param aItemsIconArray Array of item icons
-     * @param aSelfExplanatoryItems Flag indicating if only icons are shown.
-     * @param aHelpIsAvailable A flag indicating if SAT help is available.
-     * @return Information of the operation result.
-     */
-     virtual TSatUiResponse SelectItemL(const TDesC &aText,
-         const MDesCArray &aMenuItems,
-         const CArrayFixFlat<TSatAction>* aMenuItemNextActions,
-         const TInt aDefaultItem,
-         TUint8 &aSelection,
-         const CFbsBitmap *aIconBitmap,
-         const TBool aSelfExplanatoryItems,
-         const TBool aHelpIsAvailable);
-
-    /**
-    * Returns CoeEnv.
-    */
-    virtual CCoeEnv* CoeEnv() { return 0; };
-
-    /**
-    * Handles the DisplayText operation.
-    * @param aText Text to be shown.
-    * @param aSimApplicationName  Sim Application name
-    * @param aIconBitmapDisplayText Icon for dialog
-    * @param aSustainedText Indicates is this text sustained ie. no timers
-    *        used if ETrue.
-    * @param aDuration Duration for showing the text
-    * @param aWaitUserToClear Indication if user is needed to clear
-    *        message
-    * @return Information of the operation result.
-    */
-    virtual TSatUiResponse DisplayTextL(
-        const TDesC &aText,
-        const TDesC &aSimApplicationName,
-        CFbsBitmap *aIconBitmapDisplayText,
-        const TBool aSelfExplanatoryIcon,
-        const TBool aSustainedText,
-        const TTimeIntervalSeconds aDuration,
-        const TBool aWaitUserToClear);
-
-    /**
-    * Removes Display Text Dialog from the screen.
-    */
-    virtual void ClearScreen();
-
-    /**
-    * Asks a Yes/No answer from the user.
-    * @param aText A question to be shown.
-    * @param aCharacterSet The character range allowed.
-    * @param aInkey Character user feeds.
-    * @param aIconBitmap Icon for query dialog.
-    * @param aSelfExplanatory Flag indicating if icon is self-explanatory.
-    * @param aDuration Duration for showing the dialog.
-    * @param aImmediateDigitResponse Indication if Immediate digit response
-    *        is needed.
-    * @return Information of the operation result.
-    */
-    virtual TSatUiResponse GetYesNoL(
-        const TDesC &aText,
-        const TSatCharacterSet aCharacterSet,
-        TChar &aInkey,
-        const CFbsBitmap */*aIconBitmap*/,
-        const TBool aSelfExplanatory,
-        TUint &aDuration,
-        const TBool aImmediateDigitResponse);
-
-    /**
-    * Asks input from the user.
-    * @param aText A question to be shown.
-    * @param aCharacterSet The character range allowed.
-    * @param aInput The input string.
-    * @param aMinLength The minimum length of the input allowed.
-    * @param aMaxLength The maximum length of the input allowed.
-    * @param aHideInput A flag indicating if the input should be hidden.
-    * @param aGetInkey A flag indicating if GetInkey command is used.
-    * @param aIconBitmapGetInput Icon for query dialog.
-    * @param aSelfExplanatory  A flag indicating if icon is self-explanatory.
-    * @param aDuration Duration for showing the dialog.
-    * @return Information of the operation result.
-    */
-    virtual TSatUiResponse GetInputL(
-        const TDesC &aText,
-        const TSatCharacterSet aCharacterSet,
-        TDes &aInput,
-        const TInt aMinLength,
-        const TInt aMaxLength,
-        const TBool aHideInput,
-        const TBool aGetInkey,
-        const CFbsBitmap *aIconBitmapGetInput,
-        const TBool aSelfExplanatory,
-        TUint &aDuration);
-
-
-    /**
-    * Handles Standard Tone playing.
-    * @param aText The text to be displayed.
-    * @param aFileName The name of the file corresponding to the tone.
-    * @param aDuration The duration of the tone to be played.
-    * @param aIconBitmap The tone playing note icon
-    * @param aSelfExplanatory Flag indicating if icon is self-explanatory.
-    * @return Information of the operation result.
-    */
-    virtual TSatUiResponse PlayStandardToneL(
-        const TDesC &aText,
-        const TDesC8 &aSequence,
-        TTimeIntervalMicroSeconds aDuration,
-        const CFbsBitmap *aIconBitmap,
-        const TBool aSelfExplanatory);
-
-    /**
-    * Shows the confirmation note about the SAT Send SMS, Send SS or
-    * Send USSD command.
-    * @param aText The text to be displayed.
-    * @param aActionAccepted Indicates whether the command was accepted.
-    * @param aType Type of the request (SMS, SS, USSD).
-    * @return Information of the operation result.
-    */
-    virtual TSatUiResponse ConfirmSendL(
-        const TDesC &aText,
-        TBool &aActionAccepted,
-        TInt aType);
-
-    /**
-    * Shows the wait note about the Send SMS command.
-    * @param aText The text to be displayed.
-    * @param aIconBitmapSendSM Sending dialog icon.
-    * @param aSelfExplanatoryIcon A flag indicating if only icon is shown.
-    */
-    virtual void ShowSmsWaitNoteL(
-        const TDesC &aText,
-        const CFbsBitmap *aIconBitmapSendSM,
-        const TBool aSelfExplanatoryIcon);
-
-    /**
-    * Shows the wait note about the Send SS command.
-    * @param aText The text to be displayed.
-    * @param aIconBitmap Sending dialog icon.
-    * @param aSelfExplanatoryIcon A flag indicating if only icon is shown.
-    */
-    virtual void ShowSsWaitNoteL(
-        const TDesC &aText,
-        const CFbsBitmap */*aIconBitmap*/,
-        const TBool aSelfExplanatoryIcon);
-
-    /**
-    * Shows the confirmation note about the SAT Refresh command.
-    * @param aActionAccepted Indicates whether the command was accepted.
-    * @return Information of the operation result.
-    */
-    virtual TSatUiResponse ConfirmRefreshL(
-            TBool &/*aActionAccepted*/)
-        {
-            return ESatSuccess;
-        };
-
-    /**
-    * Notification of the SAT Call Control command.
-    * @param aText The text string to be displayed.
-    * @param aAlphaIdStatus Alpha Identifier status
-    * @param aControlResult Call control general result
-    * @return The response from the UI
-    */
-    virtual TSatUiResponse CallControlL(
-        const TDesC &aText,
-        const TSatAlphaIdStatus aAlphaIdStatus);
-
-    /**
-    * Notification of the SAT Launch browser confirmation request
-    * @param aText The text to be displayed.
-    * @param aActionAccepted Indicates whether the command was accepted.
-    * @param aIconBitmap The confirm note icon
-    * @param aSelfExplanatory Flag indicating if icon is self-explanatory.
-    */
-    virtual void ConfirmLaunchBrowserL(
-        const TDesC &/*aText*/,
-        TBool &/*aActionAccepted*/,
-        const CFbsBitmap */*aIconBitmap*/,
-        const TBool /*aSelfExplanatory*/) {};
-
-    /**
-    * Notification of the SAT Mo Sm Control command.
-    * @param aText The text string to be displayed.
-    * @param aAlphaIdStatus Alpha Identifier status
-    * @param aControlResult Mo Sm control general result
-    * @return The response from the UI
-    */
-    virtual TSatUiResponse MoSmControlL(
-        const TDesC &aText,
-        const TSatAlphaIdStatus aAlphaIdStatus);
-
-    /**
-    * Shows the wait note while DTMF are being sent.
-    * @param aText The text to be displayed.
-    * @param aIconBitmap The confirm note icon
-    * @param aSelfExplanatory Flag indicating if icon is self-explanatory.
-    * @return Information on the operation result.
-    */
-    virtual TSatUiResponse ShowDtmfWaitNoteL(
-            const TDesC &aText,
-            const CFbsBitmap *aIconBitmap,
-            const TBool aSelfExplanatoryIcon);
-
-    /**
-    * Dispatch iWait to action implementer.
-    * @param aWait Timer.
-    */
-    virtual void DispatchTimer(CActiveSchedulerWait &/*aWait*/) {};
-
-    /**
-    * Get flag which is indicating if end key is pressed.
-    * @return A Boolean flag which is indicating if end key is pressed.
-    *         EndKey not support, Open issue
-    */
-    virtual TBool GetEndKey(){return EFalse;};
-
-    /**
-    * Set a flag which is indicating if end key is pressed.
-    * @param aValue Status of end key
-    */
-    virtual void SetEndKey(TBool /*aValue*/) {};
-
-    /**
-    * Set a flag which is indicating if proactive command is pending.
-    * @param aValue Status of proactive command
-    */
-    virtual void SetCommandPending(TBool /*aValue*/) {};
-
-    /**
-    * Plays user selected tone.
-    * @param aText The text to be displayed.
-    * @param aDuration Play duration.
-    * @param aTone Tone to be played.
-    * @param aIconBitmap The tone playing note icon
-    * @param aSelfExplanatory Flag indicating if icon is self-explanatory.
-    * @return Information on the operation result.
-    */
-    virtual TSatUiResponse PlayUserSelectedToneL(
-        const TDesC &aText,
-        TTimeIntervalMicroSeconds aDuration,
-        TSatTone aTone,
-        const CFbsBitmap *aIconBitmap,
-        const TBool aSelfExplanatory);
-
-    /**
-    * Confirm user permission for Open Channel.
-    * @param aText The text to be displayed.
-    * @param aActionAccepted Indicates whether the command was accepted.
-    * @param aIconBitmapOpenChannel Icon for query dialog
-    * @param aSelfExplanatory A flag indicating if icon is self-explanatory
-    * @return Operation result
-    */
-    virtual TSatUiResponse ConfirmOpenChannelL(
-        const TDesC &aText,
-        TBool &aActionAccepted,
-        const CFbsBitmap */*aIconBitmapOpenChannel*/,
-        const TBool aSelfExplanatory);
-
-    /**
-    * Shows the wait note while BIP packets are sent.
-    * @param aCommand Command type.
-    * @param aText The text to be displayed.
-    * @param aIconBitmap Icon for query dialog
-    * @param aSelfExplanatory A flag indicating if icon is self-explanatory
-    */
-    virtual void ShowBIPNoteL(
-        TInt aCommand,
-        const TDesC &aText,
-        const CFbsBitmap */*aIconBitmap*/,
-        const TBool /*aSelfExplanatory*/);
-
-    /**
-    * Confirm user permission for SetUpCall
-    * @param aText The text to be displayed.
-    * @param aSimAppName Header for th equery
-    * @param aActionAccepted Indicates whether the command was accepted.
-    * @param aIconBitmap Icon for query dialog
-    * @param aSelfExplanatory A flag indicating if icon is self-explanatory
-    */
-    virtual void ConfirmSetUpCallL(
-        const TDesC &aText,
-        const TDesC &aSimAppName,
-        TBool &aActionAccepted,
-        const CFbsBitmap *aIconBitmap,
-        const TBool aSelfExplanatory);
-
-    /**
-    * Show note indicating SAT is not available.
-    */
-    virtual void ShowNotAvailableNoteL() {};
-
-    /**
-    * Show the Ss error note.
-    */
-    virtual void ShowSsErrorNoteL();
-
-    /**
-    * Close SatUi process.
-    */
-    virtual void CloseSatUI();
-
-public: // new method
-
-    /**
-    * Return current profile state.
-    * @return current profile state.
-    */
-    int profileState();
-
-     /**
-     * Response to the Set Up Menu command.
-     * @param aMenuItem The selected menu item.
-     * @param aHelpRequested Indicates whether help was requested.
-     */
-    void menuSelection(int aMenuItem, bool aHelpRequested);
-
-private: // Data
-
-    /**
-     * The pointer to the sybmian class CSatUiObserver
-     * which will access Sat Client API
-     * own
-     */
-    CSatUiObserver *mObs;
-
-    /**
-     * Own, PlayTone
-     */
-    SatAppPlayToneProvider *mPlayTone;
-
-};
-
-#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satui/satapp/inc/satappinputprovider.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,111 @@
+/*
+* 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: Provides input methods like query dialogs
+*
+*/
+
+#ifndef SATAPPINPUTPROVIDER_H
+#define SATAPPINPUTPROVIDER_H
+
+// includes
+#include <QObject>
+#include <QTime>
+#include <msatuiobserver.h>
+
+// forward declarations
+class HbDialog;
+class SatAppAction;
+class QTimer;
+
+class SatAppInputProvider : public QObject
+{
+    Q_OBJECT
+
+public:
+    SatAppInputProvider(QObject *parent = 0);
+    virtual ~SatAppInputProvider();
+    
+public slots:
+
+    /** requests user to enter a SINGLE key, character or digit */
+    void getInkey(SatAppAction& action);
+
+    /** requests user to enter a STRING of free text, number or password etc. */
+    void getInput(SatAppAction& action);
+
+    /** Resets the UI state commits pending server requests if any */
+    void resetState();
+    
+private slots:
+
+    /** update the actions when content in getinput changed */
+    void updateQueryAction();
+    /** update the actions according the text */
+    void updateQueryAction(QString text);
+    /** get the input key in get inkey */
+    void transmitInkeyFromDialog();
+    /** get the input key in get inkey immediate */
+    void transmitInkeyImmediately(QString text);
+    /** get the input key in get inkey yesno query */
+    void transmitInkeyTrue();
+    /** get the input key in get inkey yesno query */
+    void transmitInkeyFalse();
+    /** get the get input string */
+    void transmitStringFromDialog();
+    /** clear the query timeout timer */
+    void clearDurationTimer();
+
+private: // private implementation
+
+    /** show get inkey query */
+    void showGetInkeyQuery(const QString &aHeading, 
+        TSatCharacterSet aCharacterSet, int aDuration);
+    /** show get inkey immediate query */    
+    void showGetImmediateQuery(const QString &aHeading, int aDuration);    
+    /** show get inkey yes no query */
+   void showGetYesNoQuery(const QString &aText, int aDuration);
+    
+   /** show get input query */
+    void showGetInputQuery(const QString &heading, const QString &content,
+            TSatCharacterSet characterSet, int minLength, int maxLength,
+            bool aHideInput);
+    /** dialog type */
+    enum DialogMode {
+        GetInkey,
+        GetYesNo,
+        GetImmediate,
+        GetInput};
+    
+    /** update dialog according type */
+    void composeDialog(HbDialog *dlg, DialogMode mode);
+    /** set the get inkey result to action */
+    void transmitInkey(int key);
+    /** start dialog timeout timer */
+    void startDurationTimer(int duration);
+    
+private:
+    /** not own */
+    SatAppAction* mCurrentAction;
+    /** own */
+    HbDialog* mCurrentDialog;
+    /** own */
+    QTime mInputTimer;
+    /** own */
+    QTimer* mDurationTimer;
+
+    /**for unit testing */
+    friend class InputProviderTest;
+};
+
+#endif /* SATAPPINPUTPROVIDER_H */
--- a/satui/satapp/inc/satappmainhandler.h	Tue Jul 06 14:53:02 2010 +0300
+++ b/satui/satapp/inc/satappmainhandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -20,11 +20,15 @@
 #define SATAPPMAINHANDLER_H
 
 #include <QObject>
+#include <QVariant>
 
 class HbMainWindow;
-class SatAppUiProvider;
-class SatAppEventProvider;
-class SatAppCommandHandler;
+class SatAppServerDispatcher;
+class SatAppMenuProvider;
+class SatAppInputProvider;
+class SatAppToneProvider;
+class SatAppPopupProvider;
+class SatAppConfirmProvider;
 
 class SatAppMainHandler : public QObject
 {
@@ -36,11 +40,23 @@
     
 private:
     void initConnections();
+    
+private slots:
+    void updateActivity();
+    void saveActivity();
 
+private:
+    void removeActivity();
+    
 private: // data
-    SatAppEventProvider *mEvent;
-    SatAppUiProvider *mUi;
-    SatAppCommandHandler *mCommand; 
+
+    SatAppServerDispatcher* mServer;
+    SatAppMenuProvider* mMenu;
+    SatAppInputProvider* mInput;
+    SatAppToneProvider* mTone;
+    SatAppPopupProvider* mPopup;
+    SatAppConfirmProvider *mConfirm;
+    QVariantHash mActivity;
 };
 
 #endif // SATAPPMAINHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satui/satapp/inc/satappmenuprovider.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,86 @@
+/*
+* 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: Provides and maintains SAT main view (selection list)s
+*
+*/
+
+#ifndef SATAPPMENUPROVIDER_H
+#define SATAPPMENUPROVIDER_H
+
+#include <QObject>
+#include <msatuiobserver.h> //for TSatUiResponse
+
+class SatAppAction;
+class HbMainWindow;
+class HbListWidgetItem;
+class HbView;
+class QEventLoop;
+class QTimer;
+class HbMainWindow;
+class HbAction;
+class HbListWidget;
+class HbLabel;
+class QPixmap;
+
+class SatAppMenuProvider : public QObject
+{
+    Q_OBJECT
+
+public:
+
+    SatAppMenuProvider(HbMainWindow *window, QObject *parent = 0);
+
+    virtual ~SatAppMenuProvider();
+
+    /** takes a screen shot of the menu */
+    QPixmap takeScreenShot();
+
+public slots:
+
+    /** signal request to display a menu */
+    void setUpMenu(SatAppAction &action);
+    
+    /** requests a list selection menu to be displayed */
+    void selectItem(SatAppAction &action);
+
+    void resetState();
+
+private slots:
+    void menuItemSelected(HbListWidgetItem *item);
+
+private:
+
+    void loadMainView();
+    void switchView();
+    void connectItem();
+    void disconnectItem();
+
+private:
+
+    QList<QObject *> mObjects;
+    HbMainWindow *mMainWindow;    
+    HbView *mSetupMenuView;
+    HbView *mSelectItemView;
+    HbAction *mSoftKeyQuitAction;
+    HbAction *mSoftKeyBackAction;
+    HbListWidget *mListWidget;
+    HbListWidget *mSelectListWidget;
+    HbLabel *mSubTitle;
+    SatAppAction* mCurrentAction; // not own
+
+    // for unit testing
+    friend class MenuProviderTest;
+};
+
+#endif /* SATAPPMENUPROVIDER_H */
--- a/satui/satapp/inc/satappplaytoneprovider.h	Tue Jul 06 14:53:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,190 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-#ifndef SATAPPPLAYTONEPROVIDER_H
-#define SATAPPPLAYTONEPROVIDER_H
- 
-#include <QObject>
-#include <mdaaudiotoneplayer.h> //PlayStandardTone
-#include <mdaaudiosampleplayer.h> //PlayUserSelectedTone
-#include <QEventLoop>
-#include <msatuiobserver.h>
-
-
-class CMdaAudioToneUtility;
-class CMdaAudioPlayerUtility;
-class QTimer;
-class HbMessageBox;
-
-class SatAppPlayToneProvider: public QObject,
-                           public MMdaAudioToneObserver,//PlayStandardTone
-                           public MMdaAudioPlayerCallback//PlayUserSelectedTone
-{
-    Q_OBJECT
-
-public:
-
-    /**
-    * Constructor
-    */
-    SatAppPlayToneProvider(QObject *parent = 0);
-
-    /**
-    * Distructor
-    */
-    virtual ~SatAppPlayToneProvider();
-
-public: // from MSatUiActionImplementer and impletment by Symbian
-
-    /**
-    * Handles Standard Tone playing.
-    * @param aText The text to be displayed.
-    * @param aFileName The name of the file corresponding to the tone.
-    * @param aDuration The duration of the tone to be played.
-    * @param aIconBitmap The tone playing note icon
-    * @param aSelfExplanatory Flag indicating if icon is self-explanatory.
-    * @return Information of the operation result.
-    */
-    virtual TSatUiResponse PlayStandardToneL(
-        const TDesC &aText,
-        const TDesC8 &aSequence,
-        TTimeIntervalMicroSeconds aDuration,
-        const CFbsBitmap *aIconBitmap,
-        const TBool aSelfExplanatory );
-
-    /**
-    * Plays user selected tone.
-    * @param aText The text to be displayed.
-    * @param aDuration Play duration.
-    * @param aTone Tone to be played.
-    * @param aIconBitmap The tone playing note icon
-    * @param aSelfExplanatory Flag indicating if icon is self-explanatory.
-    * @return Information on the operation result.
-    */
-    virtual TSatUiResponse PlayUserSelectedToneL(
-        const TDesC &aText,
-        TTimeIntervalMicroSeconds aDuration,
-        TSatTone aTone,
-        const CFbsBitmap *aIconBitmap,
-        const TBool aSelfExplanatory );
-
-    /**
-    * ClearScreen
-    */
-    void clearScreen();
-
-    /**
-    * CloseSatUI
-    */
-    void closeSatUI();
-
-public:// from MMdaAudioToneObserver
-
-    /**
-    * From MMdaAudioToneObserver Called by the player object when
-    * it has been initialised.
-    * @param aError Error type.
-    */
-    void MatoPrepareComplete( TInt aError );
-
-    /**
-    * From MMdaAudioToneObserver Called by the player object when
-    * the playback has been terminated.
-    * @param aError Error type.
-    */
-    void MatoPlayComplete( TInt aError );
-
-public://from MMdaAudioPlayerCallback
-    /**
-    * Initialisation of an audio sample has completed.
-    * @param aError The status of the audio sample after initialisation.
-    * @param aDuration The duration of the audio sample.
-    */
-    void MapcInitComplete( 
-        TInt aError, 
-        const TTimeIntervalMicroSeconds& /*aDuration*/ );
-
-    /**
-    * Play of an audio sample has completed.
-    * @param aError The status of playback.
-    */
-    void MapcPlayComplete( TInt aError );
-
-private:// for playTone
-
-    /**
-    * Get settings from current profile like volume, warning tones on/off etc.
-    * @param aTone, optional specifies the type of needed tone if necessary
-    * @param aToneName, optional buffer to get a soundfile name from 
-    * the active profile if necessary
-    */
-    void GetProfileParamsL( TSatTone aTone = ESatToneNotSet,
-                                             TDes *aToneName = NULL );
-
-    /**
-    * showWaitNote
-    */
-    void showWaitNote();
-
-private slots:
-
-    void stopPlayTone();
-
-private: // Data
-
-    /**
-    * Warning And Play Tones
-    */
-    bool mWarningAndPlayTones;
-
-    /**
-    * Play tone volume
-    */
-    int mVolume;
-
-    /**
-    * Own, Media server interface to play rtf file
-    */
-    CMdaAudioToneUtility *mPlayer;
-
-    /**
-    * Response of Play tone
-    */
-    TSatUiResponse mPlayToneError;
-
-    /*
-     *  Own. PlayTone
-     */
-    QTimer *mTimer;
-
-    /*
-     *  Own. PlayTone 
-     */
-    QEventLoop *mLoop;
-
-    /*
-     *  Own. PlayTone note
-     */
-    HbMessageBox *mPermanentNote; 
-
-    /*
-     *  Own. Player for user selected tones.
-     */ 
-    CMdaAudioPlayerUtility *mAudioPlayer;
-
-};
-
-#endif    //SATAPPPLAYTONEPROVIDER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satui/satapp/inc/satapppopupprovider.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Provides SAT popups info and progress notes
+*
+*/
+
+#ifndef SATAPPPOPUPPROVIDER_H
+#define SATAPPPOPUPPROVIDER_H
+
+// includes
+#include <QObject>
+
+// forward declarations
+class HbMessageBox;
+class HbDialog;
+class HbDeviceMessageBox;
+class SatAppAction;
+
+class SatAppPopupProvider : public QObject
+{
+    Q_OBJECT
+
+public:
+    SatAppPopupProvider(QObject *parent = 0);
+    virtual ~SatAppPopupProvider();
+    
+public slots:
+
+    /** displays a text note on screen */
+    void displayText(SatAppAction &action);
+
+    /** shows a simple notification about an ongoing operation */
+    void notification(SatAppAction &action);
+    
+    /** requests any ongoing wait note to be dismissed */
+    void stopShowWaitNote();
+
+    /** show a error note for send ss command */
+    void showSsErrorNote();
+    
+    /** requests any ongoing wait note and display text to be dismissed */
+    void clearScreen();
+    
+    /** reset some data members */
+    void resetState();
+    
+private:
+    QString alphaId(SatAppAction &action);
+    void showBIPWaitNote(SatAppAction &action);
+    void showCloseChannelWaitNote(SatAppAction &action);
+    void showMoSmControlNote(SatAppAction &action);
+    void showSatInfoNote(SatAppAction &action);
+    void showSmsWaitNote(SatAppAction &action);
+    void showCallControlNote(SatAppAction &action);        
+    void showDtmfWaitNote(SatAppAction &action);
+    void showSsWaitNote(SatAppAction &action);
+
+private:
+    HbMessageBox *mDisplayText;
+    HbDialog *mWaitDialog;
+    HbDeviceMessageBox *mWaitDeviceDialog;
+    SatAppAction *mAction;
+    
+    // for unit testing
+    friend class PopupProviderTest;
+};
+
+#endif /* SATAPPPOPUPPROVIDER_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satui/satapp/inc/satappserverdispatcher.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,210 @@
+/*
+* 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: Receives UI commands from SAT server and converts to QT
+*
+*/
+
+#ifndef SATAPPSERVERDISPATCHER_H
+#define SATAPPSERVERDISPATCHER_H
+
+#include <QObject>
+#include <msatuiobserver.h>
+#include <rsatuisession.h>
+#include <rsatsession.h>
+
+// forward declarations
+class SatAppAction;
+
+class SatAppServerDispatcher: public QObject, public MSatUiObserver
+{
+    Q_OBJECT
+
+public:
+
+    SatAppServerDispatcher(QObject *parent = 0);
+
+    virtual ~SatAppServerDispatcher();
+
+signals:
+
+    /** signal request to display a menu */
+    void setUpMenu(SatAppAction &action);
+
+    /** requests a list selection menu to be displayed */
+    void selectItem(SatAppAction &action);
+
+    /** Requtes a text to be displayed to the user*/
+    void displayText(SatAppAction &action);
+
+    /** requests a key input to be displayed */
+    void getInkey(SatAppAction &action);
+
+    /** requests a string input to be displayed */
+    void getInput(SatAppAction &action);
+
+    /** Requests tone to be played */
+    void playTone(SatAppAction &action);
+
+    /** requests a confirm string to be displayed */
+    void confirmCommand(SatAppAction &action);
+
+    /** Requests an info notification or wait/status note */
+    void notification(SatAppAction &action);
+  
+    /** requests any ongoing wait note to be dismissed */
+    void stopShowWaitNote();
+
+    /** requests all ongoing activities to be cleared on SAT UI */
+    void clearScreen();
+
+    /** requests to show ss error note*/
+    void showSsErrorNote();
+
+public slots:
+
+     /**
+     * Response to the Set Up Menu command.
+     * @param aMenuItem The selected menu item.
+     * @param aHelpRequested Indicates whether help was requested.
+     */
+    void menuSelection(SatAppAction* action);
+
+    /**
+    * User cancel response, Send DTMF, Send Data, Receive Data
+    */
+    void userCancelSession(SatAppAction* action);
+    
+    
+    // ****************************************************************************
+    // * ************************************************************************ *
+    // * *                          SYMBIAN PART                                * *
+    // * ************************************************************************ *
+    // ****************************************************************************
+
+private:
+    
+    void ConnectSatSessionL();
+    void DisconnectSatSession();
+    int ProfileState();
+    
+public: // from MSatUiObserver
+
+    /**
+     * see msatuiobserver.h
+     */
+    TSatUiResponse DisplayTextL( const TDesC& aText,
+        const TDesC& aSimApplicationName,
+        const TSatIconId& aIconId,
+        TBool& aRequestedIconDisplayed,
+        const TBool aSustainedText,
+        const TTimeIntervalSeconds aDuration,
+        const TBool aWaitUserToClear );
+
+    /**
+     * see msatuiobserver.h
+     */
+    TSatUiResponse GetInkeyL( const TDesC& aText,
+        const TSatCharacterSet aCharacterSet, TChar& aInput,
+        const TBool aHelpIsAvailable,
+        const TSatIconId& aIconId,
+        TBool& aRequestedIconDisplayed,
+        TUint& aDuration,
+        const TBool aImmediateDigitResponse );
+
+    /**
+     * see msatuiobserver.h
+     */
+    TSatUiResponse GetInputL( const TDesC& aText,
+        const TSatCharacterSet aCharacterSet, TDes& aInput,
+        const TInt aMinLength, const TInt aMaxLength,
+        const TBool aHideInput,
+        const TBool aHelpIsAvailable,
+        const TSatIconId& aIconId,
+        TBool& aRequestedIconDisplayed );
+
+    /**
+     * see msatuiobserver.h
+     */
+    TSatUiResponse SetUpMenuL( const TDesC& aText,
+        const MDesCArray& aMenuItems,
+        const CArrayFixFlat<TSatAction>* aMenuItemNextActions,
+        const TBool aHelpIsAvailable,
+        const TSatIconId& aIconId,
+        const CArrayFixFlat<TInt>* aMenuIcons,
+        const enum TSatIconQualifier aIconListQualifier,
+        const enum TSatSelectionPreference aSelectionPreference );
+
+    /**
+     * see msatuiobserver.h
+     */
+    TSatUiResponse SelectItemL( const TDesC& aText,
+        const MDesCArray& aMenuItems,
+        const CArrayFixFlat<TSatAction>* aMenuItemNextActions,
+        const TInt aDefaultItem, TUint8& aSelection,
+        const TBool aHelpIsAvailable,
+        const TSatIconId& aIconId,
+        const CArrayFixFlat<TInt>* aMenuIcons,
+        const enum TSatIconQualifier aIconListQualifier,
+        TBool& aRequestedIconDisplayed,
+        const enum TSatSelectionPreference aSelectionPreference );
+
+    /**
+     * see msatuiobserver.h
+     */
+    TSatUiResponse PlayTone( const TDesC& aText,
+        const TSatTone aTone,
+        const TTimeIntervalMicroSeconds aDuration,
+        const TSatIconId& aIconId,
+        TBool& aRequestedIconDisplayed );
+
+    /**
+     * see msatuiobserver.h
+     */
+    void ConfirmCommand(
+        const TSatSQueryCommand aCommandId,
+        const TSatAlphaIdStatus aAlphaIdStatus,
+        const TDesC& aText,
+        const TDesC& aAdditionalText,
+        TBool& aActionAccepted,
+        const TSatIconId& aIconId,
+        TBool& aRequestedIconDisplayed,
+        TBool& aTerminatedByUser );
+
+   /**
+    * see msatuiobserver.h
+    */
+    TSatUiResponse Notification(
+        const TSatSNotifyCommand aCommandId,
+        const TSatAlphaIdStatus aAlphaIdStatus,
+        const TDesC& aText,
+        const TSatIconId& aIconId,
+        TBool& aRequestedIconDisplayed,
+        const TSatControlResult aControlResult );
+
+    /**
+     * see msatuiobserver.h
+     */
+    void EventNotification(
+        const TSatSEvent aEventId,
+        const TSatSEventStatus aEventStatus,
+        const TInt aError );
+
+private:
+    
+    RSatUiSession iSat;
+    RSatSession iSatSession;
+
+};
+
+#endif //SATAPPSERVERDISPATCHER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satui/satapp/inc/satapptoneprovider.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef SATAPPTONEPROVIDER_H
+#define SATAPPTONEPROVIDER_H
+
+// includes
+#include <QObject>
+#include <QString>
+#include <QByteArray>
+#include <msatuiobserver.h> //for TSatUiResponse
+#include <mdaaudiotoneplayer.h> //MMdaAudioToneObserver
+#include <mdaaudiosampleplayer.h> //MMdaAudioPlayerCallback
+
+// forward declarations
+class QTimer;
+class HbMessageBox;
+class CMdaAudioToneUtility;
+class CMdaAudioPlayerUtility;
+class SatAppAction;
+
+
+class SatAppToneProvider:
+    public QObject,
+    public MMdaAudioToneObserver,
+    public MMdaAudioPlayerCallback
+{
+    Q_OBJECT
+
+public:
+
+    SatAppToneProvider(QObject *parent = 0);
+    virtual ~SatAppToneProvider();
+
+public slots:
+
+    void playTone(SatAppAction& action);
+    
+    void clearScreen();
+
+private:
+
+    enum State {Idle,PlayStandardTone,PlayUserSelectedTone};
+
+    State recognizeTone(
+        int tone,
+        QByteArray& sequence,
+        int& duration);
+    QByteArray charArrayToByteArray(
+        const char tone[],
+        int size);
+    void playStandardTone(
+        const QString& text,
+        const QByteArray& sequence,
+        int duration);
+    void playUserSelectedTone(
+        const QString& text,
+        int tone,
+        int duration);
+
+public slots:
+    /**
+     * Resets the UI state within the tone provider,
+     * commits pending server requests if any
+     */
+    void resetState();
+
+private slots:
+
+    void stopPlayTone();
+
+// ****************************************************************************
+// * ************************************************************************ *
+// * *                          SYMBIAN PART                                * *
+// * ************************************************************************ *
+// ****************************************************************************
+
+private:
+
+    void SymbianPrepareAudioToneUtilityL(const TDesC8& sequence);
+    void SymbianStopAudioToneUtility();
+    void SymbianPrepareAudioPlayerL(int tone, int duration);
+    void SymbianStopAudioPlayer();
+    void GetProfileParamsL(
+        int tone=ESatToneNotSet, TDes* toneName=NULL );
+
+public: // from MMdaAudioToneObserver
+
+    void MatoPrepareComplete( TInt aError );
+    void MatoPlayComplete( TInt aError );
+
+public: //from MMdaAudioPlayerCallback
+
+    void MapcInitComplete( TInt aError,
+        const TTimeIntervalMicroSeconds& aDuration );
+    void MapcPlayComplete( TInt aError );
+
+
+private: // Data
+
+    State mState;
+    SatAppAction* mCurrentAction;
+
+    bool mWarningAndPlayTones;
+    int mVolume;
+    CMdaAudioToneUtility *mPlayer;
+    TSatUiResponse mPlayToneError;
+    QTimer *mTimer;
+    HbMessageBox *mPermanentNote;
+    CMdaAudioPlayerUtility *mAudioPlayer;
+
+    // for unit testing
+    friend class ToneProviderTest;
+};
+
+#endif //SATAPPTONEPROVIDER_H
--- a/satui/satapp/inc/satappuiprovider.h	Tue Jul 06 14:53:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,449 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-#ifndef SATAPPUIPROVIDER_H
-#define SATAPPUIPROVIDER_H
-
-#include <QObject>
-#include <hbdocumentloader.h>
-#include <hbdialog.h>
-#include <QEventLoop>
-#include <msatuiobserver.h>
-#include "satappcommonconstant.h"
-
-class HbMainWindow;
-class SatAppEventProvider;  // Call back from SatServer
-class SatAppView;           // SetupMenu and SelectItem
-class HbMessageBox;         // DisplayText
-class HbDeviceMessageBox;   // CallControl
-class HbInputDialog;        // GetInKey
-class QTimer;               // For SMS/DTMF
-class HbProgressDialog;
-
-// Here we create custom document loader to be able to use own classes in XML.
-class SatAppDocumentLoader : public HbDocumentLoader
-{
-public:
-    virtual QObject *createObject(const QString &type, const QString &name);
-};
-
-class SatAppUiProvider : public QObject
-{
-    Q_OBJECT
-
-public:
-    /*
-     * Constructor
-     * @param window reference of HbMainWindow
-     * @param event reference of SatAppEventProvider
-     * @param parent default value 
-     */
-    SatAppUiProvider(HbMainWindow &window,
-                     SatAppEventProvider &event,
-                     QObject *parent = 0); 
-
-    /*
-     * Destructor
-     */
-    ~SatAppUiProvider();
-
-    /*
-     * return the document loader, not transfer the ownership.
-     */
-    SatAppDocumentLoader* docmlLoader();
-
-    /*
-     * Set active view.
-     */
-    void activeView(const QString &view);
-
-    /*
-     * Show SetUpMenuView
-     * @param aRes TSatAppUserResponse the response
-     * @param aText The string need to be shown in heading widget
-     * @param aMenuItems The string need to be shown in list widget
-     * @param aSelfExplanatoryItems
-     * @param aHelpIsAvailable
-     */
-    void showSetUpMenuView(
-            TSatUiResponse &aRes,
-            const QString &aText,
-            const QStringList &aMenuItems,
-            //const CArrayFixFlat<TSatAction>* aMenuItemNextActions,
-            //const HbIcon &aIcon,
-            //const CAknIconArray* aItemIconsArray,
-            const bool aSelfExplanatoryItems,
-            const bool aHelpIsAvailable); 
-
-    /*
-     * Show SelectItemView
-     * @param aRes TSatAppUserResponse the response
-     * @param aText The string need to be shown in heading widget
-     * @param aMenuItems The string need to be shown in list widget
-     * @param aDefaultItem the default item
-     * param aSelection The string need to be shown in list widget
-     * @param aSelfExplanatoryItems
-     * @param aHelpIsAvailable
-     */
-    void showSelectItemView(
-            TSatUiResponse &aRes,
-            const QString &aText,
-            const QStringList &aMenuItems,
-            //const CArrayFixFlat<TSatAction>* aMenuItemNextActions,
-            const int aDefaultItem,
-            unsigned char&aSelection,
-            //const HbIcon &aIcon,
-            //const CAknIconArray* aItemsIconArray,
-            const bool aSelfExplanatoryItems,
-            const bool aHelpIsAvailable);
-
-    /*
-     * Show the Display dialog
-     * @param aText The string need to be shown in content widget
-     * @param aHeader The string need to be shown in heading widget
-     * @param aDuration the duration of dialog shown if user do nothing
-     * @return TSatAppUserResponse the response
-     */
-    TSatAppUserResponse showDisplayTextPopup(
-            const QString &aHeading,
-            const QString &aContent,
-            const int aDuration); 
-
-    /*
-     * Show GetInkeyQuer
-     * @param aHeader The string need to be shown in heading widget
-     * @param aContent The string need to be shown in content widget
-     * @param characterSet input mode is digtal or char
-     * @param aDuration the duration of dialog shown if user do nothing
-     * @return TSatAppUserResponse the response
-     */
-    TSatAppUserResponse showGetInkeyQuery(
-            const QString &aHeading,
-            QString &aContent,
-            const TSatCharacterSet aCharacterSet,
-            unsigned int &aDuration);
-
-    /*
-     * Show GetYesNoQuery
-     * @param aText The string shown in content
-     * @param characterSet input mode is digtal or char
-     * @param aDuration the duration of dialog shown if user do nothing
-     * @param aImmediateDigitResponse
-     * @return int the response
-     */
-    int showGetYesNoQuery(
-            const QString &aText,
-            const TSatCharacterSet aCharacterSet,
-            unsigned int &aInkey,
-            unsigned int &aDuration,
-            const bool aImmediateDigitResponse);
-
-    /*
-     * Show GetInput Query
-     * @param heading The string shown in heading widget
-     * @param content The string what user enters. May contain default text
-     * @param characterSet input mode is digtal or char
-     * @param minLength min lenght for user input
-     * @param maxLength max lenght for user input
-     * @param aHideInput user input should hide or not
-     */
-    TSatAppUserResponse showGetInputQuery(
-            const QString &heading,
-            QString &content,
-            const TSatCharacterSet characterSet,
-            const int minLength,
-            const int maxLength,
-            const bool aHideInput);
-
-    /*
-     * show confirm send query
-     * @param aText The string shown in heading widget
-     * @param aActionAccepted 
-     */
-    void showConfirmSendQuery(
-            const QString &aText,
-            bool &aActionAccepted);
-
-    /*
-     * Show Sms wait note
-     * @param aText The string shown in heading widget
-     */
-    void showSmsWaitNote(const QString &aText);
-
-    /*
-     * Show Dtmf wait note
-     * @param aRes 
-     * @param aText The string shown in heading widget
-     */
-    void showDtmfWaitNote(TSatUiResponse &aRes,
-            const QString &aText);
-
-    /*
-     * Stop show wait note
-     */
-    void stopShowWaitNote();
-
-    /*
-     * Comfirm setupcall
-     * @param aText 
-     * @param aSimAppName 
-     * @param aActionAccepted 
-     */
-    void showConfirmSetUpCallQuery(
-            const QString &aText,
-            const QString &aSimAppName,
-            bool &aActionAccepted);
-            
-    /*
-     * Show Ss wait note
-     * @param aText The string shown in heading widget
-     */
-    void showSsWaitNote(const QString &aText, const bool aSelfExplanatoryIcon);
-    
-    /*
-     * Show call control device info note, with cancel key
-     * @param aText The string shown in heading widget
-     */    
-    void showCallControlNote(const QString &aText);
-    
-    /*
-     * Show receive data and send data wait note, with cancel key
-     * @param aText The string shown in heading widget
-     */    
-    void showBIPWaitNote(const QString &aText);
-    
-    /*
-     * Show Mo sms info note, with cancel key
-     * @param aText The string shown in heading widget
-     */    
-    void showMoSmControlNote(const QString &aText);
-    /*
-     * Show Close Channel wait note without cancel key
-     * @param aText The string shown in heading widget
-     */    
-    void showCloseChannelWaitNote(const QString &aText);
-    
-    /*
-     * Show sat info note
-     * @param aText The string shown in heading widget
-     */    
-    void showSatInfoNote(const QString &aText);
-
-signals:
-    /*
-     * User cancel response, Send DTMF, Send Data, Receive Data
-     */
-    void userCancelResponse();
-
-public slots:
-    /*
-     * Clear Screen
-     */
-    void clearScreen();
-
-    /*
-     * Close Ui
-     */
-    void closeUi();
-
-    /*
-     * The response of user selected the Primary action
-     */
-    void userPrimaryResponse();
-
-    /*
-     * The response of user selected the secondary action
-     */
-    void userSecondaryResponse();
-
-    /*
-     * Update Query Action
-     * @param text 
-     */
-    void updateQueryAction(QString text);
-
-    /*
-     * Handle HbLineEdit contentsChanged signal.
-     * when the input dialog in the password mode 
-     * there is no textChanged signal, get this from
-     * HbAbstractEdit 
-     */  
-    void contentChanged();
-    
-    /*
-     * User cancel response, Send DTMF, Send Data, Receive Data
-     */
-    void cancelResponse();
- 
-     /*
-     * Show WaitNoteWithoutDelay
-     */   
-    void showWaitNoteWithoutDelay();
-
-    /*
-    * Show SsErrorNote
-    */   
-    void showSsErrorNote();
-
-    /*
-     * Comfirm OpenChannel
-     * @param aText 
-     * @param aActionAccepted 
-     */
-    void showConfirmOpenChannelQuery(
-            const QString &aText,
-            bool &aActionAccepted);
-
-    /*
-     * handleImmediateCancel
-     */  
-    void handleImmediateCancel();
-
-private:
-    /*
-     * Reset the data member mUserRsp value
-     */
-    void resetUserResponse();
-
-    /*
-     * Compose Dialog
-     * @param dlg
-     * @param dialog timeout
-     * @param dialog type: DisplayText, GetInput, and etc 
-     * @param aModal 
-     * @param aDismissPolicy 
-     */
-    void composeDialog(HbDialog *dlg, int aDuration,
-            TSatAppDialogActionType type, bool aModal = true,
-            HbDialog::DismissPolicy aDismissPolicy = HbDialog::NoDismiss);
-
-    /*
-     * Extend the note shown time
-     */
-    void extendNoteShowtime();
-    
-    /*
-     * Digital immediately response
-     * @param text 
-     */
-    void immediateResponse(QString text);
-
-private:
-    /*
-     *  Not own
-     */
-    HbMainWindow &mMainWindow;
-
-    /*
-     *  Own,objects load from XML. Needs to be deleted once application exits
-     */
-    QList<QObject *> mObjects;
-
-    /*
-     *  Own. For application xml
-     */
-    SatAppDocumentLoader *mLoader;
-
-    /*
-     *  Own. from application xml
-     */
-    SatAppView *mSetupMenuView;
-
-    /*
-     *  Own. from application xml
-     */
-    SatAppView *mSelectItemView;
-
-    /*
-     *  Own. DisplayPopup
-     */
-    HbMessageBox *mDisplayPopup;
-
-    /*
-     *  Own. GetInkeyQuery
-     */
-    HbInputDialog *mGetInkeyQuery;
-
-    /*
-     *  Own. YesNoPopup
-     */
-    HbMessageBox *mYesNoPopup;
-
-    /*
-     *  Own. Get inkey immediately response query dialog
-     */
-    HbInputDialog *mImmediateQuery;
-
-    /*
-     *  Own. GetInputQuery
-     */
-    HbInputDialog *mGetInputQuery;
-
-    /*
-     *  Own. Confirm SendQuery
-     */
-    HbMessageBox *mConfirmSendQuery;
-
-    /*
-     *  Own. SetUpCall Query
-     */
-    HbMessageBox *mSetUpCallQuery;
-    
-    /*
-     *  Own. CallControl Query
-     */
-    HbDeviceMessageBox *mCallControlMsg;
-
-    /*
-     *  Own. Confirm Bip Query
-     */
-    HbMessageBox *mConfirmBipQuery;
-
-    /*
-     *  General user response
-     */
-    TSatAppUserResponse mUserRsp;
-
-    /*
-     *  GetInkey immediate digital response
-     */
-    unsigned int mDigitalRsp;
-
-    /*
-     *  GetInput min legnth, en/dis able ok buttion
-     */
-    int mMinLength;
-
-    /*
-     *  Own. DTMF
-     */    
-    QTimer *mTimer;
-
-    /*
-     *  Own. 
-     */   
-    QEventLoop *mLoop;
-
-    /*
-     *  Own. SsWaitNote
-     */
-    HbProgressDialog *mWaitNote;
-
-};
-
-#endif// SATAPPUIPROVIDER_H
-
-// End of file
--- a/satui/satapp/inc/satappview.h	Tue Jul 06 14:53:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,224 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*
-*/
-
-#ifndef SATAPPVIEW_H
-#define SATAPPVIEW_H
-
-#include <QEventLoop>
-#include <hbview.h>
-#include <msatuiobserver.h>
-
-class QTimer;
-class HbMainWindow;
-class HbAction;
-class HbListWidget;
-class HbListWidgetItem;
-class HbLabel;
-class SatAppEventProvider;
-class SatAppUiProvider;
-
-class SatAppView : public HbView
-    {
-    Q_OBJECT
-
-public:
-     /**
-     * Constructor
-     */
-    SatAppView(QGraphicsItem *parent = 0);
-
-     /**
-     * Destructor
-     */
-    ~SatAppView();
-
-    void setMainWindow(HbMainWindow &mainWindow);
-
-     /**
-     * Initialize setup menu view
-     * Handles the SetUpMenu command.
-     * @param in eventProvider The reference of SatAppEventProvider.
-     * @param in uiProvider The eference of SatAppUiProvider.
-     */
-    void initSetupMenu(SatAppEventProvider &eventProvider, 
-                       SatAppUiProvider &uiProvider);
-
-     /**
-     * Initialize select item view
-     * Handles the SelectItem command.
-     * @param in utils The reference of SatAppEventProvider.
-     * @param in manager The reference of SatAppUiProvider.
-     */
-    void initSelectItem(SatAppEventProvider &eventProvider, 
-                        SatAppUiProvider &uiProvider);
-    /**
-    * Handles the SetUpMenu command.
-    * @param aRes the out parameter. the result of the command.
-    * @param aText The title text.
-    * @param aMenuItems The array of menu item captions.
-    * @param aMenuItemNextActions The array of menu item next action
-    * indicator captions.
-    * @param aIconBitmap The Context pane icon.
-    * @param aItemsIconArray Array of item icons
-    * @param aSelfExplanatoryItems Flag indicating if only icons are shown.
-    * @param aHelpIsAvailable A flag indicating if SAT help is available.
-    */
-   void showSetUpMenuContent(
-       TSatUiResponse &aRes,
-       const QString &aText,
-       const QStringList &aMenuItems,
-       //const CArrayFixFlat<TSatAction>* aMenuItemNextActions,
-       //const HbIcon &aIcon,
-       //const CAknIconArray* aItemIconsArray,
-       const bool aSelfExplanatoryItems,
-       const bool aHelpIsAvailable);
-
-   /**
-    * Handles the SelectItem view.
-    * @param aRes the out parameter. the result of the command.
-    * @param aText The title text.
-    * @param aMenuItems The array of menu items.
-    * @param aMenuItemNextActions The array of next action indicators.
-    * @param aDefaultItem The item in focus.
-    * @param aSelection The item index selected by the user.
-    * @param aIconBitmap The Context Pane icon.
-    * @param aItemsIconArray Array of item icons
-    * @param aSelfExplanatoryItems Flag indicating if only icons are shown.
-    * @param aHelpIsAvailable A flag indicating if SAT help is available.
-    * @return Information of the operation result.
-    */
-    void showSelectItemContent(
-        TSatUiResponse &aRes,
-        const QString &aText,
-        const QStringList &aMenuItems,
-        //const CArrayFixFlat<TSatAction>* aMenuItemNextActions,
-        const int aDefaultItem,
-        unsigned char &aSelection,
-        //const HbIcon &aIcon,
-        //const CAknIconArray* aItemsIconArray,
-        const bool aSelfExplanatoryItems,
-        const bool aHelpIsAvailable);
-
-public slots:
-    /**
-     * Private slot for select item event.
-     */
-    void selectItemTimeOut();
-        /**
-     * Private slot for active item.
-     */
-    void menuItemSelected(HbListWidgetItem *item);
-
-private slots:
-    /**
-     * Private slot for receiving backSoftkey press event.
-     */
-    void backButtonClicked();
-
-private: // From HbView
-    /**
-     * handle key press event
-     */
-    void keyPressEvent(QKeyEvent *event);
-
-private: // New method
-
-    /**
-     * Connect item with menuItemSelected.
-     */
-    void connectItem();
-
-    /**
-     * Disonnect item with menuItemSelected.
-     */
-    void disconnectItem();
-
-private: // data
-    /**
-     * Support select item time out.
-     */
-    bool mTimeout;
-
-    /**
-     * Indicatd Select item view and Setup Menu view.
-     */
-    bool mSelectItem;
-
-     /**
-     * Indicate use click back softkey.
-     */
-    bool mClickBackSoftkey;
-
-    /**
-     * The index of list widget.
-     */
-    int mItemIndex;
-
-    /**
-     * Own,an event loop for select item and menu selection
-     */
-    QEventLoop* mLoop;
-
-    /**
-     * Own,support selection item time out
-     */
-    QTimer *mTimer;
-
-    // quit for setup menu view
-    /**
-     * Not own. From main
-     */
-    HbMainWindow *mWindow;
-
-    /**
-     * Own. An Action to quit sat application
-     */
-    HbAction *mSoftKeyQuitAction;
-
-    /**
-     * Own. An action to back to setup menu view
-     */
-    HbAction *mSoftKeyBackAction;
-
-    /**
-     * Not own.
-     */
-    SatAppEventProvider *mEvent;
-
-    /**
-     * Not own.
-     */
-    SatAppUiProvider *mUi;
-
-    /**
-     * Own,from application xml,don't delete in distructor
-     */
-    HbListWidget *mListWidget;
-
-    /**
-     * Own,from application xml,don't delete in distructor
-     */
-    HbListWidget *mSelectListWidget;
-
-    /**
-     * Own,from application xml,don't delete in distructor
-     */
-    HbLabel *mSubTitle;
-    };
-
-#endif // SATAPPVIEW_H
--- a/satui/satapp/inc/tflogger.h	Tue Jul 06 14:53:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-/*
-* 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 __TFLOGGER_H__
-#define __TFLOGGER_H__
-
-#include <flogger.h>
-#include <e32svr.h>
-
-_LIT(KTfLogFolder, "sat");
-_LIT(KTfLogFile, "satui.txt");
-
-/**
-* ------------------------------------------------------------------------------
-*
-*  Remove #define LOGGING_ENABLED from comments to enable logging
-*
-* ------------------------------------------------------------------------------
-*/
-
-#ifdef _DEBUG 
-#define LOGGING_ENABLED
-#endif
-
-/**
-* ------------------------------------------------------------------------------
-*
-*  LOGGING MACROs
-*
-*  USE THESE MACROS IN YOUR CODE
-*
-*  Example: TFLOGTEXT(own_desc)
-*  Example: TFLOGSTRING("Test")
-*  Example: TFLOGSTRING("Test %i", aValue)
-*  Example: TFLOGSTRING("Test %i %i", aValue1, aValue2)
-*
-* ------------------------------------------------------------------------------
-*/
-
-#ifdef LOGGING_ENABLED
-
-    #define TFLOGTEXT(TEXT) \
-        {  \
-        RFileLogger::Write(KTfLogFolder,KTfLogFile, \
-            EFileLoggingModeAppend, TEXT); \
-        RDebug::Print(TEXT); \
-        }
-
-    #define TFLOGSTRING(TEXT) \
-        { \
-        _LIT(tempLogDes, TEXT); \
-        RFileLogger::Write(\
-            KTfLogFolder, \
-            KTfLogFile, \
-            EFileLoggingModeAppend, \
-            tempLogDes()); \
-        RDebug::Print(_L(TEXT)); \
-        }
-
-    #define TFLOGSTRING2(TEXT, VAR1) \
-        { \
-        _LIT(tempLogDes, TEXT); \
-        RFileLogger::WriteFormat(\
-            KTfLogFolder, \
-            KTfLogFile, \
-            EFileLoggingModeAppend, \
-            TRefByValue<const TDesC>(tempLogDes()), VAR1); \
-        RDebug::Print(_L(TEXT), VAR1); \
-        }
-
-    #define TFLOGSTRING3(TEXT, VAR1, VAR2) \
-        { \
-        _LIT(tempLogDes, TEXT); \
-        RFileLogger::WriteFormat(\
-            KTfLogFolder, \
-            KTfLogFile, \
-            EFileLoggingModeAppend, \
-            TRefByValue<const TDesC>(tempLogDes()), VAR1, VAR2); \
-        RDebug::Print(_L(TEXT), VAR1, VAR2); \
-        }
-
-#else
-
-    #define TFLOGTEXT(TEXT)
-    #define TFLOGSTRING(TEXT)
-    #define TFLOGSTRING2(TEXT, VAR1)
-    #define TFLOGSTRING3(TEXT, VAR1, VAR2)
-
-#endif // LOGGING_ENABLED
-
-#endif // __TFLOGGER_H__
Binary file satui/satapp/resource/sat_text_map.xls has changed
--- a/satui/satapp/resource/satapp.docml	Tue Jul 06 14:53:02 2010 +0300
+++ b/satui/satapp/resource/satapp.docml	Wed Jul 21 18:26:52 2010 +0300
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <hbdocument context="satapp" version="0.7">
-    <widget name="setupmenu_view" type="SatAppView">
+    <widget name="setupmenu_view" type="HbView">
         <widget name="content" role="HbView:widget" type="HbWidget">
             <widget name="s:ListWidget" type="HbListWidget">
                 <real name="z" value="1"/>
@@ -15,9 +15,9 @@
         <widget name="s:MenuAction" role="HbView:menu" type="HbMenu">
             <!--ref object="t:exit" role="HbMenu:addAction"/-->
         </widget>
-        <string name="title" value="SIM Services"/>
+        <string locid="txt_simatk_title_sim_services" name="title" value="SIM Services"/>
     </widget>
-    <widget name="selectitem_view" type="SatAppView">
+    <widget name="selectitem_view" type="HbView">
         <widget name="content_2" role="HbView:widget" type="HbWidget">
             <widget name="t:ListWidget" type="HbListWidget">
                 <real name="z" value="2"/>
@@ -40,7 +40,7 @@
             <!--ref object="t:back" role="HbMenu:addAction"/-->
             <!--ref object="t:exit" role="HbMenu:addAction"/-->
         </widget>
-        <string name="title" value="SIM Services"/>
+        <string locid="txt_simatk_title_sim_services" name="title" value="SIM Services"/>
     </widget>
     <!--connect receiver="selectitem_view" sender="t:back" signal="triggered()" slot="backButtonClicked()"/-->
     <metadata activeUIState="Common ui state" display="QHD portrait" unit="un">
Binary file satui/satapp/resource/satapp.qm has changed
--- a/satui/satapp/resource/satapp.qrc	Tue Jul 06 14:53:02 2010 +0300
+++ b/satui/satapp/resource/satapp.qrc	Wed Jul 21 18:26:52 2010 +0300
@@ -4,7 +4,7 @@
         <file alias="satapp.docml">satapp.docml</file>
     </qresource>
     <qresource prefix="/translations" >
-        <file alias="satapp_en">satapp_en.qm</file>
+        <file alias="satapp">satapp.qm</file>
     </qresource>
     <qresource prefix="/icons" >
         <file>qtg_large_sat.svg</file>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satui/satapp/resource/satapp.ts	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,268 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="3.0" language="en_GB" sourcelanguage="en_GB">
+<context>
+<message numerus="no" id="txt_common_info_processing">
+    <comment>Wait note text in message box. Displayed when something is being processed.</comment>        
+    <source>Processing</source>
+    <translation variants="no">Processing</translation>
+    <extra-loc-layout_id>qtl_dialog_pri3_large_graphic</extra-loc-layout_id>    
+    <extra-loc-viewid>common</extra-loc-viewid>
+    <extra-loc-positionid>info</extra-loc-positionid>
+    <extra-loc-feature>common</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_simatk_dialog_sendingdata">
+    <comment></comment>        
+    <source>Sending data</source>
+    <translation variants="no">Sending data</translation>
+    <extra-loc-layout_id>qtl_dialog_pri3_large_graphic</extra-loc-layout_id>    
+    <extra-loc-viewid>simatk</extra-loc-viewid>
+    <extra-loc-positionid>dialog</extra-loc-positionid>
+    <extra-loc-feature>simatk</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_simatk_info_sending">
+    <comment>notification dialog</comment>        
+    <source>Sending</source>
+    <translation variants="no">Sending</translation>
+    <extra-loc-layout_id>qtl_dialog_pri3</extra-loc-layout_id>    
+    <extra-loc-viewid>simatk</extra-loc-viewid>
+    <extra-loc-positionid>info</extra-loc-positionid>
+    <extra-loc-feature>simatk</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_simatk_title_sim_services">
+    <comment>Default titlebar text</comment>        
+    <source>SIM Services</source>
+    <translation variants="no">SIM Services</translation>
+    <extra-loc-layout_id>qtl_titlebar</extra-loc-layout_id>    
+    <extra-loc-viewid>simatk_02</extra-loc-viewid>
+    <extra-loc-positionid>title</extra-loc-positionid>
+    <extra-loc-feature>simatk</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_common_button_cancel">
+    <comment>Button. Note! Use this text ID only if there are max. two buttons in the dialog. Allows the user to cancel the action or process.</comment>        
+    <source>Cancel</source>
+    <translation variants="no">Cancel</translation>
+    <extra-loc-layout_id>qtl_dialog_softkey_2</extra-loc-layout_id>    
+    <extra-loc-viewid>common</extra-loc-viewid>
+    <extra-loc-positionid>button</extra-loc-positionid>
+    <extra-loc-feature>common</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_simatk_dialog_enternnumber">
+    <comment>Default prompt text for input dialog</comment>        
+    <source>Enter:\n(number)</source>
+    <translation variants="no">Enter:\n(number)</translation>
+    <extra-loc-layout_id>qtl_dialog_sec</extra-loc-layout_id>    
+    <extra-loc-viewid>simatk_06</extra-loc-viewid>
+    <extra-loc-positionid>dialog</extra-loc-positionid>
+    <extra-loc-feature>simatk</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_simatk_dialog_entern1_digit_09">
+    <comment>inputDialog label</comment>        
+    <source>Enter:\n(1 digit 0-9) </source>
+    <translation variants="no">Enter:\n(1 digit 0-9) </translation>
+    <extra-loc-layout_id>qtl_dialog_sec</extra-loc-layout_id>    
+    <extra-loc-viewid>simatk_06</extra-loc-viewid>
+    <extra-loc-positionid>dialog</extra-loc-positionid>
+    <extra-loc-feature>simatk</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_simatk_titlw_cmcc_sim_services">
+    <comment>title for CMCC</comment>        
+    <source>CMCC SIM Services</source>
+    <translation variants="no">CMCC SIM Services</translation>
+    <extra-loc-layout_id>qtl_titlebar</extra-loc-layout_id>    
+    <extra-loc-viewid>simatk</extra-loc-viewid>
+    <extra-loc-positionid>title</extra-loc-positionid>
+    <extra-loc-feature>simatk</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_simatk_info_1_about_to_call">
+    <comment>Body text for note, shown when SAT App is opened but SAT is not supported (no SIM/offline/etc)</comment>        
+    <source>%1 about to call</source>
+    <translation variants="no">%1 about to call</translation>
+    <extra-loc-layout_id>qtl_dialog_pri5_large_graphic</extra-loc-layout_id>    
+    <extra-loc-viewid>simatk_09</extra-loc-viewid>
+    <extra-loc-positionid>info</extra-loc-positionid>
+    <extra-loc-feature>simatk</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_short_caption_sim_services">
+    <comment>list item in Application library - Short caption / grid view</comment>        
+    <source>SIM Services</source>
+    <translation variants="no">SIM Services</translation>
+    <extra-loc-layout_id>qtl_grid_applications_sec</extra-loc-layout_id>    
+    <extra-loc-viewid>simatk_01</extra-loc-viewid>
+    <extra-loc-positionid>grid</extra-loc-positionid>
+    <extra-loc-feature>simatk</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_simatk_dialog_openbrowser">
+    <comment></comment>        
+    <source>Open browser?
+</source>
+    <translation variants="no">Open browser?
+</translation>
+    <extra-loc-layout_id>qtl_dialog_pri5_large_graphic</extra-loc-layout_id>    
+    <extra-loc-viewid>simatk</extra-loc-viewid>
+    <extra-loc-positionid>dialog</extra-loc-positionid>
+    <extra-loc-feature>simatk</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_simatk_dialog_receivingdata">
+    <comment></comment>        
+    <source>Receiving data</source>
+    <translation variants="no">Receiving data</translation>
+    <extra-loc-layout_id>qtl_dialog_pri3_large_graphic</extra-loc-layout_id>    
+    <extra-loc-viewid>simatk</extra-loc-viewid>
+    <extra-loc-positionid>dialog</extra-loc-positionid>
+    <extra-loc-feature>simatk</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_simatk_dialog_connectionclosed">
+    <comment></comment>        
+    <source>Connection closed</source>
+    <translation variants="no">Connection closed</translation>
+    <extra-loc-layout_id>qtl_dialog_pri3_large_graphic</extra-loc-layout_id>    
+    <extra-loc-viewid>simatk</extra-loc-viewid>
+    <extra-loc-positionid>dialog</extra-loc-positionid>
+    <extra-loc-feature>simatk</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_tsw_caption_sim_services">
+    <comment>Item in Task Switcher.</comment>        
+    <source>SIM Services</source>
+    <translation variants="no">SIM Services</translation>
+    <extra-loc-layout_id>qtl_grid_taskswitcher_tiny</extra-loc-layout_id>    
+    <extra-loc-viewid>tsw_01</extra-loc-viewid>
+    <extra-loc-positionid>caption</extra-loc-positionid>
+    <extra-loc-feature>tsw</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_simatk_dialog_sim_services">
+    <comment>heading for dialog (input dialog, message box dialog)</comment>        
+    <source>SIM Services</source>
+    <translation variants="no">SIM Services</translation>
+    <extra-loc-layout_id>qtl_dialog_pri_heading</extra-loc-layout_id>    
+    <extra-loc-viewid>simatk_03</extra-loc-viewid>
+    <extra-loc-positionid>title</extra-loc-positionid>
+    <extra-loc-feature>simatk</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_simatk_info_open_connection">
+    <comment>text for message box dialog</comment>        
+    <source>Open connection?</source>
+    <translation variants="no">Open connection?</translation>
+    <extra-loc-layout_id>qtl_dialog_pri5_large_graphic</extra-loc-layout_id>    
+    <extra-loc-viewid>simatk</extra-loc-viewid>
+    <extra-loc-positionid>info</extra-loc-positionid>
+    <extra-loc-feature>simatk</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_long_caption_sim_services">
+    <comment>list item in Application library - Long caption / list view</comment>        
+    <source>SIM Services</source>
+    <translation variants="no">SIM Services</translation>
+    <extra-loc-layout_id>qtl_list_pri_large_graphic</extra-loc-layout_id>    
+    <extra-loc-viewid>simatk_01</extra-loc-viewid>
+    <extra-loc-positionid>dblist_1</extra-loc-positionid>
+    <extra-loc-feature>simatk</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_simatk_dpopinfo_request_not_allowed">
+    <comment>Default note body text if SIM doesn&apos;t provide one. Used when SIM does not allow a send SMS operation. Used also when SIM does not allow a Call/SendSS/SendUssd</comment>        
+    <source>Request not allowed</source>
+    <translation variants="no">Request not allowed</translation>
+    <extra-loc-layout_id>qtl_notifdialog_pri2_medium_graphic</extra-loc-layout_id>    
+    <extra-loc-viewid>simatk</extra-loc-viewid>
+    <extra-loc-positionid>dpopinfo</extra-loc-positionid>
+    <extra-loc-feature>simatk</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_simatk_dialog_enter">
+    <comment>inputDialog label</comment>        
+    <source>Enter:</source>
+    <translation variants="no">Enter:</translation>
+    <extra-loc-layout_id>qtl_dialog_sec</extra-loc-layout_id>    
+    <extra-loc-viewid>simatk</extra-loc-viewid>
+    <extra-loc-positionid>dialog</extra-loc-positionid>
+    <extra-loc-feature>simatk</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_simatk_dpopinfo_request_modified">
+    <comment>notification dialog</comment>        
+    <source>Request modified</source>
+    <translation variants="no">Request modified</translation>
+    <extra-loc-layout_id>qtl_notifdialog_pri2_medium_graphic</extra-loc-layout_id>    
+    <extra-loc-viewid>simatk</extra-loc-viewid>
+    <extra-loc-positionid>dpopinfo</extra-loc-positionid>
+    <extra-loc-feature>simatk</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_simatk_dialog_entern1_character">
+    <comment>inputDialog label</comment>        
+    <source>Enter:\n(1 character) </source>
+    <translation variants="no">Enter:\n(1 character) </translation>
+    <extra-loc-layout_id>qtl_dialog_sec</extra-loc-layout_id>    
+    <extra-loc-viewid>simatk_05</extra-loc-viewid>
+    <extra-loc-positionid>dialog</extra-loc-positionid>
+    <extra-loc-feature>simatk</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_simatk_dpopinfo_sim_services_not_available">
+    <comment>Default note body text if SIM doesn&apos;t provide one. Used when SIM modifies a send SMS operation (e.g. destination number)</comment>        
+    <source>SIM services not available</source>
+    <translation variants="no">SIM services not available</translation>
+    <extra-loc-layout_id>qtl_notifdialog_pri2_medium_graphic</extra-loc-layout_id>    
+    <extra-loc-viewid>simatk</extra-loc-viewid>
+    <extra-loc-positionid>dpopinfo</extra-loc-positionid>
+    <extra-loc-feature>simatk</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_common_button_yes">
+    <comment>Button. Note! Use this text ID only if there are max. two buttons in the dialog. Pressing this button confirms the selected operation.</comment>        
+    <source>Yes</source>
+    <translation variants="no">Yes</translation>
+    <extra-loc-layout_id>qtl_dialog_softkey_2</extra-loc-layout_id>    
+    <extra-loc-viewid>common</extra-loc-viewid>
+    <extra-loc-positionid>button</extra-loc-positionid>
+    <extra-loc-feature>common</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_simatk_dialog_sendingcontent">
+    <comment></comment>        
+    <source>Sending\n%U</source>
+    <translation variants="no">Sending\n%U</translation>
+    <extra-loc-layout_id>qtl_dialog_pri5_large_graphic</extra-loc-layout_id>    
+    <extra-loc-viewid>simatk</extra-loc-viewid>
+    <extra-loc-positionid>dialog</extra-loc-positionid>
+    <extra-loc-feature>simatk</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_common_button_no">
+    <comment>Button. Note! Use this text ID only if there are max. two buttons in the dialog. Pressing this button rejects the selected operation.</comment>        
+    <source>No</source>
+    <translation variants="no">No</translation>
+    <extra-loc-layout_id>qtl_dialog_softkey_2</extra-loc-layout_id>    
+    <extra-loc-viewid>common</extra-loc-viewid>
+    <extra-loc-positionid>button</extra-loc-positionid>
+    <extra-loc-feature>common</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_common_button_ok">
+    <comment>Button. Note! Use this text ID only if there are max. two buttons in the dialog. When this button is pressed, the focused item or operation will be selected or accepted.</comment>        
+    <source>OK</source>
+    <translation variants="no">OK</translation>
+    <extra-loc-layout_id>qtl_dialog_softkey_2</extra-loc-layout_id>    
+    <extra-loc-viewid>common</extra-loc-viewid>
+    <extra-loc-positionid>button</extra-loc-positionid>
+    <extra-loc-feature>common</extra-loc-feature>
+    <extra-loc-blank>False</extra-loc-blank>
+</message>
+</context>
+</TS>
Binary file satui/satapp/resource/satapp_en.qm has changed
--- a/satui/satapp/resource/satapp_en.ts	Tue Jul 06 14:53:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,346 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE TS>
-<TS version="3.0" language="en_GB" sourcelanguage="en_GB">
-<context>
-<message numerus="no" id="txt_sat_setupcall_confirm_note">
-    <comment></comment>        
-    <source> about to call</source>
-    <translation variants="no"> about to call</translation>
-    <extra-loc-layout_id></extra-loc-layout_id>    
-    <extra-loc-viewid></extra-loc-viewid>
-    <extra-loc-positionid></extra-loc-positionid>
-    <extra-loc-feature></extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_sat_getinkey_char">
-    <comment></comment>        
-    <source>Enter character </source>
-    <translation variants="no">Enter character </translation>
-    <extra-loc-layout_id></extra-loc-layout_id>    
-    <extra-loc-viewid></extra-loc-viewid>
-    <extra-loc-positionid></extra-loc-positionid>
-    <extra-loc-feature></extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_sat_general_call">
-    <comment></comment>        
-    <source>Call</source>
-    <translation variants="no">Call</translation>
-    <extra-loc-layout_id></extra-loc-layout_id>    
-    <extra-loc-viewid></extra-loc-viewid>
-    <extra-loc-positionid></extra-loc-positionid>
-    <extra-loc-feature></extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_sat_conf_close_channel_bip">
-    <comment></comment>        
-    <source>Connection closed</source>
-    <translation variants="no">Connection closed</translation>
-    <extra-loc-layout_id></extra-loc-layout_id>    
-    <extra-loc-viewid></extra-loc-viewid>
-    <extra-loc-positionid></extra-loc-positionid>
-    <extra-loc-feature></extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_sat_request_modified">
-    <comment></comment>        
-    <source>Request modified</source>
-    <translation variants="no">Request modified</translation>
-    <extra-loc-layout_id></extra-loc-layout_id>    
-    <extra-loc-viewid></extra-loc-viewid>
-    <extra-loc-positionid></extra-loc-positionid>
-    <extra-loc-feature></extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_sat_sending_sms">
-    <comment></comment>        
-    <source>Sending…</source>
-    <translation variants="no">Sending…</translation>
-    <extra-loc-layout_id></extra-loc-layout_id>    
-    <extra-loc-viewid></extra-loc-viewid>
-    <extra-loc-positionid></extra-loc-positionid>
-    <extra-loc-feature></extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_sat_cc_not_allowed">
-    <comment></comment>        
-    <source>Request not allowed</source>
-    <translation variants="no">Request not allowed</translation>
-    <extra-loc-layout_id></extra-loc-layout_id>    
-    <extra-loc-viewid></extra-loc-viewid>
-    <extra-loc-positionid></extra-loc-positionid>
-    <extra-loc-feature></extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_sat_general_cancel">
-    <comment></comment>        
-    <source>Cancel</source>
-    <translation variants="no">Cancel</translation>
-    <extra-loc-layout_id></extra-loc-layout_id>    
-    <extra-loc-viewid></extra-loc-viewid>
-    <extra-loc-positionid></extra-loc-positionid>
-    <extra-loc-feature></extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_sat_cc_modified">
-    <comment></comment>        
-    <source>Request modified</source>
-    <translation variants="no">Request modified</translation>
-    <extra-loc-layout_id></extra-loc-layout_id>    
-    <extra-loc-viewid></extra-loc-viewid>
-    <extra-loc-positionid></extra-loc-positionid>
-    <extra-loc-feature></extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_sat_sendingtextmessage">
-    <comment></comment>        
-    <source>Sending Text message</source>
-    <translation variants="no">Sending Text message</translation>
-    <extra-loc-layout_id></extra-loc-layout_id>    
-    <extra-loc-viewid></extra-loc-viewid>
-    <extra-loc-positionid></extra-loc-positionid>
-    <extra-loc-feature></extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_sat_application_name">
-    <comment></comment>        
-    <source>SAT MESSAGE HEADER</source>
-    <translation variants="no">SAT MESSAGE HEADER</translation>
-    <extra-loc-layout_id></extra-loc-layout_id>    
-    <extra-loc-viewid></extra-loc-viewid>
-    <extra-loc-positionid></extra-loc-positionid>
-    <extra-loc-feature></extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_sat_general_back">
-    <comment></comment>        
-    <source>Back</source>
-    <translation variants="no">Back</translation>
-    <extra-loc-layout_id></extra-loc-layout_id>    
-    <extra-loc-viewid></extra-loc-viewid>
-    <extra-loc-positionid></extra-loc-positionid>
-    <extra-loc-feature></extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_sat_general_no">
-    <comment></comment>        
-    <source>No</source>
-    <translation variants="no">No</translation>
-    <extra-loc-layout_id></extra-loc-layout_id>    
-    <extra-loc-viewid></extra-loc-viewid>
-    <extra-loc-positionid></extra-loc-positionid>
-    <extra-loc-feature></extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_sat_sendss_wait_note_send">
-    <comment></comment>        
-    <source>Sending…</source>
-    <translation variants="no">Sending…</translation>
-    <extra-loc-layout_id></extra-loc-layout_id>    
-    <extra-loc-viewid></extra-loc-viewid>
-    <extra-loc-positionid></extra-loc-positionid>
-    <extra-loc-feature></extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_sat_general_yes">
-    <comment></comment>        
-    <source>Yes</source>
-    <translation variants="no">Yes</translation>
-    <extra-loc-layout_id></extra-loc-layout_id>    
-    <extra-loc-viewid></extra-loc-viewid>
-    <extra-loc-positionid></extra-loc-positionid>
-    <extra-loc-feature></extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_sat_selectitem_title">
-    <comment></comment>        
-    <source>Make a choice...</source>
-    <translation variants="no">Make a choice...</translation>
-    <extra-loc-layout_id></extra-loc-layout_id>    
-    <extra-loc-viewid></extra-loc-viewid>
-    <extra-loc-positionid></extra-loc-positionid>
-    <extra-loc-feature></extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_sat_general_send">
-    <comment></comment>        
-    <source>Send</source>
-    <translation variants="no">Send</translation>
-    <extra-loc-layout_id></extra-loc-layout_id>    
-    <extra-loc-viewid></extra-loc-viewid>
-    <extra-loc-positionid></extra-loc-positionid>
-    <extra-loc-feature></extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_sat_sendss_error_note">
-    <comment></comment>        
-    <source>Not done</source>
-    <translation variants="no">Not done</translation>
-    <extra-loc-layout_id></extra-loc-layout_id>    
-    <extra-loc-viewid></extra-loc-viewid>
-    <extra-loc-positionid></extra-loc-positionid>
-    <extra-loc-feature></extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_sat_title">
-    <comment></comment>        
-    <source>SIM Services</source>
-    <translation variants="no">SIM Services</translation>
-    <extra-loc-layout_id></extra-loc-layout_id>    
-    <extra-loc-viewid></extra-loc-viewid>
-    <extra-loc-positionid></extra-loc-positionid>
-    <extra-loc-feature></extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_sat_getinput_nbr">
-    <comment></comment>        
-    <source>Enter:\n(1 digit 0-9)</source>
-    <translation variants="no">Enter:\n(1 digit 0-9)</translation>
-    <extra-loc-layout_id></extra-loc-layout_id>    
-    <extra-loc-viewid></extra-loc-viewid>
-    <extra-loc-positionid></extra-loc-positionid>
-    <extra-loc-feature></extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_sat_getinkey_nbr">
-    <comment></comment>        
-    <source>Enternumber (1 digit 0-9) </source>
-    <translation variants="no">Enternumber (1 digit 0-9) </translation>
-    <extra-loc-layout_id></extra-loc-layout_id>    
-    <extra-loc-viewid></extra-loc-viewid>
-    <extra-loc-positionid></extra-loc-positionid>
-    <extra-loc-feature></extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_sat_sendss_wait_note_request">
-    <comment></comment>        
-    <source>Requesting…</source>
-    <translation variants="no">Requesting…</translation>
-    <extra-loc-layout_id></extra-loc-layout_id>    
-    <extra-loc-viewid></extra-loc-viewid>
-    <extra-loc-positionid></extra-loc-positionid>
-    <extra-loc-feature></extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_sat_openchannel_confirm_note">
-    <comment></comment>        
-    <source>Open connection?</source>
-    <translation variants="no">Open connection?</translation>
-    <extra-loc-layout_id></extra-loc-layout_id>    
-    <extra-loc-viewid></extra-loc-viewid>
-    <extra-loc-positionid></extra-loc-positionid>
-    <extra-loc-feature></extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_sat_conf_send_data_bip">
-    <comment></comment>        
-    <source>Sending data</source>
-    <translation variants="no">Sending data</translation>
-    <extra-loc-layout_id></extra-loc-layout_id>    
-    <extra-loc-viewid></extra-loc-viewid>
-    <extra-loc-positionid></extra-loc-positionid>
-    <extra-loc-feature></extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_sat_sim_notification_sendsms">
-    <comment></comment>        
-    <source>Allow SIM card to send message?</source>
-    <translation variants="no">Allow SIM card to send message?</translation>
-    <extra-loc-layout_id></extra-loc-layout_id>    
-    <extra-loc-viewid></extra-loc-viewid>
-    <extra-loc-positionid></extra-loc-positionid>
-    <extra-loc-feature></extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_sat_closechannel_wait_note">
-    <comment></comment>        
-    <source>Connection closed</source>
-    <translation variants="no">Connection closed</translation>
-    <extra-loc-layout_id></extra-loc-layout_id>    
-    <extra-loc-viewid></extra-loc-viewid>
-    <extra-loc-positionid></extra-loc-positionid>
-    <extra-loc-feature></extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_sat_general_ok">
-    <comment></comment>        
-    <source>OK</source>
-    <translation variants="no">OK</translation>
-    <extra-loc-layout_id></extra-loc-layout_id>    
-    <extra-loc-viewid></extra-loc-viewid>
-    <extra-loc-positionid></extra-loc-positionid>
-    <extra-loc-feature></extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_sat_sim_notification_sendss_ussd">
-    <comment></comment>        
-    <source>Allow SIM card to send a request to the network?</source>
-    <translation variants="no">Allow SIM card to send a request to the network?</translation>
-    <extra-loc-layout_id></extra-loc-layout_id>    
-    <extra-loc-viewid></extra-loc-viewid>
-    <extra-loc-positionid></extra-loc-positionid>
-    <extra-loc-feature></extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_sat_conf_receive_data_bip">
-    <comment></comment>        
-    <source>Receiving data</source>
-    <translation variants="no">Receiving data</translation>
-    <extra-loc-layout_id></extra-loc-layout_id>    
-    <extra-loc-viewid></extra-loc-viewid>
-    <extra-loc-positionid></extra-loc-positionid>
-    <extra-loc-feature></extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_sat_getinput_char">
-    <comment></comment>        
-    <source>Enter:</source>
-    <translation variants="no">Enter:</translation>
-    <extra-loc-layout_id></extra-loc-layout_id>    
-    <extra-loc-viewid></extra-loc-viewid>
-    <extra-loc-positionid></extra-loc-positionid>
-    <extra-loc-feature></extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_sat_senddtmf_wait_note">
-    <comment></comment>        
-    <source>Sending DTMF</source>
-    <translation variants="no">Sending DTMF</translation>
-    <extra-loc-layout_id></extra-loc-layout_id>    
-    <extra-loc-viewid></extra-loc-viewid>
-    <extra-loc-positionid></extra-loc-positionid>
-    <extra-loc-feature></extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_sat_note_sending_dtmf_template">
-    <comment></comment>        
-    <source>Sending\n%U</source>
-    <translation variants="no">Sending\n%U</translation>
-    <extra-loc-layout_id></extra-loc-layout_id>    
-    <extra-loc-viewid></extra-loc-viewid>
-    <extra-loc-positionid></extra-loc-positionid>
-    <extra-loc-feature></extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_sat_wait_note_without_delay">
-    <comment></comment>        
-    <source>Processing</source>
-    <translation variants="no">Processing</translation>
-    <extra-loc-layout_id></extra-loc-layout_id>    
-    <extra-loc-viewid></extra-loc-viewid>
-    <extra-loc-positionid></extra-loc-positionid>
-    <extra-loc-feature></extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_sat_mosm_not_allowed">
-    <comment></comment>        
-    <source>Request not allowed</source>
-    <translation variants="no">Request not allowed</translation>
-    <extra-loc-layout_id></extra-loc-layout_id>    
-    <extra-loc-viewid></extra-loc-viewid>
-    <extra-loc-positionid></extra-loc-positionid>
-    <extra-loc-feature></extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-</context>
-</TS>
--- a/satui/satapp/satapp.pro	Tue Jul 06 14:53:02 2010 +0300
+++ b/satui/satapp/satapp.pro	Wed Jul 21 18:26:52 2010 +0300
@@ -30,51 +30,49 @@
     TARGET.UID3=0x101f4ce0
 }
 
+# enable this for tracing into a file (log/sat/satui.txt)
+# DEFINES += SAT_DEBUG_TO_FILE
+# LIBS += -lflogger
 
-    INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE \
-        .inc\
-        MOC_DIR \
-        ../../inc 
+INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE \
+    $$MOC_DIR \
+    ../../inc 
 
-    LIBS += -lSatClient \
-            -lSatInternalClient \
-            -legul \
-            -lfbscli \
-            -lcentralrepository \
-            -lCenRepNotifHandler \
-            -lCdlEngine \
-            -lmediaclientaudio \
-            -lFlogger \
-            -lprofileeng 
+LIBS += -lSatClient \
+        -lSatInternalClient \
+        -legul \
+        -lfbscli \
+        -lcentralrepository \
+        -lCenRepNotifHandler \
+        -lCdlEngine \
+        -lmediaclientaudio \
+        -lprofileeng \
+        -lbafl 
 
-    HEADERS += inc/msatuiactionimplementer.h \
-               inc/satappcommonconstant.h \
-               inc/tflogger.h \
-               inc/satappmainhandler.h \
-               inc/satappcommandhandler.h \
-               inc/satappeventprovider.h \
-               inc/satappuiprovider.h \
-               inc/satappview.h \
-               inc/csatuiobserver.h \
-               inc/csatuiiconhandler.h \
-               inc/satappplaytoneprovider.h \
-               inc/dialogwaiter.h
+HEADERS += inc/satappmainhandler.h \
+           inc/satappserverdispatcher.h \
+           inc/satappmenuprovider.h \
+           inc/satappinputprovider.h \
+           inc/satapptoneprovider.h \
+           inc/satapppopupprovider.h\
+           inc/satappconfirmprovider.h \
+           inc/satappaction.h \
+           inc/satappconstant.h
 
-    SOURCES += src/main.cpp \
-               src/satappmainhandler.cpp \
-               src/satappcommandhandler.cpp \
-               src/satappeventprovider.cpp \
-               src/satappuiprovider.cpp \
-               src/satappview.cpp \
-               src/csatuiobserver.cpp \
-               src/csatuiiconhandler.cpp \
-               src/satappplaytoneprovider.cpp \
-               src/dialogwaiter.cpp
-    
-    BLD_INF_RULES.prj_exports += "rom/satapp.iby CORE_MW_LAYER_IBY_EXPORT_PATH(satapp.iby)" \
-                                 "rom/satapp_stub.sis /epoc32/data/z/system/install/satapp_stub.sis" \
-                                 "resource/satapp_en.ts /epoc32/include/platform/qt/translations/satapp_en.ts"
-                                 
+SOURCES += src/main.cpp \
+           src/satappmainhandler.cpp \
+           src/satappserverdispatcher.cpp \
+           src/satappmenuprovider.cpp \
+           src/satappinputprovider.cpp \
+           src/satapptoneprovider.cpp \
+           src/satapppopupprovider.cpp \
+           src/satappconfirmprovider.cpp \
+           src/satappaction.cpp
+
+BLD_INF_RULES.prj_exports += "rom/satapp.iby CORE_MW_LAYER_IBY_EXPORT_PATH(satapp.iby)" \
+                             "rom/satapp_stub.sis /epoc32/data/z/system/install/satapp_stub.sis" \
+                             "resource/satapp.ts /epoc32/include/platform/qt/translations/satapp.ts"
+                             
 
 RESOURCES += resource/satapp.qrc
 
--- a/satui/satapp/src/csatuiiconhandler.cpp	Tue Jul 06 14:53:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,245 +0,0 @@
-/*
-* 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: Implementation of CSatUiIconHandler class.
-*
-*/
-
-#include    <exception>
-#include    <fbs.h>
-#include    <rsatservice.h>
-#include    <tsaticoninfo.h>
-
-#include    "csatuiiconhandler.h"
-#include    "tflogger.h"
-
-// ============================ MEMBER FUNCTIONS =============================
-
-// ---------------------------------------------------------------------------
-// First part of Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CSatUiIconHandler* CSatUiIconHandler::NewL()
-    {
-    TFLOGSTRING( "CSatUiIconHandler::NewL enter" )
-    CSatUiIconHandler* self = new ( ELeave ) CSatUiIconHandler;
-    TFLOGSTRING( "CSatUiIconHandler::NewL exit" )
-    return self;
-    }
-
-// ---------------------------------------------------------------------------
-// Destructor
-// ---------------------------------------------------------------------------
-//
-CSatUiIconHandler::~CSatUiIconHandler()
-    {
-    TFLOGSTRING( "CSatUiIconHandler::~CSatUiIconHandler enter" )
-    // Close RSatService interface
-    iSatService.Close();
-    TFLOGSTRING( "CSatUiIconHandler::~CSatUiIconHandler exit" )
-    }
-
-// ---------------------------------------------------------------------------
-// Fetches first icon information, then the handle to the icon and at last
-// does the duplication of the icon bitmap. Object is set to wait the
-// completion of the request.
-// ---------------------------------------------------------------------------
-//
-CFbsBitmap* CSatUiIconHandler::FetchIconL( const RSatSession& aSatSession,
-                                           const TUint8 aIconId,
-                                           const TInt aOptWidth,
-                                           const TInt aOptHeight,
-                                           TBool& aIconSupport )
-    {
-    TFLOGSTRING( "CSatUiIconHandler::FetchIconL enter" )
-    TFLOGSTRING3( "CSatUiIconHandler::FetchIconL aOptWidth=%d aOptHeight=%d",
-            aOptWidth, aOptHeight )
-
-    iSatService.OpenL( aSatSession );
-    CleanupClosePushL( iSatService );
-
-    RIconEf iconEf;
-    CleanupClosePushL( iconEf );
-    // Order of superiority list
-    RArray<TInt> selectedIcons;
-    CleanupClosePushL( selectedIcons );
-    CFbsBitmap* iconBitmap = NULL;
-
-    // Getting the information of the icon
-    TRAPD( err, iSatService.GetIconInfoL( aIconId, iconEf ); );
-
-    if ( KErrNone == err )
-        {
-        TFLOGSTRING( "CSatUiIconHandler::FetchIconL no error" )
-        // Sorting into order of superiority
-        SortIconsL( iconEf, selectedIcons, aOptWidth, aOptHeight );
-
-        // Reset iconCount by approved icons
-        const TInt iconCount = selectedIcons.Count() <= iconEf.Count() ?
-                               selectedIcons.Count() :
-                               iconEf.Count();
-        TBool fetchSuccess( EFalse );
-
-        TFLOGSTRING2( "CSatUiIconHandler::FetchIconL iconCount: %d", iconCount )
-        // If there were icons to be fetched
-        if ( 0 < iconCount )
-            {
-            // start going through approved icons list from the
-            // first and biggest icon
-            TInt counter( 0 );
-            for ( counter = 0; ( counter < iconCount ) && !fetchSuccess;
-                counter++ )
-                {
-                TInt selectedIconCounter = selectedIcons.operator[]( counter );
-                TFLOGSTRING2( "CSatUiIconHandler::\
-                    FetchIconL selectedIconCounter: %d", selectedIconCounter )
-                TRAPD( err,
-                       iconBitmap = iSatService.GetIconL( iconEf.operator[](
-                           selectedIconCounter ) ) );
-                if ( KErrNone == err  )
-                    {
-                    fetchSuccess = ETrue;
-                    TFLOGSTRING( "CSatUiIconHandler::FetchIconL fetchSuccess!" )
-                    }
-                else
-                    {
-                    delete iconBitmap;
-                    }
-                }
-            }
-        }
-
-        TFLOGSTRING2( "CSatUiIconHandler::FetchIconL icon info error=%d", err )
-        if ( KErrNotSupported == err )
-            {
-            TFLOGSTRING( "CSatUiIconHandler::FetchIconL icons not supported" )
-            aIconSupport = EFalse;
-            }
-
-    // selectedIcons, iconEf and iSatService not deleted but closed
-    CleanupStack::PopAndDestroy( 3, &iSatService );
-
-    TFLOGSTRING( "CSatUiIconHandler::FetchIconL exit" )
-    // Icon was not found, icons are not supported or an error was received.
-    return iconBitmap;
-    }
-
-// ---------------------------------------------------------------------------
-// C++ default constructor cannot contain any code that might leave.
-// ---------------------------------------------------------------------------
-//
-CSatUiIconHandler::CSatUiIconHandler()
-    {
-    TFLOGSTRING( "CSatUiIconHandler::CSatUiIconHandler enter - exit" )
-    }
-
-// ---------------------------------------------------------------------------
-// Sorts icons into order of superiority
-// ---------------------------------------------------------------------------
-//
-void CSatUiIconHandler::SortIconsL( const RIconEf& aIconEf,
-    RArray<TInt>& aSelectedIcons, const TInt aOptWidth,
-    const TInt aOptHeight ) const
-    {
-    TFLOGSTRING( "CSatUiIconHandler::SortIcons enter" )
-
-    const TInt iconCount = aIconEf.Count();
-    TFLOGSTRING2( "CSatUiIconHandler::SortIcons iconCount=%d", iconCount )
-    TInt counter( 0 );
-    // Search icon from available iconarray
-    for ( counter = 0; counter < iconCount; counter++ )
-        {
-        TFLOGSTRING3( "CSatUiIconHandler::SortIcons Icon Width=%d Height=%d",
-            aIconEf.operator[]( counter ).IconSize().iWidth,
-            aIconEf.operator[]( counter ).IconSize().iHeight )
-
-        const TInt selectedCount( aSelectedIcons.Count() );
-        TBool replacement( EFalse );
-
-        // Count the difference of the icon versus layout
-        TInt newWidthDifference(
-            aOptWidth - aIconEf.operator[]( counter ).IconSize().iWidth );
-        TInt newHeightDifference(
-            aOptHeight - aIconEf.operator[]( counter ).IconSize().iHeight );
-
-        // Make the difference absolute value
-        if ( newWidthDifference < 0 )
-            {
-            newWidthDifference = -newWidthDifference;
-            }
-
-        if ( newHeightDifference < 0 )
-            {
-            newHeightDifference = -newHeightDifference;
-            }
-        TInt listCounter( 0 );
-        // Going through the list of icons of suitable size
-        for ( listCounter = 0; ( listCounter < selectedCount ) &&
-            !replacement; listCounter++ )
-            {
-
-            // Count the difference of the icon versus layout
-            TInt oldWidthDifference( aOptWidth - aIconEf.operator[](
-              aSelectedIcons.operator[]( listCounter ) ).IconSize().iWidth );
-            TInt oldHeightDifference( aOptHeight - aIconEf.operator[](
-              aSelectedIcons.operator[]( listCounter ) ).IconSize().iHeight );
-
-            // Make the difference absolute value
-            if ( oldWidthDifference < 0 )
-                {
-                oldWidthDifference = -oldWidthDifference;
-                }
-
-            if ( oldHeightDifference < 0 )
-                {
-                oldHeightDifference = -oldHeightDifference;
-                }
-
-            // New icon is better either by being closer to the layout or by
-            // being same size and color instead of black and white
-            if ( ( ( newWidthDifference < oldWidthDifference ) &&
-                  ( newHeightDifference <= oldHeightDifference ) ) ||
-                ( ( newWidthDifference <= oldWidthDifference ) &&
-                  ( newHeightDifference < oldHeightDifference ) ) ||
-                ( ( newWidthDifference == oldWidthDifference ) &&
-                  ( newHeightDifference == oldHeightDifference ) &&
-                 ( TSatIconInfo::EBasic == aIconEf.operator[]( aSelectedIcons.
-                    operator[]( listCounter ) ).CodingScheme() ) &&
-                 ( TSatIconInfo::EColor ==  aIconEf.operator[]( counter ).
-                    CodingScheme() ) ) )
-                {
-                TFLOGSTRING2( "CSatUiIconHandler::SortIcons \
-                             newWidthDifference: %d", newWidthDifference )
-                TFLOGSTRING2( "CSatUiIconHandler::SortIcons \
-                             oldHeightDifference: %d", oldHeightDifference )
-                // Insert new icon to correct place
-                aSelectedIcons.InsertL( counter, listCounter );
-                replacement = ETrue;
-                }
-            }
-
-        TFLOGSTRING2( "CSatUiIconHandler::SortIcons listCounter: %d", \
-            listCounter )
-        // Either first item or was not better than any in the list
-        // New icon is added to the end of the array
-        if ( !replacement )
-            {
-            aSelectedIcons.AppendL( counter );
-            }
-        }
-
-    TFLOGSTRING2( "CSatUiIconHandler::SortIcons counter: %d", \
-            counter )
-    TFLOGSTRING( "CSatUiIconHandler::SortIcons exit" )
-    }
-
--- a/satui/satapp/src/csatuiobserver.cpp	Tue Jul 06 14:53:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1648 +0,0 @@
-/*
-* 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:  This class handles the communication between server and
-*                user interface
-*
-*/
-
-
-// INCLUDE FILES
-#include    <e32test.h>
-#include    <msatuiadapter.h>
-#include    <ProfileEngineSDKCRKeys.h>
-#include    <centralrepository.h>
-#include    <settingsinternalcrkeys.h>
-#include    <gulicon.h> //for itemsicon
-#include    <fbs.h>
-#include    <HbGlobal>
-
-#include    "csatuiobserver.h"
-#include    "msatuiactionimplementer.h"
-#include    "csatuiiconhandler.h"
-#include    "tflogger.h"
-
-// CONSTANTS
-const TInt KSatActiveProfileOffline = 5; // value from ProfileEngine
-
-// PlayTone durations
-const TInt64 KSatDur170ms  = 170000;  // 170ms
-const TInt64 KSatDur200ms  = 200000;  // 200ms
-const TInt64 KSatDur250ms  = 250000;  // 250ms
-const TInt64 KSatDur1200ms = 1200000; // 1200ms
-
-// play tone tones
-_LIT8(KNetToneSeqNetBusy, "\x00\x11\x05\x4E\x30\x40\x30\x07\x0B");
-
-_LIT8(KNetToneSeqNetCallWaiting, "\x00\x11\x05\x4E\x14\x40\x3C\x4E\x14\
-\x40\x64\x40\x64\x40\x64\x4E\x14\x40\x3C\x4E\x14\x40\x64\x40\x64\x40\x64\
-\x07\x0B");
-
-_LIT8(KNetToneSeqNetCongestion, "\x00\x11\x05\x4E\x14\x40\x14\x07\x0B");
-
-_LIT8(KNetToneSeqNetSpecialInformation, "\x00\x11\x05\x4F\x21\x50\
-\x21\x51\x21\x40\x64\x07\x0B");
-
-_LIT8(KNetToneSeqDial,"\x00\x11\x05\x4E\xFE\x4E\xFE\x4E\xFE\x4E\xFE\x4E\xFE\
-\x4E\xFE\x4E\xFE\x4E\xFE\x07\x0B");
-
-_LIT8(KNetToneSeqRingGoing, "\x00\x11\x05\x4E\x64\x05\x04\x40\x64\06\x07\x0B");
-
-// General Beep is set for forever duration. Instead of AVKON definition 170ms.
-_LIT8(KGeneralBeep, "\x00\x11\x0A\x76\x00\x0B");
-_LIT8(KErrorTone, "\x00\x11\x0A\x6C\x19\x0B");
-_LIT8(KRadioPathNotAvailable, "\x00\x11\x0A\x05\x03\x4E\x14\x40\x14\x06\x0B");
-_LIT8(KRadioPathAck, "\x00\x11\x0A\x02\xFC\x0A\x80\x4E\x14\x0A\x7f\x0B");
-
-// ================= MEMBER FUNCTIONS =========================================
-
-// ----------------------------------------------------------------------------
-// CSatUiObserver::CSatUiObserver
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-CSatUiObserver::CSatUiObserver():
-    iRefresh(EFalse),
-    iIconSupport(ETrue),
-    iClearScreenEvent(EFalse)
-    {
-    }
-
-// ----------------------------------------------------------------------------
-// CSatUiObserver::ConstructL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void CSatUiObserver::ConstructL()
-    {
-    TFLOGSTRING("SATAPP: CSatUiObserver::ConstructL called")
-    TFLOGSTRING("SATAPP: CSatUiObserver::ConstructL exit")
-    }
-
-// ----------------------------------------------------------------------------
-// CSatUiObserver::NewL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-CSatUiObserver* CSatUiObserver::NewL()
-    {
-    TFLOGSTRING("SATAPP: CSatUiObserver::NewL() called")
-    CSatUiObserver* self = new (ELeave) CSatUiObserver;
-
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    CleanupStack::Pop(self);
-    TFLOGSTRING("SATAPP: CSatUiObserver::NewL() exit")
-    return self;
-    }
-
-// ----------------------------------------------------------------------------
-// CSatUiObserver::~CSatUiObserver
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-CSatUiObserver::~CSatUiObserver()
-    {
-    TFLOGSTRING("SATAPP: CSatUiObserver::~CSatUiObserver() called")
-    iActionImplementer = NULL;
-    iAdapter = NULL;
-    TFLOGSTRING("SATAPP: CSatUiObserver::~CSatUiObserver() exit")
-    }
-
-// ----------------------------------------------------------------------------
-// CSatUiObserver::SetImplementer
-// Sets a pointer to CSatUiViewAppUi object.
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void CSatUiObserver::SetImplementer(
-    MSatUiActionImplementer* aImplementer)
-    {
-    TFLOGSTRING("SATAPP: CSatUiObserver::SetImplementer calling")
-    iActionImplementer = aImplementer;
-    TFLOGSTRING("SATAPP: CSatUiObserver::SetImplementer exiting")
-    }
-
-// ----------------------------------------------------------------------------
-// CSatUiObserver::Adapter
-// Returns a pointer to MSatUiAdapter provided by SatCli.
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-MSatUiAdapter* CSatUiObserver::Adapter()
-    {
-    TFLOGSTRING("SATAPP: CSatUiObserver::Adapter calling-exiting")
-    return iAdapter;
-    }
-
-// ----------------------------------------------------------------------------
-// CSatUiObserver::DisplayTextL
-// Checks length of the text and calls method from
-// the CSatUiViewAppUi class if the length is OK.
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-TSatUiResponse CSatUiObserver::DisplayTextL(
-    const TDesC& aText,
-    const TDesC& aSimApplicationName,
-    const TSatIconId& aIconId,
-    TBool& aRequestedIconDisplayed,
-    const TBool aSustainedText,
-    const TTimeIntervalSeconds aDuration,
-    const TBool aWaitUserToClear)
-    {
-    TFLOGSTRING("SATAPP: CSatUiObserver::DisplayText called")
-    TSatUiResponse response(ESatFailure);
-    aRequestedIconDisplayed = ETrue;
-    TBool selfExplanatoryIcon(EFalse);
-
-    TInt textLength(aText.Length());
-
-    if ((!textLength) || (textLength > RSat::KTextToDisplayMaxSize))
-        {
-        TFLOGSTRING("SATAPP: CSatUiObserver::DisplayText no text")
-        aRequestedIconDisplayed = EFalse;
-        return response;
-        }
-
-    CFbsBitmap* iconBitmapDisplayText = NULL;
-    iActionImplementer->SetCommandPending(ETrue);
-
-    //if icon is available for command
-    if (((ESatSelfExplanatory == aIconId.iIconQualifier) ||
-        (ESatNotSelfExplanatory == aIconId.iIconQualifier)) &&
-        (iIconSupport))
-        {
-        TFLOGSTRING("SATAPP: CSatUiObserver::DisplayText have icon")
-        iconBitmapDisplayText = FetchIcon(aIconId.iIdentifier,
-                                           EIconDisplayText);
-
-        if (ESatSelfExplanatory == aIconId.iIconQualifier)
-            {
-            TFLOGSTRING("SATAPP: CSatUiObserver::DisplayText self \
-                explanatory icon")
-            selfExplanatoryIcon = ETrue;
-            }
-        }
-
-    //icon not found not shown
-    if (!iconBitmapDisplayText)
-        {
-        aRequestedIconDisplayed = EFalse;
-        }
-
-    iActionImplementer->DispatchTimer(iWait);
-
-    TFLOGSTRING2("CSatUiObserver::DisplayTextL aDuration: %d", aDuration.Int())
-    TRAPD(err,
-        response = iActionImplementer->DisplayTextL(aText, aSimApplicationName,
-            iconBitmapDisplayText, selfExplanatoryIcon,
-            aSustainedText, aDuration, aWaitUserToClear);
-       );
-
-    if ( KErrNone != err )
-        {
-        response = ESatFailure;
-        aRequestedIconDisplayed = EFalse;
-        }
-
-    if ( iActionImplementer->GetEndKey() )
-        {
-        response = ESatSessionTerminatedByUser;
-        iActionImplementer->SetEndKey( EFalse );
-        }
-
-    iActionImplementer->SetCommandPending( EFalse );
-
-    TFLOGSTRING2("SATAPP: CSatUiObserver::DisplayText exit, return: %d", \
-        response)
-    return response;
-    }
-
-// ----------------------------------------------------------------------------
-// CSatUiObserver::GetInkeyL
-// Checks type of the input wanted and calls right method
-// from the CSatUiViewAppUi class.
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-TSatUiResponse CSatUiObserver::GetInkeyL(
-    const TDesC& aText,
-    const TSatCharacterSet aCharacterSet,
-    TChar& aInput,
-    const TBool /*aHelpIsAvailable*/,
-    const TSatIconId& aIconId,
-    TBool& aRequestedIconDisplayed,
-    TUint& aDuration,
-    const TBool aImmediateDigitResponse)
-    {
-    TFLOGSTRING("SATAPP: CSatUiObserver::GetInkey called")
-
-    TSatUiResponse response(ESatSuccess);
-    aRequestedIconDisplayed = EFalse;
-    TBuf<1> input;
-
-    if (aInput.IsAssigned())
-        {
-        input.Fill(aInput, 1);
-        }
-
-    if ( ( ESatYesNo == aCharacterSet ) && (aText.Length() == 0) )
-        {
-        TFLOGSTRING("SATAPP: CSatUiObserver::GetInkey return ESatFailure")
-        return ESatFailure;
-        }
-
-    CFbsBitmap* iconBitmapGetInkey = NULL;
-    iActionImplementer->SetCommandPending(ETrue);
-
-    // If icon is available for command
-    if (((ESatSelfExplanatory == aIconId.iIconQualifier) ||
-        (ESatNotSelfExplanatory == aIconId.iIconQualifier)) &&
-        (iIconSupport))
-        {
-        TFLOGSTRING("SATAPP: CSatUiObserver::GetInkey have icon")
-        TIconCommand iconCommand (EIconGetInkey);
-
-        if (ESatYesNo == aCharacterSet)
-            {
-            iconCommand = EIconGetYesNo;
-            }
-
-        iconBitmapGetInkey = FetchIcon(aIconId.iIdentifier,
-                iconCommand);
-        GetScalableBitmap(iconBitmapGetInkey, iconCommand,
-            aRequestedIconDisplayed);
-        }
-
-    TBool selfExplanatory(EFalse);
-
-    // Icon is self-explanatory
-    if (ESatSelfExplanatory == aIconId.iIconQualifier)
-        {
-        selfExplanatory = ETrue;
-        }
-
-    iActionImplementer->DispatchTimer(iWait);
-
-    TRAPD(err,
-
-        if (ESatYesNo == aCharacterSet || aImmediateDigitResponse)
-            {
-            TFLOGSTRING("SATAPP: CSatUiObserver::GetInkey digit response")
-            response = iActionImplementer->GetYesNoL(aText, aCharacterSet,
-                aInput, iconBitmapGetInkey, selfExplanatory, aDuration,
-                aImmediateDigitResponse);
-            }
-        else //ESatCharSmsDefaultAlphabet, ESatCharUcs2Alphabet, ESatDigitOnly
-            {
-            TFLOGSTRING("SATAPP: CSatUiObserver::GetInkey other conditions")
-            response = iActionImplementer->GetInputL(
-                aText, aCharacterSet, input, 1, 1, EFalse, ETrue,
-                iconBitmapGetInkey, selfExplanatory, aDuration);
-
-            if ( ESatSuccess == response && input.Length() )
-                {
-                aInput = input[0];
-                }
-            }
-       );
-
-    if ( KErrNone != err )
-        {
-        response = ESatFailure;
-        }
-
-    if (iActionImplementer->GetEndKey())
-        {
-        response = ESatSessionTerminatedByUser;
-        iActionImplementer->SetEndKey(EFalse);
-        }
-    iActionImplementer->SetCommandPending(EFalse);
-
-    TFLOGSTRING2("SATAPP: CSatUiObserver::GetInkey exit, return: %d", \
-        response)
-    return response;
-    }
-
-// --------------------------------------------------------
-// CSatUiObserver::GetInputL
-// Checks type of the input wanted and whether it should be
-// hidden and calls right method from the CSatUiViewAppUi class.
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-TSatUiResponse CSatUiObserver::GetInputL(
-    const TDesC& aText,
-    const TSatCharacterSet aCharacterSet,
-    TDes& aInput,
-    const TInt aMinLength,
-    const TInt aMaxLength,
-    const TBool aHideInput,
-    const TBool /*aHelpIsAvailable*/,
-    const TSatIconId& aIconId,
-    TBool& aRequestedIconDisplayed)
-    {
-    TFLOGSTRING("SATAPP: CSatUiObserver::GetInput called")
-    TSatUiResponse response(ESatSuccess);
-    aRequestedIconDisplayed = EFalse;
-
-    if (((aCharacterSet == ESatCharSmsDefaultAlphabet) ||
-         (aCharacterSet == ESatCharUcs2Alphabet)) &&
-         (aHideInput))
-        {
-        TFLOGSTRING("SATAPP: CSatUiObserver::GetInput return ESatFailure")
-        return ESatFailure;
-        }
-
-    CFbsBitmap* iconBitmapGetInput = NULL;
-    iActionImplementer->SetCommandPending(ETrue);
-
-    // If icon is available for command
-    if (((ESatSelfExplanatory == aIconId.iIconQualifier) ||
-        (ESatNotSelfExplanatory == aIconId.iIconQualifier)) &&
-        (iIconSupport))
-        {
-        iconBitmapGetInput = FetchIcon(aIconId.iIdentifier, EIconGetInput);
-        GetScalableBitmap(iconBitmapGetInput, EIconGetInput,
-            aRequestedIconDisplayed);
-        }
-
-    TBool selfExplanatory(EFalse);
-
-    // Icon is self-explanatory
-    if (ESatSelfExplanatory == aIconId.iIconQualifier)
-        {
-        selfExplanatory = ETrue;
-        }
-
-    iActionImplementer->DispatchTimer(iWait);
-
-    TUint duration (0);
-    TRAPD(err,
-        response = iActionImplementer->GetInputL(
-            aText, aCharacterSet, aInput, aMinLength, aMaxLength,
-            aHideInput, EFalse, iconBitmapGetInput, selfExplanatory,
-            duration);
-       );
-
-    if ( KErrNone != err )
-        {
-        TFLOGSTRING2("SATAPP: CSatUiObserver::GetInput err:%d", err)
-        response = ESatFailure;
-        aRequestedIconDisplayed = EFalse;
-        }
-
-    if (iActionImplementer->GetEndKey())
-        {
-        response = ESatSessionTerminatedByUser;
-        iActionImplementer->SetEndKey(EFalse);
-        }
-    iActionImplementer->SetCommandPending(EFalse);
-
-    TFLOGSTRING2("SATAPP: CSatUiObserver::GetInput response:%d", response)
-    TFLOGSTRING2("SATAPP: CSatUiObserver::GetInput aRequestedIconDisplayed:%d",
-        aRequestedIconDisplayed)
-    TFLOGSTRING("SATAPP: CSatUiObserver::GetInput exit")
-    return response;
-    }
-
-// ----------------------------------------------------------------------------
-// CSatUiObserver::SetUpMenuL
-// Calls the method from the CSatUiViewAppUi class to show
-// a SetUpMenu view.
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-TSatUiResponse CSatUiObserver::SetUpMenuL(
-    const TDesC& aText,
-    const MDesCArray& aMenuItems,
-    const CArrayFixFlat<TSatAction>* aMenuItemNextActions,
-    const TBool aHelpIsAvailable,
-    const TSatIconId& aIconId,
-    const CArrayFixFlat<TInt>* aMenuIcons,
-    const enum TSatIconQualifier aIconListQualifier,
-    const enum TSatSelectionPreference /*aSelectionPreference*/)
-    {
-    TFLOGSTRING("SATAPP: CSatUiObserver::SetUpMenu called")
-    TSatUiResponse response(ESatSuccess);
-    TBool selfExplanatoryItems(EFalse);
-    CFbsBitmap* iconTitleBitmap = NULL;
-    iActionImplementer->SetCommandPending(ETrue);
-
-    TFLOGSTRING2("SATAPP: CSatUiObserver::SetUpMenu item count: %d",
-     aMenuItems.MdcaCount())
-
-    if (!aMenuItems.MdcaCount() ||
-        (KSatActiveProfileOffline == ProfileState()))
-        {
-        iActionImplementer->SetCommandPending(EFalse);
-        iActionImplementer->ShowNotAvailableNoteL();
-        iActionImplementer->CloseSatUI();
-        return response;
-        }
-
-    //if contextpane icon available for command
-    TFLOGSTRING2("SATAPP: CSatUiObserver::SetUpMenu icon qua: %d",
-     aIconId.iIconQualifier)
-    if (((ESatSelfExplanatory == aIconId.iIconQualifier) ||
-        (ESatNotSelfExplanatory == aIconId.iIconQualifier)) &&
-         (iIconSupport))
-        {
-        iconTitleBitmap = FetchIcon(aIconId.iIdentifier,
-                                     EIconSetUpMenuContext);
-        GetScalableBitmap(iconTitleBitmap, EIconSetUpMenuContext);
-        }
-
-    TInt iconCount(0);
-
-    if (aMenuIcons)
-        {
-        iconCount = aMenuIcons->Count();
-        TFLOGSTRING2("SATAPP: CSatUiObserver::SetUpMenu icon count: %d", iconCount)
-        }
-
-
-    //if icons are available for item list
-    if ((aMenuItems.MdcaCount() == iconCount) &&
-        ((aIconListQualifier == ESatSelfExplanatory) ||
-        (aIconListQualifier == ESatNotSelfExplanatory)) &&
-        (iIconSupport))
-        {
-        TFLOGSTRING("SATAPP: CSatUiObserver::SetUpMenu have icon")
-        if (aIconListQualifier == ESatSelfExplanatory)
-            {
-            selfExplanatoryItems = ETrue;
-            }
-
-        TBool continueLoop(ETrue);
-        TInt count(0);
-        for (count = 0; (count < iconCount) && continueLoop; count++)
-            {
-            CGulIcon* gulIcon = CGulIcon::NewLC();
-            TUint8 itemIconId(STATIC_CAST(TUint8,
-                aMenuIcons->operator[](count)));
-            CFbsBitmap* iconItemBitmap = NULL;
-            iconItemBitmap = FetchIcon(itemIconId, EIconSetUpMenuItems);
-
-            if (!iconItemBitmap &&
-                (ESatSelfExplanatory == aIconListQualifier))
-                {
-                TFLOGSTRING("SATAPP: CSatUiObserver::SetUpMenu \
-                    SelfExplanatory ")
-                CleanupStack::PopAndDestroy(gulIcon); // gulIcon
-                continueLoop = EFalse;
-                }
-            else
-                {
-                if (!iconItemBitmap &&
-                    (ESatNotSelfExplanatory == aIconListQualifier))
-                    {
-                    TFLOGSTRING("SATAPP: CSatUiObserver::SetUpMenu \
-                        not SelfExplanatory ")
-                    iconItemBitmap = new(ELeave)CFbsBitmap();
-                    }
-                else
-                    {
-                    TFLOGSTRING("SATAPP: CSatUiObserver::SetUpMenu \
-                        other conditions ")
-                    GetScalableBitmap(iconItemBitmap, EIconSetUpMenuItems);
-                    }
-
-                gulIcon->SetBitmap(iconItemBitmap);
-                CleanupStack::Pop(gulIcon);
-                }
-            }
-        TFLOGSTRING2("SATAPP: CSatUiObserver::SetUpMenu count: %d", count)
-        }
-
-    TRAPD(err,
-        response = iActionImplementer->SetUpMenuL(
-            aText, aMenuItems, aMenuItemNextActions, iconTitleBitmap,
-            /*iItemIcons,*/ selfExplanatoryItems, aHelpIsAvailable);
-       );
-
-    TFLOGSTRING2("SATAPP: CSatUiObserver::SetUpMenu err: %d", err)
-
-    if (KErrNone != err)
-        {
-        response = ESatFailure;
-        }
-
-    if (iActionImplementer->GetEndKey())
-        {
-        response = ESatSessionTerminatedByUser;
-        iActionImplementer->SetEndKey(EFalse);
-        }
-
-    iActionImplementer->SetCommandPending(EFalse);
-    TFLOGSTRING2("SATAPP: CSatUiObserver::SetUpMenu exit, \
-        return:%i", response)
-    return response;
-    }
-
-// ----------------------------------------------------------------------------
-// CSatUiObserver::SelectItemL
-// Calls the method from the CSatUiViewAppUi class to show
-// a SelectItem view.
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-TSatUiResponse CSatUiObserver::SelectItemL(
-    const TDesC& aText,
-    const MDesCArray& aMenuItems,
-    const CArrayFixFlat<TSatAction>* aMenuItemNextActions,
-    const TInt aDefaultItem,
-    TUint8& aSelection,
-    const TBool aHelpIsAvailable,
-    const TSatIconId& aIconId,
-    const CArrayFixFlat<TInt>* aMenuIcons,
-    const enum TSatIconQualifier aIconListQualifier,
-    TBool& aRequestedIconDisplayed,
-    const enum TSatSelectionPreference /*aSelectionPreference*/)
-    {
-    TFLOGSTRING("SATAPP: CSatUiObserver::SelectItem called")
-    TSatUiResponse response(ESatSuccess);
-    aRequestedIconDisplayed = ETrue;
-    TBool selfExplanatoryItems(EFalse);
-
-    CFbsBitmap* iconTitleBitmap = NULL;
-    iActionImplementer->SetCommandPending(ETrue);
-
-    //if contextpane icon available for command
-    if (((ESatSelfExplanatory == aIconId.iIconQualifier) ||
-        (ESatNotSelfExplanatory == aIconId.iIconQualifier)) &&
-        (iIconSupport))
-        {
-        TFLOGSTRING("SATAPP: CSatUiObserver::SelectItem icon available")
-        iconTitleBitmap = FetchIcon(aIconId.iIdentifier,
-                                     EIconSetUpMenuContext);
-        GetScalableBitmap(iconTitleBitmap, EIconSetUpMenuContext,
-            aRequestedIconDisplayed);
-        }
-
-    TInt iconCount(0);
-
-    if (aMenuIcons)
-        {
-        iconCount = aMenuIcons->Count();
-        }
-
-    TFLOGSTRING2("SATAPP: CSatUiObserver::SelectItem iconCount:%d", iconCount)
-
-    //if icons are available for item list
-    if ((aMenuItems.MdcaCount() == iconCount) &&
-        ((ESatSelfExplanatory == aIconListQualifier) ||
-        (ESatNotSelfExplanatory == aIconListQualifier)) &&
-        (iIconSupport))
-        {
-        TFLOGSTRING(
-            "SATAPP: CSatUiObserver::SelectItem icon available for item list")
-
-        if (ESatSelfExplanatory == aIconListQualifier)
-            {
-            selfExplanatoryItems = ETrue;
-            }
-
-        TBool continueLoop(ETrue);
-        TInt count(0);
-        for (count = 0; (count < iconCount) && continueLoop; count++)
-            {
-            CGulIcon* gulIcon = CGulIcon::NewLC();
-            TUint8 itemIconId = STATIC_CAST(TUint8,
-                aMenuIcons->operator[](count));
-            CFbsBitmap* iconItemBitmap = NULL;
-            iconItemBitmap = FetchIcon(itemIconId, EIconSetUpMenuItems);
-
-            // when icon can't be received and is set to self explanatory, we
-            // iqnore all icons and show only text
-            if (!iconItemBitmap &&
-                (aIconListQualifier == ESatSelfExplanatory))
-                {
-                TFLOGSTRING("SATAPP: CSatUiObserver::SelectItem \
-                    SelfExplanatory ")
-                continueLoop = EFalse;
-                aRequestedIconDisplayed = EFalse;
-                }
-            else
-                {
-                // when icon can't be received and is set to not self
-                // explanatory, we replace it with empty icon
-                if (!iconItemBitmap &&
-                    (ESatNotSelfExplanatory == aIconListQualifier))
-                    {
-                    TFLOGSTRING("SATAPP: CSatUiObserver::SelectItem \
-                        not SelfExplanatory ")
-                    iconItemBitmap = new(ELeave)CFbsBitmap();
-                    aRequestedIconDisplayed = EFalse;
-                    }
-                // when icon was able to receive, we scale it
-                // if every prior icon is correctly received
-                else if (aRequestedIconDisplayed)
-                    {
-                    TFLOGSTRING("SATAPP: CSatUiObserver::SelectItem \
-                        receive icon ")
-                    GetScalableBitmap(iconItemBitmap, EIconSetUpMenuItems,
-                        aRequestedIconDisplayed);
-                    }
-                // if aRequestIconDisplayed is false, at least one prior icon
-                // fetch had problems and thus we must report that by not
-                // updating aRequestedIconDisplayed
-                else
-                    {
-                    TFLOGSTRING("SATAPP: CSatUiObserver::SelectItem \
-                        aRequestIconDisplayed false ")
-                    GetScalableBitmap(iconItemBitmap, EIconSetUpMenuItems);
-                    }
-
-                gulIcon->SetBitmap(iconItemBitmap);
-                CleanupStack::Pop(gulIcon);
-                }
-            }
-        TFLOGSTRING2("SATAPP: CSatUiObserver::SelectItem count: %d", count)
-        }
-
-    TRAPD(err,
-        response = iActionImplementer->SelectItemL(aText, aMenuItems,
-            aMenuItemNextActions, aDefaultItem, aSelection, iconTitleBitmap,
-            /*iItemIcons,*/ selfExplanatoryItems, aHelpIsAvailable);
-       );
-
-    if (KErrNone != err)
-        {
-        response = ESatFailure;
-        aRequestedIconDisplayed = EFalse;
-        }
-
-    if (iActionImplementer->GetEndKey())
-        {
-        response = ESatSessionTerminatedByUser;
-        iActionImplementer->SetEndKey(EFalse);
-        }
-
-    iActionImplementer->SetCommandPending(EFalse);
-
-    TFLOGSTRING2("SATAPP: CSatUiObserver::SelectItem aSelection:%d", aSelection)
-    TFLOGSTRING2("SATAPP: CSatUiObserver::SelectItem response:%d", response)
-    TFLOGSTRING("SATAPP: CSatUiObserver::SelectItem exit")
-    return response;
-    }
-
-// ----------------------------------------------------------------------------
-// CSatUiObserver::PlayTone
-// Checks type of the tone wanted and calls right method
-// from the CSatUiViewAppUi class.
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-TSatUiResponse CSatUiObserver::PlayTone(
-    const TDesC& aText,
-    const TSatTone aTone,
-    const TTimeIntervalMicroSeconds aDuration,
-    const TSatIconId& aIconId,
-    TBool& aRequestedIconDisplayed)
-    {
-    TFLOGSTRING("SATAPP: CSatUiObserver::PlayTone called")
-    TFLOGSTRING2("SATAPP: CSatUiObserver::PlayTone tone is %i", aTone)
-
-    aRequestedIconDisplayed = EFalse;
-
-    iSequence.Zero();
-    TTimeIntervalMicroSeconds duration(aDuration.Int64());
-    iActionImplementer->SetCommandPending(ETrue);
-    // This is used to determine zero length duration.
-    const TTimeIntervalMicroSeconds zeroDuration(static_cast<TInt64>(0));
-
-    CFbsBitmap* iconBitmap = NULL;
-    // If icon is available for command
-    if (((ESatSelfExplanatory == aIconId.iIconQualifier) ||
-         (ESatNotSelfExplanatory == aIconId.iIconQualifier)) &&
-        (iIconSupport))
-        {
-        iconBitmap = FetchIcon(aIconId.iIdentifier, EIconPlayTone);
-        GetScalableBitmap(iconBitmap, EIconPlayTone,
-            aRequestedIconDisplayed);
-        }
-
-    TBool selfExplanatory(EFalse);
-
-    // Icon is self-explanatory
-    if (ESatSelfExplanatory == aIconId.iIconQualifier)
-        {
-        selfExplanatory = ETrue;
-        }
-
-    // Check if the current Profile is Meeting
-    TInt errCR(KErrNone);
-    TInt profileId(0);
-
-    CRepository* repository = NULL;
-    TSatTone tone = aTone;
-
-    // Which UID to monitor.
-    TRAP(errCR, repository = CRepository::NewL(KCRUidProfileEngine));
-
-    if (!errCR && repository)
-        {
-        errCR = repository->StartTransaction(
-            CRepository::EReadWriteTransaction);
-        errCR = repository->Get(KProEngActiveProfile, profileId);
-        }
-
-    delete repository;
-
-    TFLOGSTRING2("SATAPP: CSatUiObserver::PlayTone(): err = %d", errCR)
-
-    TFLOGSTRING2("SCSatUiObserver::PlayTone() profileId: %d",
-        profileId)
-
-    switch (tone)
-        {
-        case ESatGeneralBeep:
-        case ESatPositiveTone:
-        case ESatToneNotSet:
-            if (zeroDuration == duration)
-                {
-                duration = KSatDur170ms; // 170ms
-                }
-            iSequence.Copy(KGeneralBeep);
-            break;
-        case ESatNegativeTone:
-            if (zeroDuration == duration)
-                {
-                duration = KSatDur250ms; // 250ms
-                }
-            iSequence.Copy(KErrorTone);
-            break;
-        case ESatRadioPathNotAvailableCallDropped:
-            if (zeroDuration == duration)
-                {
-                duration = KSatDur1200ms; // 1200ms
-                }
-            iSequence.Copy(KRadioPathNotAvailable);
-            break;
-        case ESatRadioPathAcknowledge:
-            if (zeroDuration == duration)
-                {
-                duration = KSatDur200ms; // 200ms
-                }
-            iSequence.Copy(KRadioPathAck);
-            break;
-        case ESatDialTone:
-            {
-            if (zeroDuration == duration)
-                {
-                TFLOGSTRING("SATAPP: CSatUiObserver::PlayTone() ESatDialTone")
-                return ESatCmdDataNotUnderstood;
-                }
-            else
-                {
-                iSequence.Copy(KNetToneSeqDial);
-                }
-            }
-            break;
-        case ESatCalledSubscriberBusy:
-            {
-            if (zeroDuration == duration)
-                {
-                return ESatCmdDataNotUnderstood;
-                }
-            else
-                {
-                iSequence.Copy(KNetToneSeqNetBusy);
-                }
-            }
-            break;
-        case ESatCongestion:
-            {
-            if (zeroDuration == duration)
-                {
-                return ESatCmdDataNotUnderstood;
-                }
-            else
-                {
-                iSequence.Copy(KNetToneSeqNetCongestion);
-                }
-            }
-            break;
-        case ESatErrorSpecialInfo:
-            {
-            if (zeroDuration == duration)
-                {
-                return ESatCmdDataNotUnderstood;
-                }
-            else
-                {
-                iSequence.Copy(KNetToneSeqNetSpecialInformation);
-                }
-            }
-            break;
-        case ESatCallWaitingTone:
-            {
-            if (zeroDuration == duration)
-                {
-                return ESatCmdDataNotUnderstood;
-                }
-            else
-                {
-                iSequence.Copy(KNetToneSeqNetCallWaiting);
-                }
-            }
-            break;
-        case ESatRingingTone:
-            {
-            if (zeroDuration == duration)
-                {
-                return ESatCmdDataNotUnderstood;
-                }
-            else
-                {
-                iSequence.Copy(KNetToneSeqRingGoing);
-                }
-            }
-            break;
-        case ESatUserSelectedToneIncomingSpeech:
-        case ESatUserSelectedToneIncomingSms:
-            {
-            // These are handled later.
-            }
-            break;
-        default:
-            TFLOGSTRING("SATAPP: CSatUiObserver::PlayTone Default")
-            return ESatCmdDataNotUnderstood;
-        }
-
-    TSatUiResponse response(ESatFailure);
-
-    iActionImplementer->DispatchTimer(iWait);
-
-    // ESatSClearScreenEvent doesn't occur,clear displaytext on screen.
-    if (EFalse == iClearScreenEvent)
-        {
-        // Clear displaytext on the screen.
-        TFLOGSTRING("SATAPP: CSatUiObserver::PlayTone clear screen")
-        iActionImplementer->ClearScreen();
-        }
-
-    if (0 != iSequence.Length())
-        {
-        TFLOGSTRING2("SATAPP: CSatUiObserver::PlayTone duration microseconds %d",
-            aDuration.Int64())
-        TRAPD(err,
-            response = iActionImplementer->PlayStandardToneL(
-                aText,
-                iSequence,
-                duration,
-                iconBitmap,
-                selfExplanatory);
-           );
-
-        if (KErrNone != err)
-            {
-            response = ESatFailure;
-            TFLOGSTRING2("SATAPP: CSatUiObserver::PlayTone error %i", err)
-            }
-        TFLOGSTRING("SATAPP: CSatUiObserver::PlayTone StandardTone exit")
-        }
-    else
-        {
-        TFLOGSTRING("SATAPP: CSatUiObserver::PlayTone length of sequence \
-            is zero")
-
-            TRAPD(err,
-            response = iActionImplementer->PlayUserSelectedToneL(
-                aText,
-                aDuration.Int64(),
-                tone,
-                iconBitmap,
-                selfExplanatory);
-           );
-
-            if (KErrNone != err)
-                {
-                response = ESatFailure;
-                TFLOGSTRING2("SATAPP: CSatUiObserver::PlayTone error %i", err)
-                }
-
-        TFLOGSTRING("SATAPP: CSatUiObserver::PlayTone UserSelectedTone exit")
-        }
-
-    if (iActionImplementer->GetEndKey())
-        {
-        response = ESatSessionTerminatedByUser;
-        iActionImplementer->SetEndKey(EFalse);
-        }
-
-    iActionImplementer->SetCommandPending(EFalse);
-
-    TFLOGSTRING("SATAPP: CSatUiObserver::PlayTone iClearScreenEvent false")
-    iClearScreenEvent = EFalse;
-
-    TFLOGSTRING2("SATAPP: CSatUiObserver::PlayTone response: %d", response)
-    TFLOGSTRING("SATAPP: CSatUiObserver::PlayTone exit")
-    return response;
-    }
-
-// ----------------------------------------------------------------------------
-// CSatUiObserver::ConfirmCommand
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void CSatUiObserver::ConfirmCommand(
-    const TSatSQueryCommand aCommandId,
-    const TSatAlphaIdStatus aAlphaIdStatus,
-    const TDesC& aText,
-    const TDesC& aAdditionalText,
-    TBool& aActionAccepted,
-    const TSatIconId& aIconId,
-    TBool& aRequestedIconDisplayed,
-    TBool& aTerminatedByUser)
-    {
-    TFLOGSTRING("SATAPP: CSatUiObserver::ConfirmCommand calling")
-    aRequestedIconDisplayed = EFalse;
-    TInt error(KErrNone);
-    TBool selfExplanatory(EFalse);
-
-    // Icon is self-explanatory
-    if (ESatSelfExplanatory == aIconId.iIconQualifier)
-        {
-        selfExplanatory = ETrue;
-        }
-
-    aActionAccepted = ETrue;
-
-    iActionImplementer->SetCommandPending(ETrue);
-
-    iActionImplementer->StopShowWaitNote();
-
-    CFbsBitmap* iconBitmap = NULL;
-    // If icon is available for command
-    if ((((ESatSelfExplanatory == aIconId.iIconQualifier) ||
-        (ESatNotSelfExplanatory == aIconId.iIconQualifier)) &&
-        ((ESatOpenChannelQuery == aCommandId) ||
-        (ESatSLaunchBrowserQuery == aCommandId) ||
-        (ESatSSetUpCallQuery == aCommandId))) &&
-        (iIconSupport))
-        {
-        iconBitmap = FetchIcon(aIconId.iIdentifier,
-            EIconConfirmCommand);
-        GetScalableBitmap(iconBitmap, EIconConfirmCommand,
-            aRequestedIconDisplayed);
-        }
-    TFLOGSTRING2("SATAPP: CSatUiObserver::ConfirmCommand aCommandId: %d",
-                  aCommandId)
-    // Check quering command
-    switch (aCommandId)
-        {
-        case ESatOpenChannelQuery:
-            {
-            TFLOGSTRING("Quering OpenChannel")
-            TRAP(error, iActionImplementer->ConfirmOpenChannelL(
-                 aText, aActionAccepted, iconBitmap, selfExplanatory));
-            break;
-            }
-
-        case ESatSRefreshQuery:
-            {
-            TFLOGSTRING("Quering Refresh")
-            //TRAP(error, iActionImplementer->ConfirmRefreshL(aActionAccepted));
-            break;
-            }
-
-        case ESatSLaunchBrowserQuery:
-            {
-            TFLOGSTRING("Quering LaunchBrowser")
-            //HBufC* textHolder = NULL;
-
-            TRAP(error,
-            if (ESatAlphaIdNull != aAlphaIdStatus)
-                {
-                TFLOGSTRING("CSatUiObserver::ConfirmCommand AlphaId \
-                    isn't null")
-                if (ESatAlphaIdNotProvided == aAlphaIdStatus)
-                    {
-                    TFLOGSTRING("CSatUiObserver::ConfirmCommand \
-                        AlphaId not provided")
-                    // ToDo: replace the resouce with qt.
-                    //textHolder = StringLoader::LoadLC(
-                    //    R_QTN_SAT_CONF_LAUNCH_BROW,
-                    //    iActionImplementer->CoeEnv());
-                    }
-                else
-                    {
-                    TFLOGSTRING("CSatUiObserver::ConfirmCommand \
-                        AlphaId provided")
-                    //textHolder = HBufC::NewLC(aText.Length());
-                    //TPtr ptr = textHolder->Des();
-                    //ptr.Append(aText);
-                    }
-                
-                //TRAP(error, iActionImplementer->ConfirmLaunchBrowserL(*textHolder,
-                //    aActionAccepted, iconBitmap, selfExplanatory));
- 
-                // Clean textHolder
-                //CleanupStack::PopAndDestroy(textHolder);
-                }
-
-           ); // TRAP
-            break;
-            }
-
-        case ESatSSendSmQuery:
-            {
-            TFLOGSTRING( "Quering SendSm" )
-            TRAP( error, iActionImplementer->ConfirmSendL( aText,
-                  aActionAccepted, ESatUiConfirmSendSms ) );
-            break;
-            }
-
-        case ESatSSendSsQuery:
-            {
-            TFLOGSTRING(" Quering SendSs")
-            TRAP(error, iActionImplementer->ConfirmSendL(aText,
-                  aActionAccepted, ESatUiConfirmSendSs));
-            break;
-            }
-
-        case ESatSSendUssdQuery:
-            {
-            TFLOGSTRING(" Quering SendUssd")
-            TRAP(error, iActionImplementer->ConfirmSendL(aText,
-                  aActionAccepted, ESatUiConfirmSendUssd));
-            break;
-            }
-
-        case ESatSSetUpCallQuery:
-            {
-            TFLOGSTRING(" Quering SetUpCall")
-            TRAP(error, iActionImplementer->ConfirmSetUpCallL(
-                aText, aAdditionalText, aActionAccepted, iconBitmap,
-                selfExplanatory));
-            break;
-            }
-
-        default:
-            {
-            TFLOGSTRING(" Unknown quering command")
-            aActionAccepted = EFalse;
-            }
-        }
-
-    if (KErrNone != error)
-        {
-        TFLOGSTRING2("SATAPP: CSatUiObserver::ConfirmCommand error:%d", error)
-        aActionAccepted = EFalse;
-        }
-    else if (iActionImplementer->GetEndKey())
-        {
-        TFLOGSTRING("SATAPP: CSatUiObserver::ConfirmCommand press endkey")
-        aTerminatedByUser = ETrue;
-        aActionAccepted = EFalse;
-        iActionImplementer->SetEndKey(EFalse);
-        }
-
-    iActionImplementer->SetCommandPending(EFalse);
-    TFLOGSTRING("SATAPP: CSatUiObserver::ConfirmCommand exiting")
-    }
-
-// ----------------------------------------------------------------------------
-// CSatUiObserver::Notification
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-TSatUiResponse CSatUiObserver::Notification(
-    const TSatSNotifyCommand aCommandId,
-    const TSatAlphaIdStatus aAlphaIdStatus,
-    const TDesC& aText,
-    const TSatIconId& aIconId,
-    TBool& aRequestedIconDisplayed,
-    const TSatControlResult aControlResult)
-    {
-    TFLOGSTRING("SATAPP: CSatUiObserver::Notification calling")
-    TFLOGSTRING2("SATAPP: CSatUiObserver::Notification str=%S", &aText)
-    TSatUiResponse response = ESatSuccess;
-    TInt error(KErrNone);
-    aRequestedIconDisplayed = EFalse;
-    iActionImplementer->SetCommandPending(ETrue);
-
-    HBufC* textHolder = NULL;
-    QString resource;
-    // In case where command id is SendDtmf and alphaID is not provided,
-    // DTMF string to be sent is shown in dialog along with default text.
-    if ((ESatSSendDtmfNotify == aCommandId) &&
-         (ESatAlphaIdNotProvided == aAlphaIdStatus)) {
-        TFLOGSTRING("SATAPP: CSatUiObserver::Notification SendDtmf")
-        DefaultAlphaId(aCommandId, aControlResult,resource);
-        if ( resource.length()>0) 
-            {
-            TFLOGSTRING("SATAPP: CSatUiObserver::Notification SendDtmf resource")
-            TRAP(error, textHolder = HBufC::NewL(resource.length()));
-            if (KErrNone == error) 
-                {
-                textHolder->Des().Copy(reinterpret_cast<const TUint16*>
-                     (resource.utf16()));
-                }
-            }
-        }
-    // Get default text, if alpha not provided or it is NULL
-    else if (aText.Length() == 0 && ESatAlphaIdNotNull != aAlphaIdStatus)
-        {
-        TFLOGSTRING("SATAPP: CSatUiObserver::Notification alpha is null")
-        DefaultAlphaId(aCommandId, aControlResult,resource);
-        if ( resource.length()>0) 
-            {
-            TFLOGSTRING("SATAPP: CSatUiObserver::Notification alpha null resource")
-            TRAP( error, textHolder = HBufC::NewL(resource.length()) );
-            if (KErrNone == error) 
-                {
-                textHolder->Des().Copy(reinterpret_cast<const TUint16*>
-                    (resource.utf16()));
-                }
-             }
-        TFLOGSTRING("SATAPP: CSatUiObserver::Notification alpha is null out")
-        }
-    // else use given text
-    else
-        {
-        TFLOGSTRING("SATAPP: CSatUiObserver::Notification alpha is provided")
-        TRAP(error,
-            textHolder = HBufC::NewL(aText.Length());
-            TPtr ptr = textHolder->Des();
-            ptr.Copy(aText);
-           );
-        }
-    if (!textHolder)
-        {
-         TFLOGSTRING("SATAPP: CSatUiObserver::Notification textHolder 0")
-        TRAP(error, textHolder = HBufC::NewL(0));
-        }
-
-    // No need to add textHolder into CleanupStack, since this is
-    // not a leaving function
-
-    if ((KErrNone == error) && textHolder)
-        {
-        TFLOGSTRING("SATAPP: CSatUiObserver::Notification none error ")
-        CFbsBitmap* iconBitmap = NULL;
-        TBool selfExplanatoryIcon(EFalse);
-        // Fetch icon
-        // Icons not supported for sending and receiving data
-        if ((((ESatSelfExplanatory == aIconId.iIconQualifier) ||
-            (ESatNotSelfExplanatory == aIconId.iIconQualifier)) &&
-            ((ESatSSendDataNotify != aCommandId) &&
-            (ESatSReceiveDataNotify != aCommandId))) &&
-            (iIconSupport))
-            {
-            iconBitmap = FetchIcon(aIconId.iIdentifier,
-                EIconNotification);
-            }
-
-        if (ESatSelfExplanatory == aIconId.iIconQualifier)
-            {
-            selfExplanatoryIcon = ETrue;
-            }
-
-        // Check notifying command
-        switch (aCommandId)
-            {
-            case ESatSSendDataNotify:
-                {
-                TFLOGSTRING(" Notifying SendData")
-                TRAP(error,
-                    iActionImplementer->ShowBIPNoteL(
-                        ESendDataIdentier, *textHolder, iconBitmap,
-                        selfExplanatoryIcon)
-                   );
-                break;
-                }
-            case ESatSReceiveDataNotify:
-                {
-                TFLOGSTRING(" Notifying ReceiveData")
-                TRAP(error,
-                    iActionImplementer->ShowBIPNoteL(
-                        EReceiveDataIdentifier, *textHolder, iconBitmap,
-                        selfExplanatoryIcon)
-                   );
-                break;
-                }
-            case ESatSCloseChannelNotify:
-                {
-                TFLOGSTRING(" Notifying CloseChannel")
-                iActionImplementer->StopShowWaitNote();
-                TRAP(error,
-                    iActionImplementer->ShowBIPNoteL(
-                        ECloseChannelIdentifier, *textHolder, iconBitmap,
-                        selfExplanatoryIcon)
-                   );
-                break;
-                }
-            case ESatSMoSmControlNotify:
-                {
-                TFLOGSTRING(" Notifying MoSmControl")
-                TRAP(error,
-                    iActionImplementer->MoSmControlL(
-                        *textHolder, aAlphaIdStatus)
-                   );
-                iActionImplementer->SetCommandPending(EFalse);
-                break;
-                }
-            case ESatSCallControlNotify:
-                {
-                TFLOGSTRING(" Notifying CallControl")
-                iActionImplementer->DispatchTimer(iWait);
-                TRAP(error,
-                     iActionImplementer->CallControlL(
-                         *textHolder, aAlphaIdStatus)
-                     );
-                iActionImplementer->SetCommandPending(EFalse);
-                break;
-                }
-            case ESatSSendUssdNotify:   // fall through
-            case ESatSSendSsNotify:
-                {
-                TFLOGSTRING(" Notifying SendSs / SendUssd")
-                iActionImplementer->StopShowWaitNote();
-                TRAP(error,
-                    if ((ESatAlphaIdNotNull == aAlphaIdStatus) ||
-                        (ESatAlphaIdNotProvided == aAlphaIdStatus))
-                        {
-                        iActionImplementer->ShowSsWaitNoteL(*textHolder,
-                            iconBitmap, selfExplanatoryIcon);
-                        }
-                    else
-                        {
-                        iActionImplementer->ShowWaitNoteWithoutDelayL();
-                        }
-                   );
-                break;
-                }
-            case ESatSSendDtmfNotify:
-                {
-                TFLOGSTRING(" Notifying SendDtmf")
-                iActionImplementer->StopShowWaitNote();
-                TRAP(error, response = iActionImplementer->ShowDtmfWaitNoteL(
-                    *textHolder, iconBitmap, selfExplanatoryIcon));
-                break;
-                }
-            case ESatSSendSmsNotify:
-                {
-                TFLOGSTRING(" Notifying SendSms")
-                iActionImplementer->StopShowWaitNote();
-
-                if (KErrNone == error)
-                    {
-                    // Show Sms wait note
-                    TRAP(error,
-                        iActionImplementer->ShowSmsWaitNoteL(*textHolder,
-                            iconBitmap, selfExplanatoryIcon));
-                    }
-                break;
-                }
-            default:
-                {
-                TFLOGSTRING(" Unkown notification")
-                response = ESatFailure;
-                break;
-                }
-            }
-        }
-
-    delete textHolder;
-    textHolder = NULL;
-
-    if (KErrNone != error)
-        {
-        TFLOGSTRING2("SATAPP: CSatUiObserver::Notification error:%d", error)
-        response = ESatFailure;
-        }
-    else if (iActionImplementer->GetEndKey())
-        {
-        TFLOGSTRING("SATAPP: CSatUiObserver::Notification terminated by user")
-        response = ESatSessionTerminatedByUser;
-        iActionImplementer->SetEndKey(EFalse);
-        }
-    else
-        {
-        TFLOGSTRING("SATAPP: CSatUiObserver::Notification success")
-        response = ESatSuccess;
-        }
-
-    TFLOGSTRING2("SATAPP: CSatUiObserver::Notification exiting, return: %d", \
-        response)
-    return response;
-    }
-
-// ------------------------------------------------------------------------------------------------
-// CSatUiObserver::EventNotification
-// (other items were commented in a header).
-// ------------------------------------------------------------------------------------------------
-//
-void CSatUiObserver::EventNotification(
-    const TSatSEvent aEventId,
-    const TSatSEventStatus /*aEventStatus*/,
-    const TInt /*aError*/)
-    {
-    TFLOGSTRING("SATAPP: CSatUiObserver::EventNotification calling")
-
-    iActionImplementer->SetCommandPending(EFalse);
-    switch (aEventId)
-        {
-        case ESatSSmEndEvent:
-            {
-            TFLOGSTRING(" SmsEnd event")
-            iActionImplementer->StopShowWaitNote();
-            break;
-            }
-        case ESatSClearScreenEvent:
-            {
-            TFLOGSTRING(" ClearScreen event")
-            iClearScreenEvent = ETrue;
-            iActionImplementer->ClearScreen();
-            break;
-            }
-        case ESatSsEndEvent:
-            {
-            TFLOGSTRING(" Ss end event")
-            iActionImplementer->StopShowWaitNote();
-            break;
-            }
-        case ESatSsErrorEvent:
-            {
-            TFLOGSTRING(" Notifying Ss error")
-            // If error occurred (and Alpha ID provided), notify user
-            TRAPD(err, iActionImplementer->ShowSsErrorNoteL())
-
-            if (err)
-                {
-                TFLOGSTRING(" Error Note could not be created!")
-                }
-            break;
-            }
-        case ESatSDtmfEndEvent:
-            {
-            TFLOGSTRING(" DTMF End event")
-            iActionImplementer->StopShowWaitNote();
-            break;
-            }
-        case ESatSCloseSatUiAppEvent:
-            {
-            TFLOGSTRING(" Close UI event")
-            // Handle this similar way when End key is used
-            if (KSatActiveProfileOffline == ProfileState())
-                {
-                iActionImplementer->SetEndKey(ETrue);
-                TRAP_IGNORE(iActionImplementer->ShowNotAvailableNoteL())
-                }
-            iActionImplementer->CloseSatUI();
-            break;
-            }
-        default:
-            {
-            TFLOGSTRING2(" Unknown event occured: %i", aEventId)
-            break;
-            }
-        }
-
-    TFLOGSTRING("SATAPP: CSatUiObserver::EventNotification exiting")
-    }
-
-// ----------------------------------------------------------------------------
-// CSatUiObserver::DefaultAlphaId
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void CSatUiObserver::DefaultAlphaId(
-    const TSatSNotifyCommand aCommandId,
-    const TSatControlResult aControlResult, QString &resource) const
-    {
-    TFLOGSTRING("SATAPP: CSatUiObserver::DefaultAlphaId calling")
-    switch (aCommandId)
-        {
-        case ESatSSendDataNotify: // SendData
-            {
-            TFLOGSTRING("SendData default")
-            resource = hbTrId("txt_sat_conf_send_data_bip");
-            break;
-            }
-        case ESatSReceiveDataNotify: // ReceiveData
-            {
-            TFLOGSTRING("ReceiveData default")
-            resource = hbTrId("txt_sat_conf_receive_data_bip");
-            break;
-            }
-        case ESatSCloseChannelNotify: // CloseChannel
-            {
-            TFLOGSTRING("CloseChannel default")
-            resource = hbTrId("txt_sat_conf_close_channel_bip");
-            break;
-            }
-        case ESatSMoSmControlNotify: // MoSmControl
-            {
-            if (ESatNotAllowed == aControlResult)
-                {
-                TFLOGSTRING(" MoSmcontrol Not allowed default")
-                resource = hbTrId("txt_sat_mosm_not_allowed");
-                }
-            else if (ESatAllowedWithModifications == aControlResult)
-                {
-                TFLOGSTRING(" MoSmcontrol Modified default")
-                resource = hbTrId("txt_sat_request_modified");
-                }
-            else
-                {
-                TFLOGSTRING(" MoSmcontrol No default")
-                resource = hbTrId(""); // Allowed, default alpha -> no info
-                }
-            break;
-            }
-        case ESatSCallControlNotify: // CallControl
-            {
-            if (ESatNotAllowed == aControlResult)
-                {
-                TFLOGSTRING("CallControl Not allowed default")
-                resource = hbTrId("txt_sat_cc_not_allowed");
-                }
-            else if (ESatAllowedWithModifications == aControlResult)
-                {
-                TFLOGSTRING("CallControl Modified default")
-                resource = hbTrId("txt_sat_cc_modified");
-                }
-            else
-                {
-                TFLOGSTRING("CallControl No default")
-                resource = hbTrId(""); // Allowed, default alpha -> no info
-                }
-            break;
-            }
-        case ESatSSendSmsNotify: // SendSm
-            {
-            TFLOGSTRING(" SendSms default")
-            resource = hbTrId("txt_sat_sending_sms");
-            break;
-            }
-
-        case ESatSSendDtmfNotify: // SendDtmf
-            {
-            TFLOGSTRING(" SendDTMF default")
-            resource = hbTrId("txt_sat_note_sending_dtmf_template");
-            break;
-            }
-        default:
-            {
-            TFLOGSTRING2(" Unknown command id: %i", aCommandId)
-            break;
-            }
-        }
-
-    TFLOGSTRING("SATAPP: CSatUiObserver::DefaultAlphaId exiting")
-    }
-
-// ----------------------------------------------------------------------------
-// CSatUiObserver::FetchIcon
-// Fetch the icon information.
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-CFbsBitmap* CSatUiObserver::FetchIcon(const TUint8 /*aIconId*/,
-    const enum TIconCommand /*aIconCommand*/)
-    {
-    TFLOGSTRING("SATAPP: CSatUiObserver::FetchIcon called")
-
-    CFbsBitmap* iconBitmap = NULL;
-    TFLOGSTRING("SATAPP: CSatUiObserver::FetchIcon exit")
-    return iconBitmap;
-    }
-
-// ----------------------------------------------------------------------------
-// CSatUiObserver::GetPopUpWindowIconSize
-// Get size for the icon in popup window.
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-TBool CSatUiObserver::GetPopUpWindowIconSize(TSize& /*aSize*/,
-    const TIconCommand /*aIconCommand*/)
-    {
-    TFLOGSTRING("SATAPP: CSatUiObserver::GetPopUpWindowIconSize called")
-    return ETrue;
-    }
-
-// ----------------------------------------------------------------------------
-// CSatUiObserver::GetScalableBitmap
-// Creates scalable bitmap
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void CSatUiObserver::GetScalableBitmapL(
-    CFbsBitmap*& /*aBitMapToConvert*/,
-    const TIconCommand  /*aIconCommand*/)
-    {
-    TFLOGSTRING("SATAPP: CSatUiObserver::GetScalableBitmap called")
-    TFLOGSTRING("SATAPP: CSatUiObserver::GetScalableBitmap exit")
-    }
-
-// ----------------------------------------------------------------------------
-// CSatUiObserver::GetScalableBitmap
-// Handles scalable bitmap
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void CSatUiObserver::GetScalableBitmap(
-    CFbsBitmap*& /*aBitMapToConvert*/,
-    const TIconCommand  /*aIconCommand*/,
-    TBool& /*aRequestedIconDisplayed*/)
-    {
-    TFLOGSTRING("SATAPP: CSatUiObserver::GetScalableBitmap called")
-    TFLOGSTRING("SATAPP: CSatUiObserver::GetScalableBitmap exit")
-    }
-
-// ----------------------------------------------------------------------------
-// CSatUiObserver::GetScalableBitmap
-// Handles scalable bitmap
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void CSatUiObserver::GetScalableBitmap(
-    CFbsBitmap*& /*aBitMapToConvert*/,
-    const TIconCommand /*aIconCommand*/)
-    {
-    TFLOGSTRING("SATAPP: CSatUiObserver::GetScalableBitmap called")
-    TFLOGSTRING("SATAPP: CSatUiObserver::GetScalableBitmap exit")
-    }
-
-// ----------------------------------------------------------------------------
-// CSatUiObserver::ProfileState
-// Get the profile status
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-TInt CSatUiObserver::ProfileState()
-    {
-    TFLOGSTRING("SATAPP: CSatUiObserver::ProfileState called")
-    TInt profileId(0);
-    CRepository* cr (NULL);
-
-    TRAPD(err, cr = CRepository::NewL(KCRUidProfileEngine));
-    if ((KErrNone == err) && cr)
-        {
-        TFLOGSTRING("SATAPP: CSatUiObserver::ProfileState no err")
-        // Get the ID of the currently active profile:
-        cr->Get(KProEngActiveProfile, profileId);
-        delete cr;
-        }
-    else
-        {
-        TFLOGSTRING2("SATAPP: CSatUiObserver::ProfileState CR failed: %i", err)
-        }
-
-    TFLOGSTRING2("SATAPP: CSatUiObserver::ProfileState exit value: %d",
-        profileId)
-
-    return profileId;
-    }
-
-// ----------------------------------------------------------------------------
-// CSatUiObserver::ConnectRSatSessionL
-//
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void CSatUiObserver::ConnectRSatSessionL()
-    {
-    TFLOGSTRING("SATAPP: CSatUiObserver::ConnectRSatSessionL called")
-    //Register to Server as subsession
-    //If Server is not up, this function call may take time
-    iSatSession.ConnectL();
-    iSat.RegisterL(iSatSession, this);
-    iAdapter = iSat.Adapter();
-    if (!iAdapter)
-        {
-        User::Leave(KErrNotFound);
-        }
-    TFLOGSTRING("SATAPP: CSatUiObserver::ConnectRSatSessionL exit")
-    }
-
-// ----------------------------------------------------------------------------
-// CSatUiObserver::DisconnectRSatSession
-// Get the profile status
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void CSatUiObserver::DisconnectRSatSession()
-    {
-    TFLOGSTRING("SATAPP: CSatUiObserver::DisconnectRSatSession called")
-    iSat.Close();
-    iSatSession.Close();
-    TFLOGSTRING("SATAPP: CSatUiObserver::DisconnectRSatSession exit")
-    }
-
-//  End of File
--- a/satui/satapp/src/dialogwaiter.cpp	Tue Jul 06 14:53:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
-* 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: dialog waiter
-*
-*
-*/
-
-#include "dialogwaiter.h"
-
-HbAction* DialogWaiter::wait()
-{
-    mLoop.exec();
-    HbAction* a=mResult;
-    mResult=0;
-    return a;
-}
-
-void DialogWaiter::done(HbAction* result)
-{
-    mResult=result;
-    mLoop.quit();
-}
-
--- a/satui/satapp/src/main.cpp	Tue Jul 06 14:53:02 2010 +0300
+++ b/satui/satapp/src/main.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -11,41 +11,68 @@
 *
 * Contributors:
 *
-* Description:
+* Description: satapp main
 *
 *
 */
 
+#include <QtGlobal>
 #include <QApplication>
 #include <QTranslator>
 #include <hbapplication.h>
 #include <hbmainwindow.h>
+#include "satappmainhandler.h"
 
-#include "satappmainhandler.h"
-#include "tflogger.h"
 
+#ifdef SAT_DEBUG_TO_FILE
+    // ------------------------------------------------------------
+    // this segment provides functionality that copies all QT debug
+    // output to RFileLogger, and also the standard QT debug stream
+    #include <flogger.h>
+    #include <e32svr.h>
+    _LIT(KTfLogFolder, "sat");
+    _LIT(KTfLogFile, "satui.txt");
+    // original message handler
+    QtMsgHandler originalMsgHandler;
+    // debug redirection function
+    void qDebugToRFileLogger(QtMsgType type, const char *msg)
+    {
+        TPtrC8 symbian_msg((const TUint8*)msg);
+        RFileLogger::Write(KTfLogFolder,KTfLogFile,
+            EFileLoggingModeAppend,symbian_msg);
+        if (originalMsgHandler) originalMsgHandler(type,msg);
+    }
+    // ------------------------------------------------------------
+#endif
+
+
+    
 int main(int argc, char *argv[])
 {
-    TFLOGSTRING("SATAPP: main")
+#ifdef SAT_DEBUG_TO_FILE
+    originalMsgHandler = qInstallMsgHandler(qDebugToRFileLogger);
+#endif
+
+    qDebug("SATAPP: main");
 
     HbApplication app(argc, argv);
-    TFLOGSTRING("SATAPP: main app created")
+    qDebug("SATAPP: main app created");
     
     QTranslator translator;
-    bool ok = translator.load(":/translations/satapp_en");
-    TFLOGSTRING2("SATUI: main, translation %d (1=OK, 0=fail)", ok )
+    bool ok = translator.load(":/translations/satapp");
+    qDebug("SATUI: main, translation %d (1=OK, 0=fail)", ok );
     app.installTranslator(&translator);
 
     HbMainWindow window;
-    TFLOGSTRING("SATAPP: main window created")
+    qDebug("SATAPP: main window created");
 
     SatAppMainHandler *mainHandler = new SatAppMainHandler(window);
-        
+
     window.show();
-    TFLOGSTRING("SATAPP: main view showed")
+    qDebug("SATAPP: main view showed");
 
     int result = app.exec();
-    TFLOGSTRING2("SATAPP: main exit %d", result)
+    qDebug("SATAPP: main exit %d", result);
 
     delete mainHandler;
     return result;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satui/satapp/src/satappaction.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,200 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*
+*/
+
+#include <QEventLoop>
+#include <QCoreApplication>
+#include <QVariant>
+#include <QStringList>
+#include <QtDebug>
+
+#include "satappaction.h"
+
+// ----------------------------------------------------------------------------
+// global des2str
+// trasmit from symbian descripter to QString
+// ----------------------------------------------------------------------------
+//
+QString des2str(const TDesC& desc)
+{
+    return QString::fromUtf16(desc.Ptr(), desc.Length());
+}
+
+// ======== MEMBER FUNCTIONS ==================================================
+
+// ----------------------------------------------------------------------------
+// SatAppAction::SatAppAction
+// ----------------------------------------------------------------------------
+//
+SatAppAction::SatAppAction(int action, QObject *parent)
+: QObject(parent)
+{
+    qDebug("SATAPP: SatAppAction::SatAppAction");
+    mAction = action;
+    mResponse = ESatNoResponseFromUser;
+	mState = Active;
+    
+    //monitor application
+    SAT_ASSERT(connect(
+        qApp,SIGNAL(aboutToQuit()),
+        this,SLOT(completeWithSessionTerminated())));
+}
+
+// ----------------------------------------------------------------------------
+// SatAppAction::~SatAppAction
+// ----------------------------------------------------------------------------
+//
+SatAppAction::~SatAppAction()
+{
+    if (mState==Waiting)
+        complete(); // release waiting thread
+}
+
+// ----------------------------------------------------------------------------
+// SatAppAction::waitUntilCompleted
+// sync method that returns when this action is completed
+// ----------------------------------------------------------------------------
+//
+void SatAppAction::waitUntilCompleted()
+{
+    qDebug("SATAPP: SatAppAction::waitUntilCompleted");
+    if (mState==Completed) return; // no need to wait!
+    QEventLoop loop;
+    SAT_ASSERT(connect(
+        this,SIGNAL(actionCompleted(SatAppAction*)),
+        &loop,SLOT(quit())));
+    mState=Waiting;
+    qDebug("SATAPP: waitUntilCompleted: waiting...");
+    loop.exec();
+    qDebug("SATAPP: waitUntilCompleted: ...released");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppAction::complete
+// completes the action
+// ----------------------------------------------------------------------------
+//
+void SatAppAction::complete(TSatUiResponse resp)
+{
+    qDebug("SATAPP: SatAppAction::complete resp= %x in", resp);
+    if (mState!=Completed) {
+        qDebug("SATAPP: SatAppAction::completed");
+        setResponse(resp);
+        mState = Completed;
+        emit actionCompleted(this);
+    }
+    qDebug("SATAPP: SatAppAction::complete resp= %x out", resp);
+}
+
+// ----------------------------------------------------------------------------
+// SatAppAction::set
+// setter for QVariant
+// ----------------------------------------------------------------------------
+//
+void SatAppAction::set(const QString& key, QVariant value)
+{
+    qDebug() << "SATAPP: SatAppAction::set(" <<
+        key << "=" << value << ")";
+    mParams[key] = value;
+}
+
+// ----------------------------------------------------------------------------
+// SatAppAction::set
+// setter for Symbian Descripter
+// ----------------------------------------------------------------------------
+//
+void SatAppAction::set(const QString& key, const TDesC& value)
+{
+    set(key,des2str(value));
+}
+
+// ----------------------------------------------------------------------------
+// SatAppAction::set
+// setter for Symbian MDesCArray - Menu list
+// ----------------------------------------------------------------------------
+//
+void SatAppAction::set(const QString& key, const MDesCArray& value)
+{
+    QList<QVariant> list;
+    for(int i=0; i<value.MdcaCount(); ++i)
+        list.append(des2str(value.MdcaPoint(i)));
+    set(key,list);
+}
+
+// ----------------------------------------------------------------------------
+// SatAppAction::set
+// setter for CArrayFixFlat<TInt> - mene icon
+// ----------------------------------------------------------------------------
+//
+void SatAppAction::set(const QString& key, CArrayFixFlat<TInt>& value)
+{
+    QList<QVariant> list;
+    for(int i=0; i<value.Count(); ++i)
+        list.append(value[i]);
+    set(key,list);
+}
+
+// ----------------------------------------------------------------------------
+// SatAppAction::set
+// setter for TTimeIntervalSeconds - duration
+// ----------------------------------------------------------------------------
+//
+void SatAppAction::set(const QString& key, TTimeIntervalSeconds& value)
+{
+    int value_millisec = value.Int() * 1000; // sec->millisec
+    set(key,value_millisec);
+}
+
+// ----------------------------------------------------------------------------
+// SatAppAction::set
+// setter for TTimeIntervalMicroSeconds - duration
+// ----------------------------------------------------------------------------
+//
+void SatAppAction::set(const QString& key, TTimeIntervalMicroSeconds& value)
+{
+    int value_millisec = value.Int64() / 1000; // microsec->millisec
+    set(key,value_millisec);
+}
+
+// ----------------------------------------------------------------------------
+// SatAppAction::value
+// getter by key
+// ----------------------------------------------------------------------------
+//
+QVariant SatAppAction::value(const QString& key)
+{
+    if (!mParams.contains(key))
+    {
+        // lazy-fetch params implementation goes here.
+        // for instance if Icon is requested, request for the icons here.
+        // however at this moment, all parameters should be present.
+        qFatal("SATAPP: SatAppAction::value - param missing: %s",
+            key.toLatin1().data());
+    }
+    return mParams[key];
+}
+
+// ----------------------------------------------------------------------------
+// SatAppAction::hasValue
+// ----------------------------------------------------------------------------
+//
+bool SatAppAction::hasValue(const QString& key)
+{
+    return mParams.contains(key);
+}
+
+//End of file
--- a/satui/satapp/src/satappcommandhandler.cpp	Tue Jul 06 14:53:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,571 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include <QTime>
-#include "satappcommandhandler.h"
-#include "tflogger.h"
-#include "satappcommonconstant.h"
-#include "satappuiprovider.h"
-
-// ----------------------------------------------------------------------------
-// SatAppCommandHandler::DisplayText
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-SatAppCommandHandler::SatAppCommandHandler(SatAppUiProvider &ui, 
-    QObject *parent) : QObject(parent), mUi(ui)
-{
-    TFLOGSTRING("SATAPP: SatAppCommandHandler::SatAppCommandHandler call-exit")
-}
-
-// ----------------------------------------------------------------------------
-// SatAppCommandHandler::~SatAppCommandHandler
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-SatAppCommandHandler::~SatAppCommandHandler()
-{
-
-}
-
-// ----------------------------------------------------------------------------
-// SatAppCommandHandler::setUpMenu
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void SatAppCommandHandler::setUpMenu(
-    TSatUiResponse &aRes,
-    const QString &aText,
-    const QStringList &aMenuItems,
-    //const CArrayFixFlat<TSatAction>* aMenuItemNextActions,
-    //const HbIcon &aIcon,
-    //const CAknIconArray* aItemIconsArray,
-    const bool aSelfExplanatoryItems,
-    const bool aHelpIsAvailable)
-{
-    TFLOGSTRING("SATAPP: SatAppCommandHandler::setUpMenu call")
-    mUi.showSetUpMenuView(aRes, aText, aMenuItems, 
-            aSelfExplanatoryItems, aHelpIsAvailable);
-    TFLOGSTRING("SATAPP: SatAppCommandHandler::setUpMenu exit")
-}
-
-// ----------------------------------------------------------------------------
-// SatAppCommandHandler::selectItem
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void SatAppCommandHandler::selectItem(
-    TSatUiResponse &aRes,
-    const QString &aText,
-    const QStringList &aMenuItems,
-    //const CArrayFixFlat<TSatAction>* aMenuItemNextActions,
-    const int aDefaultItem,
-    unsigned char &aSelection,
-    //const HbIcon &aIcon,
-    //const CAknIconArray* aItemsIconArray,
-    const bool aSelfExplanatoryItems,
-    const bool aHelpIsAvailable)
-{
-    TFLOGSTRING("SATAPP: SatAppCommandHandler::selectItem call")
-    mUi.showSelectItemView(aRes, aText, aMenuItems, aDefaultItem, aSelection,
-            aSelfExplanatoryItems, aHelpIsAvailable);
-    TFLOGSTRING("SATAPP: SatAppCommandHandler::selectItem exit")
-}
-
-// ----------------------------------------------------------------------------
-// SatAppCommandHandler::displayText
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void SatAppCommandHandler::displayText(TSatUiResponse &aRes,
-                       const QString &aText,
-                       const QString &aSimApplicationName,
-                        //      const HbIcon &aIcon,
-                       bool &/*aRequestedIconDisplayed*/,
-                       const bool aSustainedText,
-                       const int aDuration,
-                       const bool aWaitUserToClear)
-{
-    TFLOGSTRING("SATAPP: SatAppCommandHandler::displayText call")
-
-    aRes = ESatSuccess;
-    QString heading;
-    if (!aSimApplicationName.isEmpty()) {
-        heading.append(aSimApplicationName);
-    } else {
-        heading.append(hbTrId("txt_sat_application_name"));
-    }
-
-    // set time
-    int duration(0);
-
-    if (!aDuration) {
-        TFLOGSTRING(
-        "SATAPP: SatAppCommandHandler::displayText duration not given")
-        duration = KDisplayTxtDefaultduration;
-        if (aWaitUserToClear) {
-            TFLOGSTRING(
-            "SATAPP: SatAppCommandHandler::displayText wait user to clear")
-            duration = KDisplayTxtUserClearTimeout;
-        }
-    } else {
-        TFLOGSTRING(
-        "SATAPP: SatAppCommandHandler::displayText duration given")
-        duration = aDuration * 1000;
-    }
- 
-    // If not sustained or Clear after delay requested start timer
-    if ( !(!aSustainedText || aDuration || !aWaitUserToClear) ){
-        TFLOGSTRING(
-        "SATAPP: SatAppCommandHandler::displayText no duration")
-        duration = 0;
-    }
- 
-    TFLOGSTRING2(
-    "SATAPP: SatAppCommandHandler::displayText duration: %d", 
-    duration)
-    TSatAppUserResponse rsp = EUserNoResponse;
-    rsp = mUi.showDisplayTextPopup(heading, aText, duration);
-
-    // If user is not expected to clear message used response is success
-    if (aWaitUserToClear && !aSustainedText) {
-        // User press ok key
-        if (EUserPrimaryResponse == rsp || 
-            EUserClearResponse == rsp){
-            aRes = ESatSuccess;
-            TFLOGSTRING(
-            "SATAPP: SatAppCommandHandler::DisplayText successful response")
-        } else if (EUserSecondaryResponse == rsp) {
-                // User press back key
-                aRes = ESatBackwardModeRequestedByUser;
-        } else {
-            TFLOGSTRING(
-            "SATAPP: SatAppCommandHandler::DisplayText no user response")
-            // User did not close the text, closed by the timer or MT call
-            aRes = ESatNoResponseFromUser;
-        }
-    }
-
-    // request to close by the server
-    if (EUserCloseResponse == rsp) {
-        aRes = ESatSessionTerminatedByUser;
-    }
-
-    // to do
-    //End key by user ESatSessionTerminatedByUser
-    //rsp = EUserNoResponse;
-    TFLOGSTRING("SATAPP: SatAppCommandHandler::displayText exit")
-}
-
-// ----------------------------------------------------------------------------
-// SatAppCommandHandler::getInkey
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void SatAppCommandHandler::getInkey(TSatUiResponse &aRes,
-                                const QString &aTitleText,
-                                const TSatCharacterSet aCharacterSet,
-                                QString &aInputText,
-                                //const QPixmap* /*aIconBitmapGetInput*/,
-                                const bool /*aSelfExplanatory*/,
-                                unsigned int &aDuration)
-{
-    TFLOGSTRING("SATAPP: SatAppCommandHandler::getInkey")
-    aRes = ESatSuccess;
-    // the timeout expires The timer starts when the text is
-    //displayed on the screen and stops when the TERMINALRESPONSE is sent.
-    QTime time;
-    unsigned int duration = KDefaultSelectionTimeoutMseconds;
-    if (aDuration) {
-        TFLOGSTRING2("SATAPP: SatAppCommandHandler::getInkey\
-        in aDuration: %d", aDuration)
-        duration = aDuration * KSymbianTimeConvertQtTime;
-        time.start();
-    }
-
-    QString heading;
-    if (aTitleText.isEmpty()) {
-        if (ESatDigitOnly == aCharacterSet) {
-            TFLOGSTRING("SATAPP:SatAppCommandHandler::getInkey: ESatDigitOnly")
-            heading = hbTrId("txt_sat_getinkey_nbr");
-        } else {
-            // ESatCharSmsDefaultAlphabet or ESatCharUcs2Alphabet
-            TFLOGSTRING("SatAppCommandHandler::getInkey others")
-            heading = hbTrId("txt_sat_getinkey_char");
-        }
-     } else {
-         heading = aTitleText;
-         TFLOGSTRING("SatAppCommandHandler::getInkey: Using aTitleText")
-     }
-   //Duration will be implemented in GetInkey proactive command
-    TSatAppUserResponse rsp = EUserNoResponse;
-    rsp = mUi.showGetInkeyQuery(heading, aInputText, aCharacterSet, duration);
-
-    if (aDuration) {
-        aDuration = time.elapsed() / KSymbianTimeConvertQtTime;
-        TFLOGSTRING2("SATAPP: SatAppCommandHandler::getInkey\
-                return for server aDuration: %d", aDuration)
-    }
-    // User press OK key
-    if (EUserPrimaryResponse == rsp) {
-        aRes = ESatSuccess;
-        TFLOGSTRING("SATAPP: SatAppCommandHandler::getInkey successful response")
-    } else if (EUserSecondaryResponse == rsp)
-        {
-        // User press back key
-        aRes = ESatBackwardModeRequestedByUser;
-    } else {
-        TFLOGSTRING("SATAPP: SatAppCommandHandler::getInkey no user response")
-        // User did not close the text, closed by the timer or MT call
-        aRes = ESatNoResponseFromUser;
-    }
-
-    TFLOGSTRING("SATAPP: SatAppCommandHandler::getInkey exit")
-}
-
-// ----------------------------------------------------------------------------
-// SatAppCommandHandler::getYesNo
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void SatAppCommandHandler::getYesNo(
-        TSatUiResponse &aRes,
-        const QString &aText,
-        const TSatCharacterSet aCharacterSet,
-        unsigned int &aInkey,
-        //const TSatIconId &aIconId,
-        const bool &/*aSelfExplanatory*/,
-        unsigned int &aDuration,
-        const bool aImmediateDigitResponse)
-{
-    TFLOGSTRING("SATAPP: SatAppCommandHandler::getYesNo")
-    TFLOGSTRING2("SATAPP: SatAppCommandHandler::getYesNo: immediate  %d",
-    aImmediateDigitResponse)
-
-    // the timeout expires The timer starts when the text is
-    //displayed on the screen and stops when the TERMINALRESPONSE is sent.
-    QTime time;
-    unsigned int duration = KDefaultSelectionTimeoutMseconds;
-    if (aDuration) {
-        TFLOGSTRING2("SATAPP: SatAppUiProvider::getYesNo in aDuration: %d",
-        aDuration)
-        duration = aDuration * KSymbianTimeConvertQtTime;
-        time.start();
-    }
-    TFLOGSTRING2("SATAPP: SatAppUiProvider::showGetYesNoQuery duration=%d",
-            duration)
-
-    aRes = ESatSuccess;
-    int rsp = -1;
-    unsigned int inKey = aInkey;
-    rsp = mUi.showGetYesNoQuery(aText, aCharacterSet, inKey,
-            duration, aImmediateDigitResponse);
-
-    if (aDuration) {
-        aDuration = time.elapsed() / KSymbianTimeConvertQtTime;
-    }
-    TFLOGSTRING2("SATAPP: SatAppUiProvider::showGetYesNoQuery duration out=%d",
-            aDuration)
-    if (EUserPrimaryResponse == rsp) {
-        aRes = ESatSuccess;
-        if ( Qt::Key_unknown == inKey ) {
-            // User press yes key 
-            aInkey = 1;
-        } else {
-            // User press digital key
-            aInkey = inKey;
-        }
-        TFLOGSTRING("SATAPP: SatAppCommandHandler::getYesNo successful response")
-    } else if (EUserSecondaryResponse == rsp)
-        {
-        // User press cancel in immediate digital mode
-        if (ESatYesNo != aCharacterSet) {
-            aRes = ESatBackwardModeRequestedByUser;
-            TFLOGSTRING("SATAPP: SatAppCommandHandler::getYesNo Cancel")  
-        } else {
-            // User press NO key
-            aRes = ESatSuccess;
-            aInkey = 0;
-            TFLOGSTRING("SATAPP: SatAppCommandHandler::getYesNo No")  
-        }
-    } 
-    // else if {
-    //    // User press end/back key
-    //    aRes = ESatBackwardModeRequestedByUser;
-    //    aInkey = 1;
-    else {
-        TFLOGSTRING("SATAPP: SatAppCommandHandler::getYesNo no user response")
-        // User did not close the text, closed by the timer or MT call
-        aRes = ESatNoResponseFromUser;
-        aInkey = 0;
-    }
-    TFLOGSTRING("SATAPP: SatAppCommandHandler::getYesNo exit")
-}
-
-// ----------------------------------------------------------------------------
-// SatAppCommandHandler::getInput
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void SatAppCommandHandler::getInput(TSatUiResponse &aRes,
-                                const QString &aTitleText,
-                                const TSatCharacterSet aCharacterSet,
-                                QString &aInputText,
-                                const int aMinLength,
-                                const int aMaxLength,
-                                const bool aHideInput,
-                                //const QPixmap* /*aIconBitmapGetInput*/,
-                                const bool /*aSelfExplanatory*/,
-                                unsigned int &/*aDuration*/)
-{
-    TFLOGSTRING("SATAPP: SatAppCommandHandler::getInput")
-
-    aRes = ESatNoResponseFromUser;
-    QString heading;
-
-    if (aTitleText.isEmpty()) {
-        if (ESatDigitOnly == aCharacterSet) {
-            TFLOGSTRING("SATAPP::getInput ESatDigitOnly")
-            heading = hbTrId("txt_sat_getinput_nbr");
-        } else {
-            // ESatCharSmsDefaultAlphabet or ESatCharUcs2Alphabet
-            TFLOGSTRING("SatAppCommandHandler::getInput ESatCharSmsDefaultAlphabet \
-                or ESatCharUcs2Alphabet")
-               heading = hbTrId("txt_sat_getinput_char");
-        }
-    } else {
-        heading.append(aTitleText);
-    }
-
-    int minLength = 0;
-    int maxLength = 1;
-    if (aMinLength <= KGetInputStringMaxSize && aMinLength > 0){
-         minLength = aMinLength;
-    } else if (aMinLength > KGetInputStringMaxSize){
-        minLength = KGetInputStringMaxSize;
-    }
-    //lint -e{961} else block not needed, maxLength initialized.
-    if (aMaxLength < minLength){
-        maxLength = minLength;
-    } else if (aMaxLength <= KGetInputStringMaxSize && aMaxLength > 1){
-         maxLength = aMaxLength;
-    } else if (aMaxLength > KGetInputStringMaxSize){
-         maxLength = KGetInputStringMaxSize;
-    }
-
-    QString inputText;
-    if ((aInputText.length() >= minLength)&& (aInputText.length() <= maxLength)){
-        inputText = aInputText;
-    }
-
-    //Duration will be implemented in GetInkey proactive command
-    TSatAppUserResponse rsp = EUserNoResponse;
-    rsp = mUi.showGetInputQuery( heading, inputText,
-            aCharacterSet, minLength, maxLength, aHideInput);
-
-    if (EUserPrimaryResponse == rsp) {
-        // User press OK key
-        aRes = ESatSuccess;
-        aInputText = inputText;
-        TFLOGSTRING("SATAPP: SatAppCommandHandler::getInput successful response")
-    } else if (EUserSecondaryResponse == rsp)
-        {
-        // User press back key
-        aRes = ESatBackwardModeRequestedByUser;
-        TFLOGSTRING("SATAPP: SatAppCommandHandler::getInput press back softkey response")
-    } else {
-        // User did not close the getinput query, closed by the timer or MT call
-        aRes = ESatNoResponseFromUser;
-        TFLOGSTRING("SATAPP: GetInputL::getInput no user response")
-    }
-    TFLOGSTRING("SATAPP: SatAppCommandHandler::getInput exit")
-}
-
-// ----------------------------------------------------------------------------
-// SatAppCommandHandler::callControl
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void SatAppCommandHandler::callControl(
-    const QString &aText,
-    const TSatAlphaIdStatus /*aAlphaIdStatus*/)
-{
-    TFLOGSTRING("SATAPP: SatAppCommandHandler::showCallControlNote call")
-    //if (ESatAlphaIdNotNull == aAlphaIdStatus) {
-    //TODO  The note will be disabled by the phone UI when the call is
-    // in connecting status. But call control case is an exception, So we
-    // use RAknKeyLock to enable soft notifications.
-    mUi.showCallControlNote(aText);
-    TFLOGSTRING("SATAPP: SatAppCommandHandler::showCallControlNote exit")
-}
-
-// ----------------------------------------------------------------------------
-// SatAppCommandHandler::moSmControl
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void SatAppCommandHandler::moSmControl(
-    const QString &aText,
-    const TSatAlphaIdStatus aAlphaIdStatus)
-{
-    TFLOGSTRING("SATAPP: SatAppCommandHandler::moSmControl call")
-    if (ESatAlphaIdNotNull == aAlphaIdStatus) {
-         mUi.showMoSmControlNote(aText);
-    } else {
-        mUi.showSatInfoNote(aText);
-    }
-    TFLOGSTRING("SATAPP: SatAppCommandHandler::moSmControl exit")
-}
-
-// ----------------------------------------------------------------------------
-// SatAppCommandHandler::confirmSend
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void SatAppCommandHandler::confirmSend(
-    TSatUiResponse &aRes,
-    const QString &/*aText*/,
-    bool &aActionAccepted,
-    int aType)
-{
-    TFLOGSTRING2("SATAPP: SatAppCommandHandler::confirmSend call, type=%d", aType)
-    aRes = ESatNoResponseFromUser;
-    QString title;
-    switch (aType) {
-        case ESatUiConfirmSendSms:
-            {
-            title.append(hbTrId("txt_sat_sim_notification_sendsms"));
-            TFLOGSTRING( "SATAPP: SatAppCommandHandler::confirmSend sms" )
-            }
-            break;
-        case ESatUiConfirmSendSs:
-        case ESatUiConfirmSendUssd: //the same string for SS and USSD
-            {
-            title.append(hbTrId("txt_sat_sim_notification_sendss_ussd"));
-            TFLOGSTRING( "SATAPP: SatAppCommandHandler::confirmSend ussd or ss" )
-            }
-            break;
-        default:
-           aRes = ESatFailure;
-           TFLOGSTRING( "SATAPP: SatAppCommandHandler::confirmSend type unsupport" )  
-           break;
-    }
-    if(ESatFailure != aRes) {
-        mUi.showConfirmSendQuery(title, aActionAccepted);
-        aRes = ESatSuccess;
-        TFLOGSTRING2( "SATAPP: SatAppCommandHandler::confirmSend accept=%d",
-                aActionAccepted)  
-    }
-    TFLOGSTRING2( "SATAPP: SatAppCommandHandler::confirmSend exit rsp=%d", aRes )
-}
-
-// ----------------------------------------------------------------------------
-// SatAppCommandHandler::showSmsWaitNote
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void SatAppCommandHandler::showSmsWaitNote(const QString &aText, 
-    const bool /*aSelfExplanatoryIcon*/)
-{
-    TFLOGSTRING("SATAPP: SatAppCommandHandler::showSmsWaitNote call")
-    mUi.showSmsWaitNote(aText);
-    TFLOGSTRING("SATAPP: SatAppCommandHandler::showSmsWaitNote exit")
- }
-
-// ----------------------------------------------------------------------------
-// SatAppCommandHandler::showDtmfWaitNote
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void SatAppCommandHandler::showDtmfWaitNote(TSatUiResponse &aRes,
-    const QString &aText/*,
-    const bool aSelfExplanatoryIcon*/)
-{
-    TFLOGSTRING("SATAPP: SatAppCommandHandler::showDtmfWaitNote call")
-    mUi.showDtmfWaitNote(aRes, aText);
-    TFLOGSTRING("SATAPP: SatAppCommandHandler::showDtmfWaitNote exit")
- }
-
-// ----------------------------------------------------------------------------
-// SatAppCommandHandler::stopShowWaitNote
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void SatAppCommandHandler::stopShowWaitNote()
-{
-    TFLOGSTRING("SATAPP: SatAppCommandHandler::stopShowWaitNote call")
-    mUi.stopShowWaitNote();
-    TFLOGSTRING("SATAPP: SatAppCommandHandler::stopShowWaitNote exit")
-}
-
-// ----------------------------------------------------------------------------
-// SatAppCommandHandler::confirmSetUpCall
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void SatAppCommandHandler::confirmSetUpCall(
-        const QString &aText,
-        const QString &aSimAppName,
-        bool &aActionAccepted//,
-        //const CFbsBitmap* aIconBitmap,
-        //const TBool aSelfExplanatory
-       )
-{
-    TFLOGSTRING("SATAPP: SatAppCommandHandler::showSetUpCallConfirm call")
-    mUi.showConfirmSetUpCallQuery(aText, aSimAppName, aActionAccepted);
-    TFLOGSTRING("SATAPP: SatAppCommandHandler::showSetUpCallConfirm exit")
-}
-
-// ----------------------------------------------------------------------------
-// SatAppCommandHandler::showSsWaitNote
-// (other items were commented in a header).
-// Displays a wait note to indicate SS sending.
-// ----------------------------------------------------------------------------
-//
-void SatAppCommandHandler::showSsWaitNote(
-        const QString &aText,
-        //const CFbsBitmap* aIconBitmapSendSM,
-        const bool aSelfExplanatoryIcon)
-{
-    TFLOGSTRING("SATAPP: SatAppCommandHandler::showSsWaitNote call")
-    mUi.showSsWaitNote(aText, aSelfExplanatoryIcon);
-    TFLOGSTRING("SATAPP: SatAppCommandHandler::showSsWaitNote exit")
-}
-
-// ----------------------------------------------------------------------------
-// SatAppCommandHandler::showBIPWaitNote
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void SatAppCommandHandler::showBIPWaitNote(int aCommand, const QString &aText)
-{
-    TFLOGSTRING("SATAPP: SatAppCommandHandler::showBIPWaitNote call")
-    QString title = aText;
-    if (ECloseChannelIdentifier == aCommand ){
-        if (aText.isEmpty()){
-            title= hbTrId("txt_sat_closechannel_wait_note");           
-        }
-        // No cancel key support, close channel
-        mUi.showCloseChannelWaitNote(title);
-    } else {
-        // Cancel key support, Send Data, Receive Data
-        mUi.showBIPWaitNote(title);
-    }
-    
-    TFLOGSTRING("SATAPP: SatAppCommandHandler::showBIPWaitNote exit")
-}
-//End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satui/satapp/src/satappconfirmprovider.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,194 @@
+/*
+* 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: 
+*
+*/
+
+// qt
+#include <QAction>
+// hb
+#include <hbmessagebox.h>
+#include <hbaction.h>
+// satapp
+#include "satappconfirmprovider.h"
+#include "satappconstant.h"
+#include "satappaction.h"
+
+// ----------------------------------------------------------------------------
+// SatAppConfirmProvider::SatAppConfirmProvider
+// ----------------------------------------------------------------------------
+//
+SatAppConfirmProvider::SatAppConfirmProvider(QObject *parent)
+    : QObject(parent), mConfirmQuery(0), mAction(0)
+{
+    qDebug("SATAPP: SatAppConfirmProvider::SatAppConfirmProvider");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppConfirmProvider::~SatAppConfirmProvider
+// ----------------------------------------------------------------------------
+//
+SatAppConfirmProvider::~SatAppConfirmProvider()
+{
+    qDebug("SATAPP: SatAppConfirmProvider::~SatAppConfirmProvider >");
+    clearScreen();
+    qDebug("SATAPP: SatAppConfirmProvider::~SatAppConfirmProvider <");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppConfirmProvider::showOpenChannelConfirm
+// ----------------------------------------------------------------------------
+//
+void SatAppConfirmProvider::confirmCommand(SatAppAction &action)
+{
+    qDebug("SATAPP: SatAppConfirmProvider::confirmCommand >");
+    mAction = &action;
+    delete mConfirmQuery;
+    mConfirmQuery = 0;
+    TSatSQueryCommand aCommandId = 
+        static_cast<TSatSQueryCommand>(action.value(KeyQueryCommandId).toInt());
+
+    qDebug("SATAPP: SatAppConfirmProvider::ConfirmCommand aCommandId: %d",
+         aCommandId);
+    // Check quering command
+    switch (aCommandId)
+        {
+        case ESatOpenChannelQuery:
+            {
+            qDebug("SATAPP: SatAppConfirmProvider::ConfirmCommand:\
+                Quering OpenChannel");
+            showOpenChannelConfirm(action);
+            break;
+            }
+        case ESatSSetUpCallQuery:
+            {
+            qDebug("SATAPP: SatAppConfirmProvider::ConfirmCommand:\
+                Quering SetUpCall");
+            showSetUpCallConfirm(action);
+            break;
+            }
+        // TODO: implemente later   
+        case ESatSRefreshQuery:
+        // TODO: implemente later
+        case ESatSLaunchBrowserQuery:
+            {
+            action.completeWithNoResponse();
+            break;
+            }
+        default:
+            {
+            qDebug("SATAPP: SatAppConfirmProvider::ConfirmCommand:\
+                Unknown quering command");
+            action.completeWithNoResponse();
+            }
+            break;
+        }
+    qDebug("SATAPP: SatAppConfirmProvider::ConfirmCommand <");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppConfirmProvider::showOpenChannelConfirm
+// ----------------------------------------------------------------------------
+//
+void SatAppConfirmProvider::showOpenChannelConfirm(SatAppAction &action)
+{
+    qDebug("SATAPP: SatAppConfirmProvider::showOpenChannelConfirm >");
+    QString content = action.value(KeyText).toString();
+    if (!content.length()){
+        content = hbTrId("txt_simatk_info_open_connection");
+    }
+    mConfirmQuery = new HbMessageBox(HbMessageBox::MessageTypeQuestion);
+    // Sets the "Yes"-action/button
+    mConfirmQuery->setText(content);
+    mConfirmQuery->setStandardButtons(HbMessageBox::Ok | HbMessageBox::Cancel);
+    SAT_ASSERT(connect(mConfirmQuery->actions().at(0), SIGNAL(triggered()),
+        &action, SLOT(completeWithSuccess())));
+    SAT_ASSERT(connect(mConfirmQuery->actions().at(1), SIGNAL(triggered()),
+        &action, SLOT(completeWithBackRequested())));
+    SAT_ASSERT(connect(mAction, SIGNAL(actionCompleted(SatAppAction *)),
+        this, SLOT(resetState())));
+    qDebug("SATAPP: SatAppUiProvider::showOpenChannelConfirm before open");
+    mConfirmQuery->open();
+    qDebug("SATAPP: SatAppConfirmProvider::showOpenChannelConfirm <");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppConfirmProvider::showSetUpCallConfirm
+// ----------------------------------------------------------------------------
+//
+void SatAppConfirmProvider::showSetUpCallConfirm(SatAppAction &action)
+{
+    qDebug("SATAPP: SatAppConfirmProvider::showSetUpCallConfirm >");
+    QString text = action.value(KeyText).toString();
+    QString additionText = action.value(KeyAdditionalText).toString();
+    QString alphaId;
+    if (text.length() == 0) {
+        qDebug("SATAPP: SatAppConfirmProvider::showSetUpCallConfirm length 0");
+        if (additionText.length() > 0) {
+            alphaId.append(additionText);
+        } else {
+            alphaId.append(hbTrId("txt_simatk_title_sim_services"));
+        }
+       alphaId.append(hbTrId("txt_simatk_info_1_about_to_call")); 
+    } else {
+        qDebug("SATAPP: SatAppConfirmProvider::showSetUpCallConfirm text");
+        alphaId.append(text);
+    }
+    qDebug("SATAPP: SatAppConfirmProvider::showSetUpCallConfirm new");
+    mConfirmQuery = new HbMessageBox(HbMessageBox::MessageTypeQuestion);
+    mConfirmQuery->setStandardButtons(HbMessageBox::Ok | HbMessageBox::Cancel);
+    mConfirmQuery->setText(alphaId);
+    SAT_ASSERT(connect(mConfirmQuery->actions().at(0), SIGNAL(triggered()),
+        &action, SLOT(completeWithSuccess())));
+    SAT_ASSERT(connect(mConfirmQuery->actions().at(1), SIGNAL(triggered()),
+        &action, SLOT(completeWithBackRequested())));
+    SAT_ASSERT(connect(mAction, SIGNAL(actionCompleted(SatAppAction *)),
+        this, SLOT(resetState())));
+    qDebug("SATAPP: SatAppConfirmProvider::showSetUpCallConfirm before open");
+    mConfirmQuery->open();
+    qDebug("SATAPP: SatAppConfirmProvider::showSetUpCallConfirm <");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppConfirmProvider::clearScreen
+// ----------------------------------------------------------------------------
+//
+void SatAppConfirmProvider::clearScreen()
+{
+    qDebug("SATAPP: SatAppConfirmProvider::clearScreen >");
+    if (mAction) {
+        SAT_ASSERT(disconnect(mAction, SIGNAL(actionCompleted(SatAppAction *)),
+            this, SLOT(resetState())));
+        qDebug("SATAPP: SatAppConfirmProvider::clearScreen quit event loop");
+        mAction->completeWithNoResponse();
+        mAction = 0;
+    }
+    delete mConfirmQuery;
+    mConfirmQuery = 0;
+    qDebug("SATAPP: SatAppConfirmProvider::clearScreen <");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppConfirmProvider::resetState
+// reset
+// ----------------------------------------------------------------------------
+//
+void SatAppConfirmProvider::resetState()
+{
+    qDebug( "SATAPP: SatAppConfirmProvider::resetState >" );
+    mAction = 0;
+    qDebug( "SATAPP: SatAppConfirmProvider::resetState <" );
+}
+
+//End of file
--- a/satui/satapp/src/satappeventprovider.cpp	Tue Jul 06 14:53:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,733 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include <QStringList>
-#include <msatuiadapter.h>
-
-#include "satappeventprovider.h"
-#include "satappplaytoneprovider.h"
-#include "csatuiobserver.h"
-#include "tflogger.h"
-
-// ----------------------------------------------------------------------------
-// SatAppEventProvider::SatAppEventProvider
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-SatAppEventProvider::SatAppEventProvider(QObject *parent) :
-    QObject(parent), mObs(NULL), mPlayTone(NULL)
-{
-    TFLOGSTRING("SATAPP: SatAppEventProvider::SatAppEventProvider call")
-    TRAPD(err, mObs = CSatUiObserver::NewL();
-                mObs->ConnectRSatSessionL();
-          );
-    if ( KErrNone != err ) {
-        CloseSatUI();
-    } else {
-        mObs->SetImplementer(this);
-        TFLOGSTRING("SATAPP: SatAppEventProvider::SatAppEventProvider \
-            SetImplementer")
-        mPlayTone = new SatAppPlayToneProvider(this);
-    }
-
-    TFLOGSTRING("SATAPP: SatAppEventProvider::SatAppEventProvider exit")
-}
-
-// ----------------------------------------------------------------------------
-// SatAppEventProvider::~SatAppEventProvider
-// Sets a pointer to SATAPP: SatAppEventProvider object.
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-SatAppEventProvider::~SatAppEventProvider()
-{
-    TFLOGSTRING("SATAPP: SatAppEventProvider::~SatAppEventProvider call")
-    if (mObs){
-        mObs->DisconnectRSatSession();
-        delete mObs;
-        mObs = NULL;
-    }
-    if (mPlayTone) {
-        delete mPlayTone;
-        mPlayTone = NULL;
-        TFLOGSTRING("SATAPP: SatAppEventProvider::~SatAppEventProvider delete\
-            mPlayTone")
-    }
-    TFLOGSTRING("SATAPP: SatAppEventProvider::~SatAppEventProvider exit")
-}
-
-// ----------------------------------------------------------------------------
-// SatAppEventProvider::SetUpMenuL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-TSatUiResponse SatAppEventProvider::SetUpMenuL(
-    const TDesC &aText,
-    const MDesCArray &aMenuItems,
-    const CArrayFixFlat<TSatAction> */*aMenuItemNextActions*/,
-    const CFbsBitmap */*aIconBitmap*/,
-    const TBool aSelfExplanatoryItems,
-    const TBool aHelpIsAvailable)
-{
-    TFLOGSTRING("SATAPP: SatAppEventProvider::SetUpMenuL call")
-
-    TSatUiResponse response(ESatSuccess);
-    QString title;
-    if (aText.Length() > 0) {
-        title = QString::fromUtf16 (aText.Ptr(), aText.Length());
-        TFLOGSTRING2("SATAPP: SatAppEventProvider::SetUpMenuL Title=%S",
-            &aText)
-    }
-
-    QStringList *menuList = new QStringList();
-    TFLOGSTRING("SATAPP: SatAppEventProvider::SetUpMenuL List")
-
-    //Add Item
-    if(menuList) {
-        for (int i=0 ; i<aMenuItems.MdcaCount() ; i++) {
-            QString item=QString::fromUtf16(aMenuItems.MdcaPoint(i).Ptr(),
-                aMenuItems.MdcaPoint(i).Length());
-            menuList->append(item);
-        }
-
-        TFLOGSTRING("SATAPP: SatAppEventProvider::SetUpMenuL add item")
-
-        emit setUpMenuEvent(
-            response,
-            title,
-            *menuList,
-            aSelfExplanatoryItems,
-            aHelpIsAvailable);
-
-        delete menuList;
-    }
-    TFLOGSTRING("SATAPP: SatAppEventProvider::SetUpMenuL exit")
-
-    return response;
-}
-
-// ----------------------------------------------------------------------------
-// SatAppEventProvider::SetUpMenuL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-TSatUiResponse SatAppEventProvider::SelectItemL(
-    const TDesC &aText,
-    const MDesCArray &aMenuItems,
-    const CArrayFixFlat<TSatAction> */*aMenuItemNextActions*/,
-    const TInt aDefaultItem,
-    TUint8 &aSelection,
-    const CFbsBitmap */*aIconBitmap*/,
-    const TBool aSelfExplanatoryItems,
-    const TBool aHelpIsAvailable)
-{
-    TFLOGSTRING("SATAPP: SatAppEventProvider::SelectItemL call")
-
-    TSatUiResponse response(ESatSuccess);
-    aSelection = 0;
-    QString title;
-    if (aText.Length() > 0) {
-        title=QString::fromUtf16(aText.Ptr(), aText.Length());
-        TFLOGSTRING2("SATAPP: SatAppEventProvider::SelectItemL Title=%S",
-            &aText)
-    }
-
-    QStringList *menuList = new QStringList();
-    //Add Item
-    if(menuList) {
-        for (int i=0 ; i<aMenuItems.MdcaCount() ; i++) {
-            QString item=QString::fromUtf16(aMenuItems.MdcaPoint(i).Ptr(),
-                        aMenuItems.MdcaPoint(i).Length());
-            menuList->append(item);
-        }
-        TFLOGSTRING("SATAPP: SatAppEventProvider::SelectItemL add item")
-
-        emit selectItemEvent(
-            response,
-            title,
-            *menuList,
-            aDefaultItem,
-            aSelection,
-            aSelfExplanatoryItems,
-            aHelpIsAvailable);
-
-        delete menuList;
-    }
-    TFLOGSTRING("SATAPP: SatAppEventProvider::SelectItemL exit")
-
-    return response;
-}
-
-// ----------------------------------------------------------------------------
-// SatAppEventProvider::ProfileState
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-int SatAppEventProvider::profileState()
-{
-    TFLOGSTRING("SATAPP: SatAppEventProvider::ProfileState call")
-    int res (0);
-    if (mObs) {
-       res = mObs->ProfileState();
-    }
-    TFLOGSTRING("SATAPP: SatAppEventProvider::ProfileState exit")
-    return res;
-}
-
-// ----------------------------------------------------------------------------
-// SatAppEventProvider::MenuSelection
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void SatAppEventProvider::menuSelection(int aMenuItem, bool aHelpRequested)
-{
-    TFLOGSTRING2("SATAPP: SatAppEventProvider::MenuSelection call\
-        aMenuItem=%d", aMenuItem)
-    if(mObs && mObs->Adapter()) {
-        mObs->Adapter()->MenuSelection(aMenuItem, aHelpRequested);
-    }
-
-    TFLOGSTRING("SATAPP: SatAppEventProvider::MenuSelection exit")
-}
-
-// ----------------------------------------------------------------------------
-// SatAppEventProvider::DisplayTextL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-TSatUiResponse SatAppEventProvider::DisplayTextL(
-    const TDesC &aText,
-    const TDesC &aSimApplicationName,
-    CFbsBitmap */*aIconBitmapDisplayText*/,
-    const TBool aSelfExplanatoryIcon,
-    const TBool aSustainedText,
-    const TTimeIntervalSeconds aDuration,
-    const TBool aWaitUserToClear)
-    {
-    TFLOGSTRING("SATAPP: SatAppEventProvider::DisplayTextL call")
-
-    TSatUiResponse response(ESatSuccess);
-    QString title;
-    if (aText.Length() > 0) {
-        title=QString::fromUtf16(aText.Ptr(), aText.Length());
-        TFLOGSTRING2("SATAPP: SatAppEventProvider::DisplayTextL \
-            Title=%S", &aText)
-    }
-
-    QString appName;
-    if (aSimApplicationName.Length() > 0) {
-         appName=QString::fromUtf16(aSimApplicationName.Ptr(),
-                aSimApplicationName.Length());
-         TFLOGSTRING2("SATAPP: SatAppEventProvider::DisplayTextL \
-             appName=%S", &aSimApplicationName)
-    }
-
-    int timeInterval = aDuration.Int();
-    TFLOGSTRING2("SATAPP: SatAppEventProvider::DisplayTextL: \
-        timeInterval=%d", timeInterval)
-
-    bool isSelfExplanatoryIcon = (aSelfExplanatoryIcon) ? true : false;
-
-    emit displayTextEvent(
-       response,
-       title,
-       appName,
-       //const HbIcon &aIcon,
-       isSelfExplanatoryIcon,
-       aSustainedText,
-       timeInterval,
-       aWaitUserToClear);
-
-    TFLOGSTRING("SATAPP: SatAppEventProvider::DisplayTextL exit")
-    return response;
-    }
-
-// ----------------------------------------------------------------------------
-// SatAppEventProvider::GetInputLL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-TSatUiResponse SatAppEventProvider::GetInputL(
-    const TDesC &aText,
-    const TSatCharacterSet aCharacterSet,
-    TDes &aInput,
-    const TInt aMinLength,
-    const TInt aMaxLength,
-    const TBool aHideInput,
-    const TBool aGetInkey,
-    const CFbsBitmap */*aIconBitmapGetInput*/,
-    const TBool aSelfExplanatory,
-    TUint &aDuration)
-{
-    TFLOGSTRING("SATAPP: SatAppEventProvider::GetInputL call")
-
-    TSatUiResponse response(ESatSuccess);
-
-    QString title;
-    if (aText.Length() > 0) {
-        title=QString::fromUtf16(aText.Ptr(), aText.Length());
-        TFLOGSTRING2("SATAPP: SatAppEventProvider::GetInputL \
-            Title=%S", &aText)
-     }
-
-    QString inputText;
-    if (aInput.Length() > 0) {
-        inputText = QString::fromUtf16(aInput.Ptr(), aInput.Length());
-        TFLOGSTRING2("SATAPP: SatAppEventProvider::GetInputL \
-            inputText=%S", &aInput)
-    }
-    bool isSelfExplanatory = aSelfExplanatory;
-    unsigned int duration = aDuration;
-    
-    if (aGetInkey) {
-        //Get Inkey
-         emit getInkeyEvent(
-             response,
-             title,
-             aCharacterSet,
-             inputText,
-             isSelfExplanatory,
-             duration);
-         TFLOGSTRING("SATAPP: SatAppEventProvider::GetInputL: GetInkey")
-         aInput.Copy(reinterpret_cast<const TUint16*>(inputText.utf16()), inputText.length());
-     } else {
-        // Get Input
-        bool hideInput = aHideInput;
-        int minLength = aMinLength;
-        int maxLength = aMaxLength;
-        emit getInputEvent(
-            response,
-            title,
-            aCharacterSet,
-            inputText,
-            minLength,
-            maxLength,
-            hideInput,
-            isSelfExplanatory,
-            duration);
-        int length = inputText.length();
-        if (length > maxLength) {
-            length = maxLength;
-        }
-        aInput.Copy(reinterpret_cast<const TUint16*>(inputText.utf16()), length);
-        TFLOGSTRING2("SATAPP: SatAppEventProvider::GetInputL aInput=%S", &aInput)
-    }
-    TFLOGSTRING("SATAPP: SatAppEventProvider::GetInputL exit")
-    return response;
-}
-
-// ----------------------------------------------------------------------------
-// SatAppEventProvider::CallControlL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//                                         
-TSatUiResponse SatAppEventProvider::CallControlL(
-    const TDesC &aText,
-    const TSatAlphaIdStatus aAlphaIdStatus)
-{
-    TFLOGSTRING("SATAPP: SatAppEventProvider::CallControlL call")
-    QString text;
-    if (aText.Length() > 0) {
-        text=QString::fromUtf16(aText.Ptr(), aText.Length());
-        TFLOGSTRING2("SATAPP: SatAppEventProvider::CallControlL \
-                aText=%S", &aText)
-    }
-    emit callControlEvent(text, aAlphaIdStatus);
-    TFLOGSTRING("SATAPP: SatAppEventProvider::CallControlL exit")
-    return ESatSuccess;
-}
-
-// ----------------------------------------------------------------------------
-// SatAppEventProvider::MoSmControlL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-TSatUiResponse SatAppEventProvider::MoSmControlL(
-    const TDesC &aText,
-    const TSatAlphaIdStatus aAlphaIdStatus)
-{
-    TFLOGSTRING("SATAPP: SatAppEventProvider::MoSmControlL call")
-    QString text;
-    if (aText.Length() > 0) {
-        text=QString::fromUtf16(aText.Ptr(), aText.Length());
-        TFLOGSTRING2("SATAPP: SatAppEventProvider::MoSmControlL \
-                aText=%S", &aText)
-    }
-    emit moSmControlEvent(text, aAlphaIdStatus);
-    TFLOGSTRING("SATAPP: SatAppEventProvider::MoSmControlL exit")
-    return ESatSuccess;
-}
-
-// ----------------------------------------------------------------------------
-// SatAppEventProvider::GetYesNoL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-TSatUiResponse SatAppEventProvider::GetYesNoL(
-    const TDesC &aText,
-    const TSatCharacterSet aCharacterSet,
-    TChar &aInkey,
-    const CFbsBitmap */*aIconBitmap*/,
-    const TBool aSelfExplanatory,
-    TUint &aDuration,
-    const TBool aImmediateDigitResponse)
-{
-    TFLOGSTRING("SATAPP: SatAppEventProvider::GetYesNoL call")
-    TSatUiResponse response(ESatSuccess);
-    QString text;
-    if (aText.Length() > 0) {
-        text=QString::fromUtf16(aText.Ptr(), aText.Length());
-        TFLOGSTRING2("SATAPP: SatAppEventProvider::GetYesNoL \
-                aText=%S", &aText)
-    }
-
-    unsigned int inKey = static_cast < TUint >(aInkey);
-    TFLOGSTRING2("SATAPP: SatAppEventProvider::GetYesNoL: inkey=%d",
-     inKey)
-
-    bool selfExplanatory = aSelfExplanatory;
-    bool immediateDigitResponse = aImmediateDigitResponse;
-    unsigned int duration = aDuration;
-
-    emit getYesNoEvent(
-        response,
-        text,
-        aCharacterSet,
-        inKey,
-        selfExplanatory,
-        duration,
-        immediateDigitResponse);
-
-    aInkey = inKey;
-    TFLOGSTRING2("SATAPP: SatAppEventProvider::GetYesNoL key=%x", inKey)
-    TFLOGSTRING("SATAPP: SatAppEventProvider::GetYesNoL exit")
-    return response;
-}
-
-// ----------------------------------------------------------------------------
-// SatAppEventProvider::ConfirmSendL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-TSatUiResponse SatAppEventProvider::ConfirmSendL(
-    const TDesC &aText,
-    TBool &aActionAccepted,
-    TInt aType)
-{
-    TFLOGSTRING("SATAPP: SatAppEventProvider::ConfirmSendL call")
-    TSatUiResponse response(ESatSuccess);
-    QString text;
-    if (aText.Length() > 0) {
-        text=QString::fromUtf16(aText.Ptr(), aText.Length());
-        TFLOGSTRING2("SATAPP: SatAppEventProvider::GetYesNoL \
-                aText=%S", &aText)
-    }
-    bool actionAccepted = aActionAccepted;
-    int type = aType;
-    emit confirmSendEvent(
-        response,
-        text,
-        actionAccepted,
-        type);
-    aActionAccepted = actionAccepted;
-    TFLOGSTRING("SATAPP: SatAppEventProvider::ConfirmSendL exit")
-    return response;
-}
-
-// ----------------------------------------------------------------------------
-// SatAppEventProvider::ShowSmsWaitNoteL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void SatAppEventProvider::ShowSmsWaitNoteL(
-    const TDesC &aText,
-    const CFbsBitmap */*aIconBitmapSendSM*/,
-    const TBool aSelfExplanatoryIcon)
-{
-    TFLOGSTRING("SATAPP: SatAppEventProvider::ShowSmsWaitNoteL call")
-    QString title;
-    if (aText.Length() > 0) {
-        title = QString::fromUtf16 (aText.Ptr(), aText.Length());
-        TFLOGSTRING2("SATAPP: SatAppEventProvider::ShowSmsWaitNoteL \
-            Title=%S", &aText)
-    }
-    bool selfExplanatoryIcon = aSelfExplanatoryIcon;
-
-    emit showSmsWaitNoteEvent(
-        title,
-        selfExplanatoryIcon);
-    TFLOGSTRING("SATAPP: SatAppEventProvider::ShowSmsWaitNoteL exit")
-}
-
-// ----------------------------------------------------------------------------
-// SatAppEventProvider::ConfirmSetUpCallL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void SatAppEventProvider::ConfirmSetUpCallL(
-    const TDesC &aText,
-    const TDesC &aSimAppName,
-    TBool &aActionAccepted,
-    const CFbsBitmap */*aIconBitmap*/,
-    const TBool /*aSelfExplanatory*/)
-    {
-    TFLOGSTRING("SATAPP: SatAppEventProvider::ConfirmSetUpCallL call")
-    QString text;
-    if (aText.Length() > 0) {
-        text = QString::fromUtf16 (aText.Ptr(), aText.Length());
-        TFLOGSTRING2("SATAPP: SatAppEventProvider::ConfirmSetUpCallL \
-            text=%S", &aText)
-    }
-    
-    QString title;
-    if (aSimAppName.Length() > 0) {
-        title = QString::fromUtf16 (aSimAppName.Ptr(), aSimAppName.Length());
-        TFLOGSTRING2("SATAPP: SatAppEventProvider::ConfirmSetUpCallL \
-            Title=%S", &aSimAppName)
-    }
-    bool actionAccepted = aActionAccepted;
-
-    emit showSetUpCallConfirmEvent(
-        text,
-        title,
-        actionAccepted);
-    aActionAccepted = actionAccepted;
-    TFLOGSTRING2("SATAPP: SatAppEventProvider::ConfirmSetUpCallL aActionAccepted %d \
-    exit", aActionAccepted)
-    }
-
-// ----------------------------------------------------------------------------
-// SatAppEventProvider::ShowDtmfWaitNoteL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-TSatUiResponse SatAppEventProvider::ShowDtmfWaitNoteL(
-    const TDesC &aText,
-    const CFbsBitmap */*aIconBitmapSendSM*/,
-    const TBool /*aSelfExplanatoryIcon*/)
-{
-    TSatUiResponse response(ESatSuccess);
-    TFLOGSTRING("SATAPP: SatAppEventProvider::ShowDtmfWaitNoteL call")
-    QString title;
-    if (aText.Length() > 0) {
-        title = QString::fromUtf16 (aText.Ptr(), aText.Length());
-        TFLOGSTRING2("SATAPP: SatAppEventProvider::ShowDtmfWaitNoteL \
-            Title=%S", &aText)
-    }
-    emit showDtmfWaitNoteEvent(
-        response,
-        title);
-    TFLOGSTRING("SATAPP: SatAppEventProvider::ShowDtmfWaitNoteL exit")
-    return response;
-}
-
-// ----------------------------------------------------------------------------
-// SatAppEventProvider::clearScreen
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void SatAppEventProvider::ClearScreen()
-{
-    TFLOGSTRING("SATAPP: SatAppEventProvider::ClearScreen call")
-    if (mPlayTone) {
-        mPlayTone->clearScreen();
-    }
-    emit clearScreenEvent();
-    TFLOGSTRING("SATAPP: SatAppEventProvider::ClearScreen exit")
-}
-
-// ----------------------------------------------------------------------------
-// SatAppEventProvider::CloseSatUI
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void SatAppEventProvider::CloseSatUI()
-{
-    TFLOGSTRING("SATAPP: SatAppEventProvider::CloseSatUI call")
-    if (mPlayTone) {
-        mPlayTone->closeSatUI();
-    }
-
-    emit closeUiEvent();
-    TFLOGSTRING("SATAPP: SatAppEventProvider::CloseSatUI exit")
-}
-
-//-----------------------------------------------------------------------------
-// SatAppEventProvider::StopShowWaitNote
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//    
-void SatAppEventProvider::StopShowWaitNote()
-{
-    TFLOGSTRING("SATAPP: SatAppEventProvider::StopShowWaitNote call")
-    emit stopShowWaitNoteEvent();
-    TFLOGSTRING("SATAPP: SatAppEventProvider::StopShowWaitNote exit")
-}
-
-//-----------------------------------------------------------------------------
-// SatAppEventProvider::userCancelResponse
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void SatAppEventProvider::userCancelResponse()
-{
-    TFLOGSTRING("SATAPP: SatAppEventProvider::userCancelResponse call")
-    mObs->Adapter()->SessionTerminated( ESessionCancel );
-    TFLOGSTRING("SATAPP: SatAppEventProvider::userCancelResponse exit")
-}
-
-//-----------------------------------------------------------------------------
-// SatAppEventProvider::ShowSsWaitNoteL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void SatAppEventProvider::ShowSsWaitNoteL(
-            const TDesC &aText,
-            const CFbsBitmap* /*aIconBitmap*/,
-            const TBool aSelfExplanatoryIcon )
-{
-    TFLOGSTRING("SATAPP: SatAppEventProvider::ShowSsWaitNoteL call")
-    QString title;
-    if (aText.Length() > 0) {
-        title = QString::fromUtf16 (aText.Ptr(), aText.Length());
-        TFLOGSTRING2("SATAPP: SatAppEventProvider::ShowSsWaitNoteL \
-            Title=%S", &aText)
-    }
-    bool selfExplanatoryIcon = aSelfExplanatoryIcon;
-
-    emit showSsWaitNoteEvent(
-        title,
-        selfExplanatoryIcon);
-    TFLOGSTRING("SATAPP: SatAppEventProvider::ShowSsWaitNoteL exit")
-}
-
-//-----------------------------------------------------------------------------
-// SatAppEventProvider::ShowWaitNoteWithoutDelayL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void SatAppEventProvider::ShowWaitNoteWithoutDelayL()
-{
-    TFLOGSTRING("SATAPP: SatAppEventProvider::ShowWaitNoteWithoutDelayL call")
-    emit showWaitNoteWithoutDelayEvent();
-    TFLOGSTRING("SATAPP: SatAppEventProvider::ShowWaitNoteWithoutDelayL exit")
-}
-
-//-----------------------------------------------------------------------------
-// SatAppEventProvider::showSsErrorNoteEvent
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void SatAppEventProvider::ShowSsErrorNoteL()
-{
-    TFLOGSTRING("SATAPP: SatAppEventProvider::showSsErrorNoteEvent call")
-    emit showSsErrorNoteEvent();
-    TFLOGSTRING("SATAPP: SatAppEventProvider::showSsErrorNoteEvent exit")
-}
-
-//-----------------------------------------------------------------------------
-// SatAppEventProvider::ShowBIPNoteL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void SatAppEventProvider::ShowBIPNoteL( TInt aCommand, const TDesC &aText,
-        const CFbsBitmap* /*aIconBitmap*/, const TBool /*aSelfExplanatory*/)
-{
-    TFLOGSTRING("SATAPP: SatAppEventProvider::ShowBIPNoteL call")
-    int cmdType = aCommand;
-    QString title;
-    if (aText.Length() > 0) {
-        title=QString::fromUtf16(aText.Ptr(), aText.Length());
-        TFLOGSTRING2("SATAPP: SatAppEventProvider::ShowBIPNoteL \
-            Title=%S", &aText)
-        }
-    emit showBIPNoteEvent(cmdType, title);
-    TFLOGSTRING("SATAPP: SatAppEventProvider::ShowBIPNoteL exit")
-}
-
-//-----------------------------------------------------------------------------
-// SatAppEventProvider::ConfirmOpenChannelL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-TSatUiResponse SatAppEventProvider::ConfirmOpenChannelL(
-    const TDesC &aText,
-    TBool &aActionAccepted,
-    const CFbsBitmap* /*aIconBitmapOpenChannel*/,
-    const TBool /*aSelfExplanatory*/ )
-{
-    TFLOGSTRING("SATAPP: SatAppEventProvider::ConfirmOpenChannelL call")
-    TSatUiResponse response( ESatSuccess );
-
-    QString title;
-    if (aText.Length() > 0) {
-        title=QString::fromUtf16(aText.Ptr(), aText.Length());
-        TFLOGSTRING2("SATAPP: SatAppEventProvider::ConfirmOpenChannelL \
-            Title=%S", &aText)
-        }
-    bool actionAccepted = aActionAccepted;
-    emit showOpenChannelConfirmEvent(title, actionAccepted);
-    // Show progress dialog when Openchannel confirmed
-    if( actionAccepted ) {
-        emit showWaitNoteWithoutDelayEvent();
-    }
-    aActionAccepted = actionAccepted;
-    TFLOGSTRING2( "SATAPP: SatAppEventProvider::ConfirmOpenChannelL exit\
-        response: %d", response)
-    return response;
-}
-
-//-----------------------------------------------------------------------------
-// SatAppEventProvider::PlayStandardToneL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-TSatUiResponse SatAppEventProvider::PlayStandardToneL( const TDesC& aText,
-    const TDesC8& aSequence,
-    TTimeIntervalMicroSeconds aDuration,
-    const CFbsBitmap* aIconBitmap,
-    const TBool aSelfExplanatory )
-{
-    TFLOGSTRING("SATAPP: SatAppEventProvider::PlayStandardToneL call")
-    TSatUiResponse response = mPlayTone->PlayStandardToneL(
-        aText, aSequence, aDuration, aIconBitmap, aSelfExplanatory);
-    TFLOGSTRING2("SATAPP: SatAppEventProvider::PlayStandardToneL \
-        response= %d exit", response)
-    return response;
-}
-
-//-----------------------------------------------------------------------------
-// SatAppEventProvider::PlayUserSelectedToneL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-TSatUiResponse SatAppEventProvider::PlayUserSelectedToneL(
-        const TDesC &aText,
-        TTimeIntervalMicroSeconds aDuration,
-        TSatTone aTone,
-        const CFbsBitmap* aIconBitmap,
-        const TBool aSelfExplanatory )
-{
-    TFLOGSTRING("SatAppEventProvider::PlayUserSelectedToneL calling")
-    TSatUiResponse response = mPlayTone->PlayUserSelectedToneL(
-        aText, aDuration, aTone, aIconBitmap, aSelfExplanatory);
-    TFLOGSTRING2( "SatAppEventProvider::PlayUserSelectedToneL response= %d \
-        exit", response)
-    return response;
-}
-
-//End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satui/satapp/src/satappinputprovider.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,635 @@
+/*
+* 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: Provides input methods like query dialogs
+*
+*/
+
+// qt
+#include <QTimer>
+#include <QtDebug>
+// hb
+#include <hbglobal.h>
+#include <hbinputdialog.h>
+#include <hbinputeditorinterface.h>
+#include <hbinputstandardfilters.h>
+#include <hbmessagebox.h>
+#include <hblabel.h>
+#include <hbaction.h>
+// satapp
+#include "satappinputprovider.h"
+#include "satappconstant.h"
+#include "satappaction.h"
+
+
+// ----------------------------------------------------------------------------
+// SatAppInputProvider::SatAppInputProvider
+// ----------------------------------------------------------------------------
+//
+SatAppInputProvider::SatAppInputProvider(QObject *parent)
+    : QObject(parent), mCurrentAction(0), mCurrentDialog(0)
+{
+    qDebug("SATAPP: SatAppInputProvider::SatAppInputProvider >");
+    mDurationTimer = new QTimer(this);
+    qDebug("SATAPP: SatAppInputProvider::SatAppInputProvider <");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppInputProvider::~SatAppInputProvider
+// ----------------------------------------------------------------------------
+//
+SatAppInputProvider::~SatAppInputProvider()
+{
+    qDebug("SATAPP: SatAppInputProvider::~SatAppInputProvider >");
+    resetState();
+    qDebug("SATAPP: SatAppInputProvider::~SatAppInputProvider <");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppInputProvider::getInkey
+// requests user to enter a SINGLE key, character or digit
+// ----------------------------------------------------------------------------
+//
+void SatAppInputProvider::getInkey(SatAppAction& action)
+{
+    qDebug("SATAPP: SatAppInputProvider::getInkey >");
+    
+    delete mCurrentDialog;
+    mCurrentDialog=0;
+    
+    QString heading = action.value(KeyText).toString();
+    qDebug() << "SATAPP: getInkey: heading=" << heading;
+    
+    TSatCharacterSet characterSet = 
+        static_cast<TSatCharacterSet>(action.value(KeyCharacterSet).toInt());
+
+    qDebug("SATAPP: SatAppInputProvider::getInkey char set %d", characterSet);
+
+    // yes no query must have text.
+    if ((0 == heading.length()) && (ESatYesNo == characterSet)) {
+        action.completeWithFailure();
+        return;
+    }
+    
+    // duration
+    int duration = action.value(KeyDuration).toInt();
+    if (duration == 0) {
+        duration = KDefaultSelectionTimeoutMseconds;
+    }
+    qDebug("SATAPP: getInkey: duration=%d", duration);
+    mInputTimer.start();
+
+    if (heading.isEmpty()) {
+        if (ESatDigitOnly == characterSet) {
+            heading = hbTrId("txt_simatk_dialog_entern1_digit_09");
+        } else {
+            // ESatCharSmsDefaultAlphabet or ESatCharUcs2Alphabet
+            heading = hbTrId("txt_simatk_dialog_entern1_character");
+        }
+    }
+    qDebug() << "SATAPP: getInkey: heading=" << heading;
+
+    mCurrentAction = &action;
+    bool immediate = action.value(KeyImmediate).toBool();
+    qDebug() << "SATAPP: getInkey: immediate=" << immediate;
+    
+    if (characterSet == ESatYesNo) {
+        //Yes no imediate will be combine with YES no.
+        showGetYesNoQuery(heading, duration);
+    }
+    else if (immediate) {
+        // we only have digit immediate
+        showGetImmediateQuery(heading, duration);
+    }
+    else {
+        // Reminder, there is no default inkey in get inkey
+        // proactive command.
+        showGetInkeyQuery(heading, characterSet, duration);
+    }
+    SAT_ASSERT(connect(mCurrentAction, SIGNAL(actionCompleted(SatAppAction*)),
+        this, SLOT(clearDurationTimer())));
+    qDebug("SATAPP: SatAppInputProvider::getInkey <");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppInputProvider::getInput
+// requests user to enter a STRING of free text, number or password etc.
+// ----------------------------------------------------------------------------
+//
+void SatAppInputProvider::getInput(SatAppAction& action)
+{
+    qDebug("SATAPP: SatAppInputProvider::getInput >");
+ 
+    delete mCurrentDialog;
+    mCurrentDialog=0;
+    // character set
+    TSatCharacterSet characterSet = 
+        static_cast<TSatCharacterSet>(action.value(KeyCharacterSet).toInt());
+
+    qDebug("SATAPP: SatAppInputProvider::getInput char set %d", characterSet);
+
+    // heading
+    QString heading = action.value(KeyText).toString();
+    qDebug() << "SATAPP: getInput: heading=" << heading;
+    if (heading.isEmpty()) {
+        if (ESatDigitOnly == characterSet) {
+            heading = hbTrId("txt_simatk_dialog_entern1_digit_09");
+        } else {
+            // ESatCharSmsDefaultAlphabet or ESatCharUcs2Alphabet
+            heading = hbTrId("txt_simatk_dialog_entern1_character");
+        }
+    }
+    qDebug() << "SATAPP: getInput: heading=" << heading;
+
+    // min length
+    int minLength = action.value(KeyMinLength).toInt();
+    if (minLength<0) {
+        minLength=0;
+    }
+    if (minLength>KGetInputStringMaxSize){
+        minLength=KGetInputStringMaxSize;
+    }
+
+    // max length
+    int maxLength = action.value(KeyMaxLength).toInt();
+    if (maxLength<minLength) {
+        maxLength=minLength;
+    }
+    if (maxLength>KGetInputStringMaxSize) {
+        maxLength=KGetInputStringMaxSize;
+    }
+    qDebug("SATAPP: SatAppInputProvider::getInput min %d", minLength);
+    qDebug("SATAPP: SatAppInputProvider::getInput max %d", maxLength);
+
+    // default input text
+    QString inputText = action.value(KeyInputString).toString();
+    if (inputText.length() < minLength || inputText.length() > maxLength){
+        inputText = "";
+    }
+    qDebug() << "SATAPP: getInput: inputText=" << inputText;
+
+    // hide input
+    bool hideInput = action.value(KeyHideInput).toBool();
+    qDebug("SATAPP: SatAppInputProvider::getInput hide %d", hideInput);
+
+    qDebug("SATAPP: getInput: min=%d,max=%d,hide=%d",
+        minLength, maxLength, hideInput);
+    
+    mCurrentAction = &action;
+    showGetInputQuery( heading, inputText,
+            characterSet, minLength, maxLength, hideInput);
+ 
+    SAT_ASSERT(connect(mCurrentAction, SIGNAL(actionCompleted(SatAppAction*)),
+        this, SLOT(clearDurationTimer())));
+    qDebug("SATAPP: SatAppInputProvider::getInput <");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppInputProvider::showGetInkeyQuery
+// ----------------------------------------------------------------------------
+//
+void SatAppInputProvider::showGetInkeyQuery(
+    const QString &heading,
+    TSatCharacterSet characterSet,
+    int duration)
+{
+    qDebug("SATAPP: SatAppInputProvider::showGetInkeyQuery >");
+
+    HbInputDialog* inputDialog = new HbInputDialog();
+    mCurrentDialog = inputDialog;
+    // Set PromptText
+    inputDialog->setPromptText(heading);
+    // Set ContentText
+    HbEditorInterface inputMode(inputDialog->lineEdit());
+    inputDialog->lineEdit()->setFocus();
+    if (ESatDigitOnly == characterSet) {
+        // digit mode, digits only (0 9, *, #, and +)
+        inputMode.setFilter(HbPhoneNumberFilter::instance());
+        inputMode.setMode(HbInputModeNumeric);
+        inputMode.setInputConstraints(HbEditorConstraintFixedInputMode);
+    } else {
+        // char mode
+        inputMode.setUpAsLatinAlphabetOnlyEditor();
+    }
+    composeDialog(inputDialog, GetInkey);
+    mCurrentAction->set(KeyMinLength, 1); 
+    inputDialog->lineEdit()->setMaxLength(1);
+
+    // when input changed, enable/disable OK button
+    SAT_ASSERT(connect(inputDialog->lineEdit(), SIGNAL(textChanged(QString)),
+        this, SLOT(updateQueryAction(QString))));
+    // when OK pressed, fill in data to action and complete it
+    SAT_ASSERT(connect(inputDialog->actions().at(0), SIGNAL(triggered()),
+        this, SLOT(transmitInkeyFromDialog())));
+    // when cancel pressed, complete action with ESatBackwardModeRequestedByUser
+    SAT_ASSERT(connect(inputDialog->actions().at(1), SIGNAL(triggered()),
+        mCurrentAction, SLOT(completeWithBackRequested())));
+    // after timeout, reset the provider
+    startDurationTimer(duration);
+    // open the dialog. When the dialog closes, reset everything
+    inputDialog->open();
+
+    qDebug("SATAPP: SatAppInputProvider::showGetInkeyQuery <");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppInputProvider::showGetImmediateQuery
+// ----------------------------------------------------------------------------
+//
+void SatAppInputProvider::showGetImmediateQuery(
+    const QString &heading,
+    int duration)
+{
+    qDebug("SATAPP: SatAppInputProvider::showGetImmediateQuery >");
+
+    HbInputDialog* inputDialog = new HbInputDialog();
+    mCurrentDialog = inputDialog;
+    // Set PromptText
+    inputDialog->setPromptText(heading);
+    // Set ContentText
+    HbEditorInterface inputMode(inputDialog->lineEdit());
+    inputDialog->lineEdit()->setFocus();
+
+    inputMode.setFilter(HbPhoneNumberFilter::instance());
+    inputMode.setMode(HbInputModeNumeric);
+    inputMode.setInputConstraints(HbEditorConstraintFixedInputMode);
+    
+    composeDialog(inputDialog, GetImmediate);
+
+    // when receiving first input character, send it immediately
+    SAT_ASSERT(connect(inputDialog->lineEdit(), SIGNAL(textChanged(QString)),
+        this, SLOT(transmitInkeyImmediately(QString))));
+    // when cancel pressed, complete action with ESatBackwardModeRequestedByUser
+    SAT_ASSERT(connect(inputDialog->actions().at(0), SIGNAL(triggered()),
+        mCurrentAction, SLOT(completeWithBackRequested())));
+    // after timeout, reset the provider
+    startDurationTimer(duration);
+    // open the dialog. When the dialog closes, reset everything
+    inputDialog->open();
+
+    qDebug("SATAPP: SatAppInputProvider::showGetImmediateQuery <");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppInputProvider::showGetYesNoQuery
+// ----------------------------------------------------------------------------
+//
+void SatAppInputProvider::showGetYesNoQuery(
+    const QString &text,
+    int duration)
+{
+    qDebug("SATAPP: SatAppInputProvider::showGetYesNoQuery >");
+    HbMessageBox* messageBox = new HbMessageBox(HbMessageBox::MessageTypeInformation);
+    mCurrentDialog = messageBox;
+
+    // Set the label as heading widget
+    HbLabel *lHeading = new HbLabel(text, messageBox);
+    messageBox->setHeadingWidget(lHeading);
+    messageBox->setIconVisible(false);
+
+    composeDialog(messageBox, GetYesNo);
+
+    // when YES pressed, complete action with ESatSuccess, inkey set to 1
+    SAT_ASSERT(connect(messageBox->actions().at(0), SIGNAL(triggered()),
+        this, SLOT(transmitInkeyTrue())));
+    // when NO pressed, complete action with ESatSuccess, inkey set to 0
+    SAT_ASSERT(connect(messageBox->actions().at(1), SIGNAL(triggered()),
+        this, SLOT(transmitInkeyFalse())));
+ 
+    startDurationTimer(duration);     
+    // show dialog.
+    messageBox->open();
+
+    qDebug("SATAPP: SatAppInputProvider::showGetYesNoQuery <");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppInputProvider::showGetInputQuery
+// ----------------------------------------------------------------------------
+//
+void SatAppInputProvider::showGetInputQuery(
+    const QString& heading,
+    const QString& content,
+    TSatCharacterSet characterSet,
+    int minLength,
+    int maxLength,
+    bool hideInput)
+{
+    Q_UNUSED(minLength);
+    qDebug("SATAPP: SatAppInputProvider::showGetInputQuery >");
+
+    HbInputDialog* inputQuery = new HbInputDialog();
+    mCurrentDialog = inputQuery;
+    inputQuery->setPromptText(heading);
+    inputQuery->setValue(QVariant(content));
+    HbEditorInterface inputMode(inputQuery->lineEdit());
+    inputQuery->lineEdit()->setFocus();
+    if (ESatDigitOnly == characterSet) {
+        // digit mode, digits only (0 9, *, #, and +)
+        inputMode.setFilter(HbPhoneNumberFilter::instance());
+        inputMode.setMode(HbInputModeNumeric);
+        inputMode.setInputConstraints(HbEditorConstraintFixedInputMode);
+    } else {
+        // char mode
+        inputMode.setUpAsLatinAlphabetOnlyEditor();
+    }
+
+    inputQuery->lineEdit()->setMaxLength(maxLength);
+
+    composeDialog(inputQuery, GetInput);
+    // initially set the button states
+    updateQueryAction(inputQuery->value().toString());
+
+    if (hideInput) {
+        inputQuery->lineEdit()->setEchoMode(HbLineEdit::Password);
+        qDebug("SATAPP: showGetInputQuery: hiding input");
+    }
+
+    // when dialog content changes, dim ok button accordingly, use
+    // use contentChanged signal from the base class of the editor
+    // to get the signal when in password mode
+    SAT_ASSERT(connect(inputQuery->lineEdit(), SIGNAL(contentsChanged()), 
+        this, SLOT(updateQueryAction())));
+    // transmit the text on OK press
+    SAT_ASSERT(connect(inputQuery->actions().at(0), SIGNAL(triggered()),
+        this, SLOT(transmitStringFromDialog())));
+    // on Cancel key complete action with ESatBackwardModeRequestedByUser
+    SAT_ASSERT(connect(inputQuery->actions().at(1), SIGNAL(triggered()),
+        mCurrentAction, SLOT(completeWithBackRequested())));
+    // after timeout, reset the provider
+    startDurationTimer(KDefaultSelectionTimeoutMseconds);
+    // open dialog. When it closes, reset everything
+    inputQuery->open();
+
+    qDebug("SATAPP: SatAppInputProvider::showGetInputQuery <");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppInputProvider::resetState
+// ----------------------------------------------------------------------------
+//
+void SatAppInputProvider::resetState()
+{
+    qDebug("SATAPP: SatAppInputProvider::resetState >");
+    if (mCurrentAction) {
+        qDebug("SATAPP: SatAppInputProvider::resetState action");        
+        mCurrentAction->completeWithNoResponse();
+        mCurrentAction = 0;
+    }
+
+    qDebug("SATAPP: SatAppInputProvider::resetState action done");
+
+    delete mCurrentDialog;
+    mCurrentDialog = 0;
+    qDebug("SATAPP: SatAppInputProvider::resetState <");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppInputProvider::composeDialog
+// make sure dlg has 2 buttons
+// ----------------------------------------------------------------------------
+//
+void SatAppInputProvider::composeDialog(
+    HbDialog *dlg,
+    DialogMode mode)
+{
+    qDebug("SATAPP: SatAppInputProvider::composeDialog >");
+    Q_ASSERT(mCurrentAction);
+
+    dlg->setModal(true);
+    dlg->setDismissPolicy(HbDialog::NoDismiss);
+
+    dlg->clearActions();
+    HbAction *primaryAction = new HbAction(dlg);
+    dlg->addAction(primaryAction);
+    
+    HbAction *secondaryAction = new HbAction(dlg);
+    dlg->addAction(secondaryAction);
+    
+    switch(mode){
+        case GetYesNo:
+        {
+            primaryAction->setText(hbTrId("txt_common_button_yes"));
+            secondaryAction->setText(hbTrId("txt_common_button_no"));
+            break;
+        }
+        case GetImmediate:
+        {
+            dlg->removeAction(primaryAction);
+            secondaryAction->setText(hbTrId("txt_common_button_cancel"));
+            break;
+        }
+        default:
+        {
+            primaryAction->setText(hbTrId("txt_common_button_ok"));
+            primaryAction->setEnabled(false);
+            secondaryAction->setText(hbTrId("txt_common_button_cancel"));
+            break;
+        }
+    }
+    qDebug("SATAPP: SatAppInputProvider::composeDialog <");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppInputProvider::updateQueryAction
+// Updates dialog's OK button according to input text length limits
+// ----------------------------------------------------------------------------
+//
+void SatAppInputProvider::updateQueryAction()
+{
+    qDebug("SATAPP: SatAppInputProvider::updateQueryAction >");
+    Q_ASSERT(mCurrentDialog);
+    QString content = 
+        qobject_cast<HbInputDialog*>(mCurrentDialog)->value().toString();
+    qDebug() << "SATAPP: updateQueryAction: content=" << content;
+    updateQueryAction(content);
+    qDebug("SATAPP: SatAppInputProvider::updateQueryAction >");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppInputProvider::updateQueryAction
+// Updates dialog's OK button according to input text length limits
+// ----------------------------------------------------------------------------
+//
+void SatAppInputProvider::updateQueryAction(QString text)
+{
+    qDebug("SATAPP: SatAppInputProvider::updateQueryAction 2>");
+    Q_ASSERT(mCurrentDialog);
+    qDebug() << "SATAPP: updateQueryAction 2: text=" << text;
+    int min=0;
+    if (mCurrentAction->hasValue(KeyMinLength))
+        min=mCurrentAction->value(KeyMinLength).toInt();
+    int max=10;
+    if (mCurrentAction->hasValue(KeyMaxLength))
+        max=mCurrentAction->value(KeyMaxLength).toInt();
+    if (mCurrentDialog->actions().at(0)) {
+        if (text.length() >= min && text.length() <= max) {
+            mCurrentDialog->actions().at(0)->setEnabled(true);
+        } else {
+            mCurrentDialog->actions().at(0)->setEnabled(false);
+        }
+    }
+    qDebug("SATAPP: SatAppInputProvider::updateQueryAction 2<");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppInputProvider::transmitInkeyFromDialog
+// ----------------------------------------------------------------------------
+//
+void SatAppInputProvider::transmitInkeyFromDialog()
+{
+    qDebug("SATAPP: SatAppInputProvider::transmitInkeyFromDialog >");
+    Q_ASSERT(mCurrentDialog);
+    Q_ASSERT(mCurrentAction->action()==ESatGetInkeyAction);
+    // grab the input string
+    HbInputDialog* inkeyQuery = static_cast<HbInputDialog*>(mCurrentDialog);
+    QString inputString = inkeyQuery->value().toString();
+    qDebug() << "SATAPP: transmitInkeyFromDialog: input=" << inputString;
+    transmitInkeyImmediately(inputString);
+    qDebug("SATAPP: SatAppInputProvider::transmitInkeyFromDialog <");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppInputProvider::transmitInkeyImmediately
+// ----------------------------------------------------------------------------
+//
+void SatAppInputProvider::transmitInkeyImmediately(QString text)
+{
+    qDebug("SATAPP: SatAppInputProvider::transmitInkeyImmediately >");
+    transmitInkey((int)text.utf16()[0]);
+    qDebug("SATAPP: SatAppInputProvider::transmitInkeyImmediately <");
+}
+
+
+// ----------------------------------------------------------------------------
+// SatAppInputProvider::transmitInkeyTrue
+// ----------------------------------------------------------------------------
+//
+void SatAppInputProvider::transmitInkeyTrue()
+{
+    qDebug("SATAPP: SatAppInputProvider::transmitInkeyTrue >");
+    Q_ASSERT(mCurrentAction);
+    Q_ASSERT(mCurrentAction->action()==ESatGetInkeyAction);
+    Q_ASSERT(mCurrentAction->value(KeyCharacterSet).toInt()==ESatYesNo);
+    transmitInkey(1);
+    qDebug("SATAPP: SatAppInputProvider::transmitInkeyTrue <");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppInputProvider::transmitInkeyFalse
+// ----------------------------------------------------------------------------
+//
+void SatAppInputProvider::transmitInkeyFalse()
+{
+    qDebug("SATAPP: SatAppInputProvider::transmitInkeyFalse >");
+    Q_ASSERT(mCurrentAction);
+    Q_ASSERT(mCurrentAction->action()==ESatGetInkeyAction);
+    Q_ASSERT(mCurrentAction->value(KeyCharacterSet).toInt()==ESatYesNo);
+    transmitInkey(0);
+    qDebug("SATAPP: SatAppInputProvider::transmitInkeyFalse >");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppInputProvider::transmit
+// ----------------------------------------------------------------------------
+//
+void SatAppInputProvider::transmitInkey(int key)
+{
+    qDebug("SATAPP: SatAppInputProvider::transmitInkey >");
+    qDebug("SATAPP: SatAppInputProvider::transmitInkey %d",key);
+    Q_ASSERT(mCurrentAction);
+    Q_ASSERT(mCurrentAction->action()==ESatGetInkeyAction);
+    // write inkey
+    mCurrentAction->set(KeyInKey,key);
+    // overwrite timer duration
+    if (mCurrentAction->hasValue(KeyDuration)) {
+        int newDuration = mInputTimer.elapsed();
+        qDebug("SATAPP: SatAppInputProvider::transmitInkey dur ", newDuration);
+        mCurrentAction->set(KeyDuration, newDuration);
+    }
+    bool immediate = mCurrentAction->value(KeyImmediate).toBool();
+    if(immediate) {
+        mCurrentDialog->close();
+    }
+    mCurrentAction->completeWithSuccess();
+    mCurrentAction = 0;
+    qDebug("SATAPP: SatAppInputProvider::transmitInkey >");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppInputProvider::transmitStringFromDialog
+// ----------------------------------------------------------------------------
+//
+void SatAppInputProvider::transmitStringFromDialog()
+{
+    qDebug("SATAPP: SatAppInputProvider::transmitStringFromDialog >");
+    Q_ASSERT(mCurrentDialog);
+    Q_ASSERT(mCurrentAction);
+    Q_ASSERT(mCurrentAction->action()==ESatGetInputAction);
+    // write input string
+    HbInputDialog* inputQuery = static_cast<HbInputDialog*>(mCurrentDialog);
+    QString inputString = inputQuery->value().toString();
+    qDebug() << "SATAPP: transmitStringFromDialog: string=" << inputString;
+
+    mCurrentAction->set(KeyInputString,inputString);
+    // overwrite timer duration
+    if (mCurrentAction->hasValue(KeyDuration)) {
+        int newDuration = mInputTimer.elapsed();
+        qDebug("SATAPP: SatAppInputProvider::transmitStringFromDialog dur ",
+            newDuration);
+        mCurrentAction->set(KeyDuration, newDuration);
+    }
+    mCurrentAction->completeWithSuccess();
+    mCurrentAction = 0;
+    qDebug("SATAPP: SatAppInputProvider::transmitStringFromDialog >");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppInputProvider::startDurationTimer
+// ----------------------------------------------------------------------------
+//
+void SatAppInputProvider::startDurationTimer(int duration)
+{
+    qDebug("SATAPP: SatAppInputProvider::startDurationTimer %d>", duration);
+    Q_ASSERT(mDurationTimer);    
+    if (duration) {
+        mDurationTimer->setSingleShot(true);
+        SAT_ASSERT(connect(mDurationTimer, SIGNAL(timeout()),
+            this, SLOT(resetState())));
+        mDurationTimer->start(duration);
+    }
+    qDebug("SATAPP: SatAppInputProvider::startDurationTimer <");    
+}
+
+// ----------------------------------------------------------------------------
+// SatAppInputProvider::clearDurationTimer
+// ----------------------------------------------------------------------------
+//
+void SatAppInputProvider::clearDurationTimer()
+{
+    qDebug("SATAPP: SatAppInputProvider::clearDurationTimer >");    
+    Q_ASSERT(mDurationTimer);
+    Q_ASSERT(mCurrentAction);
+
+    bool res = disconnect(mCurrentAction, SIGNAL(actionCompleted(SatAppAction*)),
+        this, SLOT(clearDurationTimer()));
+    qDebug("SATAPP: SatAppInputProvider::clearDurationTimer act %d>", res);
+    res = disconnect(mDurationTimer, SIGNAL(timeout()), 
+        this, SLOT(resetState()));
+    qDebug("SATAPP: SatAppInputProvider::clearDurationTimer dur %d>", res);
+    
+    mDurationTimer->stop();
+    qDebug("SATAPP: SatAppInputProvider::clearDurationTimer <");    
+}
+
+//End of file
--- a/satui/satapp/src/satappmainhandler.cpp	Tue Jul 06 14:53:02 2010 +0300
+++ b/satui/satapp/src/satappmainhandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -16,12 +16,19 @@
 *
 */
 
+#include <HbApplication>
+#include <HbActivityManager>
 #include "satappmainhandler.h"
-#include "satappuiprovider.h"
-#include "satappeventprovider.h"
-#include "satappcommandhandler.h"
-#include "satappcommonconstant.h"
-#include "tflogger.h"
+#include "satappserverdispatcher.h"
+#include "satappmenuprovider.h"
+#include "satappinputprovider.h"
+#include "satapptoneprovider.h"
+#include "satapppopupprovider.h"
+#include "satappconstant.h"
+#include "satappconfirmprovider.h"
+
+// Activity ID for Sat Application
+const char *SATAPP_ACTIVITY_ID = "SIMServicesList";
 
 // ======== MEMBER FUNCTIONS ==================================================
 
@@ -31,16 +38,19 @@
 // ----------------------------------------------------------------------------
 //
 SatAppMainHandler::SatAppMainHandler(HbMainWindow &window, 
-    QObject */*parent*/):mEvent(NULL), mUi(NULL), mCommand(NULL)
+    QObject */*parent*/)
 {
-    TFLOGSTRING("SATAPP: SatAppMainHandler::SatAppMainHandler call")
-
-    mEvent = new SatAppEventProvider(this);
-    mUi = new SatAppUiProvider(window, *mEvent, this);
-    mCommand = new SatAppCommandHandler(*mUi, this);
-
+    qDebug("SATAPP: SatAppMainHandler::SatAppMainHandler >");
+    
+    mServer = new SatAppServerDispatcher(this);
+    mMenu = new SatAppMenuProvider(&window, this);
+    mInput = new SatAppInputProvider(this);
+    mTone = new SatAppToneProvider(this);
+    mPopup = new SatAppPopupProvider(this);
+    mConfirm = new SatAppConfirmProvider(this);
     initConnections();
-    TFLOGSTRING("SATAPP: SatAppMainHandler::SatAppMainHandler exit")
+    removeActivity();
+    qDebug("SATAPP: SatAppMainHandler::SatAppMainHandler <");
 }
 
 // ----------------------------------------------------------------------------
@@ -50,7 +60,23 @@
 //
 SatAppMainHandler::~SatAppMainHandler()
 {
-    TFLOGSTRING("SATAPP: SatAppMainHandler::~SatAppMainHandler call-exit")
+    qDebug("SATAPP: SatAppMainHandler::~SatAppMainHandler");
+}
+
+// ----------------------------------------------------------------------------
+// Local override for connect-function
+// this method ENSURES that the connection is succesful.
+// ----------------------------------------------------------------------------
+//
+void doConnect(
+    const QObject *sender,
+    const char *signal,
+    const QObject *receiver,
+    const char *member)
+{
+    bool ret = QObject::connect(sender, signal,
+                receiver, member, Qt::DirectConnection);
+    Q_ASSERT_X(ret, "doConnect: connection failed for: ", signal);
 }
 
 // ----------------------------------------------------------------------------
@@ -60,181 +86,158 @@
 //
 void SatAppMainHandler::initConnections()
 {
-    TFLOGSTRING("SATAPP: SatAppMainHandler::initConnections call")
-    // For SetUpMenu
-    bool ret = connect(mEvent, SIGNAL(setUpMenuEvent(TSatUiResponse &,
-        QString, QStringList, bool, bool)),
-        mCommand, SLOT(setUpMenu(TSatUiResponse &,
-        QString, QStringList, bool, bool)),
-        Qt::DirectConnection);
-    TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \
-        SetUpMenu=%d", ret)
-    
-    // For SelectItem
-    ret = connect(mEvent, SIGNAL(selectItemEvent(TSatUiResponse&,
-        QString, QStringList, 
-        int, unsigned char&, bool, bool)),
-        mCommand, SLOT(selectItem(TSatUiResponse&,
-        QString,QStringList, 
-        int, unsigned char&, bool, bool)),
-        Qt::DirectConnection);
-    TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \
-        SelectItem=%d", ret)
-    
-    // for display text
-    ret = connect(mEvent, SIGNAL(displayTextEvent(TSatUiResponse &,
-        QString, QString, bool &, bool, int, bool)),
-        mCommand, SLOT(displayText(TSatUiResponse&,
-        QString, QString, bool &, bool, int, bool)),
-        Qt::DirectConnection);
-    
-    TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \
-        DisplayText=%d", ret)
-    
-    ret = connect(mEvent, SIGNAL(clearScreenEvent()),
-        mUi, SLOT(clearScreen()),
-        Qt::DirectConnection);
-    
-    TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \
-        ClearScreen=%d", ret)
+    qDebug("SATAPP: SatAppMainHandler::initConnections >");
+
+    // --------------------------------------
+    // MenuProvider
+    // --------------------------------------
+
+    // SetupMenu command from server
+    doConnect(
+        mServer, SIGNAL( setUpMenu( SatAppAction &) ),
+        mMenu, SLOT( setUpMenu( SatAppAction &) ) );
     
-    ret = connect(mEvent, SIGNAL(closeUiEvent()),
-        mUi, SLOT(closeUi()),
-        Qt::DirectConnection);
-    
-    TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \
-        CloseUi=%d", ret)
+    // SelectItem command from server
+    doConnect(
+        mServer, SIGNAL( selectItem( SatAppAction &) ),
+        mMenu, SLOT( selectItem( SatAppAction &) ) );
+
+    // --------------------------------------
+    // InputProvider
+    // --------------------------------------
 
-    // For GetInkey
-    ret = connect(mEvent, SIGNAL(getInkeyEvent(TSatUiResponse &,
-        QString, TSatCharacterSet, QString &,
-        bool,unsigned int &)),
-        mCommand, SLOT(getInkey(TSatUiResponse &, QString,
-        TSatCharacterSet, QString &,
-        bool, unsigned int &)),
-        Qt::DirectConnection);
-    TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \
-        GetInkey=%d", ret)
+    // GetInkey command    
+    doConnect(
+        mServer, SIGNAL( getInkey( SatAppAction &) ),
+        mInput, SLOT( getInkey( SatAppAction &) ) );
+    // GetInput command
+    doConnect(
+        mServer, SIGNAL( getInput( SatAppAction &) ),
+        mInput, SLOT( getInput( SatAppAction &) ) );
+
+    // clearScreen in InputProvider
+    doConnect(
+        mServer, SIGNAL( clearScreen() ),
+        mInput, SLOT( resetState() ));
+ 
+    // --------------------------------------
+    // Play tone
+    // --------------------------------------
+    // Play tone 
+    doConnect(
+        mServer, SIGNAL( playTone( SatAppAction &) ),
+        mTone, SLOT( playTone( SatAppAction &) ) );
 
-    ret = connect(mEvent, SIGNAL(getYesNoEvent(TSatUiResponse &,
-        QString, TSatCharacterSet, unsigned int &, //TSatIconId,
-        bool, unsigned int &, bool)),
-        mCommand, SLOT(getYesNo(TSatUiResponse &, QString,
-        TSatCharacterSet, unsigned int &, //TSatIconId,
-        bool, unsigned int &, bool)),
-        Qt::DirectConnection);
-    TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \
-        GetYesNo=%d", ret)
+    // clearScreen in tone provider
+    doConnect(
+        mServer, SIGNAL( clearScreen() ),
+        mTone, SLOT( clearScreen() ) );
+
+    // --------------------------------------
+    // Show Popups
+    // --------------------------------------
+
+    // display text
+    doConnect(
+        mServer, SIGNAL(displayText( SatAppAction & )),
+        mPopup, SLOT(displayText( SatAppAction & )));
+
+    // show notification
+    doConnect(
+        mServer, SIGNAL( notification( SatAppAction & ) ),
+        mPopup, SLOT( notification( SatAppAction & ) ) );
+
+    // hide wait note
+    doConnect(
+        mServer, SIGNAL( stopShowWaitNote() ),
+        mPopup, SLOT( stopShowWaitNote() ) );
+
+    // clearScreen in popup note provider
+    doConnect(
+        mServer, SIGNAL(clearScreen()),
+        mPopup, SLOT(clearScreen()));
     
-    // For GetInput
-    ret = connect(mEvent, SIGNAL(getInputEvent(TSatUiResponse &, QString,
-        TSatCharacterSet, QString &, int, int, bool, bool, unsigned int &)),
-        mCommand, SLOT(getInput(TSatUiResponse &, QString, TSatCharacterSet,
-        QString &, int, int, bool, bool, unsigned int &)),
-        Qt::DirectConnection);
-    TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \
-        GetInput=%d", ret)
-    
-    // For CallControl
-    ret = connect(mEvent, SIGNAL(callControlEvent(QString,
-        TSatAlphaIdStatus)),
-        mCommand, SLOT(callControl(QString, TSatAlphaIdStatus)),
-        Qt::DirectConnection);
-    TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \
-        CallControl=%d", ret)
+    // clearScreen in popup note provider
+    doConnect(
+        mServer, SIGNAL(showSsErrorNote()),
+        mPopup, SLOT(showSsErrorNote()));    
 
-    // For MoSmControl
-    ret = connect(mEvent, SIGNAL(moSmControlEvent(QString,
-        TSatAlphaIdStatus)),
-        mCommand, SLOT(moSmControl(QString, TSatAlphaIdStatus)),
-        Qt::DirectConnection);
-    TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \
-        MoSmControl=%d", ret)
+    // --------------------------------------
+    // Show Confirm
+    // --------------------------------------
+
+    // show confirmCommand
+    doConnect(
+        mServer, SIGNAL( confirmCommand( SatAppAction & ) ),
+        mConfirm, SLOT( confirmCommand( SatAppAction & ) ) );
+
+    // clearScreen
+    doConnect(
+        mServer, SIGNAL( clearScreen() ),
+        mConfirm, SLOT( clearScreen() ) );
 
-    // For send confirm
-    ret = connect(mEvent, SIGNAL(showSmsWaitNoteEvent(QString,
-        bool)),
-        mCommand, SLOT(showSmsWaitNote(QString,
-        bool)),
-        Qt::DirectConnection);
-    TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \
-        showSmsWaitNote=%d", ret)
-        
-    //For Send DTMF
-    ret = connect(mEvent, SIGNAL(showDtmfWaitNoteEvent(
-        TSatUiResponse &, QString)),
-        mCommand, SLOT(showDtmfWaitNote(
-        TSatUiResponse &, QString)),
-        Qt::DirectConnection);
-    TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \
-        showDtmfsWaitNote=%d", ret)
-    
-    //For DTMF, BIP cancel
-    ret = connect(mUi, SIGNAL(userCancelResponse()),
-                mEvent, SLOT(userCancelResponse()),
-        Qt::DirectConnection);
-    TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \
-        userCancelResponse=%d", ret)
-    
-    //Stop wait note
-    ret = connect(mEvent, SIGNAL(stopShowWaitNoteEvent()),
-        mCommand, SLOT(stopShowWaitNote()),
-        Qt::DirectConnection);
-    TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \
-        stopShowWaitNote=%d", ret)
+    // Task switcher
+    doConnect(
+        mServer, SIGNAL( setUpMenu( SatAppAction & ) ),
+        this, SLOT( updateActivity() ) );
+
+    doConnect(
+        qApp, SIGNAL( aboutToQuit() ),
+        this, SLOT( saveActivity() ) );
+
+    qDebug("SATAPP: SatAppMainHandler::initConnections <");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppMainHandler::updateActivity
+// ----------------------------------------------------------------------------
+//
+void SatAppMainHandler::updateActivity()
+{
+    qDebug("SATAPP: SatAppMainHandler::updateActivity >");
+    mActivity.insert("screenshot", mMenu->takeScreenShot());
+    qDebug("SATAPP: SatAppMainHandler::updateActivity <");
+}
 
-    // For SetUpCall
-    ret = connect(mEvent, SIGNAL(showSetUpCallConfirmEvent(
-        QString, QString, bool &)),
-        mCommand, SLOT(confirmSetUpCall(
-        QString, QString, bool &)),
-        Qt::DirectConnection);
-    TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \
-        showSetUpCallConfirm=%d", ret)
-        
-    ret = connect(mEvent, SIGNAL(showSsWaitNoteEvent(QString,
-        bool)),
-        mCommand, SLOT(showSsWaitNote(QString,
-        bool)),
-        Qt::DirectConnection);
+// ----------------------------------------------------------------------------
+// SatAppMainHandler::saveActivity
+// ----------------------------------------------------------------------------
+//
+void SatAppMainHandler::saveActivity()
+{
+    qDebug("SATAPP: SatAppMenuProvider::saveActivity >");
+
+    // Add the activity to the activity manager
+    const bool ok = qobject_cast<HbApplication*>(qApp)->activityManager()->
+        addActivity(SATAPP_ACTIVITY_ID, QVariant(), mActivity);
     
-    // For Send SS or USSD
-    TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \
-        showSsWaitNote=%d", ret)
-
-    //For showWaitNoteWithoutDelay
-    ret = connect(mEvent, SIGNAL(showWaitNoteWithoutDelayEvent()),
-        mUi, SLOT(showWaitNoteWithoutDelay()),
-        Qt::DirectConnection);
-     TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \
-        showWaitNoteWithoutDelayEvent=%d", ret)
+    qDebug("SATAPP: SatAppMenuProvider::saveActivity < %d", ok);
+}
 
-    //For showSsErrorNote
-    ret = connect(mEvent, SIGNAL(showSsErrorNoteEvent()),
-        mUi, SLOT(showSsErrorNote()),
-        Qt::DirectConnection);
-     TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \
-        showSsErrorNoteEvent=%d", ret)
+// ----------------------------------------------------------------------------
+// SatAppMainHandler::removeActivity
+// ----------------------------------------------------------------------------
+//
+void SatAppMainHandler::removeActivity()
+{
+    qDebug("SATAPP: SatAppMenuProvider::removeActivity >");
+        
+    QList<QVariantHash> activityList = 
+        qobject_cast<HbApplication*>(qApp)->activityManager()->activities();
+    qDebug("SATAPP: SatAppMenuProvider::removeActivity count=%d",
+        activityList.count());
+    foreach (QVariantHash activity, activityList){
+        if (activity.keys().contains(SATAPP_ACTIVITY_ID)){
+            mActivity = activity;
+            qDebug("SATAPP: SatAppMenuProvider::removeActivity store");
+            break;
+        }
+    }    
 
-    // For Open Channel
-    ret = connect(mEvent, SIGNAL(showOpenChannelConfirmEvent(
-        QString, bool &)),
-        mUi, SLOT(showConfirmOpenChannelQuery(
-        QString, bool &)),
-        Qt::DirectConnection);
-    TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \
-        showOpenChannelConfirm=%d", ret)
-
-    // For BIP wait note
-    ret = connect(mEvent, SIGNAL(showBIPNoteEvent(
-        int, QString)),
-        mCommand, SLOT(showBIPWaitNote(
-        int, QString)),
-        Qt::DirectConnection);
-    TFLOGSTRING2("SATAPP: SatAppMainHandler::initConnections: \
-         showBIPNote=%d", ret)
-
-    TFLOGSTRING("SATAPP: SatAppMainHandler::initConnections exit")
+    const bool ok = qobject_cast<HbApplication*>(qApp)->activityManager()->
+        removeActivity(SATAPP_ACTIVITY_ID);
+    
+    qDebug("SATAPP: SatAppMenuProvider::removeActivity < %d", ok);
 }
 
 //End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satui/satapp/src/satappmenuprovider.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,341 @@
+/*
+* 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: Provides and maintains SAT main view (selection list)
+*
+*/
+
+// qt
+#include <QObject>
+#include <QTimer>
+#include <QPixmap>
+#include <QtDebug>
+// hb
+#include <hbmainwindow.h>
+#include <hbdocumentloader.h>
+#include <hbview.h>
+#include <hbmenu.h>
+#include <hblabel.h>
+#include <hbaction.h>
+#include <hblistwidget.h>
+// satapp
+#include "satappmenuprovider.h"
+#include "satappaction.h"
+#include "satappconstant.h"
+
+// constants
+const char *SATAPP_DOCML = ":/xml/satapp.docml";
+const char *SATAPP_SETUPMENU_VIEW = "setupmenu_view";
+const char *SATAPP_SELECTITEM_VIEW = "selectitem_view";
+const char *SATAPP_MENUITEM = "s:ListWidget";
+const char *SATAPP_SELECTITEM = "t:ListWidget";
+const char *SATAPP_SUBTITLE = "t:label";
+
+
+// ----------------------------------------------------------------------------
+// SatAppMenuProvider::SatAppMenuProvider
+// ----------------------------------------------------------------------------
+//
+SatAppMenuProvider::SatAppMenuProvider(HbMainWindow *window,QObject *parent)
+    : QObject(parent), mMainWindow(window),mSetupMenuView(0),
+      mSelectItemView(0),mSoftKeyQuitAction(0),mSoftKeyBackAction(0),
+      mListWidget(0),mSelectListWidget(0),mSubTitle(0),mCurrentAction(0)
+{
+    qDebug("SATAPP: SatAppMenuProvider::SatAppMenuProvider");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppMenuProvider::~SatAppMenuProvider
+// ----------------------------------------------------------------------------
+//
+SatAppMenuProvider::~SatAppMenuProvider()
+{
+    qDebug("SATAPP: SatAppMenuProvider::~SatAppMenuProvider >");
+    resetState();
+    // delete all objects created from DOCML.
+    while (!mObjects.isEmpty()) {
+        delete mObjects.takeFirst();
+    }
+    // delete actions
+    delete mSoftKeyQuitAction;
+    delete mSoftKeyBackAction;
+    qDebug("SATAPP: SatAppMenuProvider::~SatAppMenuProvider <");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppMenuProvider::takeScreenShot
+// ----------------------------------------------------------------------------
+//
+QPixmap SatAppMenuProvider::takeScreenShot()
+{
+    qDebug("SATAPP: SatAppMenuProvider::takeScreenShot");
+    return QPixmap::grabWidget(mMainWindow, mMainWindow->rect());
+}
+
+// ----------------------------------------------------------------------------
+// SatAppMenuProvider::loadMainView
+// ----------------------------------------------------------------------------
+//
+void SatAppMenuProvider::loadMainView()
+{
+    qDebug("SATAPP: SatAppMenuProvider::loadMainView >");
+
+    // create actions
+    mSoftKeyQuitAction = new HbAction(Hb::QuitNaviAction,this);
+    mSoftKeyBackAction = new HbAction(Hb::BackNaviAction,this);
+
+    bool docmlLoad = false;
+    HbDocumentLoader loader;
+    // ownership of the objects are transferred to caller
+    mObjects = loader.load(SATAPP_DOCML,&docmlLoad);
+    Q_ASSERT(docmlLoad);
+    qDebug("SATAPP: SatAppMenuProvider main view found");
+    // load setupmenu view
+    mSetupMenuView = qobject_cast<HbView *>(loader.findWidget
+            (SATAPP_SETUPMENU_VIEW));
+    // find setupmenu view items
+    mListWidget = qobject_cast<HbListWidget *>
+        ( loader.findWidget(SATAPP_MENUITEM ));
+    // connect setupmenu view menu
+    HbAction *menuAction = mSetupMenuView->menu()->addAction(
+        hbTrId("txt_common_menu_exit"));
+    SAT_ASSERT(connect(menuAction, SIGNAL(triggered()),
+        mMainWindow, SLOT(close())));
+    SAT_ASSERT(connect(mSoftKeyQuitAction, SIGNAL(triggered()),
+        mMainWindow, SLOT(close())));
+    // set this view as current view
+    mMainWindow->addView(mSetupMenuView);
+    mMainWindow->setCurrentView(mSetupMenuView);
+
+    // load selectitem view
+    mSelectItemView = qobject_cast<HbView *>(loader.findWidget
+            (SATAPP_SELECTITEM_VIEW));
+    // find selectitem view items
+    mSubTitle = qobject_cast<HbLabel *>
+        ( loader.findWidget(SATAPP_SUBTITLE) );
+    mSelectListWidget = qobject_cast<HbListWidget *>
+        ( loader.findWidget(SATAPP_SELECTITEM ));
+    // connect selectitem view menu
+    HbAction *menuBack = mSelectItemView->menu()->addAction(
+        hbTrId("txt_common_opt_back"));
+    SAT_ASSERT(connect(menuBack, SIGNAL(triggered()),
+        mSoftKeyBackAction, SIGNAL(triggered())));
+    HbAction *menuQuit = mSelectItemView->menu()->addAction(
+        hbTrId("txt_common_menu_exit"));
+
+    SAT_ASSERT(connect(menuQuit, SIGNAL(triggered()),
+        mMainWindow, SLOT(close())));
+    qDebug("SATAPP: SatAppMenuProvider::loadMainView <");
+
+}
+
+// ----------------------------------------------------------------------------
+// switchView
+// ----------------------------------------------------------------------------
+//
+void SatAppMenuProvider::switchView()
+{
+    qDebug("SATAPP: SatAppMenuProvider::switchView >");
+    if (mCurrentAction && ESatSelectItemAction == mCurrentAction->action()) {
+        // switch to select item view
+        mMainWindow->removeView(mMainWindow->currentView());
+        mMainWindow->addView(mSelectItemView);
+        mMainWindow->setCurrentView(mSelectItemView);
+    } else {
+        // switch to main menu view
+        mMainWindow->removeView(mMainWindow->currentView());
+        mMainWindow->addView(mSetupMenuView);
+        mMainWindow->setCurrentView(mSetupMenuView);
+    }
+    qDebug("SATAPP: SatAppMenuProvider::switchView <");
+}
+
+
+// ----------------------------------------------------------------------------
+// SatAppMenuProvider::setUpMenu
+// constructs a menu in the main SAT application view
+// ----------------------------------------------------------------------------
+//
+void SatAppMenuProvider::setUpMenu(SatAppAction &action)
+{
+    qDebug("SATAPP: SatAppMenuProvider::setUpMenu >");
+    if (!mSetupMenuView) loadMainView();
+    resetState();
+    mCurrentAction = &action;
+    switchView();
+    action.setResponse(ESatSuccess);
+
+    // The text is the application name
+    // should be shown on the menu area always
+    QString text = action.value(KeyText).toString();
+    if (!text.isEmpty()) {
+        mSetupMenuView->setTitle(text);
+        mSelectItemView->setTitle(text);
+    }
+    qDebug() << "SATAPP: SetUpMenu title=" << text;
+
+    // build the menu
+    QList<QVariant> menu = action.value(KeyMenu).toList();
+    mListWidget->clear();
+    for(int i = 0; i < menu.count(); i++ ) {
+        mListWidget->addItem(menu.at(i).toString());
+    }
+    qDebug() << "SATAPP: SetUpMenu menu=" << menu;
+
+    // back-key quits the application
+    mSetupMenuView->setNavigationAction(mSoftKeyQuitAction);
+    // completes action with ESatSuccess and selected item
+    connectItem();
+
+    qDebug("SATAPP: SatAppMenuProvider::setUpMenu <");
+}
+
+
+// ----------------------------------------------------------------------------
+// SatAppMenuProvider::selectItem
+// Constructs a SETECT ITEM view
+// ----------------------------------------------------------------------------
+//
+void SatAppMenuProvider::selectItem( SatAppAction &action)
+{
+    qDebug("SATAPP: SatAppMenuProvider::selectItem >");
+
+    resetState();
+    mCurrentAction = &action;
+    switchView();
+    action.setResponse(ESatSuccess);
+
+    // Set sub title
+    QString text = action.value(KeyText).toString();
+    if (!text.isEmpty()) {
+        mSubTitle->setPlainText(text);
+    } else {
+        mSubTitle->setPlainText(hbTrId("txt_long_caption_sim_services"));
+    }
+    qDebug() << "SATAPP: selectItem text=" << text;
+
+    // Set List widget
+    QList<QVariant> menu = action.value(KeyMenu).toList();
+    mSelectListWidget->clear();
+    for(int i = 0; i < menu.count(); i++ ) {
+        mSelectListWidget->addItem(menu.at( i ).toString());
+    }
+    qDebug() << "SATAPP: selectItem menu=" << menu;
+
+    // timeout completes action with ESatNoResponseFromUser
+    QTimer::singleShot(KDefaultSelectionTimeoutMseconds,
+        mCurrentAction,SLOT(completeWithNoResponse()));
+    // back-key completes action with ESatBackwardModeRequestedByUser
+    mSelectItemView->setNavigationAction(mSoftKeyBackAction);
+    SAT_ASSERT(connect(mSoftKeyBackAction, SIGNAL(triggered()),
+        mCurrentAction, SLOT(completeWithBackRequested())));
+    SAT_ASSERT(connect(mSelectItemView->menu()->actions().at(1), 
+        SIGNAL(triggered()),
+        mCurrentAction, SLOT(completeWithSessionTerminated())));
+    
+    // completes action with ESatSuccess and selected item
+    connectItem();
+
+    qDebug("SATAPP: SatAppMenuProvider::selectItem <");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppMenuProvider::resetState
+// terminates ongoing events and clears the screen
+// ----------------------------------------------------------------------------
+//
+void SatAppMenuProvider::resetState()
+{
+    qDebug("SATAPP: SatAppMenuProvider::resetState >");
+    mCurrentAction = 0;
+    disconnectItem();
+    qDebug("SATAPP: SatAppMenuProvider::resetState <");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppMenuProvider::menuItemSelected
+// (Menu item selected).
+// ----------------------------------------------------------------------------
+//
+void SatAppMenuProvider::menuItemSelected(HbListWidgetItem *item)
+{
+    qDebug("SATAPP: SatAppMenuProvider::menuItemSelected >");
+    Q_ASSERT(mCurrentAction);
+    if (ESatSetUpMenuAction == mCurrentAction->action()) {
+        int index = mListWidget->row(item);
+        mCurrentAction->set(KeySelection,index);
+        mCurrentAction->set(KeyHelpRequested,false);
+        mCurrentAction->completeWithSuccess();
+    } else if(ESatSelectItemAction == mCurrentAction->action()) {
+        int index = mSelectListWidget->row(item);
+        mCurrentAction->set(KeySelection,index);
+        mCurrentAction->completeWithSuccess();
+    }
+    qDebug("SATAPP: SatAppMenuProvider::menuItemSelected <");
+}
+
+
+// ----------------------------------------------------------------------------
+// SatAppMenuProvider::connectItem
+// (Connect listwidget item).
+// ----------------------------------------------------------------------------
+//
+void SatAppMenuProvider::connectItem()
+{
+    qDebug("SATAPP: SatAppMenuProvider::connectItem >");
+    Q_ASSERT(mCurrentAction);
+    if (ESatSetUpMenuAction == mCurrentAction->action()) {
+        SAT_ASSERT(connect(
+            mListWidget, SIGNAL(activated(HbListWidgetItem *)), 
+            this, SLOT(menuItemSelected(HbListWidgetItem *))));
+        SAT_ASSERT(connect(
+            mListWidget, 
+            SIGNAL(longPressed(HbListWidgetItem *, const QPointF &)), 
+            this, SLOT(menuItemSelected(HbListWidgetItem *))));
+    } else if(mCurrentAction->action()== ESatSelectItemAction) {
+        SAT_ASSERT(connect(
+            mSelectListWidget, SIGNAL(activated(HbListWidgetItem *)), 
+            this, SLOT(menuItemSelected(HbListWidgetItem *))));
+        SAT_ASSERT(connect(
+            mSelectListWidget, 
+            SIGNAL(longPressed(HbListWidgetItem*, const QPointF &)), 
+            this, SLOT(menuItemSelected(HbListWidgetItem *))));
+    }
+    qDebug("SATAPP: SatAppMenuProvider::connectItem <");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppMenuProvider::disconnectItem
+// (Disconnect listwidget item).
+// ----------------------------------------------------------------------------
+//
+void SatAppMenuProvider::disconnectItem()
+{
+    qDebug("SATAPP: SatAppMenuProvider::disconnectItem >");
+    // setup menu view
+    disconnect(mListWidget, SIGNAL( activated(HbListWidgetItem *)),
+          this, SLOT( menuItemSelected( HbListWidgetItem *)));        
+    disconnect(
+        mListWidget, SIGNAL(longPressed(HbListWidgetItem*, const QPointF &)), 
+        this, SLOT(menuItemSelected(HbListWidgetItem *)));
+    // select item view
+    disconnect(mSelectListWidget, SIGNAL( activated(HbListWidgetItem *)),
+          this, SLOT( menuItemSelected( HbListWidgetItem *)));
+    disconnect(
+        mSelectListWidget, 
+        SIGNAL(longPressed(HbListWidgetItem*, const QPointF &)), 
+        this, SLOT(menuItemSelected(HbListWidgetItem *)));
+    qDebug("SATAPP: SatAppMenuProvider::disconnectItem <");
+}
+
+//End of file
--- a/satui/satapp/src/satappplaytoneprovider.cpp	Tue Jul 06 14:53:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,554 +0,0 @@
-/*
-* 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:
-*
-*/
-
-
-// PlayStandardTone
-#include    <MProfile.h>
-#include    <MProfileEngine.h>
-#include    <MProfileTones.h>
-#include    <TProfileToneSettings.h>
-#include    <AudioPreference.h> //KAudioPriorityLowLevel
-#include    <mda/common/resource.h>//KMdaRepeatForever
-#include    <QTimer> // timeout callback
-#include    <hbmessagebox.h>//playtone note
-#include    <mdaaudiotoneplayer.h>// for CMdaAudioToneUtility&CMdaAudioPlayerUtility
-#include    <e32std.h>//TTimeIntervalMicroSeconds
-
-#include "satappplaytoneprovider.h"
-#include "satappcommonconstant.h"
-#include "tflogger.h"
-
-//const
-// Maximum length for sound file. 
-const TInt KMaxSoundFileLength = 256;
-// Used when dividing some values. Used only for preventing the use of magic 
-// numbers
-// Audio sample is repeated indefinitely.
-const TInt KSoundPlayerRepeatForever = KMdaRepeatForever;
-
-// The max volume value from settings.
-// From TProfileToneSettings.h
-const TInt KMaxVolumeFromProfile( 10 );
-
-
-// ----------------------------------------------------------------------------
-// SatAppPlayToneProvider::SatAppPlayToneProvider
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-SatAppPlayToneProvider::SatAppPlayToneProvider(QObject *parent) :
-    QObject(parent), mWarningAndPlayTones(false),mVolume(0),
-    mPlayer(0),mPlayToneError(ESatSuccess), mTimer(0),mLoop(0),
-    mPermanentNote(0), mAudioPlayer(0)
-{
-    TFLOGSTRING("SATAPP: SatAppPlayToneProvider::SatAppPlayToneProvider call")
-    TFLOGSTRING("SATAPP: SatAppPlayToneProvider::SatAppPlayToneProvider exit")
-}
-
-// ----------------------------------------------------------------------------
-// SatAppPlayToneProvider::~SatAppPlayToneProvider
-// Sets a pointer to CSatUiViewAppUi object.
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-SatAppPlayToneProvider::~SatAppPlayToneProvider()
-{
-    TFLOGSTRING("SATAPP: SatAppPlayToneProvider::~SatAppPlayToneProvider call")
-    stopPlayTone();
-    if (mPermanentNote) {
-        TFLOGSTRING("SATAPP: SatAppPlayToneProvider::~SatAppPlayToneProvider note 0")
-        delete mPermanentNote;
-        mPermanentNote = 0;
-    }
-    if (mTimer) {
-        TFLOGSTRING("SATAPP: SatAppPlayToneProvider::~SatAppPlayToneProvider timer 0")
-        delete mTimer;
-        mTimer = 0;
-    }
-    if (mLoop) {
-        TFLOGSTRING("SatAppPlayToneProvider::~SatAppPlayToneProvider loop 0")
-        delete mLoop;
-        mLoop = 0;
-    }
-    TFLOGSTRING("SATAPP: SatAppPlayToneProvider::~SatAppPlayToneProvider exit")
-}
-
-//-----------------------------------------------------------------------------
-// SatAppPlayToneProvider::PlayStandardToneL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-TSatUiResponse SatAppPlayToneProvider::PlayStandardToneL( const TDesC& aText,
-    const TDesC8& aSequence,
-    TTimeIntervalMicroSeconds aDuration,
-    const CFbsBitmap* /*aIconBitmap*/,
-    const TBool aSelfExplanatory )
-{
-    TFLOGSTRING("SATAPP: SatAppPlayToneProvider::PlayStandardToneL call")
-    if (mTimer) {
-        if (mTimer->isActive()) {
-            mTimer->stop();
-        }
-        delete mTimer;
-        mTimer = 0;
-        TFLOGSTRING("SatAppPlayToneProvider::PlayStandardToneL delete timer")
-    }
-    if (mLoop) {
-        TFLOGSTRING("SatAppPlayToneProvider::PlayStandardToneL delete loop")
-        if (mLoop->isRunning()) {
-            mLoop->exit();
-        }
-        delete mLoop;
-        mLoop = 0;
-    }
-
-    TSatUiResponse response(ESatSuccess);
-    unsigned int duration(0);
-    if (aDuration > 0) {
-        duration = aDuration.Int64() / 1000;
-    }
-    TFLOGSTRING2("SATAPP: SatAppPlayToneProvider::PlayStandardToneL \
-     duration microseconds %d", duration)
-    QString text;
-    mLoop = new QEventLoop(this);
-    if (aText.Length() > 0) {
-        text = QString::fromUtf16(aText.Ptr(), aText.Length());
-        TFLOGSTRING2("SATAPP: SatAppPlayToneProvider::PlayStandardToneL \
-            text=%S", &aText)
-        mPermanentNote = new HbMessageBox(HbMessageBox::MessageTypeInformation);
-        bool ret = connect(mPermanentNote, SIGNAL(aboutToClose()),
-                this, SLOT(stopPlayTone()));
-        TFLOGSTRING2("SATAPP: SatAppPlayToneProvider::PlayStandardToneL connect \
-           note close to timer stop: %d", ret)
-
-        bool selfExplanatory = aSelfExplanatory;
-        if (!selfExplanatory) {
-            mPermanentNote->setText(text);
-            if (duration > 0 ) {
-                mPermanentNote->setTimeout(duration);
-            }
-            mPermanentNote->setDismissPolicy(HbPopup::TapAnywhere);
-            TFLOGSTRING("SatAppPlayToneProvider::PlayStandardToneL show before")
-            mPermanentNote->show();
-            TFLOGSTRING("SatAppPlayToneProvider::PlayStandardToneL show after")
-        }
-    }
-
-    if (mPlayer) {
-        delete mPlayer;
-        mPlayer = 0;
-    }
-    mPlayer = CMdaAudioToneUtility::NewL(*this);
-    TInt volume(mPlayer->MaxVolume());
-    mPlayer->SetVolume(volume);
-    mPlayer->PrepareToPlayDesSequence(aSequence);
-
-    if (duration > 0) {
-        mTimer = new QTimer(this);
-        bool ret = connect(mTimer, SIGNAL(timeout()),
-                this, SLOT(stopPlayTone()));
-        TFLOGSTRING2("SATAPP: SatAppPlayToneProvider::PlayStandardToneL \
-                connect mTimer stop: %d", ret)
-        mTimer->start(duration);
-    }
-
-    if (mLoop) {
-        TFLOGSTRING("SATAPP: SatAppPlayToneProvider::PlayStandardToneL loop")
-        mLoop->exec(QEventLoop::AllEvents);
-        TFLOGSTRING("SATAPP: SatAppPlayToneProvider::PlayStandardToneL quit loop")
-        delete mLoop;
-        mLoop = 0;
-    }
-    if (mPermanentNote) {
-        TFLOGSTRING("SATAPP: SatAppPlayToneProvider::PlayStandardToneL note 0")
-        delete mPermanentNote;
-        mPermanentNote = 0;
-    }
-    if (mTimer) {
-        TFLOGSTRING("SATAPP: SatAppPlayToneProvider::PlayStandardToneL timer 0")
-        delete mTimer;
-        mTimer = 0;
-    }
-
-
-    TFLOGSTRING("SATAPP: SatAppPlayToneProvider::PlayStandardToneL before play cancel")
-    mPlayer->CancelPlay();
-    delete mPlayer;
-    mPlayer = NULL;
-
-    //get warning and game tones setting from active profile
-    GetProfileParamsL();
-    if((EFalse == mWarningAndPlayTones) && 
-          (ESatSuccess == mPlayToneError)) {
-        mPlayToneError = ESatSuccessToneNotPlayed;
-    }
-    response = mPlayToneError;
-    TFLOGSTRING("SATAPP: SatAppPlayToneProvider::PlayStandardToneL exit")
-    return response;
-}
-
-
-// ---------------------------------------------------------
-// SatAppCommandHandler::GetProfileParamsL
-// Get and store settings from current profile 
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-void SatAppPlayToneProvider::GetProfileParamsL( TSatTone aTone /*= ESatToneNotSet*/,
-                                         TDes* aToneName /*= NULL*/ )
-{
-    TFLOGSTRING( "SatAppCommandHandler::GetProfileParamsL calling" )
-    MProfile* profile = NULL;
-    MProfileEngine* engine = NULL;
-    engine = CreateProfileEngineL();
-    CleanupReleasePushL( *engine );
-
-    profile = engine->ActiveProfileLC();
-
-    const MProfileTones& tones = profile->ProfileTones();
-
-    // Takes a current warning and gametones setting.
-    const TProfileToneSettings& ts = tones.ToneSettings();
-    mWarningAndPlayTones = ts.iWarningAndGameTones;
-    mVolume = ts.iRingingVolume;
-    
-    TFLOGSTRING2( "SatAppCommandHandler::GetProfileParamsL \
-        mVolume before mapping %d", mVolume )
-    
-    // Max volume from profile is KMaxVolumeFromProfile, Max volume from 
-    // CMdaAudioToneUtility is different, maybe 10,000. So, 
-    // rate = maxVolumeFromPlayer / KMaxVolumeFromProfile
-    // User may never hear the TONE, because volume is too small.
-    // iVolume times the rate make it can be heard.
-    
-    CMdaAudioToneUtility* toneUtl = CMdaAudioToneUtility::NewL( *this );
-    TInt maxVolumeFromPlayer( toneUtl->MaxVolume() );
-    mVolume *= maxVolumeFromPlayer / KMaxVolumeFromProfile;
-    delete toneUtl;
-    toneUtl = NULL;
-    TFLOGSTRING2( "CSatUiViewAppUi::GetProfileParamsL \
-        mVolume after mapping %d", mVolume )
-    
-    if ( ( ESatUserSelectedToneIncomingSms == aTone ) && ( aToneName ) )
-        {
-        TFLOGSTRING("SatAppCommandHandler::GetProfileParamsL message tone")
-        aToneName->Copy( tones.MessageAlertTone() );
-    } else if( aToneName ) {
-        TFLOGSTRING("SatAppCommandHandler::GetProfileParamsL ring tone")
-        aToneName->Copy( tones.RingingTone1() );
-    }
-
-    CleanupStack::PopAndDestroy(2); // engine, profile
-    TFLOGSTRING("SatAppCommandHandler::GetProfileParamsL exits")
-}
-
-// ---------------------------------------------------------
-// SatAppPlayToneProvider::MatoPrepareComplete
-// Indicates success or failure.
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-void SatAppPlayToneProvider::MatoPrepareComplete(TInt aError)
-{
-    TFLOGSTRING2("SatAppPlayToneProvider::MatoPrepareComplete called\
-        aError = %d", aError)
-    if (KErrNone == aError && mPlayer) {
-        mPlayToneError = ESatSuccess;
-        TTimeIntervalMicroSeconds zero(static_cast<TInt64>( 0 ));
-        mPlayer->SetPriority(KAudioPriorityLowLevel,
-               STATIC_CAST(TMdaPriorityPreference, KAudioPrefConfirmation));
-        mPlayer->SetRepeats( KMdaAudioToneRepeatForever, zero );
-        mPlayer->Play();
-    } else {
-        mPlayToneError = ESatFailure;
-    }
-    TFLOGSTRING( "SatAppPlayToneProvider::MatoPrepareComplete exit" )
-}
-
-//-----------------------------------------------------------------------------
-// SatAppPlayToneProvider::MatoPlayComplete
-// Indicates success or failure.
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void SatAppPlayToneProvider::MatoPlayComplete( TInt aError )
-{
-    TFLOGSTRING("SatAppPlayToneProvider::MatoPlayComplete calling")
-    if (KErrNone == aError && mPlayer) {
-        TFLOGSTRING("SatAppPlayToneProvider::MatoPlayComplete play")
-        mPlayer->Play();
-    } else {
-        TFLOGSTRING( "SatAppPlayToneProvider::MatoPlayComplete stop playing")
-        // Stops playing if error.
-        stopPlayTone();
-    }
-    TFLOGSTRING2("SatAppPlayToneProvider::MatoPlayComplete exit error %d", aError)
-}
-
-//-----------------------------------------------------------------------------
-// SatAppPlayToneProvider::PlayUserSelectedToneL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-TSatUiResponse SatAppPlayToneProvider::PlayUserSelectedToneL(
-        const TDesC &aText,
-        TTimeIntervalMicroSeconds aDuration,
-        TSatTone aTone,
-        const CFbsBitmap* /*aIconBitmap*/,
-        const TBool aSelfExplanatory )
-{
-    TFLOGSTRING("SatAppPlayToneProvider::PlayUserSelectedToneL calling")
-    if (mTimer) {
-        delete mTimer;
-        mTimer = 0;
-        TFLOGSTRING("SatAppPlayToneProvider::PlayUserSelectedToneL delete timer")
-    }
-    if (mLoop) {
-        delete mLoop;
-        mLoop = 0;
-        TFLOGSTRING("SatAppPlayToneProvider::PlayUserSelectedToneL delete loop")
-    }
-    unsigned int duration(0);
-    if (aDuration > 0) {
-        duration = aDuration.Int64() / KPlayToneSymbianConvertQtTime;
-        TFLOGSTRING2("SatAppPlayToneProvider::PlayUserSelectedToneL duration %d",
-                duration)
-    }
-
-    QString text;
-    if (aText.Length() > 0) {
-        text = QString::fromUtf16(aText.Ptr(), aText.Length());
-        TFLOGSTRING2("SATAPP: SatAppPlayToneProvider::PlayUserSelectedToneL \
-            text=%S", &aText)
-        mPermanentNote = new HbMessageBox(HbMessageBox::MessageTypeInformation);
-        bool selfExplanatory = aSelfExplanatory;
-        if (!selfExplanatory) {
-            mPermanentNote->setText(text);
-            if (duration) {
-                mPermanentNote->setTimeout(duration);
-            }
-            mPermanentNote->setDismissPolicy(HbPopup::TapAnywhere);
-            TFLOGSTRING("SatAppPlayToneProvider::PlayUserSelectedToneL show before")
-            mPermanentNote->show();
-            TFLOGSTRING("SatAppPlayToneProvider::PlayUserSelectedToneL show after")
-        }
-    }
-
-    // If several messages/calls arrive during a small amount of time and if the
-    // message received or incoming call tone is already being played we do not 
-    // restart it.
-    if (mAudioPlayer) {
-        TFLOGSTRING( "SatAppPlayToneProvider::\
-            PlayUserSelectedToneL Error - already played" )
-        return ESatFailure;
-    }
-
-    TSatUiResponse response(ESatSuccess);
-    // This defines name for the current message alert or incoming call tone. 
-    TBuf<KMaxSoundFileLength> soundFileName;
-    GetProfileParamsL( aTone, &soundFileName );
-    // This defines the behaviour to be adopted by an
-    // audio client if a higher priority client takes over the device.
-    TInt mdaPriority( KAudioPrefIncomingCall );
-    // This is used to resolve conflicts when more than one client tries to 
-    // access the same sound output device simultaneously.
-    TInt audioPriority( KAudioPriorityPhoneCall );
-
-    TFLOGSTRING2( "SATAPP: SatAppPlayToneProvider::PlayUserSelectedToneL\
-        Volume is %d ", mVolume )
-
-    // Creates the audio player.
-    mAudioPlayer = CMdaAudioPlayerUtility::NewFilePlayerL( 
-        soundFileName,
-        *this,
-        audioPriority,
-        ( TMdaPriorityPreference ) mdaPriority );
-
-    if (aDuration > 0) {
-        TFLOGSTRING( "SATAPP: SatAppPlayToneProvider::PlayUserSelectedToneL\
-         duration not 0" )
-        mAudioPlayer->SetRepeats( KSoundPlayerRepeatForever, 
-                                  TTimeIntervalMicroSeconds( 
-                                  static_cast<TInt64>( 0 ) ) );
-        mTimer = new QTimer(this);
-        mTimer->start(duration);
-        mLoop = new QEventLoop(this);
-        bool ret = connect(mTimer, SIGNAL(timeout()), this, SLOT(stopPlayTone()));
-        TFLOGSTRING2("SATAPP: SatAppPlayToneProvider::PlayUserSelectedToneL\
-                connect mTimer stop: %d", ret)
-
-        if (mPermanentNote) {
-            ret = connect(mPermanentNote, SIGNAL(aboutToClose()),
-                    this, SLOT(stopPlayTone()));
-            TFLOGSTRING2("SATAPP: SatAppPlayToneProvider::PlayUserSelectedToneL \
-               connect note close to timer stop: %d", ret)
-        }
-        if (mLoop) {
-            mLoop->exec(QEventLoop::AllEvents);
-            TFLOGSTRING("SATAPP: SatAppPlayToneProvider::PlayUserSelectedToneL quit loop")
-            delete mLoop;
-            mLoop = 0;
-        }
-        if (mPermanentNote) {
-            TFLOGSTRING("SATAPP: SatAppPlayToneProvider::PlayUserSelectedToneL note 0")
-            delete mPermanentNote;
-            mPermanentNote = 0;
-        }
-        if (mTimer) {
-            TFLOGSTRING("SATAPP: SatAppPlayToneProvider::PlayUserSelectedToneL timer 0")
-            delete mTimer;
-            mTimer = 0;
-        }
-        // Sample is played in forever loop for the duration.
-        // After duration call back timers are destroyed       
-        // If player exists, stop playing and delete player. MapcPlayComplete
-        // is not called because CallBackTimer stops the playing.
-        if (mAudioPlayer) {
-            mAudioPlayer->Stop();
-            delete mAudioPlayer;
-            mAudioPlayer = 0;
-            TFLOGSTRING( "SatAppPlayToneProvider::PlayUserSelectedToneL\
-                mAudioPlayer deleted" )
-        }
-    } else {
-        // If duration is zero then tone is played only once.
-        // Playing duration is same as duration of the sample.
-        mAudioPlayer->SetRepeats(
-            0, TTimeIntervalMicroSeconds( static_cast<TInt64>( 0 ) ) );
-        TFLOGSTRING( "SatAppPlayToneProvider::PlayUserSelectedToneL SetRepeats 0" )
-    }
-
-    TFLOGSTRING( "SatAppPlayToneProvider::PlayUserSelectedToneL exit" )
-    if( EFalse == mWarningAndPlayTones ) {
-        response = ESatSuccessToneNotPlayed;
-    }
-
-    TFLOGSTRING( "SatAppPlayToneProvider::PlayUserSelectedToneL exit" )
-    return response;
-}
-
-//-----------------------------------------------------------------------------
-// SatAppPlayToneProvider::MapcInitComplete
-// Plays the tone.
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-void SatAppPlayToneProvider::MapcInitComplete( TInt aError, 
-    const TTimeIntervalMicroSeconds& /*aDuration*/ )
-{
-    TFLOGSTRING( "SatAppPlayToneProvider::MapcInitComplete called" )
-    // Audio player is initialised, so if there is no error, we can start 
-    // playing the tone.
-    if (KErrNone == aError && mAudioPlayer) {
-        const TInt volume( Max(0, Min(mVolume, 
-                           mAudioPlayer->MaxVolume())));
-        TFLOGSTRING2("CSatUiViewAppUi::\
-            MapcInitComplete SetVolume %d", volume )
-        // Set volume according Settings. 
-        mAudioPlayer->SetVolume( volume );
-        mAudioPlayer->Play();
-        TFLOGSTRING( "SatAppPlayToneProvider::MapcInitComplete Play" )
-    } else {
-        // Otherwise, we delete the initialised audio player.
-        if ( mAudioPlayer ) {
-            TFLOGSTRING( "SatAppPlayToneProvider::MapcInitComplete mAudioPlayer \
-                          true" )
-            delete mAudioPlayer;
-            mAudioPlayer = 0;
-     }
-
-        // Remove also the note for play tone
-        // If there was a duration for play tone, stop waiting
-        stopPlayTone();
-
-        TFLOGSTRING2( "SatAppPlayToneProvider::MapcInitComplete Error %d", aError )
-    }
-    TFLOGSTRING( "SatAppPlayToneProvider::MapcInitComplete exit" )
-}
-
-//-----------------------------------------------------------------------------
-// SatAppPlayToneProvider::MapcPlayComplete
-// Deletes audio player after playing is completed.
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-void SatAppPlayToneProvider::MapcPlayComplete( TInt /*aError*/ )
-{
-    TFLOGSTRING( "SatAppPlayToneProvider::MapcPlayComplete called" )
-
-    // When playing is completed, deleting the audio player.
-    if ( mAudioPlayer ) {
-        TFLOGSTRING("SatAppPlayToneProvider::MapcPlayComplete delete mAudioPlayer")
-        delete mAudioPlayer;
-        mAudioPlayer = 0;
-    }
-    // Remove note after play has completed.
-    stopPlayTone();
-    TFLOGSTRING("SatAppPlayToneProvider::MapcPlayComplete exit")
-}
-
-// ----------------------------------------------------------------------------
-// SatAppPlayToneProvider::clearScreen
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void SatAppPlayToneProvider::clearScreen()
-{
-    TFLOGSTRING("SATAPP: SatAppEventProvider::ClearScreen call")
-    stopPlayTone();
-    TFLOGSTRING("SATAPP: SatAppEventProvider::ClearScreen exit")
-}
-
-// ----------------------------------------------------------------------------
-// SatAppPlayToneProvider::clearScreen
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void SatAppPlayToneProvider::closeSatUI()
-{
-    TFLOGSTRING("SATAPP: SatAppEventProvider::closeSatUI call")
-    clearScreen();
-    TFLOGSTRING("SATAPP: SatAppEventProvider::closeSatUI exit")
-}
-
-// ----------------------------------------------------------------------------
-// SatAppPlayToneProvider::stopPlayTone
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void SatAppPlayToneProvider::stopPlayTone()
-{
-    TFLOGSTRING("SATAPP: SatAppEventProvider::stopPlayTone call")
-     if (mPermanentNote) {
-        TFLOGSTRING("SatAppPlayToneProvider::stopPlayTone delete mPermanentNote")
-        disconnect(mPermanentNote,SIGNAL(aboutToClose()),
-                this, SLOT(stopPlayTone())); 
-        mPermanentNote->close();
-    }
-    if (mTimer) {
-        TFLOGSTRING("SatAppPlayToneProvider::stopPlayTone delete timer")
-        disconnect(mTimer,SIGNAL(timeout()), this, SLOT(stopPlayTone()));
-        if (mTimer->isActive()) {
-            mTimer->stop();
-        }
-    }
-    if (mLoop && mLoop->isRunning()) {
-        TFLOGSTRING("SatAppPlayToneProvider::stopPlayTone exit loop")
-        mLoop->exit();
-    }
-    TFLOGSTRING("SATAPP: SatAppEventProvider::stopPlayTone exit")
-}
-
- //End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satui/satapp/src/satapppopupprovider.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,501 @@
+/*
+* 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: 
+*
+*/
+
+// qt
+#include <QAction>
+#include <QTimer>
+#include <QtDebug>
+// hb
+#include <hbmessagebox.h>
+#include <hbprogressdialog.h>
+#include <hbdevicemessagebox.h>
+#include <hblabel.h>
+#include <hbaction.h>
+// satapp
+#include "satapppopupprovider.h"
+#include "satappconstant.h"
+#include "satappaction.h"
+
+
+// ----------------------------------------------------------------------------
+// SatAppPopupProvider::SatAppPopupProvider
+// ----------------------------------------------------------------------------
+//
+SatAppPopupProvider::SatAppPopupProvider( QObject *parent)
+    : QObject(parent), mDisplayText(0), mWaitDialog(0),
+      mWaitDeviceDialog(0), mAction(0)
+{
+    qDebug("SATAPP: SatAppPopupProvider::SatAppPopupProvider");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppPopupProvider::~SatAppPopupProvider
+// ----------------------------------------------------------------------------
+//
+SatAppPopupProvider::~SatAppPopupProvider()
+{
+    qDebug("SATAPP: SatAppPopupProvider::~SatAppPopupProvider >");
+    clearScreen();
+    qDebug("SATAPP: SatAppPopupProvider::~SatAppPopupProvider <");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppPopupProvider::displayText
+// ----------------------------------------------------------------------------
+//
+void SatAppPopupProvider::displayText(SatAppAction& action)
+{
+    qDebug("SATAPP: SatAppPopupProvider::displayText >");
+    mAction = &action;
+    delete mDisplayText;
+    mDisplayText = 0;
+    QString heading = action.value(KeyApplicationName).toString();
+    if (heading.isEmpty()) {
+        heading = hbTrId("txt_simatk_dialog_sim_services");
+    }
+    qDebug() << "SATAPP: displayText: heading=" << heading;
+
+    // text
+    QString text = action.value(KeyText).toString();
+
+    // some flags
+    bool sustainedText = action.value(KeySustainedText).toBool();
+    bool waitUserToClear = action.value(KeyWaitUserToClear).toBool();
+
+    // duration
+    int duration = action.value(KeyDuration).toInt();
+    if (duration==0) {
+        duration = KDisplayTxtDefaultduration;
+        if (waitUserToClear) {
+            duration = KDisplayTxtUserClearTimeout;
+        }
+    }
+    if ( !(!sustainedText || 
+           action.value(KeyDuration).toInt() || 
+           !waitUserToClear) ) {
+        duration = 0;
+    }
+    qDebug("SATAPP: displayText: duration=%d",duration);
+
+    // Show DisplayText dialog
+    mDisplayText = new HbMessageBox(HbMessageBox::MessageTypeInformation);
+
+    // Set the label as heading widget
+    HbLabel *label = new HbLabel(heading, mDisplayText);
+    mDisplayText->setHeadingWidget(label);
+    mDisplayText->setText(text);
+    mDisplayText->setIconVisible(false);
+    mDisplayText->setStandardButtons(HbMessageBox::Ok | HbMessageBox::Cancel);
+    // ok pressed -> complete action with KSatSuccess
+    SAT_ASSERT(connect(mDisplayText->actions().at(0), SIGNAL(triggered()),
+        &action, SLOT(completeWithSuccess())));
+    // cancel pressed -> complete action with ESatBackwardModeRequestedByUser
+    SAT_ASSERT(connect(mDisplayText->actions().at(1), SIGNAL(triggered()),
+        &action, SLOT(completeWithBackRequested())));
+    SAT_ASSERT(connect(mAction, SIGNAL(actionCompleted(SatAppAction *)),
+        this, SLOT(resetState())));
+    if (duration) {
+        if (waitUserToClear && !sustainedText) {
+           // in timeout, complete action with ESatNoResponseFromUser
+            QTimer::singleShot(duration,
+                &action, SLOT(completeWithNoResponse()));
+        } else {
+            QTimer::singleShot(duration,
+                &action, SLOT(completeWithSuccess()));
+        }
+        mDisplayText->setTimeout(duration); 
+    }
+
+    // open the popup.
+    mDisplayText->open();
+    
+    qDebug("SATAPP: SatAppPopupProvider::displayText <");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppPopupProvider::notification
+// ----------------------------------------------------------------------------
+//
+void SatAppPopupProvider::notification(SatAppAction& action)
+{
+    qDebug("SATAPP: SatAppPopupProvider::notification >");
+    // some flags
+    int commandId = action.value(KeyCommandId).toInt();
+    int alphaIdStatus = action.value(KeyAlphaIdStatus).toInt();
+    // reset mAction
+    mAction = 0;
+    qDebug("SATAPP: notification id=%d alphaSt=%d",
+        commandId, alphaIdStatus);
+
+    switch (commandId)
+    {
+        case ESatSSendDataNotify:
+        case ESatSReceiveDataNotify:
+        {
+            qDebug("SATAPP: Notifying BIP Send/Receive");
+            // need to complete action with success when use don't prees cancel
+            mAction = &action;
+            showBIPWaitNote(action);
+            break;
+        }
+        case ESatSCloseChannelNotify:
+        {
+            qDebug("SATAPP: Notifying BIP CloseChannel");
+            showCloseChannelWaitNote(action);
+            break;
+        }
+        case ESatSMoSmControlNotify:
+        {
+            qDebug("SATAPP: Notifying MoSmControl");
+            if (ESatAlphaIdNotNull == alphaIdStatus) {
+                showMoSmControlNote(action);
+            } else {
+                showSatInfoNote(action);
+            }
+            break;
+        }
+        case ESatSCallControlNotify:
+        {
+            qDebug("SATAPP: Notifying CallControl");
+            showCallControlNote(action);
+            break;
+        }
+        case ESatSSendUssdNotify:   // fall through
+        case ESatSSendSsNotify:
+        {
+            qDebug("SATAPP: Notifying SendSs / SendUssd");
+            showSsWaitNote(action);
+            break;
+        }
+        case ESatSSendDtmfNotify:
+        {
+            qDebug("SATAPP: Notifying SendDtmf");
+            // need to complete action with success when use don't prees cancel
+            mAction = &action;
+            showDtmfWaitNote(action);
+            break;
+        }
+        case ESatSSendSmsNotify:
+        {
+            qDebug("SATAPP: Notifying SendSms");
+            showSmsWaitNote(action);
+            break;
+        }
+        default:
+        {
+            qDebug("SATAPP: Unkown notification");
+            action.completeWithFailure();
+            break;
+        }
+    }
+    qDebug("SATAPP: SatAppPopupProvider::notification <");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppPopupProvider::stopShowWaitNote
+// ----------------------------------------------------------------------------
+//
+void SatAppPopupProvider::stopShowWaitNote()
+{
+    qDebug("SATAPP:SatAppPopupProvider::stopShowWaitNote: >mWaitDialog = %x", 
+        mWaitDialog );
+    if (mWaitDialog) {
+        mWaitDialog->close();
+        delete mWaitDialog;
+        mWaitDialog = NULL;
+        if (mAction) {
+            qDebug("SATAPP: stopShowWaitNote: mAction");
+            int commandId = mAction->value(KeyCommandId).toInt();
+            if (ESatSSendDataNotify == commandId 
+                || ESatSReceiveDataNotify == commandId 
+                || ESatSSendDtmfNotify == commandId) {
+                 mAction->completeWithSuccess();
+            }
+        }
+    }
+
+    qDebug("SATAPP: stopShowWaitNote: mWaitDeviceDialog=%x",
+        mWaitDeviceDialog);
+    if (mWaitDeviceDialog) {
+        mWaitDeviceDialog->close();
+        delete mWaitDeviceDialog;
+        mWaitDeviceDialog = NULL;            
+    }
+
+    qDebug("SATAPP:SatAppPopupProvider::stopShowWaitNote: <mWaitDialog = %x", 
+        mWaitDialog );
+}
+
+// ----------------------------------------------------------------------------
+// SatAppPopupProvider::defaultAlphaId
+// provides a default text in case it is empty
+// ----------------------------------------------------------------------------
+//
+QString SatAppPopupProvider::alphaId(SatAppAction& action)
+{
+    QString alpha = action.value(KeyText).toString();
+    qDebug() << "SATAPP: SatAppPopupProvider::alphaId" << alpha;
+
+    int commandId = action.value(KeyCommandId).toInt();
+    int controlResult = action.value(KeyControlResult).toInt();
+
+    if (!alpha.isEmpty()) {
+        return alpha;
+    }
+    switch (commandId)
+    {
+    case ESatSSendDataNotify: // SendData
+        {
+        alpha = hbTrId("txt_simatk_dialog_sendingdata");
+        break;
+        }
+    case ESatSReceiveDataNotify: // ReceiveData
+        {
+        alpha = hbTrId("txt_simatk_dialog_receivingdata");
+        break;
+        }
+    case ESatSCloseChannelNotify: // CloseChannel
+        {
+        alpha = hbTrId("txt_simatk_dialog_connectionclosed");
+        break;
+        }
+    case ESatSMoSmControlNotify: // MoSmControl
+        {
+        if (ESatNotAllowed == controlResult) {
+        alpha = hbTrId("txt_simatk_dpopinfo_request_not_allowed");
+        } else if (ESatAllowedWithModifications == controlResult) {
+            alpha = hbTrId("txt_simatk_dpopinfo_request_modified");
+        } else {
+            alpha =  hbTrId(""); // Allowed, default alpha -> no info
+        }
+        break;
+        }
+    case ESatSCallControlNotify: // CallControl
+       {
+        if (ESatNotAllowed == controlResult) {
+            alpha= hbTrId("txt_simatk_dpopinfo_request_not_allowed");
+        } else if (ESatAllowedWithModifications == controlResult) {
+            alpha = hbTrId("txt_simatk_dpopinfo_request_modified");
+        } else {
+            alpha = hbTrId(""); // Allowed, default alpha -> no info
+        }
+        break;
+        }
+    case ESatSSendSmsNotify: // fall through
+    case ESatSSendDtmfNotify: // fall through
+    case ESatSSendUssdNotify: // fall through
+    case ESatSSendSsNotify: // fall through
+        {
+        // alpha id is empty, set a default string
+        alpha = hbTrId("txt_common_info_processing");
+        break;
+        }
+    default:
+        break;
+    }
+    qDebug("SATAPP:SatAppPopupProvider::alphaId <");
+    return alpha;
+}
+
+// ----------------------------------------------------------------------------
+// SatAppPopupProvider::showBIPWaitNote
+// ----------------------------------------------------------------------------
+//
+void SatAppPopupProvider::showBIPWaitNote(SatAppAction& action)
+{
+    qDebug("SATAPP: SatAppPopupProvider::showBIPWaitNote >");
+
+    QString text = alphaId(action);
+    // this is a new SEND DATA action
+    delete mWaitDialog;
+    mWaitDialog = 0;
+    HbProgressDialog *pd = new HbProgressDialog(HbProgressDialog::WaitDialog);
+    pd->setText(text);
+    // cancel -> complete with ESatBackwardModeRequestedByUser
+    SAT_ASSERT(connect(pd->actions().at(0),SIGNAL(triggered()),
+        &action,SLOT(completeWithBackRequested())));
+
+    // open dialog
+    pd->open();
+    mWaitDialog = pd;
+
+    qDebug("SATAPP: SatAppPopupProvider::showBIPWaitNote <");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppPopupProvider::showCloseChannelWaitNote
+// ----------------------------------------------------------------------------
+//
+void SatAppPopupProvider::showCloseChannelWaitNote(SatAppAction& action)
+{
+    qDebug("SATAPP: SatAppPopupProvider::showCloseChannelWaitNote >");
+    HbProgressDialog *pd = new HbProgressDialog(HbProgressDialog::WaitDialog);
+    pd->clearActions();
+    pd->setText(alphaId(action));
+    pd->open();
+    mWaitDialog = pd;
+    qDebug("SATAPP: SatAppPopupProvider::showCloseChannelWaitNote <");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppPopupProvider::showMoSmControlNote
+// ----------------------------------------------------------------------------
+//
+void SatAppPopupProvider::showMoSmControlNote(SatAppAction& action)
+{
+    qDebug("SATAPP: SatAppPopupProvider::showMoSmControlNote >");
+    HbMessageBox *mb = new HbMessageBox(HbMessageBox::MessageTypeInformation);
+    mb->clearActions();
+    mb->setText(alphaId(action));
+    mb->open();
+    mWaitDialog = mb;
+    qDebug("SATAPP: SatAppPopupProvider::showMoSmControlNote <");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppPopupProvider::showSatInfoNote
+//
+// ----------------------------------------------------------------------------
+//
+void SatAppPopupProvider::showSatInfoNote(SatAppAction& action)
+{
+    qDebug("SATAPP: SatAppPopupProvider::showSatInfoNote >");
+    HbMessageBox *mb = new HbMessageBox(HbMessageBox::MessageTypeInformation);
+    mb->setText(alphaId(action));
+    mb->open();
+    mWaitDialog = mb;
+    qDebug("SATAPP: SatAppPopupProvider::showSatInfoNote <");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppPopupProvider::showCallControlNote
+// ----------------------------------------------------------------------------
+//
+void SatAppPopupProvider::showCallControlNote(SatAppAction& action)
+{
+    qDebug("SATAPP: SatAppPopupProvider::showCallControlNote >");
+    HbDeviceMessageBox *dmb = new HbDeviceMessageBox(HbMessageBox::MessageTypeInformation);
+    // No cancel key
+    dmb->setText(alphaId(action));
+    dmb->show();
+    mWaitDeviceDialog = dmb;
+
+    qDebug("SATAPP: SatAppPopupProvider::showCallControlNote <");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppPopupProvider::showSsWaitNote
+// Displays a wait note to indicate SS sending.
+// ----------------------------------------------------------------------------
+//
+void SatAppPopupProvider::showSsWaitNote(SatAppAction& action)
+{
+    qDebug("SATAPP: SatAppPopupProvider::showSsWaitNote >");
+    HbProgressDialog *pd = new HbProgressDialog(HbProgressDialog::WaitDialog);
+    pd->clearActions();
+    pd->setText(alphaId(action));
+    pd->show();
+    mWaitDialog = pd;
+    qDebug("SATAPP: SatAppPopupProvider::showSsWaitNote <");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppPopupProvider::showDtmfWaitNote
+// ----------------------------------------------------------------------------
+//
+void SatAppPopupProvider::showDtmfWaitNote(SatAppAction& action)
+{
+    qDebug("SATAPP: SatAppPopupProvider::showDtmfWaitNote >");
+    HbProgressDialog *pd = new HbProgressDialog(HbProgressDialog::WaitDialog);
+    // cancel -> complete action with ESatBackwardModeRequestedByUser
+    SAT_ASSERT(connect(pd->actions().at(0), SIGNAL(triggered()),
+        &action, SLOT(completeWithBackRequested())));
+    pd->setText(alphaId(action));
+    pd->open();
+    mWaitDialog = pd;
+    qDebug("SATAPP: SatAppPopupProvider::showDtmfWaitNote <");
+ }
+
+
+// ----------------------------------------------------------------------------
+// SatAppPopupProvider::showDtmfWaitNote
+// ----------------------------------------------------------------------------
+//
+void SatAppPopupProvider::showSmsWaitNote(SatAppAction& action)
+{
+    qDebug("SATAPP: SatAppPopupProvider::showSmsWaitNote >");
+    HbProgressDialog *pd = new HbProgressDialog(HbProgressDialog::WaitDialog);
+    //remove the default cancel softkey
+    pd->clearActions();
+    pd->setText(alphaId(action));
+    pd->open();
+    mWaitDialog = pd;
+    qDebug("SATAPP: SatAppPopupProvider::showSmsWaitNote <");
+ }
+
+// ----------------------------------------------------------------------------
+// SatAppPopupProvider::stopShowWaitNote
+// ----------------------------------------------------------------------------
+//
+void SatAppPopupProvider::showSsErrorNote()
+{
+    qDebug("SATAPP: SatAppPopupProvider::showSsErrorNote >");
+    HbMessageBox *mb = new HbMessageBox(HbMessageBox::MessageTypeWarning);
+    mb->setText(hbTrId("txt_sat_sendss_error_note"));
+    mb->open();
+    mWaitDialog = mb;
+    qDebug("SATAPP: SatAppPopupProvider::showSsErrorNote <");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppPopupProvider::clearScreen
+// terminates all ongoing UI actions
+// ----------------------------------------------------------------------------
+//
+void SatAppPopupProvider::clearScreen()
+{
+    qDebug( "SATAPP: SatAppPopupProvider::clearScreen >" );
+    stopShowWaitNote();
+    if (mDisplayText){
+        qDebug( "SatAppPopupProvider::clearScreen DisplayText" );
+        delete mDisplayText;
+        mDisplayText = 0;
+        if (mAction) {
+            qDebug( "SatAppPopupProvider::clearScreen mAction" );
+            SAT_ASSERT(disconnect(mAction, SIGNAL(actionCompleted(SatAppAction *)),
+                this, SLOT(resetState())));
+            mAction->completeWithNoResponse();
+            mAction = 0;
+        }
+        qDebug( "SatAppPopupProvider::clearScreen DisplayText <" );
+    }
+    qDebug( "SATAPP: SatAppToneProvider::clearScreen <" );
+}
+
+// ----------------------------------------------------------------------------
+// SatAppPopupProvider::resetState
+// reset
+// ----------------------------------------------------------------------------
+//
+void SatAppPopupProvider::resetState()
+{
+    qDebug( "SATAPP: SatAppPopupProvider::resetState >" );
+    mAction = 0;
+    qDebug( "SATAPP: SatAppPopupProvider::resetState <" );
+}
+
+//End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satui/satapp/src/satappserverdispatcher.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,611 @@
+/*
+* 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: Receives UI commands from SAT server and converts to QT
+*
+*/
+
+// qt
+#include <QStringList>
+#include <qglobal.h>
+#include <QCoreApplication>
+// symbian
+#include <centralrepository.h>
+#include <ProfileEngineSDKCRKeys.h>
+
+// sat
+#include <msatuiadapter.h>
+#include "satappserverdispatcher.h"
+#include "satappaction.h"
+#include "satappconstant.h"
+
+
+// ----------------------------------------------------------------------------
+// SatAppServerDispatcher::SatAppServerDispatcher
+// ----------------------------------------------------------------------------
+//
+SatAppServerDispatcher::SatAppServerDispatcher(QObject *parent) :
+    QObject(parent)
+{
+    qDebug("SATAPP: SatAppServerDispatcher::SatAppServerDispatcher");
+    QT_TRAP_THROWING(ConnectSatSessionL());
+}
+
+// ----------------------------------------------------------------------------
+// SatAppServerDispatcher::~SatAppServerDispatcher
+// ----------------------------------------------------------------------------
+//
+SatAppServerDispatcher::~SatAppServerDispatcher()
+{
+    qDebug("SATAPP: SatAppServerDispatcher::~SatAppServerDispatcher");
+    DisconnectSatSession();
+}
+
+// ----------------------------------------------------------------------------
+// SatAppServerDispatcher::menuSelection
+// ----------------------------------------------------------------------------
+//
+void SatAppServerDispatcher::menuSelection(SatAppAction* action)
+{
+    qDebug("SATAPP: SatAppServerDispatcher::menuSelection >");
+    if ( ESatSuccess == action->response() ) {
+        // user selected item from menu
+        int menuItem = action->value(KeySelection).toInt();
+        int helpRequested = action->value(KeyHelpRequested).toBool();
+        qDebug("SATAPP: SatAppServerDispatcher::MenuSelection item=%d",
+            menuItem);
+        iSat.Adapter()->MenuSelection(menuItem, helpRequested);
+    } else if (ESatSessionTerminatedByUser == action->response()) {
+        // session terminated while executing the menu action
+        qDebug("SATAPP: SatAppServerDispatcher::SessionTerminated");
+        iSat.Adapter()->SessionTerminated(EEndKeyUsed);
+    }
+    delete action;
+    qDebug("SATAPP: SatAppServerDispatcher::menuSelection <");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppServerDispatcher::userCancelResponse
+// ----------------------------------------------------------------------------
+//
+void SatAppServerDispatcher::userCancelSession(SatAppAction* action)
+{
+    qDebug("SATAPP: SatAppServerDispatcher::userCancelSession");
+    if (action && ESatBackwardModeRequestedByUser == action->response()){
+        iSat.Adapter()->SessionTerminated(ESessionCancel);
+    }    
+    delete action;
+    action = 0;
+}
+
+
+// ****************************************************************************
+// * ************************************************************************ *
+// * *                          SYMBIAN PART                                * *
+// * ************************************************************************ *
+// ****************************************************************************
+
+// ----------------------------------------------------------------------------
+// SatAppServerDispatcher::ConnectSatSessionL
+// ----------------------------------------------------------------------------
+//
+void SatAppServerDispatcher::ConnectSatSessionL()
+{
+    qDebug("SATAPP: SatAppServerDispatcher::ConnectSatSessionL>");
+    //Register to Server as subsession
+    //If Server is not up, this function call may take time
+    iSatSession.ConnectL();
+    iSat.RegisterL(iSatSession, this);
+    if (!iSat.Adapter())
+        User::Leave(KErrNotFound);
+    qDebug("SATAPP: SatAppServerDispatcher::ConnectSatSessionL<");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppServerDispatcher::DisconnectSatSession
+// ----------------------------------------------------------------------------
+//
+void SatAppServerDispatcher::DisconnectSatSession()
+{
+    qDebug("SATAPP: SatAppServerDispatcher::DisconnectSatSession>");
+    iSat.Close();
+    iSatSession.Close();
+    qDebug("SATAPP: SatAppServerDispatcher::DisconnectSatSession<");
+}
+
+// ----------------------------------------------------------------------------
+// SatAppServerDispatcher::ProfileState
+// Get the profile status
+// ----------------------------------------------------------------------------
+//
+TInt SatAppServerDispatcher::ProfileState()
+    {
+    qDebug("SATAPP: SatAppServerDispatcher::ProfileState");
+    TInt profileId(0);
+    CRepository* cr (NULL);
+
+    TRAPD(err, cr = CRepository::NewL(KCRUidProfileEngine));
+    if ( KErrNone == err )
+        {
+        // Get the ID of the currently active profile:
+        const TInt error = cr->Get(KProEngActiveProfile, profileId);
+        qDebug("SATAPP: SatAppServerDispatcher::ProfileState error=%d",
+                error);
+        delete cr;
+        }
+
+    return profileId;
+    }
+
+// ----------------------------------------------------------------------------
+// My own quick string -> descriptor conversion function :-)
+// ----------------------------------------------------------------------------
+//
+void s2d(const QString str, TDes& desc)
+{
+    desc.Copy(reinterpret_cast<const TUint16*>(str.utf16()), str.length());
+}
+
+// ----------------------------------------------------------------------------
+// SatAppServerDispatcher::DisplayTextL
+// ----------------------------------------------------------------------------
+//
+TSatUiResponse SatAppServerDispatcher::DisplayTextL( const TDesC& aText,
+    const TDesC& aSimApplicationName,
+    const TSatIconId& aIconId,
+    TBool& aRequestedIconDisplayed,
+    const TBool aSustainedText,
+    const TTimeIntervalSeconds aDuration,
+    const TBool aWaitUserToClear )
+{
+    qDebug("SATAPP: SatAppServerDispatcher::DisplayTextL >");
+    Q_UNUSED(aIconId);
+    SatAppAction action(ESatDisplayTextAction);
+    // validate
+    if (aText.Length()== 0 || aText.Length()>RSat::KTextToDisplayMaxSize){
+        qDebug("SATAPP: SatAppServerDispatcher::DisplayText no text");
+        aRequestedIconDisplayed = EFalse;
+        return ESatFailure;
+    }
+
+    QT_TRYCATCH_LEAVING(
+        // ensure state
+        emit stopShowWaitNote();
+
+        // call
+        action.set(KeyText,aText);
+        action.set(KeyApplicationName, aSimApplicationName);
+        action.set(KeySustainedText, aSustainedText);
+        action.set(KeyDuration, const_cast<TTimeIntervalSeconds &>(aDuration));
+        action.set(KeyWaitUserToClear, aWaitUserToClear);
+
+        emit displayText(action);
+        action.waitUntilCompleted();
+    );
+
+    // return
+    qDebug("SATAPP: SatAppServerDispatcher::DisplayTextL action.response() %x<", 
+        action.response());
+    return action.response();
+}
+
+// ----------------------------------------------------------------------------
+// SatAppServerDispatcher::GetInkeyL
+// ----------------------------------------------------------------------------
+//
+TSatUiResponse SatAppServerDispatcher::GetInkeyL(
+    const TDesC& aText,
+    const TSatCharacterSet aCharacterSet,
+    TChar& aInput,
+    const TBool aHelpIsAvailable,
+    const TSatIconId& aIconId,
+    TBool& aRequestedIconDisplayed,
+    TUint& aDuration,
+    const TBool aImmediateDigitResponse )
+{
+    Q_UNUSED(aHelpIsAvailable);
+    Q_UNUSED(aIconId);
+    
+    qDebug("SATAPP: SatAppServerDispatcher::GetInkeyL >");
+
+    // validate
+    aRequestedIconDisplayed = EFalse;
+    if (ESatYesNo == aCharacterSet && aText.Length() == 0) {
+        qDebug("SATAPP: CSatUiObserver::GetInkey return ESatFailure");
+        return ESatFailure;
+    }
+
+    SatAppAction action(ESatGetInkeyAction);
+    QT_TRYCATCH_LEAVING(
+        // ensure state
+        emit stopShowWaitNote();
+
+        // call
+        action.set(KeyText,aText);
+        action.set(KeyCharacterSet,(int)aCharacterSet);
+        action.set(KeyInKey,(int)aInput);
+        // convert from SAT time units(?) to milliseconds
+        action.set(KeyDuration,(int)aDuration*KSymbianTimeConvertQtTime);
+        action.set(KeyImmediate,(bool)aImmediateDigitResponse);
+        emit getInkey(action);
+        action.waitUntilCompleted();
+        // convert from milliseconds to SAT time units(?)
+        aDuration = 
+                action.value(KeyDuration).toInt()/KSymbianTimeConvertQtTime;
+        aInput = action.value(KeyInKey).toInt();
+    );
+
+    // return
+    qDebug("SATAPP: SatAppServerDispatcher::GetInkeyL <");
+    return action.response();
+}
+
+// ----------------------------------------------------------------------------
+// SatAppServerDispatcher::GetInputL
+// ----------------------------------------------------------------------------
+//
+TSatUiResponse SatAppServerDispatcher::GetInputL(
+    const TDesC& aText,
+    const TSatCharacterSet aCharacterSet,
+    TDes& aInput,
+    const TInt aMinLength,
+    const TInt aMaxLength,
+    const TBool aHideInput,
+    const TBool aHelpIsAvailable,
+    const TSatIconId& aIconId,
+    TBool& aRequestedIconDisplayed )
+{
+    Q_UNUSED(aHelpIsAvailable);
+    Q_UNUSED(aIconId);
+    qDebug("SATAPP: SatAppServerDispatcher::GetInputL >");
+
+    // validate
+    aRequestedIconDisplayed = EFalse;
+    if ((aCharacterSet == ESatCharSmsDefaultAlphabet ||
+         aCharacterSet == ESatCharUcs2Alphabet) &&
+         aHideInput) {
+        qDebug("SATAPP: SatAppServerDispatcher::GetInput return ESatFailure");
+        return ESatFailure;
+    }
+
+    SatAppAction action(ESatGetInputAction);
+    QT_TRYCATCH_LEAVING(
+        // ensure state
+        emit stopShowWaitNote();
+    
+        // call
+        action.set(KeyText,aText);
+        action.set(KeyCharacterSet,(int)aCharacterSet);
+        action.set(KeyInputString,aInput);
+        action.set(KeyMinLength,aMinLength);
+        action.set(KeyMaxLength,aMaxLength);
+        action.set(KeyHideInput,(bool)aHideInput);
+        emit getInput(action);
+        action.waitUntilCompleted();
+        s2d(action.value(KeyInputString).toString(), aInput);
+    )
+
+    // return
+    qDebug("SATAPP: SatAppServerDispatcher::GetInputL <");
+    return action.response();
+}
+
+// ----------------------------------------------------------------------------
+// SatAppServerDispatcher::SetUpMenuL
+// ----------------------------------------------------------------------------
+//
+TSatUiResponse SatAppServerDispatcher::SetUpMenuL(
+    const TDesC& aText,
+    const MDesCArray& aMenuItems,
+    const CArrayFixFlat<TSatAction>* aMenuItemNextActions,
+    const TBool aHelpIsAvailable,
+    const TSatIconId& aIconId,
+    const CArrayFixFlat<TInt>* aMenuIcons,
+    const enum TSatIconQualifier aIconListQualifier,
+    const enum TSatSelectionPreference aSelectionPreference )
+{
+    Q_UNUSED(aMenuItemNextActions);
+    Q_UNUSED(aHelpIsAvailable);
+    Q_UNUSED(aIconId);
+    Q_UNUSED(aMenuIcons);
+    Q_UNUSED(aIconListQualifier);
+    Q_UNUSED(aSelectionPreference);
+    qDebug("SATAPP: SatAppServerDispatcher::SetUpMenuL >");
+
+    QT_TRYCATCH_LEAVING(
+
+        // validate
+        if (!aMenuItems.MdcaCount() ||
+            (KSatActiveProfileOffline == ProfileState())) {
+            emit clearScreen();
+            QCoreApplication::instance()->quit();
+            return ESatSuccess;
+        }
+
+        // ensure state
+        emit stopShowWaitNote();
+    
+        // call
+        SatAppAction* action = new SatAppAction(ESatSetUpMenuAction, this);
+        action->set(KeyText,aText);
+        action->set(KeyMenu,aMenuItems);
+        // connect for asynchronous menu selection
+        connect(
+            action,SIGNAL(actionCompleted(SatAppAction*)),
+            this,SLOT(menuSelection(SatAppAction*)));
+        
+        emit setUpMenu(*action);
+    )
+
+    // return
+    qDebug("SATAPP: SatAppServerDispatcher::SetUpMenuL <");
+    return ESatSuccess;
+}
+
+// ----------------------------------------------------------------------------
+// SatAppServerDispatcher::SelectItemL
+// ----------------------------------------------------------------------------
+//
+TSatUiResponse SatAppServerDispatcher::SelectItemL(
+    const TDesC& aText,
+    const MDesCArray& aMenuItems,
+    const CArrayFixFlat<TSatAction>* aMenuItemNextActions,
+    const TInt aDefaultItem,
+    TUint8& aSelection,
+    const TBool aHelpIsAvailable,
+    const TSatIconId& aIconId,
+    const CArrayFixFlat<TInt>* aMenuIcons,
+    const enum TSatIconQualifier aIconListQualifier,
+    TBool& aRequestedIconDisplayed,
+    const enum TSatSelectionPreference aSelectionPreference )
+{
+    Q_UNUSED(aMenuItemNextActions);
+    Q_UNUSED(aHelpIsAvailable);
+    Q_UNUSED(aIconId);
+    Q_UNUSED(aMenuIcons);
+    Q_UNUSED(aIconListQualifier);
+    Q_UNUSED(aRequestedIconDisplayed);
+    Q_UNUSED(aSelectionPreference);
+    TSatUiResponse resp(ESatFailure);
+    SatAppAction action(ESatSelectItemAction);
+    qDebug("SATAPP: SatAppServerDispatcher::SelectItemL >");
+
+    QT_TRYCATCH_LEAVING(
+        // ensure state
+        emit stopShowWaitNote();
+    
+        // call
+        action.set(KeyText,aText);
+        action.set(KeyMenu,aMenuItems);
+        action.set(KeyDefault,aDefaultItem);
+        emit selectItem(action);
+        action.waitUntilCompleted();
+        resp = action.response();
+        if ( ESatSuccess == resp ) {
+            aSelection = static_cast<TUint8>(
+                    action.value(KeySelection).toInt());
+        }
+    )
+
+    // return
+    qDebug("SATAPP: SatAppServerDispatcher::SelectItemL <");
+    return resp;
+}
+
+// ----------------------------------------------------------------------------
+// SatAppServerDispatcher::PlayTone
+// ----------------------------------------------------------------------------
+//
+TSatUiResponse SatAppServerDispatcher::PlayTone(
+    const TDesC& aText,
+    const TSatTone aTone,
+    const TTimeIntervalMicroSeconds aDuration,
+    const TSatIconId& aIconId,
+    TBool& aRequestedIconDisplayed )
+{
+    Q_UNUSED(aIconId);
+    aRequestedIconDisplayed = EFalse;
+    TSatUiResponse resp(ESatSuccess);
+    qDebug("SATAPP: SatAppServerDispatcher::PlayTone >");
+    SatAppAction action(ESatPlayToneAction);
+    int err(KErrNone);
+    QT_TRYCATCH_ERROR(
+        err,
+        // ensure state
+        emit stopShowWaitNote();
+    
+        // call
+        action.set(KeyText,aText);
+        action.set(KeyToneId,aTone);
+        action.set(KeyDuration, const_cast<TTimeIntervalMicroSeconds &>(aDuration));
+        emit playTone(action);
+        action.waitUntilCompleted();
+        resp = action.response();
+    )
+
+    // return
+    qDebug("SATAPP: SatAppServerDispatcher::PlayTone err = %d<", err);
+    return resp;
+}
+
+
+// ----------------------------------------------------------------------------
+// SatAppServerDispatcher::ConfirmCommand
+// ----------------------------------------------------------------------------
+//
+void SatAppServerDispatcher::ConfirmCommand(
+    const TSatSQueryCommand aCommandId,
+    const TSatAlphaIdStatus aAlphaIdStatus,
+    const TDesC& aText,
+    const TDesC& aAdditionalText,
+    TBool& aActionAccepted,
+    const TSatIconId& aIconId,
+    TBool& aRequestedIconDisplayed,
+    TBool& aTerminatedByUser )
+{
+    qDebug("SATAPP: SatAppServerDispatcher::ConfirmCommand >");
+    Q_UNUSED(aIconId);
+    aRequestedIconDisplayed = EFalse;
+    aTerminatedByUser = EFalse;
+    //ConfirmAction
+    SatAppAction action(ESatConfirmAction);
+    qDebug("SATAPP: SatAppServerDispatcher::ConfirmCommand");
+    int err(KErrNone);
+    QT_TRYCATCH_ERROR(
+        err,
+        emit stopShowWaitNote();
+    
+        action.set(KeyQueryCommandId, aCommandId);
+        action.set(KeyAlphaIdStatus, aAlphaIdStatus);
+        action.set(KeyText, aText);
+        action.set(KeyAdditionalText, aAdditionalText);
+        action.set(KeyActionAccepted, aActionAccepted);
+
+        emit confirmCommand(action);
+        action.waitUntilCompleted();
+        if (ESatSuccess == action.response() ) {
+            aActionAccepted = ETrue;
+        }
+    )
+    qDebug("SATAPP: SatAppServerDispatcher::ConfirmCommand err = %d <", err);
+}
+
+// ----------------------------------------------------------------------------
+// SatAppServerDispatcher::Notification
+// ----------------------------------------------------------------------------
+//
+TSatUiResponse SatAppServerDispatcher::Notification(
+    const TSatSNotifyCommand aCommandId,
+    const TSatAlphaIdStatus aAlphaIdStatus,
+    const TDesC& aText,
+    const TSatIconId& aIconId,
+    TBool& aRequestedIconDisplayed,
+    const TSatControlResult aControlResult )
+{
+    Q_UNUSED(aIconId);
+    Q_UNUSED(aRequestedIconDisplayed);
+    qDebug("SATAPP: SatAppServerDispatcher::Notification command id=%d",
+        aCommandId);
+
+    TSatUiResponse res(ESatFailure);
+    int err(KErrNone);
+    switch (aCommandId)
+    {
+        // With cancel
+        case ESatSSendDataNotify:    // fall through
+        case ESatSReceiveDataNotify: // fall through
+        case ESatSSendDtmfNotify:    // fall through
+        {
+            QT_TRYCATCH_ERROR(
+                err,
+                emit stopShowWaitNote();
+                SatAppAction *action = new SatAppAction(ESatNotifyAction, this);
+                action->set(KeyText, aText);
+                action->set(KeyCommandId, aCommandId);
+                action->set(KeyAlphaIdStatus, aAlphaIdStatus);
+                action->set(KeyControlResult, aControlResult);
+                // connect for asynchronous menu selection
+                connect(
+                    action,SIGNAL(actionCompleted(SatAppAction*)),
+                    this,SLOT(userCancelSession(SatAppAction*)));
+                emit notification(*action);
+                res = ESatSuccess;
+            )
+            break;
+        }
+        // Without cancel
+        case ESatSMoSmControlNotify:  // fall through
+        case ESatSCallControlNotify:  // fall through 
+        case ESatSSendUssdNotify:     // fall through 
+        case ESatSSendSsNotify:       // fall through
+        case ESatSSendSmsNotify:      // fall through
+        case ESatSCloseChannelNotify: // fall through
+        {
+            QT_TRYCATCH_ERROR(
+                err,
+                emit stopShowWaitNote();
+                SatAppAction a(ESatNotifyAction);
+                a.set(KeyText, aText);
+                a.set(KeyCommandId, aCommandId);
+                a.set(KeyAlphaIdStatus, aAlphaIdStatus);
+                a.set(KeyControlResult, aControlResult);
+                emit notification(a);
+                res = ESatSuccess;
+            )
+            break;
+        }
+        default:
+        {
+            break;
+        }
+    }
+    qDebug("SATAPP: SatAppServerDispatcher::Notification < ret=%d", err);
+    return res;
+}
+
+// ----------------------------------------------------------------------------
+// SatAppServerDispatcher::EventNotification
+// ----------------------------------------------------------------------------
+//
+void SatAppServerDispatcher::EventNotification(
+    const TSatSEvent aEventId,
+    const TSatSEventStatus aEventStatus,
+    const TInt aError )
+{
+    qDebug( "SATAPP: SatAppServerDispatcher::EventNotification aEventId %d", 
+        aEventId );
+    Q_UNUSED(aEventStatus);
+    Q_UNUSED(aError);
+    int err(KErrNone);
+
+    QT_TRYCATCH_ERROR( err,
+    switch ( aEventId )
+        {
+        case ESatSSmEndEvent:
+        case ESatSsEndEvent:
+        case ESatSDtmfEndEvent:
+            {
+            emit stopShowWaitNote();
+            break;
+            }
+        case ESatSClearScreenEvent:
+            {
+            qDebug("SATAPP: ClearScreen event");
+            emit clearScreen();
+            break;
+            }
+       case ESatSsErrorEvent:
+            {
+            qDebug("SATAPP: Notifying Ss error" );
+            // If error occurred (and Alpha ID provided), notify user
+            emit showSsErrorNote();
+            break;
+            }
+        case ESatSCloseSatUiAppEvent:
+            {
+            qDebug(" Close UI event" );
+            emit clearScreen();
+            QCoreApplication::instance()->quit();
+            break;
+            }
+        default:
+            {
+            qDebug("SATAPP: Unknown event occured: %i", aEventId);
+            break;
+            }
+        }
+    ) // end QT_TRYCATCH_ERROR
+    qDebug("SATAPP: SatAppServerDispatcher::EventNotification err = %d<", err);
+}
+
+//End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satui/satapp/src/satapptoneprovider.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,689 @@
+/*
+* 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:
+*
+*/
+
+// includes
+#include <QTimer>
+#include <QCoreApplication>
+#include <QtDebug>
+#include <hbmessagebox.h>//playtone note
+
+#include "SatAppToneProvider.h"
+#include "satappconstant.h"
+#include "satappaction.h"
+
+// ----------------------------------------------------------------------------
+// SatAppToneProvider::SatAppToneProvider
+// ----------------------------------------------------------------------------
+//
+SatAppToneProvider::SatAppToneProvider(QObject *parent) :
+    QObject(parent)
+{
+    qDebug("SATAPP: SatAppToneProvider::SatAppToneProvider <>");
+    mState = Idle;
+    mWarningAndPlayTones = false;
+    mVolume = 0;
+    mPlayer = 0;
+    mPlayToneError = ESatSuccess;
+    mTimer = 0;
+    mPermanentNote = 0;
+    mAudioPlayer = 0;
+    mCurrentAction = 0;
+}
+
+// ----------------------------------------------------------------------------
+// SatAppToneProvider::~SatAppToneProvider
+// ----------------------------------------------------------------------------
+//
+SatAppToneProvider::~SatAppToneProvider()
+{
+    qDebug("SATAPP: SatAppToneProvider::~SatAppToneProvider >");
+    if (mCurrentAction) {
+        stopPlayTone();
+    }
+    resetState();
+    qDebug("SATAPP: SatAppToneProvider::~SatAppToneProvider <");
+}
+
+//-----------------------------------------------------------------------------
+// SatAppToneProvider::playTone
+//-----------------------------------------------------------------------------
+void SatAppToneProvider::playTone(SatAppAction& action)
+{
+    qDebug("SATAPP: SatAppToneProvider::playTone >");
+    resetState();
+    
+    mCurrentAction = &action;
+    int tone = action.value(KeyToneId).toInt();
+    int duration = action.value(KeyDuration).toInt();
+    QString text = action.value(KeyText).toString();
+    QByteArray sequence;
+    mState = recognizeTone(tone,sequence,duration);
+    if (mState == PlayStandardTone)
+    {
+        playStandardTone(text,sequence,duration);
+    }
+    else if (mState == PlayUserSelectedTone)
+    {
+        playUserSelectedTone(text,tone,duration);
+    }
+    else
+    {
+        mCurrentAction->complete(ESatCmdDataNotUnderstood);
+        mCurrentAction = 0;
+    }
+    qDebug("SATAPP: SatAppToneProvider::playTone <");
+}
+
+//-----------------------------------------------------------------------------
+// SatAppToneProvider::recognizeTone
+// @param tone the tone code from server (see TSatTone in MSatUiObserver)
+// @param sequence (out) standard tone play sequence
+// @param duration (out) stanrard tone play duration (manipulated in some cases)
+// @return suggested state for the tone provider (or Idle if tone is not recognised)
+//-----------------------------------------------------------------------------
+SatAppToneProvider::State SatAppToneProvider::recognizeTone(
+    int tone,
+    QByteArray& sequence,
+    int& duration)
+{
+    qDebug("SATAPP: SatAppToneProvider::recognizeTone >");
+    State ret = Idle;
+    qDebug("SATAPP: SatAppToneProvider::recognizeTone tone: %d", tone);
+    switch (tone)
+    {
+        case ESatGeneralBeep:
+        case ESatPositiveTone:
+        case ESatToneNotSet:
+            {
+            if (duration == 0) duration = KSatDur170ms; // 170ms
+            sequence = charArrayToByteArray(KGeneralBeep, 
+                                     sizeof(KGeneralBeep));
+            ret = PlayStandardTone;
+            break;
+            }
+        case ESatNegativeTone:
+            {
+            if (duration == 0) duration = KSatDur250ms; // 250ms
+            sequence = charArrayToByteArray(KErrorTone, 
+                                     sizeof(KErrorTone));
+            ret = PlayStandardTone;
+            break;
+            }
+        case ESatRadioPathNotAvailableCallDropped:
+            {
+            if (duration == 0) duration = KSatDur1200ms; // 1200ms
+            sequence = charArrayToByteArray(KRadioPathNotAvailable, 
+                                     sizeof(KRadioPathNotAvailable));
+            ret = PlayStandardTone;
+            break;
+            }
+        case ESatRadioPathAcknowledge:
+            {
+            if (duration == 0) duration = KSatDur200ms; // 200ms
+            sequence = charArrayToByteArray(KRadioPathAck, 
+                                     sizeof(KRadioPathAck));
+            ret = PlayStandardTone;
+            break;
+            }
+        case ESatDialTone:
+            {
+            if (duration == 0) break;
+            sequence = charArrayToByteArray(KNetToneSeqDial, 
+                                     sizeof(KNetToneSeqDial));
+            ret = PlayStandardTone;
+            break;
+            }
+        case ESatCalledSubscriberBusy:
+            {
+            if (duration == 0) break;
+            sequence = charArrayToByteArray(KNetToneSeqNetBusy, 
+                                     sizeof(KNetToneSeqNetBusy));
+            ret = PlayStandardTone;
+            break;
+            }
+        case ESatCongestion:
+            {
+            if (duration == 0) break;
+            sequence = charArrayToByteArray(KNetToneSeqNetCongestion, 
+                                     sizeof(KNetToneSeqNetCongestion));
+            ret = PlayStandardTone;
+            break;
+            }
+        case ESatErrorSpecialInfo:
+            {
+            if (duration == 0) break;
+            sequence = charArrayToByteArray(KNetToneSeqNetSpecialInformation, 
+                                     sizeof(KNetToneSeqNetSpecialInformation));
+            ret = PlayStandardTone;
+            break;
+            }
+        case ESatCallWaitingTone:
+            {
+            if (duration == 0) break;
+            sequence = charArrayToByteArray(KNetToneSeqNetCallWaiting, 
+                                     sizeof(KNetToneSeqNetCallWaiting));
+            ret = PlayStandardTone;
+            break;
+            }
+        case ESatRingingTone:
+            {
+            if (duration == 0) break;
+            sequence = charArrayToByteArray(KNetToneSeqRingGoing, 
+                                     sizeof(KNetToneSeqRingGoing));
+            ret = PlayStandardTone;
+            break;
+            }
+        case ESatUserSelectedToneIncomingSpeech:
+        case ESatUserSelectedToneIncomingSms:
+            {
+            ret = PlayUserSelectedTone;
+            break;
+            }
+        default:
+            break;
+    }
+    
+    qDebug("SATAPP: SatAppToneProvider::recognizeTone state=%d <", ret);
+    return ret;
+}
+
+//-----------------------------------------------------------------------------
+// SatAppToneProvider::charArrayToByteArray
+//-----------------------------------------------------------------------------
+QByteArray SatAppToneProvider::charArrayToByteArray(
+    const char tone[], 
+    int size)
+{
+    qDebug("SATAPP: SatAppToneProvider::charArrayToByteArray >");
+    QByteArray seq;
+    seq = QByteArray::fromRawData(tone, size);
+    qDebug("SATAPP: SatAppToneProvider::charArrayToByteArray <");
+    return seq;
+}
+
+//-----------------------------------------------------------------------------
+// SatAppToneProvider::playStandardTone
+//-----------------------------------------------------------------------------
+void SatAppToneProvider::playStandardTone(
+    const QString& text,
+    const QByteArray& sequence,
+    int duration)
+{
+    qDebug("SATAPP: SatAppToneProvider::playStandardTone >");
+
+    if (text.length() > 0) {
+        mPermanentNote = new HbMessageBox(HbMessageBox::MessageTypeInformation);
+        SAT_ASSERT(connect(mPermanentNote, SIGNAL(aboutToClose()),
+                this, SLOT(stopPlayTone())));
+        mPermanentNote->setText(text);
+        mPermanentNote->setStandardButtons(HbMessageBox::Cancel);
+        if (duration > 0 ) {
+            mPermanentNote->setTimeout(duration);
+        }
+        mPermanentNote->setDismissPolicy(HbPopup::TapAnywhere);
+        qDebug("SatAppToneProvider::playStandardTone show before");
+        mPermanentNote->show();
+        qDebug("SatAppToneProvider::playStandardTone show after");
+    }
+
+    TPtrC8 seq((unsigned char*)sequence.constData(), sequence.length());
+    qDebug("SATAPP: SatAppToneProvider::playStandardTone TPtrC8 seq: %S", &seq);
+    QT_TRAP_THROWING(SymbianPrepareAudioToneUtilityL(seq));
+
+    if (duration > 0) {
+        mTimer = new QTimer(this);
+        SAT_ASSERT(connect(mTimer, SIGNAL(timeout()),
+                this, SLOT(stopPlayTone())));
+        mTimer->start(duration);
+    }
+    
+    qDebug("SATAPP: SatAppToneProvider::playStandardTone <");
+}
+
+//-----------------------------------------------------------------------------
+// SatAppToneProvider::playUserSelectedTone
+//-----------------------------------------------------------------------------
+void SatAppToneProvider::playUserSelectedTone(
+    const QString& text,
+    int tone,
+    int duration)
+{
+    qDebug("SatAppToneProvider::playUserSelectedTone >");
+
+    // If several messages/calls arrive during a small amount of time and if the
+    // message received or incoming call tone is already being played we do not 
+    // restart it.
+    if (mAudioPlayer) {
+        qDebug( "SatAppToneProvider::\
+            PlayUserSelectedToneL Error - already played" );
+        mCurrentAction->complete(ESatFailure);
+        mCurrentAction = 0;
+        mState = Idle;
+        return;
+    }
+
+    if (text.length() > 0) {
+        mPermanentNote = new HbMessageBox(HbMessageBox::MessageTypeInformation);
+        mPermanentNote->setText(text);
+        mPermanentNote->setStandardButtons(HbMessageBox::Cancel);
+        if (duration) {
+            mPermanentNote->setTimeout(duration);
+        }
+        mPermanentNote->setDismissPolicy(HbPopup::TapAnywhere);
+        qDebug("SatAppToneProvider::PlayUserSelectedToneL show before");
+        mPermanentNote->show();
+        qDebug("SatAppToneProvider::PlayUserSelectedToneL show after");
+    }
+
+    QT_TRAP_THROWING(SymbianPrepareAudioPlayerL(tone,duration));
+    
+    if (duration > 0) {
+        qDebug( "SATAPP: SatAppToneProvider::PlayUserSelectedToneL\
+            duration not 0" );
+        mTimer = new QTimer(this);
+        mTimer->start(duration);
+        SAT_ASSERT(connect(mTimer, SIGNAL(timeout()), this, SLOT(stopPlayTone())));
+
+        if (mPermanentNote) {
+            SAT_ASSERT(connect(mPermanentNote, SIGNAL(aboutToClose()),
+                    this, SLOT(stopPlayTone())));
+        }
+    }
+    
+    qDebug( "SatAppToneProvider::PlayUserSelectedToneL <" );
+}
+
+
+// ----------------------------------------------------------------------------
+// SatAppToneProvider::clearScreen
+// terminates all ongoing UI actions
+// ----------------------------------------------------------------------------
+//
+void SatAppToneProvider::clearScreen()
+{
+    qDebug( "SatAppToneProvider::clearScreen >" );
+    if (mCurrentAction) {
+        stopPlayTone();
+    }
+    qDebug( "SatAppToneProvider::clearScreen <" );
+}
+
+// ----------------------------------------------------------------------------
+// SatAppToneProvider::stopPlayTone
+// Stops the music, frees blocked functions
+// ----------------------------------------------------------------------------
+//
+void SatAppToneProvider::stopPlayTone()
+{
+    qDebug("SATAPP: SatAppToneProvider::stopPlayTone >");
+    
+    if (mPermanentNote) {
+        qDebug("SatAppToneProvider::stopPlayTone close mPermanentNote");
+        disconnect(mPermanentNote,SIGNAL(aboutToClose()),
+                this, SLOT(stopPlayTone())); 
+        mPermanentNote->close();
+    }
+    
+    if (mTimer) {
+        qDebug("SatAppToneProvider::stopPlayTone stop timer");
+        disconnect(mTimer,SIGNAL(timeout()), this, SLOT(stopPlayTone()));
+        if (mTimer->isActive()) {
+            mTimer->stop();
+        }
+    }
+    
+    switch(mState) {
+        case PlayStandardTone: {
+            qDebug("SATAPP: SatAppToneProvider::stopPlayTone before play cancel");
+            SymbianStopAudioToneUtility();
+
+            //get warning and game tones setting from active profile
+            QT_TRAP_THROWING(GetProfileParamsL());
+            if( EFalse == mWarningAndPlayTones 
+                && ESatSuccess == mPlayToneError ) {
+                mPlayToneError = ESatSuccessToneNotPlayed;
+            }
+            break;
+        }
+        case PlayUserSelectedTone: {
+            // Sample is played in forever loop for the duration.
+            // After duration call back timers are destroyed       
+            // If player exists, stop playing and delete player. MapcPlayComplete
+            // is not called because CallBackTimer stops the playing.
+            SymbianStopAudioPlayer();
+            if( EFalse == mWarningAndPlayTones ) {
+                mPlayToneError = ESatSuccessToneNotPlayed;
+            }
+            break;
+        }
+        default:
+            break;
+    }
+    
+    mState = Idle;
+    if (mCurrentAction) {
+        mCurrentAction->complete(mPlayToneError);
+        mCurrentAction = 0;
+    }
+    
+    qDebug("SATAPP: SatAppToneProvider::stopPlayTone <");
+}
+
+void SatAppToneProvider::resetState()
+{
+    qDebug("SATAPP: SatAppToneProvider::resetState >");
+    if (mCurrentAction) {
+        mCurrentAction->completeWithNoResponse();
+        mCurrentAction = 0;
+    }
+    
+    if (mPermanentNote) {
+        qDebug("SatAppToneProvider::resetState delete mPermanentNote");
+        delete mPermanentNote;
+        mPermanentNote = 0;
+    }
+    
+    if (mTimer) {
+        qDebug("SatAppToneProvider::resetState delete timer");
+        delete mTimer;
+        mTimer = 0;
+    }
+    qDebug("SATAPP: SatAppToneProvider::resetState <");
+}
+
+
+
+// ****************************************************************************
+// * ************************************************************************ *
+// * *                          SYMBIAN PART                                * *
+// * ************************************************************************ *
+// ****************************************************************************
+
+
+// includes
+#include    <e32std.h> //TTimeIntervalMicroSeconds
+#include    <MProfile.h>
+#include    <MProfileEngine.h>
+#include    <MProfileTones.h>
+#include    <TProfileToneSettings.h>
+#include    <AudioPreference.h> //KAudioPriorityLowLevel
+#include    <mdaaudiotoneplayer.h> // for CMdaAudioToneUtility&CMdaAudioPlayerUtility
+#include    <mda/common/resource.h> //KMdaRepeatForever
+
+//constants
+
+// Maximum length for sound file. 
+const TInt KMaxSoundFileLength = 256;
+// Used when dividing some values. Used only for preventing the use of magic 
+// numbers
+// Audio sample is repeated indefinitely.
+const TInt KSoundPlayerRepeatForever = KMdaRepeatForever;
+
+// The max volume value from settings.
+// From TProfileToneSettings.h
+const TInt KMaxVolumeFromProfile( 10 );
+
+// ----------------------------------------------------------------------------
+// SatAppToneProvider::SymbianPrepareAudioToneUtilityL
+// creates and prepares CMdaAudioToneUtility
+// ----------------------------------------------------------------------------
+//
+void SatAppToneProvider::SymbianPrepareAudioToneUtilityL(const TDesC8& sequence)
+{
+    qDebug( "SatAppToneProvider::SymbianPrepareAudioToneUtilityL >" );
+    if (mPlayer) {
+        delete mPlayer;
+        mPlayer = 0;
+    }
+    mPlayer = CMdaAudioToneUtility::NewL(*this);
+    TInt volume(mPlayer->MaxVolume());
+    mPlayer->SetVolume(volume);
+    mPlayer->PrepareToPlayDesSequence(sequence);
+    qDebug( "SatAppToneProvider::SymbianPrepareAudioToneUtilityL <" );
+}
+
+// ----------------------------------------------------------------------------
+// SatAppToneProvider::SymbianStopAudioToneUtility
+// cancels and deletes CMdaAudioToneUtility
+// ----------------------------------------------------------------------------
+void SatAppToneProvider::SymbianStopAudioToneUtility()
+{
+    qDebug( "SatAppToneProvider::SymbianStopAudioToneUtility >" );
+    if (mPlayer) {
+        mPlayer->CancelPlay();
+    }
+    delete mPlayer;
+    mPlayer = NULL;
+    qDebug( "SatAppToneProvider::SymbianStopAudioToneUtility <" );
+}
+
+// ----------------------------------------------------------------------------
+// SatAppToneProvider::SymbianPrepareAudioPlayerL
+// cancels and deletes CMdaAudioToneUtility
+// ----------------------------------------------------------------------------
+void SatAppToneProvider::SymbianPrepareAudioPlayerL(
+    int tone, int duration)
+{
+    qDebug( "SatAppToneProvider::SymbianPrepareAudioPlayerL >" );
+    // This defines name for the current message alert or incoming call tone. 
+    TBuf<KMaxSoundFileLength> soundFileName;
+    GetProfileParamsL(tone, &soundFileName);
+
+    // This defines the behaviour to be adopted by an
+    // audio client if a higher priority client takes over the device.
+    TInt mdaPriority( KAudioPrefIncomingCall );
+    // This is used to resolve conflicts when more than one client tries to 
+    // access the same sound output device simultaneously.
+    TInt audioPriority( KAudioPriorityPhoneCall );
+
+    qDebug( "SATAPP: SatAppToneProvider::PlayUserSelectedToneL\
+        Volume is %d ", mVolume );
+
+    // Creates the audio player.
+    mAudioPlayer = CMdaAudioPlayerUtility::NewFilePlayerL( 
+        soundFileName,
+        *this,
+        audioPriority,
+        ( TMdaPriorityPreference ) mdaPriority );
+
+    TTimeIntervalMicroSeconds no_silence(0);
+    if (duration > 0)
+    {
+        // repeat forever in a loop
+        mAudioPlayer->SetRepeats(KSoundPlayerRepeatForever, no_silence);
+    }
+    else
+    {
+        // play only once
+        mAudioPlayer->SetRepeats(0, no_silence);
+    }
+    qDebug( "SatAppToneProvider::SymbianPrepareAudioPlayerL <" );
+
+}
+
+// ----------------------------------------------------------------------------
+// SatAppToneProvider::SymbianStopAudioPlayer
+// cancels and deletes CMdaAudioToneUtility
+// ----------------------------------------------------------------------------
+void SatAppToneProvider::SymbianStopAudioPlayer()
+{
+    qDebug( "SatAppToneProvider::SymbianStopAudioPlayer >" );
+    if (mAudioPlayer) {
+        qDebug( "SatAppToneProvider::SymbianStopAudioPlayer AudioPlayer stop" );
+        mAudioPlayer->Stop();
+    }
+    delete mAudioPlayer;
+    mAudioPlayer = 0;
+    qDebug( "SatAppToneProvider::SymbianStopAudioPlayer <" );
+}
+
+// ---------------------------------------------------------
+// SatAppCommandHandler::GetProfileParamsL
+// Get and store settings from current profile 
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void SatAppToneProvider::GetProfileParamsL(
+    int aTone /*= ESatToneNotSet*/,
+    TDes* aToneName /*= NULL*/ )
+{
+    qDebug( "SatAppCommandHandler::GetProfileParamsL >" );
+    MProfile* profile = NULL;
+    MProfileEngine* engine = NULL;
+    engine = CreateProfileEngineL();
+    CleanupReleasePushL( *engine );
+
+    profile = engine->ActiveProfileLC();
+
+    const MProfileTones& tones = profile->ProfileTones();
+
+    // Takes a current warning and gametones setting.
+    const TProfileToneSettings& ts = tones.ToneSettings();
+    mWarningAndPlayTones = ts.iWarningAndGameTones;
+    mVolume = ts.iRingingVolume;
+    
+    qDebug( "SatAppCommandHandler::GetProfileParamsL \
+        mVolume before mapping %d", mVolume );
+    
+    // Max volume from profile is KMaxVolumeFromProfile, Max volume from 
+    // CMdaAudioToneUtility is different, maybe 10,000. So, 
+    // rate = maxVolumeFromPlayer / KMaxVolumeFromProfile
+    // User may never hear the TONE, because volume is too small.
+    // iVolume times the rate make it can be heard.
+    
+    CMdaAudioToneUtility* toneUtl = CMdaAudioToneUtility::NewL( *this );
+    TInt maxVolumeFromPlayer( toneUtl->MaxVolume() );
+    mVolume *= maxVolumeFromPlayer / KMaxVolumeFromProfile;
+    delete toneUtl;
+    toneUtl = NULL;
+    qDebug( "CSatUiViewAppUi::GetProfileParamsL \
+        mVolume after mapping %d", mVolume );
+    
+    if ( ( ESatUserSelectedToneIncomingSms == aTone ) && ( aToneName ) )
+        {
+        qDebug("SatAppCommandHandler::GetProfileParamsL message tone");
+        aToneName->Copy( tones.MessageAlertTone() );
+    } else if( aToneName ) {
+        qDebug("SatAppCommandHandler::GetProfileParamsL ring tone");
+        aToneName->Copy( tones.RingingTone1() );
+    }
+
+    CleanupStack::PopAndDestroy(2); // engine, profile
+    qDebug("SatAppCommandHandler::GetProfileParamsL <");
+}
+
+// ---------------------------------------------------------
+// SatAppToneProvider::MatoPrepareComplete
+// Preparation is complete -> Starts playing tone
+// ---------------------------------------------------------
+//
+void SatAppToneProvider::MatoPrepareComplete(TInt aError)
+{
+    qDebug("SatAppToneProvider::MatoPrepareComplete \
+        aError = %d >", aError);
+    if (KErrNone == aError && mPlayer) {
+        mPlayToneError = ESatSuccess;
+        TTimeIntervalMicroSeconds zero(static_cast<TInt64>( 0 ));
+        mPlayer->SetPriority(KAudioPriorityLowLevel,
+               STATIC_CAST(TMdaPriorityPreference, KAudioPrefConfirmation));
+        mPlayer->SetRepeats( KMdaAudioToneRepeatForever, zero );
+        mPlayer->Play();
+    } else {
+        mPlayToneError = ESatFailure;
+        stopPlayTone();
+    }
+    qDebug( "SatAppToneProvider::MatoPrepareComplete <" );
+}
+
+//-----------------------------------------------------------------------------
+// SatAppToneProvider::MatoPlayComplete
+// Play complete -> Frees blocking function
+// (other items were commented in a header).
+// ----------------------------------------------------------------------------
+//
+void SatAppToneProvider::MatoPlayComplete( TInt aError )
+{
+    qDebug("SatAppToneProvider::MatoPlayComplete >");
+    if (KErrNone == aError && mPlayer) {
+        qDebug("SatAppToneProvider::MatoPlayComplete play");
+        mPlayer->Play();
+    } else {
+        qDebug( "SatAppToneProvider::MatoPlayComplete stop playing");
+        // Stops playing if error.
+        stopPlayTone();
+    }
+    qDebug("SatAppToneProvider::MatoPlayComplete error %d <", aError);
+}
+
+//-----------------------------------------------------------------------------
+// SatAppToneProvider::MapcInitComplete
+// Initialisation complete -> starts playing the tone.
+// ----------------------------------------------------------------------------
+void SatAppToneProvider::MapcInitComplete( TInt aError, 
+    const TTimeIntervalMicroSeconds& /*aDuration*/ )
+{
+    qDebug( "SatAppToneProvider::MapcInitComplete >" );
+    // Audio player is initialised, so if there is no error, we can start 
+    // playing the tone.
+    if (KErrNone == aError && mAudioPlayer) {
+        const TInt volume( Max(0, Min(mVolume, 
+                           mAudioPlayer->MaxVolume())));
+        qDebug("CSatUiViewAppUi::\
+            MapcInitComplete SetVolume %d", volume );
+        // Set volume according Settings. 
+        mAudioPlayer->SetVolume( volume );
+        mAudioPlayer->Play();
+        qDebug( "SatAppToneProvider::MapcInitComplete Play" );
+    } else {
+        // Otherwise, we delete the initialised audio player.
+        if ( mAudioPlayer ) {
+            qDebug( "SatAppToneProvider::MapcInitComplete mAudioPlayer \
+                          true" );
+            delete mAudioPlayer;
+            mAudioPlayer = 0;
+        }
+
+        // Remove also the note for play tone
+        // If there was a duration for play tone, stop waiting
+        stopPlayTone();
+
+        qDebug( "SatAppToneProvider::MapcInitComplete Error %d", aError );
+    }
+    qDebug( "SatAppToneProvider::MapcInitComplete <" );
+}
+
+//-----------------------------------------------------------------------------
+// SatAppToneProvider::MapcPlayComplete
+// Deletes audio player after playing is completed.
+// ----------------------------------------------------------------------------
+void SatAppToneProvider::MapcPlayComplete( TInt /*aError*/ )
+{
+    qDebug( "SatAppToneProvider::MapcPlayComplete >" );
+
+    // When playing is completed, deleting the audio player.
+    if ( mAudioPlayer ) {
+        qDebug("SatAppToneProvider::MapcPlayComplete delete mAudioPlayer");
+        delete mAudioPlayer;
+        mAudioPlayer = 0;
+    }
+    // Remove note after play has completed.
+    stopPlayTone();
+    qDebug( "SatAppToneProvider::MapcPlayComplete <" );
+}
+
+
+//End of file
--- a/satui/satapp/src/satappuiprovider.cpp	Tue Jul 06 14:53:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1283 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-#include <QCoreApplication>
-#include <QTime> // GetInkey duration return
-#include <QTimer> // timeout callback
-#include <hbmainwindow.h> // softkey
-#include <hbdocumentloader.h> // application xml
-#include <hbaction.h> // action user response
-#include <hbmessagebox.h> // DisplayText, ConfirmSend,
-#include <hbdevicemessagebox.h> // CallControl, SetUpCall
-#include <hblabel.h> // DisplayText, GetInput, SetUpCall
-#include <hbinputdialog.h> // GetInkey
-#include <hbprogressdialog.h> // SendSms wait note
-#include <hblineedit.h> // For GetInput
-#include <hbinputeditorinterface.h> // GetInput
-#include <hbinputeditorinterface.h>
-#include <hbinputstandardfilters.h>
-#include <hbinputfilter.h> 
-#include <dialogwaiter.h>
-#include "satappview.h" // SetUpMenu, SelectItem
-#include "satappuiprovider.h"
-#include "tflogger.h"
-
-const char *SATAPP_DOCML = ":/xml/satapp.docml";
-const char *SATAPP_SETUPMENU_VIEW = "setupmenu_view";
-const char *SATAPP_SELECTITEM_VIEW = "selectitem_view";
-
-// ======== MEMBER FUNCTIONS ==================================================
-// TODO: #ifndef __WINS__ need to be remove when orbit works well. Now the macro
-// is to avoid panic on emulator. Deleting pointer before create dialog is to
-// avoid memory leak in emulator.
-
-// ----------------------------------------------------------------------------
-// SatAppUiProvider
-// ----------------------------------------------------------------------------
-//
-SatAppUiProvider::SatAppUiProvider(
-    HbMainWindow &window,
-    SatAppEventProvider &event,
-    QObject *parent) :
-    QObject(parent), mMainWindow(window), mLoader(0),
-    mSetupMenuView(0), mSelectItemView(0), mDisplayPopup(0),
-    mGetInkeyQuery(0),mYesNoPopup(0), mImmediateQuery(0), mGetInputQuery(0),
-    mConfirmSendQuery(0), mSetUpCallQuery(0), mCallControlMsg(0),
-    mConfirmBipQuery(0), mUserRsp(EUserNoResponse), mDigitalRsp(0), 
-    mMinLength(0), mTimer(0), mLoop(0),mWaitNote(0)
-{
-    TFLOGSTRING("SATAPP: SatAppUiProvider::SatAppUiProvider call");
-
-    bool docmlLoad = false;
-    mLoader = new SatAppDocumentLoader();
-    // ownership of the objects are transferred to caller
-    mObjects = mLoader->load(SATAPP_DOCML,&docmlLoad);
-    if (docmlLoad) {
-        TFLOGSTRING("SATAPP: SatAppUiProvider::SatAppUiProvider view found")
-        mSetupMenuView = qobject_cast<SatAppView *>(mLoader->findWidget
-        (SATAPP_SETUPMENU_VIEW));
-        if (mSetupMenuView) {
-            mMainWindow.addView(mSetupMenuView);
-            mSetupMenuView->setMainWindow(mMainWindow);
-            mSetupMenuView->initSetupMenu(event, *this);
-            mMainWindow.setCurrentView(mSetupMenuView);
-        }
-
-        mSelectItemView = qobject_cast<SatAppView *>(mLoader->findWidget
-        (SATAPP_SELECTITEM_VIEW));
-        if (mSelectItemView) {
-            mSelectItemView->setMainWindow(mMainWindow);
-            mSelectItemView->initSelectItem(event, *this);
-        }
-    } else {
-        TFLOGSTRING(
-        "SATAPP: SatAppUiProvider::SatAppUiProvider DOCML failure!");
-    }
-    TFLOGSTRING("SATAPP: SatAppUiProvider::SatAppUiProvider eixt");
-}
-
-// ----------------------------------------------------------------------------
-// activeView
-// ----------------------------------------------------------------------------
-//
-void SatAppUiProvider::activeView(const QString &view)
-{
-    TFLOGSTRING("SATAPP: SatAppUiProvider::activeView");
-    if(view == "setupmenu_view") {
-        mMainWindow.removeView(mMainWindow.currentView());
-        mMainWindow.addView(mSetupMenuView);
-        mMainWindow.setCurrentView(mSetupMenuView);
-        TFLOGSTRING("SATAPP: SatAppUiProvider::activeView setup menu");
-    } else {
-        mMainWindow.removeView(mMainWindow.currentView());
-        mMainWindow.addView(mSelectItemView);
-        mMainWindow.setCurrentView(mSelectItemView);
-        TFLOGSTRING("SATAPP: SatAppUiProvider::activeView select item");
-    }
-    TFLOGSTRING("SATAPP: SatAppUiProvider::activeView eixt");
-}
-
-// ----------------------------------------------------------------------------
-// Destructor
-// ----------------------------------------------------------------------------
-//
-SatAppUiProvider::~SatAppUiProvider()
-{
-    TFLOGSTRING("SATAPP: SatAppUiProvider::~SatAppUiProvider call");
-    stopShowWaitNote();
-    delete mLoader;
-    // delete all objects created from DOCML.
-    while (!mObjects.isEmpty()) {
-        TFLOGSTRING(
-        "SATAPP: SatAppUiProvider::~SatAppUiProvider object tree");
-        delete mObjects.takeFirst();
-    }
-    
-    if (mDisplayPopup) {
-        delete mDisplayPopup;
-        mDisplayPopup = 0;
-    }
-    
-    if (mGetInkeyQuery) {
-        delete mGetInkeyQuery;
-        mGetInkeyQuery = 0;
-    }
-
-    if (mYesNoPopup) {
-        delete mYesNoPopup;
-        mYesNoPopup = 0;
-    }
-
-    if (mImmediateQuery) {
-        delete mImmediateQuery;
-        mImmediateQuery = 0;
-    }
-    if (mGetInputQuery) {
-        delete mGetInputQuery;
-        mGetInputQuery = 0;
-    }
-    if (mConfirmSendQuery) {
-        delete mConfirmSendQuery;
-        mConfirmSendQuery = 0;
-    }
-
-    if (mSetUpCallQuery) {
-        delete mSetUpCallQuery;
-        mSetUpCallQuery = 0;
-    }
-
-    if (mConfirmBipQuery ) {
-        delete mConfirmBipQuery ;
-        mConfirmBipQuery  = 0;
-    }
-
-    if (mWaitNote) {
-        delete mWaitNote;
-        mWaitNote = 0;
-    }
-
-    if (mLoop && mLoop->isRunning()) {
-        mLoop->exit();
-        delete mLoop;
-        mLoop = 0;
-        TFLOGSTRING("SatAppUiProvider::~SatAppUiProvider exit loop")
-    }
-
-    if (mCallControlMsg) {
-        delete mCallControlMsg;
-        mCallControlMsg = 0;
-    }
-    TFLOGSTRING("SATAPP: SatAppUiProvider::~SatAppUiProvider exit");
-}
-
-// ----------------------------------------------------------------------------
-// userPrimaryResponse
-// ----------------------------------------------------------------------------
-//
-void SatAppUiProvider::userPrimaryResponse()
-{
-    mUserRsp = EUserPrimaryResponse;
-    TFLOGSTRING("SATAPP: SatAppUiProvider::userPrimaryResponse call-exit")
-}
-
-// ----------------------------------------------------------------------------
-// userSecondaryResponse
-// ----------------------------------------------------------------------------
-//
-void SatAppUiProvider::userSecondaryResponse()
-{
-    mUserRsp = EUserSecondaryResponse;
-    TFLOGSTRING("SATAPP: SatAppUiProvider::userSecondaryResponse call-exit")
-}
-
-// ----------------------------------------------------------------------------
-// showSetUpMenuView
-// ----------------------------------------------------------------------------
-//
-void SatAppUiProvider::showSetUpMenuView(
-    TSatUiResponse &aRes,
-    const QString &aText,
-    const QStringList &aMenuItems,
-    //const CArrayFixFlat<TSatAction> *aMenuItemNextActions,
-    //const HbIcon &aIcon,
-    //const CAknIconArray *aItemIconsArray,
-    const bool aSelfExplanatoryItems,
-    const bool aHelpIsAvailable)
-{
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showSetUpMenuView call")
-    stopShowWaitNote();
-    activeView("setupmenu_view");
-
-    // The text is the application name
-    // should be shown on the menu area always
-    if (!aText.isEmpty()) {
-        TFLOGSTRING2("SATAPP: SatAppUiProvider::showSetUpMenuView: title1",
-             aText.utf16())
-        mSetupMenuView->setTitle(aText);
-        TFLOGSTRING2("SATAPP: SatAppUiProvider::showSetUpMenuView: title2",
-             aText.utf16())
-        mSelectItemView->setTitle(aText);
-    }
-
-    mSetupMenuView->showSetUpMenuContent(aRes, aText, aMenuItems,
-            aSelfExplanatoryItems, aHelpIsAvailable);
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showSetUpMenuView exit")
-}
-
-// ----------------------------------------------------------------------------
-// showSelectItemView
-// ----------------------------------------------------------------------------
-//
-void SatAppUiProvider::showSelectItemView(
-    TSatUiResponse &aRes,
-    const QString &aText,
-    const QStringList &aMenuItems,
-    //const CArrayFixFlat<TSatAction> *aMenuItemNextActions,
-    const int aDefaultItem,
-    unsigned char &aSelection,
-    //const HbIcon &aIcon,
-    //const CAknIconArray *aItemsIconArray,
-    const bool aSelfExplanatoryItems,
-    const bool aHelpIsAvailable)
-{
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showSelectItemView call")
-    stopShowWaitNote();
-    activeView("selectitem_view");
-    mSelectItemView->showSelectItemContent(aRes, aText,
-        aMenuItems, aDefaultItem, aSelection,
-        aSelfExplanatoryItems, aHelpIsAvailable);
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showSelectItemView call")
-}
-
-
-// ----------------------------------------------------------------------------
-// showDisplayTextPopup
-// ----------------------------------------------------------------------------
-//
-TSatAppUserResponse SatAppUiProvider::showDisplayTextPopup(
-    const QString &aHeading,
-    const QString &aContent,
-    const int aDuration)
-{
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showDisplayTextPopup call")
-    resetUserResponse();
-    stopShowWaitNote();
-    
-    if (mDisplayPopup){
-        delete mDisplayPopup;
-        mDisplayPopup = NULL;
-    }
-    mDisplayPopup = new HbMessageBox(HbMessageBox::MessageTypeInformation);
-
-    if (mDisplayPopup) {
-        TFLOGSTRING(
-        "SATAPP: SatAppUiProvider::showDisplayTextPopup note created")
-
-        // Set the label as heading widget
-        HbLabel *lHeading = new HbLabel(aHeading, mDisplayPopup);
-        mDisplayPopup->setHeadingWidget(lHeading);
-        mDisplayPopup->setText(aContent);
-        mDisplayPopup->setIconVisible(false);
-        composeDialog(mDisplayPopup, aDuration, ESatDialogDisplayText);
-        TFLOGSTRING(
-        "SATAPP: SatAppUiProvider::showDisplayTextPopup duration before open")
-        DialogWaiter waiter;
-        mDisplayPopup->open(&waiter, SLOT(done(HbAction *)));
-        waiter.wait();
-        TFLOGSTRING(
-        "SATAPP: SatAppUiProvider::showDisplayTextPopup duration end open")
-#ifndef __WINS__
-        delete mDisplayPopup;
-        mDisplayPopup = 0;
-#endif
-    }
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showDisplayTextPopup exit")
-    return mUserRsp;
-}
-
-// ----------------------------------------------------------------------------
-// showGetInkeyQuery
-// ----------------------------------------------------------------------------
-//
-TSatAppUserResponse SatAppUiProvider::showGetInkeyQuery(
-    const QString &aHeading,
-    QString &aContent,
-    const TSatCharacterSet aCharacterSet,
-    unsigned int &aDuration)
-{
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInkeyQuery call")
-
-    resetUserResponse();
-    stopShowWaitNote();
-    
-    if (mGetInkeyQuery){
-        delete mGetInkeyQuery;
-        mGetInkeyQuery = NULL;
-    }
-    mGetInkeyQuery = new HbInputDialog();
-    if (mGetInkeyQuery) {
-        TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInkeyQuery note created")
-        // Set PromptText
-        mGetInkeyQuery->setPromptText(aHeading);
-        // Set ContentText
-        QVariant vContent(aContent);
-        mGetInkeyQuery->setValue(vContent);
-        HbEditorInterface inputMode(mGetInkeyQuery->lineEdit());
-        mGetInkeyQuery->lineEdit()->setFocus();
-        if (ESatDigitOnly == aCharacterSet) {
-            // digit mode, digits only (0 9, *, #, and +)
-            inputMode.setFilter(HbPhoneNumberFilter::instance());
-         } else {
-            // char mode
-            inputMode.setUpAsLatinAlphabetOnlyEditor();
-        }
-        composeDialog(mGetInkeyQuery, aDuration, ESatDialogGetInkey);
-        mGetInkeyQuery->lineEdit()->setMaxLength(1);
-        connect(mGetInkeyQuery->lineEdit(), SIGNAL(textChanged(QString)),
-            this, SLOT(updateQueryAction(QString)));
-        TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInkeyQuery before pop")
-        DialogWaiter waiter;
-        mGetInkeyQuery->open(&waiter, SLOT(done(HbAction *)));
-        waiter.wait();
-        TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInkeyQuery end pop")
-
-        QString inputString = (mGetInkeyQuery->value()).toString();
-        aContent = inputString;
-        
-#ifndef __WINS__
-        delete mGetInkeyQuery;
-        mGetInkeyQuery = 0;
-#endif
-    }
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInkeyQuery exit")
-    return mUserRsp;
-}
-
-// ----------------------------------------------------------------------------
-// showGetYesNoQuery
-// ----------------------------------------------------------------------------
-//
-int SatAppUiProvider::showGetYesNoQuery(
-    const QString &aText,
-    const TSatCharacterSet aCharacterSet,
-    unsigned int &aInkey,
-    unsigned int &aDuration,
-    const bool aImmediateDigitResponse)
-{
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showGetYesNoQuery call")
-    resetUserResponse();
-    stopShowWaitNote();
-    TFLOGSTRING2("SATAPP: SatAppUiProvider::showGetYesNoQuery duration in=%d",
-            aDuration)
-    if (ESatYesNo == aCharacterSet) {
-        if (mYesNoPopup){
-            delete mYesNoPopup;
-            mYesNoPopup = 0;
-       }
-        mYesNoPopup = new HbMessageBox(HbMessageBox::MessageTypeInformation);
-
-        if (mYesNoPopup) {
-            TFLOGSTRING("SATAPP: SatAppUiProvider::showGetYesNoQuery normal")
-            // Set the label as heading widget
-            HbLabel *lHeading = new HbLabel(aText, mYesNoPopup);
-            mYesNoPopup->setHeadingWidget(lHeading);
-            mYesNoPopup->setIconVisible(false);
-
-            composeDialog(mYesNoPopup, aDuration, ESatDialogGetYesNo);
-
-            TFLOGSTRING("SATAPP: SatAppUiProvider::showGetYesNoQuery before open")
-            DialogWaiter waiter;
-            mYesNoPopup->open(&waiter, SLOT(done(HbAction *)));
-            waiter.wait();
-            TFLOGSTRING( "SATAPP: SatAppUiProvider::showGetYesNoQuery after open")
-            mYesNoPopup->close();
-        }
-    } else if (aImmediateDigitResponse) {
-        if (mImmediateQuery) {
-            delete mImmediateQuery;
-            mImmediateQuery = 0;
-        }
-        mImmediateQuery = new HbInputDialog();
-        if (mImmediateQuery) {
-            mImmediateQuery->setPromptText(aText);
-            // user can choose the charactor or digital , and only cancel
-            // key press, then close current dialog
-            TFLOGSTRING("SATAPP: SatAppUiProvider::showGetYesNoQuery immediate")
-            composeDialog(mImmediateQuery, aDuration, ESatDialogGetDigitalRsp);
-            bool ret = connect(mImmediateQuery->lineEdit(), 
-               SIGNAL(textChanged(QString)),
-               this, SLOT(updateQueryAction(QString)));
-            TFLOGSTRING2("SATAPP: SatAppUiProvider::showGetYesNoQuery:\
-               connect updateQueryAction=%d", ret)
-            // digit mode, digits only (0 9, *, #, and +)
-            HbEditorInterface inputMode(mImmediateQuery->lineEdit());
-            inputMode.setFilter(HbPhoneNumberFilter::instance());
-            if (mLoop) {
-                TFLOGSTRING("SatAppUiProvider::showGetYesNoQuery delete loop")
-                delete mLoop;
-                mLoop = 0;
-            }
-            if (mTimer) {
-                delete mTimer;
-                mTimer = 0;
-                TFLOGSTRING("SatAppUiProvider::showGetYesNoQuery delete timer")
-            }
-            mTimer = new QTimer(this);
-            mTimer->start(aDuration);
-            ret = connect(mTimer, SIGNAL(timeout()), mTimer, SLOT(stop()));
-            TFLOGSTRING2("SATAPP: SatAppUiProvider::showGetYesNoQuery connect\
-                mTimer stop: %d", ret)
-            mLoop = new QEventLoop(this);
-            ret = connect(mTimer, SIGNAL(timeout()), mLoop, SLOT(quit()));
-            TFLOGSTRING("SATAPP: SatAppUiProvider::showGetYesNoQuery befor pop")
-            mImmediateQuery->open();
-            mLoop->exec();
-            TFLOGSTRING("SATAPP: SatAppUiProvider::showGetYesNoQuery end pop")
-            if (mTimer->isActive()) {
-                TFLOGSTRING("SATAPP: SatAppUiProvider::showGetYesNoQuery stop time")
-                mTimer->stop();
-            }
-            aInkey = mDigitalRsp;
-            mImmediateQuery->close();
-        }
-    }
-    return  mUserRsp;
-}
-
-// ----------------------------------------------------------------------------
-// showGetInputQuery
-// ----------------------------------------------------------------------------
-//
-TSatAppUserResponse SatAppUiProvider::showGetInputQuery(
-    const QString &heading,
-    QString &content,
-    const TSatCharacterSet characterSet,
-    const int minLength,
-    const int maxLength,
-    const bool aHideInput)
-{
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInputQuery call")
-    TFLOGSTRING3("SATAPP: SatAppUiProvider::showGetInputQuery \
-                  min %d max %d length", minLength, maxLength)
-    resetUserResponse();
-    stopShowWaitNote();
-    mMinLength = minLength;
-    
-    if (mGetInputQuery){
-        delete mGetInputQuery;
-        mGetInputQuery = NULL;
-    }    
-    mGetInputQuery = new HbInputDialog();
-    mGetInputQuery->setPromptText(heading);
-    QVariant vContent(content);
-    mGetInputQuery->setValue(vContent);
-    HbEditorInterface inputMode(mGetInputQuery->lineEdit());
-    mGetInputQuery->lineEdit()->setFocus();
-    if (ESatDigitOnly == characterSet) {
-        // digit mode, digits only (0 9, *, #, and +)
-        inputMode.setFilter(HbPhoneNumberFilter::instance());
-    } else {
-        // char mode
-        inputMode.setUpAsLatinAlphabetOnlyEditor();
-    }
-    
-    mGetInputQuery->lineEdit()->setMaxLength(maxLength);
-
-    composeDialog(mGetInputQuery, KDefaultSelectionTimeoutMseconds, ESatDialogGetInput);
-    // Sets the "OK"-action/button
-    if ((0 == minLength || content.length() >= minLength) && 
-         mGetInputQuery->actions().at(0)) {
-        mGetInputQuery->actions().at(0)->setEnabled(true);
-    } 
-
-    if (aHideInput) {
-        mGetInputQuery->lineEdit()->setEchoMode(HbLineEdit::Password);
-        
-        bool res = connect(mGetInputQuery->lineEdit(), 
-            SIGNAL(contentsChanged()), this, SLOT(contentChanged()));
-        TFLOGSTRING2("SATAPP: SatAppUiProvider::showGetInputQuery \
-                     connect %d",res);
-    }else {
-        connect(mGetInputQuery->lineEdit(), SIGNAL(textChanged(QString)),
-            this, SLOT(updateQueryAction(QString)));        
-    }
-
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInputQuery before pop")
-    DialogWaiter waiter;
-    mGetInputQuery->open(&waiter, SLOT(done(HbAction *)));
-    waiter.wait();
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInputQuery end pop")
-
-    content = (mGetInputQuery->value()).toString();
-    
-#ifndef __WINS__
-    delete mGetInputQuery;
-    mGetInputQuery = 0;
-#endif
-
-    TFLOGSTRING2("SATAPP: SatAppUiProvider::showGetInputQuery mUserRsp =%d exit",
-            mUserRsp)
-    return mUserRsp;
-}
-
-// ----------------------------------------------------------------------------
-// SatAppInputProvider::contentChanged
-// Called when editor field is modified
-// ----------------------------------------------------------------------------
-//
-void SatAppUiProvider::contentChanged()
-{
-    if (mGetInputQuery) {
-        QString content = (mGetInputQuery->value()).toString();
-        updateQueryAction(content);
-    }
-}
-
-// ----------------------------------------------------------------------------
-// Called when editor field is modified
-// ----------------------------------------------------------------------------
-//
-void SatAppUiProvider::updateQueryAction(QString text)
-{
-    TFLOGSTRING("SATAPP: SatAppUiProvider::updateQueryAction call")
-    // Get Input
-    if (mGetInputQuery && mGetInputQuery->actions().at(0)) {
-        if (text.length() >= mMinLength ) {
-            mGetInputQuery->actions().at(0)->setEnabled(true);
-        } else {
-            mGetInputQuery->actions().at(0)->setEnabled(false);
-        }
-    }
-
-    // Get InKey
-    if (mGetInkeyQuery && mGetInkeyQuery->actions().at(0)) {
-        if (1 == text.length()) {
-            mGetInkeyQuery->actions().at(0)->setEnabled(true);
-        } else {
-            mGetInkeyQuery->actions().at(0)->setEnabled(false); 
-        }
-    }
-    if (mImmediateQuery) {
-        TFLOGSTRING("SATAPP: SatAppUiProvider::updateQueryAction \
-            digital immediate")
-        immediateResponse(text);
-    }
-    TFLOGSTRING("SATAPP: SatAppUiProvider::updateQueryAction exit")
-}
-
-// ----------------------------------------------------------------------------
-// showConfirmSendQuery
-// ----------------------------------------------------------------------------
-//
-void SatAppUiProvider::showConfirmSendQuery(
-    const QString &aText,
-    bool &aActionAccepted)
-{
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmSendQuery call")
-    resetUserResponse();
-    
-    if (mConfirmSendQuery){
-        delete mConfirmSendQuery;
-        mConfirmSendQuery = NULL;
-    }
-    mConfirmSendQuery = new HbMessageBox(HbMessageBox::MessageTypeQuestion);
-    if(mConfirmSendQuery) {
-        mConfirmSendQuery->setText(aText);
-        composeDialog(mConfirmSendQuery, 0, ESatDialogConfirmSend);
-
-        TFLOGSTRING("SATAPP: SatAppUiProvider::confirmSend before open")
-        DialogWaiter waiter;
-        mConfirmSendQuery->open(&waiter, SLOT(done(HbAction *)));
-        waiter.wait();
-        TFLOGSTRING("SATAPP: SatAppUiProvider::confirmSend after open")
-        
-#ifndef __WINS__
-        delete mConfirmSendQuery;
-        mConfirmSendQuery = 0;
-#endif
-    }
-    aActionAccepted = (EUserPrimaryResponse == mUserRsp) ? true : false;
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmSendQuery exit")
-}
-
-// ----------------------------------------------------------------------------
-// showSmsWaitNote
-// ----------------------------------------------------------------------------
-//
-void SatAppUiProvider::showSmsWaitNote(const QString &aText)
-{
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showSmsWaitNote")
-    if (mWaitNote) {
-        delete mWaitNote;
-        mWaitNote = 0;
-    }
-    mWaitNote = new HbProgressDialog(HbProgressDialog::WaitDialog);
-    //remove the default cancel softkey
-    if (mWaitNote){
-        mWaitNote->clearActions();
-        if(aText.isEmpty()) {
-            mWaitNote->setText(hbTrId("txt_sat_sendingtextmessage"));
-        } else {
-            mWaitNote->setText(aText);
-        }
-        mWaitNote->show();
-        // Extend showing sms wait note  timer for test
-        extendNoteShowtime();        
-    }
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showSmsWaitNote exit")
- }
-
-// ----------------------------------------------------------------------------
-// showDtmfWaitNote
-// ----------------------------------------------------------------------------
-//
-void SatAppUiProvider::showDtmfWaitNote(
-    TSatUiResponse &aRes,
-    const QString &aText)
-{
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showDtmfWaitNote call")
-    aRes = ESatSuccess;
-
-    if (mWaitNote) {
-        delete mWaitNote;
-        mWaitNote = 0;
-    }
-
-    mWaitNote = new HbProgressDialog(HbProgressDialog::WaitDialog);
-    //remove the default cancel softkey
-    bool ret = connect(mWaitNote->actions().at(0), SIGNAL(triggered()),
-                       this, SLOT(cancelResponse()));
-    TFLOGSTRING2("SATAPP: SatAppUiProvider::showDtmfWaitNote \
-    primaryAction=%d", ret)
-    if(aText.isEmpty()) {
-        mWaitNote->setText(hbTrId("txt_sat_senddtmf_wait_note"));
-    } else {
-        mWaitNote->setText(aText);
-    }
-    mWaitNote->show();
-    // Extend showing sms wait note  timer for test
-    extendNoteShowtime();
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showDtmfWaitNote exit")
- }
-
-// ----------------------------------------------------------------------------
-//stopShowWaitNote
-// ----------------------------------------------------------------------------
-//
-void SatAppUiProvider::stopShowWaitNote()
-{
-    TFLOGSTRING("SATAPP: SatAppUiProvider::stopShowWaitNote call")
-
-    if (mWaitNote) {
-        TFLOGSTRING("SATAPP: SatAppUiProvider::mWaitNote close")
-        mWaitNote->close();
-        delete mWaitNote;
-        mWaitNote = 0;
-    }
-
-    if (mCallControlMsg) {
-        TFLOGSTRING("SATAPP: SatAppUiProvider::mCallControlMsg close")
-        mCallControlMsg->close();
-        delete mCallControlMsg;
-        mCallControlMsg = 0;
-    }
-    TFLOGSTRING("SATAPP: SatAppUiProvider::stopShowWaitNote exit")
-}
-
-// ----------------------------------------------------------------------------
-// showConfirmSetUpCallQUery
-// ----------------------------------------------------------------------------
-//
-void SatAppUiProvider::showConfirmSetUpCallQuery(
-    const QString &aText,
-    const QString &aSimAppName,
-    bool &aActionAccepted)
-{
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmSetUpCallQUery call")
-    resetUserResponse();
-
-    QString alphaId;
-    if (aText.length() == 0){
-        if (aSimAppName.length() > 0){
-            alphaId.append(aSimAppName);
-        } else {
-            alphaId.append(hbTrId("txt_sat_title"));
-        }
-        alphaId.append(hbTrId("txt_sat_setupcall_confirm_note"));
-        TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmSetUpCallQUery length 0")
-    } else {
-        alphaId.append(aText);
-        TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmSetUpCallQUery exit")
-    }
-    if (mSetUpCallQuery){
-        delete mSetUpCallQuery;
-        mSetUpCallQuery = NULL;
-    }
-    
-    mSetUpCallQuery = new HbMessageBox(HbMessageBox::MessageTypeQuestion);
-    if(mSetUpCallQuery) {
-        mSetUpCallQuery->setText(alphaId);
-        composeDialog(mSetUpCallQuery, 0, ESatDialogSetUpCall);
-
-        TFLOGSTRING("SATAPP: SatAppSetUpCall::showSetUpCallConfirm before open")
-        DialogWaiter waiter;
-        mSetUpCallQuery->open(&waiter, SLOT(done(HbAction *)));
-        waiter.wait();
-        TFLOGSTRING("SATAPP: SatAppSetUpCall::showSetUpCallConfirm after open")
-        
-#ifndef __WINS__
-        delete mSetUpCallQuery;
-        mSetUpCallQuery = 0;
-#endif
-    }
-    aActionAccepted = (EUserPrimaryResponse == mUserRsp) ? true : false;
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmSetUpCallQUery exit")
-}
-
-// ----------------------------------------------------------------------------
-// clearScreen
-// ----------------------------------------------------------------------------
-//
-void SatAppUiProvider::clearScreen()
-{
-    TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen called")
-    if (mDisplayPopup) {
-        TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen DisplayText")
-        mDisplayPopup->close();
-        mDisplayPopup = NULL;
-    }
-    if (mGetInkeyQuery) {
-        TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen GetInkey")
-        mGetInkeyQuery->close();
-        mGetInkeyQuery = NULL;
-    }
-
-    if (mYesNoPopup) {
-        TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen mYesNoPopup")
-        mYesNoPopup->close();
-        delete mYesNoPopup;
-        mYesNoPopup = 0;
-    }
-
-    if (mImmediateQuery) {
-        TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen mImmediateQuery")
-        mImmediateQuery->close();
-        mImmediateQuery = NULL;
-    }
-
-    if (mGetInputQuery) {
-        TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen GetInput")
-        mGetInputQuery->close();
-        mGetInputQuery = NULL;
-    }
-
-    if(mConfirmSendQuery) {
-        TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen ConfirmSend")
-        mConfirmSendQuery->close();
-        mConfirmSendQuery = NULL;
-    }
-
-    if (mSetUpCallQuery) {
-        TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen SetUpCall")
-        mSetUpCallQuery->close();
-        mSetUpCallQuery = NULL;
-    }
-
-    if (mCallControlMsg){
-        TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen CallControlMsg")
-        mCallControlMsg->close();
-        mCallControlMsg = NULL;
-    }
-
-    if (mConfirmBipQuery){
-        TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen ConfirmBip")
-        mConfirmBipQuery->close();
-        mConfirmBipQuery = NULL;
-    }
-
-    if (mWaitNote){
-        TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen WaitNote")
-        mWaitNote->close();
-        mWaitNote = NULL;
-    }
-    mUserRsp = EUserClearResponse;
-    TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen exit")
-}
-
-// ----------------------------------------------------------------------------
-// closeUi
-// ----------------------------------------------------------------------------
-//
-void SatAppUiProvider::closeUi()
-    {
-    TFLOGSTRING("SATAPP: SatAppUiProvider::closeUi called")
-    clearScreen();
-    mUserRsp = EUserCloseResponse;
-    QCoreApplication::instance()->quit();
-    TFLOGSTRING("SATAPP: SatAppUiProvider::closeUi exit")
-}
-
-// ----------------------------------------------------------------------------
-// resetUserResponse
-// ----------------------------------------------------------------------------
-//
-void SatAppUiProvider::resetUserResponse()
-{
-    TFLOGSTRING("SATAPP: SatAppUiProvider::resetUserResponse call")
-    mUserRsp = EUserNoResponse;
-    mDigitalRsp = Qt::Key_unknown;
-    mMinLength = 0;
-    TFLOGSTRING("SATAPP: SatAppUiProvider::resetUserResponse exit")
-}
-
-// ----------------------------------------------------------------------------
-// composeDialog: make sure dlg has 2 buttons
-// ----------------------------------------------------------------------------
-//
-void SatAppUiProvider::composeDialog(
-    HbDialog *dlg, 
-    int aDuration,
-    TSatAppDialogActionType type, 
-    bool aModal/* = true*/,
-    HbDialog::DismissPolicy aDismissPolicy/* = HbDialog::NoDismiss*/)
-{
-    TFLOGSTRING("SATAPP: SatAppUiProvider::composeDialog call")
-
-    dlg->setModal(aModal);
-    dlg->setDismissPolicy(aDismissPolicy);
-    if (aDuration){
-        dlg->setTimeout(aDuration);
-    } else {
-        dlg->setTimeout(HbDialog::NoTimeout);
-    }
-    
-    dlg->clearActions();
-    HbAction *primaryAction = new HbAction(dlg);
-    dlg->addAction(primaryAction);
-    bool ret = connect(primaryAction, SIGNAL(triggered()),
-                       this, SLOT(userPrimaryResponse()));
-    TFLOGSTRING2("SATAPP: SatAppUiProvider::composeDialog \
-        primaryAction=%d", ret)   
-    
-    HbAction *secondaryAction = new HbAction(dlg);
-    dlg->addAction(secondaryAction);
-    ret = connect(secondaryAction, SIGNAL(triggered()),
-                  this, SLOT(userSecondaryResponse()));
-    TFLOGSTRING2("SATAPP: SatAppUiProvider::composeDialog \
-        secondaryAction=%d", ret)
-    
-    if (ESatDialogDisplayText == type){
-        primaryAction->setText(hbTrId("txt_sat_general_ok"));
-        secondaryAction->setText(hbTrId("txt_sat_general_back"));
-        TFLOGSTRING("SATAPP: SatAppUiProvider::composeDialog \
-            ESatDialogDisplayText")
-    } else if (ESatDialogGetInput == type){
-        primaryAction->setText(hbTrId("txt_sat_general_ok"));
-        primaryAction->setEnabled(false);
-        secondaryAction->setText(hbTrId("txt_sat_general_cancel"));
-        TFLOGSTRING("SATAPP: SatAppUiProvider::composeDialog \
-            ESatDialogGetInput")
-    } else if (ESatDialogGetInkey == type){
-        primaryAction->setText(hbTrId("txt_sat_general_ok"));
-        primaryAction->setEnabled(false);
-        secondaryAction->setText(hbTrId("txt_sat_general_cancel"));
-        TFLOGSTRING("SATAPP: SatAppUiProvider::composeDialog \
-            ESatDialogGetInkey")
-    } else if (ESatDialogGetYesNo == type){
-        primaryAction->setText(hbTrId("txt_sat_general_yes"));
-        secondaryAction->setText(hbTrId("txt_sat_general_no"));
-        TFLOGSTRING("SATAPP: SatAppUiProvider::composeDialog \
-            ESatDialogGetYesNo")
-    } else if (ESatDialogGetDigitalRsp == type){
-        dlg->removeAction(primaryAction);
-        secondaryAction->setText(hbTrId("txt_sat_general_cancel"));
-        ret = connect(secondaryAction, SIGNAL(triggered()),
-                      this, SLOT(handleImmediateCancel()));
-        TFLOGSTRING2("SATAPP: SatAppUiProvider::composeDialog \
-            con secondaryAction=%d", ret)
-        TFLOGSTRING("SATAPP: SatAppUiProvider::composeDialog \
-            ESatDialogGetDigitalRsp")
-    } else if (ESatDialogSetUpCall == type){
-        primaryAction->setText(hbTrId("txt_sat_general_call"));
-        secondaryAction->setText(hbTrId("txt_sat_general_cancel"));
-        TFLOGSTRING("SATAPP: SatAppUiProvider::composeDialog \
-            ESatDialogSetUpCall")
-    } else if (ESatDialogConfirmSend == type){
-        primaryAction->setText(hbTrId("txt_sat_general_send"));
-        secondaryAction->setText(hbTrId("txt_sat_general_cancel"));
-        TFLOGSTRING("SATAPP: SatAppUiProvider::composeDialog \
-            ESatDialogConfirmSend")
-    } else if (ESatDialogConfirmBip == type){
-        primaryAction->setText(hbTrId("txt_sat_general_ok"));
-        secondaryAction->setText(hbTrId("txt_sat_general_cancel"));
-        TFLOGSTRING("SATAPP: SatAppUiProvider::composeDialog \
-            ESatDialogConfirmBip")
-    }
-    
-    TFLOGSTRING("SATAPP: SatAppUiProvider::composeDialog exit")
-}
-
-// ----------------------------------------------------------------------------
-// docmlLoader
-// ----------------------------------------------------------------------------
-//
-SatAppDocumentLoader *SatAppUiProvider::docmlLoader()
-{
-    TFLOGSTRING("SATAPP: SatAppUiProvider::docmlLoader call-exit");
-    return mLoader;
-}
-
-// ----------------------------------------------------------------------------
-// createObject
-// ----------------------------------------------------------------------------
-//
-QObject *SatAppDocumentLoader::createObject(
-    const QString &type,
-    const QString &name)
-{
-    TFLOGSTRING("SATAPP: SatAppDocumentLoader::createObject")
-    if (type == SatAppView::staticMetaObject.className()) {
-        QObject *object = new SatAppView();
-        TFLOGSTRING2(
-        "SATAPP: SatAppDocumentLoader::createObject %S", name.utf16())
-        object->setObjectName(name);
-        TFLOGSTRING("SATAPP: SatAppDocumentLoader::createObject sat view exit")
-        return object;
-        }
-    TFLOGSTRING("SATAPP: SatAppDocumentLoader::createObject other exit")
-    return HbDocumentLoader::createObject(type, name);
-}
-
-// ----------------------------------------------------------------------------
-//extendNoteShowtime
-// ----------------------------------------------------------------------------
-//
-void SatAppUiProvider::extendNoteShowtime()
-{
-    TFLOGSTRING("SatAppUiProvider::extendNoteShowtime")
-    if (mTimer) {
-        delete mTimer;
-        mTimer = 0;
-        TFLOGSTRING("SatAppUiProvider::extendNoteShowtime delete timer")
-    }
-    if (mLoop) {
-        delete mLoop;
-        mLoop = 0;
-        TFLOGSTRING("SatAppUiProvider::extendNoteShowtime delete loop")
-    }
-    mTimer = new QTimer(this);
-    mTimer->start(KExtendTimeoutMseconds);
-    bool ret = connect(mTimer, SIGNAL(timeout()), mTimer, SLOT(stop()));
-    TFLOGSTRING2("SATAPP: SatAppUiProvider::extendNoteShowtime connect\
-        mTimer stop: %d", ret)
-
-    mLoop = new QEventLoop(this);
-    ret = connect(mTimer, SIGNAL(timeout()), mLoop, SLOT(quit()));
-    TFLOGSTRING2("SATAPP: SatAppUiProvider::extendNoteShowtime connect \
-       syn: %d", ret)
-    mLoop->exec(QEventLoop::AllEvents);
-    TFLOGSTRING("SatAppUiProvider::extendNoteShowtime exit")
-}
-
-// ----------------------------------------------------------------------------
-//cancelResponse
-// ----------------------------------------------------------------------------
-//
-void SatAppUiProvider::cancelResponse()
-{
-    TFLOGSTRING("SatAppUiProvider::cancelResponse")
-    if (mWaitNote) {
-        TFLOGSTRING("SatAppUiProvider::cancelResponse user cancel")
-        if (mTimer) {
-            mTimer->stop();
-            TFLOGSTRING("SatAppUiProvider::cancelResponse time out")
-        }
-        if (mLoop && mLoop->isRunning()) {
-            mLoop->exit();
-            TFLOGSTRING("SatAppUiProvider::cancelResponse exit loop")
-        }
-        mWaitNote->setEnabled(false);
-        mWaitNote->close();
-        emit userCancelResponse();
-    }
-    TFLOGSTRING("SatAppUiProvider::cancelResponse exit")
-}
-
-// ----------------------------------------------------------------------------
-//showSsWaitNote
-// Displays a wait note to indicate SS sending.
-// ----------------------------------------------------------------------------
-//
-void SatAppUiProvider::showSsWaitNote(const QString &aText,
-        const bool aSelfExplanatoryIcon)
-{
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showSsWaitNote")
-    if (mWaitNote) {
-        delete mWaitNote;
-        mWaitNote = 0;
-    }
-    mWaitNote = new HbProgressDialog(HbProgressDialog::WaitDialog);
-    mWaitNote->clearActions();
-    if (aText.length()) {
-        if (!aSelfExplanatoryIcon)  {
-            TFLOGSTRING("SATAPP: SatAppUiProvider::showSsWaitNote !Icon")
-            mWaitNote->setText(aText);
-        } else {
-            TFLOGSTRING("SATAPP: SatAppUiProvider::showSsWaitNote send")
-            mWaitNote->setText(hbTrId("txt_sat_sendss_wait_note_send"));
-        }    
-    }  else {
-        mWaitNote->setText(hbTrId("txt_sat_sendss_wait_note_request"));
-    }
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showSsWaitNote show before")
-    mWaitNote->show();
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showSsWaitNote exit")
-}
-
-// ----------------------------------------------------------------------------
-//showWaitNoteWithoutDelay
-// 
-// ----------------------------------------------------------------------------
-//
-void SatAppUiProvider::showWaitNoteWithoutDelay()
-{
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showWaitNoteWithoutDelay")
-    if (mWaitNote) {
-        delete mWaitNote;
-        mWaitNote = 0;
-    }
-    mWaitNote = new HbProgressDialog(HbProgressDialog::WaitDialog);
-    mWaitNote->clearActions();
-    mWaitNote->setText(hbTrId("txt_sat_wait_note_without_delay"));
-    mWaitNote->show();
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showWaitNoteWithoutDelay exit")
-}
-
-// ----------------------------------------------------------------------------
-//showSsErrorNote
-// 
-// ----------------------------------------------------------------------------
-//
-void SatAppUiProvider::showSsErrorNote()
-{
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showSsErrorNote")
-    HbMessageBox::warning(hbTrId("txt_sat_sendss_error_note"));
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showSsErrorNote exit")
-}
-
-// ----------------------------------------------------------------------------
-// showConfirmOpenChannelQuery
-// ----------------------------------------------------------------------------
-//
-void SatAppUiProvider::showConfirmOpenChannelQuery(
-        const QString &aText,
-        bool &aActionAccepted)
-{
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmOpenChannelQuery call")
-    stopShowWaitNote();
-    if (mConfirmBipQuery){
-        delete mConfirmBipQuery;
-        mConfirmBipQuery = NULL;
-    }
-    QString title = aText;
-    if (!aText.length()){
-        title = hbTrId("txt_sat_openchannel_confirm_note");
-    }
-
-    mConfirmBipQuery = new HbMessageBox(HbMessageBox::MessageTypeQuestion);
-    if(mConfirmBipQuery) {
-        // Sets the "Yes"-action/button
-        mConfirmBipQuery->setText(title);    
-        composeDialog(mConfirmBipQuery, 0, ESatDialogConfirmBip);
-
-        TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmOpenChannelQuery before open")
-        DialogWaiter waiter;
-        mConfirmBipQuery->open(&waiter, SLOT(done(HbAction *)));
-        waiter.wait();
-        TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmOpenChannelQuery after open")
-
-        delete mConfirmBipQuery;
-        mConfirmBipQuery = 0;
-    }
-
-    aActionAccepted = (EUserPrimaryResponse == mUserRsp) ? true : false;
-    
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmOpenChannelQuery exit")
-}
-
-// ----------------------------------------------------------------------------
-//showCallControlNote
-// 
-// ----------------------------------------------------------------------------
-//
-void SatAppUiProvider::showCallControlNote(const QString &aText)
-{
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showCallControlNote")
-    if (mCallControlMsg) {
-        delete mCallControlMsg;
-        mCallControlMsg = 0;
-    }
-    mCallControlMsg = new HbDeviceMessageBox(HbMessageBox::MessageTypeInformation);
-    mCallControlMsg->setText(aText);
-    mCallControlMsg->show();
-    // Extend showing sms wait note  timer for test
-    extendNoteShowtime();
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showCallControlNote exit")
-
-}
-
-// ----------------------------------------------------------------------------
-// showBIPWaitNote
-// ----------------------------------------------------------------------------
-//
-void SatAppUiProvider::showBIPWaitNote(const QString &aText)
-{
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showBIPWaitNote call")
-    if (!mWaitNote) {
-        mWaitNote = new HbProgressDialog(HbProgressDialog::WaitDialog);
-        mWaitNote->setText(aText);
-
-        //remove the default cancel softkey
-        bool ret = connect(mWaitNote->actions().at(0), SIGNAL(triggered()),
-                           this, SLOT(cancelResponse()));
-        TFLOGSTRING2("SATAPP: SatAppUiProvider::showDtmfWaitNote \
-        primaryAction=%d", ret)
-    
-        mWaitNote->show();
-    } else {
-        mWaitNote->setText(aText);
-        TFLOGSTRING("SATAPP: SatAppUiProvider::showBIPWaitNote Update Text")
-    }    
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showBIPWaitNote exit")
-}
-
-// ----------------------------------------------------------------------------
-//showMoSmControlNote
-//
-// ----------------------------------------------------------------------------
-//
-void SatAppUiProvider::showMoSmControlNote(const QString &aText)
-{
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showMoSmControlNote")
-    HbMessageBox::information(aText);
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showMoSmControlNote exit")
-
-}
-
-// ----------------------------------------------------------------------------
-// showCloseChannelWaitNote
-// ----------------------------------------------------------------------------
-//
-void SatAppUiProvider::showCloseChannelWaitNote(const QString &aText)
-{
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showCloseChannelWaitNote call")
-    if (mWaitNote) {
-        delete mWaitNote;
-        mWaitNote = 0;
-    }   
-    mWaitNote = new HbProgressDialog(HbProgressDialog::WaitDialog);
-    mWaitNote->clearActions();
-    mWaitNote->setText(aText);
-    mWaitNote->show();
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showCloseChannelWaitNote exit")
-}
-
-// ----------------------------------------------------------------------------
-//showSatInfoNote
-//
-// ----------------------------------------------------------------------------
-//
-void SatAppUiProvider::showSatInfoNote(const QString &aText)
-{
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showSatInfoNote")
-    HbMessageBox::information(aText);
-    TFLOGSTRING("SATAPP: SatAppUiProvider::showSatInfoNote exit")
-}
-
-
-// ----------------------------------------------------------------------------
-//handleImmediateCancel
-//
-// ----------------------------------------------------------------------------
-//
-void SatAppUiProvider::handleImmediateCancel()
-{
-    TFLOGSTRING("SATAPP: SatAppUiProvider::handleImmediateCancel")
-    if (mLoop && mLoop->isRunning()) {
-        mLoop->quit();
-    }
-    TFLOGSTRING("SATAPP: SatAppUiProvider::handleImmediateCancel exit")
-}
-
-// ----------------------------------------------------------------------------
-//immediateResponse
-//
-// ----------------------------------------------------------------------------
-//
-void SatAppUiProvider::immediateResponse(QString text)
-{
-    TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse")
-    if (mLoop && mLoop->isRunning()) {
-        mLoop->quit();
-    }
-    if ("0" == text) {
-        mDigitalRsp = Qt::Key_0;
-        TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse 0")
-    } else if ("1" == text) {
-        mDigitalRsp = Qt::Key_1;
-        TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse 1")
-    } else if ("2" == text) {
-        mDigitalRsp = Qt::Key_2;
-        TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse 2")
-    } else if ("3" == text) {
-        mDigitalRsp = Qt::Key_3;
-        TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse 3")
-    } else if ("4" == text) {
-        mDigitalRsp = Qt::Key_4;
-        TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse 4")
-    }else if ("5" == text) {
-        mDigitalRsp = Qt::Key_5;
-        TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse 5")
-    } else if ("6" == text) {
-        mDigitalRsp = Qt::Key_6;
-        TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse 6")
-    } else if ("7" == text) {
-        mDigitalRsp = Qt::Key_7;
-        TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse 7")
-    } else if ("8" == text) {
-        mDigitalRsp = Qt::Key_8;
-        TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse 8")
-    } else if ("9" == text) {
-        mDigitalRsp = Qt::Key_9;
-        TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse 9")
-    } else if ("+" == text) {
-        mDigitalRsp = Qt::Key_Plus;
-        TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse +")
-    } else if ("*" == text) {
-        mDigitalRsp = Qt::Key_Asterisk;
-        TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse *")
-    } else if ("#" == text) {
-        mDigitalRsp = Qt::Key_NumberSign;
-        TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse #")
-    }
-    mUserRsp = EUserPrimaryResponse;
-    TFLOGSTRING2("SATAPP: SatAppUiProvider::immediateResponse key %x",
-        mDigitalRsp)
-
-    TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse exit")
-}
-
-// End of file
--- a/satui/satapp/src/satappview.cpp	Tue Jul 06 14:53:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,463 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*
-*/
-#include <QTimer>
-#include <hbaction.h>
-#include <hbmainwindow.h>
-#include <hbview.h>
-#include <hblistwidget.h>
-#include <hblistwidgetitem.h>
-#include <hblabel.h>
-#include <hbmenu.h>
-
-#include "satappuiprovider.h"
-#include "satappeventprovider.h"
-#include "satappview.h"
-#include "tflogger.h"
-#include "satappcommonconstant.h"
-
-const char *SATAPP_MENUITEM = "s:ListWidget";
-const char *SATAPP_SUBTITLE = "t:label";
-const char *SATAPP_SELECTITEM = "t:ListWidget";
-
-
-// ======== MEMBER FUNCTIONS ==================================================
-
-// ----------------------------------------------------------------------------
-// SatAppView::SatAppView
-// (Constructor).
-// ----------------------------------------------------------------------------
-//
-SatAppView::SatAppView(QGraphicsItem *parent) :
-    HbView(parent),
-    mTimeout(false),
-    mSelectItem(false),
-    mClickBackSoftkey(false),
-    mItemIndex(0),
-    mLoop(0),
-    mTimer(0),
-    mWindow(0),
-    mSoftKeyQuitAction(0),
-    mSoftKeyBackAction(0),
-    mEvent(0),
-    mUi(0),
-    mListWidget(0),
-    mSelectListWidget(0),
-    mSubTitle(0)
-{
-    TFLOGSTRING("SATAPP: SatAppView::SatAppView call-exit")
-}
-
-// ----------------------------------------------------------------------------
-// SatAppView::~SatAppView
-// (Disconstructor).
-// ----------------------------------------------------------------------------
-//
-SatAppView::~SatAppView()
-{
-    TFLOGSTRING("SATAPP: SatAppView::~SatAppView")
-    // The objects are outside the object tree, Delete them manually
-    if (mTimer) {
-        delete mTimer;
-        mTimer = 0;
-        TFLOGSTRING("SATAPP: SatAppView::~SatAppView delete subtitle")
-    }
-
-    if (mLoop) {
-        if (mLoop->isRunning()) {
-            mLoop->quit();
-        }
-        delete mLoop;
-        mLoop = 0;
-        TFLOGSTRING("SATAPP: SatAppView::~SatAppView delete subtitle")
-    }
-    TFLOGSTRING("SATAPP: SatAppView::~SatAppView Exit")
-}
-
-// ----------------------------------------------------------------------------
-// SatAppView::initSetupMenu
-// (Init the setup menu view).
-// ----------------------------------------------------------------------------
-//
-void SatAppView::initSetupMenu(
-    SatAppEventProvider &event,
-    SatAppUiProvider &ui)
-{
-    TFLOGSTRING( "SATAPP: SatAppView::initSetupMenu call" )
-    mEvent = &event;
-    mUi = &ui;
-
-    // Listwidget
-    mListWidget = qobject_cast<HbListWidget *>
-        ( mUi->docmlLoader()->findWidget(SATAPP_MENUITEM ));
-    if (mListWidget && mWindow) {
-        mSoftKeyQuitAction = new HbAction(Hb::QuitNaviAction,this);
-        HbAction *menuAction = menu()->addAction("Exit");
-        bool ret = connect(menuAction, SIGNAL(triggered()),
-                       mSoftKeyQuitAction, SIGNAL(triggered()));
-        TFLOGSTRING2("SATAPP: SatAppView::initSetupMenu: \
-            menu connected %d", ret)
-        ret = connect(mSoftKeyQuitAction, SIGNAL(triggered()),
-                       mWindow, SLOT(close()));
-        TFLOGSTRING2("SATAPP: SatAppView::initSetupMenu: \
-            quit connected %d", ret)
-    }
-
-    TFLOGSTRING("SATAPP: SatAppView::initSetupMenu exit")
-}
-
-
-// ----------------------------------------------------------------------------
-// SatAppView::initSelectItem
-// (Init the select item view).
-// ----------------------------------------------------------------------------
-//
-void SatAppView::initSelectItem(
-    SatAppEventProvider &event,
-    SatAppUiProvider &ui)
-{
-    TFLOGSTRING( "SATAPP: SatAppView::initSelectItem call")
-    mEvent = &event;
-    mUi = &ui;
-    // Subtitle
-    mSubTitle = qobject_cast<HbLabel *>
-        ( mUi->docmlLoader()->findWidget(SATAPP_SUBTITLE) );
-
-    mSelectListWidget = qobject_cast<HbListWidget *>
-        ( mUi->docmlLoader()->findWidget(SATAPP_SELECTITEM ));
-
-    if (mSelectListWidget && mWindow) {
-        mSoftKeyBackAction = new HbAction(Hb::BackNaviAction,this);
-        HbAction *menuBack = menu()->addAction("Back");
-        bool ret = connect(menuBack, SIGNAL(triggered()),
-                       mSoftKeyBackAction, SIGNAL(triggered()));
-        TFLOGSTRING2("SATAPP: SatAppView::initSelectItem: \
-            menu connected %d", ret)
-        HbAction *menuQuit = menu()->addAction("Exit");
-        ret = connect(menuQuit, SIGNAL(triggered()),
-                      mWindow, SLOT(close()));
-        TFLOGSTRING2("SATAPP: SatAppView::initSelectItem: \
-            close connected %d", ret)
-        ret = connect(mSoftKeyBackAction, SIGNAL(triggered()),
-                      this, SLOT(backButtonClicked()));
-        TFLOGSTRING2("SATAPP: SatAppView::initSelectItem: \
-            back connected %d", ret)
-    }
-    TFLOGSTRING("SATAPP: SatAppView::initSelectItem exit")
-}
-
-// ----------------------------------------------------------------------------
-// SatAppView::SatAppView
-// (Set up menu).
-// ----------------------------------------------------------------------------
-//
-void SatAppView::showSetUpMenuContent(
-    TSatUiResponse& aRes,
-    const QString& aText,
-    const QStringList& aMenuItems,
-    //const CArrayFixFlat<TSatAction>* aMenuItemNextActions,
-    //const HbIcon& aIcon,
-    //const CAknIconArray* aItemIconsArray,
-    const bool /*aSelfExplanatoryItems*/,
-    const bool /*aHelpIsAvailable*/)
-{
-    TFLOGSTRING("SATAPP: SatAppView::SetUpMenu")
-    // Disconnect select item
-    disconnectItem();
-    aRes = ESatSuccess;
-    mSelectItem = false;
-
-    // The text is the application name
-    // should be shown on the menu area always
-    if (!aText.isEmpty()) {
-        TFLOGSTRING( "SATAPP: SatAppView::SetUpMenu: title" )
-        setTitle(aText);
-    }
-    if (mListWidget) {
-        TFLOGSTRING("SATAPP: SatAppView::SetUpMenu mListWidget")
-        mListWidget->clear();
-        for(int i = 0; i < aMenuItems.count(); i++ ) {
-            mListWidget->addItem(aMenuItems.at( i ));
-        }
-        // connect setup menu item
-        connectItem();
-        setNavigationAction(mSoftKeyQuitAction);
-    }
-    TFLOGSTRING("SATAPP: SatAppView::SetUpMenu exit")
-}
-
-
-// ----------------------------------------------------------------------------
-// SatAppView::SelectItem
-// (Selected item).
-// ----------------------------------------------------------------------------
-//
-void SatAppView::showSelectItemContent(
-    TSatUiResponse& aRes,
-    const QString& aText,
-    const QStringList& aMenuItems,
-    //const CArrayFixFlat<TSatAction>* aMenuItemNextActions,
-    const int /*aDefaultItem*/,
-    unsigned char& aSelection,
-    //const HbIcon& aIcon,
-    //const CAknIconArray* aItemsIconArray,
-    const bool /*aSelfExplanatoryItems*/,
-    const bool /*aHelpIsAvailable*/)
-{
-    TFLOGSTRING("SATAPP: SatAppView::selectItem")
-    // Disconnect setup menu item
-    disconnectItem();
-    aRes =  ESatSuccess;
-    mSelectItem = true;
-    mClickBackSoftkey = false;
-
-    // Set sub title
-    if (!aText.isEmpty()) {
-        mSubTitle->setPlainText(aText);
-    } else {
-        TFLOGSTRING("SATAPP: txt_sat_selectitem_title")
-        mSubTitle->setPlainText(hbTrId("txt_sat_selectitem_title"));
-    }
-    // Set List widget
-    if (mSelectListWidget) {
-        TFLOGSTRING("SATAPP: SatAppView::selectItem mSelectListWidget")
-        mSelectListWidget->clear();
-        for(int i = 0; i < aMenuItems.count(); i++ ) {
-            mSelectListWidget->addItem(aMenuItems.at( i ));
-        }
-    }
-    // Set Back key
-    //setSoftkeyBack();
-    if (mSoftKeyBackAction) {
-       setNavigationAction(mSoftKeyBackAction);
-       TFLOGSTRING("SATAPP: SatAppView::selectItem set softkey back")
-    }
-    // connect selectitem 
-    connectItem();
-
-    mTimer = new QTimer();
-    if (mTimer) {
-        bool ret = connect(mTimer, SIGNAL(timeout()),
-                            this, SLOT(selectItemTimeOut()));
-        TFLOGSTRING2("SATAPP: SatAppView::selectItem timer %d", ret)
-        mTimer->start( KDefaultSelectionTimeoutMseconds );
-        mLoop = new QEventLoop();
-        TFLOGSTRING("SATAPP: SatAppView::selectItem loop exec before")
-        mLoop->exec(QEventLoop::AllEvents);
-        TFLOGSTRING("SATAPP: SatAppView::selectItem loop exec after")
-        delete mTimer;
-        mTimer = 0;
-        delete mLoop;
-        mLoop = 0;
-    }
-
-    if (mTimeout) {
-        aRes = ESatNoResponseFromUser;
-        TFLOGSTRING("SATAPP: SatAppView::selectItem time out")
-    } else if (mClickBackSoftkey) {
-        TFLOGSTRING("SATAPP: SatAppView::selectItem, \
-        user click the back softkey")
-        aRes = ESatBackwardModeRequestedByUser;
-    } else {
-        TFLOGSTRING2("SATAPP: SatAppView::selectItem selected %d",
-                      mItemIndex)
-        //For Demo. We will not return user select item to SIM.
-        aSelection = mItemIndex;
-    }
-   // disconnet select item
-    disconnectItem();
-    TFLOGSTRING2("SATAPP: SatAppView::selectItem aRes:%d", aRes)
-    mTimeout = false;
-    TFLOGSTRING("SATAPP: SatAppView::selectItem exit")
-}
-
-// ----------------------------------------------------------------------------
-// SatAppView::selectItemTimeOut
-// (Time Out of select item).
-// ----------------------------------------------------------------------------
-//
-void SatAppView::selectItemTimeOut()
-{
-    TFLOGSTRING("SATAPP: SatAppView::selectItemTimeOut")
-    if (mSelectItem && mLoop && mLoop->isRunning()) {
-        TFLOGSTRING("SATAPP: SatAppView::selectItemTimeOut time out")
-        mTimeout = true;
-        mLoop->exit();
-    }
-    TFLOGSTRING("SATAPP: SatAppView::selectItemTimeOut exit")
-}
-
-// ----------------------------------------------------------------------------
-// SatAppView::keyPressEvent
-// (keyPressEvent).
-// ----------------------------------------------------------------------------
-//
-void SatAppView::keyPressEvent(QKeyEvent *event)
-{
-    TFLOGSTRING("SATAPP: SatAppView::keyPressEvent")
-    // Need updating, End key support is still missing
-    switch (event->key())
-        {
-        case Qt::Key_Hangup:
-            {
-            TFLOGSTRING("SATAPP: SatAppView::keyPressEvent end key")
-            }
-            break;
-        default:
-            {
-            TFLOGSTRING2("SATAPP: SatAppView::keyPressEvent key %d", 
-            event->key())
-            HbView::keyPressEvent(event);
-            }
-        }
-    TFLOGSTRING("SATAPP: SatAppView::keyPressEvent exit")
-}
-
-// ----------------------------------------------------------------------------
-// SatAppView::backButtonClicked
-// (Back action).
-// ----------------------------------------------------------------------------
-//
-void SatAppView::backButtonClicked()
-{
-    TFLOGSTRING("SATAPP: SatAppView::backButtonClicked")
-    if (mSelectItem) {
-        mClickBackSoftkey = true;
-        TFLOGSTRING("SATAPP: SatAppView::backButtonClicked back selected")
-        if (mLoop) {
-            TFLOGSTRING("SATAPP: SatAppView::backButtonClicked quit loop")
-            if (mLoop->isRunning()) {
-                mLoop->exit();
-            }
-        }
-    }
-    TFLOGSTRING("SATAPP: SatAppView::backButtonClicked exit")
-}
-
-// ----------------------------------------------------------------------------
-// SatAppView::setMainWindow
-// (Set window for view).
-// ----------------------------------------------------------------------------
-//
-void SatAppView::setMainWindow(HbMainWindow &mainWindow)
-{
-    TFLOGSTRING("SATAPP: SatAppView::setMainWindow")
-    TFLOGSTRING2("SATAPP: SatAppView::setMainWindow \
-            &mainWindow=0x%x", &mainWindow)
-    mWindow = &mainWindow;
-    TFLOGSTRING("SATAPP: SatAppView::setMainWindow exit")
-}
-
-// ----------------------------------------------------------------------------
-// SatAppView::menuItemSelected
-// (Menu item selected).
-// ----------------------------------------------------------------------------
-//
-void SatAppView::menuItemSelected(HbListWidgetItem *item)
-{
-    TFLOGSTRING("SATAPP: SatAppView::menuItemSelected")
-    if(mSelectItem && mSelectListWidget) {
-        mItemIndex = mSelectListWidget->row(item);
-        if (mLoop && mLoop->isRunning()) {
-            TFLOGSTRING( "SATAPP: SatAppView::menuItemSelected sel item")
-            mLoop->quit();
-            TFLOGSTRING( "SATAPP: SatAppView::menuItemSelected exit loop")
-        }
-    } 
-    if (!mSelectItem && mListWidget) {
-        mItemIndex = mListWidget->row(item);
-        TFLOGSTRING( "SATAPP: SatAppView::menuItemSelected setup menu")
-        if (mEvent) {
-            mEvent->menuSelection( mItemIndex, false );
-            TFLOGSTRING( "SATAPP: SatAppView::menuItemSelected setup menu")
-        }
-        // disconnet the list widget, when server returns response, 
-        // the connect again
-        disconnectItem();
-    }
-    TFLOGSTRING("SATAPP: SatAppView::menuItemSelected exit")
-}
-
-// ----------------------------------------------------------------------------
-// SatAppView::connectItem
-// (Connect listwidget item).
-// ----------------------------------------------------------------------------
-//
-void SatAppView::connectItem()
-{
-    TFLOGSTRING("SATAPP: SatAppView::connectItem")
-    bool ret = false;
-    if (!mSelectItem && mListWidget) {
-        ret = connect(
-            mListWidget, SIGNAL(activated(HbListWidgetItem *)), 
-            this, SLOT(menuItemSelected(HbListWidgetItem *)));
-        TFLOGSTRING2( 
-        "SATAPP: SatAppView::connectItem SetupMenu short connect=%d", ret)
-        ret = connect(
-            mListWidget, SIGNAL(longPressed(HbListWidgetItem*, const QPointF&)), 
-            this, SLOT(menuItemSelected(HbListWidgetItem *)));
-        TFLOGSTRING2( 
-        "SATAPP: SatAppView::connectItem SetupMenue long connect=%d", ret)
-    }
-
-    if (mSelectItem && mSelectListWidget) {
-        ret = connect(
-            mSelectListWidget, SIGNAL(activated(HbListWidgetItem *)), 
-            this, SLOT(menuItemSelected(HbListWidgetItem *)));
-        TFLOGSTRING2( 
-        "SATAPP: SatAppView::connectItem SelectItem short connect=%d", ret)
-        ret = connect(
-            mSelectListWidget, 
-            SIGNAL(longPressed(HbListWidgetItem*, const QPointF&)), 
-            this, SLOT(menuItemSelected(HbListWidgetItem *)));
-        TFLOGSTRING2( 
-        "SATAPP: SatAppView::connectItem SelectItem long connect=%d", ret)        
-    }
-    TFLOGSTRING("SATAPP: SatAppView::connectItem exit")
-}
-
-// ----------------------------------------------------------------------------
-// SatAppView::disconnectItem
-// (Disconnect listwidget item).
-// ----------------------------------------------------------------------------
-//
-void SatAppView::disconnectItem()
-{
-    TFLOGSTRING("SATAPP: SatAppView::disconnectItem")
-    // setup menu view
-    if (!mSelectItem && mListWidget) {
-        disconnect(mListWidget, SIGNAL( activated(HbListWidgetItem *)),
-              this, SLOT( menuItemSelected( HbListWidgetItem *)));        
-        disconnect(
-            mListWidget, SIGNAL(longPressed(HbListWidgetItem*, const QPointF&)), 
-            this, SLOT(menuItemSelected(HbListWidgetItem *)));
-        TFLOGSTRING("SATAPP: SatAppView::disconnectItem: SetupMenu")
-    }
-    // select item view
-    if (mSelectItem && mSelectListWidget) {
-        disconnect(mSelectListWidget, SIGNAL( activated(HbListWidgetItem *)),
-              this, SLOT( menuItemSelected( HbListWidgetItem *)));
-        disconnect(
-            mSelectListWidget, 
-            SIGNAL(longPressed(HbListWidgetItem*, const QPointF&)), 
-            this, SLOT(menuItemSelected(HbListWidgetItem *)));        
-        TFLOGSTRING("SATAPP: SatAppView::disconnectItem: SelectItem")
-    }
-    TFLOGSTRING("SATAPP: SatAppView::disconnectItem exit")
-}
-
-// End of file
--- a/satui/satapp/tsrc/ut_satapp/inc/dummyeventprovider.h	Tue Jul 06 14:53:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,687 +0,0 @@
-/*
-* 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: dummyeventprovider.h
-*
-*/
-
-#ifndef DUMMYEVENTPROVIDER_H
-#define DUMMYEVENTPROVIDER_H
-
-#include <QObject>
-#include <msatuiobserver.h>
-
-
-#include "msatuiactionimplementer.h"
-
-class CSatUiObserver;
-//class QPixmap; // For future icon support
-class DummyPlayToneProvider;
-
-class DummyEventProvider: public QObject,
-                          public MSatUiActionImplementer
-{
-    Q_OBJECT
-
-public:
-
-    /**
-    * Constructor
-    */
-    DummyEventProvider(QObject *parent = 0);
-
-    /**
-    * Distructor
-    */
-    virtual ~DummyEventProvider();
-
-signals:
-     /**
-     * Notification of the SAT Display Text command.
-     * @param aRes, the User's response.
-     * @param aText The text string to be displayed.
-     * @param aSimApplicationName  Sim Application name
-     * @param aIcon the icon to show.
-     * @param aRequestedIconDisplayed Informs if icon is not used.
-     * @param aSustainedText Indicates is this text sustained ie. no timers
-     *        used if true.
-     * @param aDuration Duration for showing the text
-     * @param aWaitUserToClear Indication if user is needed to clear
-     *        message
-     */
-    void displayTextEvent(
-        TSatUiResponse &aRes,
-        const QString &aText,
-        const QString &aSimApplicationName,
-        //const HbIcon &aIcon,
-        bool &aRequestedIconDisplayed,
-        const bool aSustainedText,
-        const int aDuration,
-        const bool aWaitUserToClear);
-
-    /**
-     * Notification of the SAT Get Input command.
-     * @param aText The query text.
-     * @param aCharacterSet The character range allowed.
-     * @param aInput The input string.
-     * @param aMaxLength The maximum length of the input allowed.
-     * @param aMinLength The minimum length of the input allowed.
-     * @param aHideInput A flag indicating if the input should be hidden.
-     * @param aHelpIsAvailable indicates if help can be requested.
-     * @param aIconId The id of icon.
-     * @param aRequestedIconDisplayed Informs if icon is not used.
-     * @return The response of the UI to this command.
-     */
-    void getInputEvent(
-        TSatUiResponse &aRes,
-        const QString &aTitleText,
-        const TSatCharacterSet aCharacterSet,
-        QString &aInputText,
-        const int aMinLength,
-        const int aMaxLength,
-        const bool aHideInput,
-        //const QPixmap* /*aIconBitmapGetInput*/,
-        const bool aSelfExplanatory,
-        unsigned int &aDuration );
-
-    /**
-     * Notification of the SAT Get Inkey command.
-     * @param aText The query text.
-     * @param aCharacterSet The character range allowed.
-     * @param aInput The input string.
-     * @param aHideInput A flag indicating if the input should be hidden.
-     * @param aHelpIsAvailable indicates if help can be requested.
-     * @param aIconId The id of icon.
-     * @param aRequestedIconDisplayed Informs if icon is not used.
-     */
-    void getInkeyEvent(
-        TSatUiResponse &aRes,
-        const QString &aTitleText,
-        const TSatCharacterSet aCharacterSet,
-        QString &aInputText,
-        //const QPixmap* /*aIconBitmapGetInput*/,
-        const bool aSelfExplanatory,
-        unsigned int &aDuration );
-
-    /**
-     * Notification of the SAT Get YesNo command.
-     * @param aText The query text.
-     * @param aCharacterSet The character range allowed.
-     * @param aInput The input character.
-     * @param aHelpIsAvailable indicates if help can be requested.
-     * @param aIconId The id of icon.
-     * @param aRequestedIconDisplayed Informs if icon is not used.
-     * @param aDuration Duration for showing the dialog.
-     * @param aImmediateDigitResponse Indication if Immediate digit response
-     *        is needed.
-     * @return The response of the UI to this command.
-     */
-    void getYesNoEvent(
-        TSatUiResponse &aRes,
-        const QString &aText,
-        const TSatCharacterSet aCharacterSet,
-        unsigned int &aInkey,
-        //const TSatIconId &aIconId,
-        const bool &aSelfExplanatory,
-        unsigned int &aDuration,
-        const bool aImmediateDigitResponse );
-
-    /**
-    * Handles the SetUpMenu command.
-    * @param aRes the out parameter. the result of the command.
-    * @param aText The title text.
-    * @param aMenuItems The array of menu item captions.
-    * @param aMenuItemNextActions The array of menu item next action
-    * indicator captions.
-    * @param aIconBitmap The Context pane icon.
-    * @param aItemsIconArray Array of item icons
-    * @param aSelfExplanatoryItems A flag indicating if only icons are shown.
-    * @param aHelpIsAvailable A flag indicating if SAT help is available.
-    */
-    void setUpMenuEvent(
-        TSatUiResponse &aRes,
-        const QString &aText,
-        const QStringList &aMenuItems,
-        //const CArrayFixFlat<TSatAction>* aMenuItemNextActions,
-        //const HbIcon &aIcon,
-        //const CAknIconArray* aItemIconsArray,
-        const bool aSelfExplanatoryItems,
-        const bool aHelpIsAvailable);
-
-    /**
-    * Handles the SelectItem view.
-    * @param aRes the out parameter. the result of the command.
-    * @param aText The title text.
-    * @param aMenuItems The array of menu items.
-    * @param aMenuItemNextActions The array of next action indicators.
-    * @param aDefaultItem The item in focus.
-    * @param aSelection The item index selected by the user.
-    * @param aIconBitmap The Context Pane icon.
-    * @param aItemsIconArray Array of item icons
-    * @param aSelfExplanatoryItems Flag indicating if only icons are shown.
-    * @param aHelpIsAvailable A flag indicating if SAT help is available.
-    * @return Information of the operation result.
-    */
-    void selectItemEvent(
-        TSatUiResponse &aRes,
-        const QString &aText,
-        const QStringList &aMenuItems,
-        //const CArrayFixFlat<TSatAction>* aMenuItemNextActions,
-        const int aDefaultItem,
-        unsigned char &aSelection,
-        //const HbIcon &aIcon,
-        //const CAknIconArray* aItemsIconArray,
-        const bool aSelfExplanatoryItems,
-        const bool aHelpIsAvailable);
-
-    /**
-    * Shows the confirmation note about the SAT Send SMS, Send SS or
-    * Send USSD command.
-    * @param aText The text to be displayed.
-    * @param aActionAccepted Indicates whether the command was accepted.
-    * @param aType Type of the request (SMS, SS, USSD).
-    * @return Information of the operation result.
-    */
-    void confirmSendEvent(
-        TSatUiResponse &aRes,
-        const QString &aText,
-        bool &aActionAccepted,
-        int aType);
-
-     /**
-     * Shows the wait note about the Send SMS command.
-     * @param aText The text to be displayed.
-     * @param aIconBitmapSendSM Sending dialog icon.
-     * @param aSelfExplanatoryIcon A flag indicating if only icon is shown.
-     */
-    void showSmsWaitNoteEvent(
-        const QString &aText,
-        //const CFbsBitmap* aIconBitmapSendSM,
-        const bool aSelfExplanatoryIcon
-        );
-    
-    /**
-    * Shows the confirmation not about SetUpCall.
-    * @param aText The text to be displayed.
-    * @param aSimAppName The header to be displayed.
-    * @param aActionAccepted Indicates whether the command was accepted.
-    */
-   void showSetUpCallConfirmEvent(
-        const QString &aText,
-        const QString &aSimAppName,
-        bool &aActionAccepted//,
-        //const CFbsBitmap* aIconBitmap,
-        //const TBool aSelfExplanatory
-       );
-
-     /**
-     * Shows the wait note about the Send DTMF command.
-     * @param aText The text to be displayed.
-     * @param aIconBitmapSendSM Sending dialog icon.
-     */
-    void showDtmfWaitNoteEvent(
-        TSatUiResponse &aRes,
-        const QString &aText);
-
-
-     /**
-     * Shows the wait note about the Send Ss or Ussd command.
-     * @param aText The text to be displayed.
-     * @param aIconBitmapSendSM Sending dialog icon.
-     * @param aSelfExplanatoryIcon A flag indicating if only icon is shown.
-     */
-    void showSsWaitNoteEvent(
-        const QString &aText,
-        //const CFbsBitmap* aIconBitmapSendSM,
-        const bool aSelfExplanatoryIcon
-        );
-
-     /**
-     * Shows the wait note about Open Channel
-     * @param aText The text to be displayed.
-     * @param aActionAccepted Indicates whether the command was accepted.
-     */
-    void showOpenChannelConfirmEvent(
-        const QString &aText,
-        bool &aActionAccepted);
-
-
-    /*!
-     Removes Display Text Dialog from the screen.
-    */
-    void clearScreenEvent();
-
-    /*!
-     Close the sat ui
-     */
-    void closeUiEvent();
-
-    /*!
-    *Close wait note
-    */
-    void stopShowWaitNoteEvent();
-
-    /*!
-    *Show SsWaitNote without Delay
-    */  
-    void showWaitNoteWithoutDelayEvent();
-
-    /*!
-    *ShowSsErrorNoteEvent
-    */  
-    void showSsErrorNoteEvent();
-    
-    /*!
-    * Show BIP related Note 
-    */      
-    void showBIPNoteEvent(int aCommand, const QString &aText);
-
-public slots:
-    /*!
-    *User cancel response, Send DTMF, Send Data, Receive Data
-    */
-    void userCancelResponse();
-
-public: // from MSatUiActionImplementer and impletment by QT
-
-    /**
-    * Shows the wait note.
-    */
-    virtual void ShowWaitNoteL() {};
-
-    /**
-    * Shows the wait note without delay
-    */
-    virtual void ShowWaitNoteWithoutDelayL();
-
-    /**
-    * Removes the wait note from the screen.
-    */
-    void StopShowWaitNote();
-
-    /**
-     * Handles the SetUpMenu view.
-     * @param aText The title text.
-     * @param aMenuItems The array of menu item captions.
-     * @param aMenuItemNextActions The array of menu item next action
-     * indicator captions.
-     * @param aIconBitmap The Context pane icon.
-     * @param aItemsIconArray Array of item icons
-     * @param aSelfExplanatoryItems Flag indicating if only icons are shown.
-     * @param aHelpIsAvailable A flag indicating if SAT help is available.
-     * @return Information of the operation result.
-     */
-     virtual TSatUiResponse SetUpMenuL(
-         const TDesC &aText,
-         const MDesCArray &aMenuItems,
-         const CArrayFixFlat<TSatAction>* aMenuItemNextActions,
-         const CFbsBitmap* aIconBitmap,
-         //const CAknIconArray* aItemIconsArray,
-         const TBool aSelfExplanatoryItems,
-         const TBool aHelpIsAvailable);
-
-    /**
-     * Handles the SelectItem view.
-     * @param aText The title text.
-     * @param aMenuItems The array of menu items.
-     * @param aMenuItemNextActions The array of next action indicators.
-     * @param aDefaultItem The item in focus.
-     * @param aSelection The item index selected by the user.
-     * @param aIconBitmap The Context Pane icon.
-     * @param aItemsIconArray Array of item icons
-     * @param aSelfExplanatoryItems Flag indicating if only icons are shown.
-     * @param aHelpIsAvailable A flag indicating if SAT help is available.
-     * @return Information of the operation result.
-     */
-     virtual TSatUiResponse SelectItemL( const TDesC &aText,
-         const MDesCArray &aMenuItems,
-         const CArrayFixFlat<TSatAction>* aMenuItemNextActions,
-         const TInt aDefaultItem,
-         TUint8 &aSelection,
-         const CFbsBitmap* aIconBitmap,
-         //const CAknIconArray* aItemsIconArray,
-         const TBool aSelfExplanatoryItems,
-         const TBool aHelpIsAvailable );
-
-public: // from MSatUiActionImplementer and impletment by Symbian
-
-    /**
-    * Returns CoeEnv.
-    */
-    virtual CCoeEnv* CoeEnv() { return 0; };
-
-    /**
-    * Handles the DisplayText operation.
-    * @param aText Text to be shown.
-    * @param aSimApplicationName  Sim Application name
-    * @param aIconBitmapDisplayText Icon for dialog
-    * @param aSustainedText Indicates is this text sustained ie. no timers
-    *        used if ETrue.
-    * @param aDuration Duration for showing the text
-    * @param aWaitUserToClear Indication if user is needed to clear
-    *        message
-    * @return Information of the operation result.
-    */
-    virtual TSatUiResponse DisplayTextL(
-        const TDesC &aText,
-        const TDesC &aSimApplicationName,
-        CFbsBitmap* aIconBitmapDisplayText,
-        const TBool aSelfExplanatoryIcon,
-        const TBool aSustainedText,
-        const TTimeIntervalSeconds aDuration,
-        const TBool aWaitUserToClear);
-
-    /**
-    * Removes Display Text Dialog from the screen.
-    */
-    virtual void ClearScreen();
-
-    /**
-    * Asks a Yes/No answer from the user.
-    * @param aText A question to be shown.
-    * @param aCharacterSet The character range allowed.
-    * @param aInkey Character user feeds.
-    * @param aIconBitmap Icon for query dialog.
-    * @param aSelfExplanatory Flag indicating if icon is self-explanatory.
-    * @param aDuration Duration for showing the dialog.
-    * @param aImmediateDigitResponse Indication if Immediate digit response
-    *        is needed.
-    * @return Information of the operation result.
-    */
-    virtual TSatUiResponse GetYesNoL(
-        const TDesC &aText,
-        const TSatCharacterSet aCharacterSet,
-        TChar &aInkey,
-        const CFbsBitmap* /*aIconBitmap*/,
-        const TBool aSelfExplanatory,
-        TUint &aDuration,
-        const TBool aImmediateDigitResponse);
-
-    /**
-    * Asks input from the user.
-    * @param aText A question to be shown.
-    * @param aCharacterSet The character range allowed.
-    * @param aInput The input string.
-    * @param aMinLength The minimum length of the input allowed.
-    * @param aMaxLength The maximum length of the input allowed.
-    * @param aHideInput A flag indicating if the input should be hidden.
-    * @param aGetInkey A flag indicating if GetInkey command is used.
-    * @param aIconBitmapGetInput Icon for query dialog.
-    * @param aSelfExplanatory  A flag indicating if icon is self-explanatory.
-    * @param aDuration Duration for showing the dialog.
-    * @return Information of the operation result.
-    */
-    virtual TSatUiResponse GetInputL(
-        const TDesC &aText,
-        const TSatCharacterSet aCharacterSet,
-        TDes &aInput,
-        const TInt aMinLength,
-        const TInt aMaxLength,
-        const TBool aHideInput,
-        const TBool aGetInkey,
-        const CFbsBitmap* aIconBitmapGetInput,
-        const TBool aSelfExplanatory,
-        TUint &aDuration );
-
-
-    /**
-    * Handles Standard Tone playing.
-    * @param aText The text to be displayed.
-    * @param aFileName The name of the file corresponding to the tone.
-    * @param aDuration The duration of the tone to be played.
-    * @param aIconBitmap The tone playing note icon
-    * @param aSelfExplanatory Flag indicating if icon is self-explanatory.
-    * @return Information of the operation result.
-    */
-    virtual TSatUiResponse PlayStandardToneL(
-        const TDesC &aText,
-        const TDesC8 &aSequence,
-        TTimeIntervalMicroSeconds aDuration,
-        const CFbsBitmap* aIconBitmap,
-        const TBool aSelfExplanatory );
-
-    /**
-    * Shows the confirmation note about the SAT Send SMS, Send SS or
-    * Send USSD command.
-    * @param aText The text to be displayed.
-    * @param aActionAccepted Indicates whether the command was accepted.
-    * @param aType Type of the request (SMS, SS, USSD).
-    * @return Information of the operation result.
-    */
-    virtual TSatUiResponse ConfirmSendL(
-        const TDesC &aText,
-        TBool &aActionAccepted,
-        TInt aType);
-
-    /**
-    * Shows the wait note about the Send SMS command.
-    * @param aText The text to be displayed.
-    * @param aIconBitmapSendSM Sending dialog icon.
-    * @param aSelfExplanatoryIcon A flag indicating if only icon is shown.
-    */
-    virtual void ShowSmsWaitNoteL(
-        const TDesC &aText,
-        const CFbsBitmap* aIconBitmapSendSM,
-        const TBool aSelfExplanatoryIcon);
-
-    /**
-    * Shows the wait note about the Send SS command.
-    * @param aText The text to be displayed.
-    * @param aIconBitmap Sending dialog icon.
-    * @param aSelfExplanatoryIcon A flag indicating if only icon is shown.
-    */
-    virtual void ShowSsWaitNoteL(
-            const TDesC &aText,
-            const CFbsBitmap* /*aIconBitmap*/,
-            const TBool aSelfExplanatoryIcon );
-
-    /**
-    * Shows the confirmation note about the SAT Refresh command.
-    * @param aActionAccepted Indicates whether the command was accepted.
-    * @return Information of the operation result.
-    */
-    virtual TSatUiResponse ConfirmRefreshL(
-            TBool &/*aActionAccepted*/)
-        {
-            return ESatSuccess;
-        };
-
-    /**
-    * Notification of the SAT Call Control command.
-    * @param aText The text string to be displayed.
-    * @param aAlphaIdStatus Alpha Identifier status
-    * @param aControlResult Call control general result
-    * @return The response from the UI
-    */
-    virtual TSatUiResponse CallControlL(
-            const TDesC &/*aText*/,
-            const TSatAlphaIdStatus /*aAlphaIdStatus*/ )
-        {
-            return ESatSuccess;
-        };
-
-    /**
-    * Notification of the SAT Launch browser confirmation request
-    * @param aText The text to be displayed.
-    * @param aActionAccepted Indicates whether the command was accepted.
-    * @param aIconBitmap The confirm note icon
-    * @param aSelfExplanatory Flag indicating if icon is self-explanatory.
-    */
-    virtual void ConfirmLaunchBrowserL(
-        const TDesC &/*aText*/,
-        TBool &/*aActionAccepted*/,
-        const CFbsBitmap* /*aIconBitmap*/,
-        const TBool /*aSelfExplanatory*/) {};
-
-    /**
-    * Notification of the SAT Mo Sm Control command.
-    * @param aText The text string to be displayed.
-    * @param aAlphaIdStatus Alpha Identifier status
-    * @param aControlResult Mo Sm control general result
-    * @return The response from the UI
-    */
-    virtual TSatUiResponse MoSmControlL(
-        const TDesC &/*aText*/,
-        const TSatAlphaIdStatus /*aAlphaIdStatus*/ )
-        {
-            return ESatSuccess;
-        };
-
-    /**
-    * Shows the wait note while DTMF are being sent.
-    * @param aText The text to be displayed.
-    * @param aIconBitmap The confirm note icon
-    * @param aSelfExplanatory Flag indicating if icon is self-explanatory.
-    * @return Information on the operation result.
-    */
-    virtual TSatUiResponse ShowDtmfWaitNoteL(
-            const TDesC &aText,
-            const CFbsBitmap* aIconBitmap,
-            const TBool aSelfExplanatoryIcon );
-
-    /**
-    * Dispatch iWait to action implementer.
-    * @param aWait Timer.
-    */
-    virtual void DispatchTimer(CActiveSchedulerWait &/*aWait*/) {};
-
-    /**
-    * Get flag which is indicating if end key is pressed.
-    * @return A Boolean flag which is indicating if end key is pressed.
-    */
-    virtual TBool GetEndKey()
-        {
-            return EFalse;
-        };
-
-    /**
-    * Set a flag which is indicating if end key is pressed.
-    * @param aValue Status of end key
-    */
-    virtual void SetEndKey(TBool /*aValue*/) {};
-
-    /**
-    * Set a flag which is indicating if proactive command is pending.
-    * @param aValue Status of proactive command
-    */
-    virtual void SetCommandPending(TBool /*aValue*/) {};
-
-    /**
-    * Plays user selected tone.
-    * @param aText The text to be displayed.
-    * @param aDuration Play duration.
-    * @param aTone Tone to be played.
-    * @param aIconBitmap The tone playing note icon
-    * @param aSelfExplanatory Flag indicating if icon is self-explanatory.
-    * @return Information on the operation result.
-    */
-    virtual TSatUiResponse PlayUserSelectedToneL(
-        const TDesC &aText,
-        TTimeIntervalMicroSeconds aDuration,
-        TSatTone aTone,
-        const CFbsBitmap* aIconBitmap,
-        const TBool aSelfExplanatory );
-
-    /**
-    * Confirm user permission for Open Channel.
-    * @param aText The text to be displayed.
-    * @param aActionAccepted Indicates whether the command was accepted.
-    * @param aIconBitmapOpenChannel Icon for query dialog
-    * @param aSelfExplanatory A flag indicating if icon is self-explanatory
-    * @return Operation result
-    */
-    virtual TSatUiResponse ConfirmOpenChannelL(
-        const TDesC &aText,
-        TBool &aActionAccepted,
-        const CFbsBitmap* /*aIconBitmapOpenChannel*/,
-        const TBool aSelfExplanatory );
-
-    /**
-    * Shows the wait note while BIP packets are sent.
-    * @param aCommand Command type.
-    * @param aText The text to be displayed.
-    * @param aIconBitmap Icon for query dialog
-    * @param aSelfExplanatory A flag indicating if icon is self-explanatory
-    */
-    virtual void ShowBIPNoteL(
-        TInt aCommand,
-        const TDesC &aText,
-        const CFbsBitmap* /*aIconBitmap*/,
-        const TBool /*aSelfExplanatory*/);
-
-    /**
-    * Confirm user permission for SetUpCall
-    * @param aText The text to be displayed.
-    * @param aSimAppName Header for th equery
-    * @param aActionAccepted Indicates whether the command was accepted.
-    * @param aIconBitmap Icon for query dialog
-    * @param aSelfExplanatory A flag indicating if icon is self-explanatory
-    */
-    virtual void ConfirmSetUpCallL(
-        const TDesC &aText,
-        const TDesC &aSimAppName,
-        TBool &aActionAccepted,
-        const CFbsBitmap* aIconBitmap,
-        const TBool aSelfExplanatory);
-
-    /**
-    * Show note indicating SAT is not available.
-    */
-    virtual void ShowNotAvailableNoteL() {};
-
-    /**
-    * Show the Ss error note.
-    */
-    virtual void ShowSsErrorNoteL();
-
-    /**
-    * Start SatUi closing process.
-    */
-    virtual void CloseSatUI();
-
-
-public: // new method
-
-    /**
-    * Return current profile state.
-    * @return current profile state.
-    */
-    int profileState();
-
-     /**
-     * Response to the Set Up Menu command.
-     * @param aMenuItem The selected menu item.
-     * @param aHelpRequested Indicates whether help was requested.
-     */
-    void menuSelection( int aMenuItem, bool aHelpRequested );
-
-protected:
-     //Q_DISABLE_COPY( SatAppEventProvider );
-
-private: // Data
-
-    /**
-     * The pointer to the sybmian class CSatUiObserver
-     * which will access Sat Client API
-     * own
-     */
-    CSatUiObserver *mObs;
-
-    /**
-     * Own,PlayTone
-     */
-    DummyPlayToneProvider *mPlayTone;
-
-};
-
-#endif  //DUMMYEVENTPROVIDER_H
--- a/satui/satapp/tsrc/ut_satapp/inc/dummyplaytoneprovider.h	Tue Jul 06 14:53:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,144 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-#ifndef DUMMYPLAYTONEPROVIDER_H
-#define DUMMYPLAYTONEPROVIDER_H
- 
-#include <QObject>
-#include <MdaAudioTonePlayer.h>//PlayStandardTone
-#include <MdaAudioSamplePlayer.h>//PlayUserSelectedTone
-#include <QEventLoop>
-#include <msatuiobserver.h>
-
-
-class CMdaAudioToneUtility;
-class CMdaAudioPlayerUtility;
-class QTimer;
-class HbMessageBox;
-
-class DummyPlayToneProvider: public QObject,
-                           public MMdaAudioToneObserver,//PlayStandardTone
-                           public MMdaAudioPlayerCallback//PlayUserSelectedTone
-{
-    Q_OBJECT
-
-public:
-
-    /**
-    * Constructor
-    */
-    DummyPlayToneProvider(QObject *parent = 0);
-
-    /**
-    * Distructor
-    */
-    virtual ~DummyPlayToneProvider();
-
-public: // from MSatUiActionImplementer and impletment by Symbian
-
-    /**
-    * Handles Standard Tone playing.
-    * @param aText The text to be displayed.
-    * @param aFileName The name of the file corresponding to the tone.
-    * @param aDuration The duration of the tone to be played.
-    * @param aIconBitmap The tone playing note icon
-    * @param aSelfExplanatory Flag indicating if icon is self-explanatory.
-    * @return Information of the operation result.
-    */
-    virtual TSatUiResponse PlayStandardToneL(
-        const TDesC &aText,
-        const TDesC8 &aSequence,
-        TTimeIntervalMicroSeconds aDuration,
-        const CFbsBitmap* aIconBitmap,
-        const TBool aSelfExplanatory );
-
-    /**
-    * Plays user selected tone.
-    * @param aText The text to be displayed.
-    * @param aDuration Play duration.
-    * @param aTone Tone to be played.
-    * @param aIconBitmap The tone playing note icon
-    * @param aSelfExplanatory Flag indicating if icon is self-explanatory.
-    * @return Information on the operation result.
-    */
-    virtual TSatUiResponse PlayUserSelectedToneL(
-        const TDesC &aText,
-        TTimeIntervalMicroSeconds aDuration,
-        TSatTone aTone,
-        const CFbsBitmap* aIconBitmap,
-        const TBool aSelfExplanatory );
-
-    /**
-    * ClearScreen
-    */
-    void clearScreen();
-
-    /**
-    * CloseSatUI
-    */
-    void closeSatUI();
-
-public:// from MMdaAudioToneObserver
-
-    /**
-    * From MMdaAudioToneObserver Called by the player object when
-    * it has been initialised.
-    * @param aError Error type.
-    */
-    void MatoPrepareComplete( TInt aError );
-
-    /**
-    * From MMdaAudioToneObserver Called by the player object when
-    * the playback has been terminated.
-    * @param aError Error type.
-    */
-    void MatoPlayComplete( TInt aError );
-
-public://from MMdaAudioPlayerCallback
-    /**
-    * Initialisation of an audio sample has completed.
-    * @param aError The status of the audio sample after initialisation.
-    * @param aDuration The duration of the audio sample.
-    */
-    void MapcInitComplete( 
-        TInt aError, 
-        const TTimeIntervalMicroSeconds& /*aDuration*/ );
-
-    /**
-    * Play of an audio sample has completed.
-    * @param aError The status of playback.
-    */
-    void MapcPlayComplete( TInt aError );
-
-private:// for playTone
-
-    /**
-    * Get settings from current profile like volume, warning tones on/off etc.
-    * @param aTone, optional specifies the type of needed tone if necessary
-    * @param aToneName, optional buffer to get a soundfile name from 
-    * the active profile if necessary
-    */
-    void GetProfileParamsL( TSatTone aTone = ESatToneNotSet,
-                                             TDes* aToneName = NULL );
-
-    /**
-    * showWaitNote
-    */
-    void showWaitNote();
-
-};
-
-#endif    //DUMMYPLAYTONEPROVIDER_H
--- a/satui/satapp/tsrc/ut_satapp/inc/ut_csatuiobserver.h	Tue Jul 06 14:53:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,217 +0,0 @@
-/*
-* 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: Unit test CSatUiObserver class
-*
-*/
-
-#ifndef UT_CSATUIOBSERVER_H
-#define UT_CSATUIOBSERVER_H
-
-#include <QtTest/QtTest>
-#include <QObject>
-
-// Class forwards
-class CSatUiObserver;
-class DummyEventProvider;
-
-/**
- *  CSatUiObserver unit test class.
- * 
- *  @since S60 <TB10.1>
- */
-class Ut_CSatUiObserver : public QObject
-{
-    Q_OBJECT
-
-public:
-     /**
-     * Constructor.
-     */
-    Ut_CSatUiObserver(QObject *parent = 0);
-     /**
-     * Destructor.
-     */
-    virtual ~Ut_CSatUiObserver();
-
-private slots:
-
-     /**
-     * Called before the first testfunction is executed.
-     * Handles the SetUpMenu command.
-     */
-    void initTestCase();
-
-     /**
-     * Called after the last testfunction has been executed.
-     * 
-     */
-    void cleanupTestCase();
-
-     /**
-     * Test CSatUiObserver's ConnectRSatSessionL.
-     * 
-     */
-    void testConnectRSatSession();
-
-     /**
-     * Test CSatUiObserver's Adapter.
-     * 
-     */
-    void testAdapter();
-
-     /**
-     * Test CSatUiObserver's DisconnectRSatSession.
-     * 
-     */
-    void testDisconnectRSatSession();
-
-     /**
-     * Test CSatUiObserver's ProfileState.
-     * 
-     */
-    void testProfileState();
-
-    /**
-     * Test CSatUiObserver's SetImplementer.
-     * 
-     */
-    void testSetImplementer();
-
-    /**
-     * Test CSatUiObserver's testDisplayText's input param list.
-     * 
-     */
-    void testDisplayText_data();
-
-     /**
-     * Test CSatUiObserver's DisplayTextL.
-     * 
-     */
-    void testDisplayText();
-
-    /**
-     * Test CSatUiObserver's testSetUpMenu's input param list.
-     * 
-     */
-    void testSetUpMenu_data();
-
-     /**
-     * Test CSatUiObserver's SetUpMenuL.
-     * 
-     */
-    void testSetUpMenu();
-
-     /**
-     * Test CSatUiObserver's testGetInkey's input param list.
-     * 
-     */
-    void testGetInkey_data();
-
-     /**
-     * Test CSatUiObserver's GetInkeyL.
-     * 
-     */
-    void testGetInkey();
-
-     /**
-     * Test CSatUiObserver's testGetInput's input param list.
-     * 
-     */
-    void testGetInput_data();
-
-     /**
-     * Test CSatUiObserver's GetInputL.
-     * 
-     */
-    void testGetInput();
-
-     /**
-     * Test CSatUiObserver's testConfirmCommand's input param list.
-     * 
-     */
-    void testConfirmCommand_data();
-
-     /**
-     * Test CSatUiObserver's ConfirmCommand.
-     * 
-     */
-    void testConfirmCommand();
-    
-    
-    /**
-    * Test CSatUiObserver's Notification input param list.
-    * 
-    */
-   void testNotification_data();
-
-    /**
-    * Test CSatUiObserver's Notification.
-    * 
-    */
-   void testNotification();
-
-
-   /**
-   * Test CSatUiObserver's EventNotification input param list.
-   * 
-   */
-    void testEventNotification_data();
-
-   /**
-   * Test CSatUiObserver's Notification.
-   * 
-   */
-    void testEventNotification();
-
-  /**
-   * Test CSatUiObserver's testSetUpMenu's input param list.
-   * 
-   */
-    void testSelectItem_data();
-
-   /**
-   * Test CSatUiObserver's SetUpMenuL.
-   * 
-   */
-    void testSelectItem();
-
-  /**
-   * Test CSatUiObserver's testPlayTone input param list.
-   * 
-   */
-    void testPlayTone_data();
-
-   /**
-   * Test CSatUiObserver's testPlayTone.
-   * 
-   */
-    void testPlayTone();
-
-private:
-
-     /**
-     * Own.
-     * 
-     */
-    CSatUiObserver *mSatObserver;
-
-    /**
-     * Own.
-     * 
-     */
-    DummyEventProvider *mImplementer;
-
-};
-
-#endif // UT_CSATUIOBSERVER_H
--- a/satui/satapp/tsrc/ut_satapp/inc/ut_playtoneprovider.h	Tue Jul 06 14:53:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,131 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
-#ifndef UT_SATAPPPLAYTONEPROVIDER_H
-#define UT_SATAPPPLAYTONEPROVIDER_H
-
-#include <QtTest/QtTest>
-#include <QObject>
-
-
-// Class forwards
-class SatAppPlayToneProvider;
-
-/**
- *  Satapp unit test class.
- * 
- *  @since S60 <TB10.1>
- */
-class Ut_SatAppPlayToneProvider : public QObject
-{
-    Q_OBJECT
-
-public:
-
-    Ut_SatAppPlayToneProvider(QObject *parent = 0);
-
-    virtual ~Ut_SatAppPlayToneProvider();
-
-private slots:
-    /**
-     * Called before the first testfunction is executed.
-     * Handles the SetUpMenu command.
-     */
-    void initTestCase();
-
-    /**
-     * Called after the last testfunction has been executed.
-     * 
-     */
-    void cleanupTestCase();
-
-    /**
-     * Test SatAppPlayToneProvider's constructor.
-     * 
-     */
-    void testCreatePlayTone();
-
-    /**
-   * Test SatAppPlayToneProvider's testPlayStandardTone input param list.
-   * 
-   */
-    void testPlayStandardTone_data();
-
-    /**
-   * Test SatAppPlayToneProvider's PlayStandardToneL.
-   * 
-   */
-    void testPlayStandardTone();
-
-    /**
-   * Test SatAppPlayToneProvider's testPlayUserSelectedTone input param list.
-   * 
-   */
-    void testPlayUserSelectedTone_data();
-
-    /**
-   * Test SatAppPlayToneProvider's PlayUserSelectedToneL.
-   * 
-   */
-    void testPlayUserSelectedTone();
-
-    /**
-   * Test SatAppPlayToneProvider's closeSatUI.
-   * 
-   */
-    void testCloseSatUI();
-
-    /**
-   * Test SatAppPlayToneProvider's clearScreen.
-   * 
-   */
-    void testClearScreen();
-
-    /**
-   * Test SatAppPlayToneProvider's testMapcPlayComplete input param list.
-   * 
-   */
-    void testMapcPlayComplete_data();
-
-    /**
-   * Test SatAppPlayToneProvider's MapcPlayComplete.
-   * 
-   */
-    void testMapcPlayComplete();
-
-    /**
-   * Test SatAppPlayToneProvider's testMapcInitComplete input param list.
-   * 
-   */
-    void testMapcInitComplete_data();
-
-    
-    /**
-   * Test SatAppPlayToneProvider's MapcInitComplete.
-   * 
-   */
-    void testMapcInitComplete();
-
-private:
-     /**
-     * Own.
-     */
-    SatAppPlayToneProvider *mPlayTone;
-
-};
-
-#endif // UT_SATAPPPLAYTONEPROVIDER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satui/satapp/tsrc/ut_satapp/inc/ut_satappaction.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#ifndef UT_SATAPPACTION_H
+#define UT_SATAPPACTION_H
+
+// includes
+#include <QtTest/QtTest>
+#include <QObject>
+
+
+// forward declarations
+class SatAppAction;
+
+
+
+// QTest class
+class Ut_SatAppAction : public QObject
+{
+    Q_OBJECT
+
+public:
+
+    Ut_SatAppAction(QObject *parent = 0);
+
+private slots:
+
+    void testAction();
+    void testParams();
+    void testComplete();
+    void testCompleteSignal();
+    void testDoubleComplete();
+    void testAsyncActionRobustness();
+    void testWait();
+
+private:
+
+
+};
+
+
+
+// Helper object
+class ActionHelper : public QObject
+{
+    Q_OBJECT
+
+public:
+    ActionHelper() {mCounter=0;}
+    int& count() {return mCounter;}
+
+public slots:
+    void inc() {++mCounter;}
+    void del(SatAppAction*);
+
+private:
+    int mCounter;
+};
+
+
+#endif // UT_SATAPPACTION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satui/satapp/tsrc/ut_satapp/inc/ut_satappconfirmprovider.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#ifndef UT_SATAPPCONFIRMPROVIDER_H
+#define UT_SATAPPCONFIRMPROVIDER_H
+
+// includes
+#include <QtTest/QtTest>
+#include <QObject>
+
+
+// forward declarations
+class SatAppConfirmProvider;
+
+
+
+// QTest class
+class Ut_SatAppConfirmProvider : public QObject
+{
+    Q_OBJECT
+
+public:
+
+    Ut_SatAppConfirmProvider(
+            QObject *parent = 0);
+
+private slots:
+
+    void testConfirmCommand_data();
+    void testConfirmCommand();
+    void testConfirmFirstAction();
+    void testConfirmSecondAction();
+    void testConfirmAndClearScreen();
+
+};
+
+
+// internal helper class
+class ConfirmProviderTest: public QObject
+{
+    Q_OBJECT
+
+public:
+
+    ConfirmProviderTest();
+    ~ConfirmProviderTest();
+
+public slots:
+
+    void simulateFirstActionClicked();
+    void simulateSecondActionClicked();
+    void simulateClearScreen();
+    void cleanup();
+
+public:
+    
+    // test data
+    SatAppConfirmProvider *mConfirm;
+
+};
+
+
+#endif // UT_SATAPPCONFIRMPROVIDER_H
--- a/satui/satapp/tsrc/ut_satapp/inc/ut_satappeventhandler.h	Tue Jul 06 14:53:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
-#ifndef UT_SATAPPEVENTPROVIDER_H
-#define UT_SATAPPEVENTPROVIDER_H
-
-#include <QtTest/QtTest>
-#include <QObject>
-#include <hbview.h>
-
-// Class forwards
-class HbMainWindow;
-class HbView;
-class SatAppEventProvider;
-
-/**
- *  Satapp unit test class.
- * 
- *  @since S60 <TB10.1>
- */
-class Ut_SatAppEventProvider : public QObject
-{
-    Q_OBJECT
-
-public:
-
-    Ut_SatAppEventProvider(QObject *parent = 0);
-
-
-    virtual ~Ut_SatAppEventProvider();
-
-private slots:
-     /**
-     * Called before the first testfunction is executed.
-     * Handles the SetUpMenu command.
-     */
-    void initTestCase();
-
-     /**
-     * Called after the last testfunction has been executed.
-     * 
-     */
-    void cleanupTestCase();
-
-     /**
-     * Test SatAppEventProvider's constructor.
-     * 
-     */
-    void testCreateEventHandler();
-
-    /**
-     * Test SatAppEventProvider's testShowSsWaitNote param list.
-     * 
-     */
-    void testShowSsWaitNote_data();
-
-     /**
-     * Test SatAppEventProvider's showSsWaitNote.
-     * 
-     */
-    void testShowSsWaitNote();
-
-     /**
-     * Test SatAppEventProvider's StopShowWaitNote.
-     * 
-     */
-    void testStopShowWaitNote();
-
-     /**
-     * Test SatAppEventProvider's ShowWaitNoteWithoutDelayL.
-     * 
-     */
-    void testShowWaitNoteWithoutDelay();
-
-     /**
-     * Test SatAppEventProvider's ShowSsErrorNoteL.
-     * 
-     */
-    void testShowSsErrorNote();
-
-private:
-    /**
-     * Own.
-     */
-    SatAppEventProvider *mEventHandler;
-
-    /**
-     * Own.
-     */
-    HbMainWindow *mWindow;
-
-
-};
-
-#endif // UT_SATAPPEVENTPROVIDER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satui/satapp/tsrc/ut_satapp/inc/ut_satappinputprovider.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,96 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#ifndef UT_SATAPPINPUTPROVIDER_H
+#define UT_SATAPPINPUTPROVIDER_H
+
+// includes
+#include <QtTest/QtTest>
+#include <QObject>
+
+
+// forward declarations
+class SatAppInputProvider;
+
+
+
+// QTest class
+class Ut_SatAppInputProvider : public QObject
+{
+    Q_OBJECT
+
+public:
+
+    Ut_SatAppInputProvider(
+            QObject *parent = 0);
+
+private slots:
+
+    void testResetState();
+
+    void testGetInkeyAndOk_data();
+    void testGetInkeyAndOk();
+    void testGetInkeyAndCancel_data();
+    void testGetInkeyAndCancel();
+    void testGetInkeyAndTimeout();
+    void testGetInkeyAndReset();
+    void testGetInkeyAndDelete();
+
+    void testGetInkeyImmediateAndOk();
+    void testGetInkeyImmediateAndCancel();
+    
+    void testGetInputAndOk_data();
+    void testGetInputAndOk();
+    void testGetInputAndCancel_data();
+    void testGetInputAndCancel();
+    void testGetInputAndTimeout();
+    void testGetInputAndReset();
+    void testGetInputAndDelete();
+
+private:
+
+
+};
+
+
+// internal helper class
+class InputProviderTest: public QObject
+{
+    Q_OBJECT
+
+public:
+
+    InputProviderTest();
+    ~InputProviderTest();
+
+public slots:
+
+    void simulateFirstActionClicked();
+    void simulateSecondActionClicked();
+    void simulateImmediateKeypress(QString s);
+    void cleanup();
+
+public:
+
+    
+    // test data
+    SatAppInputProvider *mInput;
+
+};
+
+
+#endif // UT_SATAPPINPUTPROVIDER_H
--- a/satui/satapp/tsrc/ut_satapp/inc/ut_satappmainhandler.h	Tue Jul 06 14:53:02 2010 +0300
+++ b/satui/satapp/tsrc/ut_satapp/inc/ut_satappmainhandler.h	Wed Jul 21 18:26:52 2010 +0300
@@ -23,6 +23,7 @@
 
 
 // Class forwards
+class HbMainWindow;
 class SatAppMainHandler;
 
 /**
@@ -36,7 +37,8 @@
 
 public:
 
-    Ut_SatAppMainHandler(QObject *parent = 0);
+    Ut_SatAppMainHandler(
+            HbMainWindow* mainWindow, QObject *parent = 0);
 
     virtual ~Ut_SatAppMainHandler();
 
@@ -60,9 +62,8 @@
     void testCreateMainHandler();
 
 private:
-     /**
-     * Own.
-     */
+    
+    HbMainWindow* mMainWindow; // not own
     SatAppMainHandler *mMainHandler;
 
 };
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satui/satapp/tsrc/ut_satapp/inc/ut_satappmenuprovider.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#ifndef UT_SATAPPMENUPROVIDER_H
+#define UT_SATAPPMENUPROVIDER_H
+
+// includes
+#include <QtTest/QtTest>
+#include <QObject>
+
+
+// forward declarations
+class HbMainWindow;
+class SatAppMenuProvider;
+
+
+
+// QTest class
+class Ut_SatAppMenuProvider : public QObject
+{
+    Q_OBJECT
+
+public:
+
+    Ut_SatAppMenuProvider(
+            HbMainWindow* mainWindow, QObject *parent = 0);
+
+private slots:
+
+    void testResetState();
+
+    void testSetUpMenu_data();
+    void testSetUpMenu();
+    void testSetUpMenuAndReset();
+    void testSetUpMenuAndDelete();
+
+    void testSelectItem_data();
+    void testSelectItem();
+    void testSelectItemAndBack();
+    void testSelectItemAndTimeout();
+    void testSelectItemAndReset();
+    void testSelectItemAndDelete();
+
+private:
+
+    HbMainWindow* mMainWindow; // not own
+
+};
+
+
+// internal helper class
+class MenuProviderTest: public QObject
+{
+    Q_OBJECT
+
+public:
+
+    MenuProviderTest(HbMainWindow* mainWindow);
+    ~MenuProviderTest();
+
+public slots:
+    void loadMainview();
+    void simulateItemSelected();
+    void simulateBackButtonClicked();
+    void cleanup();
+
+public:
+
+    // test data
+    SatAppMenuProvider *mMenu;
+    int mItemIndexToBeSelected;
+
+};
+
+
+#endif // UT_SATAPPMENUPROVIDER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satui/satapp/tsrc/ut_satapp/inc/ut_satapppopupprovider.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#ifndef UT_SATAPPPOPUPPROVIDER_H
+#define UT_SATAPPPOPUPPROVIDER_H
+
+// includes
+#include <QtTest/QtTest>
+#include <QObject>
+
+
+// forward declarations
+class SatAppPopupProvider;
+
+
+
+// QTest class
+class Ut_SatAppPopupProvider : public QObject
+{
+    Q_OBJECT
+
+public:
+
+    Ut_SatAppPopupProvider(
+            QObject *parent = 0);
+
+private slots:
+
+
+    void testDisplayTextAndOk_data();
+    void testDisplayTextAndOk();
+    
+    void testDisplayTextAndCancel_data();
+    void testDisplayTextAndCancel();
+  
+    void testDisplayTextAndTimeout();
+    
+    void testNotificationWithCancel_data();
+    void testNotificationWithCancel();
+  
+    void testNotification_data();
+    void testNotification();
+
+};
+
+
+// internal helper class
+class PopupProviderTest: public QObject
+{
+    Q_OBJECT
+
+public:
+
+    PopupProviderTest();
+    ~PopupProviderTest();
+
+public slots:
+
+    bool simulateOkClicked();
+    bool simulateCancelClicked();
+    void cleanup();
+
+public:
+    
+    // test data
+    SatAppPopupProvider *mPopup;
+
+};
+
+
+#endif // UT_SATAPPPOPUPPROVIDER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satui/satapp/tsrc/ut_satapp/inc/ut_satappserverdispatcher.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,84 @@
+/*
+* 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: Unit test CSatUiObserver class
+*
+*/
+
+#ifndef UT_SATAPPSERVERDISPATCHER_H
+#define UT_SATAPPSERVERDISPATCHER_H
+
+#include <QtTest/QtTest>
+#include <QObject>
+
+// Class forwards
+class SatAppServerDispatcher;
+class SatAppAction;
+
+/**
+ *  CSatUiObserver unit test class.
+ */
+class Ut_SatAppServerDispatcher : public QObject
+{
+    Q_OBJECT
+
+public:
+    Ut_SatAppServerDispatcher(QObject *parent = 0);
+
+private slots:
+
+    void initTestCase();
+    void cleanupTestCase();
+
+    //test MSatUiObserver api
+    void testDisplayText_data();
+    void testDisplayText();
+    void testGetInkey_data();
+    void testGetInkey();
+    void testGetInput_data();
+    void testGetInput();
+    void testSetUpMenu_data();
+    void testSetUpMenu();
+    void testSelectItem_data();
+    void testSelectItem();
+    void testPlayTone_data();
+    void testPlayTone();
+    void testConfirmCommand_data();
+    void testConfirmCommand();
+    void testNotification_data();
+    void testNotification();
+    void testEventNotification_data();
+    void testEventNotification();
+
+    // test slots
+    void testMenuSelection();
+    void testUserCancelSession();
+
+private:
+
+    SatAppServerDispatcher *mServer;
+
+};
+
+
+// internal helper class
+class ServerDispatcherHelper: public QObject
+{
+    Q_OBJECT
+
+public slots:
+    void exec(SatAppAction& action);
+    void simulateItemSelected(SatAppAction& action);
+};
+
+#endif // UT_SATAPPSERVERDISPATCHER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satui/satapp/tsrc/ut_satapp/inc/ut_satapptoneprovider.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,96 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#ifndef UT_SATAPPTONEPROVIDER_H
+#define UT_SATAPPTONEPROVIDER_H
+
+#include <QtTest/QtTest>
+#include <QObject>
+#include <msatuiobserver.h>
+
+
+// Class forwards
+class SatAppToneProvider;
+
+// class declaration
+class Ut_SatAppToneProvider : public QObject
+{
+    Q_OBJECT
+
+public:
+
+    Ut_SatAppToneProvider(QObject *parent = 0);
+
+private slots:
+
+    void testCreateProvider_data();
+    void testCreateProvider();
+    void testClearScreen();
+    
+    void testPlayTone_data();
+    void testPlayTone();
+    void testplayDoubleTone_data();
+    void testplayDoubleTone();
+    void testPlayToneAndClearScreen();
+
+    void testMatoPrepareComplete_data();
+    void testMatoPrepareComplete();
+//    void testMatoPlayComplete_data();
+//    void testMatoPlayComplete();
+//    void testMapcPlayComplete_data();
+//    void testMapcPlayComplete();
+    void testMapcInitComplete_data();
+    void testMapcInitComplete();
+    void testRecognizeTone_data();
+    void testRecognizeTone();
+    void testPrepareAudioToneUtility();
+
+};
+
+// internal helper class
+class ToneProviderTest: public QObject
+{
+    Q_OBJECT
+
+public:
+
+    ToneProviderTest();
+    ~ToneProviderTest();
+    static SatAppToneProvider* getToneInstance();
+    bool isMessageBoxShown();
+    bool isTimerActive();
+    void ConstructAudioTone();
+    void DestroyAudioTone();
+    void ConstructAudioPlayer();
+    void DestroyAudioPlayer();
+    void ConstructTimer(bool active);
+    void DestroyTimer();
+    void SetPlayToneResult(TSatUiResponse error);
+    void TestRecognizeTone(int tone, int duration);
+
+public slots:
+
+    void cleanup();
+
+public:
+    
+    // test data
+    SatAppToneProvider *mTone;
+
+};
+
+#endif // UT_SATAPPTONEPROVIDER_H
--- a/satui/satapp/tsrc/ut_satapp/src/dummyeventprovider.cpp	Tue Jul 06 14:53:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,681 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include <QStringList>
-#include <msatuiadapter.h>
-#include "dummyeventprovider.h"
-#include "tflogger.h"
-#include "csatuiobserver.h"
-#include "dummyplaytoneprovider.h"
-
-// ----------------------------------------------------------------------------
-// DummyEventProvider::DummyEventProvider
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-DummyEventProvider::DummyEventProvider(QObject *parent) :
-    QObject(parent), mObs(NULL)
-{
-    qDebug("SATAPP: DummyEventProvider::DummyEventProvider call");
-    TRAPD(err, mObs = CSatUiObserver::NewL());
-    
-    if (KErrNone != err) {
-        CloseSatUI();
-    } else {
-        mObs->SetImplementer(this);
-        TFLOGSTRING("SATAPP: DummyEventProvider::DummyEventProvider \
-            SetImplementer")
-        mPlayTone = new DummyPlayToneProvider(this);
-    }  
-    qDebug("SATAPP: DummyEventProvider::DummyEventProvider exit");
-}
-
-// ----------------------------------------------------------------------------
-// DummyEventProvider::~DummyEventProvider
-// Sets a pointer to CSatUiViewAppUi object.
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-DummyEventProvider::~DummyEventProvider()
-{
-    qDebug("SATAPP: DummyEventProvider::~DummyEventProvider call");
-    delete mObs;
-    mObs = NULL;
-    if (mPlayTone) {
-        delete mPlayTone;
-        mPlayTone = 0;
-        TFLOGSTRING("SATAPP: DummyEventProvider::~DummyEventProvider delete\
-            mPlayTone")
-    }
-    qDebug("SATAPP: DummyEventProvider::~DummyEventProvider exit");
-}
-
-// ----------------------------------------------------------------------------
-// DummyEventProvider::SetUpMenuL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-TSatUiResponse DummyEventProvider::SetUpMenuL(
-    const TDesC &aText,
-    const MDesCArray &aMenuItems,
-    const CArrayFixFlat<TSatAction> */*aMenuItemNextActions*/,
-    const CFbsBitmap */*aIconBitmap*/,
-    //const CAknIconArray */*aItemIconsArray*/,
-    const TBool aSelfExplanatoryItems,
-    const TBool aHelpIsAvailable)
-    {
-    qDebug("SATAPP: DummyEventProvider::SetUpMenuL call");
-
-    TSatUiResponse response(ESatSuccess);
-    QString title;
-    if (aText.Length() > 0) {
-        title = QString::fromUtf16 (aText.Ptr(), aText.Length());
-        }
-
-    QStringList *menuList = new QStringList();
-    qDebug("SATAPP: DummyEventProvider::SetUpMenuL List");
-
-    //Add Item
-    if(menuList) {
-        for (int i=0 ; i<aMenuItems.MdcaCount() ; i++) {
-            QString item=QString::fromUtf16(aMenuItems.MdcaPoint(i).Ptr(),
-                aMenuItems.MdcaPoint(i).Length());
-            menuList->append(item);
-            }
-
-        qDebug("SATAPP: DummyEventProvider::SetUpMenuL add item");
-
-        emit setUpMenuEvent(
-            response,
-            title,
-            *menuList,
-            //const CArrayFixFlat<TSatAction> *aMenuItemNextActions,
-            //const HbIcon &aIcon,
-            //const CArrayFixFlat<TInt> *aMenuIcons,
-            aSelfExplanatoryItems,
-            aHelpIsAvailable);
-
-        delete menuList;
-    }
-    qDebug("SATAPP: DummyEventProvider::SetUpMenuL exit");
-
-    return response;
-    }
-
-// ----------------------------------------------------------------------------
-// DummyEventProvider::SetUpMenuL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-TSatUiResponse DummyEventProvider::SelectItemL(
-    const TDesC &aText,
-    const MDesCArray &aMenuItems,
-    const CArrayFixFlat<TSatAction> */*aMenuItemNextActions*/,
-    const TInt aDefaultItem,
-    TUint8 &aSelection,
-    const CFbsBitmap */*aIconBitmap*/,
-    //const CAknIconArray */*aItemsIconArray*/,
-    const TBool aSelfExplanatoryItems,
-    const TBool aHelpIsAvailable)
-{
-    qDebug("SATAPP: DummyEventProvider::SelectItemL call");
-
-    TSatUiResponse response(ESatSuccess);
-    aSelection = 0;
-    QString title;
-    if (aText.Length() > 0) {
-        title=QString::fromUtf16(aText.Ptr(), aText.Length());
-        }
-
-    QStringList *menuList = new QStringList();
-    //Add Item
-    if(menuList) {
-        for (int i=0 ; i<aMenuItems.MdcaCount() ; i++) {
-            QString item=QString::fromUtf16(aMenuItems.MdcaPoint(i).Ptr(),
-                        aMenuItems.MdcaPoint(i).Length());
-            menuList->append(item);
-            }
-        qDebug("SATAPP: DummyEventProvider::SelectItemL add item");
-
-        emit selectItemEvent(
-            response,
-            title,
-            *menuList,
-            aDefaultItem,
-            aSelection,
-            //const CArrayFixFlat<TSatAction> *aMenuItemNextActions,
-            //const HbIcon &aIcon,
-            //const CArrayFixFlat<TInt> *aMenuIcons,
-            aSelfExplanatoryItems,
-            aHelpIsAvailable);
-
-        delete menuList;
-    }
-    qDebug("SATAPP: DummyEventProvider::SelectItemL exit");
-
-    return response;
-}
-
-// ----------------------------------------------------------------------------
-// DummyEventProvider::ProfileState
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-int DummyEventProvider::profileState()
-{
-    qDebug("SATAPP: DummyEventProvider::ProfileState call");
-    int res (0);
-    if (mObs) {
-       res = mObs->ProfileState();
-    }
-    qDebug("SATAPP: DummyEventProvider::ProfileState exit");
-    return res;
-}
-
-// ----------------------------------------------------------------------------
-// DummyEventProvider::MenuSelection
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void DummyEventProvider::menuSelection(int aMenuItem, bool aHelpRequested)
-    {
-    if(mObs && mObs->Adapter()) {
-        mObs->Adapter()->MenuSelection(aMenuItem, aHelpRequested);
-        }
-
-    qDebug("SATAPP: DummyEventProvider::MenuSelection exit");
-    }
-
-// ----------------------------------------------------------------------------
-// DummyEventProvider::DisplayTextL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-TSatUiResponse DummyEventProvider::DisplayTextL(
-    const TDesC &aText,
-    const TDesC &aSimApplicationName,
-    CFbsBitmap */*aIconBitmapDisplayText*/,
-    const TBool aSelfExplanatoryIcon,
-    const TBool aSustainedText,
-    const TTimeIntervalSeconds aDuration,
-    const TBool aWaitUserToClear)
-    {
-    qDebug("SATAPP: DummyEventProvider::DisplayTextL call");
-
-    TSatUiResponse response(ESatFailure);
-    QString title;
-    if (aText.Length() > 0) {
-        title=QString::fromUtf16(aText.Ptr(), aText.Length());
-    } else {
-         qDebug("SATAPP: DummyEventProvider::DisplayTextL null text");
-         response = ESatFailure;
-    }
-
-    QString appName;
-    if (aSimApplicationName.Length() > 0) {
-         appName=QString::fromUtf16(aSimApplicationName.Ptr(),
-                aSimApplicationName.Length());
-    } else {
-        // test leave
-        qDebug("SATAPP: DummyEventProvider::DisplayTextL leave exit");
-        User::Leave(KErrNotFound);
-    }
-
-    int timeInterval = aDuration.Int();
-
-    bool isSelfExplanatoryIcon = (aSelfExplanatoryIcon) ? true : false;
-
-    emit displayTextEvent(
-       response,
-       title,
-       appName,
-       //const HbIcon &aIcon,
-       isSelfExplanatoryIcon,
-       aSustainedText,
-       timeInterval,
-       aWaitUserToClear);
-
-    qDebug("SATAPP: DummyEventProvider::DisplayTextL exit");
-    return response;
-    }
-
-// ----------------------------------------------------------------------------
-// DummyEventProvider::GetInputLL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-TSatUiResponse DummyEventProvider::GetInputL(
-    const TDesC &aText,
-    const TSatCharacterSet aCharacterSet,
-    TDes &aInput,
-    const TInt aMinLength,
-    const TInt aMaxLength,
-    const TBool aHideInput,
-    const TBool aGetInkey,
-    const CFbsBitmap */*aIconBitmapGetInput*/,
-    const TBool aSelfExplanatory,
-    TUint &aDuration)
-{
-    qDebug("SATAPP: DummyEventProvider::GetInputL call");
-
-    TSatUiResponse response(ESatSuccess);
-
-    QString title;
-    if (aText.Length() > 0) {
-        title=QString::fromUtf16(aText.Ptr(), aText.Length());
-        TFLOGSTRING2("SATAPP: DummyEventProvider::GetInputL \
-            Title=%S", &aText)
-        }
-
-    QString inputText;
-    if (aInput.Length() > 0) {
-        inputText = QString::fromUtf16(aInput.Ptr(), aInput.Length());
-    } else {
-        // test leave
-        TFLOGSTRING("SATAPP: DummyEventProvider::GetInkey test leave")
-        User::Leave(KErrNotFound);
-    }
-    bool isSelfExplanatory = aSelfExplanatory;
-    unsigned int duration = aDuration;
-     if (aGetInkey) {
-        //Get Inkey
-         emit getInkeyEvent(
-             response,
-             title,
-             aCharacterSet,
-             inputText,
-             //iconBitmapGetInput,
-             isSelfExplanatory,
-             duration);
-         qDebug("SATAPP: DummyEventProvider::GetInputL: GetInkey");
-         aInput.Copy(reinterpret_cast<const TUint16*>(inputText.utf16()), inputText.length());
-     } else {
-        // Get Input
-        bool hideInput = aHideInput;
-        int minLength = aMinLength;
-        int maxLength = aMaxLength;
-        emit getInputEvent(
-            response,
-            title,
-            aCharacterSet,
-            inputText,
-            minLength,
-            maxLength,
-            hideInput,
-            //iconBitmapGetInput,
-            isSelfExplanatory,
-            duration);
-        int length = inputText.length();
-        if (length > maxLength) {
-            length = maxLength;
-        }
-        qDebug("SATAPP: DummyEventProvider::GetInputL: GetInput");
-        aInput.Copy(reinterpret_cast<const TUint16*>(inputText.utf16()), length);
-    }
-    qDebug("SATAPP: DummyEventProvider::GetInputL exit");
-    return response;
-    }
-
-    // ----------------------------------------------------------------------------
-// DummyEventProvider::GetYesNoL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-TSatUiResponse DummyEventProvider::GetYesNoL(
-    const TDesC &aText,
-    const TSatCharacterSet aCharacterSet,
-    TChar &aInkey,
-    const CFbsBitmap */*aIconBitmap*/,
-    const TBool aSelfExplanatory,
-    TUint &aDuration,
-    const TBool aImmediateDigitResponse)
-{
-    qDebug("SATAPP: DummyEventProvider::GetYesNoL call");
-    TSatUiResponse response(ESatSuccess);
-    QString text;
-    if (aText.Length() > 0) {
-        text=QString::fromUtf16(aText.Ptr(), aText.Length());
-    }
-
-    unsigned int inKey = static_cast < TUint >(aInkey);
-
-    bool selfExplanatory = aSelfExplanatory;
-    bool immediateDigitResponse = aImmediateDigitResponse;
-    unsigned int duration = aDuration;
-
-    emit getYesNoEvent(
-        response,
-        text,
-        aCharacterSet,
-        inKey,
-        //const TSatIconId &aIconId,
-        selfExplanatory,
-        duration,
-        immediateDigitResponse);
-
-    aInkey = inKey;
-    qDebug("SATAPP: DummyEventProvider::GetYesNoL exit");
-    return response;
-}
-
-// ----------------------------------------------------------------------------
-// DummyEventProvider::ConfirmSendL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-TSatUiResponse DummyEventProvider::ConfirmSendL(
-    const TDesC &aText,
-    TBool &aActionAccepted,
-    TInt aType)
-{
-    qDebug("SATAPP: DummyEventProvider::ConfirmSendL call");
-    TSatUiResponse response(ESatSuccess);
-    QString text;
-    if (aText.Length() > 0) {
-        text=QString::fromUtf16(aText.Ptr(), aText.Length());
-    }
-    bool actionAccepted = aActionAccepted;
-    int type = aType;
-    emit confirmSendEvent(
-        response,
-        text,
-        actionAccepted,
-        type);
-    qDebug("SATAPP: DummyEventProvider::ConfirmSendL exit");
-    return response;
-}
-
-// ----------------------------------------------------------------------------
-// DummyEventProvider::ShowSmsWaitNoteL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void DummyEventProvider::ShowSmsWaitNoteL(
-    const TDesC &aText,
-    const CFbsBitmap */*aIconBitmapSendSM*/,
-    const TBool aSelfExplanatoryIcon)
-{
-    qDebug("SATAPP: DummyEventProvider::ShowSmsWaitNoteL call");
-    QString title;
-    if (aText.Length() > 0) {
-        title = QString::fromUtf16 (aText.Ptr(), aText.Length());
-    }
-    bool selfExplanatoryIcon = aSelfExplanatoryIcon;
-
-    emit showSmsWaitNoteEvent(
-        title,
-        selfExplanatoryIcon);
-    qDebug("SATAPP: DummyEventProvider::ShowSmsWaitNoteL exit");
-}
-
-// ----------------------------------------------------------------------------
-// DummyEventProvider::ConfirmSetUpCallL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void DummyEventProvider::ConfirmSetUpCallL(
-    const TDesC &aText,
-    const TDesC &aSimAppName,
-    TBool &aActionAccepted,
-    const CFbsBitmap */*aIconBitmap*/,
-    const TBool /*aSelfExplanatory*/)
-    {
-    qDebug("SATAPP: DummyEventProvider::ConfirmSetUpCallL call");
-    QString text;
-    if (aText.Length() > 0) {
-        text = QString::fromUtf16 (aText.Ptr(), aText.Length());
-        TFLOGSTRING2("SATAPP: DummyEventProvider::ConfirmSetUpCallL \
-            text=%S", text.utf16())
-    }
-    
-    QString title;
-    if (aText.Length() > 0) {
-        title = QString::fromUtf16 (aSimAppName.Ptr(), aSimAppName.Length());
-        TFLOGSTRING2("SATAPP: DummyEventProvider::ConfirmSetUpCallL \
-            Title=%S", title.utf16())
-    }
-    bool actionAccepted = aActionAccepted;
-
-    emit showSetUpCallConfirmEvent(
-        text,
-        title,
-        actionAccepted);
-    qDebug("SATAPP: DummyEventProvider::ConfirmSetUpCallL exit");
-    }
-
-// ----------------------------------------------------------------------------
-// DummyEventProvider::ShowDtmfWaitNoteL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-TSatUiResponse DummyEventProvider::ShowDtmfWaitNoteL(
-    const TDesC &aText,
-    const CFbsBitmap */*aIconBitmapSendSM*/,
-    const TBool /*aSelfExplanatoryIcon*/)
-{
-    TSatUiResponse response(ESatSuccess);
-    qDebug("SATAPP: DummyEventProvider::ShowDtmfWaitNoteL call");
-    QString title;
-    if (aText.Length() > 0) {
-        title = QString::fromUtf16 (aText.Ptr(), aText.Length());
-        TFLOGSTRING2("SATAPP: DummyEventProvider::ShowDtmfWaitNoteL \
-            Title=%S", title.utf16())
-    }
-    emit showDtmfWaitNoteEvent(
-        response,
-        title);
-    qDebug("SATAPP: DummyEventProvider::ShowDtmfWaitNoteL exit");
-    return response;
-}
-
-// ----------------------------------------------------------------------------
-// DummyEventProvider::clearScreen
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void DummyEventProvider::ClearScreen()
-{
-    qDebug("SATAPP: DummyEventProvider::ClearScreen call");
-    if (mPlayTone) {
-        mPlayTone->clearScreen();
-    }
-    emit clearScreenEvent();
-    qDebug("SATAPP: DummyEventProvider::ClearScreen exit");
-}
-
-// ----------------------------------------------------------------------------
-// DummyEventProvider::CloseSatUI
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void DummyEventProvider::CloseSatUI()
-{
-    qDebug("SATAPP: DummyEventProvider::CloseSatUI call");
-    if (mPlayTone) {
-        mPlayTone->closeSatUI();
-    }
-    emit closeUiEvent();
-    qDebug("SATAPP: DummyEventProvider::CloseSatUI exit");
-}
-
-//-----------------------------------------------------------------------------
-// DummyEventProvider::StopShowWaitNote
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//    
-void DummyEventProvider::StopShowWaitNote()
-{
-    qDebug("SATAPP: DummyEventProvider::StopShowWaitNote call");
-    emit stopShowWaitNoteEvent();
-    qDebug("SATAPP: DummyEventProvider::StopShowWaitNote exit");
-}
-
-//-----------------------------------------------------------------------------
-// DummyEventProvider::userCancelDtmfResponse
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void DummyEventProvider::userCancelResponse()
-{
-    qDebug("SATAPP: DummyEventProvider::userCancelDtmfResponse call");
-    mObs->Adapter()->SessionTerminated( ESessionCancel );
-    qDebug("SATAPP: DummyEventProvider::userCancelDtmfResponse exit");
-}
-
-//-----------------------------------------------------------------------------
-// DummyEventProvider::ShowSsWaitNoteL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void DummyEventProvider::ShowSsWaitNoteL(
-            const TDesC &aText,
-            const CFbsBitmap* /*aIconBitmap*/,
-            const TBool aSelfExplanatoryIcon )
-{
-    TFLOGSTRING("SATAPP: DummyEventProvider::ShowSsWaitNoteL call")
-    QString title;
-    if (aText.Length() > 0) {
-        title = QString::fromUtf16 (aText.Ptr(), aText.Length());
-        TFLOGSTRING2("SATAPP: DummyEventProvider::ShowSsWaitNoteL \
-            Title=%s", title.utf16())
-    }
-    bool selfExplanatoryIcon = aSelfExplanatoryIcon;
-
-    emit showSsWaitNoteEvent(
-        title,
-        selfExplanatoryIcon);
-    TFLOGSTRING("SATAPP: DummyEventProvider::ShowSsWaitNoteL exit")
-}
-
-//-----------------------------------------------------------------------------
-// DummyEventProvider::ShowWaitNoteWithoutDelayL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void DummyEventProvider::ShowWaitNoteWithoutDelayL()
-{
-    TFLOGSTRING("SATAPP: DummyEventProvider::ShowWaitNoteWithoutDelayL call")
-    emit showWaitNoteWithoutDelayEvent();
-    TFLOGSTRING("SATAPP: DummyEventProvider::ShowWaitNoteWithoutDelayL exit")
-}
-
-//-----------------------------------------------------------------------------
-// DummyEventProvider::showSsErrorNoteEvent
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void DummyEventProvider::ShowSsErrorNoteL()
-{
-    TFLOGSTRING("SATAPP: DummyEventProvider::showSsErrorNoteEvent call")
-    emit showSsErrorNoteEvent();
-    TFLOGSTRING("SATAPP: DummyEventProvider::showSsErrorNoteEvent exit")
-}
-
-//-----------------------------------------------------------------------------
-// DummyEventProvider::ShowBIPNoteL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void DummyEventProvider::ShowBIPNoteL( TInt aCommand, const TDesC &aText,
-        const CFbsBitmap* /*aIconBitmap*/, const TBool /*aSelfExplanatory*/)
-{
-    TFLOGSTRING("SATAPP: DummyEventProvider::ShowBIPNoteL call")
-    int cmdType = aCommand;
-    QString title;
-    if (aText.Length() > 0) {
-        title=QString::fromUtf16(aText.Ptr(), aText.Length());
-        TFLOGSTRING2("SATAPP: DummyEventProvider::ShowBIPNoteL \
-            Title=%S", title.utf16())
-        }
-    emit showBIPNoteEvent(cmdType, title);
-    TFLOGSTRING("SATAPP: DummyEventProvider::ShowBIPNoteL exit")
-}
-
-//-----------------------------------------------------------------------------
-// DummyEventProvider::ConfirmOpenChannelL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-TSatUiResponse DummyEventProvider::ConfirmOpenChannelL(
-    const TDesC &aText,
-    TBool &aActionAccepted,
-    const CFbsBitmap* /*aIconBitmapOpenChannel*/,
-    const TBool /*aSelfExplanatory*/ )
-{
-    TFLOGSTRING("SATAPP: DummyEventProvider::ConfirmOpenChannelL call")
-        
-    TSatUiResponse response( ESatSuccess );
-
-    QString title;
-    if (aText.Length() > 0) {
-        title=QString::fromUtf16(aText.Ptr(), aText.Length());
-        TFLOGSTRING2("SATAPP: DummyEventProvider::ConfirmOpenChannelL \
-            Title=%s", title.utf16())
-        }
-     
-    bool actionAccepted = aActionAccepted;
-    
-    emit showOpenChannelConfirmEvent(title, actionAccepted);
-    
-    TFLOGSTRING2( "SATAPP: DummyEventProvider::ConfirmOpenChannelL exit\
-        response: %d", response)
-    return response;
-}
-
-//-----------------------------------------------------------------------------
-// DummyEventProvider::PlayStandardToneL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-TSatUiResponse DummyEventProvider::PlayStandardToneL( const TDesC& aText,
-    const TDesC8& aSequence,
-    TTimeIntervalMicroSeconds aDuration,
-    const CFbsBitmap* aIconBitmap,
-    const TBool aSelfExplanatory )
-{
-    TFLOGSTRING("SATAPP: DummyEventProvider::PlayStandardToneL call")
-    TSatUiResponse response = mPlayTone->PlayStandardToneL(
-        aText, aSequence, aDuration, aIconBitmap, aSelfExplanatory);
-    TFLOGSTRING2("SATAPP: DummyEventProvider::PlayStandardToneL \
-        response= %d exit", response)
-    return response;
-}
-
-//-----------------------------------------------------------------------------
-// DummyEventProvider::PlayUserSelectedToneL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-TSatUiResponse DummyEventProvider::PlayUserSelectedToneL(
-        const TDesC &aText,
-        TTimeIntervalMicroSeconds aDuration,
-        TSatTone aTone,
-        const CFbsBitmap* aIconBitmap,
-        const TBool aSelfExplanatory )
-{
-    TFLOGSTRING("DummyEventProvider::PlayUserSelectedToneL calling")
-    if (100 == aTone) {
-        TFLOGSTRING("DummyEventProvider::PlayUserSelectedToneL test failure")
-        return ESatFailure;
-    }
-    TSatUiResponse response = mPlayTone->PlayUserSelectedToneL(
-        aText, aDuration, aTone, aIconBitmap, aSelfExplanatory);
-    TFLOGSTRING2( "DummyEventProvider::PlayUserSelectedToneL response= %d \
-        exit", response)
-    return response;
-}
- //End of file
--- a/satui/satapp/tsrc/ut_satapp/src/dummyplaytoneprovider.cpp	Tue Jul 06 14:53:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,178 +0,0 @@
-/*
-* 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:
-*
-*/
-
-
-// PlayStandardTone
-#include    <MProfile.h>
-#include    <MProfileEngine.h>
-#include    <MProfileTones.h>
-#include    <TProfileToneSettings.h>
-#include    <audiopreference.h>//KAudioPriorityLowLevel
-
-#include    <Mda/Common/Resource.h>//KMdaRepeatForever
-#include    <QTimer> // timeout callback
-#include    <hbmessagebox.h>//playtone note
-#include    <mdaaudiotoneplayer.h>// for CMdaAudioToneUtility&CMdaAudioPlayerUtility
-#include    <e32std.h>//TTimeIntervalMicroSeconds
-
-#include "dummyplaytoneprovider.h"
-
-//#include "tflogger.h"
-
-
-// ----------------------------------------------------------------------------
-// DummyPlayToneProvider::DummyPlayToneProvider
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-DummyPlayToneProvider::DummyPlayToneProvider(QObject *parent) :
-    QObject(parent)
-{
-    qDebug("SATAPP: DummyPlayToneProvider::DummyPlayToneProvider >");
-    qDebug("SATAPP: DummyPlayToneProvider::DummyPlayToneProvider <");
-}
-
-// ----------------------------------------------------------------------------
-// DummyPlayToneProvider::~DummyPlayToneProvider
-// Sets a pointer to CSatUiViewAppUi object.
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-DummyPlayToneProvider::~DummyPlayToneProvider()
-{
-    qDebug("SATAPP: DummyPlayToneProvider::~DummyPlayToneProvider >");
-    qDebug("SATAPP: DummyPlayToneProvider::~DummyPlayToneProvider <");
-}
-
-//-----------------------------------------------------------------------------
-// DummyPlayToneProvider::PlayStandardToneL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-TSatUiResponse DummyPlayToneProvider::PlayStandardToneL( const TDesC& /*aText*/,
-    const TDesC8& /*aSequence*/,
-    TTimeIntervalMicroSeconds /*aDuration*/,
-    const CFbsBitmap* /*aIconBitmap*/,
-    const TBool /*aSelfExplanatory*/ )
-{
-    qDebug("SATAPP: DummyPlayToneProvider::PlayStandardToneL >");
-    qDebug("SATAPP: DummyPlayToneProvider::PlayStandardToneL <");
-    return ESatSuccess;
-}
-
-
-// ---------------------------------------------------------
-// SatAppCommandHandler::GetProfileParamsL
-// Get and store settings from current profile 
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-void DummyPlayToneProvider::GetProfileParamsL( TSatTone 
-                  /*aTone = ESatToneNotSet*/, TDes* /*aToneName = NULL*/ )
-{
-    qDebug( "SatAppCommandHandler::GetProfileParamsL >");
-    qDebug("SatAppCommandHandler::GetProfileParamsL <");
-}
-
-// ---------------------------------------------------------
-// DummyPlayToneProvider::MatoPrepareComplete
-// Indicates success or failure.
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-void DummyPlayToneProvider::MatoPrepareComplete(TInt /*aError*/)
-{
-    qDebug("DummyPlayToneProvider::MatoPrepareComplete >");
-    qDebug( "DummyPlayToneProvider::MatoPrepareComplete <");
-}
-
-//-----------------------------------------------------------------------------
-// DummyPlayToneProvider::MatoPlayComplete
-// Indicates success or failure.
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void DummyPlayToneProvider::MatoPlayComplete( TInt /*aError*/ )
-{
-    qDebug("DummyPlayToneProvider::MatoPlayComplete >");
-    qDebug("DummyPlayToneProvider::MatoPlayComplete <");
-}
-
-//-----------------------------------------------------------------------------
-// DummyPlayToneProvider::PlayUserSelectedToneL
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-TSatUiResponse DummyPlayToneProvider::PlayUserSelectedToneL(
-        const TDesC &/*aText*/,
-        TTimeIntervalMicroSeconds /*aDuration*/,
-        TSatTone /*aTone*/,
-        const CFbsBitmap* /*aIconBitmap*/,
-        const TBool /*aSelfExplanatory*/ )
-{
-    qDebug("DummyPlayToneProvider::PlayUserSelectedToneL >");
-    qDebug( "DummyPlayToneProvider::PlayUserSelectedToneL <");
-    return ESatSuccess;
-}
-
-//-----------------------------------------------------------------------------
-// DummyPlayToneProvider::MapcInitComplete
-// Plays the tone.
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-void DummyPlayToneProvider::MapcInitComplete( TInt /*aError*/, 
-    const TTimeIntervalMicroSeconds& /*aDuration*/ )
-{
-    qDebug( "DummyPlayToneProvider::MapcInitComplete >" );
-    qDebug( "DummyPlayToneProvider::MapcInitComplete <" );
-}
-
-//-----------------------------------------------------------------------------
-// DummyPlayToneProvider::MapcPlayComplete
-// Deletes audio player after playing is completed.
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-void DummyPlayToneProvider::MapcPlayComplete( TInt /*aError*/ )
-{
-    qDebug( "DummyPlayToneProvider::MapcPlayComplete >");
-    qDebug("DummyPlayToneProvider::MapcPlayComplete <");
-}
-
-// ----------------------------------------------------------------------------
-// DummyPlayToneProvider::clearScreen
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void DummyPlayToneProvider::clearScreen()
-{
-    qDebug("SATAPP: SatAppEventProvider::clearScreen >");
-    qDebug("SATAPP: DummyPlayToneProvider::clearScreen <");
-}
-
-// ----------------------------------------------------------------------------
-// DummyPlayToneProvider::clearScreen
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-void DummyPlayToneProvider::closeSatUI()
-{
-    qDebug("SATAPP: DummyPlayToneProvider::closeSatUI >");
-    clearScreen();
-    qDebug("SATAPP: DummyPlayToneProvider::closeSatUI <");
-}
-
- //End of file
--- a/satui/satapp/tsrc/ut_satapp/src/main.cpp	Tue Jul 06 14:53:02 2010 +0300
+++ b/satui/satapp/tsrc/ut_satapp/src/main.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -18,53 +18,67 @@
 
 
 #include <QtTest/QtTest>
+#include "hbapplication.h"
+#include "hbinstance.h"
 
 #include "ut_satappmainhandler.h"
-#include "ut_csatuiobserver.h"
-#include "ut_satappeventhandler.h"
-#include "ut_playtoneprovider.h"
+#include "ut_satappmenuprovider.h"
+#include "ut_satappinputprovider.h"
+#include "ut_satapptoneprovider.h"
+#include "ut_satapppopupprovider.h"
+#include "ut_satappserverdispatcher.h"
+#include "ut_satappconfirmprovider.h"
+#include "ut_satappaction.h"
 
 int main(int argc, char *argv[])
 {
     qDebug("Ut_SatApp: main() >");
-    QApplication app(argc, argv);
+    HbApplication app(argc,argv);
+    HbInstance::instance();
+    HbMainWindow mainWindow;
 
-    int result(0);
+    // test cmdline parameters
     char *pass[3];
     pass[0] = argv[0];
     pass[1] = "-o"; 
-    pass[2] = "c:\\logs\\sat\\ut_SatAppMainHandler.txt";
-    
-    qDebug("Test SatAppMainHandler");
-    Ut_SatAppMainHandler tc;
-    result = QTest::qExec(&tc, 3, pass);
-    qDebug("Ut_SatApp: main() test SatAppMainHandler, result=%d", result);
+
+    int result(0);
+
+    Ut_SatAppPopupProvider utPopupProvider;
+    pass[2] = "c:\\logs\\sat\\Ut_SatAppPopupProvider.txt";
+    result += QTest::qExec(&utPopupProvider, /*3*/ 1, pass);
 
-    //qDebug("Test CSatUiObserve");
-    Ut_CSatUiObserver utCSatUiObserver;
-    char *test[3];
-    test[0] = argv[0];
-    test[1] = "-o"; 
-    test[2] = "c:\\logs\\sat\\ut_CSatUiObserver.txt";
-    result = QTest::qExec(&utCSatUiObserver, 3, test);
-    qDebug("Ut_SatApp: main() test CSatUiObserver<, result=%d", result);
+    Ut_SatAppConfirmProvider utConfirmProvide;
+    pass[2] = "c:\\logs\\sat\\Ut_SatAppConfirmProvider.txt";
+    result += QTest::qExec(&utConfirmProvide, /*3*/ 1, pass);
+
+    Ut_SatAppAction utAction;
+    pass[2] = "c:\\logs\\sat\\Ut_SatAppAction.txt";
+    result += QTest::qExec(&utAction, /*3*/ 1, pass);
+
+    Ut_SatAppMenuProvider utMenuProvider(&mainWindow);
+    pass[2] = "c:\\logs\\sat\\Ut_SatAppMenuProvider.txt";
+    result += QTest::qExec(&utMenuProvider, /*3*/ 1, pass);
 
-    /*Ut_SatAppEventProvider utSatAppEventProvider;
-    char *test_event[3];
-    test_event[0] = argv[0];
-    test_event[1] = "-o"; 
-    test_event[2] = "c:\\logs\\sat\\ut_SatAppEventProvide.txt";
-    result = QTest::qExec(&utSatAppEventProvider, 3, test_event);
-    qDebug("Ut_SatApp: main() test SatAppEventProvide<, result=%d", result);*/
+    Ut_SatAppInputProvider utInputProvider;
+    pass[2] = "c:\\logs\\sat\\Ut_SatAppInputProvider.txt";
+    result += QTest::qExec(&utInputProvider, /*3*/ 1, pass);
+
+    Ut_SatAppToneProvider utToneProvider;
+    pass[2] = "c:\\logs\\sat\\Ut_SatAppToneProvider.txt";
+    result += QTest::qExec(&utToneProvider, /*3*/ 1, pass);
 
-    Ut_SatAppPlayToneProvider utPlayTone;
-    char *test_playtone[3];
-    test_playtone[0] = argv[0];
-    test_playtone[1] = "-o"; 
-    test_playtone[2] = "c:\\logs\\sat\\Ut_SatAppPlayToneProvider.txt";
-    result = QTest::qExec(&utPlayTone, 3, test_playtone);
-    qDebug("Ut_SatApp: main() test SatAppPlayToneProvider<, result=%d", result);
+    Ut_SatAppServerDispatcher utServerDispatcher;
+    pass[2] = "c:\\logs\\sat\\Ut_SatAppServerDispatcher.txt";
+    result += QTest::qExec(&utServerDispatcher, /*3*/ 1, pass);
 
+    Ut_SatAppMainHandler utMainHandler(&mainWindow);
+    pass[2] = "c:\\logs\\sat\\ut_SatAppMainHandler.txt";
+    result = QTest::qExec(&utMainHandler, /*3*/ 1, pass);
+
+    // cause a crash to free binary, so that we can recompile and run
+    // unit tests without restarting the emulator
+    //int crash = ((QString*)0)->length();
     return result;
 }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satui/satapp/tsrc/ut_satapp/src/rsat_stub.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Stub implementations for RSatSession and RSatUiSession
+*              (used in unit testing the SAT APP)
+*
+*
+*/
+
+
+#include <msatuiobserver.h>
+#include <rsatuisession.h>
+#include <rsatsession.h>
+#include <msatuiadapter.h>
+
+// adapter 
+class CSatCCommandProcessor: public MSatUiAdapter {
+    void MenuSelection(TInt aMenuItem, TBool aHelpRequested)
+    {
+    }
+
+    void SessionTerminated(TInt8 aType)
+    {
+    }
+};
+
+
+// RSatSession
+
+RSatSession::RSatSession()
+{
+}
+
+void RSatSession::ConnectL()
+{
+}
+
+// RSatUiSession
+
+RSatUiSession::RSatUiSession()
+{
+}
+
+void RSatUiSession::RegisterL(const RSatSession&,MSatUiObserver*)
+{
+    iCommandProcessor = new CSatCCommandProcessor();
+}
+
+void RSatUiSession::Close()
+{
+    delete iCommandProcessor;
+}
+
+MSatUiAdapter* RSatUiSession::Adapter() const
+{
+    return iCommandProcessor;
+}
+
+
+
+//End of file
--- a/satui/satapp/tsrc/ut_satapp/src/ut_csatuiobserver.cpp	Tue Jul 06 14:53:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1079 +0,0 @@
-/*
-* 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: Unit test for CSatUiObserver
-*
-*/
-
-//symbian
-#include <e32base.h>
-//#include <e32cmn.h>
-#include <badesca.h>
-#include <msatuiobserver.h>
-//qt
-#include <QStringList>
-//test class
-#include "csatuiobserver.h"
-#include "ut_csatuiobserver.h"
-#include "dummyeventprovider.h"
-
-
-
-// -----------------------------------------------------------------------------
-// Ut_CSatUiObserver::Ut_CSatUiObserver
-// -----------------------------------------------------------------------------
-//
-Ut_CSatUiObserver::Ut_CSatUiObserver(QObject *parent):QObject(parent) 
-{
-    qDebug("Ut_CSatUiObserver::Ut_CSatUiObserver >");
-    TRAPD(err, mSatObserver = CSatUiObserver::NewL());
-    qDebug("Ut_CSatUiObserver: Ut_CSatUiObserver, err=%d", err);
-    mImplementer = new DummyEventProvider();
-    QVERIFY(mImplementer);
-    qDebug("Ut_CSatUiObserver::Ut_CSatUiObserver <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_CSatUiObserver::~Ut_CSatUiObserver
-// -----------------------------------------------------------------------------
-//
-Ut_CSatUiObserver::~Ut_CSatUiObserver()
-{
-    qDebug("Ut_CSatUiObserver::~Ut_CSatUiObserver >");
-    if (mSatObserver) {
-        qDebug("Ut_CSatUiObserver::~Ut_CSatUiObserver delete mSatObserver...");
-        delete mSatObserver;
-        mSatObserver = 0;
-    }
-    if (mImplementer) {
-        qDebug("Ut_CSatUiObserver::~Ut_CSatUiObserver delete mImplementer...");
-        delete mImplementer;
-        mImplementer = 0;
-    }
-    qDebug("Ut_CSatUiObserver::~Ut_CSatUiObserver <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_CSatUiObserver::initTestCase
-// QTestLib cleanup method, called after the last testfunction .
-// -----------------------------------------------------------------------------
-void Ut_CSatUiObserver::initTestCase()
-{
-    qDebug("Ut_CSatUiObserver::initTestCase >");
-    qDebug("Ut_CSatUiObserver::initTestCase <");
-}
-
-
-// -----------------------------------------------------------------------------
-// Ut_CSatUiObserver::cleanupTestCase
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_CSatUiObserver::cleanupTestCase()
-{
-    qDebug("Ut_CSatUiObserver::cleanupTestCase >");
-    qDebug("Ut_CSatUiObserver::cleanupTestCase <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_CSatUiObserver::testConnectRSatSession
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_CSatUiObserver::testConnectRSatSession()
-{
-    qDebug("Ut_CSatUiObserver::testConnectRSatSession >");
-    QVERIFY(mSatObserver);
-    TRAP_IGNORE(mSatObserver->ConnectRSatSessionL());
-    qDebug("Ut_CSatUiObserver::testConnectRSatSession <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_CSatUiObserver::testAdapter
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_CSatUiObserver::testAdapter()
-{
-    qDebug("Ut_CSatUiObserver::testAdapter >");
-    QVERIFY(mSatObserver);
-    mSatObserver->Adapter();
-    qDebug("Ut_CSatUiObserver::testAdapter <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_CSatUiObserver::testDisconnectRSatSession
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_CSatUiObserver::testDisconnectRSatSession()
-{
-    qDebug("Ut_CSatUiObserver::testDisconnectRSatSession >");
-    QVERIFY(mSatObserver);
-    mSatObserver->DisconnectRSatSession();
-    qDebug("Ut_CSatUiObserver::testDisconnectRSatSession <");
-} 
-
-// -----------------------------------------------------------------------------
-// Ut_CSatUiObserver::testProfileState
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_CSatUiObserver::testProfileState()
-{
-    qDebug("Ut_CSatUiObserver::testProfileState >");
-    QVERIFY(mSatObserver);
-    mSatObserver->ProfileState();
-    qDebug("Ut_CSatUiObserver::testProfileState <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_CSatUiObserver::testSetImplementer
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_CSatUiObserver::testSetImplementer()
-{
-    qDebug("Ut_CSatUiObserver::testSetImplementer >");
-    QVERIFY(mSatObserver);
-    QVERIFY(mImplementer);
-    mSatObserver->SetImplementer(mImplementer);
-    qDebug("Ut_CSatUiObserver::testSetImplementer <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_CSatUiObserver::testDisplayText_data
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_CSatUiObserver::testDisplayText_data()
-{
-    qDebug("Ut_CSatUiObserver::testDisplayText_data >");
-    QTest::addColumn<QString>("text");
-    QTest::addColumn<QString>("appName");
-    QTest::addColumn<int>("iconIdIdentifier");
-    QTest::addColumn<int>("iconIdQualifier");//enum 0~3
-    QTest::addColumn<bool>("isIconDisplayed");
-    QTest::addColumn<bool>("sustainedText");
-    QTest::addColumn<int>("duration");
-    QTest::addColumn<bool>("isWaitUsertoClear");
-    QTest::addColumn<int>("expectValue");
-
-    QTest::newRow("first") << "Show Display text!" << "Unit test SIM Service" << 
-        84 << 1 << false << false << 2500 << true << 0;
-
-    QTest::newRow("second") << "Show Display text!" << "SIM Service" << 
-        84 << 1 << true << false << 2500 << false << 0;
-    // test null text
-    QTest::newRow("third") << "" << "SIM Service" << 
-        84 << 1 << true << false << 2500 << false << -1;
-
-    // test icon is available for command
-    QTest::newRow("fouth") << "Show Display text!" << "SIM Service" << 
-        84 << 2 << true << false << 2500 << false << 0;
-
-    // test leave occurs
-    //QTest::newRow("forth") << "Show Display text!" << "" << 
-    //    84 << 2 << true << false << 2500 << false << 1;
-
-    qDebug("Ut_CSatUiObserver::testDisplayText_data <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_SatApp::testDisplayText
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_CSatUiObserver::testDisplayText()
-{
-    qDebug("Ut_CSatUiObserver::testDisplayText >");
-    QVERIFY(mSatObserver);
-    QFETCH(QString, text);
-    QFETCH(QString, appName);
-    QFETCH(int, iconIdIdentifier);
-    QFETCH(int, iconIdQualifier);
-    QFETCH(bool, isIconDisplayed);
-    QFETCH(bool, sustainedText);
-    QFETCH(int, duration);
-    QFETCH(bool, isWaitUsertoClear);
-    QFETCH(int, expectValue);
-
-    // text
-    HBufC* hText = HBufC::New(text.length());
-    TPtr aText( hText->Des() );
-    aText.Copy( text.utf16() );
-    // sim name
-    HBufC* hSimAppName = HBufC::New(appName.length());
-    TPtr aSimApplicationName( hSimAppName->Des() );
-    aSimApplicationName.Copy( appName.utf16() );
-
-    TSatIconId aIconId;
-    aIconId.iIdentifier = iconIdIdentifier;
-    aIconId.iIconQualifier = static_cast<TSatIconQualifier>(iconIdQualifier);
-    TBool aIsIconDisplayed(isIconDisplayed);
-
-    TSatUiResponse result(ESatSuccess);
-    // It seems that TRAPD&QT_TRAP_THROWING does nothing if leave occurs, need 
-    // to investigate.
-    QT_TRAP_THROWING( result = mSatObserver->DisplayTextL(
-                              aText, 
-                              aSimApplicationName,
-                              aIconId,
-                              aIsIconDisplayed,
-                              sustainedText,
-                              duration,
-                              isWaitUsertoClear
-                              ));
-    delete hText;
-    hText = 0;
-    TSatUiResponse exValue = static_cast<TSatUiResponse>(expectValue);
-    QCOMPARE(exValue, result);
-    qDebug("Ut_CSatUiObserver::testDisplayText <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_CSatUiObserver::testSetUpMenu_data
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_CSatUiObserver::testSetUpMenu_data()
-{
-    qDebug("Ut_CSatUiObserver::testSetUpMenu_data >");
-    QTest::addColumn<QString>("text");
-    QTest::addColumn<QStringList>("setupMenuItem");
-    QTest::addColumn<bool>("isHelpIsAvailable");
-    QTest::addColumn<int>("iconIdIdentifier");
-    QTest::addColumn<int>("iconIdQualifier");//enum 0~3
-    QTest::addColumn<int>("iconListQualifier");
-    QTest::addColumn<int>("expectReturnValue");
-
-    QStringList testSetUpMenu_1_items;
-    testSetUpMenu_1_items 
-    << "SendData" 
-    << "ReceiveData" 
-    << "CloseChannel"
-    << "OpenChannel"
-    << "GetChannelStatus"
-    << "DisplayText with different symbols and durations"
-    << "GetInkey"
-    << "GetInput"
-    << "SelectItem"
-    << "PlayTone"
-    << "RefreshRequired"
-    << "DoRefresh"
-    << "SendSm"
-    << "SendSs"
-    << "SendUssd"
-    << "SetUpCall"
-    << "SetUpIdleModeText"
-    << "CallControl"
-    << "MoSmControl"
-    << "LaunchBrowser"
-    << "SendDTMF"
-    << "SetUpEventList"
-    << "ProvideLocalInfo"
-    << "EventDownload for IdleScreen available event"
-    << "SetUpMenu";
-
-    QTest::newRow("first") << "SAT" << testSetUpMenu_1_items << 
-        false << 80 << 1 << 2 << 0;
-
-    qDebug("Ut_CSatUiObserver::testSetUpMenu_data <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_CSatUiObserver::testSetUpMenu
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_CSatUiObserver::testSetUpMenu()
-{
-    qDebug("Ut_CSatUiObserver::testSetUpMenu >");
-    QVERIFY(mSatObserver);
-    QFETCH(QString, text);
-    QFETCH(QStringList, setupMenuItem);
-    QFETCH(bool, isHelpIsAvailable);
-    QFETCH(int, iconIdIdentifier);
-    QFETCH(int, iconIdQualifier);
-    QFETCH(int, iconListQualifier);
-    QFETCH(int, expectReturnValue);
-
-    // aText
-    HBufC* hText = HBufC::New(text.length());
-    TPtr aText( hText->Des() );
-    aText.Copy( text.utf16() );
-    // aMenuItems
-    TBuf<128> menuItem;
-    CDesCArrayFlat* aMenuItems = new CDesCArrayFlat(4);
-    QVERIFY(aMenuItems);
-    for (int i = 0; i< setupMenuItem.count(); i++) {
-        menuItem = setupMenuItem.at(i).utf16();
-        QT_TRAP_THROWING(aMenuItems->AppendL(menuItem));
-    }
-    // aIconId
-    TSatIconId aIconId;
-    aIconId.iIdentifier = iconIdIdentifier;
-    aIconId.iIconQualifier = static_cast<TSatIconQualifier>(iconIdQualifier);
-    // aMenuItemNextActions
-    CArrayFixFlat<TSatAction>* aMenuItemNextActions = 
-          new CArrayFixFlat<TSatAction> (4);
-     QVERIFY(aMenuItemNextActions);
-    // Temp test
-     QT_TRAP_THROWING(aMenuItemNextActions->AppendL(ESatSetUpMenuAction));
-    // aMenuIcons
-    CArrayFixFlat<TInt>* aMenuIcons = new CArrayFixFlat<TInt>(2);
-    QVERIFY(aMenuIcons);
-    // Temp test
-    QT_TRAP_THROWING(aMenuIcons->AppendL(1));
-    // aIconListQualifier
-    TSatIconQualifier aIconListQualifier = 
-        static_cast<TSatIconQualifier>(iconListQualifier);
-    // TSatSelectionPreference, useless
-    TSatSelectionPreference aSelectionPreference(ESatNoSelectionPreference);
-    TSatUiResponse result(ESatSuccess);
-    QT_TRAP_THROWING(result = mSatObserver->SetUpMenuL(
-                              aText,
-                              *aMenuItems,
-                              aMenuItemNextActions,
-                              isHelpIsAvailable,
-                              aIconId,
-                              aMenuIcons,
-                              aIconListQualifier,
-                              aSelectionPreference
-                              ));
-    TSatUiResponse exValue = static_cast<TSatUiResponse>(expectReturnValue);
-    QCOMPARE(exValue, result);
-
-    delete hText;
-    hText = 0;
-    delete aMenuItems;
-    aMenuItems = 0;
-    delete aMenuItemNextActions;
-    aMenuItemNextActions = 0;
-    delete aMenuIcons;
-    aMenuIcons = 0;
-    qDebug("Ut_CSatUiObserver::testSetUpMenu <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_CSatUiObserver::testGetInkey_data
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_CSatUiObserver::testGetInkey_data()
-{
-    qDebug("Ut_CSatUiObserver::testGetInkey_data >");
-    QTest::addColumn<QString>("text");
-    QTest::addColumn<int>("characterSet");//enum 0~3
-    QTest::addColumn<QString>("input");
-    QTest::addColumn<bool>("isHelpIsAvailable");
-    QTest::addColumn<int>("iconIdIdentifier");
-    QTest::addColumn<int>("iconIdQualifier");//enum 0~3
-    QTest::addColumn<bool>("isRequestedIconDisplayed");
-    QTest::addColumn<int>("duration");
-    QTest::addColumn<bool>("isImmediateDigitResponse");
-    QTest::addColumn<int>("expectValue");
-    //// test ESatDigitOnly
-    QTest::newRow("first") << "Test GetInKey" << 0 << 
-        "8" << false << 60 << 1 << false << 2500 << true << 0;
-    // null text && EIconGetYesNo
-    QTest::newRow("second") << "" << 0 << 
-        "s" << false<< 60 << 1 << false << 2500 << true << 0;
-    // test EIconGetYesNo
-    QTest::newRow("third") << "Test GetInKey" << 3 << 
-        "s" << false << 60 << 1 << false << 2500 << true << 0;
-    // test ESatCharSmsDefaultAlphabet
-    QTest::newRow("fourth") << "Test GetInKey" << 3 << 
-        "$" << false << 60 << 1 << false << 2500 << true << 0;
-    // ino immediateDigitResponse
-    QTest::newRow("fifth") << "Test GetInKey" << 1 << 
-    "#" << false<< 60 << 1 << false << 2500 << false << 0;
-    // test leave
-    //QTest::newRow("sisth") << "Test GetInKey" << 1 << 
-    //    "" << false << 60 << 1 << false << 2500 << true << 0;
-    qDebug("Ut_CSatUiObserver::testGetInkey_data <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_CSatUiObserver::testGetInkey
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_CSatUiObserver::testGetInkey()
-{
-    qDebug("Ut_CSatUiObserver::testGetInkey >");
-    QVERIFY(mSatObserver);
-    QFETCH(QString, text);
-    QFETCH(int, characterSet);
-    QFETCH(QString, input);
-    QFETCH(bool, isHelpIsAvailable);
-    QFETCH(int, iconIdIdentifier);
-    QFETCH(int, iconIdQualifier);
-    QFETCH(bool, isRequestedIconDisplayed);
-    QFETCH(int, duration);
-    QFETCH(bool, isImmediateDigitResponse);
-    QFETCH(int, expectValue);
-
-    // text
-    HBufC* hText = HBufC::New(text.length());
-    TPtr aText( hText->Des() );
-    aText.Copy( text.utf16() );
-    // aCharacterSet
-    TSatCharacterSet aCharacterSet = static_cast<TSatCharacterSet>(characterSet);
-    // aInput
-    TBuf<1> tInput = input.utf16();
-    TChar aInput(tInput[0]);
-    // aHelpIsAvailable
-    TBool aHelpIsAvailable(isHelpIsAvailable);
-    // aIconId
-    TSatIconId aIconId;
-    aIconId.iIdentifier = iconIdIdentifier;
-    aIconId.iIconQualifier = static_cast<TSatIconQualifier>(iconIdQualifier);
-    // aRequestedIconDisplayed
-    TBool aRequestedIconDisplayed(isRequestedIconDisplayed);
-    // aDuration
-    TUint aDuration= static_cast<TUint>(duration);
-    // aRequestedIconDisplayed
-    //TBool aImmediateDigitResponse(isImmediateDigitResponse);
-
-    TSatUiResponse result(ESatSuccess);
-    QT_TRAP_THROWING( result = mSatObserver->GetInkeyL(
-                              aText, 
-                              aCharacterSet,
-                              aInput,
-                              aHelpIsAvailable,
-                              aIconId,
-                              aRequestedIconDisplayed,
-                              aDuration,
-                              isImmediateDigitResponse
-                              ));
-    delete hText;
-    hText = 0;
-    TSatUiResponse exValue = static_cast<TSatUiResponse>(expectValue);
-    QCOMPARE(exValue, result);
-
-    qDebug("Ut_CSatUiObserver::testGetInkey <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_CSatUiObserver::testGetInput_data
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_CSatUiObserver::testGetInput_data()
-{
-    qDebug("Ut_CSatUiObserver::testGetInput_data >");
-    QTest::addColumn<QString>("text");
-    QTest::addColumn<int>("characterSet");//enum 0~3
-    QTest::addColumn<QString>("input");
-    QTest::addColumn<int>("minLength");
-    QTest::addColumn<int>("maxLength");
-    QTest::addColumn<bool>("isHideInput");
-    QTest::addColumn<bool>("isHelpIsAvailable");
-    QTest::addColumn<int>("iconIdIdentifier");
-    QTest::addColumn<int>("iconIdQualifier");//enum 0~3
-    QTest::addColumn<bool>("isRequestedIconDisplayed");
-    QTest::addColumn<int>("expectValue");
-    // test characterSet ESatCharSmsDefaultAlphabet
-    QTest::newRow("first") << "Test GetInput" << 1 << 
-        "get input" << 1 << 5 << false << false <<60 << 1 << true << 0;
-    // test iconIdQualifier ESatSelfExplanatory
-    QTest::newRow("second") << "Test GetInput" << 0 << 
-      "get input" << 1 << 5 << false << false <<60 << 2 << true << 0;
-    // test leave
-    //QTest::newRow("third") << "Test GetInput" << 0 << 
-    //  "" << 1 << 5 << false << false <<60 << 2 << true << 0;
-    qDebug("Ut_CSatUiObserver::testGetInput_data <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_CSatUiObserver::testGetInput
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_CSatUiObserver::testGetInput()
-{
-    qDebug("Ut_CSatUiObserver::testGetInput >");
-    QVERIFY(mSatObserver);
-    QFETCH(QString, text);
-    QFETCH(int, characterSet);
-    QFETCH(QString, input);
-    QFETCH(int, minLength);
-    QFETCH(int, maxLength);
-    QFETCH(bool, isHideInput);
-    QFETCH(bool, isHelpIsAvailable);
-    QFETCH(int, iconIdIdentifier);
-    QFETCH(int, iconIdQualifier);
-    QFETCH(bool, isRequestedIconDisplayed);
-    QFETCH(int, expectValue);
-
-    // text
-    HBufC* hText = HBufC::New(text.length());
-    TPtr aText( hText->Des() );
-    aText.Copy( text.utf16() );
-    // aCharacterSet
-    TSatCharacterSet aCharacterSet = static_cast<TSatCharacterSet>(characterSet);
-    // aInput
-    HBufC* hInput = HBufC::New(input.length());
-    TPtr aInput( hInput->Des() );
-    aInput.Copy( input.utf16() );
-    // aIconId
-    TSatIconId aIconId;
-    aIconId.iIdentifier = iconIdIdentifier;
-    aIconId.iIconQualifier = static_cast<TSatIconQualifier>(iconIdQualifier);
-    // aRequestedIconDisplayed
-    TBool aRequestedIconDisplayed(isRequestedIconDisplayed);
-
-    TSatUiResponse result(ESatSuccess);
-    QT_TRAP_THROWING( result = mSatObserver->GetInputL(
-                              aText, 
-                              aCharacterSet,
-                              aInput,
-                              minLength,
-                              maxLength,
-                              isHideInput,
-                              isHelpIsAvailable,
-                              aIconId,
-                              aRequestedIconDisplayed
-                              ));
-    delete hText;
-    hText = 0;
-    delete hInput;
-    hInput = 0;
-    TSatUiResponse exValue = static_cast<TSatUiResponse>(expectValue);
-    QCOMPARE(exValue, result);
-    qDebug("Ut_CSatUiObserver::testGetInput <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_CSatUiObserver::testConfirmCommand_data
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_CSatUiObserver::testConfirmCommand_data()
-{
-    qDebug("Ut_CSatUiObserver::testConfirmCommand_data >");
-    QTest::addColumn<int>("commandId");// enum 0~6
-    QTest::addColumn<int>("alphaIdStatus");
-    QTest::addColumn<QString>("text");
-    QTest::addColumn<QString>("additionalText");
-    QTest::addColumn<bool>("isctionAccepted");
-    QTest::addColumn<int>("iconIdIdentifier");
-    QTest::addColumn<int>("iconIdQualifier");//enum 0~3
-    QTest::addColumn<bool>("isRequestedIconDisplayed");
-    QTest::addColumn<bool>("isterminatedByUser");
-    // test commandId ESatSSendSmQuery
-    QTest::newRow("first") << 0 << 1 << "ConfirmCommand SendSm" 
-        << "SendSm" <<false << 60 << 1 << false <<false;
-    // test commandId ESatSSendSsQuery
-    QTest::newRow("second") << 1 << 1 << "ConfirmCommand SendSs" 
-        << "SendSs" <<false << 60 << 1 << false <<false;
-    // test commandId ESatSSendUssdQuery
-    QTest::newRow("third") << 2 << 1 << "ConfirmCommand SendUssd" 
-        << "SendUssd" <<false << 60 << 1 << false <<false;
-    // test commandId ESatSRefreshQuery
-    QTest::newRow("fourth") << 3 << 1 << "ConfirmCommand Refresh" 
-        << "First test case" <<false << 60 << 1 << false <<false;
-    // test commandId ESatSLaunchBrowserQuery
-    QTest::newRow("fifth") << 4 << 1 << "ConfirmCommand LaunchBrowser" 
-        << "LaunchBrowser" <<false << 60 << 1 << false <<false;
-    // test commandId ESatOpenChannelQuery
-    QTest::newRow("sixth") << 5 << 1 << "ConfirmCommand OpenChannel" 
-        << "OpenChanne" <<false << 60 << 1 << false <<false;
-    // test commandId ESatSSetUpCallQuery
-    QTest::newRow("seventh") << 6 << 1 << "ConfirmCommand SetUpCall" 
-        << "SetUpCall" <<false << 60 << 1 << false <<false;
-    // test commandId ESatSelfExplanatory
-    QTest::newRow("eighth") << 0 << 1 << "ConfirmCommand SendSm" 
-        << "SendSm SelfExplanatory" <<false << 60 << 2 << true <<false;
-
-    qDebug("Ut_CSatUiObserver::testConfirmCommand_data <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_CSatUiObserver::testConfirmCommand
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_CSatUiObserver::testConfirmCommand()
-{
-    qDebug("Ut_CSatUiObserver::testConfirmCommand >");
-    QVERIFY(mSatObserver);
-    QFETCH(int, commandId);
-    QFETCH(int, alphaIdStatus);
-    QFETCH(QString, text);
-    QFETCH(QString, additionalText);
-    QFETCH(bool, isctionAccepted);
-    QFETCH(int, iconIdIdentifier);
-    QFETCH(int, iconIdQualifier);
-    QFETCH(bool, isRequestedIconDisplayed);
-    QFETCH(bool, isterminatedByUser);
-
-    // aCharacterSet
-    TSatSQueryCommand aCommandId = static_cast<TSatSQueryCommand>(commandId);
-    // aAlphaIdStatus
-    TSatAlphaIdStatus aAlphaIdStatus = static_cast<TSatAlphaIdStatus>(alphaIdStatus);
-    // text
-    HBufC* hText = HBufC::New(text.length());
-    TPtr aText( hText->Des() );
-    aText.Copy( text.utf16() );
-    // aAdditionalText
-    HBufC* hAdditionalText = HBufC::New(additionalText.length());
-    TPtr aAdditionalText( hAdditionalText->Des() );
-    aAdditionalText.Copy( additionalText.utf16() );
-    // aActionAccepted
-    TBool aActionAccepted(isctionAccepted);
-    // aIconId
-    TSatIconId aIconId;
-    aIconId.iIdentifier = iconIdIdentifier;
-    aIconId.iIconQualifier = static_cast<TSatIconQualifier>(iconIdQualifier);
-    // aRequestedIconDisplayed
-    TBool aRequestedIconDisplayed(isRequestedIconDisplayed);
-    // aRequestedIconDisplayed
-    TBool aTerminatedByUser(isterminatedByUser);
-
-    mSatObserver->ConfirmCommand(
-                              aCommandId,
-                              aAlphaIdStatus,
-                              aText, 
-                              aAdditionalText,
-                              aActionAccepted,
-                              aIconId,
-                              aRequestedIconDisplayed,
-                              aTerminatedByUser
-                              );
-    delete hText;
-    hText = 0;
-    delete hAdditionalText;
-    hAdditionalText = 0;
-    qDebug("Ut_CSatUiObserver::testConfirmCommand <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_CSatUiObserver::testNotification_data
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_CSatUiObserver::testNotification_data()
-{
-    qDebug("Ut_CSatUiObserver::testNotification_data >");
-    QTest::addColumn<int>("commandId");// enum 0~6
-    QTest::addColumn<int>("alphaIdStatus");
-    QTest::addColumn<QString>("text");
-    QTest::addColumn<int>("iconIdIdentifier");
-    QTest::addColumn<int>("iconIdQualifier");//enum 0~3
-    QTest::addColumn<bool>("isRequestedIconDisplayed");
-    QTest::addColumn<int>("controlResult");
- 
-    // test commandId ESatSSendDataNotify    
-    QTest::newRow("Senddata_0id") << 0 << 0 << "Send data notify" 
-    << 2 << 0 << false <<0;
-    // test commandId ESatSSendDataNotify alpha id not null but string length is zero   
-    QTest::newRow("Senddata_1id") << 0 << 1 << "" 
-    << 2 << 0 << false <<0;
-    QTest::newRow("Senddata_2id") << 0 << 2 << "Send data notify AlphaIdNotProvided" 
-    << 2 << 0 << false <<0;
-    // test commandId ESatSReceiveDataNotify
-    QTest::newRow("Recievedata_0id") << 1 << 0 << "Recieve data notify" 
-    << 2 << 3 << false <<0;
-    QTest::newRow("Recievedata_1id") << 1 << 1 << "Recieve data notify" 
-    << 2 << 3 << false <<0;
-    QTest::newRow("Recievedata_2id") << 1 << 2 << "Recieve data notify AlphaIdNotProvided" 
-    << 2 << 3 << false <<0;
-    // test commandId ESatSCloseChannelNotify
-    QTest::newRow("CloseChannel_0id") << 2 << 0 << "Close channel notify" 
-    << 2 << 3 << false <<0;
-    QTest::newRow("CloseChannel_1id") << 2 << 1 << "" 
-    << 2 << 3 << false <<0;
-    QTest::newRow("CloseChannel_2id") << 2 << 2 << "Close channel notify AlphaIdNotProvided" 
-    << 2 << 3 << false <<0;
-    // test commandId ESatSMoSmControlNotify
-    QTest::newRow("MoSm_0id") << 3 << 0 << "SM control notify" 
-    << 2 << 0 << false <<0;
-    QTest::newRow("MoSm_1id") << 3 << 1 << "0" 
-    << 2 << 0 << false <<0;
-    QTest::newRow("MoSm_2id") << 3 << 2 << "SM control notify AlphaIdNotProvided" 
-    << 2 << 0 << false <<0;
-    // test commandId ESatSCallControlNotify
-    QTest::newRow("CallControl_0id") << 4 << 0 << "Call control notify" 
-    << 2 << 1 << false <<0;
-    QTest::newRow("CallControl_1id") << 4 << 1 << ""
-    << 2 << 1 << false <<0;
-    QTest::newRow("CallControl_2id") << 4 << 2 << "Call control notify AlphaIdNotProvided" 
-    << 2 << 1 << false <<0;
-    // test commandId ESatSSendSsNotify
-    QTest::newRow("SendSs_0id") << 5 << 0 << "Send SS notify" 
-    << 2 << 2 << false <<0;
-    QTest::newRow("SendSs_1id") << 5 << 1 << "" 
-    << 2 << 2 << false <<0;
-    QTest::newRow("SendSs_2id") << 5 << 2 << "Send SS notify AlphaIdNotProvided" 
-    << 2 << 2 << false <<0;
-    // test commandId ESatSSendUssdNotify
-    QTest::newRow("SendUssd_0id") << 6 << 0 << "Send Ussd notify" 
-    << 2 << 3 << false <<0;
-    // test commandId ESatSSendUssdNotify
-    QTest::newRow("SendUssd_1id") << 6 << 1 << "" 
-    << 2 << 3 << false <<0;
-    // test commandId ESatSSendUssdNotify
-    QTest::newRow("SendUssd_2id") << 6 << 2 << "Send Ussd notify AlphaIdNotProvided" 
-    << 2 << 3 << false <<0;
-    // test commandId ESatSSendDtmfNotify
-    QTest::newRow("SendDtmf_0id") << 7 << 0 << "Send dtmf notify" 
-    << 2 << 3 << false <<0;
-    QTest::newRow("SendDtmf_1id") << 7 << 1 << "Send dtmf notify" 
-    << 2 << 3 << false <<0;
-    QTest::newRow("SendDtmf_2id") << 7 << 2 << "Send dtmf notify AlphaIdNotProvided" 
-    << 2 << 3 << false <<0;
-    // test commandId ESatSSendSmsNotify
-    QTest::newRow("SendSm_0id") << 8 << 0 << "SendSm notify" 
-    << 2 << 2 << false <<0;
-    QTest::newRow("SendSm_1id") << 8 << 1 << "SendSm notify" 
-    << 2 << 2 << false <<0;
-    QTest::newRow("SendSm_2id") << 8 << 2 << "SendSm notify AlphaIdNotProvided" 
-    << 2 << 2 << false <<0;
-    qDebug("Ut_CSatUiObserver::testNotification_data <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_CSatUiObserver::testNotification
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_CSatUiObserver::testNotification()
-{
-    qDebug("Ut_CSatUiObserver::testNotification >");
-    QVERIFY(mSatObserver);
-    QFETCH(int, commandId);
-    QFETCH(int, alphaIdStatus);
-    QFETCH(QString, text);
-    QFETCH(int, iconIdIdentifier);
-    QFETCH(int, iconIdQualifier);
-    QFETCH(bool, isRequestedIconDisplayed);
-    QFETCH(int, controlResult);
-
-    // aCommandId
-    TSatSNotifyCommand aCommandId = static_cast<TSatSNotifyCommand>(commandId);
-    // aAlphaIdStatus
-    TSatAlphaIdStatus aAlphaIdStatus = static_cast<TSatAlphaIdStatus>(alphaIdStatus);
-    // text
-    HBufC* hText = HBufC::New(text.length());
-    TPtr aText( hText->Des() );
-    aText.Copy( text.utf16() );
-
-    // aIconId
-    TSatIconId aIconId;
-    aIconId.iIdentifier = iconIdIdentifier;
-    aIconId.iIconQualifier = static_cast<TSatIconQualifier>(iconIdQualifier);
-    // aRequestedIconDisplayed
-    TBool aRequestedIconDisplayed(isRequestedIconDisplayed);
-    // aRequestedIconDisplayed
-    TSatControlResult aControlResult = static_cast<TSatControlResult>(controlResult);
-
-    mSatObserver->Notification(
-                              aCommandId,
-                              aAlphaIdStatus,
-                              aText, 
-                              aIconId,
-                              aRequestedIconDisplayed,
-                              aControlResult
-                              );
-    delete hText;
-    hText = 0;
-    qDebug("Ut_CSatUiObserver::testNotification <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_CSatUiObserver::testEventNotification_data
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_CSatUiObserver::testEventNotification_data()
-{
-    qDebug("Ut_CSatUiObserver::testEventNotification_data >");
-    QTest::addColumn<int>("eventId");// enum 0~6
-    
-    // test eventId ESatSRefreshStartEvent    
-    QTest::newRow("RefreshStartEvent") << 0 ;
-    // test eventId ESatSRefreshEndEvent
-    QTest::newRow("RefreshEndEvent") << 1;
-    // test eventId ESatSSmEndEvent
-    QTest::newRow("SSmEndEvent") << 2;
-    // test eventId ESatSClearScreenEvent
-    QTest::newRow("ClearScreenEvent") << 3;
-    // test eventId ESatSCloseSatUiAppEvent
-    QTest::newRow("CloseSatUiAppEvent") << 4;
-    // test eventId ESatSsEndEvent
-    QTest::newRow("SsEndEvent") << 5;
-    // test eventId ESatSsErrorEvent
-    QTest::newRow("SsErrorEvent") << 6;
-    // test eventId ESatSDtmfEndEvent
-    QTest::newRow("DtmfEndEvent") << 7;
-
-    qDebug("Ut_CSatUiObserver::testEventNotification_data <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_CSatUiObserver::testEventNotification
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_CSatUiObserver::testEventNotification()
-{
-    qDebug("Ut_CSatUiObserver::testEventNotification >");
-    QVERIFY(mSatObserver);
-    QFETCH(int, eventId);
-
-    TSatSEvent aEventId = static_cast<TSatSEvent>(eventId);
-    TSatSEventStatus aEventStatus = ESatEventCompleteOk;
-    mSatObserver->EventNotification(aEventId, aEventStatus, 0);
-    qDebug("Ut_CSatUiObserver::testEventNotification <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_CSatUiObserver::testSelectItem_data
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_CSatUiObserver::testSelectItem_data()
-{
-    qDebug("Ut_CSatUiObserver::testSelectItem_data >");
-    QTest::addColumn<QString>("text");
-    QTest::addColumn<QStringList>("selectItemItem");
-    QTest::addColumn<int>("defaultItem");
-    QTest::addColumn<bool>("isHelpIsAvailable");
-    QTest::addColumn<int>("iconIdIdentifier");
-    QTest::addColumn<int>("iconIdQualifier");//enum 0~3
-    QTest::addColumn<int>("iconListQualifier");
-    QTest::addColumn<int>("expectReturnValue");
-
-    QStringList testSelectItem_1_items;
-    testSelectItem_1_items 
-    << "Select Item 1" 
-    << "Select Item 2" 
-    << "Select Item 3" 
-    << "Select Item 4" 
-    << "Select Item 5";
-
-    QTest::newRow("first") << "Make a Choice" << testSelectItem_1_items << 
-        0 << false << 80 << 1 << 2 << 0;
-
-    qDebug("Ut_CSatUiObserver::testSelectItem_data <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_CSatUiObserver::testSetUpMenu
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_CSatUiObserver::testSelectItem()
-{
-    qDebug("Ut_CSatUiObserver::testSelectItem >");
-    QVERIFY(mSatObserver);
-    QFETCH(QString, text);
-    QFETCH(QStringList, selectItemItem);
-    QFETCH(int, defaultItem);
-    QFETCH(bool, isHelpIsAvailable);
-    QFETCH(int, iconIdIdentifier);
-    QFETCH(int, iconIdQualifier);
-    QFETCH(int, iconListQualifier);
-    QFETCH(int, expectReturnValue);
-
-    // aText
-    HBufC* hText = HBufC::New(text.length());
-    TPtr aText( hText->Des() );
-    aText.Copy( text.utf16() );
-    // aMenuItems
-    TBuf<128> menuItem;
-    CDesCArrayFlat* aMenuItems = new CDesCArrayFlat(4);
-    QVERIFY(aMenuItems);
-    for (int i = 0; i< selectItemItem.count(); i++) {
-        menuItem = selectItemItem.at(i).utf16();
-        QT_TRAP_THROWING(aMenuItems->AppendL(menuItem));
-    }
-    
-    TUint8 aSelectedItem( 1 );
-    // aIconId
-    TSatIconId aIconId;
-    aIconId.iIdentifier = iconIdIdentifier;
-    aIconId.iIconQualifier = static_cast<TSatIconQualifier>(iconIdQualifier);
-    // aMenuItemNextActions
-    CArrayFixFlat<TSatAction>* aMenuItemNextActions = 
-          new CArrayFixFlat<TSatAction> (4);
-     QVERIFY(aMenuItemNextActions);
-    // Temp test
-     QT_TRAP_THROWING(aMenuItemNextActions->AppendL(ESatSelectItemAction));
-    // aMenuIcons
-    CArrayFixFlat<TInt>* aMenuIcons = new CArrayFixFlat<TInt>(2);
-    QVERIFY(aMenuIcons);
-    // Temp test
-    QT_TRAP_THROWING(aMenuIcons->AppendL(1));
-    // aIconListQualifier
-    TSatIconQualifier aIconListQualifier = 
-        static_cast<TSatIconQualifier>(iconListQualifier);
-    // TSatSelectionPreference, useless
-    TSatSelectionPreference aSelectionPreference(ESatNoSelectionPreference);
-    TBool aRequestIconDisplayed (EFalse);
-    
-    TSatUiResponse result(ESatSuccess);
-    QT_TRAP_THROWING(result = mSatObserver->SelectItemL(
-                              aText,
-                              *aMenuItems,
-                              aMenuItemNextActions,
-                              defaultItem,
-                              aSelectedItem,
-                              isHelpIsAvailable,
-                              aIconId,
-                              aMenuIcons,
-                              aIconListQualifier,
-                              aRequestIconDisplayed,
-                              aSelectionPreference
-                              ));
-    TSatUiResponse exValue = static_cast<TSatUiResponse>(expectReturnValue);
-    QCOMPARE(exValue, result);
-
-    delete hText;
-    hText = 0;
-    delete aMenuItems;
-    aMenuItems = 0;
-    delete aMenuItemNextActions;
-    aMenuItemNextActions = 0;
-    delete aMenuIcons;
-    aMenuIcons = 0;
-    qDebug("Ut_CSatUiObserver::testSelectItem <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_CSatUiObserver::testSetUpMenu
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_CSatUiObserver::testPlayTone_data()
-{
-    qDebug("Ut_CSatUiObserver::testPlayTone_data >");
-    QTest::addColumn<QString>("text");//enum 0~3
-    QTest::addColumn<int>("satTone");
-    QTest::addColumn<int>("duration");
-    QTest::addColumn<int>("iconIdIdentifier");
-    QTest::addColumn<int>("iconIdQualifier");//enum 0~3
-    QTest::addColumn<bool>("isRequestedIconDisplayed");
-    QTest::addColumn<int>("expectReturnValue");
-    QTest::newRow("Response_Failure") << "PlayStandardTone" << 100 << 
-        0 << 80 << 1 << false << -1;
-    QTest::newRow("ToneNotSet") << "PlayStandardTone" << -1 << 
-        0 << 80<< 0 << false << 0;
-    QTest::newRow("DialTone_0") << "PlayStandardTone" << 1 << 
-        0 << 80<< 1 << false << 0;
-    QTest::newRow("DialTone_2000") << "PlayStandardTone" << 1 << 
-        2000 << 80 << 2 << false << 0;
-    QTest::newRow("DialTone_true") << "PlayStandardTone" << 1 << 
-        2000 << 80 << 3 << true << 0;
-    QTest::newRow("Busy") << "PlayStandardTone" << 2 << 
-        2000 << 80 << 3 << false << 0;
-    QTest::newRow("Congestion") << "PlayStandardTone" << 3 << 
-        25000 << 80 << 3 << false << 0;
-    QTest::newRow("Congestion_0") << "PlayStandardTone" << 3 << 
-        0 << 80 << 3 << false << 0;
-    QTest::newRow("Acknowledge ") << "PlayStandardTone" << 4 << 
-        25000 << 80 << 3 << false << 0;
-    QTest::newRow("Acknowledge_0") << "PlayStandardTone" << 4 << 
-        0 << 80 << 3 << false << 0;
-    QTest::newRow("CallDropped") << "PlayStandardTone" << 5 << 
-        25000 << 80 << 1 << false << 0;
-    QTest::newRow("CallDropped_0") << "PlayStandardTone" << 5 << 
-        0 << 80 << 1 << false << 0;
-    QTest::newRow("SpecialInfo") << "PlayStandardTone" << 6 << 
-        25000 << 80 << 1 << false << 0;
-    QTest::newRow("SpecialInfo_0") << "PlayStandardTone" << 6 << 
-        0 << 80 << 1 << false << 0;
-    QTest::newRow("WaitingTone") << "PlayStandardTone" << 7 << 
-        25000 << 80 << 1 << false << 0;
-    QTest::newRow("WaitingTone_0") << "PlayStandardTone" << 7 << 
-        0 << 80 << 1 << false << 0;
-    QTest::newRow("RingingTone") << "PlayStandardTone" << 8 << 
-        25000 << 80 << 1 << false << 0;
-    QTest::newRow("RingingTone_0") << "PlayStandardTone" << 8 << 
-        0 << 80 << 1 << false << 0;
-    QTest::newRow("GeneralBeep") << "PlayStandardTone" << 16 << 
-        25000 << 80 << 1 << false << 0;
-    QTest::newRow("GeneralBeep_0") << "PlayStandardTone" << 16 << 
-        0 << 80 << 1 << false << 0;
-    QTest::newRow("PositiveTone") << "PlayStandardTone" << 17 << 
-        25000 << 80 << 1 << false << 0;
-    QTest::newRow("PositiveTone_0") << "PlayStandardTone" << 17 << 
-        0 << 80 << 1 << false << 0;
-    QTest::newRow("NegativeTone") << "PlayStandardTone" << 18 << 
-        25000 << 80 << 1 << false << 0;
-    QTest::newRow("NegativeTone_0") << "PlayStandardTone" << 18 << 
-        0 << 80 << 1 << false << 0;
-    QTest::newRow("Speech") << "PlayStandardTone" << 19 << 
-        25000 << 80 << 1 << false << 0;
-    QTest::newRow("Speech_0") << "PlayStandardTone" << 19 << 
-        25000 << 80 << 1 << false << 0;
-    QTest::newRow("Sms") << "PlayStandardTone" << 20 << 
-        25000 << 80 << 1 << false << 0;
-    QTest::newRow("Sms_0") << "PlayStandardTone" << 20 << 
-        0 << 80 << 1 << false << 0;
-    QTest::newRow("Busy_0") << "PlayStandardTone" << 2 << 
-        0 << 80 << 3 << false << 0;
-    qDebug("Ut_CSatUiObserver::testPlayTone_data <");
-}
-
-
-// -----------------------------------------------------------------------------
-// Ut_CSatUiObserver::testSetUpMenu
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_CSatUiObserver::testPlayTone()
-{
-    qDebug("Ut_CSatUiObserver::testPlayTone >");
-    QVERIFY(mSatObserver);
-    QFETCH(QString, text);
-    QFETCH(int, duration);
-    QFETCH(int, satTone);
-    QFETCH(int, iconIdIdentifier);
-    QFETCH(int, iconIdQualifier);
-    QFETCH(bool, isRequestedIconDisplayed);
-    QFETCH(int, expectReturnValue);
-    qDebug("Ut_CSatUiObserver::testPlayTone after fetch");
-    // text
-    HBufC* hText = HBufC::New(text.length());
-    TPtr aText( hText->Des() );
-    aText.Copy( text.utf16() );
-    // aTone
-    TSatTone aTone = static_cast<TSatTone>(satTone);
-    // aDuration
-    TUint aDuration= static_cast<TUint>(duration);
-    // aIconId
-    TSatIconId aIconId;
-    aIconId.iIdentifier = iconIdIdentifier;
-    aIconId.iIconQualifier = static_cast<TSatIconQualifier>(iconIdQualifier);
-    // aRequestedIconDisplayed
-    TBool aRequestedIconDisplayed(isRequestedIconDisplayed);
-    qDebug("Ut_CSatUiObserver::testPlayTone call observer");
-    TSatUiResponse result(ESatSuccess);
-    result = mSatObserver->PlayTone(
-                              aText,
-                              aTone,
-                              aDuration,
-                              aIconId,
-                              aRequestedIconDisplayed
-                              );
-    TSatUiResponse exValue = static_cast<TSatUiResponse>(expectReturnValue);
-    QCOMPARE(exValue, result);
-    delete hText;
-    hText = 0;
-    qDebug("Ut_CSatUiObserver::testPlayTone <");
-}
-
-// End of file
--- a/satui/satapp/tsrc/ut_satapp/src/ut_playtoneprovider.cpp	Tue Jul 06 14:53:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,287 +0,0 @@
-/*
-* 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: Unit test for satappmainhandler
-*
-*/
-
-
-#include <msatuiobserver.h>
-#include "ut_playtoneprovider.h"
-//test class
-#include "satappplaytoneprovider.h"
-
-// -----------------------------------------------------------------------------
-// Ut_SatAppPlayToneProvider::Ut_SatAppPlayToneProvider
-// -----------------------------------------------------------------------------
-//
-Ut_SatAppPlayToneProvider::Ut_SatAppPlayToneProvider(QObject *parent):QObject(parent) 
-{
-    qDebug("Ut_SatAppPlayToneProvider::Ut_SatAppPlayToneProvider >");
-    qDebug("Ut_SatAppPlayToneProvider::Ut_SatAppPlayToneProvider <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_SatAppPlayToneProvider::~Ut_SatAppPlayToneProvider
-// -----------------------------------------------------------------------------
-//
-Ut_SatAppPlayToneProvider::~Ut_SatAppPlayToneProvider()
-{
-    qDebug("Ut_SatAppPlayToneProvider::~Ut_SatAppPlayToneProvider >");
-    qDebug("Ut_SatAppPlayToneProvider::~Ut_SatAppPlayToneProvider <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_SatAppPlayToneProvider::initTestCase
-// QTestLib cleanup method, called after the last testfunction .
-// -----------------------------------------------------------------------------
-void Ut_SatAppPlayToneProvider::initTestCase()
-{
-    qDebug("Ut_SatAppPlayToneProvider::initTestCase >");
-    qDebug("Ut_SatAppPlayToneProvider::initTestCase <");
-}
-
-
-// -----------------------------------------------------------------------------
-// Ut_SatAppPlayToneProvider::cleanupTestCase
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_SatAppPlayToneProvider::cleanupTestCase()
-{
-    qDebug("Ut_SatAppPlayToneProvider::cleanupTestCase >");
-    if (mPlayTone) {
-        qDebug("Ut_SatAppPlayToneProvider::cleanupTestCase delete mPlayTone...");
-        delete mPlayTone;
-        mPlayTone = 0;
-    }
-    qDebug("Ut_SatAppPlayToneProvider::cleanupTestCase <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_SatAppPlayToneProvider::testCreatePlayTone
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_SatAppPlayToneProvider::testCreatePlayTone()
-{
-    qDebug("Ut_SatAppPlayToneProvider::testCreatePlayTone >");
-    mPlayTone = new SatAppPlayToneProvider();
-    QVERIFY(mPlayTone); 
-    qDebug("Ut_SatAppPlayToneProvider::testCreatePlayTone <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_SatAppPlayToneProvider::testPlayStandardTone_data
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_SatAppPlayToneProvider::testPlayStandardTone_data()
-{
-    qDebug("Ut_SatAppPlayToneProvider::testPlayStandardTone_data >");
-    QTest::addColumn<QString>("text");//enum 0~3
-    QTest::addColumn<int>("duration");
-    QTest::addColumn<bool>("isRequestedIconDisplayed");
-    QTest::addColumn<int>("expectReturnValue");
-    // test duration 0
-    QTest::newRow("duration_0") << "Play Standard tone" << 0 << false << 0;
-    QTest::newRow("duration") << "Play Standard tone" << 1000000 << false << 0;
-    QTest::newRow("textnull") << "" << 10000000 << false << 0;
-    qDebug("Ut_SatAppPlayToneProvider::testPlayStandardTone_data <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_SatAppPlayToneProvider::testPlayStandardTone
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_SatAppPlayToneProvider::testPlayStandardTone()
-{
-    qDebug("Ut_SatAppPlayToneProvider::testPlayStandardTone >");
-    QVERIFY(mPlayTone);
-    QFETCH(QString, text);
-    QFETCH(int, duration);
-    QFETCH(bool, isRequestedIconDisplayed);
-    QFETCH(int, expectReturnValue);
-    qDebug("Ut_SatAppPlayToneProvider::testPlayTone after fetch");
-    // text
-    HBufC* hText = HBufC::New(text.length());
-    TPtr aText( hText->Des() );
-    aText.Copy( text.utf16() );
-    // text
-    _LIT( KPlayToneSequence, "Play tone sequence");
-    TBuf8<32> aSequence;
-    aSequence.Copy(KPlayToneSequence);
-
-    // aDuration
-    TUint aDuration= static_cast<TUint>(duration);
-    CFbsBitmap*  bitmap(NULL);
-    qDebug("Ut_SatAppPlayToneProvider::testPlayStandardTone call");
-    TSatUiResponse result(ESatSuccess);
-    TRAPD(err, result = mPlayTone->PlayStandardToneL(
-            aText,
-            aSequence,
-            aDuration,
-            bitmap,
-            isRequestedIconDisplayed));
-    QCOMPARE(KErrNone, err);
-    TSatUiResponse exValue = static_cast<TSatUiResponse>(expectReturnValue);
-    QCOMPARE(exValue, result);
-    delete hText;
-    qDebug("Ut_SatAppPlayToneProvider::testPlayStandardTone <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_SatAppPlayToneProvider::testPlayUserSelectedTone_data
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_SatAppPlayToneProvider::testPlayUserSelectedTone_data()
-{
-    qDebug("Ut_SatAppPlayToneProvider::testPlayUserSelectedTone_data >");
-    QTest::addColumn<QString>("text");//enum 0~3
-    QTest::addColumn<int>("duration");
-    QTest::addColumn<int>("satTone");
-    QTest::addColumn<bool>("isaSelfExplanatory");
-    QTest::addColumn<int>("expectReturnValue");
-    //QTest::newRow("duration_0") << "Play UserSelectedTone" << 0 << 1 <<false << 0;
-    QTest::newRow("duration") << "Play UserSelectedTone" << 1000000 << 2 << false << 0;
-    QTest::newRow("true") << "Play UserSelectedTone" << 20000000 << 4 << true << 0;
-    QTest::newRow("textnull") << "" << 10000000 << 3 << true << 0;
-    qDebug("Ut_SatAppPlayToneProvider::testPlayUserSelectedTone_data <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_SatAppPlayToneProvider::testPlayUserSelectedTone
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_SatAppPlayToneProvider::testPlayUserSelectedTone()
-{
-    qDebug("Ut_SatAppPlayToneProvider::testPlayUserSelectedTone >");
-    QVERIFY(mPlayTone);
-    QFETCH(QString, text);
-    QFETCH(int, duration);
-    QFETCH(int, satTone);
-    QFETCH(bool, isaSelfExplanatory);
-    QFETCH(int, expectReturnValue);
-    qDebug("Ut_SatAppPlayToneProvider::testPlayTone after fetch");
-    // text
-    HBufC* hText = HBufC::New(text.length());
-    TPtr aText( hText->Des() );
-    aText.Copy( text.utf16() );
-    // aTone
-    TSatTone aTone = static_cast<TSatTone>(satTone);
-    // aDuration
-    TUint aDuration= static_cast<TUint>(duration);
-    CFbsBitmap*  bitmap(NULL);
-    TBool aSelfExplanatory(isaSelfExplanatory);
-    TSatUiResponse result(ESatSuccess);
-    TRAPD(err, result = mPlayTone->PlayUserSelectedToneL(
-                        aText,
-                        aDuration,
-                        aTone,
-                        bitmap,
-                        aSelfExplanatory ));
-    QCOMPARE(KErrNone, err);
-    delete hText;
-    hText = 0;
-    TSatUiResponse exValue = static_cast<TSatUiResponse>(expectReturnValue);
-    QCOMPARE(exValue, result);
-    qDebug("Ut_SatAppPlayToneProvider::testPlayUserSelectedTone <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_SatAppPlayToneProvider::testPlayUserSelectedTone
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_SatAppPlayToneProvider::testCloseSatUI()
-{
-    qDebug("Ut_SatAppPlayToneProvider::closeSatUI >");
-    QVERIFY(mPlayTone);
-    mPlayTone->closeSatUI();
-    qDebug("Ut_SatAppPlayToneProvider::closeSatUI <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_SatAppPlayToneProvider::testPlayUserSelectedTone
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_SatAppPlayToneProvider::testClearScreen()
-{
-    qDebug("Ut_SatAppPlayToneProvider::clearScreen >");
-    QVERIFY(mPlayTone);
-    mPlayTone->clearScreen();
-    qDebug("Ut_SatAppPlayToneProvider::clearScreen <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_SatAppPlayToneProvider::testMapcPlayComplete_data
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_SatAppPlayToneProvider::testMapcPlayComplete_data()
-{
-    qDebug("Ut_SatAppPlayToneProvider::testMapcPlayComplete_data >");
-    QTest::addColumn<int>("error");
-    QTest::newRow("error_0") << 0;
-    QTest::newRow("error_-6") << -6;
-    qDebug("Ut_SatAppPlayToneProvider::testMapcPlayComplete_data <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_SatAppPlayToneProvider::testMapcPlayComplete
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_SatAppPlayToneProvider::testMapcPlayComplete()
-{
-    qDebug("Ut_SatAppPlayToneProvider::testMapcPlayComplete >");
-    QVERIFY(mPlayTone);
-    QFETCH(int, error);
-    mPlayTone->MapcPlayComplete(error);
-    qDebug("Ut_SatAppPlayToneProvider::testMapcPlayComplete <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_SatAppPlayToneProvider::testMapcInitComplete_data
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_SatAppPlayToneProvider::testMapcInitComplete_data()
-{
-    qDebug("Ut_SatAppPlayToneProvider::testMapcInitComplete_data >");
-    QTest::addColumn<int>("error");
-    QTest::newRow("error_0") << 0;
-    QTest::newRow("error_-6") << -6;
-    qDebug("Ut_SatAppPlayToneProvider::testMapcInitComplete_data <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_SatAppPlayToneProvider::testMapcInitComplete
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_SatAppPlayToneProvider::testMapcInitComplete()
-{
-    qDebug("Ut_SatAppPlayToneProvider::testMapcInitComplete >");
-    QVERIFY(mPlayTone);
-    QFETCH(int, error);
-    mPlayTone->MapcInitComplete(error, 0);
-    qDebug("Ut_SatAppPlayToneProvider::testMapcInitComplete <");
-}
-
-// End of file
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satui/satapp/tsrc/ut_satapp/src/ut_satappaction.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,201 @@
+/*
+* 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: Unit test for satappmainhandler
+*
+*/
+
+#include <QVariant>
+#include <QTimer>
+#include <badesca.h>
+
+#include <hbmainwindow.h>
+#include <hblistwidget.h>
+
+#include "ut_satappaction.h"
+#include "satappaction.h"
+
+
+
+// --------------------------------------------------------
+// The unit tests begin here
+// --------------------------------------------------------
+
+Ut_SatAppAction::Ut_SatAppAction(QObject *parent)
+    :QObject(parent)
+{
+}
+
+
+void Ut_SatAppAction::testAction()
+{
+    SatAppAction a(ESatDisplayTextAction);
+    SatAppAction b(ESatGetInputAction);
+    SatAppAction c(ESatPlayToneAction);
+    
+    QCOMPARE(a.action(),(int)ESatDisplayTextAction);
+    QCOMPARE(b.action(),(int)ESatGetInputAction);
+    QCOMPARE(c.action(),(int)ESatPlayToneAction);
+
+}
+
+void Ut_SatAppAction::testParams()
+{
+    SatAppAction a(ESatDisplayTextAction);
+    // qvariant
+    a.set(KeyText, QVariant("hello"));
+    QCOMPARE(a.value(KeyText).toString(),QString("hello"));
+
+    // int
+    a.set(KeyMinLength, 25);
+    QCOMPARE(a.value(KeyMinLength).toInt(),25);
+
+    // string
+    a.set(KeyInputString,_L("kiss"));
+    QCOMPARE(a.value(KeyInputString).toString(),QString("kiss"));
+
+    // descriptor array
+    CDesCArrayFlat* array1 = new CDesCArrayFlat(8);
+    array1->AppendL(_L("item_0"));
+    array1->AppendL(_L("item_1"));
+    array1->AppendL(_L("item_2"));
+    a.set(KeyMenu,*array1);
+    QList<QVariant> list1 = a.value(KeyMenu).toList();
+    QCOMPARE(list1.size(), 3);
+    QCOMPARE(list1[0].toString(), QString("item_0"));
+    QCOMPARE(list1[1].toString(), QString("item_1"));
+    QCOMPARE(list1[2].toString(), QString("item_2"));
+
+    // int array
+    CArrayFixFlat<TInt>* array2 = new CArrayFixFlat<TInt>(8);
+    array2->AppendL(1);
+    array2->AppendL(2);
+    array2->AppendL(3);
+    a.set(KeyIconIdArray,*array2);
+    QList<QVariant> list2 = a.value(KeyIconIdArray).toList();
+    QCOMPARE(list2.size(), 3);
+    QCOMPARE(list2[0].toInt(), 1);
+    QCOMPARE(list2[1].toInt(), 2);
+    QCOMPARE(list2[2].toInt(), 3);
+
+    // TTimeIntervalSeconds
+    TTimeIntervalSeconds seconds(3);
+    a.set(KeyDuration,seconds);
+    QCOMPARE(a.value(KeyDuration).toInt(),3000);
+    
+    // TTimeIntervalMicroSeconds
+    TTimeIntervalMicroSeconds ysec(TInt64(500000));
+    a.set(KeyDuration,ysec);
+    QCOMPARE(a.value(KeyDuration).toInt(),500);
+    
+    // test hasValue
+    QVERIFY(a.hasValue(KeyText));
+    QVERIFY(a.hasValue(KeyMinLength));
+    QVERIFY(a.hasValue(KeyInputString));
+    QVERIFY(a.hasValue(KeyMenu));
+    QVERIFY(a.hasValue(KeyIconIdArray));
+    QVERIFY(a.hasValue(KeyDuration));
+    QVERIFY(!a.hasValue(KeyHelpRequested)); // <-- not set
+    QVERIFY(!a.hasValue(KeyHelpRequested)); // <-- not set
+    QVERIFY(!a.hasValue(KeyCharacterSet)); // <-- not set
+    QVERIFY(!a.hasValue(QString("billy the kid"))); // <-- definitely not set
+}
+
+void Ut_SatAppAction::testComplete()
+{
+    SatAppAction a(ESatDisplayTextAction);
+    SatAppAction b(ESatGetInputAction);
+    SatAppAction c(ESatPlayToneAction);
+    SatAppAction d(ESatPlayToneAction);
+    SatAppAction e(ESatPlayToneAction);
+    a.complete();
+    b.completeWithSuccess();
+    c.completeWithFailure();
+    d.completeWithBackRequested();
+    e.completeWithSessionTerminated();
+    QCOMPARE(a.response(),ESatNoResponseFromUser);
+    QCOMPARE(b.response(),ESatSuccess);
+    QCOMPARE(c.response(),ESatFailure);
+    QCOMPARE(d.response(),ESatBackwardModeRequestedByUser);
+    QCOMPARE(e.response(),ESatSessionTerminatedByUser);
+}
+
+void Ut_SatAppAction::testCompleteSignal()
+{
+    SatAppAction a(ESatDisplayTextAction);
+    SatAppAction b(ESatGetInputAction);
+    SatAppAction c(ESatPlayToneAction);
+    SatAppAction d(ESatPlayToneAction);
+    SatAppAction e(ESatPlayToneAction);
+    ActionHelper x;
+    connect(&a, SIGNAL(actionCompleted(SatAppAction*)), &x, SLOT(inc()));
+    connect(&b, SIGNAL(actionCompleted(SatAppAction*)), &x, SLOT(inc()));
+    connect(&c, SIGNAL(actionCompleted(SatAppAction*)), &x, SLOT(inc()));
+    connect(&d, SIGNAL(actionCompleted(SatAppAction*)), &x, SLOT(inc()));
+    connect(&e, SIGNAL(actionCompleted(SatAppAction*)), &x, SLOT(inc()));
+    a.complete();
+    b.completeWithSuccess();
+    c.completeWithFailure();
+    d.completeWithBackRequested();
+    e.completeWithSessionTerminated();
+    QCOMPARE(x.count(),5);
+}
+
+void Ut_SatAppAction::testDoubleComplete()
+{
+    SatAppAction a(ESatDisplayTextAction);
+    a.completeWithSuccess();
+    QCOMPARE(a.response(),ESatSuccess);
+    a.completeWithFailure(); // <-- no effect because already completed
+    QCOMPARE(a.response(),ESatSuccess); // <-- still in same state!
+}
+
+void Ut_SatAppAction::testAsyncActionRobustness()
+{
+    // this function tests if an action can be safely deleted in the "completed"
+    // slot, at the same time testing robustness and memory leaks by repeating
+    // the sequence multiple times
+    ActionHelper x;
+    for(int i=0; i<10000; ++i)
+    {
+        SatAppAction* a = new SatAppAction(ESatDisplayTextAction, this);
+        connect(a,SIGNAL(actionCompleted(SatAppAction*)),&x,SLOT(del(SatAppAction*)));
+        a->complete();
+    }
+}
+
+
+void Ut_SatAppAction::testWait()
+{
+    SatAppAction a(ESatDisplayTextAction);
+    QTimer::singleShot(1000, &a, SLOT(completeWithSuccess()));
+    // this should last 1 second
+    a.waitUntilCompleted();
+    QCOMPARE(a.response(),ESatSuccess);
+
+    // this should flow through directly, because already completed
+    a.waitUntilCompleted();
+    QCOMPARE(a.response(),ESatSuccess); // <-- response remains unchanged
+    
+}
+
+
+
+// helper
+void ActionHelper::del(SatAppAction* action)
+{
+    delete action;
+}
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satui/satapp/tsrc/ut_satapp/src/ut_satappconfirmprovider.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,193 @@
+/*
+* 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: Unit test for satappmainhandler
+*
+*/
+
+#include <QTimer>
+#include <QAction>
+
+#include <hbmessagebox.h>
+
+#include "ut_satappconfirmprovider.h"
+#include "satappconfirmprovider.h"
+#include "satappaction.h"
+
+// --------------------------------------------------------
+// The unit tests begin here
+// --------------------------------------------------------
+
+Ut_SatAppConfirmProvider::Ut_SatAppConfirmProvider(
+        QObject *parent)
+    :QObject(parent)
+{
+}
+
+void Ut_SatAppConfirmProvider::testConfirmCommand_data()
+{
+    QTest::addColumn<int>("commandId");
+    QTest::addColumn<int>("alphaIdStatus");
+    QTest::addColumn<QString>("text");
+    QTest::addColumn<QString>("additionText");
+    QTest::addColumn<bool>("userAccepted");
+    QTest::addColumn<bool>("expectRes");
+
+
+    QTest::newRow("t01") << (int)ESatOpenChannelQuery << (int)ESatAlphaIdNull 
+            << "comfrm" << "addition"<< false << false;
+    QTest::newRow("t02") << (int)ESatOpenChannelQuery << (int)ESatAlphaIdNotProvided
+            << "comfrm" << "addition"<< true << true;
+    QTest::newRow("t03") << (int)ESatOpenChannelQuery << (int)ESatAlphaIdNotProvided
+            << "" << "addition"<< true << true;
+    QTest::newRow("t04") << (int)ESatOpenChannelQuery << (int)ESatAlphaIdNotProvided
+            << "comfrm" << ""<< true << true;
+    QTest::newRow("t05") << (int)ESatSSendSmQuery << (int)ESatAlphaIdNull
+            << "comfrm" << "addition"<< true << true;
+    QTest::newRow("t06") << (int)ESatSSetUpCallQuery << (int)ESatAlphaIdNull
+            << "comfrm" << "addition"<< true << true;
+    QTest::newRow("t07") << (int)ESatSSetUpCallQuery << (int)ESatAlphaIdNull
+            << "" << "addition"<< true << true;
+    QTest::newRow("t08") << (int)ESatSSetUpCallQuery << (int)ESatAlphaIdNull
+            << "" << ""<< true << true;
+    QTest::newRow("t09") << (int)ESatSLaunchBrowserQuery << (int)ESatAlphaIdNull
+            << "" << ""<< true << true;
+    QTest::newRow("t10") << (int)ESatSLaunchBrowserQuery << (int)ESatAlphaIdNotProvided
+            << "" << ""<< true << true;
+    QTest::newRow("t11") << (int)ESatSLaunchBrowserQuery << (int)ESatAlphaIdNull
+            << "" << ""<< true << true;
+    QTest::newRow("t12") << 10 << (int)ESatAlphaIdNull
+            << "" << ""<< true << true;
+    QTest::newRow("t05") << (int)ESatSSendUssdQuery << (int)ESatAlphaIdNull
+            << "comfrm" << "addition"<< true << true;
+    QTest::newRow("t05") << (int)ESatSSendSsQuery << (int)ESatAlphaIdNull
+            << "comfrm" << "addition"<< true << true;
+    QTest::newRow("t05") << (int)ESatSRefreshQuery << (int)ESatAlphaIdNull
+            << "comfrm" << "addition"<< true << true;
+}
+
+
+void Ut_SatAppConfirmProvider::testConfirmCommand()
+{
+    QFETCH(int, commandId);
+    QFETCH(int, alphaIdStatus);
+    QFETCH(QString, text);
+    QFETCH(QString, additionText);
+    QFETCH(bool, userAccepted);
+    QFETCH(bool, expectRes);
+
+    SatAppAction action(ESatConfirmAction);
+    action.set(KeyQueryCommandId, commandId);
+    action.set(KeyAlphaIdStatus, alphaIdStatus);
+    action.set(KeyText, text);
+    action.set(KeyAdditionalText, additionText);
+    action.set(KeyActionAccepted, userAccepted);
+
+    ConfirmProviderTest test;
+    QTimer::singleShot(1000, &test, SLOT(simulateFirstActionClicked()));
+    test.mConfirm->confirmCommand(action);
+    QCOMPARE(userAccepted,expectRes);
+}
+
+void Ut_SatAppConfirmProvider::testConfirmFirstAction()
+{
+    ConfirmProviderTest test;
+
+    SatAppAction action(ESatConfirmAction);
+    action.set(KeyQueryCommandId, ESatOpenChannelQuery);
+    action.set(KeyAlphaIdStatus, ESatAlphaIdNull);
+    action.set(KeyText, "OpenChannel");
+    action.set(KeyAdditionalText, "yes");
+    test.mConfirm->confirmCommand(action);
+    QTimer::singleShot(1000, &test, SLOT(simulateFirstActionClicked()));
+    action.waitUntilCompleted();
+    QCOMPARE(action.response(), ESatSuccess);
+}
+
+void Ut_SatAppConfirmProvider::testConfirmSecondAction()
+{
+    ConfirmProviderTest test;
+
+    SatAppAction action(ESatConfirmAction);
+    action.set(KeyQueryCommandId, ESatOpenChannelQuery);
+    action.set(KeyAlphaIdStatus, ESatAlphaIdNull);
+    action.set(KeyText, "OpenChannel");
+    action.set(KeyAdditionalText, "No");
+    test.mConfirm->confirmCommand(action);
+    QTimer::singleShot(1000, &test, SLOT(simulateSecondActionClicked()));
+    action.waitUntilCompleted();
+    QCOMPARE(action.response(), ESatBackwardModeRequestedByUser);
+}
+
+
+void Ut_SatAppConfirmProvider::testConfirmAndClearScreen()
+{
+    ConfirmProviderTest test;
+
+    SatAppAction action(ESatConfirmAction);
+    action.set(KeyQueryCommandId, ESatOpenChannelQuery);
+    action.set(KeyAlphaIdStatus, ESatAlphaIdNull);
+    action.set(KeyText, "OpenChannel");
+    action.set(KeyAdditionalText, "ClearScreen");
+    test.mConfirm->confirmCommand(action);
+    QTimer::singleShot(1000, &test, SLOT(simulateClearScreen()));
+    action.waitUntilCompleted();
+    QCOMPARE(action.response(), ESatNoResponseFromUser);
+
+    action.set(KeyQueryCommandId, ESatSSetUpCallQuery);
+    action.set(KeyText, "SetUpCall");
+    test.mConfirm->confirmCommand(action);
+    QTimer::singleShot(1000, &test, SLOT(simulateClearScreen()));
+    action.waitUntilCompleted();
+    QCOMPARE(action.response(), ESatNoResponseFromUser);
+}
+
+// ---------------------------------------------------------------
+// internal helper class
+// ---------------------------------------------------------------
+
+ConfirmProviderTest::ConfirmProviderTest()
+{
+    mConfirm = new SatAppConfirmProvider(this);
+}
+
+ConfirmProviderTest::~ConfirmProviderTest()
+{
+    cleanup();
+}
+
+void ConfirmProviderTest::simulateFirstActionClicked()
+{
+    if (mConfirm->mConfirmQuery)
+    mConfirm->mConfirmQuery->actions().at(0)->trigger();
+}
+
+void ConfirmProviderTest::simulateSecondActionClicked()
+{
+    if (mConfirm->mConfirmQuery)
+    mConfirm->mConfirmQuery->actions().at(1)->trigger();
+    
+}
+
+void ConfirmProviderTest::simulateClearScreen()
+{
+    if (mConfirm->mConfirmQuery) mConfirm->clearScreen();
+}
+
+void ConfirmProviderTest::cleanup()
+{
+    delete mConfirm;
+    mConfirm = 0;
+}
+
+// End of file
--- a/satui/satapp/tsrc/ut_satapp/src/ut_satappeventhandler.cpp	Tue Jul 06 14:53:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,160 +0,0 @@
-/*
-* 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: Unit test for satappeventprovider
-*
-*/
-
-#include "ut_satappeventhandler.h"
-//test class
-#include "satappeventprovider.h"
-
-// -----------------------------------------------------------------------------
-// Ut_SatAppEventProvider::Ut_SatAppEventProvider
-// -----------------------------------------------------------------------------
-//
-Ut_SatAppEventProvider::Ut_SatAppEventProvider(QObject *parent):
-        QObject(parent), mEventHandler(0)
-{
-    qDebug("Ut_SatAppEventProvider::Ut_SatAppEventProvider >");
-    qDebug("Ut_SatAppEventProvider::Ut_SatAppEventProvider <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_SatAppEventProvider::~Ut_SatAppEventProvider
-// -----------------------------------------------------------------------------
-//
-Ut_SatAppEventProvider::~Ut_SatAppEventProvider()
-{
-    qDebug("Ut_SatAppEventProvider::~Ut_SatAppEventProvider >");
-    qDebug("Ut_SatAppEventProvider::~Ut_SatAppEventProvider <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_SatAppEventProvider::initTestCase
-// QTestLib cleanup method, called after the last testfunction .
-// -----------------------------------------------------------------------------
-void Ut_SatAppEventProvider::initTestCase()
-{
-    qDebug("Ut_SatAppEventProvider::initTestCase >");
-    qDebug("Ut_SatAppEventProvider::initTestCase <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_SatAppEventProvider::cleanupTestCase
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_SatAppEventProvider::cleanupTestCase()
-{
-    qDebug("Ut_SatAppEventProvider::cleanupTestCase >");
-    delete mEventHandler;
-    mEventHandler = 0;
-    qDebug("Ut_SatAppEventProvider::cleanupTestCase <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_SatAppEventProvider::testProfileState
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_SatAppEventProvider::testCreateEventHandler()
-{
-    qDebug("Ut_SatAppEventProvider::testCreateEventHandler >");
-    mEventHandler = new SatAppEventProvider;
-    QVERIFY(mEventHandler);
-    qDebug("Ut_SatAppEventProvider::testCreateEventHandler <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_SatAppEventProvider::testShowSsWaitNote_data
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_SatAppEventProvider::testShowSsWaitNote_data()
-{
-    qDebug("Ut_SatAppEventProvider::testShowSsWaitNote_data >");
-    QTest::addColumn<QString>("text");
-    QTest::addColumn<bool>("isSelfExplanatoryIcon");
-    QTest::newRow("first") << "Show Ss Wait note First!" << false;
-    QTest::newRow("second") << "Show Ss Wait note seconde!" << true;
-    QTest::newRow("third") << "" << false;
-    qDebug("Ut_SatAppEventProvider::testShowSsWaitNote_data <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_SatAppEventProvider::testProfileState
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_SatAppEventProvider::testShowSsWaitNote()
-{
-    qDebug("Ut_SatAppEventProvider::testShowSsWaitNote >");
-    QVERIFY(mEventHandler);
-    QFETCH(QString, text);
-    QFETCH(bool, isSelfExplanatoryIcon);
-    // text
-    HBufC* hText = HBufC::New(text.length());
-    TPtr aText( hText->Des() );
-    aText.Copy( text.utf16() );
-    CFbsBitmap* bitmap(NULL);
-    TRAPD(err, mEventHandler->ShowSsWaitNoteL(aText,bitmap,
-          isSelfExplanatoryIcon));
-    delete hText;
-    hText = 0;
-    QCOMPARE(err, KErrNone);
-    qDebug("Ut_SatAppEventProvider::testShowSsWaitNote <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_SatAppEventProvider::testProfileState
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_SatAppEventProvider:: testStopShowWaitNote()
-{
-    qDebug("Ut_SatAppEventProvider::testStopShowWaitNote >");
-    QVERIFY(mEventHandler);
-    mEventHandler->StopShowWaitNote();
-    qDebug("Ut_SatAppEventProvider::testStopShowWaitNote <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_SatAppEventProvider::ShowWaitNoteWithoutDelayL
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_SatAppEventProvider::testShowWaitNoteWithoutDelay()
-{
-    qDebug("Ut_SatAppEventProvider::testShowWaitNoteWithoutDelay >");
-    QVERIFY(mEventHandler);
-    TRAPD(err,mEventHandler->ShowWaitNoteWithoutDelayL());
-    QCOMPARE(err, KErrNone);
-    qDebug("Ut_SatAppEventProvider::testShowWaitNoteWithoutDelay <");
-}
-
-// -----------------------------------------------------------------------------
-// Ut_SatAppEventProvider::testShowSsErrorNote
-// 
-// Connects to test object signal and verifies received data.
-// -----------------------------------------------------------------------------
-void Ut_SatAppEventProvider::testShowSsErrorNote()
-{
-    qDebug("Ut_SatAppEventProvider::testShowSsErrorNote >");
-    QVERIFY(mEventHandler);
-    TRAPD(err, mEventHandler->ShowSsErrorNoteL());
-    QCOMPARE(err, KErrNone);
-    qDebug("Ut_SatAppEventProvider::testShowSsErrorNote <");
-}
-    
-// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satui/satapp/tsrc/ut_satapp/src/ut_satappinputprovider.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,411 @@
+/*
+* 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: Unit test for satappmainhandler
+*
+*/
+
+#include <QTimer>
+#include <QAction>
+
+#include <hbinputdialog.h>
+#include <hbmessagebox.h>
+
+#include "ut_satappinputprovider.h"
+#include "satappinputprovider.h"
+#include "satappaction.h"
+
+
+// --------------------------------------------------------
+// The unit tests begin here
+// --------------------------------------------------------
+
+Ut_SatAppInputProvider::Ut_SatAppInputProvider(
+        QObject *parent)
+    :QObject(parent)
+{
+}
+
+void Ut_SatAppInputProvider::testResetState()
+{
+    InputProviderTest test;
+    test.mInput->resetState();
+}
+
+void Ut_SatAppInputProvider::testGetInkeyAndOk_data()
+{
+    QTest::addColumn<QString>("text");
+    QTest::addColumn<int>("charset");
+    QTest::addColumn<int>("inkey");
+
+    QTest::newRow("t01") << "title" << (int)ESatDigitOnly << 0;
+    QTest::newRow("t02") << "title" << (int)ESatCharSmsDefaultAlphabet << 0;
+    QTest::newRow("t03") << "title" << (int)ESatCharUcs2Alphabet << 0;
+    QTest::newRow("t04") << "title" << (int)ESatYesNo << 0;
+    QTest::newRow("t05") << "long title that does not fix to screen" << (int)ESatDigitOnly << 0;
+    QTest::newRow("t06") << "long title that does not fix to screen" << (int)ESatCharSmsDefaultAlphabet << 0;
+    QTest::newRow("t07") << "long title that does not fix to screen" << (int)ESatCharUcs2Alphabet << 0;
+    QTest::newRow("t08") << "long title that does not fix to screen" << (int)ESatYesNo << 0;
+    QTest::newRow("t09") << "" << (int)ESatDigitOnly << 1;
+    QTest::newRow("t10") << "" << (int)ESatCharSmsDefaultAlphabet << 47;
+    QTest::newRow("t11") << "" << (int)ESatCharUcs2Alphabet << 58;
+    QTest::newRow("t12") << "" << (int)ESatYesNo << 0;
+}
+
+void Ut_SatAppInputProvider::testGetInkeyAndOk()
+{
+    QFETCH(QString, text);
+    QFETCH(int, charset);
+    QFETCH(int, inkey);
+    bool selfExp = false;
+
+    SatAppAction a(ESatGetInkeyAction);
+    a.set(KeyText,text);
+    a.set(KeyCharacterSet,charset);
+    a.set(KeyInKey,inkey);
+    a.set(KeyImmediate,false);
+    a.set(KeyDuration,10000);
+    
+    InputProviderTest test;
+    test.mInput->getInkey(a);
+    // simulate press OK
+    if( (charset!=ESatYesNo) || (text.length()>0)){
+    test.simulateFirstActionClicked();
+    }
+
+    if (charset==ESatYesNo) {
+        if( text.length()>0 ){
+            QCOMPARE(a.response(),ESatSuccess);
+            QCOMPARE(a.value(KeyInKey).toInt(),1);
+        }
+        else {
+            QCOMPARE(a.response(),ESatFailure);
+        }
+            
+    }
+    else {
+        QCOMPARE(a.response(),ESatSuccess);
+    }
+    
+}
+
+void Ut_SatAppInputProvider::testGetInkeyAndCancel_data()
+{
+    // uses same test materil as testGetInkeyAndOk()
+    testGetInkeyAndOk_data();
+}
+
+void Ut_SatAppInputProvider::testGetInkeyAndCancel()
+{
+    QFETCH(QString, text);
+    QFETCH(int, charset);
+    QFETCH(int, inkey);
+    bool selfExp = false;
+
+    SatAppAction a(ESatGetInkeyAction);
+    a.set(KeyText,text);
+    a.set(KeyCharacterSet,charset);
+    a.set(KeyInKey,inkey);
+    a.set(KeyImmediate,false);
+    a.set(KeyDuration,10000);
+    
+    InputProviderTest test;
+    test.mInput->getInkey(a);
+    // simulate press CANCEL
+    if((charset!=ESatYesNo) || (text.length()>0)) {
+        test.simulateSecondActionClicked();
+    }
+
+    if (charset==ESatYesNo) {
+        if( text.length()>0 ){
+            QCOMPARE(a.response(),ESatSuccess);
+            QCOMPARE(a.value(KeyInKey).toInt(),0);
+        }
+        else {
+            QCOMPARE(a.response(),ESatFailure);
+        }    }
+    else {
+        QCOMPARE(a.response(),ESatBackwardModeRequestedByUser);
+    }
+}
+
+void Ut_SatAppInputProvider::testGetInkeyAndTimeout()
+{
+    SatAppAction a(ESatGetInkeyAction);
+    a.set(KeyText,"hello");
+    a.set(KeyCharacterSet,ESatCharSmsDefaultAlphabet);
+    a.set(KeyInKey,64);
+    a.set(KeyImmediate,false);
+    a.set(KeyDuration,1000);
+    
+    InputProviderTest test;
+    test.mInput->getInkey(a);
+    a.waitUntilCompleted();
+    
+    QCOMPARE(a.response(),ESatNoResponseFromUser);
+}
+
+void Ut_SatAppInputProvider::testGetInkeyAndReset()
+{
+    SatAppAction a(ESatGetInkeyAction);
+    a.set(KeyText,"hello");
+    a.set(KeyCharacterSet,ESatCharSmsDefaultAlphabet);
+    a.set(KeyInKey,64);
+    a.set(KeyImmediate,false);
+    a.set(KeyDuration,10000);
+    a.setResponse(ESatFailure);
+
+    InputProviderTest test;
+    test.mInput->getInkey(a);
+    test.mInput->resetState();
+
+    QCOMPARE(a.response(),ESatNoResponseFromUser);
+}
+
+void Ut_SatAppInputProvider::testGetInkeyAndDelete()
+{
+    SatAppAction a(ESatGetInkeyAction);
+    a.set(KeyText,"hello");
+    a.set(KeyCharacterSet,ESatCharSmsDefaultAlphabet);
+    a.set(KeyInKey,64);
+    a.set(KeyImmediate,false);
+    a.set(KeyDuration,10000);
+    a.setResponse(ESatFailure);
+
+    {
+    InputProviderTest test;
+    test.mInput->getInkey(a);
+    }
+    // at this point everything should be cleaned up safely, and action
+    // should be completed with ESatNoResponseFromUser
+    
+    QCOMPARE(a.response(),ESatNoResponseFromUser);
+}
+
+void Ut_SatAppInputProvider::testGetInkeyImmediateAndOk()
+{
+    SatAppAction a(ESatGetInkeyAction);
+    a.set(KeyText,"hello");
+    a.set(KeyCharacterSet,ESatDigitOnly);
+    a.set(KeyInKey,64);
+    a.set(KeyImmediate,true);
+    a.set(KeyDuration,10000);
+    a.setResponse(ESatFailure);
+
+    InputProviderTest test;
+    test.mInput->getInkey(a);
+    test.simulateImmediateKeypress("0");
+    
+    QCOMPARE(a.response(),ESatSuccess);
+    QCOMPARE(a.value(KeyInKey).toInt(),0x30);
+}
+
+void Ut_SatAppInputProvider::testGetInkeyImmediateAndCancel()
+{
+    SatAppAction a(ESatGetInkeyAction);
+    a.set(KeyText,"hello");
+    a.set(KeyCharacterSet,ESatDigitOnly);
+    a.set(KeyInKey,64);
+    a.set(KeyImmediate,true);
+    a.set(KeyDuration,10000);
+    a.setResponse(ESatFailure);
+
+    InputProviderTest test;
+    test.mInput->getInkey(a);
+    test.simulateFirstActionClicked(); // cancel
+    
+    QCOMPARE(a.response(),ESatBackwardModeRequestedByUser);
+}
+
+void Ut_SatAppInputProvider::testGetInputAndOk_data()
+{
+    QTest::addColumn<QString>("text");
+    QTest::addColumn<int>("charset");
+    QTest::addColumn<QString>("input");
+    QTest::addColumn<int>("min");
+    QTest::addColumn<int>("max");
+    QTest::addColumn<bool>("hide");
+
+    QTest::newRow("t01") << "title" << (int)ESatDigitOnly << "" << 1 << 5 << false;
+    QTest::newRow("t02") << "title" << (int)ESatCharSmsDefaultAlphabet << "" << 1 << 5 << false;
+    QTest::newRow("t03") << "title" << (int)ESatCharUcs2Alphabet << "" << 1 << 5 << false;
+    QTest::newRow("t04") << "very long title that does not fit into screen" << (int)ESatDigitOnly << "" << 1 << 5 << false;
+    QTest::newRow("t05") << "very long title that does not fit into screen" << (int)ESatCharSmsDefaultAlphabet << "" << 2 << 8 << false;
+    QTest::newRow("t06") << "very long title that does not fit into screen" << (int)ESatCharUcs2Alphabet << "" << 2 << 8 << false;
+    QTest::newRow("t07") << "title" << (int)ESatDigitOnly << "12345" << 1 << 5 << false;
+    QTest::newRow("t08") << "title" << (int)ESatCharSmsDefaultAlphabet << "12345" << 1 << 5 << false;
+    QTest::newRow("t09") << "title" << (int)ESatCharUcs2Alphabet << "12345" << 1 << 5 << false;
+    QTest::newRow("t10") << "title" << (int)ESatDigitOnly << "12345" << 1 << 5 << true;
+    QTest::newRow("t11") << "title" << (int)ESatCharSmsDefaultAlphabet << "12345" << 1 << 5 << true;
+    QTest::newRow("t12") << "title" << (int)ESatCharUcs2Alphabet << "12345" << 1 << 5 << true;
+    QTest::newRow("t13") << "" << (int)ESatDigitOnly << "" << 1 << 5 << false;
+    QTest::newRow("t14") << "" << (int)ESatCharSmsDefaultAlphabet << "" << 1 << 5 << false;
+    QTest::newRow("t15") << "" << (int)ESatCharUcs2Alphabet << "" << 1 << 5 << false;
+    QTest::newRow("t16") << "" << (int)ESatDigitOnly << "123456789123456789" << 1 << 5 << false;
+    QTest::newRow("t17") << "" << (int)ESatCharSmsDefaultAlphabet << "123456789123456789" << 1 << 5 << false;
+    QTest::newRow("t18") << "" << (int)ESatCharUcs2Alphabet << "123456789123456789" << 1 << 5 << false;
+    
+}
+
+void Ut_SatAppInputProvider::testGetInputAndOk()
+{
+    QFETCH(QString, text);
+    QFETCH(int, charset);
+    QFETCH(QString, input);
+    QFETCH(int, min);
+    QFETCH(int, max);
+    QFETCH(bool, hide);
+
+    SatAppAction a(ESatGetInputAction);
+    a.set(KeyText,text);
+    a.set(KeyCharacterSet,charset);
+    a.set(KeyInputString,input);
+    a.set(KeyMinLength,min);
+    a.set(KeyMaxLength,max);
+    a.set(KeyHideInput,hide);
+    a.set(KeyDuration,10000);
+
+    InputProviderTest test;
+    test.mInput->getInput(a);
+    test.simulateFirstActionClicked();
+
+    QCOMPARE(a.response(),ESatSuccess);
+}
+
+void Ut_SatAppInputProvider::testGetInputAndCancel_data()
+{
+    // uses same test data as testGetInputAndOk
+    testGetInputAndOk_data();
+}
+
+void Ut_SatAppInputProvider::testGetInputAndCancel()
+{
+    QFETCH(QString, text);
+    QFETCH(int, charset);
+    QFETCH(QString, input);
+    QFETCH(int, min);
+    QFETCH(int, max);
+    QFETCH(bool, hide);
+
+    SatAppAction a(ESatGetInputAction);
+    a.set(KeyText,text);
+    a.set(KeyCharacterSet,charset);
+    a.set(KeyInputString,input);
+    a.set(KeyMinLength,min);
+    a.set(KeyMaxLength,max);
+    a.set(KeyHideInput,hide);
+    a.set(KeyDuration,10000);
+
+    InputProviderTest test;
+    test.mInput->getInput(a);
+    test.simulateSecondActionClicked();
+
+    QCOMPARE(a.response(),ESatBackwardModeRequestedByUser);
+}
+
+void Ut_SatAppInputProvider::testGetInputAndTimeout()
+{
+    SatAppAction a(ESatGetInputAction);
+    a.set(KeyText,"hello");
+    a.set(KeyCharacterSet,ESatCharSmsDefaultAlphabet);
+    a.set(KeyInputString,"12345");
+    a.set(KeyMinLength,1);
+    a.set(KeyMaxLength,10);
+    a.set(KeyHideInput,false);
+    a.set(KeyDuration,1000);
+
+    InputProviderTest test;
+    test.mInput->getInput(a);
+    a.waitUntilCompleted();
+
+    QCOMPARE(a.response(),ESatNoResponseFromUser);
+}
+
+void Ut_SatAppInputProvider::testGetInputAndReset()
+{
+    SatAppAction a(ESatGetInputAction);
+    a.set(KeyText,"hello");
+    a.set(KeyCharacterSet,ESatCharSmsDefaultAlphabet);
+    a.set(KeyInputString,"12345");
+    a.set(KeyMinLength,1);
+    a.set(KeyMaxLength,10);
+    a.set(KeyHideInput,false);
+    a.set(KeyDuration,10000);
+
+    InputProviderTest test;
+    test.mInput->getInput(a);
+    test.mInput->resetState();
+
+    QCOMPARE(a.response(),ESatNoResponseFromUser);
+}
+
+void Ut_SatAppInputProvider::testGetInputAndDelete()
+{
+    SatAppAction a(ESatGetInputAction);
+    a.set(KeyText,"hello");
+    a.set(KeyCharacterSet,ESatCharSmsDefaultAlphabet);
+    a.set(KeyInputString,"12345");
+    a.set(KeyMinLength,1);
+    a.set(KeyMaxLength,10);
+    a.set(KeyHideInput,false);
+    a.set(KeyDuration,10000);
+    a.setResponse(ESatFailure);
+
+    {
+    InputProviderTest test;
+    test.mInput->getInput(a);
+    }
+    // at this point input dialog out of scope and destroyed.
+    // pending action should have been completed with ESatNoResponseFromUser
+
+    QCOMPARE(a.response(),ESatNoResponseFromUser);
+}
+
+
+// ---------------------------------------------------------------
+// internal helper class
+// ---------------------------------------------------------------
+
+InputProviderTest::InputProviderTest()
+{
+    mInput = new SatAppInputProvider(this);
+}
+
+InputProviderTest::~InputProviderTest()
+{
+    cleanup();
+}
+
+void InputProviderTest::simulateFirstActionClicked()
+{
+    mInput->mCurrentDialog->actions().at(0)->trigger();
+}
+
+void InputProviderTest::simulateSecondActionClicked()
+{
+    mInput->mCurrentDialog->actions().at(1)->trigger();
+}
+
+void InputProviderTest::simulateImmediateKeypress(QString s)
+{
+    mInput->transmitInkeyImmediately(s);
+}
+
+void InputProviderTest::cleanup()
+{
+    delete mInput;
+    mInput = 0;
+}
+
+
+// End of file
--- a/satui/satapp/tsrc/ut_satapp/src/ut_satappmainhandler.cpp	Tue Jul 06 14:53:02 2010 +0300
+++ b/satui/satapp/tsrc/ut_satapp/src/ut_satappmainhandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -25,7 +25,9 @@
 // Ut_SatAppMainHandler::Ut_SatAppMainHandler
 // -----------------------------------------------------------------------------
 //
-Ut_SatAppMainHandler::Ut_SatAppMainHandler(QObject *parent):QObject(parent) 
+Ut_SatAppMainHandler::Ut_SatAppMainHandler(
+        HbMainWindow* mainWindow, QObject *parent)
+    :QObject(parent), mMainWindow(mainWindow)
 {
     qDebug("Ut_SatAppMainHandler::Ut_SatAppMainHandler >");
     qDebug("Ut_SatAppMainHandler::Ut_SatAppMainHandler <");
@@ -76,9 +78,7 @@
 void Ut_SatAppMainHandler::testCreateMainHandler()
 {
     qDebug("Ut_SatAppMainHandler::testProfileState >");
-    HbMainWindow* window = new HbMainWindow();
-    QVERIFY(window);
-    mMainHandler = new SatAppMainHandler(*window);
+    mMainHandler = new SatAppMainHandler(*mMainWindow);
     QVERIFY(mMainHandler); 
     qDebug("Ut_SatAppMainHandler::testProfileState <");
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satui/satapp/tsrc/ut_satapp/src/ut_satappmenuprovider.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,268 @@
+/*
+* 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: Unit test for satappmainhandler
+*
+*/
+
+#include <hbmainwindow.h>
+#include <hblistwidget.h>
+#include <hbaction.h>
+
+#include "ut_satappmenuprovider.h"
+#include "satappmenuprovider.h"
+#include "satappaction.h"
+
+
+
+// --------------------------------------------------------
+// The unit tests begin here
+// --------------------------------------------------------
+
+Ut_SatAppMenuProvider::Ut_SatAppMenuProvider(
+        HbMainWindow* mainWindow, QObject *parent)
+    :QObject(parent)
+{
+    mMainWindow = mainWindow;
+}
+
+void Ut_SatAppMenuProvider::testResetState()
+{
+    MenuProviderTest test(mMainWindow);
+    test.mMenu->resetState();
+}
+
+void Ut_SatAppMenuProvider::testSetUpMenu_data()
+{
+    QTest::addColumn<QString>("text");
+    QTest::addColumn<int>("menuitems");
+    QTest::addColumn<int>("selection");
+
+    QTest::newRow("t1") << "title" << 1 << 0;
+    QTest::newRow("t2") << "a very long title that does not fit to screen" << 2 << 1;
+    QTest::newRow("t3") << "manyrows" << 999 << 444;
+    QTest::newRow("t4") << "" << 1 << 0;
+    QTest::newRow("t5") << "" << 10 << 1;
+    QTest::newRow("t6") << "a" << 10 << 9;
+}
+
+void Ut_SatAppMenuProvider::testSetUpMenu()
+{
+    QFETCH(QString, text);
+    QFETCH(int, menuitems);
+    QFETCH(int, selection);
+
+    SatAppAction a(ESatSetUpMenuAction);
+    a.set(KeyText,text);
+    QStringList list;
+    for(int i=0; i<menuitems; ++i) list<<QString::number(i);
+    a.set(KeyMenu,list);
+    
+    MenuProviderTest test(mMainWindow);
+    test.mMenu->setUpMenu(a);
+
+    test.mItemIndexToBeSelected = selection;
+    test.simulateItemSelected();
+
+    QCOMPARE(a.response(), ESatSuccess);
+    QVERIFY(a.hasValue(KeySelection));
+
+}
+
+void Ut_SatAppMenuProvider::testSetUpMenuAndReset()
+{
+    SatAppAction a(ESatSetUpMenuAction);
+    a.set(KeyText,"hello");
+    QStringList list;
+    for(int i=0; i<10; ++i) {list<<QString::number(i);}
+    a.set(KeyMenu,list);
+
+    MenuProviderTest test(mMainWindow);
+    test.mMenu->setUpMenu(a);
+    
+    test.mMenu->resetState();
+
+    QCOMPARE(a.response(), ESatSuccess);
+
+}
+
+void Ut_SatAppMenuProvider::testSetUpMenuAndDelete()
+{
+    SatAppAction a(ESatSetUpMenuAction);
+    a.set(KeyText,"hello");
+    QStringList list;
+    for(int i=0; i<10; ++i) {list<<QString::number(i);}
+    a.set(KeyMenu,list);
+
+    {
+        MenuProviderTest test(mMainWindow);
+        
+        test.mMenu->setUpMenu(a);
+    }
+    // now SatAppMenuProvider is out of scope and deleted.
+    QCOMPARE(a.response(), ESatSuccess);
+}
+
+void Ut_SatAppMenuProvider::testSelectItem_data()
+{
+    QTest::addColumn<QString>("text");
+    QTest::addColumn<int>("menuitems");
+    QTest::addColumn<int>("defaultitem");
+    QTest::addColumn<int>("selection");
+
+    QTest::newRow("t1") << "title" << 1 << 0 << 0;
+    QTest::newRow("t2") << "a very long title that does not fit to screen" << 2 << 0 << 1;
+    QTest::newRow("t3") << "manyrows" << 999 << 333 << 444 ;
+    QTest::newRow("t4") << "" << 3 << 2 << 1 ;
+    QTest::newRow("t5") << "" << 4 << 3 << 0 ;
+    QTest::newRow("t6") << "default out of range" << 5 << 7 << 1 ;
+}
+
+void Ut_SatAppMenuProvider::testSelectItem()
+{
+    QFETCH(QString, text);
+    QFETCH(int, menuitems);
+    QFETCH(int, defaultitem);
+    QFETCH(int, selection);
+
+    SatAppAction a(ESatSelectItemAction);
+    a.set(KeyText,text);
+    QStringList list;
+    for(int i=0; i<menuitems; ++i) {list<<QString::number(i);}
+    a.set(KeyMenu,list);
+    a.set(KeyDefault,defaultitem);
+
+    MenuProviderTest test(mMainWindow);
+    test.loadMainview();
+    test.mMenu->selectItem(a);
+
+    test.mItemIndexToBeSelected = selection;
+    test.simulateItemSelected();
+    
+    QCOMPARE(a.response(), ESatSuccess);
+    QVERIFY(a.hasValue(KeySelection));
+
+}
+
+void Ut_SatAppMenuProvider::testSelectItemAndBack()
+{
+    SatAppAction a(ESatSelectItemAction);
+    a.set(KeyText,"hello");
+    QStringList list;
+    for(int i=0; i<10; ++i) {list<<QString::number(i);}
+    a.set(KeyMenu,list);
+    a.set(KeyDefault,5);
+
+    MenuProviderTest test(mMainWindow);
+    test.loadMainview();
+    test.mMenu->selectItem(a);
+    test.simulateBackButtonClicked();
+
+    QCOMPARE(a.response(), ESatBackwardModeRequestedByUser);
+
+}
+
+
+void Ut_SatAppMenuProvider::testSelectItemAndTimeout()
+{
+    SatAppAction a(ESatSelectItemAction);
+    a.set(KeyText,"hello");
+    QStringList list;
+    for(int i=0; i<10; ++i) {list<<QString::number(i);}
+    a.set(KeyMenu,list);
+    a.set(KeyDefault,5);
+
+    MenuProviderTest test(mMainWindow);
+    test.loadMainview();
+    test.mMenu->selectItem(a);
+    a.waitUntilCompleted(); // wait selectItem timeout
+
+    QCOMPARE(a.response(), ESatNoResponseFromUser);
+
+}
+
+void Ut_SatAppMenuProvider::testSelectItemAndReset()
+{
+    SatAppAction a(ESatSelectItemAction);
+    a.set(KeyText,"hello");
+    QStringList list;
+    for(int i=0; i<10; ++i) {list<<QString::number(i);}
+    a.set(KeyMenu,list);
+    a.set(KeyDefault,5);
+
+    MenuProviderTest test(mMainWindow);
+    test.loadMainview();
+    test.mMenu->selectItem(a);
+    test.mMenu->resetState();
+
+    QCOMPARE(a.response(), ESatSuccess);
+   
+}
+
+void Ut_SatAppMenuProvider::testSelectItemAndDelete()
+{
+    SatAppAction a(ESatSelectItemAction);
+    a.set(KeyText,"hello");
+    QStringList list;
+    for(int i=0; i<10; ++i) {list<<QString::number(i);}
+    a.set(KeyMenu,list);
+    a.set(KeyDefault,5);
+
+    {
+        MenuProviderTest test(mMainWindow);
+        test.loadMainview();
+        test.mMenu->selectItem(a);
+    }
+
+    // object deleted, blocking function should return safely
+    QCOMPARE(a.response(), ESatSuccess);
+}
+
+// ---------------------------------------------------------------
+// internal helper class
+// ---------------------------------------------------------------
+
+MenuProviderTest::MenuProviderTest(HbMainWindow* mainWindow)
+{
+    mMenu = new SatAppMenuProvider(mainWindow,this);
+}
+
+MenuProviderTest::~MenuProviderTest()
+{
+    cleanup();
+}
+
+void MenuProviderTest::loadMainview()
+{
+    mMenu->loadMainView();
+}
+
+void MenuProviderTest::simulateItemSelected()
+{
+    mMenu->menuItemSelected(mMenu->mSelectListWidget->item(
+            mItemIndexToBeSelected));
+}
+
+void MenuProviderTest::simulateBackButtonClicked()
+{
+    mMenu->mSoftKeyBackAction->trigger();
+}
+
+
+void MenuProviderTest::cleanup()
+{
+    delete mMenu;
+    mMenu = 0;
+}
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satui/satapp/tsrc/ut_satapp/src/ut_satapppopupprovider.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,284 @@
+/*
+* 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: Unit test for satappmainhandler
+*
+*/
+
+#include <QTimer>
+#include <QAction>
+
+#include <hbmessagebox.h>
+#include <hbprogressdialog.h>
+#include <hbdevicemessagebox.h>
+
+#include "ut_satapppopupprovider.h"
+#include "satapppopupprovider.h"
+#include "satappaction.h"
+
+
+
+// --------------------------------------------------------
+// The unit tests begin here
+// --------------------------------------------------------
+
+Ut_SatAppPopupProvider::Ut_SatAppPopupProvider(
+        QObject *parent)
+    :QObject(parent)
+{
+}
+
+
+void Ut_SatAppPopupProvider::testDisplayTextAndOk_data()
+{
+    QTest::addColumn<QString>("text");
+    QTest::addColumn<QString>("appName");
+    QTest::addColumn<bool>("sustainedText");
+    QTest::addColumn<int>("duration");
+
+    QTest::newRow("t01") << "title" << "sat" << true << 1000;
+    QTest::newRow("t02") << "" << "sat" << false << 100;
+    QTest::newRow("t03") << "" << "sat" << true << 500;
+    QTest::newRow("t04") << "title" << "sat" << true << 0;
+    QTest::newRow("t05") << "a bit longer title that does not fit" << "" << false << 900;
+    QTest::newRow("t06") << "title" << "" << false << 400;
+    QTest::newRow("t07") << "" << "" << true << 150;
+    QTest::newRow("t08") << "a bit longer title that does not fit" << "sat" << true << 2000;
+    QTest::newRow("t09") << "title" << "sat" << false << 600;
+    QTest::newRow("t10") << "" << "somewhat longer application name" << false << 200;
+    QTest::newRow("t11") << "" << "" << false << 0;
+    QTest::newRow("t12") << "title" << "" << true << 500;
+    QTest::newRow("t13") << "title" << "somewhat longer application name" << false << 0;
+    QTest::newRow("t14") << "" << "sat" << true << 700;
+    QTest::newRow("t15") << "title" << "sat" << false << 3000;
+    
+}
+
+void Ut_SatAppPopupProvider::testDisplayTextAndOk()
+{
+    QFETCH(QString, text);
+    QFETCH(QString, appName);
+    QFETCH(bool, sustainedText);
+    QFETCH(int, duration);
+
+    SatAppAction a(ESatDisplayTextAction);
+    a.set(KeyText,text);
+    a.set(KeyApplicationName,appName);
+    a.set(KeySustainedText,sustainedText);
+    a.set(KeyDuration,duration);
+    a.set(KeyWaitUserToClear,false);
+    a.setResponse(ESatFailure);
+
+    PopupProviderTest test;
+    test.mPopup->displayText(a);
+    test.simulateOkClicked();
+    
+    QCOMPARE(a.response(),ESatSuccess);
+}
+
+
+void Ut_SatAppPopupProvider::testDisplayTextAndCancel_data()
+{
+    testDisplayTextAndOk_data(); // same test material
+}
+
+void Ut_SatAppPopupProvider::testDisplayTextAndCancel()
+{
+    QFETCH(QString, text);
+    QFETCH(QString, appName);
+    QFETCH(bool, sustainedText);
+    QFETCH(int, duration);
+
+    SatAppAction a(ESatDisplayTextAction);
+    a.set(KeyText,text);
+    a.set(KeyApplicationName,appName);
+    a.set(KeySustainedText,sustainedText);
+    a.set(KeyDuration,duration);
+    a.set(KeyWaitUserToClear,false);
+    a.setResponse(ESatFailure);
+
+    PopupProviderTest test;
+    test.mPopup->displayText(a);
+    test.simulateCancelClicked();
+    
+    QCOMPARE(a.response(),ESatBackwardModeRequestedByUser);
+}
+
+
+void Ut_SatAppPopupProvider::testDisplayTextAndTimeout()
+{
+    SatAppAction a(ESatDisplayTextAction);
+    a.set(KeyText,"hello world");
+    a.set(KeyApplicationName,"sat");
+    a.set(KeySustainedText,true);
+    a.set(KeyDuration,1000);
+    a.set(KeyWaitUserToClear,true);
+    a.setResponse(ESatFailure);
+
+    PopupProviderTest test;
+    test.mPopup->displayText(a);
+    a.waitUntilCompleted();
+    QCOMPARE(a.response(),ESatNoResponseFromUser);
+}
+
+void Ut_SatAppPopupProvider::testNotificationWithCancel_data()
+{
+    QTest::addColumn<int>("commandId");
+    QTest::addColumn<int>("alphaIdStatus");
+    QTest::addColumn<QString>("text");
+    QTest::addColumn<int>("controlResult");
+    QTest::addColumn<int>("clickState"); // clikcked->state
+
+    QTest::newRow("t01") << (int)ESatSSendDataNotify << (int)ESatAlphaIdNotNull << "notify"
+        << (int)ESatAllowedNoModification << (int)ESatSuccess;
+    QTest::newRow("t02") << (int)ESatSSendDataNotify << (int)ESatAlphaIdNull << ""
+        << (int)ESatNotAllowed << (int)ESatSuccess;
+    
+    QTest::newRow("t03") << (int)ESatSReceiveDataNotify << (int)ESatAlphaIdNotNull
+        << "notify" << (int)ESatAllowedNoModification << (int)ESatSuccess;
+    QTest::newRow("t04") << (int)ESatSReceiveDataNotify << (int)ESatAlphaIdNull
+        << "" << (int)ESatNotAllowed << (int)ESatSuccess;
+
+    QTest::newRow("t05") << (int)ESatSSendDtmfNotify << (int)ESatAlphaIdNotNull
+        << "notify" << (int)ESatAllowedNoModification << (int)ESatSuccess;
+    QTest::newRow("t06") << (int)ESatSSendDtmfNotify << (int)ESatAlphaIdNull
+        << "" << (int)ESatNotAllowed << (int)ESatSuccess;
+}
+
+void Ut_SatAppPopupProvider::testNotificationWithCancel()
+{
+    QFETCH(int, commandId);
+    QFETCH(int, alphaIdStatus);
+    QFETCH(QString, text);
+    QFETCH(int, controlResult);
+    QFETCH(int, clickState);
+
+    SatAppAction *a = new SatAppAction(ESatNotifyAction);
+    a->set(KeyCommandId,commandId);
+    a->set(KeyAlphaIdStatus,alphaIdStatus);
+    a->set(KeyText,text);
+    a->set(KeyControlResult,controlResult);
+    a->setResponse(ESatSuccess);
+
+    PopupProviderTest test;
+    test.mPopup->notification(*a);
+    qDebug() << "action response" << a->response() << "/" << clickState;
+    QVERIFY(a->response()==(TSatUiResponse)clickState);
+}
+
+void Ut_SatAppPopupProvider::testNotification_data()
+{
+    QTest::addColumn<int>("commandId");
+    QTest::addColumn<int>("alphaIdStatus");
+    QTest::addColumn<QString>("text");
+    QTest::addColumn<int>("controlResult");
+    QTest::addColumn<int>("clickState"); // clikcked->state    
+
+    QTest::newRow("t01") << (int)ESatSCloseChannelNotify << (int)ESatAlphaIdNotNull
+        << "notify" << (int)ESatNotAllowed << (int)ESatSuccess;
+    QTest::newRow("t02") << (int)ESatSCloseChannelNotify << (int)ESatAlphaIdNull
+        << "" << (int)ESatAllowedNoModification << (int)ESatSuccess;
+
+    QTest::newRow("t03") << (int)ESatSMoSmControlNotify << (int)ESatAlphaIdNotNull
+        << "notify" << (int)ESatAllowedNoModification << (int)ESatSuccess;
+    QTest::newRow("t04") << (int)ESatSMoSmControlNotify << (int)ESatAlphaIdNull
+        << "" << (int)ESatNotAllowed << (int)ESatSuccess;
+    QTest::newRow("t05") << (int)ESatSMoSmControlNotify << (int)ESatAlphaIdNotProvided
+        << "" << (int)ESatAllowedWithModifications << (int)ESatSuccess;
+
+    QTest::newRow("t06") << (int)ESatSCallControlNotify << (int)ESatAlphaIdNotNull
+        << "notify" << (int)ESatAllowedNoModification << (int)ESatSuccess;
+    QTest::newRow("t07") << (int)ESatSCallControlNotify << (int)ESatAlphaIdNull
+        << "" << (int)ESatNotAllowed << (int)ESatSuccess;
+    QTest::newRow("t08") << (int)ESatSCallControlNotify << (int)ESatAlphaIdNotProvided
+        << "" << (int)ESatAllowedWithModifications << (int)ESatSuccess;
+
+    QTest::newRow("t09") << (int)ESatSSendUssdNotify << (int)ESatAlphaIdNotNull
+        << "notify" << (int)ESatAllowedNoModification << (int)ESatSuccess;
+    QTest::newRow("t10") << (int)ESatSSendUssdNotify << (int)ESatAlphaIdNull
+        << "" << (int)ESatNotAllowed << (int)ESatSuccess;
+
+    QTest::newRow("t11") << (int)ESatSSendUssdNotify << (int)ESatAlphaIdNotNull
+        << "notify" << (int)ESatAllowedNoModification << (int)ESatSuccess;
+    QTest::newRow("t12") << (int)ESatSSendUssdNotify << (int)ESatAlphaIdNull
+        << "" << (int)ESatNotAllowed << (int)ESatSuccess;
+
+    QTest::newRow("t13") << (int)ESatSSendSsNotify << (int)ESatAlphaIdNotNull
+        << "notify" << (int)ESatAllowedNoModification << (int)ESatSuccess;
+    QTest::newRow("t14") << (int)ESatSSendSsNotify << (int)ESatAlphaIdNull
+        << "" << (int)ESatNotAllowed << (int)ESatSuccess;
+    
+    QTest::newRow("t15") << (int)ESatSSendSmsNotify << (int)ESatAlphaIdNotNull
+        << "notify" << (int)ESatAllowedNoModification << (int)ESatSuccess;
+    QTest::newRow("t16") << (int)ESatSSendSmsNotify << (int)ESatAlphaIdNull
+        << "" << (int)ESatNotAllowed << (int)ESatSuccess;
+}
+
+void Ut_SatAppPopupProvider::testNotification()
+{
+    QFETCH(int, commandId);
+    QFETCH(int, alphaIdStatus);
+    QFETCH(QString, text);
+    QFETCH(int, controlResult);
+    QFETCH(int, clickState);
+
+    SatAppAction a(ESatNotifyAction);
+    a.set(KeyCommandId,commandId);
+    a.set(KeyAlphaIdStatus,alphaIdStatus);
+    a.set(KeyText,text);
+    a.set(KeyControlResult,controlResult);
+    a.setResponse(ESatSuccess);
+    
+    PopupProviderTest test;
+    test.mPopup->notification(a);
+
+    qDebug() << "action response:" << a.response() << "/" << clickState;
+    QCOMPARE(a.response(),(TSatUiResponse)clickState);
+}
+
+// ---------------------------------------------------------------
+// internal helper class
+// ---------------------------------------------------------------
+
+PopupProviderTest::PopupProviderTest()
+{
+    mPopup = new SatAppPopupProvider(this);
+}
+
+PopupProviderTest::~PopupProviderTest()
+{
+    cleanup();
+}
+
+bool PopupProviderTest::simulateOkClicked()
+{
+    if (mPopup->mDisplayText->actions().size()<=0) return false;
+    mPopup->mDisplayText->actions().at(0)->trigger();
+    return true;
+}
+
+bool PopupProviderTest::simulateCancelClicked()
+{
+    if (mPopup->mDisplayText->actions().size()<=1) return false;
+    mPopup->mDisplayText->actions().at(1)->trigger();
+    return true;
+}
+
+void PopupProviderTest::cleanup()
+{
+    delete mPopup;
+    mPopup = 0;
+}
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satui/satapp/tsrc/ut_satapp/src/ut_satappserverdispatcher.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,1043 @@
+/*
+* 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: Unit test for CSatUiObserver
+*
+*/
+
+#include "ut_satappserverdispatcher.h"
+#include "satappserverdispatcher.h"
+#include "satappaction.h"
+
+Ut_SatAppServerDispatcher::Ut_SatAppServerDispatcher(QObject *parent):QObject(parent) 
+{
+}
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppServerDispatcher::initTestCase
+// QTestLib cleanup method, called after the last testfunction .
+// -----------------------------------------------------------------------------
+void Ut_SatAppServerDispatcher::initTestCase()
+{
+    mServer = new SatAppServerDispatcher(this);
+}
+
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppServerDispatcher::cleanupTestCase
+// 
+// Connects to test object signal and verifies received data.
+// -----------------------------------------------------------------------------
+void Ut_SatAppServerDispatcher::cleanupTestCase()
+{
+    delete mServer;
+    mServer = 0;
+}
+
+
+
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppServerDispatcher::testDisplayText_data
+// 
+// Connects to test object signal and verifies received data.
+// -----------------------------------------------------------------------------
+void Ut_SatAppServerDispatcher::testDisplayText_data()
+{
+    qDebug("Ut_SatAppServerDispatcher::testDisplayText_data >");
+    QTest::addColumn<QString>("text");
+    QTest::addColumn<QString>("appName");
+    QTest::addColumn<int>("iconIdIdentifier");
+    QTest::addColumn<int>("iconIdQualifier");//enum 0~3
+    QTest::addColumn<bool>("isIconDisplayed");
+    QTest::addColumn<bool>("sustainedText");
+    QTest::addColumn<int>("duration");
+    QTest::addColumn<bool>("isWaitUsertoClear");
+    QTest::addColumn<int>("expectValue");
+
+    QTest::newRow("first") << "Show Display text!" << "Unit test SIM Service" << 
+        84 << 1 << false << false << 2500 << true << 0;
+
+    QTest::newRow("second") << "Show Display text!" << "SIM Service" << 
+        84 << 1 << true << false << 2500 << false << 0;
+    // test null text
+    QTest::newRow("third") << "" << "SIM Service" << 
+        84 << 1 << true << false << 2500 << false << -1;
+
+    // test icon is available for command
+    QTest::newRow("fouth") << "Show Display text!" << "SIM Service" << 
+        84 << 2 << true << false << 2500 << false << 0;
+
+    // test show a log text over the limitation
+    QTest::newRow("five") << "Show a very very long text. Show a very very long text. Show a very very long text. Show a very very long text. Show a very very long text. Show a very very long text. Show a very very long text. Show a very very long text. Show a very very long text. Show a very very long text. Show a very very long text. Show a very very long text. Show a very very long text. Show a very very long text. Show a very very long text. Show a very very long text. Show a very very long text. Show a very very long text. Show a very very long text. Show a very very long text. " 
+        << "SIM Service" << 84 << 2 << true << false << 2500 << false << -1;
+   
+    // test leave occurs
+    //QTest::newRow("forth") << "Show Display text!" << "" << 
+    //    84 << 2 << true << false << 2500 << false << 1;
+
+    qDebug("Ut_SatAppServerDispatcher::testDisplayText_data <");
+}
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppServerDispatcher::testDisplayText
+// 
+// Connects to test object signal and verifies received data.
+// -----------------------------------------------------------------------------
+void Ut_SatAppServerDispatcher::testDisplayText()
+{
+    qDebug("Ut_SatAppServerDispatcher::testDisplayText >");
+    QVERIFY(mServer);
+    QFETCH(QString, text);
+    QFETCH(QString, appName);
+    QFETCH(int, iconIdIdentifier);
+    QFETCH(int, iconIdQualifier);
+    QFETCH(bool, isIconDisplayed);
+    QFETCH(bool, sustainedText);
+    QFETCH(int, duration);
+    QFETCH(bool, isWaitUsertoClear);
+    QFETCH(int, expectValue);
+
+    // text
+    HBufC* hText = HBufC::New(text.length());
+    TPtr aText( hText->Des() );
+    aText.Copy( text.utf16() );
+    // sim name
+    HBufC* hSimAppName = HBufC::New(appName.length());
+    TPtr aSimApplicationName( hSimAppName->Des() );
+    aSimApplicationName.Copy( appName.utf16() );
+
+    TSatIconId aIconId;
+    aIconId.iIdentifier = iconIdIdentifier;
+    aIconId.iIconQualifier = static_cast<TSatIconQualifier>(iconIdQualifier);
+    TBool aIsIconDisplayed(isIconDisplayed);
+
+    TSatUiResponse result(ESatSuccess);
+    ServerDispatcherHelper helper;
+    connect(mServer,SIGNAL(displayText(SatAppAction&)),&helper,SLOT(exec(SatAppAction&)));
+    // It seems that TRAPD&QT_TRAP_THROWING does nothing if leave occurs, need 
+    // to investigate.
+    QT_TRAP_THROWING( result = mServer->DisplayTextL(
+                              aText, 
+                              aSimApplicationName,
+                              aIconId,
+                              aIsIconDisplayed,
+                              sustainedText,
+                              duration,
+                              isWaitUsertoClear
+                              ));
+    delete hText;
+    hText = 0;
+    TSatUiResponse exValue = static_cast<TSatUiResponse>(expectValue);
+    QCOMPARE(exValue, result);
+    qDebug("Ut_SatAppServerDispatcher::testDisplayText <");
+}
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppServerDispatcher::testGetInkey_data
+// 
+// Connects to test object signal and verifies received data.
+// -----------------------------------------------------------------------------
+void Ut_SatAppServerDispatcher::testGetInkey_data()
+{
+    qDebug("Ut_SatAppServerDispatcher::testGetInkey_data >");
+    QTest::addColumn<QString>("text");
+    QTest::addColumn<int>("characterSet");//enum 0~3
+    QTest::addColumn<QString>("input");
+    QTest::addColumn<bool>("isHelpIsAvailable");
+    QTest::addColumn<int>("iconIdIdentifier");
+    QTest::addColumn<int>("iconIdQualifier");//enum 0~3
+    QTest::addColumn<bool>("isRequestedIconDisplayed");
+    QTest::addColumn<int>("duration");
+    QTest::addColumn<bool>("isImmediateDigitResponse");
+    QTest::addColumn<int>("expectValue");
+    //// test ESatDigitOnly
+    QTest::newRow("first") << "Test GetInKey" << 0 << 
+        "8" << false << 60 << 1 << false << 2500 << true << 0;
+    // null text
+    QTest::newRow("second") << "" << 0 << 
+        "s" << false<< 60 << 1 << false << 2500 << true << 0;
+    // test EIconGetYesNo
+    QTest::newRow("third") << "Test GetInKey" << 3 << 
+        "s" << false << 60 << 1 << false << 2500 << true << 0;
+    // test ESatCharSmsDefaultAlphabet
+    QTest::newRow("fourth") << "Test GetInKey" << 3 << 
+        "$" << false << 60 << 1 << false << 2500 << true << 0;
+    // ino immediateDigitResponse
+    QTest::newRow("fifth") << "Test GetInKey" << 1 << 
+    "#" << false<< 60 << 1 << false << 2500 << false << 0;
+    // test zero lenght and yes no
+    QTest::newRow("sisth") << "" << 3 << 
+        "S" << false << 60 << 1 << false << 2500 << true << -1;
+    qDebug("Ut_SatAppServerDispatcher::testGetInkey_data <");
+}
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppServerDispatcher::testGetInkey
+// 
+// Connects to test object signal and verifies received data.
+// -----------------------------------------------------------------------------
+void Ut_SatAppServerDispatcher::testGetInkey()
+{
+    qDebug("Ut_SatAppServerDispatcher::testGetInkey >");
+    QVERIFY(mServer);
+    QFETCH(QString, text);
+    QFETCH(int, characterSet);
+    QFETCH(QString, input);
+    QFETCH(bool, isHelpIsAvailable);
+    QFETCH(int, iconIdIdentifier);
+    QFETCH(int, iconIdQualifier);
+    QFETCH(bool, isRequestedIconDisplayed);
+    QFETCH(int, duration);
+    QFETCH(bool, isImmediateDigitResponse);
+    QFETCH(int, expectValue);
+
+    // text
+    HBufC* hText = HBufC::New(text.length());
+    TPtr aText( hText->Des() );
+    aText.Copy( text.utf16() );
+    // aCharacterSet
+    TSatCharacterSet aCharacterSet = static_cast<TSatCharacterSet>(characterSet);
+    // aInput
+    TBuf<1> tInput = input.utf16();
+    TChar aInput(tInput[0]);
+    // aHelpIsAvailable
+    TBool aHelpIsAvailable(isHelpIsAvailable);
+    // aIconId
+    TSatIconId aIconId;
+    aIconId.iIdentifier = iconIdIdentifier;
+    aIconId.iIconQualifier = static_cast<TSatIconQualifier>(iconIdQualifier);
+    // aRequestedIconDisplayed
+    TBool aRequestedIconDisplayed(isRequestedIconDisplayed);
+    // aDuration
+    TUint aDuration= static_cast<TUint>(duration);
+    // aRequestedIconDisplayed
+    //TBool aImmediateDigitResponse(isImmediateDigitResponse);
+    ServerDispatcherHelper helper;
+    connect(mServer,SIGNAL(getInkey(SatAppAction&)),&helper,SLOT(exec(SatAppAction&)));
+    TSatUiResponse result(ESatSuccess);
+    QT_TRAP_THROWING( result = mServer->GetInkeyL(
+                              aText, 
+                              aCharacterSet,
+                              aInput,
+                              aHelpIsAvailable,
+                              aIconId,
+                              aRequestedIconDisplayed,
+                              aDuration,
+                              isImmediateDigitResponse
+                              ));
+    delete hText;
+    hText = 0;
+    TSatUiResponse exValue = static_cast<TSatUiResponse>(expectValue);
+    QCOMPARE(exValue, result);
+
+    qDebug("Ut_SatAppServerDispatcher::testGetInkey <");
+}
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppServerDispatcher::testGetInput_data
+// 
+// Connects to test object signal and verifies received data.
+// -----------------------------------------------------------------------------
+void Ut_SatAppServerDispatcher::testGetInput_data()
+{
+    qDebug("Ut_SatAppServerDispatcher::testGetInput_data >");
+    QTest::addColumn<QString>("text");
+    QTest::addColumn<int>("characterSet");//enum 0~3
+    QTest::addColumn<QString>("input");
+    QTest::addColumn<int>("minLength");
+    QTest::addColumn<int>("maxLength");
+    QTest::addColumn<bool>("isHideInput");
+    QTest::addColumn<bool>("isHelpIsAvailable");
+    QTest::addColumn<int>("iconIdIdentifier");
+    QTest::addColumn<int>("iconIdQualifier");//enum 0~3
+    QTest::addColumn<bool>("isRequestedIconDisplayed");
+    QTest::addColumn<int>("expectValue");
+    // test characterSet ESatCharSmsDefaultAlphabet
+    QTest::newRow("first") << "Test GetInput" << 1 << 
+        "get input" << 1 << 5 << false << false <<60 << 1 << true << 0;
+    // test iconIdQualifier ESatSelfExplanatory
+    QTest::newRow("second") << "Test GetInput" << 0 << 
+      "get input" << 1 << 5 << false << false <<60 << 2 << true << 0;
+    // test hide
+    QTest::newRow("third") << "Test GetInput" << 1 << 
+      "" << 1 << 5 << true << false <<60 << 2 << true << -1;
+    qDebug("Ut_SatAppServerDispatcher::testGetInput_data <");
+}
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppServerDispatcher::testGetInput
+// 
+// Connects to test object signal and verifies received data.
+// -----------------------------------------------------------------------------
+void Ut_SatAppServerDispatcher::testGetInput()
+{
+    qDebug("Ut_SatAppServerDispatcher::testGetInput >");
+    QVERIFY(mServer);
+    QFETCH(QString, text);
+    QFETCH(int, characterSet);
+    QFETCH(QString, input);
+    QFETCH(int, minLength);
+    QFETCH(int, maxLength);
+    QFETCH(bool, isHideInput);
+    QFETCH(bool, isHelpIsAvailable);
+    QFETCH(int, iconIdIdentifier);
+    QFETCH(int, iconIdQualifier);
+    QFETCH(bool, isRequestedIconDisplayed);
+    QFETCH(int, expectValue);
+
+    // text
+    HBufC* hText = HBufC::New(text.length());
+    TPtr aText( hText->Des() );
+    aText.Copy( text.utf16() );
+    // aCharacterSet
+    TSatCharacterSet aCharacterSet = static_cast<TSatCharacterSet>(characterSet);
+    // aInput
+    HBufC* hInput = HBufC::New(input.length());
+    TPtr aInput( hInput->Des() );
+    aInput.Copy( input.utf16() );
+    // aIconId
+    TSatIconId aIconId;
+    aIconId.iIdentifier = iconIdIdentifier;
+    aIconId.iIconQualifier = static_cast<TSatIconQualifier>(iconIdQualifier);
+    // aRequestedIconDisplayed
+    TBool aRequestedIconDisplayed(isRequestedIconDisplayed);
+    ServerDispatcherHelper helper;
+    connect(mServer,SIGNAL(getInput(SatAppAction&)),&helper,SLOT(exec(SatAppAction&)));
+    TSatUiResponse result(ESatSuccess);
+    QT_TRAP_THROWING( result = mServer->GetInputL(
+                              aText, 
+                              aCharacterSet,
+                              aInput,
+                              minLength,
+                              maxLength,
+                              isHideInput,
+                              isHelpIsAvailable,
+                              aIconId,
+                              aRequestedIconDisplayed
+                              ));
+    delete hText;
+    hText = 0;
+    delete hInput;
+    hInput = 0;
+    TSatUiResponse exValue = static_cast<TSatUiResponse>(expectValue);
+    QCOMPARE(exValue, result);
+    qDebug("Ut_SatAppServerDispatcher::testGetInput <");
+}
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppServerDispatcher::testSetUpMenu_data
+// 
+// Connects to test object signal and verifies received data.
+// -----------------------------------------------------------------------------
+void Ut_SatAppServerDispatcher::testSetUpMenu_data()
+{
+    qDebug("Ut_SatAppServerDispatcher::testSetUpMenu_data >");
+    QTest::addColumn<QString>("text");
+    QTest::addColumn<QStringList>("setupMenuItem");
+    QTest::addColumn<bool>("isHelpIsAvailable");
+    QTest::addColumn<int>("iconIdIdentifier");
+    QTest::addColumn<int>("iconIdQualifier");//enum 0~3
+    QTest::addColumn<int>("iconListQualifier");
+    QTest::addColumn<int>("expectReturnValue");
+
+    QStringList testSetUpMenu_1_items;
+    testSetUpMenu_1_items 
+    << "SendData" 
+    << "ReceiveData" 
+    << "CloseChannel"
+    << "OpenChannel"
+    << "GetChannelStatus"
+    << "DisplayText with different symbols and durations"
+    << "GetInkey"
+    << "GetInput"
+    << "SelectItem"
+    << "PlayTone"
+    << "RefreshRequired"
+    << "DoRefresh"
+    << "SendSm"
+    << "SendSs"
+    << "SendUssd"
+    << "SetUpCall"
+    << "SetUpIdleModeText"
+    << "CallControl"
+    << "MoSmControl"
+    << "LaunchBrowser"
+    << "SendDTMF"
+    << "SetUpEventList"
+    << "ProvideLocalInfo"
+    << "EventDownload for IdleScreen available event"
+    << "SetUpMenu";
+
+    QTest::newRow("first") << "SAT" << testSetUpMenu_1_items << 
+        false << 80 << 1 << 2 << 0;
+
+    qDebug("Ut_SatAppServerDispatcher::testSetUpMenu_data <");
+}
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppServerDispatcher::testSetUpMenu
+// 
+// Connects to test object signal and verifies received data.
+// -----------------------------------------------------------------------------
+void Ut_SatAppServerDispatcher::testSetUpMenu()
+{
+    qDebug("Ut_SatAppServerDispatcher::testSetUpMenu >");
+    QVERIFY(mServer);
+    QFETCH(QString, text);
+    QFETCH(QStringList, setupMenuItem);
+    QFETCH(bool, isHelpIsAvailable);
+    QFETCH(int, iconIdIdentifier);
+    QFETCH(int, iconIdQualifier);
+    QFETCH(int, iconListQualifier);
+    QFETCH(int, expectReturnValue);
+
+    // aText
+    HBufC* hText = HBufC::New(text.length());
+    TPtr aText( hText->Des() );
+    aText.Copy( text.utf16() );
+    // aMenuItems
+    TBuf<128> menuItem;
+    CDesCArrayFlat* aMenuItems = new CDesCArrayFlat(4);
+    QVERIFY(aMenuItems);
+    for (int i = 0; i< setupMenuItem.count(); i++) {
+        menuItem = setupMenuItem.at(i).utf16();
+        QT_TRAP_THROWING(aMenuItems->AppendL(menuItem));
+    }
+    // aIconId
+    TSatIconId aIconId;
+    aIconId.iIdentifier = iconIdIdentifier;
+    aIconId.iIconQualifier = static_cast<TSatIconQualifier>(iconIdQualifier);
+    // aMenuItemNextActions
+    CArrayFixFlat<TSatAction>* aMenuItemNextActions = 
+          new CArrayFixFlat<TSatAction> (4);
+     QVERIFY(aMenuItemNextActions);
+    // Temp test
+     QT_TRAP_THROWING(aMenuItemNextActions->AppendL(ESatSetUpMenuAction));
+    // aMenuIcons
+    CArrayFixFlat<TInt>* aMenuIcons = new CArrayFixFlat<TInt>(2);
+    QVERIFY(aMenuIcons);
+    // Temp test
+    QT_TRAP_THROWING(aMenuIcons->AppendL(1));
+    // aIconListQualifier
+    TSatIconQualifier aIconListQualifier = 
+        static_cast<TSatIconQualifier>(iconListQualifier);
+    // TSatSelectionPreference, useless
+    TSatSelectionPreference aSelectionPreference(ESatNoSelectionPreference);
+    TSatUiResponse result(ESatSuccess);
+    QT_TRAP_THROWING(result = mServer->SetUpMenuL(
+                              aText,
+                              *aMenuItems,
+                              aMenuItemNextActions,
+                              isHelpIsAvailable,
+                              aIconId,
+                              aMenuIcons,
+                              aIconListQualifier,
+                              aSelectionPreference
+                              ));
+    TSatUiResponse exValue = static_cast<TSatUiResponse>(expectReturnValue);
+    QCOMPARE(exValue, result);
+
+    delete hText;
+    hText = 0;
+    delete aMenuItems;
+    aMenuItems = 0;
+    delete aMenuItemNextActions;
+    aMenuItemNextActions = 0;
+    delete aMenuIcons;
+    aMenuIcons = 0;
+    qDebug("Ut_SatAppServerDispatcher::testSetUpMenu <");
+}
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppServerDispatcher::testSelectItem_data
+// 
+// Connects to test object signal and verifies received data.
+// -----------------------------------------------------------------------------
+void Ut_SatAppServerDispatcher::testSelectItem_data()
+{
+    qDebug("Ut_SatAppServerDispatcher::testSelectItem_data >");
+    QTest::addColumn<QString>("text");
+    QTest::addColumn<QStringList>("selectItemItem");
+    QTest::addColumn<int>("defaultItem");
+    QTest::addColumn<bool>("isHelpIsAvailable");
+    QTest::addColumn<int>("iconIdIdentifier");
+    QTest::addColumn<int>("iconIdQualifier");//enum 0~3
+    QTest::addColumn<int>("iconListQualifier");
+    QTest::addColumn<int>("expectReturnValue");
+
+    QStringList testSelectItem_1_items;
+    testSelectItem_1_items 
+    << "Select Item 1" 
+    << "Select Item 2" 
+    << "Select Item 3" 
+    << "Select Item 4" 
+    << "Select Item 5";
+
+    QTest::newRow("first") << "Make a Choice" << testSelectItem_1_items << 
+        0 << false << 80 << 1 << 2 << 0;
+
+    qDebug("Ut_SatAppServerDispatcher::testSelectItem_data <");
+}
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppServerDispatcher::testSetUpMenu
+// 
+// Connects to test object signal and verifies received data.
+// -----------------------------------------------------------------------------
+void Ut_SatAppServerDispatcher::testSelectItem()
+{
+    qDebug("Ut_SatAppServerDispatcher::testSelectItem >");
+    QVERIFY(mServer);
+    QFETCH(QString, text);
+    QFETCH(QStringList, selectItemItem);
+    QFETCH(int, defaultItem);
+    QFETCH(bool, isHelpIsAvailable);
+    QFETCH(int, iconIdIdentifier);
+    QFETCH(int, iconIdQualifier);
+    QFETCH(int, iconListQualifier);
+    QFETCH(int, expectReturnValue);
+
+    // aText
+    HBufC* hText = HBufC::New(text.length());
+    TPtr aText( hText->Des() );
+    aText.Copy( text.utf16() );
+    // aMenuItems
+    TBuf<128> menuItem;
+    CDesCArrayFlat* aMenuItems = new CDesCArrayFlat(4);
+    QVERIFY(aMenuItems);
+    for (int i = 0; i< selectItemItem.count(); i++) {
+        menuItem = selectItemItem.at(i).utf16();
+        QT_TRAP_THROWING(aMenuItems->AppendL(menuItem));
+    }
+    
+    TUint8 aSelectedItem( 1 );
+    // aIconId
+    TSatIconId aIconId;
+    aIconId.iIdentifier = iconIdIdentifier;
+    aIconId.iIconQualifier = static_cast<TSatIconQualifier>(iconIdQualifier);
+    // aMenuItemNextActions
+    CArrayFixFlat<TSatAction>* aMenuItemNextActions = 
+          new CArrayFixFlat<TSatAction> (4);
+     QVERIFY(aMenuItemNextActions);
+    // Temp test
+     QT_TRAP_THROWING(aMenuItemNextActions->AppendL(ESatSelectItemAction));
+    // aMenuIcons
+    CArrayFixFlat<TInt>* aMenuIcons = new CArrayFixFlat<TInt>(2);
+    QVERIFY(aMenuIcons);
+    // Temp test
+    QT_TRAP_THROWING(aMenuIcons->AppendL(1));
+    // aIconListQualifier
+    TSatIconQualifier aIconListQualifier = 
+        static_cast<TSatIconQualifier>(iconListQualifier);
+    // TSatSelectionPreference, useless
+    TSatSelectionPreference aSelectionPreference(ESatNoSelectionPreference);
+    TBool aRequestIconDisplayed (EFalse);
+    
+    TSatUiResponse result(ESatSuccess);
+    ServerDispatcherHelper helper;
+    connect(mServer,SIGNAL(selectItem(SatAppAction&)),&helper,SLOT(exec(SatAppAction&)));
+    connect(mServer,SIGNAL(selectItem(SatAppAction&)),
+        &helper,SLOT(simulateItemSelected(SatAppAction&)));
+    QT_TRAP_THROWING(result = mServer->SelectItemL(
+                              aText,
+                              *aMenuItems,
+                              aMenuItemNextActions,
+                              defaultItem,
+                              aSelectedItem,
+                              isHelpIsAvailable,
+                              aIconId,
+                              aMenuIcons,
+                              aIconListQualifier,
+                              aRequestIconDisplayed,
+                              aSelectionPreference
+                              ));
+    TSatUiResponse exValue = static_cast<TSatUiResponse>(expectReturnValue);
+    QCOMPARE(exValue, result);
+
+    delete hText;
+    hText = 0;
+    delete aMenuItems;
+    aMenuItems = 0;
+    delete aMenuItemNextActions;
+    aMenuItemNextActions = 0;
+    delete aMenuIcons;
+    aMenuIcons = 0;
+    qDebug("Ut_SatAppServerDispatcher::testSelectItem <");
+}
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppServerDispatcher::testSetUpMenu
+// 
+// Connects to test object signal and verifies received data.
+// -----------------------------------------------------------------------------
+void Ut_SatAppServerDispatcher::testPlayTone_data()
+{
+    qDebug("Ut_SatAppServerDispatcher::testPlayTone_data >");
+    QTest::addColumn<QString>("text");//enum 0~3
+    QTest::addColumn<int>("satTone");
+    QTest::addColumn<int>("duration");
+    QTest::addColumn<int>("iconIdIdentifier");
+    QTest::addColumn<int>("iconIdQualifier");//enum 0~3
+    QTest::addColumn<bool>("isRequestedIconDisplayed");
+    QTest::addColumn<int>("expectReturnValue");
+    QTest::newRow("Response_Failure") << "PlayStandardTone" << 100 << 
+        0 << 80 << 1 << false << 0;
+    QTest::newRow("ToneNotSet") << "PlayStandardTone" << -1 << 
+        0 << 80<< 0 << false << 0;
+    QTest::newRow("DialTone_0") << "PlayStandardTone" << 1 << 
+        0 << 80<< 1 << false << 0;
+    QTest::newRow("DialTone_2000") << "PlayStandardTone" << 1 << 
+        2000 << 80 << 2 << false << 0;
+    QTest::newRow("DialTone_true") << "PlayStandardTone" << 1 << 
+        2000 << 80 << 3 << true << 0;
+    QTest::newRow("Busy") << "PlayStandardTone" << 2 << 
+        2000 << 80 << 3 << false << 0;
+    QTest::newRow("Congestion") << "PlayStandardTone" << 3 << 
+        25000 << 80 << 3 << false << 0;
+    QTest::newRow("Congestion_0") << "PlayStandardTone" << 3 << 
+        0 << 80 << 3 << false << 0;
+    QTest::newRow("Acknowledge ") << "PlayStandardTone" << 4 << 
+        25000 << 80 << 3 << false << 0;
+    QTest::newRow("Acknowledge_0") << "PlayStandardTone" << 4 << 
+        0 << 80 << 3 << false << 0;
+    QTest::newRow("CallDropped") << "PlayStandardTone" << 5 << 
+        25000 << 80 << 1 << false << 0;
+    QTest::newRow("CallDropped_0") << "PlayStandardTone" << 5 << 
+        0 << 80 << 1 << false << 0;
+    QTest::newRow("SpecialInfo") << "PlayStandardTone" << 6 << 
+        25000 << 80 << 1 << false << 0;
+    QTest::newRow("SpecialInfo_0") << "PlayStandardTone" << 6 << 
+        0 << 80 << 1 << false << 0;
+    QTest::newRow("WaitingTone") << "PlayStandardTone" << 7 << 
+        25000 << 80 << 1 << false << 0;
+    QTest::newRow("WaitingTone_0") << "PlayStandardTone" << 7 << 
+        0 << 80 << 1 << false << 0;
+    QTest::newRow("RingingTone") << "PlayStandardTone" << 8 << 
+        25000 << 80 << 1 << false << 0;
+    QTest::newRow("RingingTone_0") << "PlayStandardTone" << 8 << 
+        0 << 80 << 1 << false << 0;
+    QTest::newRow("GeneralBeep") << "PlayStandardTone" << 16 << 
+        25000 << 80 << 1 << false << 0;
+    QTest::newRow("GeneralBeep_0") << "PlayStandardTone" << 16 << 
+        0 << 80 << 1 << false << 0;
+    QTest::newRow("PositiveTone") << "PlayStandardTone" << 17 << 
+        25000 << 80 << 1 << false << 0;
+    QTest::newRow("PositiveTone_0") << "PlayStandardTone" << 17 << 
+        0 << 80 << 1 << false << 0;
+    QTest::newRow("NegativeTone") << "PlayStandardTone" << 18 << 
+        25000 << 80 << 1 << false << 0;
+    QTest::newRow("NegativeTone_0") << "PlayStandardTone" << 18 << 
+        0 << 80 << 1 << false << 0;
+    QTest::newRow("Speech") << "PlayStandardTone" << 19 << 
+        25000 << 80 << 1 << false << 0;
+    QTest::newRow("Speech_0") << "PlayStandardTone" << 19 << 
+        25000 << 80 << 1 << false << 0;
+    QTest::newRow("Sms") << "PlayStandardTone" << 20 << 
+        25000 << 80 << 1 << false << 0;
+    QTest::newRow("Sms_0") << "PlayStandardTone" << 20 << 
+        0 << 80 << 1 << false << 0;
+    QTest::newRow("Busy_0") << "PlayStandardTone" << 2 << 
+        0 << 80 << 3 << false << 0;
+    qDebug("Ut_SatAppServerDispatcher::testPlayTone_data <");
+}
+
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppServerDispatcher::testSetUpMenu
+// 
+// Connects to test object signal and verifies received data.
+// -----------------------------------------------------------------------------
+void Ut_SatAppServerDispatcher::testPlayTone()
+{
+    qDebug("Ut_SatAppServerDispatcher::testPlayTone >");
+    QVERIFY(mServer);
+    QFETCH(QString, text);
+    QFETCH(int, duration);
+    QFETCH(int, satTone);
+    QFETCH(int, iconIdIdentifier);
+    QFETCH(int, iconIdQualifier);
+    QFETCH(bool, isRequestedIconDisplayed);
+    QFETCH(int, expectReturnValue);
+    qDebug("Ut_SatAppServerDispatcher::testPlayTone after fetch");
+    // text
+    HBufC* hText = HBufC::New(text.length());
+    TPtr aText( hText->Des() );
+    aText.Copy( text.utf16() );
+    // aTone
+    TSatTone aTone = static_cast<TSatTone>(satTone);
+    // aDuration
+    TUint aDuration= static_cast<TUint>(duration);
+    // aIconId
+    TSatIconId aIconId;
+    aIconId.iIdentifier = iconIdIdentifier;
+    aIconId.iIconQualifier = static_cast<TSatIconQualifier>(iconIdQualifier);
+    // aRequestedIconDisplayed
+    TBool aRequestedIconDisplayed(isRequestedIconDisplayed);
+    qDebug("Ut_SatAppServerDispatcher::testPlayTone call observer");
+    ServerDispatcherHelper helper;
+    connect(mServer,SIGNAL(playTone(SatAppAction&)),&helper,SLOT(exec(SatAppAction&)));
+    TSatUiResponse result(ESatSuccess);
+    result = mServer->PlayTone(
+                              aText,
+                              aTone,
+                              aDuration,
+                              aIconId,
+                              aRequestedIconDisplayed
+                              );
+    TSatUiResponse exValue = static_cast<TSatUiResponse>(expectReturnValue);
+    QCOMPARE(exValue, result);
+    delete hText;
+    hText = 0;
+    qDebug("Ut_SatAppServerDispatcher::testPlayTone <");
+}
+
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppServerDispatcher::testConfirmCommand_data
+// 
+// Connects to test object signal and verifies received data.
+// -----------------------------------------------------------------------------
+void Ut_SatAppServerDispatcher::testConfirmCommand_data()
+{
+    qDebug("Ut_SatAppServerDispatcher::testConfirmCommand_data >");
+    QTest::addColumn<int>("commandId");// enum 0~6
+    QTest::addColumn<int>("alphaIdStatus");
+    QTest::addColumn<QString>("text");
+    QTest::addColumn<QString>("additionalText");
+    QTest::addColumn<bool>("isctionAccepted");
+    QTest::addColumn<int>("iconIdIdentifier");
+    QTest::addColumn<int>("iconIdQualifier");//enum 0~3
+    QTest::addColumn<bool>("isRequestedIconDisplayed");
+    QTest::addColumn<bool>("isterminatedByUser");
+    // test commandId ESatSSendSmQuery
+    QTest::newRow("first") << 0 << 1 << "ConfirmCommand SendSm" 
+        << "SendSm" <<false << 60 << 1 << false <<false;
+    // test commandId ESatSSendSsQuery
+    QTest::newRow("second") << 1 << 1 << "ConfirmCommand SendSs" 
+        << "SendSs" <<false << 60 << 1 << false <<false;
+    // test commandId ESatSSendUssdQuery
+    QTest::newRow("third") << 2 << 1 << "ConfirmCommand SendUssd" 
+        << "SendUssd" <<false << 60 << 1 << false <<false;
+    // test commandId ESatSRefreshQuery
+    QTest::newRow("fourth") << 3 << 1 << "ConfirmCommand Refresh" 
+        << "First test case" <<false << 60 << 1 << false <<false;
+    // test commandId ESatSLaunchBrowserQuery
+    QTest::newRow("fifth") << 4 << 1 << "ConfirmCommand LaunchBrowser" 
+        << "LaunchBrowser" <<false << 60 << 1 << false <<false;
+    // test commandId ESatOpenChannelQuery
+    QTest::newRow("sixth") << 5 << 1 << "ConfirmCommand OpenChannel" 
+        << "OpenChanne" <<false << 60 << 1 << false <<false;
+    // test commandId ESatSSetUpCallQuery
+    QTest::newRow("seventh") << 6 << 1 << "ConfirmCommand SetUpCall" 
+        << "SetUpCall" <<false << 60 << 1 << false <<false;
+    // test commandId ESatSelfExplanatory
+    QTest::newRow("eighth") << 0 << 1 << "ConfirmCommand SendSm" 
+        << "SendSm SelfExplanatory" <<false << 60 << 2 << true <<false;
+
+    qDebug("Ut_SatAppServerDispatcher::testConfirmCommand_data <");
+}
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppServerDispatcher::testConfirmCommand
+// 
+// Connects to test object signal and verifies received data.
+// -----------------------------------------------------------------------------
+void Ut_SatAppServerDispatcher::testConfirmCommand()
+{
+    qDebug("Ut_SatAppServerDispatcher::testConfirmCommand >");
+    QVERIFY(mServer);
+    QFETCH(int, commandId);
+    QFETCH(int, alphaIdStatus);
+    QFETCH(QString, text);
+    QFETCH(QString, additionalText);
+    QFETCH(bool, isctionAccepted);
+    QFETCH(int, iconIdIdentifier);
+    QFETCH(int, iconIdQualifier);
+    QFETCH(bool, isRequestedIconDisplayed);
+    QFETCH(bool, isterminatedByUser);
+
+    // aCharacterSet
+    TSatSQueryCommand aCommandId = static_cast<TSatSQueryCommand>(commandId);
+    // aAlphaIdStatus
+    TSatAlphaIdStatus aAlphaIdStatus = static_cast<TSatAlphaIdStatus>(alphaIdStatus);
+    // text
+    HBufC* hText = HBufC::New(text.length());
+    TPtr aText( hText->Des() );
+    aText.Copy( text.utf16() );
+    // aAdditionalText
+    HBufC* hAdditionalText = HBufC::New(additionalText.length());
+    TPtr aAdditionalText( hAdditionalText->Des() );
+    aAdditionalText.Copy( additionalText.utf16() );
+    // aActionAccepted
+    TBool aActionAccepted(isctionAccepted);
+    // aIconId
+    TSatIconId aIconId;
+    aIconId.iIdentifier = iconIdIdentifier;
+    aIconId.iIconQualifier = static_cast<TSatIconQualifier>(iconIdQualifier);
+    // aRequestedIconDisplayed
+    TBool aRequestedIconDisplayed(isRequestedIconDisplayed);
+    // aRequestedIconDisplayed
+    TBool aTerminatedByUser(isterminatedByUser);
+    ServerDispatcherHelper helper;
+    connect(mServer,SIGNAL(confirmCommand(SatAppAction&)),&helper,SLOT(exec(SatAppAction&)));
+    mServer->ConfirmCommand(
+                              aCommandId,
+                              aAlphaIdStatus,
+                              aText, 
+                              aAdditionalText,
+                              aActionAccepted,
+                              aIconId,
+                              aRequestedIconDisplayed,
+                              aTerminatedByUser
+                              );
+    delete hText;
+    hText = 0;
+    delete hAdditionalText;
+    hAdditionalText = 0;
+    qDebug("Ut_SatAppServerDispatcher::testConfirmCommand <");
+}
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppServerDispatcher::testNotification_data
+// 
+// Connects to test object signal and verifies received data.
+// -----------------------------------------------------------------------------
+void Ut_SatAppServerDispatcher::testNotification_data()
+{
+    qDebug("Ut_SatAppServerDispatcher::testNotification_data >");
+    QTest::addColumn<int>("commandId");// enum 0~6
+    QTest::addColumn<int>("alphaIdStatus");
+    QTest::addColumn<QString>("text");
+    QTest::addColumn<int>("iconIdIdentifier");
+    QTest::addColumn<int>("iconIdQualifier");//enum 0~3
+    QTest::addColumn<bool>("isRequestedIconDisplayed");
+    QTest::addColumn<int>("controlResult");
+ 
+    // test commandId ESatSSendDataNotify    
+    QTest::newRow("Senddata_0id") << 0 << 0 << "Send data notify" 
+    << 2 << 0 << false <<0;
+    // test commandId ESatSSendDataNotify alpha id not null but string length is zero   
+    QTest::newRow("Senddata_1id") << 0 << 1 << "" 
+    << 2 << 0 << false <<0;
+    QTest::newRow("Senddata_2id") << 0 << 2 << "Send data notify AlphaIdNotProvided" 
+    << 2 << 0 << false <<0;
+    // test commandId ESatSReceiveDataNotify
+    QTest::newRow("Recievedata_0id") << 1 << 0 << "Recieve data notify" 
+    << 2 << 3 << false <<0;
+    QTest::newRow("Recievedata_1id") << 1 << 1 << "Recieve data notify" 
+    << 2 << 3 << false <<0;
+    QTest::newRow("Recievedata_2id") << 1 << 2 << "Recieve data notify AlphaIdNotProvided" 
+    << 2 << 3 << false <<0;
+    // test commandId ESatSCloseChannelNotify
+    QTest::newRow("CloseChannel_0id") << 2 << 0 << "Close channel notify" 
+    << 2 << 3 << false <<0;
+    QTest::newRow("CloseChannel_1id") << 2 << 1 << "" 
+    << 2 << 3 << false <<0;
+    QTest::newRow("CloseChannel_2id") << 2 << 2 << "Close channel notify AlphaIdNotProvided" 
+    << 2 << 3 << false <<0;
+    // test commandId ESatSMoSmControlNotify
+    QTest::newRow("MoSm_0id") << 3 << 0 << "SM control notify" 
+    << 2 << 0 << false <<0;
+    QTest::newRow("MoSm_1id") << 3 << 1 << "0" 
+    << 2 << 0 << false <<0;
+    QTest::newRow("MoSm_2id") << 3 << 2 << "SM control notify AlphaIdNotProvided" 
+    << 2 << 0 << false <<0;
+    // test commandId ESatSCallControlNotify
+    QTest::newRow("CallControl_0id") << 4 << 0 << "Call control notify" 
+    << 2 << 1 << false <<0;
+    QTest::newRow("CallControl_1id") << 4 << 1 << ""
+    << 2 << 1 << false <<0;
+    QTest::newRow("CallControl_2id") << 4 << 2 << "Call control notify AlphaIdNotProvided" 
+    << 2 << 1 << false <<0;
+    // test commandId ESatSSendSsNotify
+    QTest::newRow("SendSs_0id") << 5 << 0 << "Send SS notify" 
+    << 2 << 2 << false <<0;
+    QTest::newRow("SendSs_1id") << 5 << 1 << "" 
+    << 2 << 2 << false <<0;
+    QTest::newRow("SendSs_2id") << 5 << 2 << "Send SS notify AlphaIdNotProvided" 
+    << 2 << 2 << false <<0;
+    // test commandId ESatSSendUssdNotify
+    QTest::newRow("SendUssd_0id") << 6 << 0 << "Send Ussd notify" 
+    << 2 << 3 << false <<0;
+    // test commandId ESatSSendUssdNotify
+    QTest::newRow("SendUssd_1id") << 6 << 1 << "" 
+    << 2 << 3 << false <<0;
+    // test commandId ESatSSendUssdNotify
+    QTest::newRow("SendUssd_2id") << 6 << 2 << "Send Ussd notify AlphaIdNotProvided" 
+    << 2 << 3 << false <<0;
+    // test commandId ESatSSendDtmfNotify
+    QTest::newRow("SendDtmf_0id") << 7 << 0 << "Send dtmf notify" 
+    << 2 << 3 << false <<0;
+    QTest::newRow("SendDtmf_1id") << 7 << 1 << "Send dtmf notify" 
+    << 2 << 3 << false <<0;
+    QTest::newRow("SendDtmf_2id") << 7 << 2 << "Send dtmf notify AlphaIdNotProvided" 
+    << 2 << 3 << false <<0;
+    // test commandId ESatSSendSmsNotify
+    QTest::newRow("SendSm_0id") << 8 << 0 << "SendSm notify" 
+    << 2 << 2 << false <<0;
+    QTest::newRow("SendSm_1id") << 8 << 1 << "SendSm notify" 
+    << 2 << 2 << false <<0;
+    QTest::newRow("SendSm_2id") << 8 << 2 << "SendSm notify AlphaIdNotProvided" 
+    << 2 << 2 << false <<0;
+    qDebug("Ut_SatAppServerDispatcher::testNotification_data <");
+}
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppServerDispatcher::testNotification
+// 
+// Connects to test object signal and verifies received data.
+// -----------------------------------------------------------------------------
+void Ut_SatAppServerDispatcher::testNotification()
+{
+    qDebug("Ut_SatAppServerDispatcher::testNotification >");
+    QVERIFY(mServer);
+    QFETCH(int, commandId);
+    QFETCH(int, alphaIdStatus);
+    QFETCH(QString, text);
+    QFETCH(int, iconIdIdentifier);
+    QFETCH(int, iconIdQualifier);
+    QFETCH(bool, isRequestedIconDisplayed);
+    QFETCH(int, controlResult);
+
+    // aCommandId
+    TSatSNotifyCommand aCommandId = static_cast<TSatSNotifyCommand>(commandId);
+    // aAlphaIdStatus
+    TSatAlphaIdStatus aAlphaIdStatus = static_cast<TSatAlphaIdStatus>(alphaIdStatus);
+    // text
+    HBufC* hText = HBufC::New(text.length());
+    TPtr aText( hText->Des() );
+    aText.Copy( text.utf16() );
+
+    // aIconId
+    TSatIconId aIconId;
+    aIconId.iIdentifier = iconIdIdentifier;
+    aIconId.iIconQualifier = static_cast<TSatIconQualifier>(iconIdQualifier);
+    // aRequestedIconDisplayed
+    TBool aRequestedIconDisplayed(isRequestedIconDisplayed);
+    // aRequestedIconDisplayed
+    TSatControlResult aControlResult = static_cast<TSatControlResult>(controlResult);
+    ServerDispatcherHelper helper;
+    connect(mServer,SIGNAL(notification(SatAppAction&)),&helper,SLOT(exec(SatAppAction&)));
+    mServer->Notification(
+                              aCommandId,
+                              aAlphaIdStatus,
+                              aText, 
+                              aIconId,
+                              aRequestedIconDisplayed,
+                              aControlResult
+                              );
+    delete hText;
+    hText = 0;
+    qDebug("Ut_SatAppServerDispatcher::testNotification <");
+}
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppServerDispatcher::testEventNotification_data
+// 
+// Connects to test object signal and verifies received data.
+// -----------------------------------------------------------------------------
+void Ut_SatAppServerDispatcher::testEventNotification_data()
+{
+    qDebug("Ut_SatAppServerDispatcher::testEventNotification_data >");
+    QTest::addColumn<int>("eventId");// enum 0~6
+    
+    // test eventId ESatSRefreshStartEvent    
+    QTest::newRow("RefreshStartEvent") << 0 ;
+    // test eventId ESatSRefreshEndEvent
+    QTest::newRow("RefreshEndEvent") << 1;
+    // test eventId ESatSSmEndEvent
+    QTest::newRow("SSmEndEvent") << 2;
+    // test eventId ESatSClearScreenEvent
+    QTest::newRow("ClearScreenEvent") << 3;
+    // test eventId ESatSCloseSatUiAppEvent
+    QTest::newRow("CloseSatUiAppEvent") << 4;
+    // test eventId ESatSsEndEvent
+    QTest::newRow("SsEndEvent") << 5;
+    // test eventId ESatSsErrorEvent
+    QTest::newRow("SsErrorEvent") << 6;
+    // test eventId ESatSDtmfEndEvent
+    QTest::newRow("DtmfEndEvent") << 7;
+
+    qDebug("Ut_SatAppServerDispatcher::testEventNotification_data <");
+}
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppServerDispatcher::testEventNotification
+// 
+// Connects to test object signal and verifies received data.
+// -----------------------------------------------------------------------------
+void Ut_SatAppServerDispatcher::testEventNotification()
+{
+    qDebug("Ut_SatAppServerDispatcher::testEventNotification >");
+    QVERIFY(mServer);
+    QFETCH(int, eventId);
+
+    TSatSEvent aEventId = static_cast<TSatSEvent>(eventId);
+    TSatSEventStatus aEventStatus = ESatEventCompleteOk;
+    mServer->EventNotification(aEventId, aEventStatus, 0);
+    qDebug("Ut_SatAppServerDispatcher::testEventNotification <");
+}
+
+
+void Ut_SatAppServerDispatcher::testMenuSelection()
+{
+    // menu selection 1
+    SatAppAction* a = new SatAppAction(ESatSetUpMenuAction,mServer);
+    a->set(KeySelection,4);
+    a->set(KeyHelpRequested,false);
+    connect(a,SIGNAL(actionCompleted(SatAppAction*)),mServer,SLOT(menuSelection(SatAppAction*)));
+    a->completeWithSuccess();
+
+    // menu selection 2 - with different params
+    SatAppAction* b = new SatAppAction(ESatSetUpMenuAction,mServer);
+    b->set(KeySelection,4);
+    b->set(KeyHelpRequested,false);
+    connect(b,SIGNAL(actionCompleted(SatAppAction*)),mServer,SLOT(menuSelection(SatAppAction*)));
+    b->completeWithSuccess();
+
+    // menu selection 3 - no user resp
+    SatAppAction* c = new SatAppAction(ESatSetUpMenuAction,mServer);
+    connect(c,SIGNAL(actionCompleted(SatAppAction*)),mServer,SLOT(menuSelection(SatAppAction*)));
+    c->completeWithNoResponse();
+
+    // menu selection 4 - session terminated
+    SatAppAction* d = new SatAppAction(ESatSetUpMenuAction,mServer);
+    connect(d,SIGNAL(actionCompleted(SatAppAction*)),mServer,SLOT(menuSelection(SatAppAction*)));
+    d->completeWithSessionTerminated();
+
+}
+
+void Ut_SatAppServerDispatcher::testUserCancelSession()
+{
+    SatAppAction* a = new SatAppAction(ESatSetUpMenuAction);
+    mServer->userCancelSession(a);
+}
+
+
+/*!
+*User cancel response, Send DTMF, Send Data, Receive Data
+*/
+
+// helper class
+void ServerDispatcherHelper::exec(SatAppAction& action)
+{
+    action.completeWithSuccess();
+}
+
+void ServerDispatcherHelper::simulateItemSelected(SatAppAction& action)
+{
+    action.set(KeySelection, 0);
+}
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/satui/satapp/tsrc/ut_satapp/src/ut_satapptoneprovider.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,625 @@
+/*
+* 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: Unit test for satappmainhandler
+*
+*/
+
+#include <QTimer>
+#include "ut_satapptoneprovider.h"
+#include "satapptoneprovider.h"
+#include "satappaction.h"
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppToneProvider::Ut_SatAppToneProvider
+// -----------------------------------------------------------------------------
+//
+Ut_SatAppToneProvider::Ut_SatAppToneProvider(QObject *parent):QObject(parent) 
+{
+}
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppToneProvider::testCreateProvider
+// 
+// Connects to test object signal and verifies received data.
+// -----------------------------------------------------------------------------
+void Ut_SatAppToneProvider::testCreateProvider_data()
+{
+    QTest::addColumn<bool>("timer");
+    QTest::newRow("t01") << false;
+    QTest::newRow("t01") << true;
+}
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppToneProvider::testCreateProvider
+// 
+// Connects to test object signal and verifies received data.
+// -----------------------------------------------------------------------------
+void Ut_SatAppToneProvider::testCreateProvider()
+{
+    QFETCH(bool, timer);
+    ToneProviderTest test;
+    if(timer){
+        test.ConstructTimer(false);
+    }
+    QVERIFY(test.mTone); 
+}
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppToneProvider::testClearScreen
+// 
+// Connects to test object signal and verifies received data.
+// -----------------------------------------------------------------------------
+void Ut_SatAppToneProvider::testClearScreen()
+{
+    ToneProviderTest test;
+    test.mTone->clearScreen();
+    QVERIFY(!test.isMessageBoxShown());
+    QVERIFY(!test.isTimerActive());
+}
+
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppToneProvider::testPlayTone_data
+// 
+// Connects to test object signal and verifies received data.
+// -----------------------------------------------------------------------------
+void Ut_SatAppToneProvider::testPlayTone_data()
+{
+    QTest::addColumn<QString>("text");
+    QTest::addColumn<int>("tone");
+    QTest::addColumn<int>("duration");
+    QTest::addColumn<int>("exp_result");
+
+    QTest::newRow("t01") << "Standard" << 0x01 << 0 << 0x32; // exp result changed
+    QTest::newRow("t02") << "Standard" << 0x02 << 100 << 0;
+    QTest::newRow("t03") << "Standard" << 0x03 << 1000 << 0;
+    QTest::newRow("t04") << "Standard" << 0x04 << 0 << 0;
+    QTest::newRow("t05") << "Standard" << 0x05 << 100 << 0;
+    QTest::newRow("t06") << "Standard" << 0x07 << 1000 << 0;
+    QTest::newRow("t07") << "" << 0x07 << 100 << 0;
+    QTest::newRow("t08") << "" << 0x08 << 500 << 0;
+    QTest::newRow("t09") << "" << 0x09 << 1000 << 0x32; // exp result changed
+    QTest::newRow("t10") << "User" << 0x13 << 1000 << 0;
+    QTest::newRow("t11") << "User" << 0x14 << 500 << 0;
+    QTest::newRow("t12") << "Illegal" << 0x99 << 100 << 0x32;
+}
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppToneProvider::testPlayTone
+// -----------------------------------------------------------------------------
+void Ut_SatAppToneProvider::testPlayTone()
+{
+    QFETCH(QString, text);
+    QFETCH(int, tone);
+    QFETCH(int, duration);
+    QFETCH(int, exp_result);
+
+    ToneProviderTest test;
+    TSatUiResponse resp(ESatSuccess);
+    
+    SatAppAction action(ESatPlayToneAction);
+    action.set(KeyToneId,tone);
+    action.set(KeyDuration,duration);
+    action.set(KeyText,text);
+    test.mTone->playTone(action);
+    action.waitUntilCompleted();
+    resp = action.response();
+
+    QCOMPARE((int)resp, exp_result);
+}
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppToneProvider::testplayStandardTone_data
+// 
+// Connects to test object signal and verifies received data.
+// -----------------------------------------------------------------------------
+void Ut_SatAppToneProvider::testplayDoubleTone_data()
+{
+    QTest::addColumn<QString>("text");
+    QTest::addColumn<int>("tone");
+    QTest::addColumn<int>("duration");
+    QTest::addColumn<bool>("timer");
+    QTest::addColumn<bool>("active");
+
+    QTest::newRow("t01") << "Standard" << 0x10 << 0 << false << false;
+    QTest::newRow("t02") << "Standard" << 0x10 << 0 << true << true;
+    QTest::newRow("t03") << "Standard" << 0x10 << 0 << true << false;
+    QTest::newRow("t04") << "Standard" << 0x13 << 0 << false << false;
+    QTest::newRow("t04") << "Standard" << 0x14 << 0 << true << true;
+    QTest::newRow("t04") << "" << 0x13 << 0 << true << false;
+
+}
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppToneProvider::testplayStandardTone
+// -----------------------------------------------------------------------------
+void Ut_SatAppToneProvider::testplayDoubleTone()
+{
+    QFETCH(QString, text);
+    QFETCH(int, tone);
+    QFETCH(int, duration);
+    QFETCH(bool, timer);
+    QFETCH(bool, active);
+
+    ToneProviderTest test;
+    TSatUiResponse resp(ESatSuccess);
+    if(timer){
+        test.ConstructTimer(active);
+    }
+    
+    SatAppAction action(ESatPlayToneAction);
+    action.set(KeyToneId,tone);
+    action.set(KeyDuration,duration);
+    action.set(KeyText,text);
+    test.mTone->playTone(action);
+    action.waitUntilCompleted();
+    resp = action.response();
+}
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppToneProvider::testPlayToneAndClearScreen
+// -----------------------------------------------------------------------------
+void Ut_SatAppToneProvider::testPlayToneAndClearScreen()
+{
+    ToneProviderTest test;
+
+    // timer for clearing screen after 1 sec.
+    QTimer::singleShot(1000, test.mTone, SLOT(clearScreen()));
+    
+    // start playing
+    TSatUiResponse result(ESatFailure);
+    SatAppAction action(ESatPlayToneAction);
+    action.set(KeyToneId,0x01);
+    action.set(KeyDuration,3000);
+    action.set(KeyText,QString("play"));
+    test.mTone->playTone(action);
+    action.waitUntilCompleted();
+    result = action.response();
+
+//    QCOMPARE(result, ESatSuccessToneNotPlayed); TODO:which?
+    QCOMPARE(result, ESatSuccess);
+}
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppToneProvider::testMatoPlayComplete_data
+// 
+// Connects to test object signal and verifies received data.
+// -----------------------------------------------------------------------------
+void Ut_SatAppToneProvider::testMatoPrepareComplete_data()
+{
+    QTest::addColumn<int>("error");
+    QTest::addColumn<bool>("tone");
+    QTest::newRow("error_0") << 0 << true;
+    QTest::newRow("error_-1") << -1 << false;
+    QTest::newRow("error_-2") << 0 << false;
+}
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppToneProvider::testMatoPlayComplete
+// 
+// Connects to test object signal and verifies received data.
+// -----------------------------------------------------------------------------
+void Ut_SatAppToneProvider::testMatoPrepareComplete()
+{
+    QFETCH(int, error);
+    QFETCH(bool, tone);
+    ToneProviderTest test;
+
+    if(tone)
+        test.ConstructAudioTone();
+
+    test.mTone->MatoPrepareComplete(error);
+    
+    test.DestroyAudioTone();
+}
+
+//// -----------------------------------------------------------------------------
+//// Ut_SatAppToneProvider::testMatoPlayComplete_data
+//// 
+//// Connects to test object signal and verifies received data.
+//// -----------------------------------------------------------------------------
+//void Ut_SatAppToneProvider::testMatoPlayComplete_data()
+//{
+//    QTest::addColumn<int>("error");
+//    QTest::addColumn<bool>("tone");
+//    QTest::newRow("error_0") << 0 << true;
+//    QTest::newRow("error_-1") << -1 << false;
+//    QTest::newRow("error_-2") << 0 << false;
+//}
+//
+//// -----------------------------------------------------------------------------
+//// Ut_SatAppToneProvider::testMatoPlayComplete
+//// 
+//// Connects to test object signal and verifies received data.
+//// -----------------------------------------------------------------------------
+//void Ut_SatAppToneProvider::testMatoPlayComplete()
+//{
+//    QFETCH(int, error);
+//    QFETCH(bool, tone);
+//    ToneProviderTest test;
+//
+//    if(tone)
+//        test.ConstructAudioTone();
+//
+//    test.mTone->MatoPrepareComplete(error);
+//    test.mTone->MatoPlayComplete(error);
+//    
+//    test.DestroyAudioTone();
+//}
+//
+//// -----------------------------------------------------------------------------
+//// Ut_SatAppToneProvider::testMapcPlayComplete_data
+//// 
+//// Connects to test object signal and verifies received data.
+//// -----------------------------------------------------------------------------
+//void Ut_SatAppToneProvider::testMapcPlayComplete_data()
+//{
+//    QTest::addColumn<bool>("player");
+//    QTest::newRow("t_true") << true;
+//    QTest::newRow("t_false") << false;
+//}
+//
+//// -----------------------------------------------------------------------------
+//// Ut_SatAppToneProvider::testMapcPlayComplete
+//// 
+//// Connects to test object signal and verifies received data.
+//// -----------------------------------------------------------------------------
+//void Ut_SatAppToneProvider::testMapcPlayComplete()
+//{
+//    QFETCH(bool, player);
+//    TInt error = 0;
+//    ToneProviderTest test;
+//    
+//    if(player)
+//        test.ConstructAudioPlayer();
+//    
+//    test.mTone->MapcPlayComplete(error);
+//    
+//    test.DestroyAudioPlayer();
+//}
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppToneProvider::testMapcInitComplete_data
+// 
+// Connects to test object signal and verifies received data.
+// -----------------------------------------------------------------------------
+void Ut_SatAppToneProvider::testMapcInitComplete_data()
+{
+    QTest::addColumn<int>("error");
+    QTest::addColumn<bool>("player");
+    QTest::newRow("error_0") << 0 << false;
+    QTest::newRow("error_-6") << -6 << true;
+    QTest::newRow("error_-6") << -6 << false;
+}
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppToneProvider::testMapcInitComplete
+// 
+// Connects to test object signal and verifies received data.
+// -----------------------------------------------------------------------------
+void Ut_SatAppToneProvider::testMapcInitComplete()
+{
+    QFETCH(int, error);
+    QFETCH(bool, player);
+    ToneProviderTest test;
+    
+    if(player)
+        test.ConstructAudioPlayer();
+    
+    test.mTone->MapcInitComplete(error, 0);
+    
+    test.DestroyAudioPlayer();
+}
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppToneProvider::testRecognizeTone_data
+// 
+// Connects to test object signal and verifies received data.
+// -----------------------------------------------------------------------------
+void Ut_SatAppToneProvider::testRecognizeTone_data()
+{
+    QTest::addColumn<int>("tone");
+    QTest::addColumn<int>("duration");
+
+    QTest::newRow("t01") << -1 << 0;
+    QTest::newRow("t01") << -1 << 1;
+    QTest::newRow("t01") << 0x01 << 0;
+    QTest::newRow("t01") << 0x01 << 1;
+    QTest::newRow("t01") << 0x02 << 0;
+    QTest::newRow("t01") << 0x02 << 1;
+    QTest::newRow("t01") << 0x03 << 0;
+    QTest::newRow("t01") << 0x03 << 1;
+    QTest::newRow("t01") << 0x04 << 0;
+    QTest::newRow("t01") << 0x04 << 1;
+    QTest::newRow("t01") << 0x05 << 0;
+    QTest::newRow("t01") << 0x05 << 1;
+    QTest::newRow("t01") << 0x06 << 0;
+    QTest::newRow("t01") << 0x06 << 1;
+    QTest::newRow("t01") << 0x07 << 0;
+    QTest::newRow("t01") << 0x07 << 1;
+    QTest::newRow("t01") << 0x08 << 0;
+    QTest::newRow("t01") << 0x08 << 1;
+    QTest::newRow("t01") << 0x09 << 0;
+    
+    QTest::newRow("t01") << 0x10 << 0;
+    QTest::newRow("t01") << 0x10 << 1;
+    QTest::newRow("t01") << 0x11 << 0;
+    QTest::newRow("t01") << 0x11 << 1;
+    QTest::newRow("t01") << 0x12 << 0;
+    QTest::newRow("t01") << 0x12 << 1;
+    QTest::newRow("t02") << 0x13 << 0;
+    
+    QTest::newRow("t02") << 0x14 << 0;
+    
+    
+}
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppToneProvider::testRecognizeTone
+// 
+// Connects to test object signal and verifies received data.
+// -----------------------------------------------------------------------------
+void Ut_SatAppToneProvider::testRecognizeTone()
+{
+    QFETCH(int, tone);
+    QFETCH(int, duration);
+    
+    ToneProviderTest test;
+    test.TestRecognizeTone(tone, duration);
+}
+
+// -----------------------------------------------------------------------------
+// Ut_SatAppToneProvider::testPrepareAudioToneUtility
+// 
+// Connects to test object signal and verifies received data.
+// -----------------------------------------------------------------------------
+void Ut_SatAppToneProvider::testPrepareAudioToneUtility()
+{
+    ToneProviderTest test;
+    test.ConstructAudioTone();
+    test.ConstructAudioTone();
+}
+
+// ---------------------------------------------------------------
+// internal helper class
+// ---------------------------------------------------------------
+
+ToneProviderTest::ToneProviderTest()
+{
+    mTone = new SatAppToneProvider(this);
+}
+
+ToneProviderTest::~ToneProviderTest()
+{
+    cleanup();
+}
+
+/**
+ * Singleton Pattern - not used
+ */
+SatAppToneProvider* ToneProviderTest::getToneInstance()
+{
+
+}
+
+bool ToneProviderTest::isMessageBoxShown()
+{
+    if (mTone->mPermanentNote) {
+        return true;
+    }
+    return false;
+}
+
+bool ToneProviderTest::isTimerActive()
+{
+    if (mTone->mTimer && mTone->mTimer->isActive()) {
+        return true;
+    }
+    return false;
+}
+
+void ToneProviderTest::ConstructAudioTone()
+{
+    QByteArray sequence;
+    sequence = KNetToneSeqDial;
+    TPtrC8 seq((unsigned char*)sequence.constData(),sequence.length());
+    if(mTone)
+        QT_TRAP_THROWING(mTone->SymbianPrepareAudioToneUtilityL(seq));
+}
+
+void ToneProviderTest::DestroyAudioTone()
+{
+    if(mTone)
+        mTone->SymbianStopAudioToneUtility();
+}
+
+void ToneProviderTest::ConstructAudioPlayer()
+{
+    int tone = ESatToneNotSet;
+    int duration = 0;
+    if(mTone)
+        QT_TRAP_THROWING(mTone->SymbianPrepareAudioPlayerL(tone,duration));
+}
+
+void ToneProviderTest::DestroyAudioPlayer()
+{
+    if(mTone)
+        mTone->SymbianStopAudioPlayer();
+}
+
+void ToneProviderTest::ConstructTimer(bool active)
+{
+    mTone->mTimer = new QTimer(mTone);
+    connect(mTone->mTimer, SIGNAL(timeout()),
+            mTone, SLOT(stopPlayTone()));
+    if(active)
+        mTone->mTimer->start(3000);
+}
+
+void ToneProviderTest::DestroyTimer()
+{
+    
+}
+
+void ToneProviderTest::SetPlayToneResult(TSatUiResponse error)
+{
+    mTone->mPlayToneError = error;
+}
+
+void ToneProviderTest::TestRecognizeTone(int tone, int duration)
+{
+    QByteArray sequence;
+    mTone->recognizeTone(tone, sequence, duration);
+}
+
+void ToneProviderTest::cleanup()
+{
+    delete mTone;
+    mTone = 0;
+}
+
+// ****************************************************************************
+// * ************************************************************************ *
+// * *                      SYMBIAN MOC PART                                * *
+// * ************************************************************************ *
+// ****************************************************************************
+
+
+// includes
+#include <e32cmn.h>
+#include <MProfile.h>
+#include <MProfileEngine.h>
+#include <MProfileTones.h>
+#include <TProfileToneSettings.h>
+#include <mdaaudiotoneplayer.h> //MMdaAudioToneObserver
+
+class CMocProfileTones : public MProfileTones
+    {
+    public:
+        CMocProfileTones() 
+            {
+            // Set TProfileToneSettings with specified value
+            iToneSettings.iWarningAndGameTones = EFalse;
+            TBuf<256> ringTone(_L("Z:\\Data\\Sounds\\Digital\\Nokia tune.aac"));
+            TBuf<256> alertTone(_L("Z:\\Data\\Sounds\\Digital\\Message 1.aac"));
+            iTone = ringTone;
+            }
+        virtual ~CMocProfileTones() {}
+
+    public:
+        virtual const TDesC& RingingTone1() const 
+            {
+            //DONE
+            return iTone;
+            }
+        virtual const TDesC& RingingTone2() const 
+            {
+            //DONE
+            return iTone;
+            }
+        virtual const TDesC& MessageAlertTone() const 
+            {
+            //DONE
+            return iTone;
+            }
+        virtual const TProfileToneSettings& ToneSettings() const 
+            {
+            //DONE: Return TProfileToneSettings
+            return iToneSettings;
+            }
+    private:
+        TProfileToneSettings iToneSettings;
+        TBuf<256> iTone;
+    };
+
+class CMocProFile : public MProfile
+    {
+    public:
+        static CMocProFile* NewLC()
+            {
+            CMocProFile* self = new( ELeave ) CMocProFile;
+            CleanupStack::PushL( self );
+            self->ConstructL();
+            return self;
+            }
+        virtual ~CMocProFile() {}
+    protected:
+        CMocProFile() {}
+        void ConstructL()
+            {
+            iTones = new(ELeave) CMocProfileTones;
+            }
+
+    public: // New functions
+        virtual void Release() {}
+        virtual const TArray<TContactItemId> AlertForL() {}
+        virtual TBool IsSilent() const { return EFalse; }
+        virtual const MProfileName& ProfileName() const {}
+        virtual const MProfileTones& ProfileTones() const 
+            {
+            //DONE: return an MProfileTones object
+            return *iTones;
+            }
+        virtual const MProfileExtraTones& ProfileExtraTones() const {}
+        virtual const MProfileExtraSettings& ProfileExtraSettings() const {}
+        
+    private:
+        MProfileTones* iTones;
+    };
+
+class CMocProfileEngine : public MProfileEngine
+    {
+    public:
+        CMocProfileEngine() {};
+        virtual ~CMocProfileEngine() {};
+    public:
+        virtual void Release() {};
+        virtual MProfile* ActiveProfileLC()
+            {
+            //DONE: Create an MProfile object
+            MProfile* pf = CMocProFile::NewLC();
+            return pf;
+            }
+        virtual MProfile* ActiveProfileL() { return NULL; };
+        virtual TInt ActiveProfileId() { return 0; };
+        virtual MProfilesNamesArray* ProfilesNamesArrayLC() { return NULL; };
+        virtual void SetActiveProfileL( TInt /*aId*/ ) {};
+        virtual void SetTempRingingVolumeL( TProfileRingingVolume /*aVolume*/ ) {};
+        virtual TProfileRingingVolume TempRingingVolumeL() const {
+            return EProfileRingingVolumeLevel1; 
+        }
+        virtual void SetTempMediaVolumeL( TProfileRingingVolume /*aVolume*/ ) {};
+        virtual TProfileRingingVolume TempMediaVolumeL() const {
+            return EProfileRingingVolumeLevel1; 
+        }
+        virtual TBool IsFeatureSupported(
+            TProfileFeatureId /*aFeatureId*/ ) const { return EFalse; };
+        virtual TBool IsActiveProfileTimedL() { return EFalse; };
+
+    };
+
+// ----------------------------------------------------------------------------
+// CreateProfileEngineL moc
+// create profile engine
+// ----------------------------------------------------------------------------
+//
+//MProfileEngine* CreateProfileEngineL()
+//    {
+//    
+//    MProfileEngine* pe = new( ELeave ) CMocProfileEngine;
+//    return pe;
+//    }
+
+// End of file
+
--- a/satui/satapp/tsrc/ut_satapp/ut_satapp.pro	Tue Jul 06 14:53:02 2010 +0300
+++ b/satui/satapp/tsrc/ut_satapp/ut_satapp.pro	Wed Jul 21 18:26:52 2010 +0300
@@ -15,69 +15,71 @@
 #
 
 TEMPLATE = app
-TARGET = utsatapp
+TARGET = ut_satapp
 DEPENDPATH += .
 INCLUDEPATH += .
 CONFIG += hb
 CONFIG += qtestlib
 HEADERS += $$PUBLIC_HEADERS
-MOC_DIR = moc_utsatapp
+MOC_DIR = moc
 
 symbian {
-    TARGET.CAPABILITY = CAP_GENERAL_DLL
-    INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE \
-                   .inc \
-                    ../../../../inc \
-                    .MOC_DIR 
+    TARGET.CAPABILITY = CAP_APPLICATION
+}
+
+INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE \
+               $$MOC_DIR \
+               ../../../../inc \
+               ../../inc
 
-    LIBS += -lSatClient.dll \
-            -lSatInternalClient.dll \
-            -legul.dll \
-            -lfbscli.dll \
-            -lcentralrepository.dll \
-            -lCenRepNotifHandler.dll \
-            -lCdlEngine.dll \
-            -lFlogger.dll \
-            -lbafl.dll \
-            -lprofileeng.dll 
+LIBS += -legul \
+        -lfbscli \
+        -lcentralrepository \
+        -lCenRepNotifHandler \
+        -lCdlEngine \
+        -lbafl \
+        -lmediaclientaudio \
+        -lprofileeng \
+        -lFlogger
 
-    HEADERS += ../../inc \
-               ../../inc/msatuiactionimplementer.h \
-               ../../inc/satappcommonconstant.h \
-               ../../inc/tflogger.h \
-               ../../inc/satappmainhandler.h \
-               ../../inc/csatuiobserver.h\
-               ../../inc/satappcommandhandler.h \
-               ../../inc/satappeventprovider.h \
-               ../../inc/satappuiprovider.h \
-               ../../inc/satappview.h \
-               ../../inc/satappgetinkeynote.h \
-               ../../inc/csatuiobserver.h \
-               ../../inc/csatuiiconhandler.h \
-               ../../inc/satappplaytoneprovider.h \
-               inc/dummyeventprovider.h \
-               inc/dummyplaytoneprovider.h \
-               inc/ut_satappmainhandler.h \
-               inc/ut_csatuiobserver.h \
-               inc/ut_satappeventhandler.h \
-               inc/ut_playtoneprovider.h 
+HEADERS += ../../inc \
+           ../../inc/satappmainhandler.h \
+           ../../inc/satappserverdispatcher.h \
+           ../../inc/satappmenuprovider.h \
+           ../../inc/satappinputprovider.h \
+           ../../inc/satapptoneprovider.h \
+           ../../inc/satapppopupprovider.h \
+           ../../inc/satappconfirmprovider.h \
+           ../../inc/satappaction.h \
+           ../../inc/satappconstant.h \
+           inc/ut_satappmainhandler.h \
+           inc/ut_satappserverdispatcher.h \
+           inc/ut_satappmenuprovider.h \
+           inc/ut_satappinputprovider.h \
+           inc/ut_satapptoneprovider.h \
+           inc/ut_satapppopupprovider.h \
+           inc/ut_satappconfirmprovider.h \
+           inc/ut_satappaction.h
 
 
-    SOURCES +=  ../../src/csatuiobserver.cpp \
-               ../../src/satappmainhandler.cpp \
-               ../../src/satappcommandhandler.cpp \
-               ../../src/satappuiprovider.cpp \
-               ../../src/satappeventprovider.cpp \
-               ../../src/satappview.cpp \
-               ../../src/satappgetinkeynote.cpp \
-               ../../src/csatuiiconhandler.cpp\
-               ../../src/satappplaytoneprovider.cpp\
-               src/main.cpp \
-               src/dummyeventprovider.cpp \
-               src/dummyplaytoneprovider.cpp \
-               src/ut_satappmainhandler.cpp \
-               src/ut_csatuiobserver.cpp \
-               src/ut_satappeventhandler.cpp \
-               src/ut_playtoneprovider.cpp 
+SOURCES += ../../src/satappmainhandler.cpp \
+           ../../src/satappserverdispatcher.cpp \
+           ../../src/satappmenuprovider.cpp \
+           ../../src/satappinputprovider.cpp \
+           ../../src/satapptoneprovider.cpp \
+           ../../src/satapppopupprovider.cpp \
+           ../../src/satappconfirmprovider.cpp \
+           ../../src/satappaction.cpp \
+           src/main.cpp \
+           src/ut_satappmainhandler.cpp \
+           src/ut_satappserverdispatcher.cpp \
+           src/ut_satappmenuprovider.cpp \
+           src/ut_satappinputprovider.cpp \
+           src/ut_satapptoneprovider.cpp \
+           src/ut_satapppopupprovider.cpp \
+           src/ut_satappconfirmprovider.cpp \
+           src/ut_satappaction.cpp \
+           src/rsat_stub.cpp
 
-}
+RESOURCES += ../../resource/satapp.qrc
+
--- a/telutils/dialpad/bwins/dialpadu.def	Tue Jul 06 14:53:02 2010 +0300
+++ b/telutils/dialpad/bwins/dialpadu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -61,4 +61,5 @@
 	?metaObject@DialpadKeyHandler@@UBEPBUQMetaObject@@XZ @ 60 NONAME ; struct QMetaObject const * DialpadKeyHandler::metaObject(void) const
 	??0DialpadKeyHandler@@QAE@PAVDialpad@@AAVHbMainWindow@@PAVQObject@@@Z @ 61 NONAME ; DialpadKeyHandler::DialpadKeyHandler(class Dialpad *, class HbMainWindow &, class QObject *)
 	?isCallButtonEnabled@Dialpad@@QBE_NXZ @ 62 NONAME ; bool Dialpad::isCallButtonEnabled(void) const
+	?changeEvent@Dialpad@@MAEXPAVQEvent@@@Z @ 63 NONAME ; void Dialpad::changeEvent(class QEvent *)
 
--- a/telutils/dialpad/dialpad.pro	Tue Jul 06 14:53:02 2010 +0300
+++ b/telutils/dialpad/dialpad.pro	Wed Jul 21 18:26:52 2010 +0300
@@ -37,7 +37,8 @@
            inc/dialpadvideomailboxeventfilter.h \
            inc/dialpadmailboxeventfilterbase.h \
            inc/dialpademergencycalleventfilter.h \
-           inc/dialpadhasheventfilter.h
+           inc/dialpadhasheventfilter.h \
+           inc/dialpadnumericbutton.h
 
 SOURCES += src/dialpad.cpp \
            src/dialpadbutton.cpp \
@@ -54,7 +55,8 @@
            src/dialpadmailboxeventfilterbase.cpp \
            src/dialpademergencycalleventfilter.cpp \
            src/dialpadvtkeyhandler.cpp \
-           src/dialpadhasheventfilter.cpp
+           src/dialpadhasheventfilter.cpp \
+	   src/dialpadnumericbutton.cpp
 
 RESOURCES += dialpad.qrc
 
--- a/telutils/dialpad/eabi/dialpadu.def	Tue Jul 06 14:53:02 2010 +0300
+++ b/telutils/dialpad/eabi/dialpadu.def	Wed Jul 21 18:26:52 2010 +0300
@@ -68,4 +68,5 @@
 	_ZThn8_N7DialpadD0Ev @ 67 NONAME
 	_ZThn8_N7DialpadD1Ev @ 68 NONAME
 	_ZNK7Dialpad19isCallButtonEnabledEv @ 69 NONAME
+	_ZN7Dialpad11changeEventEP6QEvent @ 70 NONAME
 
--- a/telutils/dialpad/inc/dialpadkeypad.h	Tue Jul 06 14:53:02 2010 +0300
+++ b/telutils/dialpad/inc/dialpadkeypad.h	Wed Jul 21 18:26:52 2010 +0300
@@ -18,10 +18,13 @@
 #ifndef DIALPADKEYPAD_H
 #define DIALPADKEYPAD_H
 
+#include <QTextLayout>
+#include <QColor>
 #include <hbinputbuttongroup.h>
 
 class DialpadInputField;
 class DialpadButton;
+class DialpadNumericButton;
 class QSignalMapper;
 class QGraphicsGridLayout;
 
@@ -53,10 +56,44 @@
     void sendLongPressEvent(const QKeyEvent& event);
     void handleKeyChangeEvent(const QKeyEvent& releaseEvent,
                               const QKeyEvent& pressEvent);
+    void cancelButtonPress();
+
+protected:
+    void postKeyEvent(QEvent::Type type, int key);
+    void sendKeyEventToEditor(QEvent::Type type, int key);
+
+    inline DialpadNumericButton* button(int i) const;
+    void updateButtonLabels();
+    void updateColorArray();
+    void updateIconColor();
+    void updateTextLayouts(const QSizeF &size);
+    void resolveTextContent(QList<QString> &content);
+    void createTextLayouts(const QSizeF &size,
+                           const QList<QString> &content);
+    void layoutTextLines(const QSizeF &size,
+                         QTextLayout &textLayout,
+                         int state,
+                         int type);
+
+protected:
+    void paint(QPainter* painter,
+               const QStyleOptionGraphicsItem* option,
+               QWidget* widget);
+    void setGeometry(const QRectF &rect);
+    void changeEvent(QEvent *event);
 
 private:
-    void postKeyEvent(QEvent::Type type, int key);
-    void sendKeyEventToEditor(QEvent::Type type, int key);
+    enum ButtonState {
+        Normal = 0,
+        Pressed,
+        StateCount
+    };
+
+    enum TextType {
+        PrimaryText = 0,
+        SecondaryText,
+        TextTypeCount
+    };
 
 private:
     const HbMainWindow& mMainWindow;
@@ -65,6 +102,10 @@
     QMap<int,QChar> mGeneratedChar;
     int mPressedNumericKey;
     DialpadButton* mCallButton;
+    QList<QColor> mColors;
+    QList<QTextLayout*> mTextLayouts;
+    qreal mUnit;
+    qreal mMaxPrimaryLineWidth;
 };
 
 #endif // DIALPADKEYPAD_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/dialpad/inc/dialpadnumericbutton.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,47 @@
+/*!
+* 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: Extends HbInputButton
+*
+*/
+
+#ifndef DIALPADNUMERICBUTTON_H
+#define DIALPADNUMERICBUTTON_H
+
+#include <hbicon.h>
+#include <hbinputbutton.h>
+
+class DialpadNumericButton : public HbInputButton
+{
+    Q_OBJECT
+
+public:
+    explicit DialpadNumericButton(int keyCode, const QPoint &position, const QSize &size = QSize(1, 1));
+    virtual ~DialpadNumericButton();
+
+    void setIcon(const HbIcon& icon);
+    HbIcon& icon();
+
+    void setText(const QString& text);
+    QString text() const;
+
+    void setSecondaryText(const QString& text);
+    QString secondaryText() const;
+
+private:
+    HbIcon mIcon;
+    QString mText;
+    QString mSecondaryText;
+};
+
+#endif // DIALPADNUMERICBUTTON_H
--- a/telutils/dialpad/resources/dialpad.css	Tue Jul 06 14:53:02 2010 +0300
+++ b/telutils/dialpad/resources/dialpad.css	Wed Jul 21 18:26:52 2010 +0300
@@ -15,6 +15,6 @@
     left: -var(hb-param-margin-gene-middle-horizontal);
     right: var(hb-param-margin-gene-middle-horizontal);
     top: -var(hb-param-margin-gene-middle-vertical);
-    bottom: var(hb-param-margin-gene-middle-vertical);;
+    bottom: var(hb-param-margin-gene-middle-vertical);
 }
 
--- a/telutils/dialpad/src/dialpad.cpp	Tue Jul 06 14:53:02 2010 +0300
+++ b/telutils/dialpad/src/dialpad.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -27,6 +27,7 @@
 #include <hbapplication.h>
 #include <hbswipegesture.h>
 #include <hbeffect.h>
+#include <hbevent.h>
 
 #include "dialpad.h"
 #include "dialpadinputfield.h"
@@ -45,8 +46,8 @@
 static const qreal DialpadComponentMargin = 0.75; // units
 static const qreal DialpadCloseHandleHeight = 2.23; // units
 static const qreal DialpadCloseHandleWidth = 18.8; // units
-static const qreal DialpadCallButtonHeight = 8.0; // units
-static const qreal DialpadCallButtonHeightH = 6.0; // units
+static const qreal DialpadCallButtonHeight = 8.75; // units, same as numeric buttons
+static const qreal DialpadCallButtonHeightH = 7.25; // units
 
 static const QLatin1String handsetIcon("qtg_mono_call");
 static const QLatin1String vmbxIcon("qtg_mono_voice_mailbox");
@@ -113,7 +114,8 @@
     popupLayout->addItem(mKeypad);
     popupLayout->addItem(&mKeypad->callButton());
     popupLayout->setContentsMargins(margin, mCloseHandleHeight, margin, margin);
-    popupLayout->setSpacing(margin);
+    popupLayout->setSpacing(0);
+    popupLayout->setItemSpacing(0,margin);
     setLayout(popupLayout);
 
     // asterisk multitap handler
@@ -214,6 +216,16 @@
     mIconDrawer->paint(painter, rect);
 }
 
+void Dialpad::changeEvent(QEvent *event)
+{
+    if (event->type() == QEvent::LayoutDirectionChange) {
+        mBackgroundDrawer->setLayoutDirection(layoutDirection());
+    } else if (event->type() == HbEvent::ThemeChanged) {
+        mBackgroundDrawer->themeChanged();
+        mIconDrawer->themeChanged();
+    }
+}
+
 bool Dialpad::isOpen() const
 {
     return mIsOpen;
--- a/telutils/dialpad/src/dialpadbluetootheventfilter.cpp	Tue Jul 06 14:53:02 2010 +0300
+++ b/telutils/dialpad/src/dialpadbluetootheventfilter.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -44,18 +44,17 @@
 bool DialpadBluetoothEventFilter::eventFilter(QObject *watched, QEvent *event)
 {
     Q_UNUSED(watched)
-    QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
-    const int keyCode = keyEvent->key();
-    const int eventType = event->type();
-
-    if (eventType == QEvent::KeyPress && keyCode == Qt::Key_Asterisk) {
-        if (!(mDialpad->editor().text().length() >= 1)) {
+            
+    if (event->type() == QEvent::KeyPress) {
+        QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
+        if (keyEvent->key() == Qt::Key_Asterisk && 
+            !(mDialpad->editor().text().length() >= 1)) {
             //Check that there is only one item in dialpad, if there is more than one
             //do not handle long key press.
             mLongPressTimer->stop();
             mLongPressTimer->start(DialpadLongKeyPressTimeOut);
         }
-    } else if (eventType == QEvent::KeyRelease) {
+    } else if (event->type() == QEvent::KeyRelease) {
             mLongPressTimer->stop();
     }
 
--- a/telutils/dialpad/src/dialpademergencycalleventfilter.cpp	Tue Jul 06 14:53:02 2010 +0300
+++ b/telutils/dialpad/src/dialpademergencycalleventfilter.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -23,8 +23,6 @@
 
 #ifdef Q_OS_SYMBIAN
 #include <cphcltemergencycall.h>
-#include <xqservicerequest.h>
-#include <xqserviceutil.h>
 #include <phclttypes.h>
 #endif //Q_OS_SYMBIAN
 
--- a/telutils/dialpad/src/dialpadhasheventfilter.cpp	Tue Jul 06 14:53:02 2010 +0300
+++ b/telutils/dialpad/src/dialpadhasheventfilter.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -38,20 +38,18 @@
     Q_UNUSED(watched)
     bool keyEventEaten(false);
 
-    QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
-    const int keyCode = keyEvent->key();
-    const int eventType = event->type();
-        
-    if (eventType == QEvent::KeyPress) {
-        if ((isLongKeyPressSupported(keyCode)) &&
-                !(mDialpad->editor().text().length() >= 1)) {
+    if (event->type() == QEvent::KeyPress) {
+        QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);        
+        if ((isLongKeyPressSupported(keyEvent->key())) &&
+            !(mDialpad->editor().text().length() >= 1)) {
             //Check that there is only one item in dialpad, if there is more than one
             //do not handle long key press.
             mLongPressTimer->stop();
             mLongPressTimer->start(DialpadLongKeyPressTimeOut);
         }
-    } else if (eventType == QEvent::KeyRelease) {
-        if (isLongKeyPressSupported(keyCode)){
+    } else if (event->type() == QEvent::KeyRelease) {
+        QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
+        if (isLongKeyPressSupported(keyEvent->key())){
             mLongPressTimer->stop();
         }
     }
--- a/telutils/dialpad/src/dialpadkeypad.cpp	Tue Jul 06 14:53:02 2010 +0300
+++ b/telutils/dialpad/src/dialpadkeypad.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -25,9 +25,12 @@
 #include <hbinputsettingproxy.h>
 #include <hbinputlanguage.h>
 #include <hbapplication.h>
+#include <hbcolorscheme.h>
 #include <hblineedit.h>
-#include <hbinputbutton.h>
+#include <hbfontspec.h>
+#include <hbevent.h>
 
+#include "dialpadnumericbutton.h"
 #include "dialpadkeypad.h"
 #include "dialpadbutton.h"
 #include "dialpadinputfield.h"
@@ -36,7 +39,12 @@
 static const int DialpadColumnCount = 3;
 static const QLatin1String handsetIcon("qtg_mono_call");
 static const QLatin1String vmbxIcon("qtg_mono_voice_mailbox");
-static const qreal DialpadKeypadBorderWidth = 0.25;
+// layout values in units
+static const qreal DialpadPrimaryTextSize = 5.5;
+static const qreal DialpadSecondaryTextSize = 4.0;
+static const qreal DialpadIconSize = 4.0;
+static const qreal DialpadPrimaryTextLeftMargin  = 1.5;
+static const qreal DialpadPrimarySecondaryMargin  = 0.75;
 
 static const int DialpadKeyCodeTable[DialpadRowCount*DialpadColumnCount] =
 {
@@ -53,7 +61,8 @@
     QGraphicsItem* parent) :
     HbInputButtonGroup(parent),
     mMainWindow(mainWindow),
-    mInputField(inputField)
+    mInputField(inputField),
+    mMaxPrimaryLineWidth(0)
 {
     setObjectName("keypad");
 
@@ -70,12 +79,12 @@
 
     // create keypad
     setGridSize(QSize(DialpadColumnCount, DialpadRowCount));
-    setButtonBorderSize(DialpadKeypadBorderWidth);
+    setButtonBorderSize(0);    
 
     QList<HbInputButton*> buttons;
 
     for (int i = 0; i < DialpadRowCount * DialpadColumnCount; ++i) {
-        HbInputButton *item = new HbInputButton(
+        DialpadNumericButton *item = new DialpadNumericButton(
             DialpadKeyCodeTable[i],
             QPoint(i % DialpadColumnCount, i / DialpadColumnCount));
         buttons.append(item);
@@ -114,13 +123,16 @@
     // set button texts
     setButtonTexts();
     // set button icons
-    button(0)->setIcon(HbIcon(vmbxIcon),
-        HbInputButton::ButtonIconIndexSecondaryFirstRow);
+    button(0)->setIcon(HbIcon(vmbxIcon));
 
     // update button texts when input language is changed
     connect(HbInputSettingProxy::instance(),
             SIGNAL(globalInputLanguageChanged(HbInputLanguage)),
             this,SLOT(setButtonTexts()));
+
+    updateColorArray();
+
+    mUnit = HbDeviceProfile::profile(this).unitValue();
 }
 
 DialpadKeypad::~DialpadKeypad()
@@ -144,10 +156,8 @@
             if (keyCode == Qt::Key_Asterisk) {
                 // asterisk is not localized
                 QChar asterisk('*');
-                button(i)->setText(asterisk,
-                    HbInputButton::ButtonTextIndexPrimary);
-                button(i)->setText("+",
-                    HbInputButton::ButtonTextIndexSecondaryFirstRow);
+                button(i)->setText(asterisk);
+                button(i)->setSecondaryText(QLatin1String("+"));
                 mGeneratedChar.insert(Qt::Key_Asterisk, asterisk);
                 continue;
             }
@@ -155,10 +165,7 @@
             if (keyCode == Qt::Key_NumberSign) {
                 // number sign is not localized
                 QChar numberSign('#');
-                button(i)->setText(numberSign,
-                    HbInputButton::ButtonTextIndexPrimary);
-                button(i)->setText(" ",
-                    HbInputButton::ButtonTextIndexSecondaryFirstRow);
+                button(i)->setText(numberSign);
                 mGeneratedChar.insert(Qt::Key_NumberSign, numberSign);
                 continue;
             }
@@ -175,11 +182,11 @@
                 QChar numberChar =
                     HbInputUtils::findFirstNumberCharacterBoundToKey(
                         key,
-                        inputLanguage.language());
+                        inputLanguage.language(),
+                        HbInputUtils::inputDigitType(inputLanguage.language()));
 
                 // button text
-                button(i)->setText(numberChar,
-                    HbInputButton::ButtonTextIndexPrimary);
+                button(i)->setText(numberChar);
                 mGeneratedChar.insert(keyCode,numberChar);
 
                 // additional text (letters)
@@ -194,12 +201,8 @@
 
                 QString characters = key->characters(HbModifierNone);
 
-                if (numberOfCharacters==0 && keyCode!=Qt::Key_1) {
-                    button(i)->setText(" ",
-                        HbInputButton::ButtonTextIndexSecondaryFirstRow);
-                } else {
-                    button(i)->setText(characters.left(numberOfCharacters),
-                        HbInputButton::ButtonTextIndexSecondaryFirstRow);
+                if (numberOfCharacters!=0 && keyCode!=Qt::Key_1) {
+                    button(i)->setSecondaryText(characters.left(numberOfCharacters));
                 }
             }
         }
@@ -229,6 +232,7 @@
 
 void DialpadKeypad::sendKeyPressEvent(const QKeyEvent& event)
 {
+    updateButtonLabels();
     mPressedNumericKey = event.key();
     postKeyEvent(QEvent::KeyPress, event.key());
 }
@@ -246,7 +250,6 @@
 void DialpadKeypad::sendLongPressEvent(const QKeyEvent& event)
 {
     sendKeyEventToEditor(QEvent::KeyPress, event.key());
-    resetButtons();
     mPressedNumericKey = 0;
 }
 
@@ -275,3 +278,298 @@
 {
     return *mCallButton;
 }
+
+DialpadNumericButton* DialpadKeypad::button(int i) const
+{
+    return static_cast<DialpadNumericButton*>(HbInputButtonGroup::button(i));
+}
+
+void DialpadKeypad::updateButtonLabels()
+{
+    // update numeric buttons according to button state (pressed/released)
+    updateIconColor();
+    updateTextLayouts(rect().size());
+}
+
+void DialpadKeypad::paint(
+    QPainter* painter,
+    const QStyleOptionGraphicsItem* option,
+    QWidget* widget)
+{
+    Q_UNUSED(option);
+    Q_UNUSED(widget);
+
+    // Paints empty buttons
+    HbInputButtonGroup::paint(painter,option,widget);
+
+    qreal cellWidth = boundingRect().width() / gridSize().width();
+    qreal cellHeight = boundingRect().height() / gridSize().height();
+
+    // Draw icons
+    for (int i = 0; i < DialpadRowCount * DialpadColumnCount; i++) {
+        DialpadNumericButton *item = button(i);
+
+        if (!item->icon().isNull()) {
+            // icon is centered to button
+            qreal x = (item->position().x() * cellWidth) + (cellWidth / 2) -
+                      ((DialpadIconSize * mUnit) / 2);
+            qreal y = (item->position().y() * cellHeight) +  (cellHeight / 2) -
+                      ((DialpadIconSize * mUnit) / 2);
+
+            qreal width = DialpadIconSize * mUnit;
+            qreal height = DialpadIconSize * mUnit;
+
+            Qt::Alignment alignment =
+                static_cast<Qt::Alignment>(Qt::AlignVCenter | Qt::AlignHCenter);
+            item->icon().paint(painter,
+                               QRectF(x,y,width,height),
+                               Qt::KeepAspectRatio,
+                               alignment);
+        }                      
+    }
+
+    // Draw texts
+    QPen origPen = painter->pen();
+    for (int i = 0; i < mTextLayouts.count(); ++i) {
+        if (i==SecondaryText) {
+            // dimmed in normal state
+            painter->setPen(mColors.at(Pressed+1));
+        } else {
+            // otherwise normal or pressed color
+            painter->setPen(mColors.at(i/TextTypeCount));
+        }
+        mTextLayouts.at(i)->draw(painter, QPointF(0, 0));
+    }
+    painter->setPen(origPen);
+}
+
+void DialpadKeypad::updateColorArray()
+{
+    mColors.clear();
+
+    QColor normalColor = HbColorScheme::color("qtc_input_button_normal");
+    mColors.insert(Normal, normalColor);
+
+    QColor pressedColor = HbColorScheme::color("qtc_input_button_pressed");
+    mColors.insert(Pressed, pressedColor);
+
+    // this is used for alphabets shown dimmed, use alpha until exact color
+    // is specified
+    QColor disabledColor = HbColorScheme::color("qtc_input_button_normal");
+    disabledColor.setAlpha(128);
+    mColors.insert(Pressed+1, disabledColor);
+}
+
+void DialpadKeypad::updateIconColor()
+{
+    for (int i = 0; i < (DialpadRowCount * DialpadColumnCount); i++) {
+        DialpadNumericButton *item = button(i);
+
+        if (item->state()==HbInputButton::ButtonStatePressed) {
+            item->icon().setColor(mColors.at(Pressed));
+        } else {
+            item->icon().setColor(mColors.at(Normal));
+        }
+    }
+}
+
+void DialpadKeypad::cancelButtonPress()
+{
+    HbInputButtonGroup::cancelButtonPress();
+    updateButtonLabels();
+}
+
+void DialpadKeypad::setGeometry(const QRectF &rect)
+{
+    HbInputButtonGroup::setGeometry(rect);
+    updateTextLayouts(rect.size());
+}
+
+void DialpadKeypad::changeEvent(QEvent *event)
+{
+    HbInputButtonGroup::changeEvent(event);
+
+    if (event->type() == HbEvent::ThemeChanged) {
+        updateColorArray();
+        updateIconColor();
+    }
+}
+
+void DialpadKeypad::updateTextLayouts(const QSizeF &size)
+{
+    if (!size.width() && !size.height()) {
+        return;
+    }
+
+    // get normal and pressed state texts
+    QList<QString> textContent;
+    resolveTextContent(textContent);
+
+    // layout the texts
+    createTextLayouts(size, textContent);
+}
+
+void DialpadKeypad::resolveTextContent(QList<QString> &content)
+{
+    QString normalState;
+    QString normalStateSecondary;
+    QString pressedState;
+    QString pressedStateSecondary;
+
+    for (int i = 0; i < (DialpadRowCount*DialpadColumnCount); i++) {
+        DialpadNumericButton *item = button(i);
+        if (item->state()==HbInputButton::ButtonStatePressed) {
+            if (item->text().length()) {
+                pressedState.append(item->text());
+                pressedState.append(QChar(QChar::LineSeparator));
+            }
+
+            if (item->secondaryText().length()) {
+                pressedStateSecondary.append(item->secondaryText());
+                pressedStateSecondary.append(QChar(QChar::LineSeparator));
+            }
+        } else { // ButtonStateNormal
+            if (item->text().length()) {
+                normalState.append(item->text());
+                normalState.append(QChar(QChar::LineSeparator));
+            }
+
+            if (item->secondaryText().length()) {
+                normalStateSecondary.append(item->secondaryText());
+                normalStateSecondary.append(QChar(QChar::LineSeparator));
+            }
+        }
+    }
+
+    content.insert(PrimaryText, normalState);
+    content.insert(SecondaryText, normalStateSecondary);
+    content.insert(TextTypeCount + Pressed, pressedState);
+    content.insert(StateCount + SecondaryText, pressedStateSecondary);
+}
+
+void DialpadKeypad::createTextLayouts(
+    const QSizeF &size, const QList<QString> &content)
+{
+    // clear old layouts
+    qDeleteAll(mTextLayouts);
+    mTextLayouts.clear();
+
+    if (content.count()==2) {
+        // line width is measured only when all buttons are in normal state
+        mMaxPrimaryLineWidth = 0;
+    }
+
+    QFont primaryfFont = HbFontSpec(HbFontSpec::Primary).font();
+    primaryfFont.setPixelSize(DialpadPrimaryTextSize * mUnit);
+
+    QFont secondaryFont = HbFontSpec(HbFontSpec::Secondary).font();
+    secondaryFont.setPixelSize(DialpadSecondaryTextSize * mUnit);
+
+    for (int i=0; i < (StateCount*TextTypeCount); i++ ) {
+        QString text = content.at(i);
+
+        if (!text.isNull()) {
+            QTextLayout* textLayout;
+            int type;
+
+            if (i%TextTypeCount) {
+                textLayout = new QTextLayout(text,secondaryFont);
+                type = SecondaryText;
+            } else {
+                textLayout = new QTextLayout(text,primaryfFont);
+                type = PrimaryText;
+            }
+
+            mTextLayouts.append(textLayout);
+
+            textLayout->beginLayout();
+
+            int state = (i>=TextTypeCount) ? Pressed : Normal;
+
+            layoutTextLines(size,*textLayout,state,type);
+
+            textLayout->endLayout();
+
+            textLayout->setCacheEnabled(true);
+        }
+    }
+}
+
+void DialpadKeypad::layoutTextLines(
+    const QSizeF &size,
+    QTextLayout &textLayout,
+    int state,
+    int type)
+{
+    QFontMetricsF fontMetrics(textLayout.font());
+    qreal textHeight = fontMetrics.height();
+
+    qreal cellWidth = size.width() / gridSize().width();
+    qreal cellHeight = size.height() / gridSize().height();
+    qreal maxLineWidth = 0;
+
+    for (int j = 0; j < (DialpadRowCount*DialpadColumnCount); j++) {
+        DialpadNumericButton *item = button(j);
+
+        if ((type==PrimaryText && item->text().isNull()) ||
+            (type==SecondaryText && item->secondaryText().isNull())) {
+            continue; // no text for this button -> next button
+        }
+
+        if ( ( state==Normal &&
+               item->state()==HbInputButton::ButtonStateReleased ) ||
+             ( state==Pressed &&
+               item->state()==HbInputButton::ButtonStatePressed ) ) {
+
+            QTextLine line = textLayout.createLine();
+
+            qreal textPositionX = 0;
+            qreal textPositionY = 0;
+
+            if (line.isValid()) {
+                line.setNumColumns(item->text().length());
+                // layout text line
+                if (type==SecondaryText) {
+                    if (j==9) {
+                        // + is centered to button
+                        qreal lineWidth = fontMetrics.width(item->text());
+                        textPositionX = (item->position().x() * cellWidth) +
+                                        (cellWidth / 2) -
+                                        (lineWidth / 2);
+                        textPositionY = (item->position().y() +
+                                        (0.5 * item->size().height())) *
+                                        cellHeight - (0.5 * textHeight);
+
+                    } else {
+                        textPositionX = (item->position().x() * cellWidth) +
+                                        (DialpadPrimaryTextLeftMargin * mUnit) +
+                                        mMaxPrimaryLineWidth +
+                                        (DialpadPrimarySecondaryMargin * mUnit)
+                                        + buttonBorderSize();
+                        textPositionY = (item->position().y() +
+                                        (0.5 * item->size().height())) *
+                                        cellHeight - (0.5 * textHeight);
+                    }                    
+                } else {
+                    textPositionX = (item->position().x() * cellWidth) +
+                                    (DialpadPrimaryTextLeftMargin * mUnit)
+                                    + buttonBorderSize();
+                    textPositionY = (item->position().y() +
+                                    (0.5 * item->size().height())) *
+                                    cellHeight - (0.5 * textHeight);
+
+                    // store line width, for drawing secondary text
+                    qreal lineWidth = fontMetrics.width(item->text());
+                    if (mMaxPrimaryLineWidth == 0 && (j>0 && j<10) &&
+                        lineWidth > maxLineWidth) {
+                        maxLineWidth = lineWidth;
+                    }
+                }
+            }
+
+            line.setPosition(QPointF(textPositionX, textPositionY));
+        }
+    }
+
+    mMaxPrimaryLineWidth = maxLineWidth;
+}
--- a/telutils/dialpad/src/dialpadkeysequenceeventfilter.cpp	Tue Jul 06 14:53:02 2010 +0300
+++ b/telutils/dialpad/src/dialpadkeysequenceeventfilter.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -57,33 +57,32 @@
     Q_UNUSED(watched)
     
     const bool eventFiltered = false;
-#ifdef Q_OS_SYMBIAN
-    QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
-    const int keyCode = keyEvent->key();
-    const int eventType = event->type();
-    
+#ifdef Q_OS_SYMBIAN    
     // Code is executed after '#' is pressed as specified in Dialer UI 
     // specification.
-    QString keySequenceCandidate = HbStringUtil::convertDigitsTo(
-        mDialpad->editor().text(), WesternDigit);
-    if (QEvent::KeyRelease == eventType && Qt::Key_NumberSign == keyCode) {
-        XQAiwInterfaceDescriptor keySequenceHandler = 
-            findKeySequenceHandler(keySequenceCandidate);
-        if (keySequenceHandler.isValid()) {
-            QScopedPointer<XQAiwRequest> request(mAiwMgr.create(
-                keySequenceHandler, 
-                "executeKeySequence(QString)",
-                false));
-            request->setSynchronous(true);
-            request->setBackground(true);
-            QList<QVariant> arguments;
-            arguments << keySequenceCandidate;
-            request->setArguments(arguments);
-            
-            QVariant keySequenceProcessed;
-            bool requestOk = request->send(keySequenceProcessed);
-            if (requestOk && keySequenceProcessed.toBool()) {
-                mDialpad->editor().setText(QString(""));
+    if (QEvent::KeyRelease == event->type()){
+        QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
+        if (Qt::Key_NumberSign == keyEvent->key())  {        
+            QString keySequenceCandidate = HbStringUtil::convertDigitsTo(
+                mDialpad->editor().text(), WesternDigit);
+            XQAiwInterfaceDescriptor keySequenceHandler = 
+                findKeySequenceHandler(keySequenceCandidate);
+            if (keySequenceHandler.isValid()) {
+                QScopedPointer<XQAiwRequest> request(mAiwMgr.create(
+                    keySequenceHandler, 
+                    "executeKeySequence(QString)",
+                    false));
+                request->setSynchronous(true);
+                request->setBackground(true);
+                QList<QVariant> arguments;
+                arguments << keySequenceCandidate;
+                request->setArguments(arguments);
+                
+                QVariant keySequenceProcessed;
+                bool requestOk = request->send(keySequenceProcessed);
+                if (requestOk && keySequenceProcessed.toBool()) {
+                    mDialpad->editor().setText(QString(""));
+                }
             }
         }
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/dialpad/src/dialpadnumericbutton.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,59 @@
+/*!
+* 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: Extends HbInputButton
+*
+*/
+
+
+#include "dialpadnumericbutton.h"
+
+DialpadNumericButton::DialpadNumericButton(
+    int keyCode, const QPoint &position, const QSize &size)
+    : HbInputButton(keyCode, position, size)
+{
+}
+
+DialpadNumericButton::~DialpadNumericButton()
+{
+}
+
+void DialpadNumericButton::setIcon(const HbIcon& icon)
+{
+    mIcon = icon;
+}
+
+HbIcon& DialpadNumericButton::icon()
+{
+    return mIcon;
+}
+
+void DialpadNumericButton::setText(const QString& text)
+{
+    mText = text;
+}
+
+QString DialpadNumericButton::text() const
+{
+    return mText;
+}
+
+void DialpadNumericButton::setSecondaryText(const QString& text)
+{
+    mSecondaryText = text;
+}
+
+QString DialpadNumericButton::secondaryText() const
+{
+    return mSecondaryText;
+}
--- a/telutils/dialpad/src/dialpadvideomailboxeventfilter.cpp	Tue Jul 06 14:53:02 2010 +0300
+++ b/telutils/dialpad/src/dialpadvideomailboxeventfilter.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -43,25 +43,23 @@
 {
     Q_UNUSED(watched)
     bool keyEventEaten(false);
-    
-    QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
-    const int keyCode = keyEvent->key();
-    const int eventType = event->type();
-
-    if (eventType == QEvent::KeyPress) {
-        if (checkIfSendEventAndConsumeEvent(keyCode, eventType)) {
+        
+    if (event->type() == QEvent::KeyPress) {
+        QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
+        if (checkIfSendEventAndConsumeEvent(keyEvent->key(), event->type())) {
             keyEventEaten = true;
-        } else if ((isLongKeyPressSupported(keyCode)) &&
+        } else if ((isLongKeyPressSupported(keyEvent->key())) &&
                 !(mDialpad->editor().text().length() >= 1)) {
             //Check that there is only one item in dialpad, if there is more than one
             //do not handle long key press.
             mLongPressTimer->stop();
             mLongPressTimer->start(DialpadLongKeyPressTimeOut);
         }
-    } else if (eventType == QEvent::KeyRelease) {
-        if (checkIfSendEventAndConsumeEvent(keyCode, eventType)) {
+    } else if (event->type() == QEvent::KeyRelease) {
+        QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
+        if (checkIfSendEventAndConsumeEvent(keyEvent->key(), event->type())) {
             keyEventEaten = true;
-        } else if (isLongKeyPressSupported(keyCode)){
+        } else if (isLongKeyPressSupported(keyEvent->key())){
             mLongPressTimer->stop();
         }
     }
--- a/telutils/dialpad/src/dialpadvoicemailboxeventfilter.cpp	Tue Jul 06 14:53:02 2010 +0300
+++ b/telutils/dialpad/src/dialpadvoicemailboxeventfilter.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -43,25 +43,23 @@
 {
     Q_UNUSED(watched)
     bool keyEventEaten(false);
-
-    QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
-    const int keyCode = keyEvent->key();
-    const int eventType = event->type();
-
-    if (eventType == QEvent::KeyPress) {
-        if (checkIfSendEventAndConsumeEvent(keyCode, eventType)) {
+    
+    if (event->type() == QEvent::KeyPress) {
+        QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
+        if (checkIfSendEventAndConsumeEvent(keyEvent->key(), event->type())) {
             keyEventEaten = true;
-        } else if ((isLongKeyPressSupported(keyCode)) &&
+        } else if ((isLongKeyPressSupported(keyEvent->key())) &&
                 !(mDialpad->editor().text().length() >= 1)) {
             //Check that there is only one item in dialpad, if there is more than one
             //do not handle long key press.
             mLongPressTimer->stop();
             mLongPressTimer->start(DialpadLongKeyPressTimeOut);
         }
-    } else if (eventType == QEvent::KeyRelease) {
-        if (checkIfSendEventAndConsumeEvent(keyCode, eventType)) {
+    } else if (event->type() == QEvent::KeyRelease) {
+        QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
+        if (checkIfSendEventAndConsumeEvent(keyEvent->key(), event->type())) {
             keyEventEaten = true;
-        } else if (isLongKeyPressSupported(keyCode)){
+        } else if (isLongKeyPressSupported(keyEvent->key())){
             mLongPressTimer->stop();
         }
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/dialpad/tsrc/unit/shared/mock_cphcltemergencycall.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,149 @@
+/*
+* 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:
+*
+*/
+
+#include <smcmockclassincludes.h>
+#include <mphcltemergencycallobserver.h>
+#include "mock_cphcltemergencycall.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhCltEmergencyCall::CPhCltEmergencyCall
+// C++ constructor.
+// -----------------------------------------------------------------------------
+//
+CPhCltEmergencyCall::CPhCltEmergencyCall( 
+        MPhCltEmergencyCallObserver* aObserver )
+    : CActive( EPriorityStandard ), iObserver( aObserver )
+    {
+    
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltEmergencyCall::CPhCltEmergencyCall
+// -----------------------------------------------------------------------------
+//
+CPhCltEmergencyCall* CPhCltEmergencyCall::NewL( 
+        MPhCltEmergencyCallObserver* aObserver )
+    {
+    return CPhCltEmergencyCallMock::NewL( aObserver );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltEmergencyCallMock::CPhCltEmergencyCallMock
+// C++ constructor.
+// -----------------------------------------------------------------------------
+//
+CPhCltEmergencyCallMock::CPhCltEmergencyCallMock( 
+        MPhCltEmergencyCallObserver * aObserver )
+    : CPhCltEmergencyCall( aObserver )
+    {
+    
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltEmergencyCallMock::NewL
+// -----------------------------------------------------------------------------
+//
+CPhCltEmergencyCallMock * CPhCltEmergencyCallMock::NewL( 
+        MPhCltEmergencyCallObserver * aObserver )
+    {
+    SMC_MOCK_NEWL1( CPhCltEmergencyCallMock *, MPhCltEmergencyCallObserver *, aObserver )
+
+    CPhCltEmergencyCallMock* self = new( ELeave ) CPhCltEmergencyCallMock( aObserver );
+    CleanupStack::PushL( self );
+    //self->ConstructL()
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltEmergencyCallMock::IsEmergencyPhoneNumber
+// -----------------------------------------------------------------------------
+//
+TInt CPhCltEmergencyCallMock::IsEmergencyPhoneNumber( 
+        const TDesC & aNumber,
+        TBool & aIsEmergencyNumber )
+    {
+    SMC_MOCK_METHOD2( TInt, const TDesC &, aNumber, 
+        TBool &, aIsEmergencyNumber )
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltEmergencyCallMock::FindEmergencyPhoneNumber
+// -----------------------------------------------------------------------------
+//
+TInt CPhCltEmergencyCallMock::FindEmergencyPhoneNumber( 
+        TDes & aNumber,
+        TBool & aIsEmergencyNumber )
+    {
+    SMC_MOCK_METHOD2( TInt, TDes &, aNumber, 
+        TBool &, aIsEmergencyNumber )
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltEmergencyCallMock::DialEmergencyCallL
+// -----------------------------------------------------------------------------
+//
+void CPhCltEmergencyCallMock::DialEmergencyCallL( 
+        const TDesC & aNumber )
+    {
+    SMC_MOCK_METHOD1( void, const TDesC &, aNumber )
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltEmergencyCallMock::IsEmergencyPhoneNumber
+// -----------------------------------------------------------------------------
+//
+TInt CPhCltEmergencyCallMock::IsEmergencyPhoneNumber( 
+        const TDesC & aNumber,
+        TDes & aMatchedEmergencyNumber,
+        TBool & aIsEmergencyNumber )
+    {
+    SMC_MOCK_METHOD3( TInt, const TDesC &, aNumber, 
+        TDes &, aMatchedEmergencyNumber, 
+        TBool &, aIsEmergencyNumber )
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltEmergencyCallMock::RunL
+// Declaration needed due to vftable references.
+// -----------------------------------------------------------------------------
+//
+void CPhCltEmergencyCallMock::RunL()
+    {
+    
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhCltEmergencyCallMock::DoCancel
+// Declaration needed due to vftable references.
+// -----------------------------------------------------------------------------
+//
+void CPhCltEmergencyCallMock::DoCancel()
+    {
+    
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/dialpad/tsrc/unit/shared/mock_cphcltemergencycall.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,144 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef CPHCLTEMERGENCYCALLMOCK_H
+#define CPHCLTEMERGENCYCALLMOCK_H
+
+#include <e32base.h>
+#include <cphcltemergencycall.h>
+
+// FORWARD DECLARATIONS
+class MPhCltEmergencyCallObserver;
+
+// CLASS DECLARATION
+/**
+*   Phone Client Emergency Call Api for emergency number query
+*   and emergency dialing.
+*
+*   @lib phoneclient.lib
+*   @since SeriesS60_3.2
+*/
+class CPhCltEmergencyCallMock : public CPhCltEmergencyCall
+    {
+    public:
+        static TBool iSimulateEmergencyNumberMatch;
+    
+    public:  // Constructors and destructor
+ 
+        /**
+        * Create an instance that implements the interface.
+        *
+        * @param aObserver It is the observer for the instance.
+        * @return Returns the created instance.
+        */
+        static CPhCltEmergencyCallMock* NewL( 
+            MPhCltEmergencyCallObserver* aObserver );
+
+    public: // New functions    
+        
+       /**
+        * Returns information whether the number specified was an emergency number.
+        * 
+        * @param aNumber Number to be queried. aNumber might contain prefix (SS code)
+        *                and/or postfix (DTMF part).  
+        *                The aNumber parameter should be a buffer and the 
+        *                clients are provided with a typedef called 
+        *                TPhCltEmergencyNumber.
+        *
+        * @param aIsEmergencyNumber If ETrue, then the aNumber 
+        *                           parameter included emergency number.
+        * @return Returns error code of the success of the operation.
+        */
+        TInt IsEmergencyPhoneNumber( const TDesC& aNumber, 
+            TBool& aIsEmergencyNumber );
+
+        /**
+        * Method can be used to check if the number specified contains 
+        * a valid emergency number in the end of the number.
+        * 
+        * @param aNumber Number to be queried, matched emergency number 
+        *                is returned in this parameter.
+        *                The aNumber parameter should be a buffer and the 
+        *                clients are provided with a typedef called 
+        *                TPhCltTelephoneNumber.
+        *             
+        * @param aIsEmergencyNumber If ETrue, then the aNumber parameter 
+        *                           was emergency number. 
+        * @return Returns error code of the success of the operation.
+        */
+        TInt FindEmergencyPhoneNumber( TDes& aNumber, 
+            TBool& aIsEmergencyNumber );
+
+        /**
+        * Initiates an emergency call.
+        *
+        * @param aNumber Emergency number to be dialed.
+        *                The aNumber parameter should be a buffer and the 
+        *                clients are provided with a typedef called 
+        *                TPhCltEmergencyNumber. 
+        *
+        *                If the aNumber parameter supplies an "empty" buffer 
+        *                the call is created either dialing the default emergency 
+        *                phone number or use the SET UP EMERGENCY request  
+        *                that does not contain a  dialling number.
+        *
+        *                Leaves with KErrArgument, if parameter aNumber was
+        *                not an emergency number.
+        *
+        * @pre IsActive() returns EFalse, otherwise leaves with KErrInUse.
+        */
+        void DialEmergencyCallL( const TDesC& aNumber );
+        
+        /**
+        * Returns information whether the number specified was an emergency 
+        * number and also returns the plain emergency number.
+        * 
+        * @param aNumber Number to be queried.aNumber might contain prefix (SS code)
+        *                and/or postfix (DTMF part).
+        *                The aNumber parameter should be a buffer and the 
+        *                clients are provided with a typedef called 
+        *                TPhCltEmergencyNumber. 
+        *
+        * @param aMatchedEmergencyNumber Matched emergencynumber without prefix or 
+        *                postfix is returned in this parameter. The aMatchedEmergencyNumber 
+        *                parameter should be a buffer and the clients are
+        *                provided with atypedef called TPhCltEmergencyNumber.
+        * 
+        * @param aIsEmergencyNumber If ETrue, then the aNumber 
+        *                           parameter included emergency number.
+        *
+        * @return Returns error code of the success of the operation.
+        */
+        TInt IsEmergencyPhoneNumber( const TDesC& aNumber,
+            TDes& aMatchedEmergencyNumber, TBool& aIsEmergencyNumber );                    
+        
+    protected:
+
+        /**
+        * C++ constructor.
+        */
+        CPhCltEmergencyCallMock( MPhCltEmergencyCallObserver* aObserver );
+        
+        void RunL();
+        
+        void DoCancel();
+
+    };
+
+#endif      // CPHCLTEMERGENCYCALLMOCK_H
+
+// End of File
--- a/telutils/dialpad/tsrc/unit/shared/mock_dialpadhasheventfilter.cpp	Tue Jul 06 14:53:02 2010 +0300
+++ b/telutils/dialpad/tsrc/unit/shared/mock_dialpadhasheventfilter.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -29,9 +29,9 @@
         Dialpad * dialpad,
         QObject * parent )
     :
-    QObject( parent )
+    DialpadMailboxEventFilterBase(dialpad, parent)
     {
-    Q_UNUSED(dialpad)
+
     }
 
 
@@ -57,4 +57,29 @@
         QEvent *, event )
     }
 
+// -----------------------------------------------------------------------------
+// DialpadHashEventFilter::handleCallButtonPress
+// -----------------------------------------------------------------------------
+//
+bool DialpadHashEventFilter::handleCallButtonPress()
+{
+    return false;
+}
 
+// -----------------------------------------------------------------------------
+// DialpadHashEventFilter::handleMailboxOperation
+// -----------------------------------------------------------------------------
+//
+void DialpadHashEventFilter::handleMailboxOperation()
+{
+    
+}
+
+// -----------------------------------------------------------------------------
+// DialpadHashEventFilter::handleLongKeyPress
+// -----------------------------------------------------------------------------
+//
+void DialpadHashEventFilter::handleLongKeyPress()
+{
+    
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/dialpad/tsrc/unit/shared/mock_hbnotificationdialog.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,288 @@
+/*
+* 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:
+*
+*/
+#include <smcmockclassincludes.h>
+#include "hbnotificationdialog.h"
+#include <qgraphicsscene.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// HbNotificationDialog::Q_PROPERTY
+// -----------------------------------------------------------------------------
+//
+/*Q_OBJECT HbNotificationDialog::Q_PROPERTY( 
+        QString text READ text WRITE setText ) Q_PROPERTY ( QString title READ title WRITE setTitle ) Q_PROPERTY ( HbIcon icon READ icon WRITE setIcon ) Q_PROPERTY ( Hb::TextWrapping titleTextWrapping READ titleTextWrapping WRITE setTitleTextWrapping ) Q_PROPERTY ( bool sequentialShow READ isSequentialShow WRITE setSequentialShow ):HbNotificationDialog ( )
+    {
+    SMC_MOCK_METHOD1( Q_OBJECT, QString text READ text WRITE setText ) Q_PROPERTY ( QString title READ title WRITE setTitle ) Q_PROPERTY ( HbIcon icon READ icon WRITE setIcon ) Q_PROPERTY ( Hb::TextWrapping titleTextWrapping READ titleTextWrapping WRITE setTitleTextWrapping ) Q_PROPERTY ( bool sequentialShow READ isSequentialShow WRITE setSequentialShow ):HbNotificationDialog, ( )
+    }*/
+
+HbNotificationDialog::HbNotificationDialog() //: HbDialog(*new HbNotificationDialogPrivate, 0)
+{    
+}
+
+
+// -----------------------------------------------------------------------------
+// HbNotificationDialog::~HbNotificationDialog
+// -----------------------------------------------------------------------------
+//
+HbNotificationDialog::~HbNotificationDialog(  )
+    {
+    //SMC_MOCK_METHOD0( void )
+    }
+
+
+// -----------------------------------------------------------------------------
+// HbNotificationDialog::launchDialog
+// -----------------------------------------------------------------------------
+//
+void HbNotificationDialog::launchDialog( 
+        const QString & title,
+        QGraphicsScene * scene )
+    {
+    SMC_MOCK_METHOD2( void, const QString &, title, 
+        QGraphicsScene *, scene )
+    }
+
+
+// -----------------------------------------------------------------------------
+// HbNotificationDialog::launchDialog
+// -----------------------------------------------------------------------------
+//
+void HbNotificationDialog::launchDialog( 
+        const QString & title,
+        const QString & text,
+        QGraphicsScene * scene )
+    {
+    SMC_MOCK_METHOD3( void, const QString &, title, 
+        const QString &, text, 
+        QGraphicsScene *, scene )
+    }
+
+
+// -----------------------------------------------------------------------------
+// HbNotificationDialog::launchDialog
+// -----------------------------------------------------------------------------
+//
+void HbNotificationDialog::launchDialog( 
+        const HbIcon & icon,
+        const QString & title,
+        const QString & text,
+        QGraphicsScene * scene )
+    {
+    SMC_MOCK_METHOD4( void, const HbIcon &, icon, 
+        const QString &, title, 
+        const QString &, text, 
+        QGraphicsScene *, scene )
+    }
+
+
+// -----------------------------------------------------------------------------
+// HbNotificationDialog::enableTouchActivation
+// -----------------------------------------------------------------------------
+//
+void HbNotificationDialog::enableTouchActivation( 
+        bool enabled )
+    {
+    SMC_MOCK_METHOD1( void, bool, enabled )
+    }
+
+
+// -----------------------------------------------------------------------------
+// HbNotificationDialog::isTouchActivating
+// -----------------------------------------------------------------------------
+//
+bool HbNotificationDialog::isTouchActivating(  ) const
+    {
+    SMC_MOCK_METHOD0( bool )
+    }
+
+
+// -----------------------------------------------------------------------------
+// HbNotificationDialog::setTitle
+// -----------------------------------------------------------------------------
+//
+void HbNotificationDialog::setTitle( 
+        const QString & text )
+    {
+    SMC_MOCK_METHOD1( void, const QString &, text )
+    }
+
+
+// -----------------------------------------------------------------------------
+// HbNotificationDialog::setText
+// -----------------------------------------------------------------------------
+//
+void HbNotificationDialog::setText( 
+        const QString & text )
+    {
+    SMC_MOCK_METHOD1( void, const QString &, text )
+    }
+
+
+// -----------------------------------------------------------------------------
+// HbNotificationDialog::setIcon
+// -----------------------------------------------------------------------------
+//
+void HbNotificationDialog::setIcon( 
+        const HbIcon & icon )
+    {
+    SMC_MOCK_METHOD1( void, const HbIcon &, icon )
+    }
+
+
+// -----------------------------------------------------------------------------
+// HbNotificationDialog::title
+// -----------------------------------------------------------------------------
+//
+QString HbNotificationDialog::title(  ) const
+    {
+    SMC_MOCK_METHOD0( QString )
+    }
+
+
+// -----------------------------------------------------------------------------
+// HbNotificationDialog::text
+// -----------------------------------------------------------------------------
+//
+QString HbNotificationDialog::text(  ) const
+    {
+    SMC_MOCK_METHOD0( QString )
+    }
+
+
+// -----------------------------------------------------------------------------
+// HbNotificationDialog::icon
+// -----------------------------------------------------------------------------
+//
+HbIcon HbNotificationDialog::icon(  ) const
+    {
+    SMC_MOCK_METHOD0( HbIcon )
+    }
+
+
+// -----------------------------------------------------------------------------
+// HbNotificationDialog::setTitleTextWrapping
+// -----------------------------------------------------------------------------
+//
+void HbNotificationDialog::setTitleTextWrapping( 
+        Hb::TextWrapping wrapping )
+    {
+    SMC_MOCK_METHOD1( void, Hb::TextWrapping, wrapping )
+    }
+
+
+// -----------------------------------------------------------------------------
+// HbNotificationDialog::titleTextWrapping
+// -----------------------------------------------------------------------------
+//
+Hb::TextWrapping HbNotificationDialog::titleTextWrapping(  ) const
+    {
+    SMC_MOCK_METHOD0( Hb::TextWrapping )
+    }
+
+
+// -----------------------------------------------------------------------------
+// HbNotificationDialog::setSequentialShow
+// -----------------------------------------------------------------------------
+//
+void HbNotificationDialog::setSequentialShow( 
+        bool sequential )
+    {
+    SMC_MOCK_METHOD1( void, bool, sequential )
+    }
+
+
+// -----------------------------------------------------------------------------
+// HbNotificationDialog::isSequentialShow
+// -----------------------------------------------------------------------------
+//
+bool HbNotificationDialog::isSequentialShow(  ) const
+    {
+    SMC_MOCK_METHOD0( bool )
+    }
+
+// -----------------------------------------------------------------------------
+// HbNotificationDialog::primitive
+// -----------------------------------------------------------------------------
+//
+QGraphicsItem * HbNotificationDialog::primitive( 
+        const QString & itemName ) const
+    {
+    SMC_MOCK_METHOD1( QGraphicsItem *, const QString &, itemName )
+    }
+
+// -----------------------------------------------------------------------------
+// HbNotificationDialog::HbNotificationDialog
+// -----------------------------------------------------------------------------
+//
+/*void*/ HbNotificationDialog::HbNotificationDialog( 
+        HbNotificationDialogPrivate & dd,
+        QGraphicsItem * parent )
+    {
+    Q_UNUSED(dd)
+    Q_UNUSED(parent)    
+    //SMC_MOCK_METHOD2( void, HbNotificationDialogPrivate &, dd, 
+     //   QGraphicsItem *, parent )
+    }
+
+
+// -----------------------------------------------------------------------------
+// HbNotificationDialog::gestureEvent
+// -----------------------------------------------------------------------------
+//
+void HbNotificationDialog::gestureEvent( 
+        QGestureEvent * event )
+    {
+    SMC_MOCK_METHOD1( void, QGestureEvent *, event )
+    }
+
+
+// -----------------------------------------------------------------------------
+// HbNotificationDialog::hideEvent
+// -----------------------------------------------------------------------------
+//
+void HbNotificationDialog::hideEvent( 
+        QHideEvent * event )
+    {
+    SMC_MOCK_METHOD1( void, QHideEvent *, event )
+    }
+
+
+// -----------------------------------------------------------------------------
+// HbNotificationDialog::showEvent
+// -----------------------------------------------------------------------------
+//
+void HbNotificationDialog::showEvent( 
+        QShowEvent * event )
+    {
+    SMC_MOCK_METHOD1( void, QShowEvent *, event )
+    }
+
+
+// -----------------------------------------------------------------------------
+// HbNotificationDialog::itemChange
+// -----------------------------------------------------------------------------
+//
+QVariant HbNotificationDialog::itemChange( 
+        GraphicsItemChange change,
+        const QVariant & value )
+    {
+    SMC_MOCK_METHOD2( QVariant, GraphicsItemChange, change, 
+        const QVariant &, value )
+    }
+
+
--- a/telutils/dialpad/tsrc/unit/unit.pro	Tue Jul 06 14:53:02 2010 +0300
+++ b/telutils/dialpad/tsrc/unit/unit.pro	Wed Jul 21 18:26:52 2010 +0300
@@ -27,3 +27,4 @@
 SUBDIRS += mt_dialpad
 SUBDIRS += mt_keyhandler
 SUBDIRS += ut_dialpadhasheventfilter
+SUBDIRS += ut_dialpadnumericbutton
--- a/telutils/dialpad/tsrc/unit/ut_dialpademergencycalleventfilter/ut_dialpademergencycalleventfilter.cpp	Tue Jul 06 14:53:02 2010 +0300
+++ b/telutils/dialpad/tsrc/unit/ut_dialpademergencycalleventfilter/ut_dialpademergencycalleventfilter.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -25,31 +25,18 @@
 #include <hbview.h>
 #include <hblineedit.h>
 #include <hbinstance.h>
+#include <mockservice.h>
 
-#ifdef Q_OS_SYMBIAN
-#include "xqservicerequest.h"
-#endif
-
+#include "mock_cphcltemergencycall.h"
 #include "dialpadtest.h"
 #include "dialpadtestutil.h"
 #include "dialpademergencycalleventfilter.h"
 #include "dialpad.h"
 
 const int WAIT_TIME = 300;
-QString mService;
-QString mMessage;
-bool mXQServiceConstructed;
-bool mSendCalled;
-
-#ifdef Q_OS_SYMBIAN
-XQServiceRequest::XQServiceRequest(const QString& service, const QString& message, const bool& synchronous) { mService=service; mMessage=message; mXQServiceConstructed=true; }
-XQServiceRequest::~XQServiceRequest() {}
-bool XQServiceRequest::send(QVariant& retValue) { mSendCalled=true; return true; }
-void XQServiceRequest::addArg(const QVariant& v) {}
-#endif
 
 // test cases
-class ut_DialpadEmergencyCallEventFilter : public QObject
+class ut_DialpadEmergencyCallEventFilter : public QObject, public MockService
 {
     Q_OBJECT
 
@@ -95,10 +82,7 @@
 
 void ut_DialpadEmergencyCallEventFilter::init()
 {
-    mService = QString("");
-    mMessage = QString("");
-    mXQServiceConstructed = false;
-    mSendCalled = false;
+    initialize();
 }
 
 void ut_DialpadEmergencyCallEventFilter::cleanupTestCase()
@@ -110,13 +94,24 @@
 
 void ut_DialpadEmergencyCallEventFilter::cleanup()
 {
+    reset();
     mDialpad->editor().setText(QString());
     QTest::qWait( WAIT_TIME ); // delay between tests
 }
 
+void checkNumber(const TDesC& aNumber, TBool& aIsEmergencyNumber)
+{
+    if (aNumber == _L("112")) {
+        aIsEmergencyNumber = true;
+    }
+}
 
 void ut_DialpadEmergencyCallEventFilter::testEmergencyCallEventFilter()
 {
+    EXPECT(CPhCltEmergencyCallMock::IsEmergencyPhoneNumber).willOnce(
+            invoke(checkNumber));
+    EXPECT(CPhCltEmergencyCallMock::DialEmergencyCallL);
+    
     mDialpad->openDialpad();
     QTest::qWait(WAIT_TIME);
     mUtil->mouseClickDialpad(Qt::Key_1);
@@ -130,12 +125,7 @@
     
     mDialpad->closeDialpad();
 
-#ifdef Q_OS_SYMBIAN
-    QVERIFY(mXQServiceConstructed == true);
-    QVERIFY(mSendCalled == true);
-    QCOMPARE(mService, QString("com.nokia.symbian.ICallDial"));
-    QCOMPARE(mMessage, QString("dial(QString)"));
-#endif
+    QVERIFY(verify());
 }
 
 DIALPAD_TEST_MAIN(ut_DialpadEmergencyCallEventFilter)
--- a/telutils/dialpad/tsrc/unit/ut_dialpademergencycalleventfilter/ut_dialpademergencycalleventfilter.pro	Tue Jul 06 14:53:02 2010 +0300
+++ b/telutils/dialpad/tsrc/unit/ut_dialpademergencycalleventfilter/ut_dialpademergencycalleventfilter.pro	Wed Jul 21 18:26:52 2010 +0300
@@ -32,11 +32,11 @@
 

 HEADERS += ../../../inc/dialpademergencycalleventfilter.h \
-           xqservicerequest.h \
            ../shared/dialpadtestutil.h
 SOURCES += ut_dialpademergencycalleventfilter.cpp \
            ../../../src/dialpademergencycalleventfilter.cpp \
-           ../shared/dialpadtestutil.cpp
+           ../shared/dialpadtestutil.cpp \
+           ../shared/mock_cphcltemergencycall.cpp
 
 # 
-LIBS += -ldialpad
+LIBS += -ldialpad -lmocklib -lsymbianmock
--- a/telutils/dialpad/tsrc/unit/ut_dialpademergencycalleventfilter/xqservicerequest.h	Tue Jul 06 14:53:02 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
-class XQServiceRequest : public QObject
-{
-public:
-    XQServiceRequest(const QString& service, const QString& message, const bool& synchronous);
-    ~XQServiceRequest();
-    bool send(QVariant& retValue);
-    void addArg(const QVariant& v);
-    template<typename T>
-    inline XQServiceRequest &operator<< (const T &var)
-    {
-        QVariant v = qVariantFromValue(var);
-        addArg(v);
-        return *this;
-    }
-};
--- a/telutils/dialpad/tsrc/unit/ut_dialpadkeyhandler/ut_dialpadkeyhandler.cpp	Tue Jul 06 14:53:02 2010 +0300
+++ b/telutils/dialpad/tsrc/unit/ut_dialpadkeyhandler/ut_dialpadkeyhandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -39,6 +39,10 @@
     SMC_MOCK_METHOD1( void, QObject *, obj )
 }
 
+void QObject::removeEventFilter(QObject *obj)
+{
+    SMC_MOCK_METHOD1( void, QObject *, obj )
+}
 
 UT_DialpadKeyHandler::UT_DialpadKeyHandler()
     :
@@ -79,6 +83,7 @@
 void UT_DialpadKeyHandler::t_constructionWithAllFilters()
 {
     EXPECT(QObject::installEventFilter).times(5);
+    EXPECT(QObject::removeEventFilter).times(5);
     
     DialpadKeyHandler::DialpadKeyEventFilters filters(
         DialpadKeyHandler::VoiceMailbox |
@@ -89,6 +94,8 @@
         DialpadKeyHandler::Hash );
     
     m_keyHandler = new DialpadKeyHandler(m_dialPad, filters, this);
+    delete m_keyHandler;
+    m_keyHandler = 0;
     
     QVERIFY(verify());
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/dialpad/tsrc/unit/ut_dialpadnumericbutton/ut_dialpadnumericbutton.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,78 @@
+/*!
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include <QtGui>
+#include <QtTest/QtTest>
+
+#include <hbapplication.h>
+
+#include "dialpadtest.h"
+#include "dialpadnumericbutton.h"
+
+class ut_DialpadNumericButton : public QObject
+{
+    Q_OBJECT
+
+private slots:
+    void initTestCase();
+    void cleanupTestCase();
+
+    void testSetText();
+    void testSetSecondaryText();
+    void testSetIcon();
+
+private:
+    DialpadNumericButton *mButton;
+};
+
+void ut_DialpadNumericButton::initTestCase()
+{
+    mButton = new DialpadNumericButton(0,QPoint(1,1),QSize(1,1));
+}
+
+void ut_DialpadNumericButton::cleanupTestCase()
+{
+    delete mButton;
+}
+
+void ut_DialpadNumericButton::testSetText()
+{
+    QVERIFY(mButton->text().isNull());
+    mButton->setText(QLatin1String("Primary text"));
+    QVERIFY(mButton->text() == QLatin1String("Primary text"));
+}
+
+void ut_DialpadNumericButton::testSetSecondaryText()
+{
+    QVERIFY(mButton->secondaryText().isNull());
+    mButton->setSecondaryText(QLatin1String("Secondary text"));
+    QVERIFY(mButton->secondaryText() == QLatin1String("Secondary text"));
+}
+
+void ut_DialpadNumericButton::testSetIcon()        
+{
+    HbIcon icon(QLatin1String("dummy.svg"));
+
+    QVERIFY(mButton->icon().isNull());
+    mButton->setIcon(icon);
+    mButton->icon().setColor(Qt::white);
+    QVERIFY(mButton->icon().iconName() == QLatin1String("dummy.svg"));
+    QVERIFY(mButton->icon().color() == Qt::white);
+}
+
+DIALPAD_TEST_MAIN(ut_DialpadNumericButton)
+#include "ut_dialpadnumericbutton.moc"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/dialpad/tsrc/unit/ut_dialpadnumericbutton/ut_dialpadnumericbutton.pro	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,35 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+#
+
+TEMPLATE = app
+TARGET = 
+DEPENDPATH += . ../../../src
+INCLUDEPATH += . ../../../inc ../shared
+CONFIG += hb qtestlib
+HB += hbinput
+
+symbian {
+    INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+} else:win32 {
+    DESTDIR = ./
+}
+
+HEADERS += ../../../inc/dialpadnumericbutton.h
+
+SOURCES += ut_dialpadnumericbutton.cpp \
+           ../../../src/dialpadnumericbutton.cpp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/bmarm/phoneparseru.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,26 @@
+EXPORTS
+	"_._25CPhoneGsmHandlerContainer" @ 1 NONAME R3UNUSED ; CPhoneGsmHandlerContainer::~CPhoneGsmHandlerContainer(void)
+	CreateOptionContainerL__14PhoneGsmParser @ 2 NONAME R3UNUSED ; PhoneGsmParser::CreateOptionContainerL(void)
+	CreateParserL__14PhoneGsmParser @ 3 NONAME R3UNUSED ; PhoneGsmParser::CreateParserL(void)
+	CreateResultL__14PhoneGsmParser @ 4 NONAME R3UNUSED ; PhoneGsmParser::CreateResultL(void)
+	DefineOptionL__24CPhoneGsmOptionContainerii @ 5 NONAME R3UNUSED ; CPhoneGsmOptionContainer::DefineOptionL(int, int)
+	DetermineContentType__14PhoneGsmParserRC21CPhoneGsmParserResult @ 6 NONAME R3UNUSED ; PhoneGsmParser::DetermineContentType(CPhoneGsmParserResult const &)
+	FindOptionStatus__C24CPhoneGsmOptionContaineri @ 7 NONAME R3UNUSED ; CPhoneGsmOptionContainer::FindOptionStatus(int) const
+	InitialiseOptionsToDefaultValues__14PhoneGsmParserR24CPhoneGsmOptionContainer @ 8 NONAME R3UNUSED ; PhoneGsmParser::InitialiseOptionsToDefaultValues(CPhoneGsmOptionContainer &)
+	IsAllowedForArriving__14PhoneGsmParserRC21CPhoneGsmParserResult @ 9 NONAME R3UNUSED ; PhoneGsmParser::IsAllowedForArriving(CPhoneGsmParserResult const &)
+	IsAllowedForBadSim__14PhoneGsmParserRC21CPhoneGsmParserResult @ 10 NONAME R3UNUSED ; PhoneGsmParser::IsAllowedForBadSim(CPhoneGsmParserResult const &)
+	IsOptionDefined__C24CPhoneGsmOptionContaineri @ 11 NONAME R3UNUSED ; CPhoneGsmOptionContainer::IsOptionDefined(int) const
+	NewL__24CPhoneGsmOptionContainer @ 12 NONAME R3UNUSED ; CPhoneGsmOptionContainer::NewL(void)
+	NewL__25CPhoneGsmHandlerContainer @ 13 NONAME R3UNUSED ; CPhoneGsmHandlerContainer::NewL(void)
+	ProcessL__18CPhoneGsmSsHandlerR21CPhoneGsmParserResult @ 14 NONAME R3UNUSED ; CPhoneGsmSsHandler::ProcessL(CPhoneGsmParserResult &)
+	ProcessL__20CPhoneGsmMiscHandlerR21CPhoneGsmParserResult @ 15 NONAME R3UNUSED ; CPhoneGsmMiscHandler::ProcessL(CPhoneGsmParserResult &)
+	ProcessL__22CPhoneGsmSsCallHandlerR21CPhoneGsmParserResult @ 16 NONAME R3UNUSED ; CPhoneGsmSsCallHandler::ProcessL(CPhoneGsmParserResult &)
+	ProcessL__26CPhoneGsmSimControlHandlerR21CPhoneGsmParserResult @ 17 NONAME R3UNUSED ; CPhoneGsmSimControlHandler::ProcessL(CPhoneGsmParserResult &)
+	ProcessL__27CPhoneGsmPhoneNumberHandlerR21CPhoneGsmParserResult @ 18 NONAME R3UNUSED ; CPhoneGsmPhoneNumberHandler::ProcessL(CPhoneGsmParserResult &)
+	ProcessL__28CPhoneGsmManufacturerHandlerR21CPhoneGsmParserResult @ 19 NONAME R3UNUSED ; CPhoneGsmManufacturerHandler::ProcessL(CPhoneGsmParserResult &)
+	ProcessL__28CPhoneGsmPcnProcedureHandlerR21CPhoneGsmParserResult @ 20 NONAME R3UNUSED ; CPhoneGsmPcnProcedureHandler::ProcessL(CPhoneGsmParserResult &)
+	SetOptionStatus__24CPhoneGsmOptionContainerii @ 21 NONAME R3UNUSED ; CPhoneGsmOptionContainer::SetOptionStatus(int, int)
+	"_._24CPhoneGsmOptionContainer" @ 22 NONAME R3UNUSED ; CPhoneGsmOptionContainer::~CPhoneGsmOptionContainer(void)
+	AddHandlerL__25CPhoneGsmHandlerContainerR20CPhoneGsmHandlerBase @ 23 NONAME R3UNUSED ; CPhoneGsmHandlerContainer::AddHandlerL(CPhoneGsmHandlerBase &)
+	ProcessL__22CPhoneGsmSsCcbsHandlerR21CPhoneGsmParserResult @ 24 NONAME R3UNUSED ; CPhoneGsmSsCcbsHandler::ProcessL(CPhoneGsmParserResult &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/bwins/phoneparseru.def	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,21 @@
+EXPORTS
+	??1CPhoneGsmHandlerContainer@@UAE@XZ @ 1 NONAME ; CPhoneGsmHandlerContainer::~CPhoneGsmHandlerContainer(void)
+	?AddHandlerL@CPhoneGsmHandlerContainer@@QAEXAAVCPhoneGsmHandlerBase@@@Z @ 2 NONAME ; void CPhoneGsmHandlerContainer::AddHandlerL(class CPhoneGsmHandlerBase &)
+	?CreateOptionContainerL@PhoneGsmParser@@SAPAVCPhoneGsmOptionContainerBase@@XZ @ 3 NONAME ; class CPhoneGsmOptionContainerBase * PhoneGsmParser::CreateOptionContainerL(void)
+	?CreateParserL@PhoneGsmParser@@SAPAVCPhoneGsmParserBase@@XZ @ 4 NONAME ; class CPhoneGsmParserBase * PhoneGsmParser::CreateParserL(void)
+	?CreateResultL@PhoneGsmParser@@SAPAVCPhoneGsmParserResult@@XZ @ 5 NONAME ; class CPhoneGsmParserResult * PhoneGsmParser::CreateResultL(void)
+	?DetermineContentType@PhoneGsmParser@@SA?AW4TContentType@1@ABVCPhoneGsmParserResult@@@Z @ 6 NONAME ; enum PhoneGsmParser::TContentType PhoneGsmParser::DetermineContentType(class CPhoneGsmParserResult const &)
+	?IsAllowedForArriving@PhoneGsmParser@@SAHABVCPhoneGsmParserResult@@@Z @ 7 NONAME ; int PhoneGsmParser::IsAllowedForArriving(class CPhoneGsmParserResult const &)
+	?IsAllowedForBadSim@PhoneGsmParser@@SAHABVCPhoneGsmParserResult@@@Z @ 8 NONAME ; int PhoneGsmParser::IsAllowedForBadSim(class CPhoneGsmParserResult const &)
+	?NewL@CPhoneGsmHandlerContainer@@SAPAV1@XZ @ 9 NONAME ; class CPhoneGsmHandlerContainer * CPhoneGsmHandlerContainer::NewL(void)
+	?ProcessL@CPhoneGsmEmergencyNumberHandler@@UAEXAAVCPhoneGsmParserResult@@@Z @ 10 NONAME ; void CPhoneGsmEmergencyNumberHandler::ProcessL(class CPhoneGsmParserResult &)
+	?ProcessL@CPhoneGsmManufacturerHandler@@UAEXAAVCPhoneGsmParserResult@@@Z @ 11 NONAME ; void CPhoneGsmManufacturerHandler::ProcessL(class CPhoneGsmParserResult &)
+	?ProcessL@CPhoneGsmMiscHandler@@UAEXAAVCPhoneGsmParserResult@@@Z @ 12 NONAME ; void CPhoneGsmMiscHandler::ProcessL(class CPhoneGsmParserResult &)
+	?ProcessL@CPhoneGsmPcnProcedureHandler@@UAEXAAVCPhoneGsmParserResult@@@Z @ 13 NONAME ; void CPhoneGsmPcnProcedureHandler::ProcessL(class CPhoneGsmParserResult &)
+	?ProcessL@CPhoneGsmPhoneNumberHandler@@UAEXAAVCPhoneGsmParserResult@@@Z @ 14 NONAME ; void CPhoneGsmPhoneNumberHandler::ProcessL(class CPhoneGsmParserResult &)
+	?ProcessL@CPhoneGsmSimControlHandler@@UAEXAAVCPhoneGsmParserResult@@@Z @ 15 NONAME ; void CPhoneGsmSimControlHandler::ProcessL(class CPhoneGsmParserResult &)
+	?ProcessL@CPhoneGsmSsCallHandler@@UAEXAAVCPhoneGsmParserResult@@@Z @ 16 NONAME ; void CPhoneGsmSsCallHandler::ProcessL(class CPhoneGsmParserResult &)
+	?ProcessL@CPhoneGsmSsHandler@@UAEXAAVCPhoneGsmParserResult@@@Z @ 17 NONAME ; void CPhoneGsmSsHandler::ProcessL(class CPhoneGsmParserResult &)
+	?ProcessL@CPhoneVoipNumberHandler@@UAEXAAVCPhoneGsmParserResult@@@Z @ 18 NONAME ; void CPhoneVoipNumberHandler::ProcessL(class CPhoneGsmParserResult &)
+	?UseFeatureStub@PhoneGsmParser@@SAXPAVCPhoneParserFeatures@@@Z @ 19 NONAME ; void PhoneGsmParser::UseFeatureStub(class CPhoneParserFeatures *)
+
Binary file telutils/phoneparser/group/phoneparser_stub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/inc/cphonegsmdummyparser.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,69 @@
+/*
+* 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:  It is a parser that parses nothing.
+*
+*/
+
+
+#ifndef CPHONEGSMDUMMYPARSER_H
+#define CPHONEGSMDUMMYPARSER_H
+
+// INCLUDES
+#include    "cphonegsmparserbase.h" 
+
+// CLASS DECLARATION
+
+/**
+* It is a parser that parses nothing.
+*
+* @since 1.0
+* @lib phoneparser.lib
+*/
+NONSHARABLE_CLASS( CPhoneGsmDummyParser )
+    : public CPhoneGsmParserBase
+    {
+    public:  // Constructors and destructor      
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CPhoneGsmDummyParser* NewL();
+
+    public: // Functions from base classes
+
+        /**
+        * From CPhoneGsmParserBase, parse string.
+        *
+        * @param aString It is string to be parsed.
+        * @param aResult It will contain result.
+        * @param aOptions It contains all options related to parsing.
+        * @return It returns boolean value indicating success of parsing.
+        */
+        TBool ParseL( 
+            const TDesC& aString,
+            CPhoneGsmParserResult& aResult,
+            CPhoneGsmOptionContainerBase& aOptions );
+            
+    private:
+
+        /**
+        * C++ constructor.
+        */
+        CPhoneGsmDummyParser();
+
+    };
+
+#endif      // CPHONEGSMDUMMYPARSER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/inc/cphonegsmemergencynumberparser.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,95 @@
+/*
+* 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:  It is parser for emergency numbers.
+*
+*/
+
+
+#ifndef CPHONEGSMEMERGENCYNUMBERPARSER_H
+#define CPHONEGSMEMERGENCYNUMBERPARSER_H
+
+// INCLUDES
+#include    "cphonegsmparserbase.h" 
+#include    <phclttypes.h> 
+
+// FORWARD DECLARATIONS
+class CPhoneGsmOptionContainer;
+
+// CONSTANTS
+
+/*
+* EMERGENCY NUMBER UIDS
+*/
+const TUint32 KPhoneUidEmergencyNumber = 
+    PHONE_MAKE_UID( KPhoneGsmUidDialEmergencyNumber, 0 );
+
+// CLASS DECLARATION
+
+/**
+* It is parser for emergency numbers.
+*
+* @since S60 5.0
+* @lib phoneparser.lib
+*/
+NONSHARABLE_CLASS( CPhoneGsmEmergencyNumberParser )
+    : public CPhoneGsmParserBase
+    {
+    public:  // Constructors and destructor      
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CPhoneGsmEmergencyNumberParser* NewLC();
+
+    public: // Functions from base classes
+
+        /**
+        * From CPhoneGsmParserBase. 
+        * Parse string.
+        *
+        * @param aString It is string to be parsed.
+        * @param aResult It will contain result.
+        * @param aOptions It indicates operation options.
+        * @return It returns boolean value indicating success of parsing.
+        */
+        TBool ParseL( 
+            const TDesC& aString,
+            CPhoneGsmParserResult& aResult,
+            CPhoneGsmOptionContainerBase& aOptions );
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CPhoneGsmEmergencyNumberParser();
+
+        /**
+        * Parse.
+        */
+        TBool DoParseL( 
+            const TDesC& aString,
+            CPhoneGsmParserResult& aResult,
+            CPhoneGsmOptionContainer& aOptions );
+
+    private:    // Data
+
+        // Emergency number.
+        TPhCltTelephoneNumber iEmergencyPhoneNumber;
+
+    };
+
+#endif      // CPHONEGSMEMERGENCYNUMBERPARSER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/inc/cphonegsmmanufacturerparser.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,178 @@
+/*
+* 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:  It is parser class for manufacturer specific codes.
+*
+*/
+
+
+#ifndef CPHONEGSMMANUFACTURERPARSER_H
+#define CPHONEGSMMANUFACTURERPARSER_H
+
+// INCLUDES
+#include    "cphonegsmparserbase.h" 
+
+// FORWARD DECLARATIONS
+class CPhoneGsmOptionContainer;
+
+// CONSTANTS
+
+/*
+* MANUFACTURER CODE UIDS
+*/
+
+const TUint32 KPhoneUidManufacturerCode = 
+    PHONE_MAKE_UID( KPhoneGsmUidManufacturer, 0 );
+
+const TUint32 KPhoneUidManufacturerDebugCode =
+    PHONE_MAKE_UID( KPhoneGsmUidManufacturer, 1 );
+
+// MACROS
+
+// This definition enables parsing of debug code. 
+//#define PHONEPARSER_PARSE_DEBUG_CODE
+
+// CLASS DECLARATION
+
+/**
+* It is parser for manufacturer specific codes.
+*
+* @since 1.0
+* @lib phoneparser.lib
+*/
+NONSHARABLE_CLASS( CPhoneGsmManufacturerParser )
+    : public CPhoneGsmParserBase
+    {
+    public:  // Constructors and destructor      
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CPhoneGsmManufacturerParser* NewLC();
+        
+        /**
+        * Destructor.
+        */
+        ~CPhoneGsmManufacturerParser();
+
+    public: // New functions
+
+        /**
+        * Enumerates all flags.
+        *
+        * EFlagCode       - string is a code, checked only when # is pressed.
+        * EFlagSend       - SEND key must be pressed.
+        * EFlagPrefix     - string is just a prefix.
+        * EFlagNotInIdle   - not in from idle state.
+        * EFlagNotInInCall - not in during incall.
+        */
+        enum TFlags
+            {
+            EFlagCode = 0x01,        
+            EFlagSend = 0x02,        
+            EFlagPrefix = 0x04,
+            EFlagNotInIdle = 0x08,
+            EFlagNotInInCall = 0x10
+            };
+
+        /**
+        * Add string to the set of manufacturer specific codes.
+        *
+        * Note that string must exist as long as the instance.
+        *
+        * @param aString string
+        * @param aFlags flags, see TFlags
+        * @param aCommand command id
+        * @param aFeatureId feature manager id.
+        */
+        void AddStringL( 
+            const TDesC& aString, 
+            TInt aFlags, 
+            TUint aCommand,
+            TInt aFeatureId = 0 );
+
+    public: // Functions from base classes
+
+        /**
+        * From CPhoneGsmParserBase.
+        * Parse string.
+        *
+        * @param aString It is string to be parsed.
+        * @param aResult It will contain result.
+        * @param aSendOperation It indicates if it would be SEND operation.
+        * @return It returns boolean value indicating success of parsing.
+        */
+        TBool ParseL( 
+            const TDesC& aString,
+            CPhoneGsmParserResult& aResult,
+            CPhoneGsmOptionContainerBase& aOptions );
+
+    private:
+
+        class TCodeInfo;
+
+        /**
+        * C++ default constructor.
+        */
+        CPhoneGsmManufacturerParser();
+
+        /**
+        * Symbian OS constructor.
+        */
+        void ConstructL();
+
+        /**
+        * Checks code.
+        *
+        * @param aString string to be checked.
+        * @param aInfo code information.
+        * @param aOptions options.
+        */
+        TBool CheckCode( 
+            const TDesC& aString, 
+            const TCodeInfo& aInfo,
+            CPhoneGsmOptionContainerBase& aOptions );
+
+        /**
+        * Is situation ok for string.
+        */
+        TBool CheckSituation( 
+            const TDesC& aString,
+            TInt aFlags,
+            CPhoneGsmOptionContainerBase& aOptions );
+            
+    private:    // Data
+
+        /**
+        * It defines structure that contains information of single code.
+        */
+        class TCodeInfo
+            {
+            public:
+                TPtrC iString;
+                TInt iFlags;
+                TUint iCommand;
+                TInt iFeatureId;
+            };
+        
+        // Type definition for code array.
+        typedef CArrayFixFlat< TCodeInfo > CCodeArray;
+
+        // Owned array of codes.
+        CCodeArray* iArray;
+
+    };
+
+#endif      // CPHONEGSMMANUFACTURERPARSER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/inc/cphonegsmoptioncontainer.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,161 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  It is container for options, boolean flags with identifiers.
+*                Using these flags, parsing process can be configured.
+*
+*/
+
+
+#ifndef CPHONEGSMOPTIONCONTAINER_H
+#define CPHONEGSMOPTIONCONTAINER_H
+
+// INCLUDES
+#include    "cphonegsmoptioncontainerbase.h" 
+
+// FORWARD DECLARATIONS
+
+// For two digit calling, some options are defined
+// elsewhere.
+class CPhoneGsmOptionContainerExt;
+
+// CLASS DECLARATION
+
+/**
+* It is container for options. Each option is identified by 
+* a single uid and each option has a boolean status.
+*
+* @since 1.0
+* @lib phoneparser.lib
+*/
+NONSHARABLE_CLASS( CPhoneGsmOptionContainer )
+        : public CPhoneGsmOptionContainerBase    
+    {
+    public:  // Constructors and destructor      
+        /**
+        * Two-phased constructor.
+        */
+        static CPhoneGsmOptionContainer* NewL();
+        
+        /**
+        * Destructor.
+        */
+        ~CPhoneGsmOptionContainer();
+
+    public: // New functions
+        
+        /**
+        * Checks if option is defined.
+        * 
+        * @param aOptionUid It is the uid of the option.
+        * @return Returns ETrue, only if it is defined.
+        */
+        TBool IsOptionDefined( TInt aOptionUid ) const;
+
+        /**
+        * Defines an option.
+        *
+        * Method panics if option is already defined. Note that 
+        * the method might leave.
+        *
+        * @param aOptionUid It is the uid of the new option.
+        * @param aStatus It is the initial status for the option.
+        */
+        void DefineOptionL( TInt aOptionUid, TBool aStatus );
+            
+        /**
+        * This method can be used to make overrides to definition of phone numbers.
+        *
+        * For example, there can be two digit emergency numbers which are normally
+        * considered as ussd requests.
+        *
+        * Note: this can return directly EFalse in which case standard
+        * GSM practices are applied.
+        *
+        * @param aNumber string to be checked.
+        * @return ETrue if should be considered as phone number.
+        */
+        TBool IsEmergencyNumber( const TDesC& aNumber, TDes& aEmergencyNumber );
+
+        /**
+        * From CPhoneGsmOptionContainerBase. 
+        * Sets status of option.
+        *
+        * Method panics if option is not defined.
+        *
+        * @param aOptionUid It is the uid of the option.
+        * @param aStatus It is the new status for the option.
+        */
+        void SetOptionStatus( TInt aOptionUid, TBool aStatus );   
+                
+        /**
+        * From CPhoneGsmOptionContainerBase.
+        * Finds status of option.
+        *
+        * Method panics if option is not defined.
+        *
+        * @param aOptionUid It is the uid of the option.
+        * @return Returne status of the option.
+        */
+        TBool FindOptionStatus( TInt aOptionUid ) const;             
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CPhoneGsmOptionContainer();
+
+        /**
+        * Symbian OS constructor.
+        */
+        void ConstructL();
+
+        /**
+        * Creates key.
+        */
+        static TKeyArrayFix MakeKey();
+
+        // By default, prohibit copy constructor
+        CPhoneGsmOptionContainer( const CPhoneGsmOptionContainer& );
+        // Prohibit assigment operator
+        CPhoneGsmOptionContainer& operator= ( const CPhoneGsmOptionContainer& );
+
+    private:    // Data
+        
+        /**
+        * It is the structure containing information about single option.
+        */
+        class TOptionItem 
+            {
+            public:
+                TInt iUid;
+                TBool iStatus;
+            };
+
+        /**
+        * It is the type for array of options.
+        */
+        typedef CArrayFixFlat< TOptionItem > COptionArray;
+
+        // Owned: array of options.
+        COptionArray* iOptions;
+
+        // Owned: option extension for two digit calling.
+        CPhoneGsmOptionContainerExt* iExtension;
+
+    };
+
+#endif      // CPHONEGSMOPTIONCONTAINER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/inc/cphonegsmparser.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,134 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  It is class that provides parsing functionality.
+*
+*/
+
+
+#ifndef CPHONEGSMPARSER_H
+#define CPHONEGSMPARSER_H
+
+// INCLUDES
+#include    <e32base.h>
+#include    "cphonegsmparserbase.h" 
+
+// FORWARD DECLARATIONS
+class CPhoneGsmParserResult;
+class CPhoneGsmOptionContainerBase;
+class CPhoneGsmOptionContainer;
+
+// CLASS DECLARATION
+
+/**
+* It is class that provides parsing functionality.
+*
+* @since 1.0
+* @lib phoneparser.lib.
+*/
+NONSHARABLE_CLASS( CPhoneGsmParser )
+    : public CPhoneGsmParserBase
+    {           
+    public:  // Constructors and destructor      
+        
+        /**
+        * Two-phased constructor.
+        *
+        * Note that ownership is transferred!
+        */
+        static CPhoneGsmParser* NewL(
+            CPhoneGsmParserBase* aSsProcedure,
+            CPhoneGsmParserBase* aSimControlProcedure,
+            CPhoneGsmParserBase* aPhoneNumber,
+            CPhoneGsmParserBase* aManufacturerSpecific,
+            CPhoneGsmParserBase* aEmergencyNumberParser,
+            CPhoneGsmParserBase* iVoipNumber);
+        
+        /**
+        * Destructor.
+        */
+        ~CPhoneGsmParser();
+
+    public: // New functions
+        
+        /**
+        * From CPhoneGsmParserBase.
+        * Parses the string.
+        *
+        * @param aString It is string to be parsed.
+        * @param aResult It will contain the results of parsing.
+        * @param aOptions It is option container.
+        */
+        TBool ParseL( 
+            const TDesC& aString, 
+            CPhoneGsmParserResult& aResult,
+            CPhoneGsmOptionContainerBase& aOptions );
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CPhoneGsmParser(
+            CPhoneGsmParserBase* aSsProcedure,
+            CPhoneGsmParserBase* aSimControlProcedure,
+            CPhoneGsmParserBase* aPhoneNumber,
+            CPhoneGsmParserBase* aManufacturerSpecific,
+            CPhoneGsmParserBase* aEmergencyNumberParser,
+            CPhoneGsmParserBase* iVoipNumber);
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Parses the string.
+        */
+        TBool DoParseL( 
+            const TDesC& aString, 
+            CPhoneGsmParserResult& aResult,
+            CPhoneGsmOptionContainer& aOptions );
+
+        /**
+        * Define string as unstructured supplementary service.
+        */
+        TBool DefineAsUssdL( 
+            const TDesC& aString,
+            CPhoneGsmParserResult& aResult,
+            CPhoneGsmOptionContainer& aOptions );
+        
+    private:    // Data
+
+        // Owned supplementary service procedurwe parser.
+        CPhoneGsmParserBase* iGsmSsProcedure;
+
+        // Owned SIM control procedure parser.
+        CPhoneGsmParserBase* iGsmSimControlProcedure;
+
+        // Owned phone number parser.
+        CPhoneGsmParserBase* iGsmPhoneNumber;
+
+        // Owned manufacturer specific procedure parser.
+        CPhoneGsmParserBase* iGsmManufacturerProcedure;
+        
+        // Owned emergency number parser.
+        CPhoneGsmParserBase* iGsmEmergencyNumber;
+        
+        // Owned voip number parser.
+        CPhoneGsmParserBase* iVoipNumber;
+    };
+
+#endif      // CPHONEGSMPARSER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/inc/cphonegsmparsercontainer.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,95 @@
+/*
+* 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:  It is handler that is also container for handlers. Parsing 
+*                requests are simply forwarded to the contained handlers.
+*
+*/
+
+
+#ifndef CPHONEGSMPARSERCONTAINER_H
+#define CPHONEGSMPARSERCONTAINER_H
+
+// INCLUDES
+#include    <e32base.h>
+#include    "cphonegsmparserbase.h" 
+
+// CLASS DECLARATION
+
+/**
+* It is itself a parser and it is container for parsers. Parsing is
+* done so that each of the contained parsers are called.
+*
+* @since 1.0
+* @lib phoneparser.lib
+*/
+NONSHARABLE_CLASS( CPhoneGsmParserContainer )
+    : public CPhoneGsmParserBase
+    {
+    public: // Constructors and destructor      
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CPhoneGsmParserContainer* NewLC();
+        
+        /**
+        * Destructor.
+        */
+        ~CPhoneGsmParserContainer();
+
+    public: // New functions
+        
+        /**
+        * Add a parser to the container.
+        *
+        * Note that ownership is transferred. Panics if parser is already
+        * added.
+        */
+        void AddL( CPhoneGsmParserBase& aParser );
+
+    public: // Functios from base classes
+
+        /**
+        * From CPhoneGsmParserBase, parses strings.
+        */
+        TBool ParseL( 
+            const TDesC& aString, 
+            CPhoneGsmParserResult& aResult,
+            CPhoneGsmOptionContainerBase& aOptions );
+                
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CPhoneGsmParserContainer();
+
+        /**
+        * Symbian OS constructor.
+        */
+        void ConstructL();
+       
+    private:    // Data
+
+        // Type for parser array.
+        typedef CArrayPtrFlat< CPhoneGsmParserBase > CParserArray;
+
+        // Owned array of parsers.
+        CParserArray* iArray;
+
+    };
+
+#endif      // CPHONEGSMPARSERCONTAINER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/inc/cphonegsmpcnprocedureparser.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,111 @@
+/*
+* 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:  It is parser for PCN specific procedures.
+*
+*/
+
+
+#ifndef CPHONEGSMPCNPROCEDUREPARSER_H
+#define CPHONEGSMPCNPROCEDUREPARSER_H
+
+// INCLUDES
+#include    "cphonegsmparserbase.h" 
+
+// CONSTANTS
+
+/*
+* Perfom SIM locking.
+*/
+const TUint32 KPhoneUidSimLockCode =
+    PHONE_MAKE_UID( KPhoneGsmUidPcnProcedures, 0 );
+
+/*
+* Perform SIM unlocking. 
+*/
+const TUint32 KPhoneUidSimUnlockCode =
+    PHONE_MAKE_UID( KPhoneGsmUidPcnProcedures, 1 );
+
+// CLASS DECLARATION
+
+/**
+* It is parser for GsmPcn specific procedures.
+*
+* @since 1.0
+* @lib phoneparser.lib
+*/
+NONSHARABLE_CLASS( CPhoneGsmPcnProcedureParser )
+    : public CPhoneGsmParserBase
+    {
+    public:  // Constructors and destructor      
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CPhoneGsmPcnProcedureParser* NewLC();
+        
+    public: // Functions from base classes
+
+        /**
+        * From CPhoneGsmParserBase, parses string.
+        *
+        * String must not contain other characters than from set
+        * { 0..9, *, #, +, p, w }. If method leaves, then result
+        * may contain something that is not valid.
+        *
+        * @param aString string to be parsed.
+        * @param aResult It will contain result.
+        * @param aOptions It contains all options related to parsing.
+        * @return It returns boolean value indicating success of parsing.
+        */
+        TBool ParseL( 
+            const TDesC& aString,
+            CPhoneGsmParserResult& aResult,
+            CPhoneGsmOptionContainerBase& aOptions );
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CPhoneGsmPcnProcedureParser();
+
+        /**
+        * Handles SIM lock closing.
+        */
+        TBool HandleSimLockCodeL(
+            const TDesC& aString,
+            CPhoneGsmParserResult& aResult );
+
+        /**
+        * Handles SIM lock opening.
+        */
+        TBool HandleSimUnlockCodeL(
+            const TDesC& aString,
+            CPhoneGsmParserResult& aResult );       
+
+        /**
+        * Handle lock commands.
+        *
+        * @param aString string.
+        * @param aResult result.
+        */
+        TBool HandleLockCodeParametersL( 
+            const TDesC& aString,
+            CPhoneGsmParserResult& aResult );
+
+    };
+
+#endif      // CPHONEGSMPCNPROCEDUREPARSER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/inc/cphonegsmphonenumberparser.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,197 @@
+/*
+* 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:  It is parser for phone numbers.
+*
+*/
+
+
+#ifndef CPHONEGSMPHONENUMBERPARSER_H
+#define CPHONEGSMPHONENUMBERPARSER_H
+
+// INCLUDES
+#include    "cphonegsmparserbase.h" 
+
+// FORWARD DECLARATIONS
+class CPhoneGsmOptionContainer;
+// CONSTANTS
+
+/*
+* PHONE NUMBER UIDS
+*/
+
+const TUint32 KPhoneUidPhoneNumber = 
+    PHONE_MAKE_UID( KPhoneGsmUidDialPhoneNumber, 0 );
+
+/*
+* Dial phone number related constants, store to aux information field.
+*/
+
+/*
+* There was no prefix, use default clir.
+*/
+const TUint KPhoneDialDefaultClir = 0;
+
+/*
+* There was clir suppress prefix.
+*/
+const TUint KPhoneDialSuppressClir = 1;
+
+/*
+* There was clir invoke prefix.
+*/
+const TUint KPhoneDialInvokeClir = 2;
+
+// CLASS DECLARATION
+
+/**
+* It is parser for phone numbers.
+*
+* @since 1.0
+* @lib phoneparser.lib
+*/
+NONSHARABLE_CLASS( CPhoneGsmPhoneNumberParser )
+    : public CPhoneGsmParserBase
+    {
+    public:  // Constructors and destructor      
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CPhoneGsmPhoneNumberParser* NewLC();
+
+    public: // Functions from base classes
+
+        /**
+        * From CPhoneGsmParserBase.
+        * Parse string.
+        *
+        * @param aString It is string to be parsed.
+        * @param aResult It will contain result.
+        * @param aOptionUid It is the uid of the option.
+        * @return It returns boolean value indicating success of parsing.
+        */
+        TBool ParseL( 
+            const TDesC& aString,
+            CPhoneGsmParserResult& aResult,
+            CPhoneGsmOptionContainerBase& aOptions );
+            
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CPhoneGsmPhoneNumberParser();
+
+        /**
+        * Parse.
+        * 
+        * @param aString It is string to be parsed.
+        * @param aResult It will contain result.
+        * @param aOptionUid It is the uid of the option.
+        * @return It returns boolean value indicating success of parsing.
+        */
+        TBool DoParseL( 
+            const TDesC& aString,
+            CPhoneGsmParserResult& aResult,
+            CPhoneGsmOptionContainer& aOptions );
+
+
+        /**
+        * Handle supplementary service prefixes.
+        * Checks is there clir suppress/invoke prefix in the string.
+        * @param aLex Contains string to be handled.
+        * @param aResult It will contain result.
+        */
+        TBool HandleServicePrefix( 
+            TLex& aLex, 
+            CPhoneGsmParserResult& aResult );
+
+        /**
+        * Takes a main part of the phone number( before 'p','w' or 
+        * second '+' marks ). 
+        * And add it to parameter of the aResult with or without optional 
+        * international prefix.
+        * @param aLex Contains string to be handled.
+        * @param aResult It will contain result.
+        */
+        TBool TakeNumberPartL(
+            TLex& aLex,
+            CPhoneGsmParserResult& aResult );
+
+        /**
+        * Takes Dtmf postfix and add it to parameter of the aResult.
+        * @param aLex Contains string to be handled.
+        * @param aResult It will contain result.
+        */
+        TBool TakeDtmfPostfixL(
+            TLex& aLex,
+            CPhoneGsmParserResult& aResult );
+
+        /**
+        * Checks if param aLeft is prefix of param aDest.
+        */
+        static TBool EqualsLeft( const TDesC& aDest, const TDesC& aLeft );
+
+        /**
+        * Checks if string contains p or w characters.
+        *
+        * @param aString It is string to be checked.
+        * @return ETrue if string contains p or w characters.
+        */
+        TBool ContainsPauseOrWaitChars( const TDesC& aString ) const;
+
+        /**
+        * Checks if rightmost character in string is #.
+        *
+        * @param aString It is string to be checked.
+        * @return ETrue if string is hash string.
+        */
+        TBool IsHashString( const TDesC& aString ) const;
+
+        /**
+        * Checks if string is zero and zero dialling is on and
+        * it is not in call situation.
+        *
+        * @param aString It is string to be checked.
+        * @param aOptions Is call options
+        * @return ETrue if zero dialling.
+        */
+        TBool IsZeroDialling( const TDesC& aString, 
+            CPhoneGsmOptionContainer& aOptions ) const;
+
+        /**
+        * Checks if two digit dialling is on and string 
+        * is two digit string.
+        *
+        * @param aString It is string to be checked.
+        * @return ETrue if two digit dialling.
+        */
+        TBool IsTwoDigitDialling( const TDesC& aString ) const;
+
+        /**
+        * Checks if Input string is a 2 digit starting with a "1"
+        * and it is not in call situation.
+        *
+        * @param aString It is string to be checked.
+        * @param aOptions Is call options
+        * @return ETrue if 1x dialling situation.
+        */
+        TBool Is1xDialling( const TDesC& aString,
+            CPhoneGsmOptionContainer& aOptions ) const;
+        
+    };
+
+#endif      // CPHONEGSMPHONENUMBERPARSER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/inc/cphonegsmsimcontrolparser.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,173 @@
+/*
+* 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:  It is parser for SIM control procedures.
+*
+*/
+
+
+#ifndef CPHONEGSMSIMCONTROLPARSER_H
+#define CPHONEGSMSIMCONTROLPARSER_H
+
+// INCLUDES
+#include    "cphonegsmparserbase.h" 
+
+// CONSTANTS
+
+/**
+* SIM CONTROL UIDS
+*/
+
+const TUint32 KPhoneUidPinChange = 
+    PHONE_MAKE_UID( KPhoneGsmUidSimControlProcedure, 1 );
+const TUint32 KPhoneUidPin2Change = 
+    PHONE_MAKE_UID( KPhoneGsmUidSimControlProcedure, 2 );
+const TUint32 KPhoneUidPinUnblock = 
+    PHONE_MAKE_UID( KPhoneGsmUidSimControlProcedure, 3 );
+const TUint32 KPhoneUidPin2Unblock = 
+    PHONE_MAKE_UID( KPhoneGsmUidSimControlProcedure, 4 );
+
+// CLASS DECLARATION
+
+/**
+* It parses sim control procedures.
+*
+* @since 1.0
+* @lib phoneparser.lib
+*/
+NONSHARABLE_CLASS( CPhoneGsmSimControlParser )
+    : public CPhoneGsmParserBase
+    {
+    public:  // Constructors and destructor      
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CPhoneGsmSimControlParser* NewLC();
+
+    public: // Functions from base classes
+
+        /**
+        * From CPhoneGsmParserBase, parses sim control procedures.
+        *
+        * @param aString It is string to be parsed.
+        * @param aResult It will contain result.
+        * @param aSendOperation It indicates if it would be SEND operation.
+        * @return It returns boolean value indicating success of parsing.
+        */    
+        TBool ParseL( 
+            const TDesC& aString,
+            CPhoneGsmParserResult& aResult,
+            CPhoneGsmOptionContainerBase& aOptions );
+        
+    private:
+
+        /**
+        * It is type of parameter checking procedures.
+        *
+        * @param aDesc It is the parameter.
+        * @return Returns if the parameter is acceptable.
+        */ 
+        typedef TBool (*TParameterValidationFunction)( const TDesC& aParam );
+
+        /**
+        * C++ default constructor.
+        */
+        CPhoneGsmSimControlParser();
+
+        /**
+        * Parse sim control procedures.
+        */
+        TBool DoParseL(
+            const TDesC& aString,
+            CPhoneGsmParserResult& aResult,
+            TBool aSendOperation,
+            TBool aInCall );
+
+        /**
+        * Handle pin operations (pin change, unblock)
+        */
+        TBool HandlePinOperationsL( 
+            TLex& aInput, 
+            CPhoneGsmParserResult& aResult );
+
+        /**
+        * Check that there is '**' in the beginning of input.
+        */
+        TBool HandlePinPrefix( 
+            TLex& aInput,
+            CPhoneGsmParserResult& aResult );
+
+        /**
+        * Handle pin change code.
+        */
+        TBool HandlePinChangeL(
+            TLex& aInput,
+            CPhoneGsmParserResult& aResult );
+
+        /**
+        * Handle pin unblock code.
+        */
+        TBool HandlePinUnblockL(
+            TLex& aInput,
+            CPhoneGsmParserResult& aResult );
+
+        /**
+        * Handle no more parameters (only hash).
+        */
+        TBool HandleNoParameters(
+            TLex& aInput,
+            CPhoneGsmParserResult& aResult );
+
+        /**
+        * Handle pin password.
+        */
+        TBool HandlePinL(
+            TLex& aInput,
+            CPhoneGsmParserResult& aResult );
+
+        /**
+        * Handle pin unblocking key.
+        */
+        TBool HandlePukL(
+            TLex& aInput, 
+            CPhoneGsmParserResult& aResult );
+
+        /**
+        * Handle parameters.
+        */
+        TBool HandleParameterL( 
+            TLex& aInput,
+            CPhoneGsmParserResult& aResult,
+            TParameterValidationFunction aFunc );
+
+        /**
+        * Returns number.
+        */
+        TPtrC NextNumber( TLex& aInput );
+
+        /**
+        * Validate syntax of pin.
+        */
+        static TBool ValidatePin( const TDesC& aParam );
+
+        /**
+        * Validate syntax of puk.
+        */
+        static TBool ValidatePuk( const TDesC& aParam );
+
+    };
+
+#endif      // CPHONEGSMSIMCONTROLPARSER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/inc/cphonegsmsscallparser.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,93 @@
+/*
+* 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:  It is responsible of parsing GSM specified supplementary 
+*                services that can be entered during calls.
+*
+*/
+
+
+#ifndef CPHONEGSMSSCALLPARSER_H
+#define CPHONEGSMSSCALLPARSER_H
+
+// INCLUDES
+#include    <e32base.h>
+#include    "cphonegsmparserbase.h" 
+
+// CONSTANTS
+
+/*
+* SUPPLEMENTARY SERVICE UIDS - DURING CALLS
+*
+* Final commands depend on the state of the phone and that's why they
+* decided in handler.
+*/
+
+const TUint32 KPhoneUidCommand0 =
+    PHONE_MAKE_UID( KPhoneGsmUidSupplementaryServiceDuringCall, 0 );
+const TUint32 KPhoneUidCommand1 =
+    PHONE_MAKE_UID( KPhoneGsmUidSupplementaryServiceDuringCall, 1 );
+const TUint32 KPhoneUidCommand2 =
+    PHONE_MAKE_UID( KPhoneGsmUidSupplementaryServiceDuringCall, 2 );
+const TUint32 KPhoneUidCommand3 =
+    PHONE_MAKE_UID( KPhoneGsmUidSupplementaryServiceDuringCall, 3 );
+const TUint32 KPhoneUidCommand4 =
+    PHONE_MAKE_UID( KPhoneGsmUidSupplementaryServiceDuringCall, 10 );
+
+// CLASS DECLARATION
+
+/**
+* It is responsible of parsing GSM specified supplementary services 
+* that can be entered during calls.
+*
+* @since 1.0
+* @lib phoneparser.lib
+*/
+NONSHARABLE_CLASS( CPhoneGsmSsCallParser )
+    : public CPhoneGsmParserBase
+    {
+    public: // Constructors and destructor      
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CPhoneGsmSsCallParser* NewLC();
+        
+    public: // Functions from base classes
+        
+        /**
+        * From CPhoneGsmParserBase. 
+        * Parses ss strings.
+        *
+        * @param aString string to parse.
+        * @param aResult It will contain result.
+        * @param aOptions It contains options.
+        * @return ETrue iff parsed successfully.
+        */
+        TBool ParseL( 
+            const TDesC& aString, 
+            CPhoneGsmParserResult& aResult,
+            CPhoneGsmOptionContainerBase& aOptions );
+                
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CPhoneGsmSsCallParser();
+      
+    };
+
+#endif      // CPHONEGSMSSCALLPARSER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/inc/cphonegsmssparser.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,460 @@
+/*
+* 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:  It is responsible of parsing of GSM specified supplementary 
+*                service requests.
+*
+*/
+
+
+#ifndef CPHONEGSMSSPARSER_H
+#define CPHONEGSMSSPARSER_H
+
+// INCLUDES
+#include    <e32base.h>
+#include    "cphonegsmparserbase.h" 
+
+// CONSTANTS
+
+/*
+* SUPPLEMENTARY SERVICE UIDS
+*/
+
+/*
+* Now follows uids for all supported supplementary services.
+*/
+const TUint32 KPhoneUidForwardingAll = 
+    PHONE_MAKE_UID( KPhoneGsmUidSupplementaryService, 0 );
+const TUint32 KPhoneUidForwardingAllConditional = 
+    PHONE_MAKE_UID( KPhoneGsmUidSupplementaryService, 1 );
+const TUint32 KPhoneUidForwardingUnconditional = 
+    PHONE_MAKE_UID( KPhoneGsmUidSupplementaryService, 2 );
+const TUint32 KPhoneUidForwardingNoReply = 
+    PHONE_MAKE_UID( KPhoneGsmUidSupplementaryService, 3 );
+const TUint32 KPhoneUidForwardingNotReachable = 
+    PHONE_MAKE_UID( KPhoneGsmUidSupplementaryService, 4 );
+const TUint32 KPhoneUidForwardingBusy = 
+    PHONE_MAKE_UID( KPhoneGsmUidSupplementaryService, 5 );
+const TUint32 KPhoneUidBarringAllOutgoingCalls = 
+    PHONE_MAKE_UID( KPhoneGsmUidSupplementaryService, 6 );
+const TUint32 KPhoneUidBarringAllIncomingCalls =
+    PHONE_MAKE_UID( KPhoneGsmUidSupplementaryService, 7 );
+const TUint32 KPhoneUidBarringAllServices =
+    PHONE_MAKE_UID( KPhoneGsmUidSupplementaryService, 8 );
+const TUint32 KPhoneUidBarringAllOutgoingInternationalCalls =
+    PHONE_MAKE_UID( KPhoneGsmUidSupplementaryService, 9 );
+const TUint32 KPhoneUidBarringAllOutgoingInternationalCallsExceptHome =
+    PHONE_MAKE_UID( KPhoneGsmUidSupplementaryService, 10 );
+const TUint32 KPhoneUidBarringAllOutgoingServices = 
+    PHONE_MAKE_UID( KPhoneGsmUidSupplementaryService, 11 );
+const TUint32 KPhoneUidBarringAllIncomingCallsWhenRoaming =
+    PHONE_MAKE_UID( KPhoneGsmUidSupplementaryService, 12 );
+const TUint32 KPhoneUidBarringAllIncomingServices = 
+    PHONE_MAKE_UID( KPhoneGsmUidSupplementaryService, 13 );
+const TUint32 KPhoneUidWaiting =
+    PHONE_MAKE_UID( KPhoneGsmUidSupplementaryService, 14 );
+const TUint32 KPhoneUidCallingLineIdentificationPresentation =
+    PHONE_MAKE_UID( KPhoneGsmUidSupplementaryService, 15 );
+const TUint32 KPhoneUidCallingLineIdentificationRestriction =
+    PHONE_MAKE_UID( KPhoneGsmUidSupplementaryService, 16 );
+const TUint32 KPhoneUidConnectedLinePresentation =
+    PHONE_MAKE_UID( KPhoneGsmUidSupplementaryService, 17 );
+const TUint32 KPhoneUidConnectedLinePresentationRestriction =
+    PHONE_MAKE_UID( KPhoneGsmUidSupplementaryService, 18 );
+const TUint32 KPhoneUidPassword =
+    PHONE_MAKE_UID( KPhoneGsmUidSupplementaryService, 19 );
+const TUint32 KPhoneUidCallingNamePresentation =
+    PHONE_MAKE_UID( KPhoneGsmUidSupplementaryService, 20 );
+
+/**
+* It defines the maximum lenght of service code.
+*/
+const TInt KPhoneGsmSsServiceCodeMaxLength = 5;
+
+// CLASS DECLARATION
+
+/**
+* It is responsible of parsing GSM specified supplementary services that
+* are supported.
+*
+* @since 1.0
+* @lib phoneparser.lib
+*/
+NONSHARABLE_CLASS( CPhoneGsmSsParser )
+    : public CPhoneGsmParserBase
+    {
+    public: // Types
+
+        /**
+        * Enumeration for different service types.
+        */
+        enum TServiceType
+            {
+            EServiceActivation,
+            EServiceDeactivation,
+            EServiceInterrogation,
+            EServiceRegistration,
+            EServiceErasure
+            };
+
+        /** 
+        * Enumeration for different syntax.
+        *
+        * ESyntaxNotAllowed
+        *   Not allowed.
+        *
+        * ESyntaxNoParameters
+        *   No parameters. 
+        *
+        *     SS_code#
+        *
+        * ESyntaxEmptyOrBasicCode
+        *   No parameters or empty and basic code.
+        *
+        *     SS_code# or SS_code**BB#             
+        *
+        * ESyntaxNumberOptBasicCodeOptTimer
+        *   Number parameter or number parameter and basic code or
+        *   number parameter and basic code and timer or number parameter
+        *   and timer.
+        *
+        *     SS_code*NN# or SS_code*NN*BB# or SS_code*NN*BB*TT# or
+        *     SS_code*NN**TT#
+        *
+        * ESyntaxNumberOptBasicCode
+        *   Number parameter or number parameter and basic code.
+        *
+        *     SS_code*NN# or SS_code*NN*BB#
+        *
+        * ESyntaxPasswordOptBasicCode
+        *   Password or password and basic code. 
+        *
+        *     SS_code*PPPP# or SS_code*PPPP*BB#
+        *
+        * ESyntaxOptGroupCodePasswordNewPasswordNewPassword
+        *
+        *   Register group code and password and new password and 
+        *   new password. Or same with empty register group.
+        *
+        *     SS_code*xxx*PPPP*WWWW*WWWW#         
+        *     SS_code**PPPP*WWWW*WWWW#
+        *
+        * ESyntaxEmptyOrBasicCode2    
+        *   Empty or Basic code 
+        *
+        *     SS_code# or SS_code*BB#
+        */
+        enum TServiceSyntax
+            {
+            ESyntaxNotAllowed,
+            ESyntaxNoParameters, 
+            ESyntaxEmptyOrBasicCode, 
+            ESyntaxNumberOptBasicCodeOptTimer,
+            ESyntaxNumberOptBasicCode,
+            ESyntaxPasswordOptBasicCode,
+            ESyntaxOptGroupCodePasswordNewPasswordNewPassword,
+            ESyntaxEmptyOrBasicCode2
+            };
+
+    public:  // Constructors and destructor      
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CPhoneGsmSsParser* NewLC();
+        
+        /**
+        * Destructor.
+        */
+        ~CPhoneGsmSsParser();
+
+    public: // New functions
+        
+
+        /**
+        * Pack data to integer.
+        *
+        * @param aResult It will contain packed data.
+        * @param aType type of service.
+        * @param aSyntax syntax of service.
+        */
+        static void PackData(
+            TUint& aResult,
+            TServiceType aType,
+            TServiceSyntax aSyntax );       
+
+        /**
+        * Unpack data from integer.
+        *
+        * @param aData packed data.
+        * @param aType type of service.
+        * @param aSyntax syntax of service.
+        */
+        static void UnpackData(
+            TUint aData,
+            TServiceType& aType,
+            TServiceSyntax& aSyntax );
+        
+// from base class CPhoneGsmParserBase    
+        
+        /**
+         * From CPhoneGsmParserBase.
+         * Parses ss strings.
+         *
+         * @param aString string to be parser.
+         * @param aResult It will contain result.
+         * @param aOptions It contains options.
+         * @return ETrue iff string parsed successfully.
+         */
+         TBool ParseL(
+                 const TDesC& aString, 
+                 CPhoneGsmParserResult& aResult,
+                 CPhoneGsmOptionContainerBase& aOptions );
+        
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CPhoneGsmSsParser();
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Handle parameters.
+        */
+        TBool HandleParametersL( 
+            TLex& aInput, 
+            CPhoneGsmParserResult& aResult,
+            TServiceSyntax aSyntax );
+
+        /**
+        * Handle "not allowed" syntax.
+        */
+        TBool HandleNotAllowedL( 
+            TLex& aInput, 
+            CPhoneGsmParserResult& aResult );
+
+        /**
+        * Handle "no more parameters" syntax.
+        */ 
+        TBool HandleNoParametersL( 
+            TLex& aInput, 
+            CPhoneGsmParserResult& aResult );
+
+        /**
+        * Handle "empty or basic code" syntax.
+        */
+        TBool HandleEmptyOrBasicCodeL( 
+            TLex& aInput,
+            CPhoneGsmParserResult& aResult );
+
+        /**
+        * Handle "number optionally basic code and timer" syntax.
+        */
+        TBool HandleNumberOptBasicCodeOptTimerL(
+            TLex& aInput,
+            CPhoneGsmParserResult& aResult );
+
+        /**
+        * Handle "number optionally basic code" syntax.
+        */
+        TBool HandleNumberOptBasicCodeL(
+            TLex& aInput,
+            CPhoneGsmParserResult& aResult );
+
+        /**
+        * Handle "password optionally basic code" syntax.
+        */
+        TBool HandlePasswordOptBasicCodeL(
+            TLex& aInput,
+            CPhoneGsmParserResult& aResult );
+
+        /**
+        * Handle "optionally group code, then old password and new
+        * password twice" syntax.
+        */
+        TBool HandleOptGroupCodePasswordNewPasswordNewPasswordL(
+            TLex& aInput,
+            CPhoneGsmParserResult& aResult );
+
+        /**
+        * Handle "empty or basic code" syntax.
+        */
+        TBool HandleEmptyOrBasicCode2L(
+            TLex& aInput,
+            CPhoneGsmParserResult& aResult );
+
+        /**
+        * Handle "empty parameter" syntax.
+        */
+        TBool HandleEmptyParameterL( 
+            TLex& aInput,
+            CPhoneGsmParserResult& aResult );
+
+        /**
+        * Handle "basic code" syntax.
+        */
+        TBool HandleBasicCodeL( 
+            TLex& aInput,
+            CPhoneGsmParserResult& aResult );
+
+        /**
+        * Handle "directory number" syntax.
+        */
+        TBool HandleNumberL( 
+            TLex& aInput,
+            CPhoneGsmParserResult& aResult );
+
+        /**
+        * Handle "timer" syntax.
+        */
+        TBool HandleTimerL( 
+            TLex& aInput,
+            CPhoneGsmParserResult& aResult );
+
+        /**
+        * Handle "password" syntax.
+        */
+        TBool HandlePasswordL( 
+            TLex& aInput,
+            CPhoneGsmParserResult& aResult );
+
+        /**
+        * Handle "group code" syntax.
+        */
+        TBool HandleGroupCodeL( 
+            TLex& aInput,
+            CPhoneGsmParserResult& aResult );
+
+        /**
+        * Check basic service code.
+        */
+        TBool CheckBasicCode( const TDesC& aCode );
+
+        /**
+        * Check 'no reply timer'
+        */
+        TBool CheckTimer( const TDesC& aCode );
+
+        /**
+        * Check password group code.
+        */ 
+        TBool CheckGroupCode( const TDesC& aCode );
+
+        /**
+        * Find string (starting from current position) that 
+        * contains characters from given string. 
+        *
+        * (note that empty string may be returned).
+        */
+        static TPtrC FindString( 
+            TLex& aInput,
+            const TDesC& aAllowedCharacters );
+
+        /**
+        * Add a new service.
+        *
+        * SHOULD ONLY BE USED DURING CONSTRUCTION.
+        *
+        * Panics if invalid service description is passed.
+        *
+        * @param aService It is service description.
+        * @param aUid It is uid for the service.
+        */
+        void AddL( const TDesC& aService, TUint aUid );
+
+        /**
+        * Add a new service.
+        *
+        * SHOULD ONLY BE USED DURING CONSTRUCTION.
+        */
+        void AddServiceL( 
+            const TDesC& aServiceCode,
+            TServiceSyntax aActivation,
+            TServiceSyntax aDeactivation,
+            TServiceSyntax aInterrogation,
+            TServiceSyntax aRegistration,
+            TServiceSyntax aErasure,
+            TUint aUid );
+
+        /**
+        * Get next number as descriptor.
+        *
+        * ONLY TO BE USED DURING SERVICE DESCRIPTION PARSING.
+        *
+        * Panics if next character (not a space) does not start 
+        * a new number or the number is invalid.
+        *
+        * @param aLex It is lex.
+        * @return Returns number.
+        */
+        static TPtrC NextNumber( TLex& aLex );
+
+        /**
+        * Get next number as value.
+        *
+        * ONLY TO BE USED DURING SERVICE DESCRIPTION PARSING.
+        *
+        * Panics if next character (not a space) does not start 
+        * a new number or the number is invalid.
+        *
+        * @param aLex It is lex.
+        * @return Returns number as value.
+        */
+        static TUint NextNumberAsValue( TLex& aLex );       
+
+        /**
+        * Converts to service syntax.
+        *
+        * @param aService It is numerical value of service syntax.
+        * @return Returns service syntax corresponding to value.
+        */
+        static TServiceSyntax ConvertToServiceSyntax( TUint aService );
+
+    private:    // Data
+
+        /**
+        * It is type for service code.
+        */
+        typedef TBuf< KPhoneGsmSsServiceCodeMaxLength > TServiceCode;
+    
+        /**
+        * It defines structure containing information about a service.
+        */
+        class TServiceInfo
+            {
+            public:
+                TServiceCode iCode;
+                TServiceSyntax iActivation;
+                TServiceSyntax iDeactivation;
+                TServiceSyntax iInterrogation;
+                TServiceSyntax iRegistration;
+                TServiceSyntax iErasure;
+                TUint iUid;
+            };
+
+        // Type for service code array.
+        typedef CArrayFixFlat< TServiceInfo > CServiceArray;
+
+        // Owned array of service codes.
+        CServiceArray* iArray;
+
+    };
+
+#endif      // CPHONEGSMSSPARSER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/inc/cphoneparserfeatures.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,182 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  It encapsulates all dependencies.
+*
+*/
+
+
+#ifndef CPHONEPARSERFEATURES_H
+#define CPHONEPARSERFEATURES_H
+
+#include    <e32base.h>
+
+class CPhCltEmergencyCall;
+class CRepository;
+
+// INCLUDES
+#include    <mphcltemergencycallobserver.h> 
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+* It is extension for options. 
+*
+* @since 1.2
+* @lib phoneparser.lib
+*/
+NONSHARABLE_CLASS( CPhoneParserFeatures )
+    : public CBase, public MPhCltEmergencyCallObserver
+    {
+    public:  // Constructors and destructor      
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CPhoneParserFeatures* InstanceL();
+        
+       /**
+        * To release resources.
+        */
+        static void Free();
+
+    public:  // From MPhCltEmergencyCallObserver   
+        
+        /**
+        * It is called whenever client's dial request is completed.
+        *
+        * @param aStatus error code of the success of the operation.
+        */       
+        void HandleEmergencyDialL( const TInt aStatus );
+
+    public: // New functions
+        
+        /**
+        * Checks if two digit calling is enabled.
+        *
+        * @return ETrue if supported.
+        */
+        static TBool TwoDigitCallingEnabled();
+            
+        /**
+        * Checks if zero send should make a call.
+        *
+        * @return ETrue if enabled.
+        */
+        static TBool IsZeroDialEnabled();
+
+        /**
+        * Checks if feature is supported.
+        *
+        * @param aFeature feature.
+        * @return ETrue if supported.
+        */
+        static TBool FeatureSupported( TInt aFeature );
+        
+        /**
+        * Checks if given number is emergency.
+        *
+        * @param aNumber Number to be queried.aNumber might contain prefix (SS code)
+        *                and/or postfix (DTMF part).
+        *                The aNumber parameter should be a buffer and the 
+        *                clients are provided with a typedef called 
+        *                TPhCltEmergencyNumber. 
+        *
+        * @param aEmergencyNumber Matched emergencynumber without prefix or 
+        *                postfix is returned in this parameter. The aMatchedEmergencyNumber 
+        *                parameter should be a buffer and the clients are
+        *                provided with atypedef called TPhCltEmergencyNumber.
+        * 
+        * @returns ETrue if emergency.
+        */
+        static TBool IsEmergencyNumber( 
+            const TDesC& aNumber, 
+            TDes& aEmergencyNumber );
+            
+        /**
+        * To set stub for testing purposes.
+        *
+        * @param aStub test stub.
+        */       
+#ifdef __WINS__
+        static void SetInstance( CPhoneParserFeatures* aStub );
+#endif // __WINS__
+    
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CPhoneParserFeatures();
+
+        /**
+        * Symbian OS constructor.
+        */
+        void ConstructL();
+
+        /**
+        * Non leaving instance method.
+        */
+        static CPhoneParserFeatures* Instance();
+        
+        /**
+        * Destructor.
+        */
+        ~CPhoneParserFeatures();
+
+        /**
+        * Checks if given number is emergency.
+        *
+        * @param aNumber Number to be queried.aNumber might contain prefix (SS code)
+        *                and/or postfix (DTMF part).
+        *                The aNumber parameter should be a buffer and the 
+        *                clients are provided with a typedef called 
+        *                TPhCltEmergencyNumber. 
+        *
+        * @param aEmergencyNumber Matched emergencynumber without prefix or 
+        *                postfix is returned in this parameter. The aMatchedEmergencyNumber 
+        *                parameter should be a buffer and the clients are
+        *                provided with atypedef called TPhCltEmergencyNumber.
+        * 
+        * @returns ETrue if emergency.
+        */
+        virtual TBool IsEmergencyPhoneNumber( 
+            const TDesC& aNumber, 
+            TDes& aEmergencyNumber );
+            
+        /**
+        * Checks if feature is supported.
+        *
+        * @param aFeature feature.
+        * @return ETrue if supported.
+        */
+        virtual TBool IsFeatureSupported( TInt aFeature );
+        
+        virtual TInt GetTelephoneVariant();
+
+    private:    // Data
+
+
+        // Owned: Phone client emergency number session.
+        CPhCltEmergencyCall* iEmergencyCall;
+ 
+        CRepository* iRepository;
+        
+    };
+
+#endif      // CPHONEPARSERFEATURES_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/inc/cphonevoipnumberparser.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,122 @@
+/*
+* 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:  It is parser for voip numbers.
+*
+*/
+
+
+#ifndef CPHONEVOIPNUMBERPARSER_H
+#define CPHONEVOIPNUMBERPARSER_H
+
+// INCLUDES
+#include    "cphonegsmparserbase.h" 
+#include    <phclttypes.h> 
+
+// FORWARD DECLARATIONS
+class CPhoneGsmOptionContainer;
+
+// CONSTANTS
+
+/*
+* EMERGENCY NUMBER UIDS
+*/
+const TUint32 KPhoneUidVoipNumber = 
+    PHONE_MAKE_UID( KPhoneUidDialVoipyNumber, 0 );
+
+// CLASS DECLARATION
+
+/**
+* It is parser for voip numbers.
+*
+* @since S60 5.0
+* @lib phoneparser.lib
+*/
+NONSHARABLE_CLASS( CPhoneVoipNumberParser )
+    : public CPhoneGsmParserBase
+    {
+    public:  // Constructors and destructor      
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CPhoneVoipNumberParser* NewLC();
+
+    public: // Functions from base classes
+
+        /**
+        * From CPhoneGsmParserBase. 
+        * Parse string.
+        *
+        * @param aString It is string to be parsed.
+        * @param aResult It will contain result.
+        * @param aOptions It indicates operation options.
+        * @return It returns boolean value indicating success of parsing.
+        */
+        TBool ParseL( 
+            const TDesC& aString,
+            CPhoneGsmParserResult& aResult,
+            CPhoneGsmOptionContainerBase& aOptions );
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CPhoneVoipNumberParser();
+
+        /**
+        * Parse.
+        * 
+        * @param aString It is string to be parsed.
+        * @param aResult It will contain result.
+        * @param aOptionUid It is the uid of the option.
+        * @return It returns boolean value indicating success of parsing.
+        */
+        TBool DoParseL( 
+            const TDesC& aString,
+            CPhoneGsmParserResult& aResult,
+            CPhoneGsmOptionContainer& aOptions );
+        /**   
+        * Takes a main part of the phone number( before 'p','w' or 
+        * second '+' marks ). 
+        * And add it to parameter of the aResult with or without optional 
+        * international prefix.
+        * @param aLex Contains string to be handled.
+        * @param aResult It will contain result.
+        */
+        void TakeNumberPartL(
+            TLex& aLex,
+            CPhoneGsmParserResult& aResult );
+
+        /**
+        * Takes Dtmf postfix and add it to parameter of the aResult.
+        * @param aLex Contains string to be handled.
+        * @param aResult It will contain result.
+        */
+        void TakeDtmfPostfixL(
+            TLex& aLex,
+            CPhoneGsmParserResult& aResult );
+        
+        /**
+        * Checks that string contains only valid dtmf characters 
+        * @param aString string to be checked
+        * @return ETrue if valid dtmf string 
+        */
+        TBool IsValidDtmfString( TPtrC& aString );
+
+    };
+
+#endif      // CPHONEVOIPNUMBERPARSER_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/inc/phoneparsercommon.h	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,36 @@
+/*
+* 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:  Common definitions
+*
+*/
+
+
+#ifndef PHONEPARSERCOMMON_H
+#define PHONEPARSERCOMMON_H
+
+/**  Dtmf pause */
+const TInt KPhoneDtmfPause = 'p';
+/**  Dtmf wait */
+const TInt KPhoneDtmfWait = 'w';
+/**  Hash mark */
+const TInt KPhoneNumberHash = '#';
+/**  Asterisk mark */
+const TInt KPhoneNumberAsterisk = '*';
+/**  Plus mark */
+const TInt KPhonePlus = '+';
+/**  Valid Dtmf Chars */
+_LIT( KValidDtmfChars, "0123456789pw*+#" );
+
+
+#endif // PHONEPARSERCOMMON_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/rom/phoneparser.iby	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,25 @@
+/*
+* 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:  PhoneParser's iby definitions.
+ *
+*/
+
+#ifndef __PhoneParser_IBY__
+#define __PhoneParser_IBY__
+
+file=ABI_DIR\BUILD_DIR\phoneparser.dll       System\libs\phoneparser.dll
+data=ZSYSTEM\install\phoneparser_stub.sis    System\Install\phoneparser_stub.sis
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/src/cphonegsmdummyparser.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 dummy parser.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "cphonegsmdummyparser.h" 
+#include    "cphonegsmparserresult.h" 
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmDummyParser::CPhoneGsmDummyParser
+// -----------------------------------------------------------------------------
+//
+CPhoneGsmDummyParser::CPhoneGsmDummyParser()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmDummyParser::ParseL
+// -----------------------------------------------------------------------------
+//
+CPhoneGsmDummyParser* CPhoneGsmDummyParser::NewL()
+    {
+    CPhoneGsmDummyParser* self = new (ELeave) CPhoneGsmDummyParser;
+    
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmDummyParser::ParseL
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmDummyParser::ParseL( 
+        const TDesC& /*aString*/,
+        CPhoneGsmParserResult& aResult,
+        CPhoneGsmOptionContainerBase& /*aOptions*/ )
+    {
+    aResult.ClearL();
+    return EFalse;
+    }      
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/src/cphonegsmemergencynumberhandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* 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:  Handler for emergency numbers.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "cphonegsmemergencynumberhandler.h" 
+#include    "cphonegsmemergencynumberparser.h" 
+#include    "cphonegsmparserresult.h" 
+
+// CONSTANTS
+const TInt KPhoneEmergencyNumberDialParam = 0;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmEmergencyNumberHandler::ProcessL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CPhoneGsmEmergencyNumberHandler::ProcessL( 
+            CPhoneGsmParserResult& aResult )
+    {
+    if ( aResult.Uid() == KPhoneUidEmergencyNumber )
+        {
+        TPtrC number( aResult.ParameterAt( KPhoneEmergencyNumberDialParam ) );
+        ProcessDialToEmergencyNumberL( number );
+        }
+    }   
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/src/cphonegsmemergencynumberparser.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,101 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Parser for emergency numbers.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "cphonegsmemergencynumberparser.h" 
+#include    "cphonegsmparserresult.h" 
+#include    "cphonegsmoptioncontainer.h" 
+#include    "cphoneparserfeatures.h" 
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmEmergencyNumberParser::CPhoneGsmEmergencyNumberParser
+// -----------------------------------------------------------------------------
+//
+CPhoneGsmEmergencyNumberParser::CPhoneGsmEmergencyNumberParser()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmEmergencyNumberParser::NewLC
+// -----------------------------------------------------------------------------
+//
+CPhoneGsmEmergencyNumberParser* CPhoneGsmEmergencyNumberParser::NewLC()
+    {
+    CPhoneGsmEmergencyNumberParser* self = 
+        new ( ELeave ) CPhoneGsmEmergencyNumberParser;
+    
+    CleanupStack::PushL( self );
+        
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmEmergencyNumberParser::ParseL
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmEmergencyNumberParser::ParseL( 
+        const TDesC& aString,
+        CPhoneGsmParserResult& aResult,
+        CPhoneGsmOptionContainerBase& aOptions )
+    {
+    aResult.ClearL();
+
+    TBool result = DoParseL( 
+            aString,
+            aResult,
+            static_cast<CPhoneGsmOptionContainer&>( aOptions ) );
+
+    if ( !result )
+        {
+        aResult.ClearL();
+        }
+
+    return result;
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhoneGsmEmergencyNumberParser::DoParseL
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmEmergencyNumberParser::DoParseL( 
+        const TDesC& aString,
+        CPhoneGsmParserResult& aResult,
+        CPhoneGsmOptionContainer& aOptions )
+    {
+    TBool result( EFalse );
+
+    if ( aOptions.FindOptionStatus( KPhoneOptionSend ) )
+        {
+        iEmergencyPhoneNumber.Zero();
+
+        if ( CPhoneParserFeatures::IsEmergencyNumber( 
+            aString, iEmergencyPhoneNumber ))
+            {
+            aResult.AddParameterL( iEmergencyPhoneNumber );
+            aResult.SetUid( KPhoneUidEmergencyNumber );
+            result = ETrue;
+            }
+        }
+
+    return result;
+    }
+
+    
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/src/cphonegsmhandlercontainer.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,116 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 handler container.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "cphonegsmhandlercontainer.h" 
+#include    "phonegsmparser.h" 
+
+// CONSTANTS
+const TInt KPhoneHandlerArrayGranularity = 10;
+const TInt KPhoneHandlerArrayReserve = 10;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmHandlerContainer::CPhoneGsmHandlerContainer
+// -----------------------------------------------------------------------------
+//
+CPhoneGsmHandlerContainer::CPhoneGsmHandlerContainer()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmHandlerContainer::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CPhoneGsmHandlerContainer::ConstructL()
+    {
+    iHandlers = 
+        new ( ELeave ) CHandlerArray( KPhoneHandlerArrayGranularity );
+    iHandlers->SetReserveL( KPhoneHandlerArrayReserve );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmHandlerContainer::NewL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CPhoneGsmHandlerContainer* CPhoneGsmHandlerContainer::NewL()
+    {
+    CPhoneGsmHandlerContainer* self = 
+        new (ELeave) CPhoneGsmHandlerContainer;
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmHandlerContainer::~CPhoneGsmHandlerContainer
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CPhoneGsmHandlerContainer::~CPhoneGsmHandlerContainer()
+    {
+    if ( iHandlers )
+        {
+        iHandlers->ResetAndDestroy();
+        }
+    delete iHandlers;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmHandlerContainer::AddHandlerL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CPhoneGsmHandlerContainer::AddHandlerL( 
+        CPhoneGsmHandlerBase& aHandler )
+    {
+    TInt index;
+    TInt count = iHandlers->Count();
+
+    for ( index = 0; index < count; index++ )
+        {
+        CPhoneGsmHandlerBase* handler = iHandlers->At( index );
+
+        if ( handler == &aHandler )
+            {
+            PhoneGsmParser::Panic( PhoneGsmParser::EIncorrectUse );
+            }
+        }
+
+    iHandlers->AppendL( &aHandler );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmHandlerContainer::ProcessL
+// -----------------------------------------------------------------------------
+//
+void CPhoneGsmHandlerContainer::ProcessL( 
+        CPhoneGsmParserResult& aResult )
+    {
+    TInt index;
+    TInt count = iHandlers->Count();
+
+    for ( index = 0; index < count; index++ )
+        {
+        iHandlers->At( index )->ProcessL( aResult );
+        }
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/src/cphonegsmmanufacturerhandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 manufacturer handler.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "cphonegsmmanufacturerhandler.h" 
+#include    "cphonegsmmanufacturerparser.h" 
+#include    "cphonegsmparserresult.h" 
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmManufacturerHandler::ProcessL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CPhoneGsmManufacturerHandler::ProcessL( 
+        CPhoneGsmParserResult& aResult )
+    {
+    if ( aResult.Uid() == KPhoneUidManufacturerCode )
+        {
+        ProcessCommandL( aResult.AuxInformation() );
+        }
+#ifdef PHONEPARSER_PARSE_DEBUG_CODE
+    else if ( aResult.Uid() == KPhoneUidManufacturerDebugCode )
+        {
+        ProcessDebugL( aResult.ParameterAt( 0 ) ); // The first parameter is code.
+        }
+#endif
+    }
+    
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/src/cphonegsmmanufacturerparser.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,243 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 manufacturer parser.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "cphonegsmmanufacturerparser.h" 
+#include    "cphonegsmoptioncontainer.h" 
+#include    "cphonegsmparserresult.h" 
+#include    "cphoneparserfeatures.h" 
+
+// CONSTANTS
+const TInt KPhoneManufacturerCodeArrayGanularity = 5;
+
+_LIT( KPhoneHashStr, "#" );
+#ifdef PHONEPARSER_PARSE_DEBUG_CODE
+_LIT( KPhoneDebugPrefixStr, "*#74603" );
+#endif
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmManufacturerParser::CPhoneGsmManufacturerParser
+// -----------------------------------------------------------------------------
+//
+CPhoneGsmManufacturerParser::CPhoneGsmManufacturerParser()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmManufacturerParser::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CPhoneGsmManufacturerParser::ConstructL()
+    {
+    iArray = new ( ELeave ) CCodeArray( 
+        KPhoneManufacturerCodeArrayGanularity );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmManufacturerParser::NewLC
+// -----------------------------------------------------------------------------
+//
+CPhoneGsmManufacturerParser* CPhoneGsmManufacturerParser::NewLC()
+    {
+    CPhoneGsmManufacturerParser* self = 
+        new ( ELeave ) CPhoneGsmManufacturerParser;
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmManufacturerParser::~CPhoneGsmManufacturerParser
+// -----------------------------------------------------------------------------
+//
+CPhoneGsmManufacturerParser::~CPhoneGsmManufacturerParser()
+    { 
+    delete iArray;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmManufacturerParser::AddStringL
+// -----------------------------------------------------------------------------
+//
+void CPhoneGsmManufacturerParser::AddStringL( 
+        const TDesC& aString, 
+        TInt aFlags, 
+        TUint aCommand,
+        TInt aFeatureId )
+    {
+    TCodeInfo info;
+    info.iString.Set( aString );
+    info.iFlags = aFlags;
+    info.iCommand = aCommand;
+    info.iFeatureId = aFeatureId;
+
+    iArray->AppendL( info );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmManufacturerParser::ParseL
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmManufacturerParser::ParseL( 
+        const TDesC& aString,
+        CPhoneGsmParserResult& aResult,
+        CPhoneGsmOptionContainerBase& aOptions )
+    {
+    TBool result = EFalse;
+    
+    aResult.ClearL();
+
+    TInt index;
+    TInt count = iArray->Count();
+
+    // Go through all elements.
+    for ( index = 0; index < count; index++ )
+        {
+        TCodeInfo& info = iArray->At( index ); 
+
+        // Check if string matches to code information.
+        if ( CheckCode( aString, info, aOptions ) ) 
+            {
+            // Yes, fill result
+            aResult.SetUid( KPhoneUidManufacturerCode );
+            aResult.SetAuxInformation( info.iCommand );
+            result = ETrue;
+            break;
+            }
+        }
+
+#ifdef PHONEPARSER_PARSE_DEBUG_CODE
+    if ( !result )
+        {
+        // Check special debug code.
+
+        if ( IsPrefixOf( aString, KPhoneDebugPrefixStr ) && 
+             IsPostfixOf( aString, KPhoneHashStr ) )
+            {
+            aResult.SetUid( KPhoneUidManufacturerDebugCode );
+            aResult.SetAuxInformation( 0 );
+            aResult.AddParameterL( 
+                aString.Mid( 
+                    KPhoneDebugPrefixStr().Length(), 
+                    aString.Length() - KPhoneDebugPrefixStr().Length() - 1 ) );
+            result = ETrue;
+            }
+        }
+#endif
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmManufacturerParser::CheckCode
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmManufacturerParser::CheckCode( 
+        const TDesC& aString, 
+        const TCodeInfo& aInfo,
+        CPhoneGsmOptionContainerBase& aOptions )
+    {
+    TInt flags = aInfo.iFlags;
+
+    if ( !aString.Length() )
+        {
+        return EFalse;
+        }
+
+    if ( !CheckSituation( aString, flags, aOptions ) )
+        {
+        return EFalse;
+        }
+    
+    if ( aInfo.iFeatureId )
+        {
+        if ( !CPhoneParserFeatures::FeatureSupported( aInfo.iFeatureId ) )
+            {
+            return EFalse;
+            }
+        }
+
+    // Check if string is ok.
+    if ( ( flags & EFlagPrefix ) )
+        {
+        return ( IsPrefixOf( aString, aInfo.iString ) );
+        }
+    else
+        {
+        return ( aString == aInfo.iString );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmManufacturerParser::CheckSituation
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmManufacturerParser::CheckSituation( 
+        const TDesC& aString,
+        TInt aFlags,
+        CPhoneGsmOptionContainerBase& aOptions )
+    {
+    TBool result = ETrue;
+
+    // Check if it is send operation or hash check.
+    TBool send = aOptions.FindOptionStatus( KPhoneOptionSend );
+
+    TBool isCode = aFlags & EFlagCode;
+    TBool isSend = aFlags & EFlagSend;
+
+    if ( isCode && send )
+        {
+        result = EFalse;
+        }
+    else if ( isCode && !send )
+        {
+        // For code, there must be hash.
+
+        if ( aString.Right( 1 ) != KPhoneHashStr )  // Compare rightmost characters
+            {
+            result = EFalse;
+            }
+        }
+
+    if ( isSend && !send )
+        {
+        result = EFalse;
+        }
+    
+    // Check if phone is in correct state.
+    TBool incall = aOptions.FindOptionStatus( KPhoneOptionInCall );
+
+    if ( ( aFlags & EFlagNotInIdle ) && !incall )
+        {
+        result = EFalse;
+        }
+
+    if ( ( aFlags & EFlagNotInInCall ) && incall )
+        {
+        result = EFalse;
+        }
+
+    return result;
+    }
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/src/cphonegsmmischandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 handler for USSD.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "cphonegsmmischandler.h" 
+#include    "cphonegsmparserbase.h" 
+#include    "cphonegsmparserresult.h" 
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmMiscHandler::ProcessL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CPhoneGsmMiscHandler::ProcessL( 
+        CPhoneGsmParserResult& aResult )
+    {
+    TUint uid = aResult.Uid();
+
+    switch ( uid )
+        {
+        case KPhoneUidUnstructuredService:
+            if ( aResult.CountParameters() )
+                {
+                // First parameter is ussd string.
+                ProcessUssdL( aResult.ParameterAt( 0 ) );
+                }
+            break;
+
+        default:
+            break;
+        }
+    }   
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/src/cphonegsmoptioncontainer.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,181 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 option container.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "cphonegsmoptioncontainer.h" 
+#include    "phonegsmparser.h" 
+#include    "cphoneparserfeatures.h" 
+
+// CONSTANTS
+const TInt KPhoneGsmOptionGranularity = 5;
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmOptionContainer::CPhoneGsmOptionContainer
+// -----------------------------------------------------------------------------
+//
+CPhoneGsmOptionContainer::CPhoneGsmOptionContainer()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmOptionContainer::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CPhoneGsmOptionContainer::ConstructL()
+    {
+    iOptions = 
+        new ( ELeave ) COptionArray( KPhoneGsmOptionGranularity );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmOptionContainer::NewL
+// -----------------------------------------------------------------------------
+//
+CPhoneGsmOptionContainer* CPhoneGsmOptionContainer::NewL()
+    {
+    CPhoneGsmOptionContainer* self = 
+        new (ELeave) CPhoneGsmOptionContainer;
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmOptionContainer::~CPhoneGsmOptionContainer
+// -----------------------------------------------------------------------------
+//
+CPhoneGsmOptionContainer::~CPhoneGsmOptionContainer()
+    {
+    delete iOptions;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmOptionContainer::IsOptionDefined
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmOptionContainer::IsOptionDefined( 
+        TInt aOptionUid ) const
+    {
+    // For two digit calling, we have one option defined
+    // in extension.
+    if ( aOptionUid == KPhoneOptionTwoDigitCalling )
+        {
+        return ETrue;
+        }
+
+    TKeyArrayFix key = MakeKey();
+    TOptionItem option;
+    option.iUid = aOptionUid;
+    TInt index;
+
+    return !iOptions->FindIsq( option, key, index );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmOptionContainer::FindOptionStatus
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmOptionContainer::FindOptionStatus( 
+        TInt aOptionUid ) const
+    {
+    // For two digit calling, we have one option defined
+    // in extension.
+    if ( aOptionUid == KPhoneOptionTwoDigitCalling )
+        {
+        return CPhoneParserFeatures::TwoDigitCallingEnabled();
+        }
+
+    TKeyArrayFix key = MakeKey();
+    TOptionItem option;
+    option.iUid = aOptionUid;
+    TInt index;
+
+    if ( iOptions->FindIsq( option, key, index ) )
+        {
+        PhoneGsmParser::Panic( PhoneGsmParser::EOptionNotDefined );
+        }
+
+    TBool result = iOptions->At( index ).iStatus;
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmOptionContainer::SetOptionStatus
+// -----------------------------------------------------------------------------
+//
+void CPhoneGsmOptionContainer::SetOptionStatus( 
+        TInt aOptionUid, 
+        TBool aStatus )
+    {
+    // For two digit calling, we have one option defined
+    // in extension - not allowed to be modified.
+    if ( aOptionUid == KPhoneOptionTwoDigitCalling )
+        {
+        PhoneGsmParser::Panic( PhoneGsmParser::EIncorrectUse );
+        }
+
+    TKeyArrayFix key = MakeKey();
+    TOptionItem option;
+    option.iUid = aOptionUid;
+    TInt index;
+
+    if ( iOptions->FindIsq( option, key, index ) )
+        {
+        PhoneGsmParser::Panic( PhoneGsmParser::EOptionNotDefined );
+        }
+
+    iOptions->At( index ).iStatus = aStatus;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmOptionContainer::DefineOptionL
+// -----------------------------------------------------------------------------
+//
+void CPhoneGsmOptionContainer::DefineOptionL( 
+        TInt aOptionUid, 
+        TBool aStatus )
+    {
+    if ( IsOptionDefined( aOptionUid ) )
+        {
+        PhoneGsmParser::Panic( PhoneGsmParser::EOptionAlreadyDefined );
+        }
+
+    TKeyArrayFix key = MakeKey();
+    TOptionItem option;
+    option.iUid = aOptionUid;
+    option.iStatus = aStatus;
+
+    iOptions->InsertIsqL( option, key );
+    }   
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmOptionContainer::MakeKey
+// -----------------------------------------------------------------------------
+//
+TKeyArrayFix CPhoneGsmOptionContainer::MakeKey()
+    {
+    return TKeyArrayFix( _FOFF( TOptionItem, iUid ), ECmpTInt );
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/src/cphonegsmparser.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,250 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Principal parsing process is defined by the CPhoneGsmParser
+*                class.
+*
+*/
+
+
+// INCLUDE FILES
+#include    <bldvariant.hrh>
+
+#include    "cphonegsmparser.h" 
+#include    "cphonegsmparserresult.h" 
+#include    "cphonegsmparserbase.h" 
+#include    "cphonegsmdummyparser.h" 
+#include    "cphonegsmoptioncontainer.h" 
+#include    "cphoneparserfeatures.h" 
+#include    "cphonegsmoptioncontainerbase.h" 
+
+// CONSTANTS
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmParser::NewL
+// -----------------------------------------------------------------------------
+//
+CPhoneGsmParser* CPhoneGsmParser::NewL( 
+        CPhoneGsmParserBase* aSsProcedure,
+        CPhoneGsmParserBase* aSimControlProcedure,
+        CPhoneGsmParserBase* aPhoneNumber,
+        CPhoneGsmParserBase* aManufacturerSpecific,
+        CPhoneGsmParserBase* aEmergencyNumberParser,
+        CPhoneGsmParserBase* aVoipNumber)
+    {
+    // Ownership of these instances is transferred, thus
+    // creation of the instance must not leave. 
+
+    CPhoneGsmParser* self = 
+        new CPhoneGsmParser(
+            aSsProcedure,
+            aSimControlProcedure,
+            aPhoneNumber,
+            aManufacturerSpecific,
+            aEmergencyNumberParser,
+            aVoipNumber);
+    
+    if ( !self )
+        {
+        delete aSsProcedure;
+        delete aSimControlProcedure;
+        delete aPhoneNumber;
+        delete aManufacturerSpecific;
+        delete aEmergencyNumberParser;
+        delete aVoipNumber;
+        
+        User::Leave( KErrNoMemory );
+        }
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmParser::~CPhoneGsmParser
+// -----------------------------------------------------------------------------
+//
+CPhoneGsmParser::~CPhoneGsmParser()
+    {
+    delete iGsmSsProcedure;
+    delete iGsmSimControlProcedure;
+    delete iGsmPhoneNumber;
+    delete iGsmManufacturerProcedure;
+    delete iGsmEmergencyNumber;
+    delete iVoipNumber;
+    CPhoneParserFeatures::Free();
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmParser::CPhoneGsmParser
+// -----------------------------------------------------------------------------
+//
+CPhoneGsmParser::CPhoneGsmParser( 
+        CPhoneGsmParserBase* aSsProcedure,
+        CPhoneGsmParserBase* aSimControlProcedure,
+        CPhoneGsmParserBase* aPhoneNumber,
+        CPhoneGsmParserBase* aManufacturerSpecific,
+        CPhoneGsmParserBase* aEmergencyNumberParser,
+        CPhoneGsmParserBase* aVoipNumber)
+    : iGsmSsProcedure( aSsProcedure ), 
+      iGsmSimControlProcedure( aSimControlProcedure ),
+      iGsmPhoneNumber( aPhoneNumber ),
+      iGsmManufacturerProcedure( aManufacturerSpecific ),
+      iGsmEmergencyNumber( aEmergencyNumberParser ),
+      iVoipNumber( aVoipNumber )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmParser::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CPhoneGsmParser::ConstructL()
+    {
+    // If we didn't receive a parser for something, then create dummy.
+
+    if ( !iGsmSsProcedure )
+        {
+        iGsmSsProcedure = CPhoneGsmDummyParser::NewL();
+        }
+    if ( !iGsmSimControlProcedure )
+        {
+        iGsmSimControlProcedure = CPhoneGsmDummyParser::NewL();
+        }
+    if ( !iGsmPhoneNumber )
+        {
+        iGsmPhoneNumber = CPhoneGsmDummyParser::NewL();
+        }
+    if ( !iGsmManufacturerProcedure )
+        {
+        iGsmManufacturerProcedure = CPhoneGsmDummyParser::NewL();
+        }
+    if ( !iGsmEmergencyNumber )
+        {
+        iGsmEmergencyNumber = CPhoneGsmDummyParser::NewL();
+        }
+    if ( !iVoipNumber )
+        {
+        iVoipNumber = CPhoneGsmDummyParser::NewL();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmParser::ParseL
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmParser::ParseL( 
+        const TDesC& aString, 
+        CPhoneGsmParserResult& aResult,
+        CPhoneGsmOptionContainerBase& aOptions )
+    {
+    TBool result = EFalse;
+        
+    result = DoParseL(
+            aString,
+            aResult, 
+            static_cast<CPhoneGsmOptionContainer&>( aOptions ) );
+
+    if ( !result )
+        {
+        aResult.ClearL();
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmParser::DoParseL
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmParser::DoParseL( 
+        const TDesC& aString,
+        CPhoneGsmParserResult& aResult,
+        CPhoneGsmOptionContainer& aOptions )
+    {
+    TBool result = EFalse;
+    aResult.ClearL();
+
+    // We do not handle empty strings.
+    if ( !aString.Length() )
+        {
+        return EFalse;
+        }
+
+    TBool sendOperation = aOptions.FindOptionStatus( KPhoneOptionSend );
+    
+    // Check if emergency number.
+    result = iGsmEmergencyNumber->ParseL( aString, aResult, aOptions );
+    
+    // First check if string is GSM ss procedure supported by MS.
+    if ( !result )
+        {
+        result = iGsmSsProcedure->ParseL( aString, aResult, aOptions );
+        }
+        
+    if ( !result )
+        {
+        // Check if it is sim control procedure.
+        result = iGsmSimControlProcedure->ParseL( aString, aResult, aOptions );
+        }
+
+    if ( !result )
+        {
+        // Check if it is manufacturer specific procedure.
+        result = 
+            iGsmManufacturerProcedure->ParseL( aString, aResult, aOptions );
+        }
+    if ( !result )
+        {
+        // Check if it voip call.
+        result = iVoipNumber->ParseL( aString, aResult, aOptions );
+        }
+    if ( !result )
+        {
+        result = iGsmPhoneNumber->ParseL( aString, aResult, aOptions );
+        }
+    if ( !result )
+        {
+        result = DefineAsUssdL( aString, aResult, aOptions );
+        } 
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmParser::DefineAsUssd
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmParser::DefineAsUssdL( 
+        const TDesC& aString,
+        CPhoneGsmParserResult& aResult,
+        CPhoneGsmOptionContainer& aOptions )
+    {
+    aResult.ClearL();
+    
+    TBool result = aOptions.FindOptionStatus( KPhoneOptionSend );
+    if ( result )
+        {
+        aResult.SetUid( KPhoneUidUnstructuredService );
+        aResult.AddParameterL( aString );
+        }
+    return result;
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/src/cphonegsmparserbase.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 functions common for all parsers.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "cphonegsmparserbase.h" 
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmParserBase::IsPrefixOf
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmParserBase::IsPrefixOf( 
+        const TDesC& aString, 
+        const TDesC& aPrefix )
+    {
+    TBool result = EFalse;
+
+    if ( aPrefix.Length() <= aString.Length() )
+        {
+        TPtrC part( aString.Left( aPrefix.Length() ) );
+
+        result = ( part == aPrefix );
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmParserBase::IsPostfixOf
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmParserBase::IsPostfixOf(
+        const TDesC& aString,
+        const TDesC& aPostfix )
+    {
+    TBool result = EFalse;
+
+    if ( aPostfix.Length() <= aString.Length() )
+        {
+        TPtrC part( aString.Right( aPostfix.Length() ) );
+
+        result = ( part == aPostfix );
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmParserBase::ExtractNumber
+// -----------------------------------------------------------------------------
+//
+TPtrC CPhoneGsmParserBase::ExtractNumber( 
+        const TDesC& aString )
+    {
+    TPtrC result( KNullDesC );
+
+    if ( aString.Length() )
+        {
+        TLex input( aString );
+        TLexMark mark;
+        input.Mark( mark );
+
+        while ( input.Peek().IsDigit() )
+            {
+            input.Inc();
+            }
+
+        result.Set( input.MarkedToken( mark ) );
+        }
+    
+    return result;
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/src/cphonegsmparsercontainer.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Container for parsers.
+*
+*/
+
+
+// INCLUDE FILES
+#include    <featmgr.h>
+
+#include    "cphonegsmparsercontainer.h" 
+#include    "cphonegsmparserresult.h" 
+#include    "cphonegsmoptioncontainer.h" 
+#include    "phonegsmparser.h" 
+
+// CONSTANTS
+const TInt KPhoneParserArrayGranularity = 5;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmParserContainer::CPhoneGsmParserContainer
+// -----------------------------------------------------------------------------
+//
+CPhoneGsmParserContainer::CPhoneGsmParserContainer()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmParserContainer::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CPhoneGsmParserContainer::ConstructL()
+    {
+    iArray = 
+        new ( ELeave ) CParserArray( KPhoneParserArrayGranularity );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmParserContainer::NewLC
+// -----------------------------------------------------------------------------
+//
+CPhoneGsmParserContainer* CPhoneGsmParserContainer::NewLC()
+    {
+    CPhoneGsmParserContainer* self = 
+        new ( ELeave ) CPhoneGsmParserContainer;
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmParserContainer::~CPhoneGsmParserContainer
+// -----------------------------------------------------------------------------
+//
+CPhoneGsmParserContainer::~CPhoneGsmParserContainer()
+    {
+    if ( iArray )
+        {
+        iArray->ResetAndDestroy();
+        }
+    delete iArray;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmParserContainer::AddL
+// -----------------------------------------------------------------------------
+//
+void CPhoneGsmParserContainer::AddL(
+        CPhoneGsmParserBase& aParser )
+    {
+    TInt index;
+    TInt count = iArray->Count();
+
+    for ( index = 0; index < count; index++ )
+        {
+        CPhoneGsmParserBase* parser = iArray->At( index );
+
+        if ( parser == &aParser )
+            {
+            PhoneGsmParser::Panic( PhoneGsmParser::EIncorrectUse );
+            }
+        }
+
+    iArray->AppendL( &aParser );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmParserContainer::ParseL
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmParserContainer::ParseL( 
+        const TDesC& aString,
+        CPhoneGsmParserResult& aResult,
+        CPhoneGsmOptionContainerBase& aOptions )
+    {
+    TInt index;
+    TInt count = iArray->Count();
+    TBool result = EFalse;
+
+    for ( index = 0; index < count; index++ )
+        {
+        CPhoneGsmParserBase* parser = iArray->At( index );
+
+        result = parser->ParseL( aString, aResult, aOptions );
+
+        if ( result )
+            {
+            break;
+            }
+        }
+
+    return result;
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/src/cphonegsmparserresult.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,145 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 results of parsing.
+*
+*/
+
+
+// INCLUDE FILES
+#include    <featmgr.h>
+
+#include    "cphonegsmparserresult.h" 
+#include    "cphonegsmparserbase.h" 
+#include    "phonegsmparser.h" 
+
+// CONSTANTS
+const TInt KPhoneParserResultParameterGranularity = 10;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmParserResult::CPhoneGsmParserResult
+// -----------------------------------------------------------------------------
+//
+CPhoneGsmParserResult::CPhoneGsmParserResult()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmParserResult::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CPhoneGsmParserResult::ConstructL()
+    {
+    iParameters = 
+        new ( ELeave ) 
+            CArrayFixFlat< TPtrC >( KPhoneParserResultParameterGranularity );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmParserResult::NewL
+// -----------------------------------------------------------------------------
+//
+CPhoneGsmParserResult* CPhoneGsmParserResult::NewL()
+    {
+    CPhoneGsmParserResult* self = new (ELeave) CPhoneGsmParserResult;
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmParserResult::~CPhoneGsmParserResult
+// -----------------------------------------------------------------------------
+//
+CPhoneGsmParserResult::~CPhoneGsmParserResult()
+    {
+    delete iParameters;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmParserResult::ReserveParametersL
+// -----------------------------------------------------------------------------
+//
+void CPhoneGsmParserResult::ReserveParametersL( 
+        TUint aAmount )
+    {
+    iParameters->SetReserveL( aAmount );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmParserResult::ClearL
+//
+// Zero all information.
+// -----------------------------------------------------------------------------
+//
+void CPhoneGsmParserResult::ClearL()
+    {
+    iUid = KPhoneGsmUidInvalid;
+    iAuxInformation = 0;
+
+    if ( iParameters->Count() )
+        {
+        iParameters->ResizeL( 0 ); // Doesn't leave
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmParserResult::ParameterAt
+// -----------------------------------------------------------------------------
+//
+const TDesC& CPhoneGsmParserResult::ParameterAt( 
+        TInt aIndex ) const
+    {
+    __ASSERT_ALWAYS( aIndex >= 0 &&
+                     aIndex < iParameters->Count(),
+                     PhoneGsmParser::Panic( PhoneGsmParser::EIncorrectUse ) );
+    
+    return iParameters->At( aIndex );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmParserResult::SetUid
+// -----------------------------------------------------------------------------
+//
+void CPhoneGsmParserResult::SetUid( 
+        TUint aUid )
+    {
+    iUid = aUid;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmParserResult::SetAuxInformation
+// -----------------------------------------------------------------------------
+//
+void CPhoneGsmParserResult::SetAuxInformation( 
+        TUint aAuxInformation )
+    {
+    iAuxInformation = aAuxInformation;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmParserResult::AddParameterL
+// -----------------------------------------------------------------------------
+//
+void CPhoneGsmParserResult::AddParameterL( 
+        const TDesC& aParameter )
+    {
+    iParameters->AppendL( aParameter );
+    }           
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/src/cphonegsmpcnprocedurehandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Handler for PCN procedures.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "cphonegsmpcnprocedurehandler.h" 
+#include    "cphonegsmparserresult.h" 
+#include    "cphonegsmpcnprocedureparser.h" 
+
+// CONSTANTS
+
+// Position of password in SIM codes.
+const TInt KPhoneGsmPcnSimPasswordParamAt = 0;
+
+// Position of type in SIM codes.
+const TInt KPhoneGsmPcnSimTypeParamAt = 1;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmPcnProcedureHandler::ProcessL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CPhoneGsmPcnProcedureHandler::ProcessL( 
+        CPhoneGsmParserResult& aResult )
+    {
+    switch ( aResult.Uid() )
+        {
+        case KPhoneUidSimLockCode:
+            ProcessSimLockL( 
+                aResult.ParameterAt( KPhoneGsmPcnSimPasswordParamAt ),
+                aResult.ParameterAt( KPhoneGsmPcnSimTypeParamAt ) );
+            break;
+
+        case KPhoneUidSimUnlockCode:
+            ProcessSimUnlockL(
+                aResult.ParameterAt( KPhoneGsmPcnSimPasswordParamAt ),
+                aResult.ParameterAt( KPhoneGsmPcnSimTypeParamAt ) );
+            break;
+
+        default:
+            break;
+        }
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/src/cphonegsmpcnprocedureparser.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,208 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Parser for PCN procedures.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "cphonegsmpcnprocedureparser.h" 
+#include    "cphonegsmparserresult.h" 
+#include    "cphonegsmoptioncontainer.h" 
+
+// CONSTANTS
+
+// GsmPcn sim lock code prefix
+_LIT( KPhoneGsmPcnSimLockCodePrefix, "*pw+" );
+
+// GsmPcn sim unlock code prefix
+_LIT( KPhoneGsmPcnSimUnlockCodePrefix, "#pw+" );
+
+// Plus character.
+const TInt KPhoneGsmPcnPlus = '+';
+
+// Hash string
+_LIT( KPhoneGsmPcnHash, "#" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmPcnProcedureParser::CPhoneGsmPcnProcedureParser
+// -----------------------------------------------------------------------------
+//
+CPhoneGsmPcnProcedureParser::CPhoneGsmPcnProcedureParser()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmPcnProcedureParser::NewLC
+// -----------------------------------------------------------------------------
+//
+CPhoneGsmPcnProcedureParser* CPhoneGsmPcnProcedureParser::NewLC()
+    {
+    CPhoneGsmPcnProcedureParser* self = 
+        new ( ELeave ) CPhoneGsmPcnProcedureParser;
+    
+    CleanupStack::PushL( self );
+    
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmPcnProcedureParser::ParseL
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmPcnProcedureParser::ParseL( 
+        const TDesC& aString,
+        CPhoneGsmParserResult& aResult,
+        CPhoneGsmOptionContainerBase& aOptions )
+    {
+    TBool result = EFalse;
+    aResult.ClearL();
+    
+    CPhoneGsmOptionContainer& options =
+                static_cast<CPhoneGsmOptionContainer&>( aOptions );
+    
+    if ( !options.FindOptionStatus( KPhoneOptionSend ) )
+        {
+        result = HandleSimLockCodeL( aString, aResult );
+
+        if ( !result )
+            {
+            result = HandleSimUnlockCodeL( aString, aResult );
+            }
+        }
+    
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmPcnProcedureParser::HandleSimLockCodeL
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmPcnProcedureParser::HandleSimLockCodeL(
+        const TDesC& aString,
+        CPhoneGsmParserResult& aResult )
+    {
+    TBool result = EFalse;
+
+    // Is this SIM lock command
+    if ( IsPrefixOf( aString, KPhoneGsmPcnSimLockCodePrefix ) )
+        {
+        TLex input( aString );
+        input.Inc( KPhoneGsmPcnSimLockCodePrefix().Length() );
+       
+        if ( HandleLockCodeParametersL( input.Remainder(), aResult ) )
+            {
+            result = ETrue;
+            aResult.SetUid( KPhoneUidSimLockCode );
+            }
+        else if ( IsPostfixOf( aString, KPhoneGsmPcnHash ) )
+            {
+            result = ETrue;
+            aResult.ClearL();
+            aResult.SetUid( KPhoneUidSimLockCode );
+            aResult.AddParameterL( KNullDesC );
+            aResult.AddParameterL( KNullDesC );
+            }
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmPcnProcedureParser::HandleSimUnlockCodeL
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmPcnProcedureParser::HandleSimUnlockCodeL(
+        const TDesC& aString,
+        CPhoneGsmParserResult& aResult )
+    {
+    TBool result = EFalse;
+
+    // Is this SIM unlock command
+    if ( IsPrefixOf( aString, KPhoneGsmPcnSimUnlockCodePrefix ) )
+        {
+        TLex input( aString );
+        input.Inc( KPhoneGsmPcnSimLockCodePrefix().Length() );
+
+        if ( HandleLockCodeParametersL( input.Remainder(), aResult ) )
+            {
+            result = ETrue;
+            aResult.SetUid( KPhoneUidSimUnlockCode );
+            }
+        else if ( IsPostfixOf( aString, KPhoneGsmPcnHash ) )
+            {
+            result = ETrue;
+            aResult.ClearL();
+            aResult.SetUid( KPhoneUidSimUnlockCode );
+            aResult.AddParameterL( KNullDesC );
+            aResult.AddParameterL( KNullDesC );
+            }
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmPcnProcedureParser::HandleLockCodeParametersL
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmPcnProcedureParser::HandleLockCodeParametersL( 
+        const TDesC& aString,
+        CPhoneGsmParserResult& aResult )
+    {
+    TBool result = EFalse;
+    TLex input( aString );
+    TInt len; // length of strings
+   
+    // Extract first parameter
+    TPtrC password( ExtractNumber( aString ) );
+    len = password.Length();
+
+    if ( len )
+        {
+        // Parameter ok
+        input.Inc( len );       
+
+        // Plus is separator of two parameters
+        if ( input.Peek() == KPhoneGsmPcnPlus )
+            {
+            input.Inc();
+
+            // Extract second parameter
+            TPtrC type( ExtractNumber( input.Remainder() ) );
+            len = type.Length();
+
+            if ( len )
+                {
+                // Parameter ok
+                input.Inc( len );
+
+                // Check if we are at the end of string
+                if ( input.Remainder() == KPhoneGsmPcnHash )
+                    {
+                    aResult.AddParameterL( password );
+                    aResult.AddParameterL( type );
+
+                    result = ETrue;
+                    }
+                }
+            }
+        }
+    
+    return result;
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/src/cphonegsmphonenumberhandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* 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:  Handler for phone numbers.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "cphonegsmphonenumberhandler.h" 
+#include    "cphonegsmphonenumberparser.h" 
+#include    "cphonegsmparserresult.h" 
+
+// CONSTANTS
+const TInt KPhonePhoneNumberDialParam = 0;
+const TInt KPhonePhoneNumberPostfixParam = 1;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmPhoneNumberHandler::ProcessL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CPhoneGsmPhoneNumberHandler::ProcessL( 
+            CPhoneGsmParserResult& aResult )
+    {
+    if ( aResult.Uid() == KPhoneUidPhoneNumber )
+        {
+        TPtrC number( aResult.ParameterAt( KPhonePhoneNumberDialParam ) );
+        TPtrC postfix( aResult.ParameterAt( KPhonePhoneNumberPostfixParam ) );
+        TClir clirover = EClirDefault;
+        
+        if ( aResult.AuxInformation() == KPhoneDialSuppressClir )
+            {
+            clirover = EClirSuppress;
+            }
+        else if ( aResult.AuxInformation() == KPhoneDialInvokeClir )
+            {
+            clirover = EClirInvoke;
+            } 
+
+            ProcessDialToNumberL( number, postfix, clirover );
+        }
+        
+    }   
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/src/cphonegsmphonenumberparser.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,329 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Parser for phone numbers.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "cphonegsmphonenumberparser.h" 
+#include    "cphonegsmparserresult.h" 
+#include    "cphonegsmoptioncontainer.h" 
+#include    "cphonevoipnumberparser.h" 
+#include    "cphoneparserfeatures.h" 
+#include    "phoneparsercommon.h" 
+// CONSTANTS
+_LIT( KPhoneClirSuppress, "*31#" );
+_LIT( KPhoneClirInvoke, "#31#" );
+
+const TInt KPhoneNumberOne = '1';
+
+const TInt KPhoneNumberMaxLength = 80;
+
+const TInt KPhoneShortStringMinLength = 1;  // Must be positive.
+const TInt KPhoneShortStringMaxLength = 2;  // Must be positive.
+const TInt KPhoneHashStringMinLength = 2;
+const TInt KPhoneTwoDigitStringLength = 2;
+
+// If there is one of the characters in the string, then the string
+// is considered as phone number.
+_LIT( KPhoneMustPhoneNumberChars, "pw" );
+_LIT( KPhoneHashChar, "#" );
+_LIT( KPhoneNumberZero, "0" );
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmPhoneNumberParser::CPhoneGsmPhoneNumberParser
+// -----------------------------------------------------------------------------
+//
+CPhoneGsmPhoneNumberParser::CPhoneGsmPhoneNumberParser()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmPhoneNumberParser::NewLC
+// -----------------------------------------------------------------------------
+//
+CPhoneGsmPhoneNumberParser* CPhoneGsmPhoneNumberParser::NewLC()
+    {
+    CPhoneGsmPhoneNumberParser* self = 
+        new ( ELeave ) CPhoneGsmPhoneNumberParser;
+    
+    CleanupStack::PushL( self );
+        
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmPhoneNumberParser::ParseL
+// 
+// Phone number can contain following parts: supplementary
+// service prefix, main part and dtmf postfix.
+// 
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmPhoneNumberParser::ParseL( 
+        const TDesC& aString,
+        CPhoneGsmParserResult& aResult,
+        CPhoneGsmOptionContainerBase& aOptions )
+    {
+    aResult.ClearL();
+
+    TBool result = DoParseL( 
+            aString,
+            aResult,
+            static_cast<CPhoneGsmOptionContainer&>( aOptions ) );
+
+    if ( !result )
+        {
+        aResult.ClearL();
+        }
+
+    return result;
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhoneGsmPhoneNumberParser::DoParseL
+// 
+// Phone number can contain following parts: supplementary
+// service prefix, main part and dtmf postfix.
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmPhoneNumberParser::DoParseL( 
+        const TDesC& aString,
+        CPhoneGsmParserResult& aResult,
+        CPhoneGsmOptionContainer& aOptions )
+    {
+    TBool result = EFalse;
+
+    if ( !aOptions.FindOptionStatus( KPhoneOptionSend ))
+        {
+        return EFalse;
+        }
+    if ( !ContainsPauseOrWaitChars( aString )) // p or w --> always phone number
+        {
+        if ( IsHashString( aString ))
+            {
+            return EFalse;
+            }
+        if ( aString.Length() >= KPhoneShortStringMinLength &&
+             aString.Length() <= KPhoneShortStringMaxLength )
+            {
+            if ( !IsZeroDialling( aString, aOptions ) && 
+                !IsTwoDigitDialling( aString ) && !Is1xDialling( aString, aOptions )) 
+                {
+                return EFalse;
+                }
+            }
+        }
+    TLex input( aString );
+    
+    if ( !HandleServicePrefix( input, aResult ) )
+        {
+        aResult.SetAuxInformation( KPhoneDialDefaultClir );
+        }
+
+    // Take number part and add it to result.
+    result = TakeNumberPartL( input, aResult );
+        
+    if ( result )
+        {
+        if ( !aOptions.FindOptionStatus( KPhoneOptionVoipCall ) )
+            {
+            aResult.SetUid( KPhoneUidPhoneNumber );
+            }
+
+        // Add rest of string( dtmf postfix ) to result.
+        if ( !TakeDtmfPostfixL( input, aResult ) )
+            {
+            aResult.AddParameterL( KNullDesC );
+            }
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmPhoneNumberParser::HandleServicePrefix
+// 
+// Checks if there is clir suppress/invoke prefix in the
+// string. 
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmPhoneNumberParser::HandleServicePrefix( 
+        TLex& aLex, 
+        CPhoneGsmParserResult& aResult )
+    {
+    TBool result = EFalse;
+    TPtrC remainder( aLex.Remainder() );
+
+    if ( EqualsLeft( remainder, KPhoneClirSuppress ) )
+        {
+        aLex.Inc( KPhoneClirSuppress().Length() );
+        aResult.SetAuxInformation( KPhoneDialSuppressClir );
+        result = ETrue;
+        }
+    else if ( EqualsLeft( remainder, KPhoneClirInvoke ) )
+        {
+        aLex.Inc( KPhoneClirSuppress().Length() );
+        aResult.SetAuxInformation( KPhoneDialInvokeClir );
+        result = ETrue;
+        }
+    
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmPhoneNumberParser::TakeNumberPartL
+// 
+// Takes a main part of the phone number. And add
+// it to the aReturn parameter with or without optional international prefix.
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmPhoneNumberParser::TakeNumberPartL(
+        TLex& aLex,
+        CPhoneGsmParserResult& aResult )
+    {
+    TBool result = EFalse;
+    
+    TLexMark start;
+    aLex.Mark( start );
+
+    TInt maxLength = KPhoneNumberMaxLength;
+
+    // Checks is first char optional international prefix
+    // and if its increments to the next char position.
+    if ( aLex.Peek() == KPhonePlus )
+        {
+        aLex.Inc();
+        maxLength++;
+        }
+
+    // Check possible 'p','w' or '+' marks.
+    while ( ( aLex.Peek().IsDigit() ) || 
+            ( aLex.Peek() == KPhoneNumberAsterisk ) ||
+            ( aLex.Peek() == KPhoneNumberHash ) )
+        {
+        aLex.Inc();
+        }
+
+    // Add parsing string to result parameter
+    TPtrC mainpart( aLex.MarkedToken( start ) );
+    const TInt length = mainpart.Length();
+    if ( length <= maxLength )
+        {
+        result = ETrue;
+        aResult.AddParameterL( mainpart );
+        }
+    
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmPhoneNumberParser::TakeDtmfPostfixL
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmPhoneNumberParser::TakeDtmfPostfixL(
+        TLex& aLex,
+        CPhoneGsmParserResult& aResult )
+    {
+    // Add rest of string( after TLex16::iNext ) to result.
+    aResult.AddParameterL( aLex.Remainder() );
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmPhoneNumberParser::EqualsLeft
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmPhoneNumberParser::EqualsLeft( 
+        const TDesC& aDesc, 
+        const TDesC& aLeft )
+    {
+    return IsPrefixOf( aDesc, aLeft );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmPhoneNumberParser::ContainsPauseOrWaitChars
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmPhoneNumberParser::ContainsPauseOrWaitChars(
+        const TDesC& aString ) const
+    {
+
+    TBool result = EFalse;
+    TPtrC chs( KPhoneMustPhoneNumberChars );
+    for ( TInt index = 0; index < chs.Length(); index++ )
+        {
+        if ( aString.Locate( chs[ index ] ) != KErrNotFound )
+            {
+            result = ETrue;
+            break;
+            }
+        }
+
+    return result; 
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmPhoneNumberParser::IsHashString
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmPhoneNumberParser::IsHashString( 
+        const TDesC& aString ) const
+    {
+    return aString.Length() >= KPhoneHashStringMinLength &&
+        // Rightmost character must be #
+        aString.Right( 1 ) == KPhoneHashChar; 
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmPhoneNumberParser::IsZeroDialling
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmPhoneNumberParser::IsZeroDialling( 
+        const TDesC& aString, CPhoneGsmOptionContainer& aOptions ) const
+    {
+    return !aOptions.FindOptionStatus( KPhoneOptionInCall ) &&
+        !aString.Compare( KPhoneNumberZero ) && 
+        CPhoneParserFeatures::IsZeroDialEnabled(); 
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmPhoneNumberParser::IsTwoDigitDialling
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmPhoneNumberParser::IsTwoDigitDialling( 
+        const TDesC& aString ) const
+    {
+    return CPhoneParserFeatures::TwoDigitCallingEnabled() &&
+        aString.Length()== KPhoneTwoDigitStringLength;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmPhoneNumberParser::Is1xDialling
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmPhoneNumberParser::Is1xDialling( 
+    const TDesC& aString, CPhoneGsmOptionContainer& aOptions  ) const
+    {
+    return !aOptions.FindOptionStatus( KPhoneOptionInCall ) &&
+        aString.Length()== KPhoneShortStringMaxLength &&
+        aString[0] == KPhoneNumberOne &&
+        TChar( aString[1] ).IsDigit();
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/src/cphonegsmsimcontrolhandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Handler for SIM control procedures.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "cphonegsmsimcontrolhandler.h" 
+#include    "cphonegsmsimcontrolparser.h" 
+#include    "cphonegsmparserresult.h" 
+#include    "phonegsmparser.h" 
+
+// CONSTANTS
+const TInt KPhoneSimControlOldPinPukParam = 0;
+const TInt KPhoneSimControlNewPinParam = 1;
+const TInt KPhoneSimControlNewPinVerifyParam = 2;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSimControlHandler::ProcessL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CPhoneGsmSimControlHandler::ProcessL( 
+        CPhoneGsmParserResult& aResult )
+    {
+    switch( aResult.Uid() )
+        {
+        case KPhoneUidPinChange:
+            ProcessPinChangeL( EPinCode, aResult );
+            break;
+
+        case KPhoneUidPin2Change:
+            ProcessPinChangeL( EPin2Code, aResult );
+            break;
+
+        case KPhoneUidPinUnblock:
+            ProcessPinUnblockL( EPinCode, aResult );
+            break;
+
+        case KPhoneUidPin2Unblock:
+            ProcessPinUnblockL( EPin2Code, aResult );
+            break;
+
+        default:
+            break;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSimControlHandler::ProcessPinChangeL
+// -----------------------------------------------------------------------------
+//
+void CPhoneGsmSimControlHandler::ProcessPinChangeL( 
+        TPinCode aType,
+        CPhoneGsmParserResult& aResult )
+    {
+    ProcessChangePinL( 
+        aType,
+        aResult.ParameterAt( KPhoneSimControlOldPinPukParam ),
+        aResult.ParameterAt( KPhoneSimControlNewPinParam ),
+        aResult.ParameterAt( KPhoneSimControlNewPinVerifyParam ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSimControlHandler::ProcessPinUnblockL
+// -----------------------------------------------------------------------------
+//
+void CPhoneGsmSimControlHandler::ProcessPinUnblockL(
+        TPinCode aType,
+        CPhoneGsmParserResult& aResult )
+    {
+    ProcessUnblockPinL( 
+        aType,
+        aResult.ParameterAt( KPhoneSimControlOldPinPukParam ),
+        aResult.ParameterAt( KPhoneSimControlNewPinParam ),
+        aResult.ParameterAt( KPhoneSimControlNewPinVerifyParam ) );
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/src/cphonegsmsimcontrolparser.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,369 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Parser for SIM control procedures.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "cphonegsmsimcontrolparser.h" 
+#include    "cphonegsmparserresult.h" 
+#include    "cphonegsmoptioncontainer.h" 
+
+// CONSTANTS
+_LIT( KPhoneSimControlPinChangeCode, "04" );
+_LIT( KPhoneSimControlPin2ChangeCode, "042" );
+_LIT( KPhoneSimControlPinUnblockCode, "05" );
+_LIT( KPhoneSimControlPin2UnblockCode, "052" );
+
+const TInt KPhoneSimControlPinMinLength = 4;
+const TInt KPhoneSimControlPinMaxLength = 8;
+const TInt KPhoneSimControlPukLength = 8;
+
+const TInt KPhoneSimControlAsterisk = '*';
+const TInt KPhoneSimControlHash = '#';
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSimControlParser::CPhoneGsmSimControlParser
+// -----------------------------------------------------------------------------
+//
+CPhoneGsmSimControlParser::CPhoneGsmSimControlParser()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSimControlParser::NewLC
+// -----------------------------------------------------------------------------
+//
+CPhoneGsmSimControlParser* CPhoneGsmSimControlParser::NewLC()
+    {
+    CPhoneGsmSimControlParser* self = 
+        new ( ELeave ) CPhoneGsmSimControlParser;
+    
+    CleanupStack::PushL( self );
+    
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSimControlParser::ParseL
+// 
+// Parse sim control procedures.
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmSimControlParser::ParseL( 
+        const TDesC& aString,
+        CPhoneGsmParserResult& aResult,
+        CPhoneGsmOptionContainerBase& aOptions )
+    {
+    aResult.ClearL();    
+    
+    TBool sendOperation = aOptions.FindOptionStatus( KPhoneOptionSend );
+    TBool incall = aOptions.FindOptionStatus( KPhoneOptionInCall );
+
+    TBool result = DoParseL( aString, aResult, sendOperation, incall );
+
+    if ( !result )
+        {
+        aResult.ClearL();
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSimControlParser::DoParseL
+// 
+// Parse sim control procedures.
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmSimControlParser::DoParseL(
+        const TDesC& aString,
+        CPhoneGsmParserResult& aResult,
+        TBool aSendOperation,
+        TBool /*aInCall*/ )
+    {
+    TBool result = EFalse;
+    aResult.ClearL();
+
+    TLex input( aString );
+
+    if ( !aSendOperation )
+        {
+        result = HandlePinOperationsL( input, aResult );
+        }
+
+    return result;
+    }  
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSimControlParser::HandlePinOperationsL
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmSimControlParser::HandlePinOperationsL( 
+        TLex& aInput, 
+        CPhoneGsmParserResult& aResult )
+    {
+    TBool result = EFalse;
+    TLexMark start;
+    aInput.Mark( start );
+
+    if ( HandlePinPrefix( aInput, aResult ) )
+        {
+        TPtrC number( NextNumber( aInput ) );
+
+        if ( number == KPhoneSimControlPinChangeCode )
+            {
+            aResult.SetUid( KPhoneUidPinChange );
+            result = HandlePinChangeL( aInput, aResult );
+            }
+        else if ( number == KPhoneSimControlPin2ChangeCode )
+            {
+            aResult.SetUid( KPhoneUidPin2Change );
+            result = HandlePinChangeL( aInput, aResult );
+            }
+        else if ( number == KPhoneSimControlPinUnblockCode )
+            {
+            aResult.SetUid( KPhoneUidPinUnblock );
+            result = HandlePinUnblockL( aInput, aResult );
+            }
+        else if ( number == KPhoneSimControlPin2UnblockCode )
+            {
+            aResult.SetUid( KPhoneUidPin2Unblock );
+            result = HandlePinUnblockL( aInput, aResult );
+            }
+        }
+
+    if ( !result )
+        {
+        aResult.ClearL();
+        aInput.UnGetToMark( start );
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSimControlParser::HandlePinPrefix
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmSimControlParser::HandlePinPrefix( 
+        TLex& aInput,
+        CPhoneGsmParserResult& /*aResult*/ )
+    {
+    TBool result = ETrue;
+
+    TLexMark start;
+    aInput.Mark( start );
+
+    if ( aInput.Peek() != KPhoneSimControlAsterisk )
+        {
+        result = EFalse;
+        }
+    else
+        {
+        aInput.Inc();
+
+        if ( aInput.Peek() != KPhoneSimControlAsterisk )
+            {
+            result = EFalse;
+            }
+        else
+            {
+            aInput.Inc();
+            }
+        }
+
+    if ( !result )
+        {
+        aInput.UnGetToMark( start );
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSimControlParser::HandlePinChangeL
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmSimControlParser::HandlePinChangeL(
+        TLex& aInput,
+        CPhoneGsmParserResult& aResult )
+    {
+    TBool result = EFalse;
+    TLexMark start;
+    aInput.Mark( start );
+
+    result = HandlePinL( aInput, aResult );
+    result = result && HandlePinL( aInput, aResult );
+    result = result && HandlePinL( aInput, aResult );
+    result = result && HandleNoParameters( aInput, aResult );
+
+    if ( !result )
+        {
+        aInput.UnGetToMark( start );
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSimControlParser::HandlePinUnblockL
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmSimControlParser::HandlePinUnblockL(
+        TLex& aInput,
+        CPhoneGsmParserResult& aResult )
+    {
+    TBool result = EFalse;
+    TLexMark start;
+    aInput.Mark( start );
+
+    result = HandlePukL( aInput, aResult );
+    result = result && HandlePinL( aInput, aResult );
+    result = result && HandlePinL( aInput, aResult );
+    result = result && HandleNoParameters( aInput, aResult );
+
+    if ( !result )
+        {
+        aInput.UnGetToMark( start );
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSimControlParser::HandleNoParameters
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmSimControlParser::HandleNoParameters(
+        TLex& aInput,
+        CPhoneGsmParserResult& /*aResult*/ )
+    {
+    TBool result = EFalse;
+
+    if ( aInput.Remainder().Length() == 1 &&    // single character
+         aInput.Peek() == KPhoneSimControlHash )
+        {
+        result = ETrue;
+        aInput.Inc();
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSimControlParser::HandlePinL
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmSimControlParser::HandlePinL(
+        TLex& aInput,
+        CPhoneGsmParserResult& aResult )
+    {
+    return HandleParameterL(
+        aInput,
+        aResult,
+        CPhoneGsmSimControlParser::ValidatePin );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSimControlParser::HandlePukL
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmSimControlParser::HandlePukL(
+        TLex& aInput, 
+        CPhoneGsmParserResult& aResult )
+    {
+    return HandleParameterL( 
+        aInput, 
+        aResult,
+        CPhoneGsmSimControlParser::ValidatePuk );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSimControlParser::HandleParameterL
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmSimControlParser::HandleParameterL( 
+        TLex& aInput,
+        CPhoneGsmParserResult& aResult,
+        TParameterValidationFunction aFunc )
+    {
+    TBool result = EFalse;
+
+    TLexMark start;
+    aInput.Mark( start );
+
+    if ( aInput.Peek() == KPhoneSimControlAsterisk )
+        {
+        aInput.Inc();
+
+        TPtrC password( NextNumber( aInput ) );
+        
+        if ( aFunc( password ) )
+            {
+            aResult.AddParameterL( password );
+            result = ETrue;
+            }
+        }
+
+    if ( !result )
+        {
+        aInput.UnGetToMark( start );
+        }
+
+    return result;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSimControlParser::NextNumber
+// -----------------------------------------------------------------------------
+//
+TPtrC CPhoneGsmSimControlParser::NextNumber( 
+        TLex& aInput )
+    {
+    TLexMark start;
+    aInput.Mark( start );
+    
+    while ( aInput.Peek().IsDigit() )
+        {
+        aInput.Inc();
+        }
+
+    return aInput.MarkedToken( start );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSimControlParser::ValidatePin
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmSimControlParser::ValidatePin( const TDesC& aParam )
+    {
+    return ( aParam.Length() >= KPhoneSimControlPinMinLength ) &&
+           ( aParam.Length() <= KPhoneSimControlPinMaxLength );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSimControlParser::ValidatePuk
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmSimControlParser::ValidatePuk( const TDesC& aParam )
+    {
+    return ( aParam.Length() == KPhoneSimControlPukLength );
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/src/cphonegsmsscallhandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Handler for call concerned SS procedures.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "cphonegsmsscallhandler.h" 
+#include    "cphonegsmsscallparser.h" 
+#include    "cphonegsmparserresult.h" 
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsCallHandler::ProcessL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CPhoneGsmSsCallHandler::ProcessL( 
+            CPhoneGsmParserResult& aResult )
+    {
+    switch ( aResult.Uid() )
+        {
+        case KPhoneUidCommand0:
+            ProcessEndOrRejectL();
+            break;
+
+        case KPhoneUidCommand1:
+            {
+            TInt value = aResult.AuxInformation();
+
+            if ( !value )
+                {
+                ProcessEndAndAcceptL();
+                }
+            else
+                {
+                value--;
+                ProcessEndCallL( value );
+                }
+            }
+            break;
+
+        case KPhoneUidCommand2:
+            {
+            TInt value = aResult.AuxInformation();
+
+            if ( !value )
+                {
+                ProcessSwapL();
+                }
+            else
+                {
+                value--;
+                ProcessHoldAllCallsExceptL( value );
+                }
+            }
+            break;
+
+        case KPhoneUidCommand3:
+            ProcessJoinL();
+            break;
+
+        case KPhoneUidCommand4:
+            ProcessExplicitCallTransferL();
+            break;
+
+        default:
+            break;
+        }
+    }   
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/src/cphonegsmsscallparser.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,143 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Parser for call concerned SS procedures.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "cphonegsmsscallparser.h" 
+#include    "cphonegsmparserresult.h" 
+#include    "cphonegsmoptioncontainer.h" 
+
+// CONSTANTS
+
+const TInt KPhoneCommandLength = 1;
+
+// The length of the following are expected to be KPhoneCommandLength.
+_LIT( KPhoneCommand0, "0" );
+_LIT( KPhoneCommand1, "1" );
+_LIT( KPhoneCommand2, "2" );
+_LIT( KPhoneCommand3, "3" );
+_LIT( KPhoneCommand4, "4" );
+
+// 2 character commands.
+const TInt KPhoneCommandXLength = 2;
+_LIT( KPhoneCommand2X, "2" );
+_LIT( KPhoneCommand1X, "1" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsCallParser::CPhoneGsmSsCallParser
+// -----------------------------------------------------------------------------
+//
+CPhoneGsmSsCallParser::CPhoneGsmSsCallParser()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsCallParser::NewLC
+// -----------------------------------------------------------------------------
+//
+CPhoneGsmSsCallParser* CPhoneGsmSsCallParser::NewLC()
+    {
+    CPhoneGsmSsCallParser* self = 
+        new ( ELeave ) CPhoneGsmSsCallParser;
+    
+    CleanupStack::PushL( self );
+        
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsCallParser::ParseL
+//
+// Parse call concerned ss strings.
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmSsCallParser::ParseL( 
+        const TDesC& aString,
+        CPhoneGsmParserResult& aResult,
+        CPhoneGsmOptionContainerBase& aOptions )
+    {
+    aResult.ClearL();
+
+    if ( !aOptions.FindOptionStatus( KPhoneOptionInCall ) ||
+         !aOptions.FindOptionStatus( KPhoneOptionSend ) )
+        {
+        return EFalse;
+        }
+    
+    TInt length = aString.Length();
+
+    if ( length == KPhoneCommandXLength )
+        {
+        // Check one character from the beginning.
+        TPtrC prefix( aString.Left( 1 ) );
+
+        if ( prefix == KPhoneCommand1X )
+            {
+            TLex lex( aString.Right(1) );
+            TUint32 value;
+
+            if ( lex.Val( value, EDecimal ) == KErrNone )
+                {
+                aResult.SetUid( KPhoneUidCommand1 );
+                aResult.SetAuxInformation( value + 1 );
+                }           
+            }
+        else if ( prefix == KPhoneCommand2X )
+            {
+            TLex lex( aString.Right(1) );
+            TUint32 value;
+
+            if ( lex.Val( value, EDecimal ) == KErrNone )
+                {
+                aResult.SetUid( KPhoneUidCommand2 );
+                aResult.SetAuxInformation( value + 1 );
+                }
+            }
+        }
+    else
+        {
+        if ( length == KPhoneCommandLength )
+            {
+            if ( aString == KPhoneCommand0 )
+                {
+                aResult.SetUid( KPhoneUidCommand0 );
+                }
+            else if ( aString == KPhoneCommand1 )
+                {
+                aResult.SetUid( KPhoneUidCommand1 );
+                }
+            else if ( aString == KPhoneCommand2 )
+                {
+                aResult.SetUid( KPhoneUidCommand2 );
+                }
+            else if ( aString == KPhoneCommand3 )
+                {
+                aResult.SetUid( KPhoneUidCommand3 );
+                }
+            else if ( aString == KPhoneCommand4 )
+                {
+                aResult.SetUid( KPhoneUidCommand4 );
+                }
+            }
+        }
+   
+    return ( aResult.Uid() != KPhoneGsmUidInvalid );
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/src/cphonegsmsshandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,366 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Principal handler for supplementary service procedures.
+*
+*/
+
+
+// INCLUDE FILES
+#include    <bldvariant.hrh>
+
+#include    "cphonegsmsshandler.h" 
+#include    "cphonegsmssparser.h" 
+#include    "cphonegsmparserresult.h" 
+
+// LOCAL FUNCTION PROTOTYPES
+
+/**
+* Converts from service type to action.
+*/
+CPhoneGsmSsHandler::TAction ConvertFromServiceType( 
+    CPhoneGsmSsParser::TServiceType aType );
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ConvertFromServiceType
+// -----------------------------------------------------------------------------
+//
+CPhoneGsmSsHandler::TAction ConvertFromServiceType( 
+        CPhoneGsmSsParser::TServiceType aType )
+    {
+    CPhoneGsmSsHandler::TAction result = 
+        CPhoneGsmSsHandler::EActivate;
+
+    switch ( aType )
+        {
+        case CPhoneGsmSsParser::EServiceActivation:
+            result = CPhoneGsmSsHandler::EActivate;
+            break;
+        case CPhoneGsmSsParser::EServiceDeactivation:
+            result = CPhoneGsmSsHandler::EDeactivate;
+            break;
+        case CPhoneGsmSsParser::EServiceInterrogation:
+            result = CPhoneGsmSsHandler::EInterrogate;
+            break;
+        case CPhoneGsmSsParser::EServiceRegistration:
+            result = CPhoneGsmSsHandler::ERegister;
+            break;
+        case CPhoneGsmSsParser::EServiceErasure:
+            result = CPhoneGsmSsHandler::EErase;
+            break;
+
+        default:
+            break;
+        }
+
+    return result;
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsHandler::ProcessL
+//
+// Process result and call appropriate function.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CPhoneGsmSsHandler::ProcessL( 
+        CPhoneGsmParserResult& aResult )
+    {            
+    switch( aResult.Uid() )
+        {
+        case KPhoneUidForwardingAll:
+            DoProcessForwardingL( 
+                EForwardingAll,
+                aResult );
+            break;
+
+        case KPhoneUidForwardingAllConditional:
+            DoProcessForwardingL(
+                EForwardingAllConditional,
+                aResult );
+            break;
+
+        case KPhoneUidForwardingUnconditional:
+            DoProcessForwardingL(
+                EForwardingUnconditional,
+                aResult );
+            break;
+
+        case KPhoneUidForwardingNoReply:
+            DoProcessForwardingL(
+                EForwardingNoReply,
+                aResult );
+            break;
+
+        case KPhoneUidForwardingNotReachable:
+            DoProcessForwardingL(
+                EForwardingNotReachable,
+                aResult );
+            break;
+
+        case KPhoneUidForwardingBusy:
+            DoProcessForwardingL( 
+                EForwardingBusy,
+                aResult );
+            break;
+
+        case KPhoneUidBarringAllOutgoingCalls:
+            DoProcessBarringL( 
+                EBarringAllOutgoingCalls,
+                aResult );
+            break;
+
+        case KPhoneUidBarringAllIncomingCalls:
+            DoProcessBarringL( 
+                EBarringAllIncomingCalls,
+                aResult );
+            break;
+
+        case KPhoneUidBarringAllServices:
+            DoProcessBarringL( 
+                EBarringAllServices,
+                aResult );
+            break;
+
+        case KPhoneUidBarringAllOutgoingInternationalCalls:
+            DoProcessBarringL( 
+                EBarringAllOutgoingInternationalCalls,
+                aResult );
+
+            break;
+
+        case KPhoneUidBarringAllOutgoingInternationalCallsExceptHome:
+            DoProcessBarringL( 
+                EBarringAllOutgoingInternationalCallsExceptHome,
+                aResult );
+            break;
+
+        case KPhoneUidBarringAllOutgoingServices:
+            DoProcessBarringL( 
+                EBarringAllOutgoingServices,
+                aResult );
+            break;
+
+        case KPhoneUidBarringAllIncomingCallsWhenRoaming:
+            DoProcessBarringL( 
+                EBarringAllIncomingCallsWhenRoaming,
+                aResult );
+            break;
+
+        case KPhoneUidBarringAllIncomingServices:
+            DoProcessBarringL( 
+                EBarringAllIncomingServices,
+                aResult );
+            break;
+
+        case KPhoneUidWaiting:
+            {
+            TPtrC ptr( KNullDesC );
+
+            if ( aResult.CountParameters() )
+                {
+                ptr.Set( aResult.ParameterAt( 0 ) );
+                }
+
+            TUint data = aResult.AuxInformation();
+            CPhoneGsmSsParser::TServiceType type;
+            CPhoneGsmSsParser::TServiceSyntax syntax;
+
+            CPhoneGsmSsParser::UnpackData( data, type, syntax );
+
+            TAction action = ConvertFromServiceType( type ); 
+            ProcessWaitingL( action, ptr );
+            }
+            break;
+
+        case KPhoneUidCallingLineIdentificationPresentation:
+            ProcessClipStatusL();
+            break;
+
+        case KPhoneUidCallingLineIdentificationRestriction:
+            ProcessClirStatusL();
+            break;
+
+        case KPhoneUidConnectedLinePresentation:
+            ProcessColpStatusL();
+            break;
+
+        case KPhoneUidConnectedLinePresentationRestriction:
+            ProcessColrStatusL();
+            break;
+
+        case KPhoneUidPassword:
+            {
+            TPasswordProcedure procedure = EPasswordNetwork;
+            if ( aResult.ParameterAt( 0 ).Length() )
+                {
+                procedure = EPasswordBarring;
+                }
+
+            ProcessPasswordChangeL( 
+                procedure,
+                aResult.ParameterAt(1),
+                aResult.ParameterAt(2),
+                aResult.ParameterAt(3) );
+            }
+            break;
+
+        case KPhoneUidCallingNamePresentation:
+            ProcessCnapStatusL();
+            break;
+
+        default:
+            break;
+        }
+
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsHandler::DoProcessBarringL
+//
+// Process barring procedures.
+// -----------------------------------------------------------------------------
+//
+void CPhoneGsmSsHandler::DoProcessBarringL(
+        TBarringProcedure aBarring,
+        CPhoneGsmParserResult& aResult )
+    {
+    CPhoneGsmSsParser::TServiceType type;
+    CPhoneGsmSsParser::TServiceSyntax syntax;
+    TPtrC password( KNullDesC );
+    TPtrC basicCode( KNullDesC );
+
+    CPhoneGsmSsParser::UnpackData( 
+        aResult.AuxInformation(),
+        type,
+        syntax );
+
+    TAction action = ConvertFromServiceType( type ); 
+
+    switch ( type )
+        {
+        case CPhoneGsmSsParser::EServiceDeactivation:
+        case CPhoneGsmSsParser::EServiceActivation:
+            
+            // First parameter is password.
+            if ( aResult.CountParameters() >= 1 )
+                {
+                password.Set( aResult.ParameterAt( 0 ) );
+                }
+
+            // Second parameter is basic service code.
+            if ( aResult.CountParameters() >= 2 )
+                {
+                basicCode.Set( aResult.ParameterAt( 1 ) );
+                }
+
+            ProcessBarringL( 
+                action,
+                aBarring,
+                password,
+                basicCode );
+
+            break;
+    
+        case CPhoneGsmSsParser::EServiceInterrogation:
+
+            // First parameter is basic service code.
+            if ( aResult.CountParameters() >= 1 )
+                {
+                basicCode.Set( aResult.ParameterAt( 0 ) );
+                }
+
+            ProcessBarringL(
+                action,
+                aBarring,
+                KNullDesC,
+                basicCode );
+
+            break;
+
+        case CPhoneGsmSsParser::EServiceRegistration:
+        case CPhoneGsmSsParser::EServiceErasure:
+            // These can never happen.
+            break;
+
+        default:
+            break;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsHandler::DoProcessForwardingL
+//
+// Process result and call appropriate function.
+// -----------------------------------------------------------------------------
+//
+void CPhoneGsmSsHandler::DoProcessForwardingL(
+        TForwardingProcedure aForwarding,
+        CPhoneGsmParserResult& aResult )
+    {
+    CPhoneGsmSsParser::TServiceType type;
+    CPhoneGsmSsParser::TServiceSyntax syntax;
+
+    CPhoneGsmSsParser::UnpackData( 
+        aResult.AuxInformation(),
+        type,
+        syntax );
+
+    TAction action = ConvertFromServiceType( type ); 
+
+    TPtrC number( KNullDesC );
+    TPtrC basicCode( KNullDesC );
+    TPtrC timer( KNullDesC );
+
+    switch ( type )
+        {
+        case CPhoneGsmSsParser::EServiceActivation:
+        case CPhoneGsmSsParser::EServiceDeactivation:
+        case CPhoneGsmSsParser::EServiceInterrogation:
+        case CPhoneGsmSsParser::EServiceErasure:
+            basicCode.Set( aResult.ParameterAt( 1 ) );
+            break;
+
+        case CPhoneGsmSsParser::EServiceRegistration:
+            {
+            number.Set( aResult.ParameterAt( 0 ) );
+            
+            if ( aResult.CountParameters() > 1 )
+                {
+                basicCode.Set( aResult.ParameterAt( 1 ) );
+                }
+
+            if ( aResult.CountParameters() > 2 )
+                {
+                timer.Set( aResult.ParameterAt( 2 ) );
+                }
+            }
+            break;
+
+        default:
+            break;
+        }
+
+    ProcessForwardingL(
+        action,
+        aForwarding,
+        number,
+        basicCode,
+        timer );
+            
+    }
+    
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/src/cphonegsmssparser.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,1387 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Principal parser for supplementary service procedures.
+*
+*/
+
+
+// INCLUDE FILES
+#include    <bldvariant.hrh>
+#include    <featmgr.h>
+#include    <nwdefs.h>
+
+#include    "cphonegsmssparser.h" 
+#include    "cphonegsmparserresult.h" 
+#include    "phonegsmparser.h" 
+#include    "cphonegsmoptioncontainer.h" 
+#include    "cphoneparserfeatures.h" 
+
+// CONSTANTS
+
+// Granularity of service array
+const TInt KPhoneServiceArrayGranularity = 20;
+
+// Activation starts with *. See also registration.
+_LIT( KPhoneSsActivation, "*" );
+
+// Deactivation starts with #.
+_LIT( KPhoneSsDeactivation, "#" );
+
+// Interrogation starts with *#.
+_LIT( KPhoneSsInterrogation, "*#" );
+
+// Registration starts with ** OR *. Case * is handled in the code.
+_LIT( KPhoneSsRegistration, "**" );
+
+// Erasure starts with ##.
+_LIT( KPhoneSsErasure, "##" );
+
+// It defines characters that can be used in these prefixes (see above).
+_LIT( KPhoneSsActionCharacters, "*#" );
+
+// It defines string that ends all ss requests.
+_LIT( KPhoneSsEnd, "#" );
+
+// It defines characters that are considered to be digits.
+_LIT( KPhoneSsDigits, "1234567890" );
+
+// Asterisk.
+const TInt KPhoneSsAsterisk = '*';
+
+// Hash.
+const TInt KPhoneSsHash = '#';
+
+// Plus.
+const TInt KPhoneSsPlus = '+';
+
+// Remainder: single character
+const TInt KPhoneSsRemainderSingle = 1;
+
+// Remainder: still a parameter, but ok ss
+const TInt KPhoneSsRemainderMinLength = 2; // something + #
+
+const TInt KPhoneSsPasswordLength = 4; 
+
+// Remainder: passwordk, ok ss
+const TInt KPhoneSsRemainderPasswordMinLength = 5; // four digits + #
+
+// Maximum length of directory number.
+const TInt KPhoneSsDirectoryNumberMaxLength = 38;
+// Maximum length of basic service code.
+const TInt KPhoneSsBasicCodeMaxLength = 2;
+// Maximum length of group code.
+const TInt KPhoneSsGroupCodeMaxLength = 4;
+// Maximum length of timer.
+const TInt KPhoneSsTimerMaxLength = 2;
+
+// The only acceptable group code (change of barring password)
+const TUint KPhoneSsOnlyAllowedGroupCode = 330;
+
+// Pack: shift
+const TInt KPhoneGsmPackShift = 8;
+
+// Pack: mask
+const TInt KPhoneGsmPackMask = 255;
+
+// -----------------------------------------------------------------------------
+// Syntax:
+//    
+//      SC      Service code
+//      A       Activation
+//      D       Deactivation
+//      I       Interrogation
+//      R       Registration
+//      E       Erasure
+//
+//     Text string must contain each of these in the following order
+//     "SC A D I R E" (separated by space). Following values correspond
+//      
+//
+//     0 - ENotAllowed       
+//     1 - ENoParameters
+//     2 - EEmptyOrBasicCode
+//     3 - ENumberOptBasicCodeOptTimer
+//     4 - ENumberOptBasicCode     
+//     5 - EPasswordOptBasicCode
+//     6 - EOptGroupCodePasswordNewPasswordNewPassword    
+//     7 - EEmptyOrBasicCode2         
+// -----------------------------------------------------------------------------
+_LIT( KPhoneUidForwardingAllCode,                                   "002 2 2 0 3 2" );
+_LIT( KPhoneUidForwardingAllConditionalCode,                        "004 2 2 0 3 2" );
+_LIT( KPhoneUidForwardingUnconditionalCode,                         "21  2 2 2 4 2" );
+_LIT( KPhoneUidForwardingNoReplyCode,                               "61  2 2 2 3 2" );
+_LIT( KPhoneUidForwardingNotReachableCode,                          "62  2 2 2 4 2" );
+_LIT( KPhoneUidForwardingBusyCode,                                  "67  2 2 2 4 2" );
+_LIT( KPhoneUidBarringAllOutgoingCallsCode,                         "33  5 5 1 0 0" );
+_LIT( KPhoneUidBarringAllIncomingCallsCode,                         "35  5 5 1 0 0" );
+_LIT( KPhoneUidBarringAllServicesCode,                              "330 0 5 0 0 0" );
+_LIT( KPhoneUidBarringAllOutgoingInternationalCallsCode,            "331 5 5 1 0 0" );
+_LIT( KPhoneUidBarringAllOutgoingInternationalCallsExceptHomeCode,  "332 5 5 1 0 0" );
+_LIT( KPhoneUidBarringAllOutgoingServicesCode,                      "333 0 5 0 0 0" );
+_LIT( KPhoneUidBarringAllIncomingCallsWhenRoamingCode,              "351 5 5 1 0 0" );
+_LIT( KPhoneUidBarringAllIncomingServicesCode,                      "353 0 5 0 0 0" );
+_LIT( KPhoneUidWaitingCode,                                         "43  7 7 7 0 0" );
+_LIT( KPhoneUidCallingLineIdentificationPresentationCode,           "30  0 0 1 0 0" );
+_LIT( KPhoneUidCallingLineIdentificationRestrictionCode,            "31  0 0 1 0 0" );
+_LIT( KPhoneUidConnectedLinePresentationCode,                       "76  0 0 1 0 0" );
+_LIT( KPhoneUidConnectedLinePresentationRestrictionCode,            "77  0 0 1 0 0" ); 
+_LIT( KPhoneUidPasswordCode,                                        "03  6 0 0 6 0" );
+_LIT( KPhoneUidCallingNamePresentationCode,                         "300 0 0 1 0 0" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsParser::CPhoneGsmSsParser
+// -----------------------------------------------------------------------------
+//
+CPhoneGsmSsParser::CPhoneGsmSsParser()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsParser::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CPhoneGsmSsParser::ConstructL()
+    {
+    iArray = 
+        new ( ELeave ) CServiceArray( 
+            KPhoneServiceArrayGranularity );
+
+    // Check AddL method for details what these really mean.
+    
+    // Forwarding
+    AddL( KPhoneUidForwardingAllCode, 
+        KPhoneUidForwardingAll );
+    AddL( KPhoneUidForwardingAllConditionalCode, 
+        KPhoneUidForwardingAllConditional );
+    AddL( KPhoneUidForwardingUnconditionalCode, 
+        KPhoneUidForwardingUnconditional );
+    AddL( KPhoneUidForwardingNoReplyCode, 
+        KPhoneUidForwardingNoReply );
+    AddL( KPhoneUidForwardingNotReachableCode, 
+        KPhoneUidForwardingNotReachable );
+    AddL( KPhoneUidForwardingBusyCode, 
+        KPhoneUidForwardingBusy );
+
+    // Barring
+    AddL( KPhoneUidBarringAllOutgoingCallsCode, 
+        KPhoneUidBarringAllOutgoingCalls );
+    AddL( KPhoneUidBarringAllIncomingCallsCode, 
+        KPhoneUidBarringAllIncomingCalls );
+    AddL( KPhoneUidBarringAllServicesCode, 
+        KPhoneUidBarringAllServices );
+    AddL( KPhoneUidBarringAllOutgoingInternationalCallsCode, 
+        KPhoneUidBarringAllOutgoingInternationalCalls );
+    AddL( KPhoneUidBarringAllOutgoingInternationalCallsExceptHomeCode, 
+        KPhoneUidBarringAllOutgoingInternationalCallsExceptHome );
+    AddL( KPhoneUidBarringAllOutgoingServicesCode, 
+        KPhoneUidBarringAllOutgoingServices );
+    AddL( KPhoneUidBarringAllIncomingCallsWhenRoamingCode, 
+        KPhoneUidBarringAllIncomingCallsWhenRoaming );
+    AddL( KPhoneUidBarringAllIncomingServicesCode, 
+        KPhoneUidBarringAllIncomingServices );
+    
+    // Waiting
+    AddL( KPhoneUidWaitingCode, 
+        KPhoneUidWaiting );
+
+    // Calling line identification presentation
+    AddL( KPhoneUidCallingLineIdentificationPresentationCode, 
+        KPhoneUidCallingLineIdentificationPresentation );
+
+    // Calling line identification restriction
+    AddL( KPhoneUidCallingLineIdentificationRestrictionCode, 
+        KPhoneUidCallingLineIdentificationRestriction );
+
+    // Connected line presentation
+    AddL( KPhoneUidConnectedLinePresentationCode, 
+        KPhoneUidConnectedLinePresentation );
+
+    // Connected line presentation restriction.
+    AddL( KPhoneUidConnectedLinePresentationRestrictionCode, 
+        KPhoneUidConnectedLinePresentationRestriction );
+
+    // CNAP.  
+    if ( CPhoneParserFeatures::FeatureSupported( KFeatureIdPhoneCnap ) )
+        {
+        AddL( KPhoneUidCallingNamePresentationCode, 
+            KPhoneUidCallingNamePresentation );
+        }
+
+    // Password
+    AddL( KPhoneUidPasswordCode, 
+        KPhoneUidPassword );
+
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsParser::NewLC
+// -----------------------------------------------------------------------------
+//
+CPhoneGsmSsParser* CPhoneGsmSsParser::NewLC()
+    {
+    CPhoneGsmSsParser* self = new ( ELeave ) CPhoneGsmSsParser;
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsParser::~CPhoneGsmSsParser
+// -----------------------------------------------------------------------------
+//
+CPhoneGsmSsParser::~CPhoneGsmSsParser()
+    {
+    delete iArray;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsParser::ParseL
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmSsParser::ParseL( 
+        const TDesC& aString, 
+        CPhoneGsmParserResult& aResult,
+        CPhoneGsmOptionContainerBase& aOptions )
+    {
+    TBool result = EFalse;
+    aResult.ClearL();      
+// All operations require SEND.
+// If VoIP call no action needed here.
+    if ( !aOptions.FindOptionStatus( KPhoneOptionSend ) ||
+         aOptions.FindOptionStatus( KPhoneOptionVoipCall ) )
+        {
+        return EFalse;
+        }
+
+    TLex input( aString );
+    TPtrC action( 
+        FindString( 
+            input, 
+            KPhoneSsActionCharacters() ) );
+
+    // Check if action is proper for service requests.
+    TServiceType type = EServiceActivation;
+    
+    // This variable will indicate if action was ok.
+    TBool ok = ETrue;
+
+    // Fill type.
+    if ( action == KPhoneSsActivation )
+        {
+        type = EServiceActivation;
+        }
+    else if ( action == KPhoneSsDeactivation )
+        {
+        type = EServiceDeactivation;
+        }
+    else if ( action == KPhoneSsInterrogation )
+        {
+        type = EServiceInterrogation;
+        }
+    else if ( action == KPhoneSsRegistration )
+        {
+        type = EServiceRegistration;
+        }
+    else if ( action == KPhoneSsErasure )
+        {
+        type = EServiceErasure;
+        }
+    else 
+        {
+        // Not ok.
+        ok = EFalse;
+        }
+
+    // Prefix must be one of the service types.
+    if ( ok )
+        {
+        TPtrC serviceCode( FindString( input, KPhoneSsDigits() ) );
+        
+        // Check that service code is not too long.
+        if ( serviceCode.Length() > KPhoneGsmSsServiceCodeMaxLength )
+            {
+            return EFalse;
+            }
+
+        TKeyArrayFix key( _FOFF( TServiceInfo, iCode ), ECmpNormal );
+        TServiceInfo info;
+        TInt position;       
+        info.iCode = serviceCode;
+
+        // Check if the string can be a service request.
+        if ( !iArray->FindIsq( info, key, position ) )
+            {
+            info = iArray->At( position );
+            }
+        else
+            {
+            // Not found.
+            return EFalse;
+            }
+
+        TServiceSyntax syntax = ESyntaxNotAllowed;
+
+        // Take syntax from info record.
+        switch ( type )
+            {
+            case EServiceActivation:
+                syntax = info.iActivation;
+                break;
+
+            case EServiceDeactivation:
+                syntax = info.iDeactivation;
+                break;
+
+            case EServiceInterrogation:
+                syntax = info.iInterrogation;
+                break;
+
+            case EServiceRegistration:
+                syntax = info.iRegistration;
+                break;
+
+            case EServiceErasure:
+                syntax = info.iErasure;
+                break;
+
+            default:
+                PhoneGsmParser::Panic( PhoneGsmParser::EShouldNeverHappen );
+                break;
+            }
+
+        TUint data;
+        PackData( data, type, syntax );
+
+        aResult.SetUid( info.iUid );
+        aResult.SetAuxInformation( data );
+        
+        // We may have to backtrack in case HandleParametersL fails.
+        TLexMark mark;
+        input.Mark( mark );
+
+        // First attempt
+        result = HandleParametersL( input, aResult, syntax );
+
+        // If action was activation and result was failure, then try registration.
+        if ( !result && type == EServiceActivation )
+            {
+            // Backtrack.
+            input.UnGetToMark( mark );
+
+            // Clear previous results & fill information again.
+
+            type = EServiceRegistration;
+            syntax = info.iRegistration;
+            PackData( data, type, syntax );
+
+            aResult.ClearL();
+            aResult.SetUid( info.iUid );
+            aResult.SetAuxInformation( data );
+
+            // Try again. If this fails, then it is really failure.
+            result = HandleParametersL( input, aResult, syntax );
+            }
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsParser::PackData
+//
+// Combine data to integer.
+// -----------------------------------------------------------------------------
+//
+void CPhoneGsmSsParser::PackData(
+        TUint& aResult,
+        TServiceType aType,
+        TServiceSyntax aSyntax )
+    {
+    aResult = 
+        ( ( ( TUint )aType ) << KPhoneGsmPackShift ) + ( ( TUint )aSyntax );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsParser::UnpackData
+// 
+// Take data from integer.
+// -----------------------------------------------------------------------------
+//
+void CPhoneGsmSsParser::UnpackData(
+        TUint aData,
+        TServiceType& aResultType,
+        TServiceSyntax& aResultSyntax )
+    {
+    aResultSyntax = 
+        CPhoneGsmSsParser::TServiceSyntax( aData & KPhoneGsmPackMask );
+    aResultType = 
+        CPhoneGsmSsParser::TServiceType( 
+            ( aData >> KPhoneGsmPackShift ) & 
+            KPhoneGsmPackMask );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsParser::HandleParametersL
+//
+// Selects correct function by syntax information.
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmSsParser::HandleParametersL( 
+        TLex& aInput, 
+        CPhoneGsmParserResult& aResult,
+        TServiceSyntax aSyntax )
+    {
+    TBool result = EFalse;
+
+    switch ( aSyntax )
+        {
+        case ESyntaxNotAllowed:
+            result = 
+                HandleNotAllowedL( aInput, aResult );
+            break;
+
+        case ESyntaxNoParameters:
+            result = 
+                HandleNoParametersL( aInput, aResult );
+            break;
+
+        case ESyntaxEmptyOrBasicCode:
+            result = 
+                HandleEmptyOrBasicCodeL( aInput, aResult );
+            break;
+            
+        case ESyntaxNumberOptBasicCodeOptTimer:
+            result = 
+                HandleNumberOptBasicCodeOptTimerL( 
+                    aInput, 
+                    aResult );
+            break;
+
+        case ESyntaxNumberOptBasicCode:
+            result = 
+                HandleNumberOptBasicCodeL( 
+                    aInput, 
+                    aResult );
+            break;
+
+        case ESyntaxPasswordOptBasicCode:
+            result = 
+                HandlePasswordOptBasicCodeL( 
+                    aInput, 
+                    aResult );
+            break;
+            
+        case ESyntaxOptGroupCodePasswordNewPasswordNewPassword:
+            result = 
+                HandleOptGroupCodePasswordNewPasswordNewPasswordL( 
+                    aInput, 
+                    aResult );
+            break;
+
+        case ESyntaxEmptyOrBasicCode2:
+            result = 
+                HandleEmptyOrBasicCode2L( 
+                    aInput, 
+                    aResult );
+            break;
+
+        default:
+            break;
+        }          
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsParser::HandleNotAllowedL
+//
+// Just clear the result and return that parsing failed.
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmSsParser::HandleNotAllowedL( 
+        TLex& /*aInput*/, 
+        CPhoneGsmParserResult& aResult )
+    {
+    aResult.ClearL();
+    
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsParser::HandleNoParametersL
+//
+// Handle no more parameters, only hash 
+// as the last character.
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmSsParser::HandleNoParametersL( 
+        TLex& aInput, 
+        CPhoneGsmParserResult& /*aResult*/ )
+    {
+    // Next character is last character and it is hash character.
+    TBool result = EFalse;
+    TPtrC ptr = aInput.Remainder();
+
+    if ( ptr.Length() == KPhoneSsRemainderSingle )
+        {
+        result = ( ptr[0] == KPhoneSsHash );
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsParser::HandleEmptyOrBasicCodeL
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmSsParser::HandleEmptyOrBasicCodeL( 
+        TLex& aInput,
+        CPhoneGsmParserResult& aResult )
+    {
+    TBool result = EFalse;
+
+    if ( HandleNoParametersL( aInput, aResult ) )
+        {
+        aResult.AddParameterL( KNullDesC );
+        aResult.AddParameterL( KNullDesC );
+        result = ETrue;
+        }
+    else
+        {
+        result = HandleEmptyParameterL( aInput, aResult );
+
+        if ( result )
+            {
+            result = HandleBasicCodeL( aInput, aResult );
+            result = result && HandleNoParametersL( aInput, aResult );
+            }
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsParser::HandleNumberOptBasicCodeOptTimerL
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmSsParser::HandleNumberOptBasicCodeOptTimerL(
+        TLex& aInput,
+        CPhoneGsmParserResult& aResult )
+    {
+    TBool result = EFalse;
+    
+    if ( HandleNumberL( aInput, aResult ) )
+        {
+        if ( HandleNoParametersL( aInput, aResult ) )
+            {
+            // Add basic code and timer.
+            aResult.AddParameterL( KNullDesC ); 
+            aResult.AddParameterL( KNullDesC ); 
+            result = ETrue;
+            }
+        else 
+            {
+            if ( HandleBasicCodeL( aInput, aResult ) )
+                {
+                if ( HandleTimerL( aInput, aResult ) )
+                    {
+                    result = HandleNoParametersL( aInput, aResult );
+                    }
+                else
+                    {
+                    result = HandleNoParametersL( aInput, aResult );
+                    aResult.AddParameterL( KNullDesC );
+                    }
+                }
+            else if ( HandleEmptyParameterL( aInput, aResult ) )
+                {
+                result = HandleTimerL( aInput, aResult );
+                result = result && 
+                         HandleNoParametersL( aInput, aResult );
+                }
+            }
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsParser::HandleNumberOptBasicCodeL
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmSsParser::HandleNumberOptBasicCodeL(
+        TLex& aInput,
+        CPhoneGsmParserResult& aResult )
+    {
+    TBool result = EFalse;
+    
+    if ( HandleNumberL( aInput, aResult ) )
+        {
+        if ( HandleNoParametersL( aInput, aResult ) )
+            {
+            aResult.AddParameterL( KNullDesC );
+            result = ETrue;
+            }
+        else
+            {
+            result = HandleBasicCodeL( aInput, aResult );
+            result = result && HandleNoParametersL( aInput, aResult );
+            }
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsParser::HandlePasswordOptBasicCodeL
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmSsParser::HandlePasswordOptBasicCodeL(
+        TLex& aInput,
+        CPhoneGsmParserResult& aResult )
+    {
+    TBool result = EFalse;
+
+    if ( HandlePasswordL( aInput, aResult ) )
+        {
+        if ( HandleNoParametersL( aInput, aResult ) )
+            {
+            aResult.AddParameterL( KNullDesC );
+            result = ETrue;
+            }
+        else
+            {
+            result = HandleBasicCodeL( aInput, aResult );
+            result = result && HandleNoParametersL( aInput, aResult );
+            }
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsParser::
+// HandleOptGroupCodePasswordNewPasswordNewPasswordL
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmSsParser::
+    HandleOptGroupCodePasswordNewPasswordNewPasswordL(
+        TLex& aInput,
+        CPhoneGsmParserResult& aResult )
+    {
+    TBool result = HandleGroupCodeL( aInput, aResult );
+
+    if ( !result )
+        {
+        result = HandleEmptyParameterL( aInput, aResult );
+        }
+
+    result = result && HandlePasswordL( aInput, aResult );
+    result = result && HandlePasswordL( aInput, aResult );
+    result = result && HandlePasswordL( aInput, aResult );
+    result = result && HandleNoParametersL( aInput, aResult );
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsParser::HandleEmptyOrBasicCode2L
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmSsParser::HandleEmptyOrBasicCode2L(
+        TLex& aInput,
+        CPhoneGsmParserResult& aResult )
+    {
+    TBool result = HandleNoParametersL( aInput, aResult );
+
+    if ( result )
+        {
+        aResult.AddParameterL( KNullDesC );
+        }
+    else
+        {
+        result = HandleBasicCodeL( aInput, aResult );
+        result = result && HandleNoParametersL( aInput, aResult );
+        }
+    
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsParser::HandleEmptyParameterL
+//
+// Handle empty parameter, two consecutive asterisks.
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmSsParser::HandleEmptyParameterL( 
+        TLex& aInput,
+        CPhoneGsmParserResult& aResult )
+    {
+    TBool result = EFalse;
+    aInput.Mark();
+
+    if ( aInput.Peek() == KPhoneSsAsterisk )
+        {
+        aInput.Inc();
+
+        result = ( aInput.Peek() == KPhoneSsAsterisk );
+        
+        if ( result )
+            {
+            aResult.AddParameterL( KNullDesC );
+            }
+        }
+
+    if ( !result )
+        {
+        aInput.UnGetToMark();
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsParser::HandleBasicCodeL
+//
+// Basically, basic service code is a two digit string.
+// In this method, only explicit
+// values are handled (parameter might be empty).
+//
+// The method checks that the first character is * and then
+// it is followed by two digits. And there must not be more
+// than two digits.
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmSsParser::HandleBasicCodeL( 
+        TLex& aInput,
+        CPhoneGsmParserResult& aResult )
+    {   
+    TBool result = EFalse;
+    TLexMark start;
+
+    aInput.Mark( start );
+
+    if ( aInput.Peek() == KPhoneSsAsterisk )
+        {
+        aInput.Inc();
+    
+        TLexMark mark;
+        aInput.Mark( mark );
+        
+        if ( aInput.Peek().IsDigit() )
+            {
+            aInput.Inc();
+
+            if ( aInput.Peek().IsDigit() )
+                {
+                aInput.Inc();
+
+                if ( !aInput.Peek().IsDigit() )
+                    {
+                    TPtrC code = aInput.MarkedToken( mark );
+
+                    result = CheckBasicCode( code );
+
+                    if ( result )
+                        {
+                        aResult.AddParameterL( code );
+                        }
+                    }
+                }
+            }
+
+        // Check empty parameters.
+        if ( !result )
+            {
+            aInput.UnGetToMark( mark );
+            
+            if ( aInput.Remainder() == KPhoneSsEnd )
+                {
+                aResult.AddParameterL( KNullDesC );
+                result = ETrue;
+                }
+            }
+        }
+
+    if ( !result )
+        {
+        aInput.UnGetToMark( start );
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsParser::HandleNumberL
+//
+// Directory number as a parameter must be present. It can
+// contain at most 38 digits. Digits and '+' characters
+// are allowed, but '+' character is allowed to be only in the 
+// beginning of the string.
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmSsParser::HandleNumberL( 
+        TLex& aInput,
+        CPhoneGsmParserResult& aResult )
+    {
+    if ( aInput.Remainder().Length() < KPhoneSsRemainderMinLength )
+        {
+        return EFalse;
+        }
+
+    TInt maxLength = KPhoneSsDirectoryNumberMaxLength;
+    TBool result = EFalse;
+    TLexMark start;
+
+    aInput.Mark( start );
+
+    if ( aInput.Peek() == KPhoneSsAsterisk )
+        {
+        aInput.Inc();
+       
+        TLexMark mark;
+        aInput.Mark( mark );
+
+        if ( aInput.Peek() == KPhoneSsPlus )
+            {
+            aInput.Inc();
+            maxLength++;
+            }
+
+        while ( aInput.Peek().IsDigit() )
+            {
+            aInput.Inc();
+            }
+
+        TPtrC number = aInput.MarkedToken( mark );
+        if ( number.Length() <= maxLength )
+            {  
+            aResult.AddParameterL( number );
+            result = ETrue;
+            }
+        }
+
+    if ( !result )
+        {
+        aInput.UnGetToMark( start );
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsParser::HandleTimerL
+//
+// The method checks if the next part is 'no reply timer'.
+// It is at most two digits. Value is expected to be present.
+// Value is checked in CheckTimer method.
+//
+// (if value is not present, then it is handled in calling
+//  method)
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmSsParser::HandleTimerL( 
+        TLex& aInput,
+        CPhoneGsmParserResult& aResult )
+    {
+    TBool result = EFalse;
+    TLexMark start;
+    aInput.Mark( start );
+
+    if ( aInput.Peek() == KPhoneSsAsterisk )
+        {
+        aInput.Inc();
+
+        TLexMark mark;
+        aInput.Mark( mark );
+        
+        while ( aInput.Peek().IsDigit() )
+            {
+            aInput.Inc();
+            }
+        
+        TPtrC timer( aInput.MarkedToken( mark ) );
+        
+        if ( CheckTimer( timer ) )
+            {
+            aResult.AddParameterL( timer );
+            result = ETrue;
+            }
+
+        // Check empty parameters.
+        if ( !result )
+            {
+            aInput.UnGetToMark( mark );
+            
+            if ( aInput.Remainder() == KPhoneSsEnd )
+                {
+                aResult.AddParameterL( KNullDesC );
+                result = ETrue;
+                }
+            }
+        }
+
+    if ( !result )
+        {
+        aInput.UnGetToMark( start );
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsParser::HandlePasswordL
+//
+// Password is four digit string.
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmSsParser::HandlePasswordL( 
+        TLex& aInput,
+        CPhoneGsmParserResult& aResult )
+    {
+    if ( aInput.Remainder().Length() <
+         KPhoneSsRemainderPasswordMinLength )
+        {
+        return EFalse;
+        }
+
+    TBool result = EFalse;
+    TLexMark start;
+    aInput.Mark( start );
+
+    if ( aInput.Peek() == KPhoneSsAsterisk )
+        {
+        aInput.Inc();
+
+        TLexMark mark;
+        aInput.Mark( mark );
+
+        while( aInput.Peek().IsDigit() )
+            {
+            aInput.Inc();
+            }
+
+        TPtrC password( aInput.MarkedToken( mark ) );
+        
+        if ( password.Length() == KPhoneSsPasswordLength )
+            {
+            aResult.AddParameterL( password );
+            result = ETrue;
+            }
+        }
+
+    if ( !result )
+        {
+        aInput.UnGetToMark( start );
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsParser::HandleGroupCodeL
+//
+// The method handles password group codes. However, code 
+// must be one to four digits. 
+//
+// (if group code is null, then it is handled in calling
+//  method)
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmSsParser::HandleGroupCodeL( 
+        TLex& aInput,
+        CPhoneGsmParserResult& aResult )
+    {
+    if ( aInput.Remainder().Length() <= KPhoneSsRemainderMinLength )
+        {
+        return EFalse;
+        }
+
+    TBool result = EFalse; 
+    TLexMark start;
+
+    aInput.Mark( start );
+
+    if ( aInput.Peek() == KPhoneSsAsterisk )
+        {
+        aInput.Inc();
+        
+        TLexMark mark;
+        aInput.Mark( mark );
+
+        while ( aInput.Peek().IsDigit() )
+            {
+            aInput.Inc();
+            }
+
+        TPtrC groupCode( aInput.MarkedToken( mark ) );
+
+        if ( CheckGroupCode( groupCode ) )
+            {
+            aResult.AddParameterL( groupCode );
+            result = ETrue;
+            }
+        }
+
+    if ( !result )
+        {
+        aInput.UnGetToMark( start );
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsParser::CheckBasicCode
+//
+// Check that basic code is appropriate
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmSsParser::CheckBasicCode( const TDesC& aCode )
+    {
+    TLex lex( aCode );
+    TUint value;
+    
+    if ( aCode.Length() <= KPhoneSsBasicCodeMaxLength )
+        {
+        if ( lex.Val( value, EDecimal ) != KErrNone )
+            {
+            return EFalse;
+            }
+        }
+    else
+        {
+        return EFalse;
+        }
+
+    TBool result = EFalse;
+  
+    switch ( value )
+        {
+        // TELESERVICES
+        case EAllTele:          // GSM: All tele and bearer services
+        case ETelephony:        // GSM: Teleservices
+        case EAllDataTele:      // GSM: All data teleservices
+        case EFax:              // GSM: Facsimile services
+        case ESms:              // GSM: Short message services
+        case EAllTeleExcSms:    // GSM: All teleservices except SMS
+        case EAltTele:          // PCN: Alternate line service
+
+        // BEARER SERVICES
+        case EAllBearer:        // GSM: All bearer services
+        case EAllAsync:         // GSM: All async services
+        case EAllSync:          // GSM: All sync services
+        case ESyncData:         // GSM: All data circuit sync
+        case EAsyncData:        // GSM: All data circuit async
+        case EPacketData:       // GSM: All dedicated packet access
+        case EPadAccess:        // GSM: All dedicated PAD access
+
+            result = ETrue;
+            break;
+
+        // PLMN specific teleservices and bearer services
+        default:
+            
+            // GSM: PLMN specific teleservices
+            if ( value >= EAllPlmnTele && value <= EPlmnTeleF )
+                {
+                result = ETrue;
+                }
+            // GSM: PLMN specific bearer services
+            else if ( value >= EAllPlmnBearer && value <= EPlmnBearerServF )
+                {
+                result = ETrue;
+                }
+
+            // Otherwise, result == EFalse and it's OK.
+            break;
+        }
+    
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsParser::CheckTimer
+//
+// Check if timer value is ok.
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmSsParser::CheckTimer( const TDesC& aCode )
+    {
+    TLex lex( aCode );
+    TUint value;
+    
+    if ( aCode.Length() <= KPhoneSsTimerMaxLength )
+        {
+        if ( lex.Val( value, EDecimal ) != KErrNone )
+            {
+            return EFalse;
+            }
+        }
+    else 
+        {
+        return EFalse;
+        }
+
+    TBool result = EFalse;
+
+    switch ( value )
+        {
+        case 5:
+        case 10:
+        case 15:
+        case 20:
+        case 25:
+        case 30:
+            result = ETrue;
+            break;
+
+        default:
+            break;
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsParser::CheckGroupCode
+//
+// Check if group code is ok.
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneGsmSsParser::CheckGroupCode( const TDesC& aCode )
+    {
+    TLex lex( aCode );
+    TUint value;
+    TBool result = EFalse;
+
+    if ( aCode.Length() <= KPhoneSsGroupCodeMaxLength )
+        {
+        if ( lex.Val( value, EDecimal ) == KErrNone )
+            {
+            result = ( value == KPhoneSsOnlyAllowedGroupCode );
+            }
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsParser::FindString
+// -----------------------------------------------------------------------------
+//
+TPtrC CPhoneGsmSsParser::FindString( 
+        TLex& aInput,
+        const TDesC& aAllowedCharacters )
+    {
+    TLexMark mark;
+    aInput.Mark( mark );
+
+    // Return string containing characters that appear in 
+    // aAllowedCharacters.
+    while ( aAllowedCharacters.Locate( aInput.Peek() ) != 
+            KErrNotFound )
+        {
+        aInput.Inc();
+        }
+    
+    return aInput.MarkedToken( mark );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsParser::AddL
+//
+// Parse service description and add it.
+//
+// -----------------------------------------------------------------------------
+//
+void CPhoneGsmSsParser::AddL( 
+        const TDesC& aService, 
+        TUint aUid )
+    {
+    // There must be six positive integers in aService.   
+    TLex input( aService );
+
+    // First number is service code.
+    TPtrC serviceCode( NextNumber( input ) );
+
+    // And then next five are syntax descriptions.
+    TServiceSyntax activation = 
+        ConvertToServiceSyntax( NextNumberAsValue( input ) );
+    TServiceSyntax deactivation = 
+        ConvertToServiceSyntax( NextNumberAsValue( input ) );
+    TServiceSyntax interrogation = 
+        ConvertToServiceSyntax( NextNumberAsValue( input ) );
+    TServiceSyntax registration = 
+        ConvertToServiceSyntax( NextNumberAsValue( input ) );
+    TServiceSyntax erasure = 
+        ConvertToServiceSyntax( NextNumberAsValue( input ) );
+   
+    // Add to array.
+    AddServiceL( 
+        serviceCode,
+        activation,
+        deactivation,
+        interrogation,
+        registration,
+        erasure,
+        aUid );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsParser::AddServiceL
+// -----------------------------------------------------------------------------
+//
+void CPhoneGsmSsParser::AddServiceL( 
+        const TDesC& aServiceCode,
+        TServiceSyntax aActivation,
+        TServiceSyntax aDeactivation,
+        TServiceSyntax aInterrogation,
+        TServiceSyntax aRegistration,
+        TServiceSyntax aErasure,
+        TUint aUid )
+    {   
+    TServiceInfo info;
+
+    // Fill information to info structure.
+    info.iCode = aServiceCode;
+    info.iActivation = aActivation;
+    info.iDeactivation = aDeactivation;
+    info.iInterrogation = aInterrogation;
+    info.iRegistration = aRegistration;
+    info.iErasure = aErasure;
+    info.iUid = aUid;
+
+    TKeyArrayFix key( _FOFF( TServiceInfo, iCode ), ECmpNormal );
+
+    // Add it to the array.
+    TRAPD( err, iArray->InsertIsqL( info, key ) ); 
+
+    if ( err != KErrNone && err != KErrNoMemory )
+        {
+        PhoneGsmParser::Panic( 
+            PhoneGsmParser::EIncorrectServiceDescription );
+        }
+
+    // Just leave if no memory.
+    if ( err == KErrNoMemory )
+        {
+        User::Leave( err );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsParser::NextNumber
+//
+// Skip spaces and then get next number.
+// -----------------------------------------------------------------------------
+//
+TPtrC CPhoneGsmSsParser::NextNumber( 
+        TLex& aLex )
+    {
+    // Skip whites.
+    aLex.SkipSpace();
+
+    // Go over digits.
+    aLex.Mark();
+    while ( aLex.Peek().IsDigit() )
+        {
+        aLex.Inc();
+        }
+
+    // Check if we got proper number.
+    if ( !aLex.TokenLength() )
+        {
+        PhoneGsmParser::Panic( 
+            PhoneGsmParser::EIncorrectServiceDescription );
+        }
+    
+    return aLex.MarkedToken();       
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsParser::NextNumberAsValue
+//
+// Get number and convert it to value.
+// -----------------------------------------------------------------------------
+//
+TUint CPhoneGsmSsParser::NextNumberAsValue( 
+        TLex& aLex )
+    {
+    // Get number.
+    TPtrC number( NextNumber( aLex ) );
+    TLex input( number );
+    TUint value;
+
+    // Parse number.
+    if ( input.Val( value, EDecimal ) != KErrNone )
+        {
+        PhoneGsmParser::Panic( 
+            PhoneGsmParser::EIncorrectServiceDescription );
+        }
+
+    return value;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneGsmSsParser::ConvertToServiceSyntax
+//
+// Convert value to a service syntax enumeration.
+// -----------------------------------------------------------------------------
+//
+CPhoneGsmSsParser::TServiceSyntax 
+    CPhoneGsmSsParser::ConvertToServiceSyntax( 
+        TUint aService )
+    {
+    TServiceSyntax service = ESyntaxNotAllowed;
+
+    switch ( aService )
+        {
+        case 0:
+            service = ESyntaxNotAllowed;        
+            break;
+        case 1:
+            service = ESyntaxNoParameters;
+            break;
+        case 2:
+            service = ESyntaxEmptyOrBasicCode;
+            break;
+        case 3:
+            service = ESyntaxNumberOptBasicCodeOptTimer;
+            break;
+        case 4:
+            service = ESyntaxNumberOptBasicCode;
+            break;
+        case 5:
+            service = ESyntaxPasswordOptBasicCode;
+            break;
+        case 6:
+            service = ESyntaxOptGroupCodePasswordNewPasswordNewPassword;
+            break;
+        case 7:
+            service = ESyntaxEmptyOrBasicCode2;
+            break;
+        default:
+            PhoneGsmParser::Panic( 
+                PhoneGsmParser::EIncorrectServiceDescription );       
+        }
+
+    return service;
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/src/cphoneparserfeatures.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,212 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Encapsulation of external dependencies of Phone Parser.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "cphoneparserfeatures.h" 
+#include    <featmgr.h>
+#include    <centralrepository.h>
+#include    <telservicesvariant.hrh>
+#include    <telservicesinternalcrkeys.h>
+#include    <cphcltemergencycall.h> 
+
+// FORWARD DECLARATION
+
+// CONSTANTS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneParserFeatures::CPhoneParserFeatures
+// -----------------------------------------------------------------------------
+//
+CPhoneParserFeatures::CPhoneParserFeatures()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneParserFeatures::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CPhoneParserFeatures::ConstructL()
+    {
+    // Read local variation settings.
+    FeatureManager::InitializeLibL();
+    iEmergencyCall = CPhCltEmergencyCall::NewL( this );
+    iRepository = CRepository::NewL( KCRUidTelSrvVariation );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneParserFeatures::InstanceL
+// -----------------------------------------------------------------------------
+//
+CPhoneParserFeatures* CPhoneParserFeatures::InstanceL()
+    {
+    CPhoneParserFeatures* self =
+        static_cast<CPhoneParserFeatures*>( Dll::Tls() );
+
+    if( !self )
+        {
+        self = new (ELeave) CPhoneParserFeatures;
+        CleanupStack::PushL( self );
+        self->ConstructL();
+        CleanupStack::Pop( self );
+        Dll::SetTls( self );
+        }
+
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneParserFeatures::Instance
+// -----------------------------------------------------------------------------
+//
+CPhoneParserFeatures* CPhoneParserFeatures::Instance()
+    {
+    CPhoneParserFeatures* self( NULL );
+    TRAPD( err, self = InstanceL() );
+    return err ? NULL : self;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneParserFeatures::Free
+// -----------------------------------------------------------------------------
+//
+void CPhoneParserFeatures::Free()
+    {
+    CPhoneParserFeatures* self =
+        static_cast<CPhoneParserFeatures*>( Dll::Tls() );
+
+    if( self )
+        {
+        delete self;
+        self = NULL;
+        Dll::SetTls( NULL );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneParserFeatures::SetInstance
+// -----------------------------------------------------------------------------
+//
+#ifdef __WINS__
+void CPhoneParserFeatures::SetInstance( 
+    CPhoneParserFeatures* aStub )
+    {
+    Dll::SetTls( aStub );
+    }
+#endif // __WINS__
+// -----------------------------------------------------------------------------
+// CPhoneParserFeatures::~CPhoneParserFeatures
+// -----------------------------------------------------------------------------
+//
+CPhoneParserFeatures::~CPhoneParserFeatures()
+    {
+    delete iEmergencyCall;
+    delete iRepository;
+    FeatureManager::UnInitializeLib();
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneParserFeatures::HandleEmergencyDialL
+// -----------------------------------------------------------------------------
+//
+void CPhoneParserFeatures::HandleEmergencyDialL( const TInt /*aStatus*/ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneParserFeatures::TwoDigitCallingEnabled
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneParserFeatures::TwoDigitCallingEnabled()
+    {
+    return Instance() ? 
+        Instance()->GetTelephoneVariant() & KTelSrvLVFlagTwoDigitDial : 
+        EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneParserFeatures::IsZeroDialEnabled
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneParserFeatures::IsZeroDialEnabled()
+    {
+    return Instance() ? 
+        Instance()->GetTelephoneVariant() & KTelSrvLVFlagZeroDial : EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneParserFeatures::IsEmergencyNumber
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneParserFeatures::IsEmergencyNumber( 
+    const TDesC& aNumber, 
+    TDes& aEmergencyNumber )
+    {
+    return Instance() ? 
+        Instance()->IsEmergencyPhoneNumber( aNumber, aEmergencyNumber ) : EFalse; 
+    }    
+
+// -----------------------------------------------------------------------------
+// CPhoneParserFeatures::IsItEmergencyNumber
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneParserFeatures::IsEmergencyPhoneNumber( 
+    const TDesC& aNumber, 
+    TDes& aEmergencyNumber )
+    {
+    TBool isEmergency;
+
+    TInt error = iEmergencyCall->IsEmergencyPhoneNumber( 
+        aNumber, 
+        aEmergencyNumber, 
+        isEmergency );
+            
+    return error ? EFalse : isEmergency;
+    }    
+
+// -----------------------------------------------------------------------------
+// CPhoneParserFeatures::GetTelephoneVariant
+// -----------------------------------------------------------------------------
+//
+TInt CPhoneParserFeatures::GetTelephoneVariant()
+    {
+    TInt telephoneVariant;
+    TInt err = iRepository->Get( KTelSrvVariationFlags, telephoneVariant );
+    return err == KErrNone ? telephoneVariant : 0;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneParserFeatures::FeatureSupported
+// -----------------------------------------------------------------------------
+// 
+TBool CPhoneParserFeatures::FeatureSupported( TInt aFeature )
+    {
+    return Instance() ? Instance()->IsFeatureSupported( aFeature ) : EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneParserFeatures::IsFeatureSupported
+// -----------------------------------------------------------------------------
+// 
+TBool CPhoneParserFeatures::IsFeatureSupported( TInt aFeature )
+    {
+    return FeatureManager::FeatureSupported( aFeature );
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/src/cphonevoipnumberhandler.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Handler for voip numbers.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "cphonevoipnumberhandler.h" 
+#include    "cphonevoipnumberparser.h" 
+#include    "cphonegsmparserresult.h" 
+
+// CONSTANTS
+const TInt KPhoneVoipNumberDialParam = 0;
+const TInt KPhoneVoipNumberPostfixParam = 1;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneVoipNumberHandler::ProcessL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CPhoneVoipNumberHandler::ProcessL( 
+            CPhoneGsmParserResult& aResult )
+    {
+    if ( aResult.Uid() == KPhoneUidVoipNumber )
+        {
+        TPtrC number( aResult.ParameterAt( KPhoneVoipNumberDialParam ) );
+        TPtrC postfix( aResult.ParameterAt( KPhoneVoipNumberPostfixParam ) );
+        ProcessDialToVoipNumberL( number, postfix );
+        }
+    }   
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/src/cphonevoipnumberparser.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,187 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Parser for emergency numbers.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "cphonevoipnumberparser.h" 
+#include    "cphonegsmparserresult.h" 
+#include    "cphonegsmoptioncontainer.h" 
+#include    "phoneparsercommon.h" 
+
+// CONSTANTS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPhoneVoipNumberParser::CPhoneVoipNumberParser
+// -----------------------------------------------------------------------------
+//
+CPhoneVoipNumberParser::CPhoneVoipNumberParser()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneVoipNumberParser::NewLC
+// -----------------------------------------------------------------------------
+//
+CPhoneVoipNumberParser* CPhoneVoipNumberParser::NewLC()
+    {
+    CPhoneVoipNumberParser* self = 
+        new ( ELeave ) CPhoneVoipNumberParser;
+    
+    CleanupStack::PushL( self );
+        
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneVoipNumberParser::ParseL
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneVoipNumberParser::ParseL( 
+        const TDesC& aString,
+        CPhoneGsmParserResult& aResult,
+        CPhoneGsmOptionContainerBase& aOptions )
+    {
+    aResult.ClearL();
+
+    TBool result = DoParseL( 
+            aString,
+            aResult,
+            static_cast<CPhoneGsmOptionContainer&>( aOptions ) );
+
+    if ( !result )
+        {
+        aResult.ClearL();
+        }
+
+    return result;
+    }
+    
+// -----------------------------------------------------------------------------
+// CPhoneVoipNumberParser::DoParseL
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneVoipNumberParser::DoParseL( 
+        const TDesC& aString,
+        CPhoneGsmParserResult& aResult,
+        CPhoneGsmOptionContainer& aOptions )
+    {
+    TBool result( EFalse );
+
+    if ( aOptions.FindOptionStatus( KPhoneOptionSend ) )
+        {
+        if ( aOptions.FindOptionStatus( KPhoneOptionVoipCall ) &&
+             aString.Length() )
+            {
+            TLex input( aString );
+            
+            // Take number part and put it to first parameter of the aResult.
+            TakeNumberPartL( input, aResult );       
+            // Take rest of string( postfix part ) to next parameter of the result.
+            TakeDtmfPostfixL( input, aResult );
+
+            aResult.SetUid( KPhoneUidVoipNumber );
+            result = ETrue;
+            }
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneVoipNumberParser::TakeNumberPartL
+// 
+// Take the main part of the phone number and add it to result.
+// -----------------------------------------------------------------------------
+//
+void CPhoneVoipNumberParser::TakeNumberPartL(
+        TLex& aLex,
+        CPhoneGsmParserResult& aResult )
+    {
+    TLexMark start;
+    aLex.Mark( start );
+    TBool allDigits = ETrue;
+    TBool dtmfFound = EFalse;
+    
+    while ( !aLex.Eos() &&
+            !dtmfFound )
+        {
+        TChar nextChar = aLex.Peek().GetLowerCase();
+        if ( allDigits &&
+            ( KPhoneDtmfPause == nextChar ||
+              KPhoneDtmfWait == nextChar ||
+              KPhonePlus == nextChar ) )
+            {
+            // Dtmf string is always postfixed if present
+            if ( aLex.Offset() > 0 )
+                {
+                // Check if rest of the string is valid dtmf string
+                TPtrC remainder( aLex.Remainder() );
+                if ( IsValidDtmfString( remainder ) )
+                    {
+                    dtmfFound = ETrue;     
+                    }
+                }
+            }
+        
+        if ( !dtmfFound )
+            {
+            if ( !nextChar.IsDigit() )
+                {
+                allDigits = EFalse;
+                }
+            aLex.Inc();
+            }
+        }
+    
+    // Add main part of the number to the parsing result
+    TPtrC mainpart( aLex.MarkedToken( start ) );
+    aResult.AddParameterL( mainpart );   
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneVoipNumberParser::TakeDtmfPostfixL
+// -----------------------------------------------------------------------------
+//
+void CPhoneVoipNumberParser::TakeDtmfPostfixL(
+        TLex& aLex,
+        CPhoneGsmParserResult& aResult )
+    {
+    // Add rest of string( after TLex16::iNext ) to result.
+    aResult.AddParameterL( aLex.Remainder() );
+    }
+
+// -----------------------------------------------------------------------------
+// CPhoneVoipNumberParser::IsValidDtmfString
+// -----------------------------------------------------------------------------
+//
+TBool CPhoneVoipNumberParser::IsValidDtmfString( TPtrC& aString )
+    { 
+    TBool validDtmf = ETrue;
+    // Check that string contains only valid dtmf characters
+    for( TInt i = 0; i < aString.Length(); i++ )
+        {
+        if ( KErrNotFound == KValidDtmfChars().Locate( aString[i] ) )
+            {
+            validDtmf = EFalse;
+            break;
+            }      
+        }
+    return validDtmf;
+    }
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telutils/phoneparser/src/phonegsmparser.cpp	Wed Jul 21 18:26:52 2010 +0300
@@ -0,0 +1,375 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 functions for clients.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "phonegsmparser.h" 
+#include    "cphonegsmparser.h" 
+#include    "cphonegsmparserbase.h" 
+#include    "cphonegsmparserresult.h" 
+#include    "cphonegsmoptioncontainer.h" 
+
+#include    "cphonegsmparsercontainer.h" 
+#include    "cphonegsmssparser.h" 
+#include    "cphonegsmsimcontrolparser.h" 
+#include    "cphonegsmphonenumberparser.h" 
+#include    "cphonegsmsscallparser.h" 
+#include    "cphonegsmmanufacturerparser.h" 
+#include    "cphonegsmpcnprocedureparser.h" 
+#include    "cphonegsmmanufacturerhandler.h" 
+#include    "cphonegsmemergencynumberparser.h" 
+#include    "cphoneparserfeatures.h" 
+#include    "cphonevoipnumberparser.h" 
+
+// CONSTANTS
+const TInt KPhoneParserResultParameterReserver = 10;
+_LIT( KPhoneParserPanic, "PhoneParser" );
+
+// Software version display code
+_LIT( KPhoneCodeBadPinChange, "**04*" );
+_LIT( KPhoneCodeBadPin2Change, "**042*" );
+_LIT( KPhoneCodeBadPinUnblock, "**05*" );
+_LIT( KPhoneCodeBadPin2Unblock, "**052*" );
+_LIT( KPhoneCodeActivateRfsNormal, "*#7780#" );
+_LIT( KPhoneCodeActivateRfsDeep, "*#7370#" );
+_LIT( KPhoneCodeBtAddress, "*#2820#" );
+_LIT( KPhoneCodeRFLoopback, "*#9990#" );
+_LIT( KPhoneCodeWLANMAC, "*#62209526#" );
+_LIT( KPhoneCodeBtDebugMode, "*#2873#" );
+                  
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// PhoneGsmParser::CreateParserL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CPhoneGsmParserBase* PhoneGsmParser::CreateParserL()
+    {
+    // 1. SS CONTAINER TO STACK
+    CPhoneGsmParserContainer* ssContainer =
+        CPhoneGsmParserContainer::NewLC();
+
+    CPhoneGsmParserBase* ssProcedure = 
+        CPhoneGsmSsParser::NewLC();
+    ssContainer->AddL( *ssProcedure );
+    CleanupStack::Pop( ssProcedure );
+
+    CPhoneGsmParserBase* ssCallProcedure =
+        CPhoneGsmSsCallParser::NewLC();
+    ssContainer->AddL( *ssCallProcedure );
+    CleanupStack::Pop( ssCallProcedure );
+    
+    // 2. SIM CONTROL PROCEDURE TO STACK
+    CPhoneGsmParserBase* simControlProcedure = 
+        CPhoneGsmSimControlParser::NewLC();
+   
+    // 3. PHONE NUMBER TO STACK
+    CPhoneGsmParserBase* phoneNumber =
+        CPhoneGsmPhoneNumberParser::NewLC();
+
+    // 4. MANUFACTURER SPECIFIC TO STACK
+    CPhoneGsmParserBase* manufacturerSpecific = 
+        CreateManufacturerProcedureParserLC();
+        
+    // 5. EMERGENCY NUMBER PARSER TO STACK
+    CPhoneGsmParserBase* emergencyNumberParser =
+        CPhoneGsmEmergencyNumberParser::NewLC();
+        
+    // 6. VOIP NUMBER PARSER TO STACK
+    CPhoneGsmParserBase* voipNumberParser =
+        CPhoneVoipNumberParser::NewLC();
+    
+    CPhoneGsmParser* parser = 
+        CPhoneGsmParser::NewL(
+            ssContainer, 
+            simControlProcedure,
+            phoneNumber,
+            manufacturerSpecific,
+            emergencyNumberParser,
+            voipNumberParser);
+
+    CleanupStack::Pop( 6, ssContainer );
+
+    return parser;
+    }
+
+// -----------------------------------------------------------------------------
+// PhoneGsmParser::UseFeatureStub
+// -----------------------------------------------------------------------------
+//
+#ifdef __WINS__
+EXPORT_C void PhoneGsmParser::UseFeatureStub( CPhoneParserFeatures* aStub )
+    {
+    CPhoneParserFeatures::SetInstance( aStub );
+    }
+#endif // __WINS__
+
+// -----------------------------------------------------------------------------
+// PhoneGsmParser::CreateResultsL
+//
+// Create parser so that AddParameterL shouldn't leave.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CPhoneGsmParserResult* PhoneGsmParser::CreateResultL()
+    {
+    CPhoneGsmParserResult* result = CPhoneGsmParserResult::NewL();
+    
+    CleanupStack::PushL( result );
+    result->ReserveParametersL( KPhoneParserResultParameterReserver );
+    CleanupStack::Pop( result );
+
+    result->ClearL();
+    return result;
+    }
+
+
+// -----------------------------------------------------------------------------
+// PhoneGsmParser::CreateOptionContainerL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CPhoneGsmOptionContainerBase* PhoneGsmParser::CreateOptionContainerL()
+    {
+    CPhoneGsmOptionContainer* options =
+        CPhoneGsmOptionContainer::NewL();
+    
+    CleanupStack::PushL( options );
+
+    DefineOptionsL( *options );
+    InitialiseOptionsToDefaultValues( *options );
+
+    CleanupStack::Pop( options );
+    return options;
+    }
+
+
+// -----------------------------------------------------------------------------
+// PhoneGsmParser::InitialiseOptionsToDefaultValues
+// -----------------------------------------------------------------------------
+//
+void PhoneGsmParser::InitialiseOptionsToDefaultValues( 
+        CPhoneGsmOptionContainerBase& aOptions )
+    {
+    aOptions.SetOptionStatus( KPhoneOptionSend, EFalse );
+    aOptions.SetOptionStatus( KPhoneOptionInCall, EFalse );
+    aOptions.SetOptionStatus( KPhoneOptionVoipCall, EFalse );
+    }
+
+// -----------------------------------------------------------------------------
+// PhoneGsmParser::DetermineContentType
+//
+// It is helper method to categorize processed strings.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C PhoneGsmParser::TContentType 
+    PhoneGsmParser::DetermineContentType( 
+        const CPhoneGsmParserResult& aResult )
+    {
+    TContentType type = EContentUnknown;
+    TUint uid = aResult.Uid();
+    TUint main = PHONE_EXTRACT_MAIN( aResult.Uid() );
+
+    switch ( main )
+        {
+        case KPhoneGsmUidInvalid:
+            type = EContentInvalid;
+            break;
+
+        case KPhoneGsmUidMisc:
+            if ( uid == KPhoneUidUnstructuredService )
+                {
+                type = EContentUnstructuredService;
+                }
+            break;
+
+        case KPhoneGsmUidSupplementaryService:
+        case KPhoneGsmUidSupplementaryServiceDuringCall:
+            type = EContentSupplementaryService;
+            break;
+
+        case KPhoneGsmUidDialPhoneNumber:
+            type = EContentPhoneNumber;
+            break;
+
+        default:
+            break;
+        }
+
+    return type;
+    }
+
+// -----------------------------------------------------------------------------
+// PhoneGsmParser::IsAllowedForArriving
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool PhoneGsmParser::IsAllowedForArriving(
+        const CPhoneGsmParserResult& aResult )
+    {  
+    TUint32 uid = aResult.Uid();
+    
+    // Allowed:
+    //      0 SEND
+    //      All manufacturer codes
+    //      All sim control procedures
+    //      All pcn procedures
+    
+    return ( uid == KPhoneUidCommand0 ||
+             uid == KPhoneUidManufacturerDebugCode ||
+             uid == KPhoneUidManufacturerCode || 
+             PHONE_EXTRACT_MAIN( uid ) == KPhoneGsmUidSimControlProcedure ||
+             PHONE_EXTRACT_MAIN( uid ) == KPhoneGsmUidPcnProcedures );
+    }
+
+// -----------------------------------------------------------------------------
+// PhoneGsmParser::IsAllowedForBadSim
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool PhoneGsmParser::IsAllowedForBadSim(
+        const CPhoneGsmParserResult& aResult )
+    {
+    TUint32 uid = aResult.Uid();
+    TUint aux = aResult.AuxInformation();
+
+    // Allowed:
+    //      DialEmergency
+    //      Some manufacturer codes
+    //      All sim control procedures
+    //      All pcn procedures
+    
+    return ( uid == KPhoneUidEmergencyNumber ||
+             uid == KPhoneUidManufacturerDebugCode ||
+             ( uid == KPhoneUidManufacturerCode && 
+               ( aux == CPhoneGsmManufacturerHandler::EBadPinChange ||
+                 aux == CPhoneGsmManufacturerHandler::EBadPin2Change ||
+                 aux == CPhoneGsmManufacturerHandler::EBadPinUnblock ||
+                 aux == CPhoneGsmManufacturerHandler::EBadPin2Unblock ) ) ||
+
+             PHONE_EXTRACT_MAIN( uid ) == KPhoneGsmUidSimControlProcedure ||
+             PHONE_EXTRACT_MAIN( uid ) == KPhoneGsmUidPcnProcedures );
+    }
+
+// -----------------------------------------------------------------------------
+// PhoneGsmParser::Panic
+//
+// Panic for phone parser.
+// -----------------------------------------------------------------------------
+//
+void PhoneGsmParser::Panic( 
+        TPanicReason aReason )
+    {
+    User::Panic( KPhoneParserPanic, aReason );
+    }
+
+// -----------------------------------------------------------------------------
+// PhoneGsmParser::DefineOptionsL
+// -----------------------------------------------------------------------------
+//
+void PhoneGsmParser::DefineOptionsL( 
+        CPhoneGsmOptionContainerBase& aOptions )
+    {
+    CPhoneGsmOptionContainer& options =
+            static_cast<CPhoneGsmOptionContainer&>( aOptions );
+    
+    options.DefineOptionL( KPhoneOptionSend, EFalse );
+    options.DefineOptionL( KPhoneOptionInCall, EFalse );
+    options.DefineOptionL( KPhoneOptionVoipCall, EFalse );
+    }
+
+// -----------------------------------------------------------------------------
+// PhoneGsmParser::CreateManufacturerProcedureParserLC
+// -----------------------------------------------------------------------------
+//
+CPhoneGsmParserBase* 
+    PhoneGsmParser::CreateManufacturerProcedureParserLC()
+    {
+    // CONTAINER TO STACK.
+    CPhoneGsmParserContainer* manufacturer =
+        CPhoneGsmParserContainer::NewLC();
+
+    CPhoneGsmPcnProcedureParser* gsmPcnCodes =
+        CPhoneGsmPcnProcedureParser::NewLC();
+    manufacturer->AddL( *gsmPcnCodes );
+    CleanupStack::Pop( gsmPcnCodes );
+
+    CPhoneGsmManufacturerParser* manuCodes =
+        CPhoneGsmManufacturerParser::NewLC();
+    manufacturer->AddL( *manuCodes );
+    CleanupStack::Pop( manuCodes );
+
+    manuCodes->AddStringL( 
+        KPhoneCodeBadPinChange,
+        CPhoneGsmManufacturerParser::EFlagCode + 
+        CPhoneGsmManufacturerParser::EFlagPrefix,
+        CPhoneGsmManufacturerHandler::EBadPinChange );
+
+    manuCodes->AddStringL( 
+        KPhoneCodeBadPin2Change,
+        CPhoneGsmManufacturerParser::EFlagCode + 
+        CPhoneGsmManufacturerParser::EFlagPrefix,
+        CPhoneGsmManufacturerHandler::EBadPin2Change );
+
+    manuCodes->AddStringL( 
+        KPhoneCodeBadPinUnblock,
+        CPhoneGsmManufacturerParser::EFlagCode + 
+        CPhoneGsmManufacturerParser::EFlagPrefix,
+        CPhoneGsmManufacturerHandler::EBadPinUnblock );
+
+    manuCodes->AddStringL( 
+        KPhoneCodeBadPin2Unblock,
+        CPhoneGsmManufacturerParser::EFlagCode + 
+        CPhoneGsmManufacturerParser::EFlagPrefix,
+        CPhoneGsmManufacturerHandler::EBadPin2Unblock );
+
+    manuCodes->AddStringL(
+        KPhoneCodeActivateRfsNormal,
+        CPhoneGsmManufacturerParser::EFlagCode,
+        CPhoneGsmManufacturerHandler::EActivateRfsNormal );
+
+    manuCodes->AddStringL(
+        KPhoneCodeActivateRfsDeep,
+        CPhoneGsmManufacturerParser::EFlagCode,
+        CPhoneGsmManufacturerHandler::EActivateRfsDeep );
+
+    manuCodes->AddStringL(
+        KPhoneCodeBtAddress,
+        CPhoneGsmManufacturerParser::EFlagCode,
+        CPhoneGsmManufacturerHandler::EShowBtAddress,
+        KFeatureIdBt );
+
+    manuCodes->AddStringL(
+        KPhoneCodeWLANMAC, 
+        CPhoneGsmManufacturerParser::EFlagCode,
+        CPhoneGsmManufacturerHandler::EShowWlanMac,
+        KFeatureIdProtocolWlan );       
+
+    manuCodes->AddStringL( 
+        KPhoneCodeRFLoopback,
+        CPhoneGsmManufacturerParser::EFlagCode,
+        CPhoneGsmManufacturerHandler::EBTLoopback,
+        KFeatureIdBtTestMode );
+
+    manuCodes->AddStringL( 
+        KPhoneCodeBtDebugMode,
+        CPhoneGsmManufacturerParser::EFlagCode,
+        CPhoneGsmManufacturerHandler::EBTDebugMode,
+        KFeatureIdBt );
+
+    return manufacturer;
+    }
+
+//  End of File  
Binary file vmbx/vmbxengine/conf/CI_voicemailbox.confml has changed
Binary file vmbx/vmbxengine/conf/voicemailbox.confml has changed
--- a/vmbx/vmbxengine/vmbxengine.pro	Tue Jul 06 14:53:02 2010 +0300
+++ b/vmbx/vmbxengine/vmbxengine.pro	Wed Jul 21 18:26:52 2010 +0300
@@ -116,14 +116,16 @@
     
     MMP_RULES += defFiles
 
-    BLD_INF_RULES.prj_exports += "rom/backup_registration.xml /epoc32/data/z/private/100058F5/backup_registration.xml" \
-                                 "conf/CI_voicemailbox.confml         MW_LAYER_CONFML(CI_voicemailbox.confml)" \
-                                 "conf/voicemailbox_101F874F.crml  MW_LAYER_CRML(voicemailbox_101F874F.crml)" \
-                                 "rom/backup_registration.xml   /epoc32/release/winscw/udeb/z/private/100058F5/backup_registration.xml" \
-                                 "rom/backup_registration.xml   /epoc32/release/winscw/urel/z/private/100058F5/backup_registration.xml" \
-                                 "rom/vmbxengine_stub.sis /epoc32/data/z/system/install/vmbxengine_stub.sis" \
-                                 "rom/vmbxengine.iby CORE_MW_LAYER_IBY_EXPORT_PATH(vmbxengine.iby)" \
-                                 "rom/vmbxresources.iby       LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(vmbxresources.iby)"
-TRANSLATIONS = vmbx.ts
+    BLD_INF_RULES.prj_exports += \
+        "rom/backup_registration.xml /epoc32/data/z/private/100058F5/backup_registration.xml" \
+        "conf/voicemailbox.confml         MW_LAYER_CONFML(voicemailbox.confml)" \
+        "conf/voicemailbox_101F874F.crml  MW_LAYER_CRML(voicemailbox_101F874F.crml)" \
+        "rom/backup_registration.xml   /epoc32/release/winscw/udeb/z/private/100058F5/backup_registration.xml" \
+        "rom/backup_registration.xml   /epoc32/release/winscw/urel/z/private/100058F5/backup_registration.xml" \
+        "rom/vmbxengine_stub.sis /epoc32/data/z/system/install/vmbxengine_stub.sis" \
+        "rom/vmbxengine.iby CORE_MW_LAYER_IBY_EXPORT_PATH(vmbxengine.iby)" \
+        "rom/vmbxresources.iby       LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(vmbxresources.iby)"
+
+    TRANSLATIONS = vmbx.ts
 
 }